From solipsis at pitrou.net Fri Sep 1 05:06:35 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 01 Sep 2017 09:06:35 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=12 Message-ID: <20170901090633.124791.FDBC62D3E5F1176A@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 2, -1] memory blocks, sum=1 test_multiprocessing_forkserver leaked [1, 1, -2] memory blocks, sum=0 test_multiprocessing_spawn leaked [-2, 1, 1] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog5Uwpcz', '--timeout', '7200'] From webhook-mailer at python.org Fri Sep 1 07:05:30 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 11:05:30 -0000 Subject: [Python-checkins] bpo-31217: Fix regrtest -R for small integer (#3260) Message-ID: https://github.com/python/cpython/commit/6c2feabc5dac2f3049b15134669e9ad5af573193 commit: 6c2feabc5dac2f3049b15134669e9ad5af573193 branch: master author: Victor Stinner committer: GitHub date: 2017-09-01T13:05:27+02:00 summary: bpo-31217: Fix regrtest -R for small integer (#3260) Use a pool of integer objects toprevent false alarm when checking for memory block leaks. Fill the pool with values in -1000..1000 which are the most common (reference, memory block, file descriptor) differences. Co-Authored-By: Antoine Pitrou files: M Lib/test/libregrtest/refleak.py diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py index efe52107cb4..18d5bd0511a 100644 --- a/Lib/test/libregrtest/refleak.py +++ b/Lib/test/libregrtest/refleak.py @@ -38,6 +38,14 @@ def dash_R(the_module, test, indirect_test, huntrleaks): for obj in abc.__subclasses__() + [abc]: abcs[obj] = obj._abc_registry.copy() + # bpo-31217: Integer pool to get a single integer object for the same + # value. The pool is used to prevent false alarm when checking for memory + # block leaks. Fill the pool with values in -1000..1000 which are the most + # common (reference, memory block, file descriptor) differences. + int_pool = {value: value for value in range(-1000, 1000)} + def get_pooled_int(value): + return int_pool.setdefault(value, value) + nwarmup, ntracked, fname = huntrleaks fname = os.path.join(support.SAVEDCWD, fname) repcount = nwarmup + ntracked @@ -56,9 +64,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks): abcs) print('.', end='', file=sys.stderr, flush=True) if i >= nwarmup: - rc_deltas[i] = rc_after - rc_before - alloc_deltas[i] = alloc_after - alloc_before - fd_deltas[i] = fd_after - fd_before + rc_deltas[i] = get_pooled_int(rc_after - rc_before) + alloc_deltas[i] = get_pooled_int(alloc_after - alloc_before) + fd_deltas[i] = get_pooled_int(fd_after - fd_before) alloc_before = alloc_after rc_before = rc_after fd_before = fd_after From webhook-mailer at python.org Fri Sep 1 08:46:09 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 12:46:09 -0000 Subject: [Python-checkins] bpo-31250, test_asyncio: fix dangling threads (#3252) Message-ID: https://github.com/python/cpython/commit/16432beadb8eba079c9786cc0c0eaacfd9fd2f7b commit: 16432beadb8eba079c9786cc0c0eaacfd9fd2f7b branch: master author: Victor Stinner committer: GitHub date: 2017-09-01T14:46:06+02:00 summary: bpo-31250, test_asyncio: fix dangling threads (#3252) * Explicitly call shutdown(wait=True) on executors to wait until all threads complete to prevent side effects between tests. * Fix test_loop_self_reading_exception(): don't mock loop.close(). Previously, the original close() method was called rather than the mock, because how set_event_loop() registered loop.close(). files: M Lib/asyncio/test_utils.py M Lib/test/test_asyncio/test_futures.py M Lib/test/test_asyncio/test_proactor_events.py diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index 15059501070..ecb3fca097b 100644 --- a/Lib/asyncio/test_utils.py +++ b/Lib/asyncio/test_utils.py @@ -437,12 +437,19 @@ def get_function_source(func): class TestCase(unittest.TestCase): + @staticmethod + def close_loop(loop): + executor = loop._default_executor + if executor is not None: + executor.shutdown(wait=True) + loop.close() + def set_event_loop(self, loop, *, cleanup=True): assert loop is not None # ensure that the event loop is passed explicitly in asyncio events.set_event_loop(None) if cleanup: - self.addCleanup(loop.close) + self.addCleanup(self.close_loop, loop) def new_test_loop(self, gen=None): loop = TestLoop(gen) diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ebedfec7fa3..f8f614f1c30 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -380,6 +380,7 @@ def run(arg): self.assertTrue(asyncio.isfuture(f2)) self.assertEqual(res, 'oi') self.assertNotEqual(ident, threading.get_ident()) + ex.shutdown(wait=True) def test_wrap_future_future(self): f1 = self._new_future(loop=self.loop) @@ -395,6 +396,7 @@ def run(arg): f1 = ex.submit(run, 'oi') f2 = asyncio.wrap_future(f1) self.assertIs(self.loop, f2._loop) + ex.shutdown(wait=True) def test_wrap_future_cancel(self): f1 = concurrent.futures.Future() diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py index 4dfc61259f8..d76da661ab9 100644 --- a/Lib/test/test_asyncio/test_proactor_events.py +++ b/Lib/test/test_asyncio/test_proactor_events.py @@ -529,7 +529,6 @@ def test_loop_self_reading_fut(self): self.loop._loop_self_reading) def test_loop_self_reading_exception(self): - self.loop.close = mock.Mock() self.loop.call_exception_handler = mock.Mock() self.proactor.recv.side_effect = OSError() self.loop._loop_self_reading() From webhook-mailer at python.org Fri Sep 1 08:46:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 12:46:47 -0000 Subject: [Python-checkins] bpo-31249: Fix ref cycle in ThreadPoolExecutor (#3253) Message-ID: https://github.com/python/cpython/commit/60f3f1fb5cbf5354c3081138be806c56cb04153f commit: 60f3f1fb5cbf5354c3081138be806c56cb04153f branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-01T14:46:44+02:00 summary: bpo-31249: Fix ref cycle in ThreadPoolExecutor (#3253) [3.6] bpo-31249: Fix ref cycle in ThreadPoolExecutor files: A Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst M Lib/concurrent/futures/thread.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/thread.py b/Lib/concurrent/futures/thread.py index 03d276b63f6..5ade790e3db 100644 --- a/Lib/concurrent/futures/thread.py +++ b/Lib/concurrent/futures/thread.py @@ -53,8 +53,10 @@ def run(self): try: result = self.fn(*self.args, **self.kwargs) - except BaseException as e: - self.future.set_exception(e) + except BaseException as exc: + self.future.set_exception(exc) + # Break a reference cycle with the exception 'exc' + self = None else: self.future.set_result(result) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 92a3ebdd886..90dec61814c 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -59,11 +59,20 @@ def my_method(self): pass +class BaseTestCase(unittest.TestCase): + def setUp(self): + self._thread_key = test.support.threading_setup() + + def tearDown(self): + test.support.reap_children() + test.support.threading_cleanup(*self._thread_key) + + class ExecutorMixin: worker_count = 5 def setUp(self): - self._thread_cleanup = test.support.threading_setup() + super().setUp() self.t1 = time.time() try: @@ -81,8 +90,7 @@ def tearDown(self): print("%.2fs" % dt, end=' ') self.assertLess(dt, 60, "synchronization issue: test lasted too long") - test.support.threading_cleanup(*self._thread_cleanup) - test.support.reap_children() + super().tearDown() def _prime_executor(self): # Make sure that the executor is ready to do work before running the @@ -130,7 +138,7 @@ def test_hang_issue12364(self): f.result() -class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest, unittest.TestCase): +class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest, BaseTestCase): def _prime_executor(self): pass @@ -186,7 +194,7 @@ def test_thread_names_default(self): t.join() -class ProcessPoolShutdownTest(ProcessPoolMixin, ExecutorShutdownTest, unittest.TestCase): +class ProcessPoolShutdownTest(ProcessPoolMixin, ExecutorShutdownTest, BaseTestCase): def _prime_executor(self): pass @@ -323,7 +331,7 @@ def test_timeout(self): self.assertEqual(set([future2]), pending) -class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests, unittest.TestCase): +class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests, BaseTestCase): def test_pending_calls_race(self): # Issue #14406: multi-threaded race condition when waiting on all @@ -341,7 +349,7 @@ def future_func(): sys.setswitchinterval(oldswitchinterval) -class ProcessPoolWaitTests(ProcessPoolMixin, WaitTests, unittest.TestCase): +class ProcessPoolWaitTests(ProcessPoolMixin, WaitTests, BaseTestCase): pass @@ -390,11 +398,11 @@ def test_duplicate_futures(self): self.assertEqual(len(completed), 1) -class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, unittest.TestCase): +class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, BaseTestCase): pass -class ProcessPoolAsCompletedTests(ProcessPoolMixin, AsCompletedTests, unittest.TestCase): +class ProcessPoolAsCompletedTests(ProcessPoolMixin, AsCompletedTests, BaseTestCase): pass @@ -465,7 +473,7 @@ def test_max_workers_negative(self): self.executor_type(max_workers=number) -class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, unittest.TestCase): +class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, BaseTestCase): def test_map_submits_without_iteration(self): """Tests verifying issue 11777.""" finished = [] @@ -482,7 +490,7 @@ def test_default_workers(self): (os.cpu_count() or 1) * 5) -class ProcessPoolExecutorTest(ProcessPoolMixin, ExecutorTest, unittest.TestCase): +class ProcessPoolExecutorTest(ProcessPoolMixin, ExecutorTest, BaseTestCase): def test_killed_child(self): # When a child process is abruptly terminated, the whole pool gets # "broken". @@ -538,7 +546,7 @@ def test_traceback(self): f1.getvalue()) -class FutureTests(unittest.TestCase): +class FutureTests(BaseTestCase): def test_done_callback_with_result(self): callback_result = None def fn(callback_future): diff --git a/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst b/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst new file mode 100644 index 00000000000..f11a66802d1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst @@ -0,0 +1,2 @@ +concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now breaks a +reference cycle between an exception object and the WorkItem object. From webhook-mailer at python.org Fri Sep 1 09:04:50 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 13:04:50 -0000 Subject: [Python-checkins] bpo-31217: Fix regrtest -R for small integer (#3260) (#3261) Message-ID: https://github.com/python/cpython/commit/98c849a2f32f6727239b4cce38b8f0ff8adeef22 commit: 98c849a2f32f6727239b4cce38b8f0ff8adeef22 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-01T15:04:47+02:00 summary: bpo-31217: Fix regrtest -R for small integer (#3260) (#3261) Use a pool of integer objects toprevent false alarm when checking for memory block leaks. Fill the pool with values in -1000..1000 which are the most common (reference, memory block, file descriptor) differences. Co-Authored-By: Antoine Pitrou (cherry picked from commit 6c2feabc5dac2f3049b15134669e9ad5af573193) files: M Lib/test/libregrtest/refleak.py diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py index 8e93816d965..0bd8288e276 100644 --- a/Lib/test/libregrtest/refleak.py +++ b/Lib/test/libregrtest/refleak.py @@ -68,6 +68,14 @@ def dash_R(the_module, test, indirect_test, huntrleaks): for obj in abc.__subclasses__() + [abc]: abcs[obj] = obj._abc_registry.copy() + # bpo-31217: Integer pool to get a single integer object for the same + # value. The pool is used to prevent false alarm when checking for memory + # block leaks. Fill the pool with values in -1000..1000 which are the most + # common (reference, memory block, file descriptor) differences. + int_pool = {value: value for value in range(-1000, 1000)} + def get_pooled_int(value): + return int_pool.setdefault(value, value) + nwarmup, ntracked, fname = huntrleaks fname = os.path.join(support.SAVEDCWD, fname) repcount = nwarmup + ntracked @@ -86,9 +94,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks): abcs) print('.', end='', file=sys.stderr, flush=True) if i >= nwarmup: - rc_deltas[i] = rc_after - rc_before - alloc_deltas[i] = alloc_after - alloc_before - fd_deltas[i] = fd_after - fd_before + rc_deltas[i] = get_pooled_int(rc_after - rc_before) + alloc_deltas[i] = get_pooled_int(alloc_after - alloc_before) + fd_deltas[i] = get_pooled_int(fd_after - fd_before) alloc_before = alloc_after rc_before = rc_after fd_before = fd_after From webhook-mailer at python.org Fri Sep 1 12:54:03 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Fri, 01 Sep 2017 16:54:03 -0000 Subject: [Python-checkins] bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (#1560) Message-ID: https://github.com/python/cpython/commit/97e1b1c81458d2109b2ffed32ffa1eb643a6c3b9 commit: 97e1b1c81458d2109b2ffed32ffa1eb643a6c3b9 branch: master author: Grzegorz Grzywacz committer: Antoine Pitrou date: 2017-09-01T18:54:00+02:00 summary: bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (#1560) * bpo-27144: concurrent.futures as_complie and map iterators do not keep reference to returned object * Some nits. Improve wordings in docstrings and comments, and avoid relying on sys.getrefcount() in tests. files: A Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst M Lib/concurrent/futures/_base.py M Lib/concurrent/futures/process.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py index 295489c93e5..88521ae317e 100644 --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -170,6 +170,20 @@ def _create_and_install_waiters(fs, return_when): return waiter + +def _yield_and_decref(fs, ref_collect): + """ + Iterate on the list *fs*, yielding objects one by one in reverse order. + Before yielding an object, it is removed from each set in + the collection of sets *ref_collect*. + """ + while fs: + for futures_set in ref_collect: + futures_set.remove(fs[-1]) + # Careful not to keep a reference to the popped value + yield fs.pop() + + def as_completed(fs, timeout=None): """An iterator over the given futures that yields each as it completes. @@ -191,6 +205,8 @@ def as_completed(fs, timeout=None): if timeout is not None: end_time = timeout + time.time() + total_futures = len(fs) + fs = set(fs) with _AcquireFutures(fs): finished = set( @@ -198,9 +214,9 @@ def as_completed(fs, timeout=None): if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]) pending = fs - finished waiter = _create_and_install_waiters(fs, _AS_COMPLETED) - + finished = list(finished) try: - yield from finished + yield from _yield_and_decref(finished, ref_collect=(fs,)) while pending: if timeout is None: @@ -210,7 +226,7 @@ def as_completed(fs, timeout=None): if wait_timeout < 0: raise TimeoutError( '%d (of %d) futures unfinished' % ( - len(pending), len(fs))) + len(pending), total_futures)) waiter.event.wait(wait_timeout) @@ -219,9 +235,9 @@ def as_completed(fs, timeout=None): waiter.finished_futures = [] waiter.event.clear() - for future in finished: - yield future - pending.remove(future) + # reverse to keep finishing order + finished.reverse() + yield from _yield_and_decref(finished, ref_collect=(fs, pending)) finally: for f in fs: @@ -551,11 +567,14 @@ def map(self, fn, *iterables, timeout=None, chunksize=1): # before the first iterator value is required. def result_iterator(): try: - for future in fs: + # reverse to keep finishing order + fs.reverse() + while fs: + # Careful not to keep a reference to the popped future if timeout is None: - yield future.result() + yield fs.pop().result() else: - yield future.result(end_time - time.time()) + yield fs.pop().result(end_time - time.time()) finally: for future in fs: future.cancel() diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 8f1d714193a..03b28ab5d68 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -357,6 +357,18 @@ def _check_system_limits(): raise NotImplementedError(_system_limited) +def _chain_from_iterable_of_lists(iterable): + """ + Specialized implementation of itertools.chain.from_iterable. + Each item in *iterable* should be a list. This function is + careful not to keep references to yielded objects. + """ + for element in iterable: + element.reverse() + while element: + yield element.pop() + + class BrokenProcessPool(RuntimeError): """ Raised when a process in a ProcessPoolExecutor terminated abruptly @@ -482,7 +494,7 @@ def map(self, fn, *iterables, timeout=None, chunksize=1): results = super().map(partial(_process_chunk, fn), _get_chunks(*iterables, chunksize=chunksize), timeout=timeout) - return itertools.chain.from_iterable(results) + return _chain_from_iterable_of_lists(results) def shutdown(self, wait=True): with self._shutdown_lock: diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index ebc30a49e5e..f1226fe7090 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -59,6 +59,10 @@ def my_method(self): pass +def make_dummy_object(_): + return MyObject() + + class BaseTestCase(unittest.TestCase): def setUp(self): self._thread_key = test.support.threading_setup() @@ -396,6 +400,38 @@ def test_duplicate_futures(self): completed = [f for f in futures.as_completed([future1,future1])] self.assertEqual(len(completed), 1) + def test_free_reference_yielded_future(self): + # Issue #14406: Generator should not keep references + # to finished futures. + futures_list = [Future() for _ in range(8)] + futures_list.append(create_future(state=CANCELLED_AND_NOTIFIED)) + futures_list.append(create_future(state=SUCCESSFUL_FUTURE)) + + with self.assertRaises(futures.TimeoutError): + for future in futures.as_completed(futures_list, timeout=0): + futures_list.remove(future) + wr = weakref.ref(future) + del future + self.assertIsNone(wr()) + + futures_list[0].set_result("test") + for future in futures.as_completed(futures_list): + futures_list.remove(future) + wr = weakref.ref(future) + del future + self.assertIsNone(wr()) + if futures_list: + futures_list[0].set_result("test") + + def test_correct_timeout_exception_msg(self): + futures_list = [CANCELLED_AND_NOTIFIED_FUTURE, PENDING_FUTURE, + RUNNING_FUTURE, SUCCESSFUL_FUTURE] + + with self.assertRaises(futures.TimeoutError) as cm: + list(futures.as_completed(futures_list, timeout=0)) + + self.assertEqual(str(cm.exception), '2 (of 4) futures unfinished') + class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, BaseTestCase): pass @@ -421,6 +457,10 @@ def test_map(self): list(self.executor.map(pow, range(10), range(10))), list(map(pow, range(10), range(10)))) + self.assertEqual( + list(self.executor.map(pow, range(10), range(10), chunksize=3)), + list(map(pow, range(10), range(10)))) + def test_map_exception(self): i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5]) self.assertEqual(i.__next__(), (0, 1)) @@ -471,6 +511,14 @@ def test_max_workers_negative(self): "than 0"): self.executor_type(max_workers=number) + def test_free_reference(self): + # Issue #14406: Result iterator should not keep an internal + # reference to result objects. + for obj in self.executor.map(make_dummy_object, range(10)): + wr = weakref.ref(obj) + del obj + self.assertIsNone(wr()) + class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, BaseTestCase): def test_map_submits_without_iteration(self): diff --git a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst new file mode 100644 index 00000000000..857fad0c852 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst @@ -0,0 +1,2 @@ +The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` +now avoid keeping a reference to yielded objects. \ No newline at end of file From webhook-mailer at python.org Fri Sep 1 13:16:50 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Fri, 01 Sep 2017 17:16:50 -0000 Subject: [Python-checkins] [3.6] bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (GH-1560) (#3266) Message-ID: https://github.com/python/cpython/commit/ea767915f7476c1fe97f7b1a53304d57f105bdd2 commit: ea767915f7476c1fe97f7b1a53304d57f105bdd2 branch: 3.6 author: Antoine Pitrou committer: GitHub date: 2017-09-01T19:16:46+02:00 summary: [3.6] bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (GH-1560) (#3266) bpo-27144: concurrent.futures as_complie and map iterators do not keep reference to returned object (cherry picked from commit 97e1b1c81458d2109b2ffed32ffa1eb643a6c3b9) files: A Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst M Lib/concurrent/futures/_base.py M Lib/concurrent/futures/process.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py index 295489c93e5..88521ae317e 100644 --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -170,6 +170,20 @@ def _create_and_install_waiters(fs, return_when): return waiter + +def _yield_and_decref(fs, ref_collect): + """ + Iterate on the list *fs*, yielding objects one by one in reverse order. + Before yielding an object, it is removed from each set in + the collection of sets *ref_collect*. + """ + while fs: + for futures_set in ref_collect: + futures_set.remove(fs[-1]) + # Careful not to keep a reference to the popped value + yield fs.pop() + + def as_completed(fs, timeout=None): """An iterator over the given futures that yields each as it completes. @@ -191,6 +205,8 @@ def as_completed(fs, timeout=None): if timeout is not None: end_time = timeout + time.time() + total_futures = len(fs) + fs = set(fs) with _AcquireFutures(fs): finished = set( @@ -198,9 +214,9 @@ def as_completed(fs, timeout=None): if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]) pending = fs - finished waiter = _create_and_install_waiters(fs, _AS_COMPLETED) - + finished = list(finished) try: - yield from finished + yield from _yield_and_decref(finished, ref_collect=(fs,)) while pending: if timeout is None: @@ -210,7 +226,7 @@ def as_completed(fs, timeout=None): if wait_timeout < 0: raise TimeoutError( '%d (of %d) futures unfinished' % ( - len(pending), len(fs))) + len(pending), total_futures)) waiter.event.wait(wait_timeout) @@ -219,9 +235,9 @@ def as_completed(fs, timeout=None): waiter.finished_futures = [] waiter.event.clear() - for future in finished: - yield future - pending.remove(future) + # reverse to keep finishing order + finished.reverse() + yield from _yield_and_decref(finished, ref_collect=(fs, pending)) finally: for f in fs: @@ -551,11 +567,14 @@ def map(self, fn, *iterables, timeout=None, chunksize=1): # before the first iterator value is required. def result_iterator(): try: - for future in fs: + # reverse to keep finishing order + fs.reverse() + while fs: + # Careful not to keep a reference to the popped future if timeout is None: - yield future.result() + yield fs.pop().result() else: - yield future.result(end_time - time.time()) + yield fs.pop().result(end_time - time.time()) finally: for future in fs: future.cancel() diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 8f1d714193a..03b28ab5d68 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -357,6 +357,18 @@ def _check_system_limits(): raise NotImplementedError(_system_limited) +def _chain_from_iterable_of_lists(iterable): + """ + Specialized implementation of itertools.chain.from_iterable. + Each item in *iterable* should be a list. This function is + careful not to keep references to yielded objects. + """ + for element in iterable: + element.reverse() + while element: + yield element.pop() + + class BrokenProcessPool(RuntimeError): """ Raised when a process in a ProcessPoolExecutor terminated abruptly @@ -482,7 +494,7 @@ def map(self, fn, *iterables, timeout=None, chunksize=1): results = super().map(partial(_process_chunk, fn), _get_chunks(*iterables, chunksize=chunksize), timeout=timeout) - return itertools.chain.from_iterable(results) + return _chain_from_iterable_of_lists(results) def shutdown(self, wait=True): with self._shutdown_lock: diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 90dec61814c..73baf9a8e49 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -59,6 +59,10 @@ def my_method(self): pass +def make_dummy_object(_): + return MyObject() + + class BaseTestCase(unittest.TestCase): def setUp(self): self._thread_key = test.support.threading_setup() @@ -397,6 +401,38 @@ def test_duplicate_futures(self): completed = [f for f in futures.as_completed([future1,future1])] self.assertEqual(len(completed), 1) + def test_free_reference_yielded_future(self): + # Issue #14406: Generator should not keep references + # to finished futures. + futures_list = [Future() for _ in range(8)] + futures_list.append(create_future(state=CANCELLED_AND_NOTIFIED)) + futures_list.append(create_future(state=SUCCESSFUL_FUTURE)) + + with self.assertRaises(futures.TimeoutError): + for future in futures.as_completed(futures_list, timeout=0): + futures_list.remove(future) + wr = weakref.ref(future) + del future + self.assertIsNone(wr()) + + futures_list[0].set_result("test") + for future in futures.as_completed(futures_list): + futures_list.remove(future) + wr = weakref.ref(future) + del future + self.assertIsNone(wr()) + if futures_list: + futures_list[0].set_result("test") + + def test_correct_timeout_exception_msg(self): + futures_list = [CANCELLED_AND_NOTIFIED_FUTURE, PENDING_FUTURE, + RUNNING_FUTURE, SUCCESSFUL_FUTURE] + + with self.assertRaises(futures.TimeoutError) as cm: + list(futures.as_completed(futures_list, timeout=0)) + + self.assertEqual(str(cm.exception), '2 (of 4) futures unfinished') + class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, BaseTestCase): pass @@ -422,6 +458,10 @@ def test_map(self): list(self.executor.map(pow, range(10), range(10))), list(map(pow, range(10), range(10)))) + self.assertEqual( + list(self.executor.map(pow, range(10), range(10), chunksize=3)), + list(map(pow, range(10), range(10)))) + def test_map_exception(self): i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5]) self.assertEqual(i.__next__(), (0, 1)) @@ -472,6 +512,14 @@ def test_max_workers_negative(self): "than 0"): self.executor_type(max_workers=number) + def test_free_reference(self): + # Issue #14406: Result iterator should not keep an internal + # reference to result objects. + for obj in self.executor.map(make_dummy_object, range(10)): + wr = weakref.ref(obj) + del obj + self.assertIsNone(wr()) + class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, BaseTestCase): def test_map_submits_without_iteration(self): diff --git a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst new file mode 100644 index 00000000000..857fad0c852 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst @@ -0,0 +1,2 @@ +The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` +now avoid keeping a reference to yielded objects. \ No newline at end of file From webhook-mailer at python.org Fri Sep 1 15:28:49 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Fri, 01 Sep 2017 19:28:49 -0000 Subject: [Python-checkins] bpo-30581: Windows: os.cpu_count() returns wrong number of processors (#2934) (#3267) Message-ID: https://github.com/python/cpython/commit/58521fdba1657f6553a1ead5cbaa100967a167b3 commit: 58521fdba1657f6553a1ead5cbaa100967a167b3 branch: 3.6 author: Christopher Wilcox committer: Antoine Pitrou date: 2017-09-01T21:28:47+02:00 summary: bpo-30581: Windows: os.cpu_count() returns wrong number of processors (#2934) (#3267) * Fixes #30581 by adding a path to use newer GetMaximumProcessorCount API on Windows calls to os.cpu_count() * Add NEWS.d entry for bpo-30581, os.cpu_count on Windows. * Tweak NEWS entry files: A Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst M Modules/posixmodule.c diff --git a/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst b/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst new file mode 100644 index 00000000000..6591fa0df00 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst @@ -0,0 +1,2 @@ +os.cpu_count() now returns the correct number of processors on Windows +when the number of logical processors is greater than 64. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 111e4c9fde5..ead2ea93702 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -11028,9 +11028,22 @@ os_cpu_count_impl(PyObject *module) { int ncpu = 0; #ifdef MS_WINDOWS - SYSTEM_INFO sysinfo; - GetSystemInfo(&sysinfo); - ncpu = sysinfo.dwNumberOfProcessors; + /* Vista is supported and the GetMaximumProcessorCount API is Win7+ + Need to fallback to Vista behavior if this call isn't present */ + HINSTANCE hKernel32; + hKernel32 = GetModuleHandleW(L"KERNEL32"); + + static DWORD(CALLBACK *_GetMaximumProcessorCount)(WORD) = NULL; + *(FARPROC*)&_GetMaximumProcessorCount = GetProcAddress(hKernel32, + "GetMaximumProcessorCount"); + if (_GetMaximumProcessorCount != NULL) { + ncpu = _GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS); + } + else { + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + ncpu = sysinfo.dwNumberOfProcessors; + } #elif defined(__hpux) ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL); #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) From webhook-mailer at python.org Fri Sep 1 18:25:14 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 22:25:14 -0000 Subject: [Python-checkins] bpo-31326: ProcessPoolExecutor waits for the call queue thread (#3265) Message-ID: https://github.com/python/cpython/commit/b713adf27a76b5df95e3ee5f85f9064a2763ae35 commit: b713adf27a76b5df95e3ee5f85f9064a2763ae35 branch: master author: Victor Stinner committer: GitHub date: 2017-09-02T00:25:11+02:00 summary: bpo-31326: ProcessPoolExecutor waits for the call queue thread (#3265) * bpo-31326: ProcessPoolExecutor waits for the call queue thread concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the call queue. Moreover, shutdown(wait=True) now also join the call queue thread, to prevent leaking a dangling thread. * Fix for shutdown() being called twice. files: A Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst M Lib/concurrent/futures/process.py diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 03b28ab5d68..50ee296ac89 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -507,7 +507,11 @@ def shutdown(self, wait=True): # To reduce the risk of opening too many files, remove references to # objects that use file descriptors. self._queue_management_thread = None - self._call_queue = None + if self._call_queue is not None: + self._call_queue.close() + if wait: + self._call_queue.join_thread() + self._call_queue = None self._result_queue = None self._processes = None shutdown.__doc__ = _base.Executor.shutdown.__doc__ diff --git a/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst b/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst new file mode 100644 index 00000000000..ea0ff2b4580 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst @@ -0,0 +1,3 @@ +concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the +call queue. Moreover, shutdown(wait=True) now also join the call queue +thread, to prevent leaking a dangling thread. From webhook-mailer at python.org Fri Sep 1 18:25:42 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 22:25:42 -0000 Subject: [Python-checkins] bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264) Message-ID: https://github.com/python/cpython/commit/e8a533fbc734af6eeb389202ba6c6e9c2548027f commit: e8a533fbc734af6eeb389202ba6c6e9c2548027f branch: master author: Victor Stinner committer: GitHub date: 2017-09-02T00:25:39+02:00 summary: bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264) Call doCleanups() to close the loop after calling executor.shutdown(wait=True): see TestCase.set_event_loop() of asyncio.test_utils. Replace also gc.collect() with support.gc_collect(). files: M Lib/test/test_asyncio/test_events.py diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 9746678607c..27781a2d91b 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -258,8 +258,8 @@ def tearDown(self): if not self.loop.is_closed(): test_utils.run_briefly(self.loop) - self.loop.close() - gc.collect() + self.doCleanups() + support.gc_collect() super().tearDown() def test_run_until_complete_nesting(self): From webhook-mailer at python.org Fri Sep 1 18:26:20 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 01 Sep 2017 22:26:20 -0000 Subject: [Python-checkins] bpo-31323: Fix reference leak in test_ssl (#3263) Message-ID: https://github.com/python/cpython/commit/868710158910fa38e285ce0e6d50026e1d0b2a8c commit: 868710158910fa38e285ce0e6d50026e1d0b2a8c branch: master author: Victor Stinner committer: GitHub date: 2017-09-02T00:26:17+02:00 summary: bpo-31323: Fix reference leak in test_ssl (#3263) Store exceptions as string rather than object to prevent reference cycles which cause leaking dangling threads. files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 104b7f377a5..5e143f95e39 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1889,7 +1889,11 @@ def wrap_conn(self): # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. - self.server.conn_errors.append(e) + # + # bpo-31323: Store the exception as string to prevent + # a reference leak: server -> conn_errors -> exception + # -> traceback -> self (ConnectionHandler) -> server + self.server.conn_errors.append(str(e)) if self.server.chatty: handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") self.running = False @@ -3097,7 +3101,7 @@ def test_default_ciphers(self): with context.wrap_socket(socket.socket()) as s: with self.assertRaises(OSError): s.connect((HOST, server.port)) - self.assertIn("no shared cipher", str(server.conn_errors[0])) + self.assertIn("no shared cipher", server.conn_errors[0]) def test_version_basic(self): """ From lp_benchmark_robot at intel.com Fri Sep 1 18:42:25 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 1 Sep 2017 15:42:25 -0700 Subject: [Python-checkins] [65 flat] Results for Python (master branch) 2017-08-31 Message-ID: <9fff41d5-05ca-4eed-a852-055c8351defb@orsmsx104.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project python/master, build date: 2017-08-31 18:13:10+00:00. - commit: 122e88a - previous commit: c67bae0 - revision date: 2017-08-30 18:47:52-04:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.023% | +0.088% | +3.146% | +9.054% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.903% | +0.084% | +23.077% | +11.461% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.232% | -0.387% | +23.616% | +11.169% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 2.372% | -0.444% | +21.554% | +9.814% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 3.972% | -0.547% | +2.425% | +18.297% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.817% | +0.364% | +12.445% | +9.397% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.800% | -0.210% | +6.336% | +11.091% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.491% | +0.249% | +3.026% | +6.840% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 5.768% | +0.418% | +5.960% | +19.298% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 6.807% | -1.338% | +4.720% | +16.231% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.749% | +0.314% | +4.129% | +6.812% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.629% | -0.053% | +5.785% | +4.841% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.684% | -0.075% | +3.529% | +5.218% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.429% | -0.374% | +7.798% | +10.804% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.073% | -0.043% | +5.765% | +9.750% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.836% | -0.140% | +6.301% | +10.835% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.254% | -0.016% | +9.321% | +10.432% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.522% | -0.702% | +5.011% | +12.589% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.329% | +1.065% | +5.349% | +8.369% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 3.761% | -0.130% | +1.035% | +12.374% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.880% | +0.292% | +5.564% | +12.931% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 3.861% | -0.139% | +46.613% | +12.516% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.615% | -1.082% | +5.789% | +14.775% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.442% | +0.025% | +18.868% | +11.565% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 5.006% | -0.895% | +6.256% | +13.933% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.504% | +0.159% | +4.242% | +5.276% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.911% | -0.264% | -5.260% | +5.653% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.486% | +0.314% | +2.979% | +5.870% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.266% | +0.392% | +3.423% | +10.550% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 3.534% | +0.230% | -0.285% | +23.125% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.369% | +0.097% | +2.599% | +19.113% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.239% | +0.069% | +6.522% | +18.646% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.211% | +0.201% | +12.155% | +9.719% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.261% | -0.033% | +0.398% | +9.944% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.138% | -0.028% | +8.551% | +5.380% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.094% | -0.038% | +0.614% | +5.061% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.671% | +0.027% | +8.493% | +13.791% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.283% | +1.265% | -7.797% | +10.590% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.183% | +0.265% | +2.112% | +9.243% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot|15.151% | +1.982% | -21.435% | +16.979% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 0.485% | +0.425% | +11.724% | +4.703% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 2.117% | +0.056% | +7.510% | +14.410% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 2.515% | -0.481% | +0.741% | +2.331% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.848% | -0.265% | +26.486% | +8.038% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.106% | -0.442% | +2.690% | +7.779% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.533% | +0.210% | +14.407% | +8.401% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 1.101% | +0.099% | +0.859% | -4.071% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 1.215% | -0.048% | +5.296% | +3.103% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.175% | -0.291% | +4.427% | +9.721% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.712% | -0.125% | +5.106% | +6.137% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.326% | -0.131% | +1.084% | +10.563% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 1.960% | -0.290% | +11.870% | +9.420% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 2.068% | +0.245% | +9.579% | +7.952% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.606% | +0.325% | +11.589% | +10.423% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.231% | -1.519% | +12.196% | +11.521% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 3.719% | +1.383% | +23.228% | +10.797% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.063% | +0.049% | +5.490% | +7.496% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.712% | +0.064% | +2.772% | -0.465% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 6.898% | +2.271% | +9.862% | +17.348% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.826% | +0.217% | -2.361% | +19.448% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.633% | +0.420% | +5.861% | +7.438% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.243% | -0.202% | +6.330% | +6.879% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.571% | -0.125% | +2.551% | +5.494% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.041% | +0.256% | -4.765% | +10.102% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.172% | +0.170% | +7.579% | +6.956% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/65-flat-results-for-python-master-branch-2017-08-31 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From solipsis at pitrou.net Sat Sep 2 05:05:32 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 02 Sep 2017 09:05:32 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-60 Message-ID: <20170902090532.90988.84A03A07B3F80B8F@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [0, 0, 3] memory blocks, sum=3 test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-2, 1, 0] memory blocks, sum=-1 test_ssl leaked [-45, 0, 0] references, sum=-45 test_ssl leaked [-16, 2, 0] memory blocks, sum=-14 test_ssl leaked [-1, 0, 0] file descriptors, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogClCZkt', '--timeout', '7200'] From webhook-mailer at python.org Sat Sep 2 12:24:37 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Sat, 02 Sep 2017 16:24:37 -0000 Subject: [Python-checkins] [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3242) Message-ID: https://github.com/python/cpython/commit/990b2d043cdfaafc3378550f7d27259410a6b918 commit: 990b2d043cdfaafc3378550f7d27259410a6b918 branch: 2.7 author: Pauli Virtanen committer: Antoine Pitrou date: 2017-09-02T18:24:32+02:00 summary: [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3242) [2.7] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) Ctypes currently produces wrong pep3118 type codes for several types. E.g. memoryview(ctypes.c_long()).format gives "' endian specification in the struct syntax also turns on the "standard size" mode, which makes type characters have a platform-independent meaning, which does not match with the codes used internally in ctypes. The struct module format syntax also does not allow specifying native-size non-native-endian items. This commit adds a converter function that maps the internal ctypes codes to appropriate struct module standard-size codes in the pep3118 format strings. The tests are modified to check for this.. (cherry picked from commit 07f1658aa09f6798793c473c72b2951b7fefe220) files: A Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst M Lib/ctypes/test/test_pep3118.py M Modules/_ctypes/_ctypes.c diff --git a/Lib/ctypes/test/test_pep3118.py b/Lib/ctypes/test/test_pep3118.py index 3e007e1b41d..49a1356a2c4 100644 --- a/Lib/ctypes/test/test_pep3118.py +++ b/Lib/ctypes/test/test_pep3118.py @@ -109,6 +109,34 @@ class Complete(Structure): # This table contains format strings as they look on little endian # machines. The test replaces '<' with '>' on big endian machines. # + +# Platform-specific type codes +s_bool = {1: '?', 2: 'H', 4: 'L', 8: 'Q'}[sizeof(c_bool)] +s_short = {2: 'h', 4: 'l', 8: 'q'}[sizeof(c_short)] +s_ushort = {2: 'H', 4: 'L', 8: 'Q'}[sizeof(c_ushort)] +s_int = {2: 'h', 4: 'i', 8: 'q'}[sizeof(c_int)] +s_uint = {2: 'H', 4: 'I', 8: 'Q'}[sizeof(c_uint)] +s_long = {4: 'l', 8: 'q'}[sizeof(c_long)] +s_ulong = {4: 'L', 8: 'Q'}[sizeof(c_ulong)] +s_longlong = "q" +s_ulonglong = "Q" +s_float = "f" +s_double = "d" +s_longdouble = "g" + +# Alias definitions in ctypes/__init__.py +if c_int is c_long: + s_int = s_long +if c_uint is c_ulong: + s_uint = s_ulong +if c_longlong is c_long: + s_longlong = s_long +if c_ulonglong is c_ulong: + s_ulonglong = s_ulong +if c_longdouble is c_double: + s_longdouble = s_double + + native_types = [ # type format shape calc itemsize @@ -117,52 +145,51 @@ class Complete(Structure): (c_char, "l:x:>l:y:}", None, BEPoint), - (LEPoint, "T{l:x:>l:y:}", None, POINTER(BEPoint)), - (POINTER(LEPoint), "&T{l:x:>l:y:}".replace('l', s_long), None, BEPoint), + (LEPoint, "T{l:x:>l:y:}".replace('l', s_long), None, POINTER(BEPoint)), + (POINTER(LEPoint), "&T{' : '<'; + result[1] = pep_code; + result[2] = '\0'; + return result; +} + /* Allocate a memory block for a pep3118 format string, copy prefix (if non-null) and suffix into it. Returns NULL on failure, with the error @@ -1999,9 +2070,9 @@ PyCSimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) stgdict->setfunc = fmt->setfunc; stgdict->getfunc = fmt->getfunc; #ifdef WORDS_BIGENDIAN - stgdict->format = _ctypes_alloc_format_string(">", proto_str); + stgdict->format = _ctypes_alloc_format_string_for_type(proto_str[0], 1); #else - stgdict->format = _ctypes_alloc_format_string("<", proto_str); + stgdict->format = _ctypes_alloc_format_string_for_type(proto_str[0], 0); #endif if (stgdict->format == NULL) { Py_DECREF(result); From webhook-mailer at python.org Sun Sep 3 00:51:44 2017 From: webhook-mailer at python.org (Senthil Kumaran) Date: Sun, 03 Sep 2017 04:51:44 -0000 Subject: [Python-checkins] remove a redundant lower in urllib.parse.urlsplit (#3008) Message-ID: https://github.com/python/cpython/commit/8df44ee8e0fbdb390bd38eb88eb1ee4e2a10d355 commit: 8df44ee8e0fbdb390bd38eb88eb1ee4e2a10d355 branch: master author: Oren Milman committer: Senthil Kumaran date: 2017-09-02T21:51:39-07:00 summary: remove a redundant lower in urllib.parse.urlsplit (#3008) files: M Lib/urllib/parse.py diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 01eb54906c8..76086e58bea 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -407,7 +407,6 @@ def urlsplit(url, scheme='', allow_fragments=True): i = url.find(':') if i > 0: if url[:i] == 'http': # optimize the common case - scheme = url[:i].lower() url = url[i+1:] if url[:2] == '//': netloc, url = _splitnetloc(url, 2) @@ -418,7 +417,7 @@ def urlsplit(url, scheme='', allow_fragments=True): url, fragment = url.split('#', 1) if '?' in url: url, query = url.split('?', 1) - v = SplitResult(scheme, netloc, url, query, fragment) + v = SplitResult('http', netloc, url, query, fragment) _parse_cache[key] = v return _coerce_result(v) for c in url[:i]: From webhook-mailer at python.org Sun Sep 3 01:10:16 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 03 Sep 2017 05:10:16 -0000 Subject: [Python-checkins] bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076) Message-ID: https://github.com/python/cpython/commit/bca4939d806170c3ca5d05f23710d11a8f1669cf commit: bca4939d806170c3ca5d05f23710d11a8f1669cf branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-03T08:10:14+03:00 summary: bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076) files: A Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst M Lib/test/test_asyncio/test_futures.py M Modules/_asynciomodule.c M Modules/clinic/_asynciomodule.c.h diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index f8f614f1c30..4320a901f49 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -100,8 +100,8 @@ def test_ensure_future(self): class BaseFutureTests: - def _new_future(self, loop=None): - raise NotImplementedError + def _new_future(self, *args, **kwargs): + return self.cls(*args, **kwargs) def setUp(self): super().setUp() @@ -147,6 +147,39 @@ def test_constructor_positional(self): # Make sure Future doesn't accept a positional argument self.assertRaises(TypeError, self._new_future, 42) + def test_uninitialized(self): + fut = self.cls.__new__(self.cls, loop=self.loop) + self.assertRaises(asyncio.InvalidStateError, fut.result) + fut = self.cls.__new__(self.cls, loop=self.loop) + self.assertRaises(asyncio.InvalidStateError, fut.exception) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.set_result(None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.set_exception(Exception) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.cancel() + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.add_done_callback(lambda f: None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.remove_done_callback(lambda f: None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut._schedule_callbacks() + fut = self.cls.__new__(self.cls, loop=self.loop) + try: + repr(fut) + except AttributeError: + pass + fut = self.cls.__new__(self.cls, loop=self.loop) + fut.cancelled() + fut.done() + iter(fut) + def test_cancel(self): f = self._new_future(loop=self.loop) self.assertTrue(f.cancel()) @@ -501,15 +534,11 @@ def __del__(self): @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') class CFutureTests(BaseFutureTests, test_utils.TestCase): - - def _new_future(self, *args, **kwargs): - return futures._CFuture(*args, **kwargs) + cls = getattr(futures, '_CFuture') class PyFutureTests(BaseFutureTests, test_utils.TestCase): - - def _new_future(self, *args, **kwargs): - return futures._PyFuture(*args, **kwargs) + cls = futures._PyFuture class BaseFutureDoneCallbackTests(): diff --git a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst new file mode 100644 index 00000000000..bdaa4ea35da --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst @@ -0,0 +1 @@ +Fixed miscellaneous errors in asyncio speedup module. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index d4b313480e9..2c64c55e7e3 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -68,7 +68,7 @@ typedef struct { PyObject_HEAD TaskObj *sw_task; PyObject *sw_arg; -} TaskSendMethWrapper; +} TaskStepMethWrapper; typedef struct { PyObject_HEAD @@ -92,11 +92,11 @@ static int future_schedule_callbacks(FutureObj *fut) { Py_ssize_t len; - PyObject* iters; + PyObject *callbacks; int i; if (fut->fut_callbacks == NULL) { - PyErr_SetString(PyExc_RuntimeError, "NULL callbacks"); + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); return -1; } @@ -105,42 +105,41 @@ future_schedule_callbacks(FutureObj *fut) return 0; } - iters = PyList_GetSlice(fut->fut_callbacks, 0, len); - if (iters == NULL) { + callbacks = PyList_GetSlice(fut->fut_callbacks, 0, len); + if (callbacks == NULL) { return -1; } if (PyList_SetSlice(fut->fut_callbacks, 0, len, NULL) < 0) { - Py_DECREF(iters); + Py_DECREF(callbacks); return -1; } for (i = 0; i < len; i++) { - PyObject *handle = NULL; - PyObject *cb = PyList_GET_ITEM(iters, i); + PyObject *handle; + PyObject *cb = PyList_GET_ITEM(callbacks, i); handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, &PyId_call_soon, cb, fut, NULL); if (handle == NULL) { - Py_DECREF(iters); + Py_DECREF(callbacks); return -1; } - else { - Py_DECREF(handle); - } + Py_DECREF(handle); } - Py_DECREF(iters); + Py_DECREF(callbacks); return 0; } static int future_init(FutureObj *fut, PyObject *loop) { - PyObject *res = NULL; + PyObject *res; + int is_true; _Py_IDENTIFIER(get_debug); - if (loop == NULL || loop == Py_None) { + if (loop == Py_None) { loop = _PyObject_CallNoArg(asyncio_get_event_loop); if (loop == NULL) { return -1; @@ -149,25 +148,25 @@ future_init(FutureObj *fut, PyObject *loop) else { Py_INCREF(loop); } - Py_CLEAR(fut->fut_loop); - fut->fut_loop = loop; + Py_XSETREF(fut->fut_loop, loop); res = _PyObject_CallMethodId(fut->fut_loop, &PyId_get_debug, NULL); if (res == NULL) { return -1; } - if (PyObject_IsTrue(res)) { - Py_CLEAR(res); - fut->fut_source_tb = _PyObject_CallNoArg(traceback_extract_stack); + is_true = PyObject_IsTrue(res); + Py_DECREF(res); + if (is_true < 0) { + return -1; + } + if (is_true) { + Py_XSETREF(fut->fut_source_tb, _PyObject_CallNoArg(traceback_extract_stack)); if (fut->fut_source_tb == NULL) { return -1; } } - else { - Py_CLEAR(res); - } - fut->fut_callbacks = PyList_New(0); + Py_XSETREF(fut->fut_callbacks, PyList_New(0)); if (fut->fut_callbacks == NULL) { return -1; } @@ -183,6 +182,7 @@ future_set_result(FutureObj *fut, PyObject *res) return NULL; } + assert(!fut->fut_result); Py_INCREF(res); fut->fut_result = res; fut->fut_state = STATE_FINISHED; @@ -208,6 +208,11 @@ future_set_exception(FutureObj *fut, PyObject *exc) if (exc_val == NULL) { return NULL; } + if (fut->fut_state != STATE_PENDING) { + Py_DECREF(exc_val); + PyErr_SetString(asyncio_InvalidStateError, "invalid state"); + return NULL; + } } else { exc_val = exc; @@ -226,6 +231,7 @@ future_set_exception(FutureObj *fut, PyObject *exc) return NULL; } + assert(!fut->fut_exception); fut->fut_exception = exc_val; fut->fut_state = STATE_FINISHED; @@ -240,31 +246,14 @@ future_set_exception(FutureObj *fut, PyObject *exc) static int future_get_result(FutureObj *fut, PyObject **result) { - PyObject *exc; - if (fut->fut_state == STATE_CANCELLED) { - exc = _PyObject_CallNoArg(asyncio_CancelledError); - if (exc == NULL) { - return -1; - } - *result = exc; - return 1; + PyErr_SetNone(asyncio_CancelledError); + return -1; } if (fut->fut_state != STATE_FINISHED) { - PyObject *msg = PyUnicode_FromString("Result is not ready."); - if (msg == NULL) { - return -1; - } - - exc = PyObject_CallFunctionObjArgs(asyncio_InvalidStateError, msg, NULL); - Py_DECREF(msg); - if (exc == NULL) { - return -1; - } - - *result = exc; - return 1; + PyErr_SetString(asyncio_InvalidStateError, "Result is not set."); + return -1; } fut->fut_log_tb = 0; @@ -286,15 +275,16 @@ future_add_done_callback(FutureObj *fut, PyObject *arg) PyObject *handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, &PyId_call_soon, arg, fut, NULL); - if (handle == NULL) { return NULL; } - else { - Py_DECREF(handle); - } + Py_DECREF(handle); } else { + if (fut->fut_callbacks == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); + return NULL; + } int err = PyList_Append(fut->fut_callbacks, arg); if (err != 0) { return NULL; @@ -324,7 +314,7 @@ future_cancel(FutureObj *fut) _asyncio.Future.__init__ * - loop: 'O' = NULL + loop: object = None This class is *almost* compatible with concurrent.futures.Future. @@ -342,7 +332,7 @@ This class is *almost* compatible with concurrent.futures.Future. static int _asyncio_Future___init___impl(FutureObj *self, PyObject *loop) -/*[clinic end generated code: output=9ed75799eaccb5d6 input=8e1681f23605be2d]*/ +/*[clinic end generated code: output=9ed75799eaccb5d6 input=89af317082bc0bf8]*/ { return future_init(self, loop); @@ -420,12 +410,12 @@ _asyncio_Future_exception_impl(FutureObj *self) /*[clinic end generated code: output=88b20d4f855e0710 input=733547a70c841c68]*/ { if (self->fut_state == STATE_CANCELLED) { - PyErr_SetString(asyncio_CancelledError, ""); + PyErr_SetNone(asyncio_CancelledError); return NULL; } if (self->fut_state != STATE_FINISHED) { - PyErr_SetString(asyncio_InvalidStateError, "Result is not ready."); + PyErr_SetString(asyncio_InvalidStateError, "Exception is not set."); return NULL; } @@ -441,7 +431,7 @@ _asyncio_Future_exception_impl(FutureObj *self) /*[clinic input] _asyncio.Future.set_result - res: 'O' + res: object / Mark the future done and set its result. @@ -452,7 +442,7 @@ InvalidStateError. static PyObject * _asyncio_Future_set_result(FutureObj *self, PyObject *res) -/*[clinic end generated code: output=a620abfc2796bfb6 input=8619565e0503357e]*/ +/*[clinic end generated code: output=a620abfc2796bfb6 input=5b9dc180f1baa56d]*/ { return future_set_result(self, res); } @@ -460,7 +450,7 @@ _asyncio_Future_set_result(FutureObj *self, PyObject *res) /*[clinic input] _asyncio.Future.set_exception - exception: 'O' + exception: object / Mark the future done and set an exception. @@ -471,7 +461,7 @@ InvalidStateError. static PyObject * _asyncio_Future_set_exception(FutureObj *self, PyObject *exception) -/*[clinic end generated code: output=f1c1b0cd321be360 input=1377dbe15e6ea186]*/ +/*[clinic end generated code: output=f1c1b0cd321be360 input=e45b7d7aa71cc66d]*/ { return future_set_exception(self, exception); } @@ -479,7 +469,7 @@ _asyncio_Future_set_exception(FutureObj *self, PyObject *exception) /*[clinic input] _asyncio.Future.add_done_callback - fn: 'O' + fn: object / Add a callback to be run when the future becomes done. @@ -491,7 +481,7 @@ scheduled with call_soon. static PyObject * _asyncio_Future_add_done_callback(FutureObj *self, PyObject *fn) -/*[clinic end generated code: output=819e09629b2ec2b5 input=8cce187e32cec6a8]*/ +/*[clinic end generated code: output=819e09629b2ec2b5 input=8f818b39990b027d]*/ { return future_add_done_callback(self, fn); } @@ -499,7 +489,7 @@ _asyncio_Future_add_done_callback(FutureObj *self, PyObject *fn) /*[clinic input] _asyncio.Future.remove_done_callback - fn: 'O' + fn: object / Remove all instances of a callback from the "call when done" list. @@ -509,11 +499,16 @@ Returns the number of callbacks removed. static PyObject * _asyncio_Future_remove_done_callback(FutureObj *self, PyObject *fn) -/*[clinic end generated code: output=5ab1fb52b24ef31f input=3fedb73e1409c31c]*/ +/*[clinic end generated code: output=5ab1fb52b24ef31f input=0a43280a149d505b]*/ { PyObject *newlist; Py_ssize_t len, i, j=0; + if (self->fut_callbacks == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); + return NULL; + } + len = PyList_GET_SIZE(self->fut_callbacks); if (len == 0) { return PyLong_FromSsize_t(0); @@ -527,29 +522,31 @@ _asyncio_Future_remove_done_callback(FutureObj *self, PyObject *fn) for (i = 0; i < PyList_GET_SIZE(self->fut_callbacks); i++) { int ret; PyObject *item = PyList_GET_ITEM(self->fut_callbacks, i); - - if ((ret = PyObject_RichCompareBool(fn, item, Py_EQ)) < 0) { - goto fail; - } + Py_INCREF(item); + ret = PyObject_RichCompareBool(fn, item, Py_EQ); if (ret == 0) { if (j < len) { - Py_INCREF(item); PyList_SET_ITEM(newlist, j, item); j++; + continue; } - else { - if (PyList_Append(newlist, item)) { - goto fail; - } - } + ret = PyList_Append(newlist, item); + } + Py_DECREF(item); + if (ret < 0) { + goto fail; } } - if (PyList_SetSlice(newlist, j, len, NULL) < 0) { - goto fail; + if (j < len) { + Py_SIZE(newlist) = j; } - if (PyList_SetSlice(self->fut_callbacks, 0, len, newlist) < 0) { - goto fail; + j = PyList_GET_SIZE(newlist); + len = PyList_GET_SIZE(self->fut_callbacks); + if (j != len) { + if (PyList_SetSlice(self->fut_callbacks, 0, len, newlist) < 0) { + goto fail; + } } Py_DECREF(newlist); return PyLong_FromSsize_t(len - j); @@ -730,7 +727,7 @@ FutureObj_get_state(FutureObj *fut) default: assert (0); } - Py_INCREF(ret); + Py_XINCREF(ret); return ret; } @@ -766,25 +763,14 @@ FutureObj_repr(FutureObj *fut) { _Py_IDENTIFIER(_repr_info); - PyObject *_repr_info = _PyUnicode_FromId(&PyId__repr_info); // borrowed - if (_repr_info == NULL) { - return NULL; - } - - PyObject *rinfo = PyObject_CallMethodObjArgs((PyObject*)fut, _repr_info, - NULL); + PyObject *rinfo = _PyObject_CallMethodIdObjArgs((PyObject*)fut, + &PyId__repr_info, + NULL); if (rinfo == NULL) { return NULL; } - PyObject *sp = PyUnicode_FromString(" "); - if (sp == NULL) { - Py_DECREF(rinfo); - return NULL; - } - - PyObject *rinfo_s = PyUnicode_Join(sp, rinfo); - Py_DECREF(sp); + PyObject *rinfo_s = PyUnicode_Join(NULL, rinfo); Py_DECREF(rinfo); if (rinfo_s == NULL) { return NULL; @@ -794,7 +780,7 @@ FutureObj_repr(FutureObj *fut) PyObject *type_name = PyObject_GetAttrString((PyObject*)Py_TYPE(fut), "__name__"); if (type_name != NULL) { - rstr = PyUnicode_FromFormat("<%S %S>", type_name, rinfo_s); + rstr = PyUnicode_FromFormat("<%S %U>", type_name, rinfo_s); Py_DECREF(type_name); } Py_DECREF(rinfo_s); @@ -810,22 +796,21 @@ FutureObj_finalize(FutureObj *fut) _Py_IDENTIFIER(future); _Py_IDENTIFIER(source_traceback); + PyObject *error_type, *error_value, *error_traceback; + PyObject *context; + PyObject *type_name; + PyObject *message = NULL; + PyObject *func; + if (!fut->fut_log_tb) { return; } assert(fut->fut_exception != NULL); - fut->fut_log_tb = 0;; + fut->fut_log_tb = 0; - PyObject *error_type, *error_value, *error_traceback; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); - PyObject *context = NULL; - PyObject *type_name = NULL; - PyObject *message = NULL; - PyObject *func = NULL; - PyObject *res = NULL; - context = PyDict_New(); if (context == NULL) { goto finally; @@ -838,6 +823,7 @@ FutureObj_finalize(FutureObj *fut) message = PyUnicode_FromFormat( "%S exception was never retrieved", type_name); + Py_DECREF(type_name); if (message == NULL) { goto finally; } @@ -856,18 +842,19 @@ FutureObj_finalize(FutureObj *fut) func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler); if (func != NULL) { - res = PyObject_CallFunctionObjArgs(func, context, NULL); + PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } + else { + Py_DECREF(res); + } + Py_DECREF(func); } finally: - Py_CLEAR(context); - Py_CLEAR(type_name); - Py_CLEAR(message); - Py_CLEAR(func); - Py_CLEAR(res); + Py_XDECREF(context); + Py_XDECREF(message); /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); @@ -1014,22 +1001,19 @@ FutureIter_iternext(futureiterobject *it) Py_INCREF(fut); return (PyObject *)fut; } - PyErr_Format(PyExc_AssertionError, - "yield from wasn't used with future"); + PyErr_SetString(PyExc_AssertionError, + "yield from wasn't used with future"); return NULL; } + it->future = NULL; res = _asyncio_Future_result_impl(fut); if (res != NULL) { /* The result of the Future is not an exception. */ - if (_PyGen_SetStopIterationValue(res) < 0) { - Py_DECREF(res); - return NULL; - } + (void)_PyGen_SetStopIterationValue(res); Py_DECREF(res); } - it->future = NULL; Py_DECREF(fut); return NULL; } @@ -1046,7 +1030,7 @@ FutureIter_send(futureiterobject *self, PyObject *unused) static PyObject * FutureIter_throw(futureiterobject *self, PyObject *args) { - PyObject *type=NULL, *val=NULL, *tb=NULL; + PyObject *type, *val = NULL, *tb = NULL; if (!PyArg_ParseTuple(args, "O|OO", &type, &val, &tb)) return NULL; @@ -1090,7 +1074,7 @@ FutureIter_throw(futureiterobject *self, PyObject *args) PyErr_Restore(type, val, tb); - return FutureIter_iternext(self); + return NULL; fail: Py_DECREF(type); @@ -1171,7 +1155,7 @@ static PyObject * task_step(TaskObj *, PyObject *); /* ----- Task._step wrapper */ static int -TaskSendMethWrapper_clear(TaskSendMethWrapper *o) +TaskStepMethWrapper_clear(TaskStepMethWrapper *o) { Py_CLEAR(o->sw_task); Py_CLEAR(o->sw_arg); @@ -1179,22 +1163,30 @@ TaskSendMethWrapper_clear(TaskSendMethWrapper *o) } static void -TaskSendMethWrapper_dealloc(TaskSendMethWrapper *o) +TaskStepMethWrapper_dealloc(TaskStepMethWrapper *o) { PyObject_GC_UnTrack(o); - (void)TaskSendMethWrapper_clear(o); + (void)TaskStepMethWrapper_clear(o); Py_TYPE(o)->tp_free(o); } static PyObject * -TaskSendMethWrapper_call(TaskSendMethWrapper *o, +TaskStepMethWrapper_call(TaskStepMethWrapper *o, PyObject *args, PyObject *kwds) { + if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no keyword arguments"); + return NULL; + } + if (args != NULL && PyTuple_GET_SIZE(args) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no positional arguments"); + return NULL; + } return task_call_step(o->sw_task, o->sw_arg); } static int -TaskSendMethWrapper_traverse(TaskSendMethWrapper *o, +TaskStepMethWrapper_traverse(TaskStepMethWrapper *o, visitproc visit, void *arg) { Py_VISIT(o->sw_task); @@ -1203,7 +1195,7 @@ TaskSendMethWrapper_traverse(TaskSendMethWrapper *o, } static PyObject * -TaskSendMethWrapper_get___self__(TaskSendMethWrapper *o) +TaskStepMethWrapper_get___self__(TaskStepMethWrapper *o) { if (o->sw_task) { Py_INCREF(o->sw_task); @@ -1212,30 +1204,30 @@ TaskSendMethWrapper_get___self__(TaskSendMethWrapper *o) Py_RETURN_NONE; } -static PyGetSetDef TaskSendMethWrapper_getsetlist[] = { - {"__self__", (getter)TaskSendMethWrapper_get___self__, NULL, NULL}, +static PyGetSetDef TaskStepMethWrapper_getsetlist[] = { + {"__self__", (getter)TaskStepMethWrapper_get___self__, NULL, NULL}, {NULL} /* Sentinel */ }; -PyTypeObject TaskSendMethWrapper_Type = { +PyTypeObject TaskStepMethWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "TaskSendMethWrapper", - .tp_basicsize = sizeof(TaskSendMethWrapper), + "TaskStepMethWrapper", + .tp_basicsize = sizeof(TaskStepMethWrapper), .tp_itemsize = 0, - .tp_getset = TaskSendMethWrapper_getsetlist, - .tp_dealloc = (destructor)TaskSendMethWrapper_dealloc, - .tp_call = (ternaryfunc)TaskSendMethWrapper_call, + .tp_getset = TaskStepMethWrapper_getsetlist, + .tp_dealloc = (destructor)TaskStepMethWrapper_dealloc, + .tp_call = (ternaryfunc)TaskStepMethWrapper_call, .tp_getattro = PyObject_GenericGetAttr, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - .tp_traverse = (traverseproc)TaskSendMethWrapper_traverse, - .tp_clear = (inquiry)TaskSendMethWrapper_clear, + .tp_traverse = (traverseproc)TaskStepMethWrapper_traverse, + .tp_clear = (inquiry)TaskStepMethWrapper_clear, }; static PyObject * -TaskSendMethWrapper_new(TaskObj *task, PyObject *arg) +TaskStepMethWrapper_new(TaskObj *task, PyObject *arg) { - TaskSendMethWrapper *o; - o = PyObject_GC_New(TaskSendMethWrapper, &TaskSendMethWrapper_Type); + TaskStepMethWrapper *o; + o = PyObject_GC_New(TaskStepMethWrapper, &TaskStepMethWrapper_Type); if (o == NULL) { return NULL; } @@ -1258,7 +1250,11 @@ TaskWakeupMethWrapper_call(TaskWakeupMethWrapper *o, { PyObject *fut; - if (!PyArg_ParseTuple(args, "O|", &fut)) { + if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no keyword arguments"); + return NULL; + } + if (!PyArg_ParseTuple(args, "O", &fut)) { return NULL; } @@ -1322,16 +1318,16 @@ TaskWakeupMethWrapper_new(TaskObj *task) /*[clinic input] _asyncio.Task.__init__ - coro: 'O' + coro: object * - loop: 'O' = NULL + loop: object = None A coroutine wrapped in a Future. [clinic start generated code]*/ static int _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop) -/*[clinic end generated code: output=9f24774c2287fc2f input=71d8d28c201a18cd]*/ +/*[clinic end generated code: output=9f24774c2287fc2f input=8d132974b049593e]*/ { PyObject *res; _Py_IDENTIFIER(add); @@ -1437,7 +1433,7 @@ TaskObj_get_fut_waiter(TaskObj *task) @classmethod _asyncio.Task.current_task - loop: 'O' = None + loop: object = None Return the currently running task in an event loop or None. @@ -1448,7 +1444,7 @@ None is returned when called not in the context of a Task. static PyObject * _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop) -/*[clinic end generated code: output=99fbe7332c516e03 input=a0d6cdf2e3b243e1]*/ +/*[clinic end generated code: output=99fbe7332c516e03 input=cd14770c5b79c7eb]*/ { PyObject *res; @@ -1510,12 +1506,14 @@ task_all_tasks(PyObject *loop) Py_DECREF(task_loop); Py_DECREF(task); } - + if (PyErr_Occurred()) { + goto fail; + } Py_DECREF(iter); return set; fail: - Py_XDECREF(set); + Py_DECREF(set); Py_XDECREF(iter); return NULL; } @@ -1524,7 +1522,7 @@ task_all_tasks(PyObject *loop) @classmethod _asyncio.Task.all_tasks - loop: 'O' = None + loop: object = None Return a set of all tasks for an event loop. @@ -1533,7 +1531,7 @@ By default all tasks for the current event loop are returned. static PyObject * _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop) -/*[clinic end generated code: output=11f9b20749ccca5d input=c6f5b53bd487488f]*/ +/*[clinic end generated code: output=11f9b20749ccca5d input=497f80bc9ce726b5]*/ { PyObject *res; @@ -1627,7 +1625,7 @@ _asyncio_Task_cancel_impl(TaskObj *self) _asyncio.Task.get_stack * - limit: 'O' = None + limit: object = None Return the list of stack frames for this task's coroutine. @@ -1652,7 +1650,7 @@ returned for a suspended coroutine. static PyObject * _asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit) -/*[clinic end generated code: output=c9aeeeebd1e18118 input=b1920230a766d17a]*/ +/*[clinic end generated code: output=c9aeeeebd1e18118 input=05b323d42b809b90]*/ { return PyObject_CallFunctionObjArgs( asyncio_task_get_stack_func, self, limit, NULL); @@ -1662,8 +1660,8 @@ _asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit) _asyncio.Task.print_stack * - limit: 'O' = None - file: 'O' = None + limit: object = None + file: object = None Print the stack or traceback for this task's coroutine. @@ -1677,7 +1675,7 @@ to sys.stderr. static PyObject * _asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit, PyObject *file) -/*[clinic end generated code: output=7339e10314cd3f4d input=19f1e99ab5400bc3]*/ +/*[clinic end generated code: output=7339e10314cd3f4d input=1a0352913b7fcd92]*/ { return PyObject_CallFunctionObjArgs( asyncio_task_print_stack_func, self, limit, file, NULL); @@ -1686,12 +1684,12 @@ _asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit, /*[clinic input] _asyncio.Task._step - exc: 'O' = NULL + exc: object = None [clinic start generated code]*/ static PyObject * _asyncio_Task__step_impl(TaskObj *self, PyObject *exc) -/*[clinic end generated code: output=7ed23f0cefd5ae42 input=ada4b2324e5370af]*/ +/*[clinic end generated code: output=7ed23f0cefd5ae42 input=1e19a985ace87ca4]*/ { return task_step(self, exc == Py_None ? NULL : exc); } @@ -1699,12 +1697,12 @@ _asyncio_Task__step_impl(TaskObj *self, PyObject *exc) /*[clinic input] _asyncio.Task._wakeup - fut: 'O' + fut: object [clinic start generated code]*/ static PyObject * _asyncio_Task__wakeup_impl(TaskObj *self, PyObject *fut) -/*[clinic end generated code: output=75cb341c760fd071 input=11ee4918a5bdbf21]*/ +/*[clinic end generated code: output=75cb341c760fd071 input=6a0616406f829a7b]*/ { return task_wakeup(self, fut); } @@ -1717,11 +1715,9 @@ TaskObj_finalize(TaskObj *task) _Py_IDENTIFIER(message); _Py_IDENTIFIER(source_traceback); + PyObject *context; PyObject *message = NULL; - PyObject *context = NULL; - PyObject *func = NULL; - PyObject *res = NULL; - + PyObject *func; PyObject *error_type, *error_value, *error_traceback; if (task->task_state != STATE_PENDING || !task->task_log_destroy_pending) { @@ -1757,17 +1753,19 @@ TaskObj_finalize(TaskObj *task) func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler); if (func != NULL) { - res = PyObject_CallFunctionObjArgs(func, context, NULL); + PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } + else { + Py_DECREF(res); + } + Py_DECREF(func); } finally: - Py_CLEAR(context); - Py_CLEAR(message); - Py_CLEAR(func); - Py_CLEAR(res); + Py_XDECREF(context); + Py_XDECREF(message); /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); @@ -1879,9 +1877,6 @@ task_call_step(TaskObj *task, PyObject *arg) } else { /* `task` is a subclass of Task */ - if (arg == NULL) { - arg = Py_None; - } return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__step, arg, NULL); } @@ -1892,7 +1887,7 @@ task_call_step_soon(TaskObj *task, PyObject *arg) { PyObject *handle; - PyObject *cb = TaskSendMethWrapper_new(task, arg); + PyObject *cb = TaskStepMethWrapper_new(task, arg); if (cb == NULL) { return -1; } @@ -1947,7 +1942,7 @@ task_step_impl(TaskObj *task, PyObject *exc) int res; int clear_exc = 0; PyObject *result = NULL; - PyObject *coro = task->task_coro; + PyObject *coro; PyObject *o; if (task->task_state != STATE_PENDING) { @@ -1988,6 +1983,12 @@ task_step_impl(TaskObj *task, PyObject *exc) Py_CLEAR(task->task_fut_waiter); + coro = task->task_coro; + if (coro == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object"); + return NULL; + } + if (exc == NULL) { if (PyGen_CheckExact(coro) || PyCoro_CheckExact(coro)) { result = _PyGen_Send((PyGenObject*)coro, Py_None); @@ -2002,7 +2003,7 @@ task_step_impl(TaskObj *task, PyObject *exc) exc, NULL); if (clear_exc) { /* We created 'exc' during this call */ - Py_CLEAR(exc); + Py_DECREF(exc); } } @@ -2051,13 +2052,13 @@ task_step_impl(TaskObj *task, PyObject *exc) o = future_set_exception((FutureObj*)task, ev); if (!o) { /* An exception in Task.set_exception() */ - Py_XDECREF(et); + Py_DECREF(et); Py_XDECREF(tb); Py_XDECREF(ev); goto fail; } assert(o == Py_None); - Py_CLEAR(o); + Py_DECREF(o); if (!PyErr_GivenExceptionMatches(et, PyExc_Exception)) { /* We've got a BaseException; re-raise it */ @@ -2065,7 +2066,7 @@ task_step_impl(TaskObj *task, PyObject *exc) goto fail; } - Py_XDECREF(et); + Py_DECREF(et); Py_XDECREF(tb); Py_XDECREF(ev); @@ -2137,7 +2138,7 @@ task_step_impl(TaskObj *task, PyObject *exc) } else { if (o == Py_None) { - Py_CLEAR(o); + Py_DECREF(o); } else { /* `result` is a Future-compatible object */ @@ -2145,7 +2146,7 @@ task_step_impl(TaskObj *task, PyObject *exc) PyObject *res; int blocking = PyObject_IsTrue(o); - Py_CLEAR(o); + Py_DECREF(o); if (blocking < 0) { goto fail; } @@ -2228,7 +2229,7 @@ task_step_impl(TaskObj *task, PyObject *exc) goto fail; } res = PyObject_IsTrue(o); - Py_CLEAR(o); + Py_DECREF(o); if (res == -1) { /* An exception while checking if 'val' is True */ goto fail; @@ -2296,14 +2297,8 @@ task_step(TaskObj *task, PyObject *exc) PyObject *et, *ev, *tb; PyErr_Fetch(&et, &ev, &tb); ot = _PyDict_Pop(current_tasks, task->task_loop, NULL); - if (ot == NULL) { - Py_XDECREF(et); - Py_XDECREF(tb); - Py_XDECREF(ev); - return NULL; - } - Py_DECREF(ot); - PyErr_Restore(et, ev, tb); + Py_XDECREF(ot); + _PyErr_ChainExceptions(et, ev, tb); return NULL; } else { @@ -2322,17 +2317,18 @@ task_step(TaskObj *task, PyObject *exc) static PyObject * task_wakeup(TaskObj *task, PyObject *o) { + PyObject *et, *ev, *tb; + PyObject *result; assert(o); if (Future_CheckExact(o) || Task_CheckExact(o)) { PyObject *fut_result = NULL; int res = future_get_result((FutureObj*)o, &fut_result); - PyObject *result; switch(res) { case -1: assert(fut_result == NULL); - return NULL; + break; /* exception raised */ case 0: Py_DECREF(fut_result); return task_call_step(task, NULL); @@ -2343,29 +2339,32 @@ task_wakeup(TaskObj *task, PyObject *o) return result; } } - - PyObject *fut_result = PyObject_CallMethod(o, "result", NULL); - if (fut_result == NULL) { - PyObject *et, *ev, *tb; - PyObject *res; - - PyErr_Fetch(&et, &ev, &tb); - if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { - PyErr_NormalizeException(&et, &ev, &tb); + else { + PyObject *fut_result = PyObject_CallMethod(o, "result", NULL); + if (fut_result != NULL) { + Py_DECREF(fut_result); + return task_call_step(task, NULL); } + /* exception raised */ + } - res = task_call_step(task, ev); - - Py_XDECREF(et); - Py_XDECREF(tb); - Py_XDECREF(ev); - - return res; + PyErr_Fetch(&et, &ev, &tb); + if (!PyErr_GivenExceptionMatches(et, PyExc_Exception)) { + /* We've got a BaseException; re-raise it */ + PyErr_Restore(et, ev, tb); + return NULL; } - else { - Py_DECREF(fut_result); - return task_call_step(task, NULL); + if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { + PyErr_NormalizeException(&et, &ev, &tb); } + + result = task_call_step(task, ev); + + Py_DECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + + return result; } @@ -2398,7 +2397,7 @@ module_init(void) Py_CLEAR(module); \ module = PyImport_ImportModule(NAME); \ if (module == NULL) { \ - return -1; \ + goto fail; \ } #define GET_MOD_ATTR(VAR, NAME) \ @@ -2429,7 +2428,7 @@ module_init(void) WITH_MOD("weakref") GET_MOD_ATTR(cls, "WeakSet") all_tasks = _PyObject_CallNoArg(cls); - Py_CLEAR(cls); + Py_DECREF(cls); if (all_tasks == NULL) { goto fail; } @@ -2439,7 +2438,7 @@ module_init(void) goto fail; } - Py_CLEAR(module); + Py_DECREF(module); return 0; fail: @@ -2478,7 +2477,7 @@ PyInit__asyncio(void) if (PyType_Ready(&FutureIterType) < 0) { return NULL; } - if (PyType_Ready(&TaskSendMethWrapper_Type) < 0) { + if (PyType_Ready(&TaskStepMethWrapper_Type) < 0) { return NULL; } if(PyType_Ready(&TaskWakeupMethWrapper_Type) < 0) { diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index 8f598edd05e..7627849bb88 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -28,7 +28,7 @@ _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs) int return_value = -1; static const char * const _keywords[] = {"loop", NULL}; static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0}; - PyObject *loop = NULL; + PyObject *loop = Py_None; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &loop)) { @@ -244,7 +244,7 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs) static const char * const _keywords[] = {"coro", "loop", NULL}; static _PyArg_Parser _parser = {"O|$O:Task", _keywords, 0}; PyObject *coro; - PyObject *loop = NULL; + PyObject *loop = Py_None; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &coro, &loop)) { @@ -477,7 +477,7 @@ _asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject * PyObject *return_value = NULL; static const char * const _keywords[] = {"exc", NULL}; static _PyArg_Parser _parser = {"|O:_step", _keywords, 0}; - PyObject *exc = NULL; + PyObject *exc = Py_None; if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, &exc)) { @@ -517,4 +517,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject exit: return return_value; } -/*[clinic end generated code: output=fe651840e0466fa9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b92f9cd2b9fb37ef input=a9049054013a1b77]*/ From webhook-mailer at python.org Sun Sep 3 02:24:35 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 03 Sep 2017 06:24:35 -0000 Subject: [Python-checkins] bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076) (#3269) Message-ID: https://github.com/python/cpython/commit/98bbeb78e06d5756491705920e72f9721850c727 commit: 98bbeb78e06d5756491705920e72f9721850c727 branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-09-03T09:24:32+03:00 summary: bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (#3076) (#3269) (cherry picked from commit bca4939d806170c3ca5d05f23710d11a8f1669cf) files: A Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst M Lib/test/test_asyncio/test_futures.py M Modules/_asynciomodule.c M Modules/clinic/_asynciomodule.c.h diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ebedfec7fa3..a06059dc9b7 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -100,8 +100,8 @@ def test_ensure_future(self): class BaseFutureTests: - def _new_future(self, loop=None): - raise NotImplementedError + def _new_future(self, *args, **kwargs): + return self.cls(*args, **kwargs) def setUp(self): super().setUp() @@ -147,6 +147,39 @@ def test_constructor_positional(self): # Make sure Future doesn't accept a positional argument self.assertRaises(TypeError, self._new_future, 42) + def test_uninitialized(self): + fut = self.cls.__new__(self.cls, loop=self.loop) + self.assertRaises(asyncio.InvalidStateError, fut.result) + fut = self.cls.__new__(self.cls, loop=self.loop) + self.assertRaises(asyncio.InvalidStateError, fut.exception) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.set_result(None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.set_exception(Exception) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.cancel() + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.add_done_callback(lambda f: None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut.remove_done_callback(lambda f: None) + fut = self.cls.__new__(self.cls, loop=self.loop) + with self.assertRaises((RuntimeError, AttributeError)): + fut._schedule_callbacks() + fut = self.cls.__new__(self.cls, loop=self.loop) + try: + repr(fut) + except AttributeError: + pass + fut = self.cls.__new__(self.cls, loop=self.loop) + fut.cancelled() + fut.done() + iter(fut) + def test_cancel(self): f = self._new_future(loop=self.loop) self.assertTrue(f.cancel()) @@ -499,15 +532,11 @@ def __del__(self): @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') class CFutureTests(BaseFutureTests, test_utils.TestCase): - - def _new_future(self, *args, **kwargs): - return futures._CFuture(*args, **kwargs) + cls = getattr(futures, '_CFuture') class PyFutureTests(BaseFutureTests, test_utils.TestCase): - - def _new_future(self, *args, **kwargs): - return futures._PyFuture(*args, **kwargs) + cls = futures._PyFuture class BaseFutureDoneCallbackTests(): diff --git a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst new file mode 100644 index 00000000000..bdaa4ea35da --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst @@ -0,0 +1 @@ +Fixed miscellaneous errors in asyncio speedup module. diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index c48cbbc263d..35632a6e6fa 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -68,7 +68,7 @@ typedef struct { PyObject_HEAD TaskObj *sw_task; PyObject *sw_arg; -} TaskSendMethWrapper; +} TaskStepMethWrapper; typedef struct { PyObject_HEAD @@ -92,11 +92,11 @@ static int future_schedule_callbacks(FutureObj *fut) { Py_ssize_t len; - PyObject* iters; + PyObject *callbacks; int i; if (fut->fut_callbacks == NULL) { - PyErr_SetString(PyExc_RuntimeError, "NULL callbacks"); + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); return -1; } @@ -105,43 +105,42 @@ future_schedule_callbacks(FutureObj *fut) return 0; } - iters = PyList_GetSlice(fut->fut_callbacks, 0, len); - if (iters == NULL) { + callbacks = PyList_GetSlice(fut->fut_callbacks, 0, len); + if (callbacks == NULL) { return -1; } if (PyList_SetSlice(fut->fut_callbacks, 0, len, NULL) < 0) { - Py_DECREF(iters); + Py_DECREF(callbacks); return -1; } for (i = 0; i < len; i++) { - PyObject *handle = NULL; - PyObject *cb = PyList_GET_ITEM(iters, i); + PyObject *handle; + PyObject *cb = PyList_GET_ITEM(callbacks, i); - handle = _PyObject_CallMethodId( - fut->fut_loop, &PyId_call_soon, "OO", cb, fut, NULL); + handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, &PyId_call_soon, + cb, fut, NULL); if (handle == NULL) { - Py_DECREF(iters); + Py_DECREF(callbacks); return -1; } - else { - Py_DECREF(handle); - } + Py_DECREF(handle); } - Py_DECREF(iters); + Py_DECREF(callbacks); return 0; } static int future_init(FutureObj *fut, PyObject *loop) { - PyObject *res = NULL; + PyObject *res; + int is_true; _Py_IDENTIFIER(get_debug); - if (loop == NULL || loop == Py_None) { - loop = PyObject_CallObject(asyncio_get_event_loop, NULL); + if (loop == Py_None) { + loop = _PyObject_CallNoArg(asyncio_get_event_loop); if (loop == NULL) { return -1; } @@ -149,25 +148,25 @@ future_init(FutureObj *fut, PyObject *loop) else { Py_INCREF(loop); } - Py_CLEAR(fut->fut_loop); - fut->fut_loop = loop; + Py_XSETREF(fut->fut_loop, loop); res = _PyObject_CallMethodId(fut->fut_loop, &PyId_get_debug, NULL); if (res == NULL) { return -1; } - if (PyObject_IsTrue(res)) { - Py_CLEAR(res); - fut->fut_source_tb = PyObject_CallObject(traceback_extract_stack, NULL); + is_true = PyObject_IsTrue(res); + Py_DECREF(res); + if (is_true < 0) { + return -1; + } + if (is_true) { + Py_XSETREF(fut->fut_source_tb, _PyObject_CallNoArg(traceback_extract_stack)); if (fut->fut_source_tb == NULL) { return -1; } } - else { - Py_CLEAR(res); - } - fut->fut_callbacks = PyList_New(0); + Py_XSETREF(fut->fut_callbacks, PyList_New(0)); if (fut->fut_callbacks == NULL) { return -1; } @@ -183,6 +182,7 @@ future_set_result(FutureObj *fut, PyObject *res) return NULL; } + assert(!fut->fut_result); Py_INCREF(res); fut->fut_result = res; fut->fut_state = STATE_FINISHED; @@ -208,6 +208,11 @@ future_set_exception(FutureObj *fut, PyObject *exc) if (exc_val == NULL) { return NULL; } + if (fut->fut_state != STATE_PENDING) { + Py_DECREF(exc_val); + PyErr_SetString(asyncio_InvalidStateError, "invalid state"); + return NULL; + } } else { exc_val = exc; @@ -226,6 +231,7 @@ future_set_exception(FutureObj *fut, PyObject *exc) return NULL; } + assert(!fut->fut_exception); fut->fut_exception = exc_val; fut->fut_state = STATE_FINISHED; @@ -240,31 +246,14 @@ future_set_exception(FutureObj *fut, PyObject *exc) static int future_get_result(FutureObj *fut, PyObject **result) { - PyObject *exc; - if (fut->fut_state == STATE_CANCELLED) { - exc = _PyObject_CallNoArg(asyncio_CancelledError); - if (exc == NULL) { - return -1; - } - *result = exc; - return 1; + PyErr_SetNone(asyncio_CancelledError); + return -1; } if (fut->fut_state != STATE_FINISHED) { - PyObject *msg = PyUnicode_FromString("Result is not ready."); - if (msg == NULL) { - return -1; - } - - exc = _PyObject_CallArg1(asyncio_InvalidStateError, msg); - Py_DECREF(msg); - if (exc == NULL) { - return -1; - } - - *result = exc; - return 1; + PyErr_SetString(asyncio_InvalidStateError, "Result is not set."); + return -1; } fut->fut_log_tb = 0; @@ -283,17 +272,19 @@ static PyObject * future_add_done_callback(FutureObj *fut, PyObject *arg) { if (fut->fut_state != STATE_PENDING) { - PyObject *handle = _PyObject_CallMethodId( - fut->fut_loop, &PyId_call_soon, "OO", arg, fut, NULL); - + PyObject *handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, + &PyId_call_soon, + arg, fut, NULL); if (handle == NULL) { return NULL; } - else { - Py_DECREF(handle); - } + Py_DECREF(handle); } else { + if (fut->fut_callbacks == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); + return NULL; + } int err = PyList_Append(fut->fut_callbacks, arg); if (err != 0) { return NULL; @@ -323,7 +314,7 @@ future_cancel(FutureObj *fut) _asyncio.Future.__init__ * - loop: 'O' = NULL + loop: object = None This class is *almost* compatible with concurrent.futures.Future. @@ -341,7 +332,7 @@ This class is *almost* compatible with concurrent.futures.Future. static int _asyncio_Future___init___impl(FutureObj *self, PyObject *loop) -/*[clinic end generated code: output=9ed75799eaccb5d6 input=8e1681f23605be2d]*/ +/*[clinic end generated code: output=9ed75799eaccb5d6 input=89af317082bc0bf8]*/ { return future_init(self, loop); @@ -419,12 +410,12 @@ _asyncio_Future_exception_impl(FutureObj *self) /*[clinic end generated code: output=88b20d4f855e0710 input=733547a70c841c68]*/ { if (self->fut_state == STATE_CANCELLED) { - PyErr_SetString(asyncio_CancelledError, ""); + PyErr_SetNone(asyncio_CancelledError); return NULL; } if (self->fut_state != STATE_FINISHED) { - PyErr_SetString(asyncio_InvalidStateError, "Result is not ready."); + PyErr_SetString(asyncio_InvalidStateError, "Exception is not set."); return NULL; } @@ -440,7 +431,7 @@ _asyncio_Future_exception_impl(FutureObj *self) /*[clinic input] _asyncio.Future.set_result - res: 'O' + res: object / Mark the future done and set its result. @@ -451,7 +442,7 @@ InvalidStateError. static PyObject * _asyncio_Future_set_result(FutureObj *self, PyObject *res) -/*[clinic end generated code: output=a620abfc2796bfb6 input=8619565e0503357e]*/ +/*[clinic end generated code: output=a620abfc2796bfb6 input=5b9dc180f1baa56d]*/ { return future_set_result(self, res); } @@ -459,7 +450,7 @@ _asyncio_Future_set_result(FutureObj *self, PyObject *res) /*[clinic input] _asyncio.Future.set_exception - exception: 'O' + exception: object / Mark the future done and set an exception. @@ -470,7 +461,7 @@ InvalidStateError. static PyObject * _asyncio_Future_set_exception(FutureObj *self, PyObject *exception) -/*[clinic end generated code: output=f1c1b0cd321be360 input=1377dbe15e6ea186]*/ +/*[clinic end generated code: output=f1c1b0cd321be360 input=e45b7d7aa71cc66d]*/ { return future_set_exception(self, exception); } @@ -478,7 +469,7 @@ _asyncio_Future_set_exception(FutureObj *self, PyObject *exception) /*[clinic input] _asyncio.Future.add_done_callback - fn: 'O' + fn: object / Add a callback to be run when the future becomes done. @@ -490,7 +481,7 @@ scheduled with call_soon. static PyObject * _asyncio_Future_add_done_callback(FutureObj *self, PyObject *fn) -/*[clinic end generated code: output=819e09629b2ec2b5 input=8cce187e32cec6a8]*/ +/*[clinic end generated code: output=819e09629b2ec2b5 input=8f818b39990b027d]*/ { return future_add_done_callback(self, fn); } @@ -498,7 +489,7 @@ _asyncio_Future_add_done_callback(FutureObj *self, PyObject *fn) /*[clinic input] _asyncio.Future.remove_done_callback - fn: 'O' + fn: object / Remove all instances of a callback from the "call when done" list. @@ -508,11 +499,16 @@ Returns the number of callbacks removed. static PyObject * _asyncio_Future_remove_done_callback(FutureObj *self, PyObject *fn) -/*[clinic end generated code: output=5ab1fb52b24ef31f input=3fedb73e1409c31c]*/ +/*[clinic end generated code: output=5ab1fb52b24ef31f input=0a43280a149d505b]*/ { PyObject *newlist; Py_ssize_t len, i, j=0; + if (self->fut_callbacks == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object"); + return NULL; + } + len = PyList_GET_SIZE(self->fut_callbacks); if (len == 0) { return PyLong_FromSsize_t(0); @@ -526,29 +522,31 @@ _asyncio_Future_remove_done_callback(FutureObj *self, PyObject *fn) for (i = 0; i < PyList_GET_SIZE(self->fut_callbacks); i++) { int ret; PyObject *item = PyList_GET_ITEM(self->fut_callbacks, i); - - if ((ret = PyObject_RichCompareBool(fn, item, Py_EQ)) < 0) { - goto fail; - } + Py_INCREF(item); + ret = PyObject_RichCompareBool(fn, item, Py_EQ); if (ret == 0) { if (j < len) { - Py_INCREF(item); PyList_SET_ITEM(newlist, j, item); j++; + continue; } - else { - if (PyList_Append(newlist, item)) { - goto fail; - } - } + ret = PyList_Append(newlist, item); + } + Py_DECREF(item); + if (ret < 0) { + goto fail; } } - if (PyList_SetSlice(newlist, j, len, NULL) < 0) { - goto fail; + if (j < len) { + Py_SIZE(newlist) = j; } - if (PyList_SetSlice(self->fut_callbacks, 0, len, newlist) < 0) { - goto fail; + j = PyList_GET_SIZE(newlist); + len = PyList_GET_SIZE(self->fut_callbacks); + if (j != len) { + if (PyList_SetSlice(self->fut_callbacks, 0, len, newlist) < 0) { + goto fail; + } } Py_DECREF(newlist); return PyLong_FromSsize_t(len - j); @@ -729,7 +727,7 @@ FutureObj_get_state(FutureObj *fut) default: assert (0); } - Py_INCREF(ret); + Py_XINCREF(ret); return ret; } @@ -765,25 +763,14 @@ FutureObj_repr(FutureObj *fut) { _Py_IDENTIFIER(_repr_info); - PyObject *_repr_info = _PyUnicode_FromId(&PyId__repr_info); // borrowed - if (_repr_info == NULL) { - return NULL; - } - - PyObject *rinfo = PyObject_CallMethodObjArgs((PyObject*)fut, _repr_info, - NULL); + PyObject *rinfo = _PyObject_CallMethodIdObjArgs((PyObject*)fut, + &PyId__repr_info, + NULL); if (rinfo == NULL) { return NULL; } - PyObject *sp = PyUnicode_FromString(" "); - if (sp == NULL) { - Py_DECREF(rinfo); - return NULL; - } - - PyObject *rinfo_s = PyUnicode_Join(sp, rinfo); - Py_DECREF(sp); + PyObject *rinfo_s = PyUnicode_Join(NULL, rinfo); Py_DECREF(rinfo); if (rinfo_s == NULL) { return NULL; @@ -793,7 +780,7 @@ FutureObj_repr(FutureObj *fut) PyObject *type_name = PyObject_GetAttrString((PyObject*)Py_TYPE(fut), "__name__"); if (type_name != NULL) { - rstr = PyUnicode_FromFormat("<%S %S>", type_name, rinfo_s); + rstr = PyUnicode_FromFormat("<%S %U>", type_name, rinfo_s); Py_DECREF(type_name); } Py_DECREF(rinfo_s); @@ -809,22 +796,21 @@ FutureObj_finalize(FutureObj *fut) _Py_IDENTIFIER(future); _Py_IDENTIFIER(source_traceback); + PyObject *error_type, *error_value, *error_traceback; + PyObject *context; + PyObject *type_name; + PyObject *message = NULL; + PyObject *func; + if (!fut->fut_log_tb) { return; } assert(fut->fut_exception != NULL); - fut->fut_log_tb = 0;; + fut->fut_log_tb = 0; - PyObject *error_type, *error_value, *error_traceback; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); - PyObject *context = NULL; - PyObject *type_name = NULL; - PyObject *message = NULL; - PyObject *func = NULL; - PyObject *res = NULL; - context = PyDict_New(); if (context == NULL) { goto finally; @@ -837,6 +823,7 @@ FutureObj_finalize(FutureObj *fut) message = PyUnicode_FromFormat( "%S exception was never retrieved", type_name); + Py_DECREF(type_name); if (message == NULL) { goto finally; } @@ -855,18 +842,19 @@ FutureObj_finalize(FutureObj *fut) func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + PyObject *res = _PyObject_CallArg1(func, context); if (res == NULL) { PyErr_WriteUnraisable(func); } + else { + Py_DECREF(res); + } + Py_DECREF(func); } finally: - Py_CLEAR(context); - Py_CLEAR(type_name); - Py_CLEAR(message); - Py_CLEAR(func); - Py_CLEAR(res); + Py_XDECREF(context); + Py_XDECREF(message); /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); @@ -1013,22 +1001,19 @@ FutureIter_iternext(futureiterobject *it) Py_INCREF(fut); return (PyObject *)fut; } - PyErr_Format(PyExc_AssertionError, - "yield from wasn't used with future"); + PyErr_SetString(PyExc_AssertionError, + "yield from wasn't used with future"); return NULL; } + it->future = NULL; res = _asyncio_Future_result_impl(fut); if (res != NULL) { /* The result of the Future is not an exception. */ - if (_PyGen_SetStopIterationValue(res) < 0) { - Py_DECREF(res); - return NULL; - } + (void)_PyGen_SetStopIterationValue(res); Py_DECREF(res); } - it->future = NULL; Py_DECREF(fut); return NULL; } @@ -1045,7 +1030,7 @@ FutureIter_send(futureiterobject *self, PyObject *unused) static PyObject * FutureIter_throw(futureiterobject *self, PyObject *args) { - PyObject *type=NULL, *val=NULL, *tb=NULL; + PyObject *type, *val = NULL, *tb = NULL; if (!PyArg_ParseTuple(args, "O|OO", &type, &val, &tb)) return NULL; @@ -1089,7 +1074,7 @@ FutureIter_throw(futureiterobject *self, PyObject *args) PyErr_Restore(type, val, tb); - return FutureIter_iternext(self); + return NULL; fail: Py_DECREF(type); @@ -1170,7 +1155,7 @@ static PyObject * task_step(TaskObj *, PyObject *); /* ----- Task._step wrapper */ static int -TaskSendMethWrapper_clear(TaskSendMethWrapper *o) +TaskStepMethWrapper_clear(TaskStepMethWrapper *o) { Py_CLEAR(o->sw_task); Py_CLEAR(o->sw_arg); @@ -1178,22 +1163,30 @@ TaskSendMethWrapper_clear(TaskSendMethWrapper *o) } static void -TaskSendMethWrapper_dealloc(TaskSendMethWrapper *o) +TaskStepMethWrapper_dealloc(TaskStepMethWrapper *o) { PyObject_GC_UnTrack(o); - (void)TaskSendMethWrapper_clear(o); + (void)TaskStepMethWrapper_clear(o); Py_TYPE(o)->tp_free(o); } static PyObject * -TaskSendMethWrapper_call(TaskSendMethWrapper *o, +TaskStepMethWrapper_call(TaskStepMethWrapper *o, PyObject *args, PyObject *kwds) { + if (kwds != NULL && PyDict_Size(kwds) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no keyword arguments"); + return NULL; + } + if (args != NULL && PyTuple_GET_SIZE(args) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no positional arguments"); + return NULL; + } return task_call_step(o->sw_task, o->sw_arg); } static int -TaskSendMethWrapper_traverse(TaskSendMethWrapper *o, +TaskStepMethWrapper_traverse(TaskStepMethWrapper *o, visitproc visit, void *arg) { Py_VISIT(o->sw_task); @@ -1202,7 +1195,7 @@ TaskSendMethWrapper_traverse(TaskSendMethWrapper *o, } static PyObject * -TaskSendMethWrapper_get___self__(TaskSendMethWrapper *o) +TaskStepMethWrapper_get___self__(TaskStepMethWrapper *o) { if (o->sw_task) { Py_INCREF(o->sw_task); @@ -1211,30 +1204,30 @@ TaskSendMethWrapper_get___self__(TaskSendMethWrapper *o) Py_RETURN_NONE; } -static PyGetSetDef TaskSendMethWrapper_getsetlist[] = { - {"__self__", (getter)TaskSendMethWrapper_get___self__, NULL, NULL}, +static PyGetSetDef TaskStepMethWrapper_getsetlist[] = { + {"__self__", (getter)TaskStepMethWrapper_get___self__, NULL, NULL}, {NULL} /* Sentinel */ }; -PyTypeObject TaskSendMethWrapper_Type = { +PyTypeObject TaskStepMethWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "TaskSendMethWrapper", - .tp_basicsize = sizeof(TaskSendMethWrapper), + "TaskStepMethWrapper", + .tp_basicsize = sizeof(TaskStepMethWrapper), .tp_itemsize = 0, - .tp_getset = TaskSendMethWrapper_getsetlist, - .tp_dealloc = (destructor)TaskSendMethWrapper_dealloc, - .tp_call = (ternaryfunc)TaskSendMethWrapper_call, + .tp_getset = TaskStepMethWrapper_getsetlist, + .tp_dealloc = (destructor)TaskStepMethWrapper_dealloc, + .tp_call = (ternaryfunc)TaskStepMethWrapper_call, .tp_getattro = PyObject_GenericGetAttr, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - .tp_traverse = (traverseproc)TaskSendMethWrapper_traverse, - .tp_clear = (inquiry)TaskSendMethWrapper_clear, + .tp_traverse = (traverseproc)TaskStepMethWrapper_traverse, + .tp_clear = (inquiry)TaskStepMethWrapper_clear, }; static PyObject * -TaskSendMethWrapper_new(TaskObj *task, PyObject *arg) +TaskStepMethWrapper_new(TaskObj *task, PyObject *arg) { - TaskSendMethWrapper *o; - o = PyObject_GC_New(TaskSendMethWrapper, &TaskSendMethWrapper_Type); + TaskStepMethWrapper *o; + o = PyObject_GC_New(TaskStepMethWrapper, &TaskStepMethWrapper_Type); if (o == NULL) { return NULL; } @@ -1257,7 +1250,11 @@ TaskWakeupMethWrapper_call(TaskWakeupMethWrapper *o, { PyObject *fut; - if (!PyArg_ParseTuple(args, "O|", &fut)) { + if (kwds != NULL && PyDict_Size(kwds) != 0) { + PyErr_SetString(PyExc_TypeError, "function takes no keyword arguments"); + return NULL; + } + if (!PyArg_ParseTuple(args, "O", &fut)) { return NULL; } @@ -1321,16 +1318,16 @@ TaskWakeupMethWrapper_new(TaskObj *task) /*[clinic input] _asyncio.Task.__init__ - coro: 'O' + coro: object * - loop: 'O' = NULL + loop: object = None A coroutine wrapped in a Future. [clinic start generated code]*/ static int _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop) -/*[clinic end generated code: output=9f24774c2287fc2f input=71d8d28c201a18cd]*/ +/*[clinic end generated code: output=9f24774c2287fc2f input=8d132974b049593e]*/ { PyObject *res; _Py_IDENTIFIER(add); @@ -1436,7 +1433,7 @@ TaskObj_get_fut_waiter(TaskObj *task) @classmethod _asyncio.Task.current_task - loop: 'O' = None + loop: object = None Return the currently running task in an event loop or None. @@ -1447,7 +1444,7 @@ None is returned when called not in the context of a Task. static PyObject * _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop) -/*[clinic end generated code: output=99fbe7332c516e03 input=a0d6cdf2e3b243e1]*/ +/*[clinic end generated code: output=99fbe7332c516e03 input=cd14770c5b79c7eb]*/ { PyObject *res; @@ -1509,12 +1506,14 @@ task_all_tasks(PyObject *loop) Py_DECREF(task_loop); Py_DECREF(task); } - + if (PyErr_Occurred()) { + goto fail; + } Py_DECREF(iter); return set; fail: - Py_XDECREF(set); + Py_DECREF(set); Py_XDECREF(iter); return NULL; } @@ -1523,7 +1522,7 @@ task_all_tasks(PyObject *loop) @classmethod _asyncio.Task.all_tasks - loop: 'O' = None + loop: object = None Return a set of all tasks for an event loop. @@ -1532,7 +1531,7 @@ By default all tasks for the current event loop are returned. static PyObject * _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop) -/*[clinic end generated code: output=11f9b20749ccca5d input=c6f5b53bd487488f]*/ +/*[clinic end generated code: output=11f9b20749ccca5d input=497f80bc9ce726b5]*/ { PyObject *res; @@ -1626,7 +1625,7 @@ _asyncio_Task_cancel_impl(TaskObj *self) _asyncio.Task.get_stack * - limit: 'O' = None + limit: object = None Return the list of stack frames for this task's coroutine. @@ -1651,7 +1650,7 @@ returned for a suspended coroutine. static PyObject * _asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit) -/*[clinic end generated code: output=c9aeeeebd1e18118 input=b1920230a766d17a]*/ +/*[clinic end generated code: output=c9aeeeebd1e18118 input=05b323d42b809b90]*/ { return PyObject_CallFunctionObjArgs( asyncio_task_get_stack_func, self, limit, NULL); @@ -1661,8 +1660,8 @@ _asyncio_Task_get_stack_impl(TaskObj *self, PyObject *limit) _asyncio.Task.print_stack * - limit: 'O' = None - file: 'O' = None + limit: object = None + file: object = None Print the stack or traceback for this task's coroutine. @@ -1676,7 +1675,7 @@ to sys.stderr. static PyObject * _asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit, PyObject *file) -/*[clinic end generated code: output=7339e10314cd3f4d input=19f1e99ab5400bc3]*/ +/*[clinic end generated code: output=7339e10314cd3f4d input=1a0352913b7fcd92]*/ { return PyObject_CallFunctionObjArgs( asyncio_task_print_stack_func, self, limit, file, NULL); @@ -1685,12 +1684,12 @@ _asyncio_Task_print_stack_impl(TaskObj *self, PyObject *limit, /*[clinic input] _asyncio.Task._step - exc: 'O' = NULL + exc: object = None [clinic start generated code]*/ static PyObject * _asyncio_Task__step_impl(TaskObj *self, PyObject *exc) -/*[clinic end generated code: output=7ed23f0cefd5ae42 input=ada4b2324e5370af]*/ +/*[clinic end generated code: output=7ed23f0cefd5ae42 input=1e19a985ace87ca4]*/ { return task_step(self, exc == Py_None ? NULL : exc); } @@ -1698,12 +1697,12 @@ _asyncio_Task__step_impl(TaskObj *self, PyObject *exc) /*[clinic input] _asyncio.Task._wakeup - fut: 'O' + fut: object [clinic start generated code]*/ static PyObject * _asyncio_Task__wakeup_impl(TaskObj *self, PyObject *fut) -/*[clinic end generated code: output=75cb341c760fd071 input=11ee4918a5bdbf21]*/ +/*[clinic end generated code: output=75cb341c760fd071 input=6a0616406f829a7b]*/ { return task_wakeup(self, fut); } @@ -1716,11 +1715,9 @@ TaskObj_finalize(TaskObj *task) _Py_IDENTIFIER(message); _Py_IDENTIFIER(source_traceback); + PyObject *context; PyObject *message = NULL; - PyObject *context = NULL; - PyObject *func = NULL; - PyObject *res = NULL; - + PyObject *func; PyObject *error_type, *error_value, *error_traceback; if (task->task_state != STATE_PENDING || !task->task_log_destroy_pending) { @@ -1756,17 +1753,19 @@ TaskObj_finalize(TaskObj *task) func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + PyObject *res = _PyObject_CallArg1(func, context); if (res == NULL) { PyErr_WriteUnraisable(func); } + else { + Py_DECREF(res); + } + Py_DECREF(func); } finally: - Py_CLEAR(context); - Py_CLEAR(message); - Py_CLEAR(func); - Py_CLEAR(res); + Py_XDECREF(context); + Py_XDECREF(message); /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); @@ -1878,9 +1877,6 @@ task_call_step(TaskObj *task, PyObject *arg) } else { /* `task` is a subclass of Task */ - if (arg == NULL) { - arg = Py_None; - } return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__step, arg, NULL); } @@ -1891,7 +1887,7 @@ task_call_step_soon(TaskObj *task, PyObject *arg) { PyObject *handle; - PyObject *cb = TaskSendMethWrapper_new(task, arg); + PyObject *cb = TaskStepMethWrapper_new(task, arg); if (cb == NULL) { return -1; } @@ -1946,7 +1942,7 @@ task_step_impl(TaskObj *task, PyObject *exc) int res; int clear_exc = 0; PyObject *result = NULL; - PyObject *coro = task->task_coro; + PyObject *coro; PyObject *o; if (task->task_state != STATE_PENDING) { @@ -1987,6 +1983,12 @@ task_step_impl(TaskObj *task, PyObject *exc) Py_CLEAR(task->task_fut_waiter); + coro = task->task_coro; + if (coro == NULL) { + PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object"); + return NULL; + } + if (exc == NULL) { if (PyGen_CheckExact(coro) || PyCoro_CheckExact(coro)) { result = _PyGen_Send((PyGenObject*)coro, Py_None); @@ -2001,7 +2003,7 @@ task_step_impl(TaskObj *task, PyObject *exc) coro, &PyId_throw, exc, NULL); if (clear_exc) { /* We created 'exc' during this call */ - Py_CLEAR(exc); + Py_DECREF(exc); } } @@ -2050,13 +2052,13 @@ task_step_impl(TaskObj *task, PyObject *exc) o = future_set_exception((FutureObj*)task, ev); if (!o) { /* An exception in Task.set_exception() */ - Py_XDECREF(et); + Py_DECREF(et); Py_XDECREF(tb); Py_XDECREF(ev); goto fail; } assert(o == Py_None); - Py_CLEAR(o); + Py_DECREF(o); if (!PyErr_GivenExceptionMatches(et, PyExc_Exception)) { /* We've got a BaseException; re-raise it */ @@ -2064,7 +2066,7 @@ task_step_impl(TaskObj *task, PyObject *exc) goto fail; } - Py_XDECREF(et); + Py_DECREF(et); Py_XDECREF(tb); Py_XDECREF(ev); @@ -2136,7 +2138,7 @@ task_step_impl(TaskObj *task, PyObject *exc) } else { if (o == Py_None) { - Py_CLEAR(o); + Py_DECREF(o); } else { /* `result` is a Future-compatible object */ @@ -2144,7 +2146,7 @@ task_step_impl(TaskObj *task, PyObject *exc) PyObject *res; int blocking = PyObject_IsTrue(o); - Py_CLEAR(o); + Py_DECREF(o); if (blocking < 0) { goto fail; } @@ -2227,7 +2229,7 @@ task_step_impl(TaskObj *task, PyObject *exc) goto fail; } res = PyObject_IsTrue(o); - Py_CLEAR(o); + Py_DECREF(o); if (res == -1) { /* An exception while checking if 'val' is True */ goto fail; @@ -2295,14 +2297,8 @@ task_step(TaskObj *task, PyObject *exc) PyObject *et, *ev, *tb; PyErr_Fetch(&et, &ev, &tb); ot = _PyDict_Pop(current_tasks, task->task_loop, NULL); - if (ot == NULL) { - Py_XDECREF(et); - Py_XDECREF(tb); - Py_XDECREF(ev); - return NULL; - } - Py_DECREF(ot); - PyErr_Restore(et, ev, tb); + Py_XDECREF(ot); + _PyErr_ChainExceptions(et, ev, tb); return NULL; } else { @@ -2321,17 +2317,18 @@ task_step(TaskObj *task, PyObject *exc) static PyObject * task_wakeup(TaskObj *task, PyObject *o) { + PyObject *et, *ev, *tb; + PyObject *result; assert(o); if (Future_CheckExact(o) || Task_CheckExact(o)) { PyObject *fut_result = NULL; int res = future_get_result((FutureObj*)o, &fut_result); - PyObject *result; switch(res) { case -1: assert(fut_result == NULL); - return NULL; + break; /* exception raised */ case 0: Py_DECREF(fut_result); return task_call_step(task, NULL); @@ -2342,29 +2339,32 @@ task_wakeup(TaskObj *task, PyObject *o) return result; } } - - PyObject *fut_result = PyObject_CallMethod(o, "result", NULL); - if (fut_result == NULL) { - PyObject *et, *ev, *tb; - PyObject *res; - - PyErr_Fetch(&et, &ev, &tb); - if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { - PyErr_NormalizeException(&et, &ev, &tb); + else { + PyObject *fut_result = PyObject_CallMethod(o, "result", NULL); + if (fut_result != NULL) { + Py_DECREF(fut_result); + return task_call_step(task, NULL); } + /* exception raised */ + } - res = task_call_step(task, ev); - - Py_XDECREF(et); - Py_XDECREF(tb); - Py_XDECREF(ev); - - return res; + PyErr_Fetch(&et, &ev, &tb); + if (!PyErr_GivenExceptionMatches(et, PyExc_Exception)) { + /* We've got a BaseException; re-raise it */ + PyErr_Restore(et, ev, tb); + return NULL; } - else { - Py_DECREF(fut_result); - return task_call_step(task, NULL); + if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { + PyErr_NormalizeException(&et, &ev, &tb); } + + result = task_call_step(task, ev); + + Py_DECREF(et); + Py_XDECREF(tb); + Py_XDECREF(ev); + + return result; } @@ -2397,7 +2397,7 @@ module_init(void) Py_CLEAR(module); \ module = PyImport_ImportModule(NAME); \ if (module == NULL) { \ - return -1; \ + goto fail; \ } #define GET_MOD_ATTR(VAR, NAME) \ @@ -2427,8 +2427,8 @@ module_init(void) WITH_MOD("weakref") GET_MOD_ATTR(cls, "WeakSet") - all_tasks = PyObject_CallObject(cls, NULL); - Py_CLEAR(cls); + all_tasks = _PyObject_CallNoArg(cls); + Py_DECREF(cls); if (all_tasks == NULL) { goto fail; } @@ -2438,7 +2438,7 @@ module_init(void) goto fail; } - Py_CLEAR(module); + Py_DECREF(module); return 0; fail: @@ -2477,7 +2477,7 @@ PyInit__asyncio(void) if (PyType_Ready(&FutureIterType) < 0) { return NULL; } - if (PyType_Ready(&TaskSendMethWrapper_Type) < 0) { + if (PyType_Ready(&TaskStepMethWrapper_Type) < 0) { return NULL; } if(PyType_Ready(&TaskWakeupMethWrapper_Type) < 0) { diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h index 41f11f4cac5..62bf8e7a92d 100644 --- a/Modules/clinic/_asynciomodule.c.h +++ b/Modules/clinic/_asynciomodule.c.h @@ -28,7 +28,7 @@ _asyncio_Future___init__(PyObject *self, PyObject *args, PyObject *kwargs) int return_value = -1; static const char * const _keywords[] = {"loop", NULL}; static _PyArg_Parser _parser = {"|$O:Future", _keywords, 0}; - PyObject *loop = NULL; + PyObject *loop = Py_None; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &loop)) { @@ -244,7 +244,7 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs) static const char * const _keywords[] = {"coro", "loop", NULL}; static _PyArg_Parser _parser = {"O|$O:Task", _keywords, 0}; PyObject *coro; - PyObject *loop = NULL; + PyObject *loop = Py_None; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &coro, &loop)) { @@ -477,7 +477,7 @@ _asyncio_Task__step(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject * PyObject *return_value = NULL; static const char * const _keywords[] = {"exc", NULL}; static _PyArg_Parser _parser = {"|O:_step", _keywords, 0}; - PyObject *exc = NULL; + PyObject *exc = Py_None; if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &exc)) { @@ -517,4 +517,4 @@ _asyncio_Task__wakeup(TaskObj *self, PyObject **args, Py_ssize_t nargs, PyObject exit: return return_value; } -/*[clinic end generated code: output=40ca6c9da517da73 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7441872b13652085 input=a9049054013a1b77]*/ From solipsis at pitrou.net Sun Sep 3 05:06:59 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 03 Sep 2017 09:06:59 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170903090659.90691.D2F4791403EF56B9@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-1, -1, 2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog1eimV6', '--timeout', '7200'] From webhook-mailer at python.org Sun Sep 3 09:09:28 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Sun, 03 Sep 2017 13:09:28 -0000 Subject: [Python-checkins] Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (#3270) Message-ID: https://github.com/python/cpython/commit/2ef37607b7aacb7c750d008b9113fe11f96163c0 commit: 2ef37607b7aacb7c750d008b9113fe11f96163c0 branch: master author: Antoine Pitrou committer: GitHub date: 2017-09-03T15:09:23+02:00 summary: Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (#3270) files: M Lib/concurrent/futures/_base.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py index 88521ae317e..70c7b619593 100644 --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -171,15 +171,24 @@ def _create_and_install_waiters(fs, return_when): return waiter -def _yield_and_decref(fs, ref_collect): +def _yield_finished_futures(fs, waiter, ref_collect): """ - Iterate on the list *fs*, yielding objects one by one in reverse order. - Before yielding an object, it is removed from each set in - the collection of sets *ref_collect*. + Iterate on the list *fs*, yielding finished futures one by one in + reverse order. + Before yielding a future, *waiter* is removed from its waiters + and the future is removed from each set in the collection of sets + *ref_collect*. + + The aim of this function is to avoid keeping stale references after + the future is yielded and before the iterator resumes. """ while fs: + f = fs[-1] for futures_set in ref_collect: - futures_set.remove(fs[-1]) + futures_set.remove(f) + with f._condition: + f._waiters.remove(waiter) + del f # Careful not to keep a reference to the popped value yield fs.pop() @@ -216,7 +225,8 @@ def as_completed(fs, timeout=None): waiter = _create_and_install_waiters(fs, _AS_COMPLETED) finished = list(finished) try: - yield from _yield_and_decref(finished, ref_collect=(fs,)) + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs,)) while pending: if timeout is None: @@ -237,9 +247,11 @@ def as_completed(fs, timeout=None): # reverse to keep finishing order finished.reverse() - yield from _yield_and_decref(finished, ref_collect=(fs, pending)) + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs, pending)) finally: + # Remove waiter from unfinished futures for f in fs: with f._condition: f._waiters.remove(waiter) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index f1226fe7090..03f8d1d7112 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -405,7 +405,7 @@ def test_free_reference_yielded_future(self): # to finished futures. futures_list = [Future() for _ in range(8)] futures_list.append(create_future(state=CANCELLED_AND_NOTIFIED)) - futures_list.append(create_future(state=SUCCESSFUL_FUTURE)) + futures_list.append(create_future(state=FINISHED, result=42)) with self.assertRaises(futures.TimeoutError): for future in futures.as_completed(futures_list, timeout=0): From webhook-mailer at python.org Sun Sep 3 09:30:59 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Sun, 03 Sep 2017 13:30:59 -0000 Subject: [Python-checkins] [3.6] Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (GH-3270) (#3271) Message-ID: https://github.com/python/cpython/commit/5cbca0235b8da07c9454bcaa94f12d59c2df0ad2 commit: 5cbca0235b8da07c9454bcaa94f12d59c2df0ad2 branch: 3.6 author: Antoine Pitrou committer: GitHub date: 2017-09-03T15:30:55+02:00 summary: [3.6] Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (GH-3270) (#3271) (cherry picked from commit 2ef3760) files: M Lib/concurrent/futures/_base.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py index 88521ae317e..70c7b619593 100644 --- a/Lib/concurrent/futures/_base.py +++ b/Lib/concurrent/futures/_base.py @@ -171,15 +171,24 @@ def _create_and_install_waiters(fs, return_when): return waiter -def _yield_and_decref(fs, ref_collect): +def _yield_finished_futures(fs, waiter, ref_collect): """ - Iterate on the list *fs*, yielding objects one by one in reverse order. - Before yielding an object, it is removed from each set in - the collection of sets *ref_collect*. + Iterate on the list *fs*, yielding finished futures one by one in + reverse order. + Before yielding a future, *waiter* is removed from its waiters + and the future is removed from each set in the collection of sets + *ref_collect*. + + The aim of this function is to avoid keeping stale references after + the future is yielded and before the iterator resumes. """ while fs: + f = fs[-1] for futures_set in ref_collect: - futures_set.remove(fs[-1]) + futures_set.remove(f) + with f._condition: + f._waiters.remove(waiter) + del f # Careful not to keep a reference to the popped value yield fs.pop() @@ -216,7 +225,8 @@ def as_completed(fs, timeout=None): waiter = _create_and_install_waiters(fs, _AS_COMPLETED) finished = list(finished) try: - yield from _yield_and_decref(finished, ref_collect=(fs,)) + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs,)) while pending: if timeout is None: @@ -237,9 +247,11 @@ def as_completed(fs, timeout=None): # reverse to keep finishing order finished.reverse() - yield from _yield_and_decref(finished, ref_collect=(fs, pending)) + yield from _yield_finished_futures(finished, waiter, + ref_collect=(fs, pending)) finally: + # Remove waiter from unfinished futures for f in fs: with f._condition: f._waiters.remove(waiter) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 73baf9a8e49..9b61cc069b5 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -406,7 +406,7 @@ def test_free_reference_yielded_future(self): # to finished futures. futures_list = [Future() for _ in range(8)] futures_list.append(create_future(state=CANCELLED_AND_NOTIFIED)) - futures_list.append(create_future(state=SUCCESSFUL_FUTURE)) + futures_list.append(create_future(state=FINISHED, result=42)) with self.assertRaises(futures.TimeoutError): for future in futures.as_completed(futures_list, timeout=0): From webhook-mailer at python.org Sun Sep 3 16:29:37 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sun, 03 Sep 2017 20:29:37 -0000 Subject: [Python-checkins] [3.6] Fix a typo in the Programming FAQ. (GH-3230) (#3273) Message-ID: https://github.com/python/cpython/commit/d4097353baf7c3f2679f68679e36f2b3fd56c3f5 commit: d4097353baf7c3f2679f68679e36f2b3fd56c3f5 branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-03T13:29:34-07:00 summary: [3.6] Fix a typo in the Programming FAQ. (GH-3230) (#3273) subobjects, not subobjecs. (cherry picked from commit e9d978fd1bc122395efc91a82b16b2c4b968441d) files: M Doc/faq/programming.rst diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 9c5e20dcadf..7476ce11f4f 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1638,7 +1638,7 @@ collected. Despite the cycle collector, it's still a good idea to define an explicit ``close()`` method on objects to be called whenever you're done with them. The -``close()`` method can then remove attributes that refer to subobjecs. Don't +``close()`` method can then remove attributes that refer to subobjects. Don't call :meth:`__del__` directly -- :meth:`__del__` should call ``close()`` and ``close()`` should make sure that it can be called more than once for the same object. From webhook-mailer at python.org Sun Sep 3 17:08:51 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sun, 03 Sep 2017 21:08:51 -0000 Subject: [Python-checkins] bpo-9146: add the missing NEWS entry. (#3275) Message-ID: https://github.com/python/cpython/commit/4f013881cb0ca7d29620ddb0594dde09bc5d24ca commit: 4f013881cb0ca7d29620ddb0594dde09bc5d24ca branch: master author: Gregory P. Smith committer: GitHub date: 2017-09-03T14:08:48-07:00 summary: bpo-9146: add the missing NEWS entry. (#3275) files: A Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst diff --git a/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst b/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst new file mode 100644 index 00000000000..8c45bcef5fd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst @@ -0,0 +1,3 @@ +Fix a segmentation fault in _hashopenssl when standard hash functions +such as md5 are not available in the linked OpenSSL library. As in +some special FIPS-140 build environments. From webhook-mailer at python.org Sun Sep 3 17:35:22 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sun, 03 Sep 2017 21:35:22 -0000 Subject: [Python-checkins] [3.6] bpo-9146: Raise a ValueError if OpenSSL fails to init a hash func (#3274) Message-ID: https://github.com/python/cpython/commit/31b8efeaa893e95358b71eb2b8365552d3966b4a commit: 31b8efeaa893e95358b71eb2b8365552d3966b4a branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-03T14:35:19-07:00 summary: [3.6] bpo-9146: Raise a ValueError if OpenSSL fails to init a hash func (#3274) * [3.6] bpo-9146: Raise a ValueError if OpenSSL fails to init a hash func. (GH-1777) This helps people in weird FIPS mode environments where common things like MD5 are not available in the binary as a matter of policy. (cherry picked from commit 07244a83014fad42da937c17d98474b47a570bf7) * Include a NEWS entry. files: A Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst M Modules/_hashopenssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst b/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst new file mode 100644 index 00000000000..8c45bcef5fd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst @@ -0,0 +1,3 @@ +Fix a segmentation fault in _hashopenssl when standard hash functions +such as md5 are not available in the linked OpenSSL library. As in +some special FIPS-140 build environments. diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index daa4f3db2e8..395c719f302 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -139,7 +139,10 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len) process = MUNCH_SIZE; else process = Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int); - EVP_DigestUpdate(self->ctx, (const void*)cp, process); + if (!EVP_DigestUpdate(self->ctx, (const void*)cp, process)) { + _setException(PyExc_ValueError); + break; + } len -= process; cp += process; } @@ -209,7 +212,10 @@ EVP_digest(EVPobject *self, PyObject *unused) return _setException(PyExc_ValueError); } digest_size = EVP_MD_CTX_size(temp_ctx); - EVP_DigestFinal(temp_ctx, digest, NULL); + if (!EVP_DigestFinal(temp_ctx, digest, NULL)) { + _setException(PyExc_ValueError); + return NULL; + } retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); EVP_MD_CTX_free(temp_ctx); @@ -237,7 +243,10 @@ EVP_hexdigest(EVPobject *self, PyObject *unused) return _setException(PyExc_ValueError); } digest_size = EVP_MD_CTX_size(temp_ctx); - EVP_DigestFinal(temp_ctx, digest, NULL); + if (!EVP_DigestFinal(temp_ctx, digest, NULL)) { + _setException(PyExc_ValueError); + return NULL; + } EVP_MD_CTX_free(temp_ctx); @@ -362,7 +371,12 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds) PyBuffer_Release(&view); return -1; } - EVP_DigestInit(self->ctx, digest); + if (!EVP_DigestInit(self->ctx, digest)) { + _setException(PyExc_ValueError); + if (data_obj) + PyBuffer_Release(&view); + return -1; + } self->name = name_obj; Py_INCREF(self->name); @@ -461,7 +475,11 @@ EVPnew(PyObject *name_obj, if (initial_ctx) { EVP_MD_CTX_copy(self->ctx, initial_ctx); } else { - EVP_DigestInit(self->ctx, digest); + if (!EVP_DigestInit(self->ctx, digest)) { + _setException(PyExc_ValueError); + Py_DECREF(self); + return NULL; + } } if (cp && len) { @@ -902,6 +920,8 @@ generate_hash_name_list(void) * the generic one passing it a python string and are noticeably * faster than calling a python new() wrapper. Thats important for * code that wants to make hashes of a bunch of small strings. + * The first call will lazy-initialize, which reports an exception + * if initialization fails. */ #define GEN_CONSTRUCTOR(NAME) \ static PyObject * \ @@ -915,6 +935,17 @@ generate_hash_name_list(void) return NULL; \ } \ \ + if (CONST_new_ ## NAME ## _ctx_p == NULL) { \ + EVP_MD_CTX *ctx_p = EVP_MD_CTX_new(); \ + if (!EVP_get_digestbyname(#NAME) || \ + !EVP_DigestInit(ctx_p, EVP_get_digestbyname(#NAME))) { \ + _setException(PyExc_ValueError); \ + EVP_MD_CTX_free(ctx_p); \ + return NULL; \ + } \ + CONST_new_ ## NAME ## _ctx_p = ctx_p; \ + } \ + \ if (data_obj) \ GET_BUFFER_VIEW_OR_ERROUT(data_obj, &view); \ \ @@ -942,10 +973,6 @@ generate_hash_name_list(void) #define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ if (CONST_ ## NAME ## _name_obj == NULL) { \ CONST_ ## NAME ## _name_obj = PyUnicode_FromString(#NAME); \ - if (EVP_get_digestbyname(#NAME)) { \ - CONST_new_ ## NAME ## _ctx_p = EVP_MD_CTX_new(); \ - EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ - } \ } \ } while (0); From webhook-mailer at python.org Sun Sep 3 17:52:23 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sun, 03 Sep 2017 21:52:23 -0000 Subject: [Python-checkins] [3.6] bpo-29212: Fix the ugly repr() ThreadPoolExecutor thread name. (GH-2315) (#3276) Message-ID: https://github.com/python/cpython/commit/7d8282d25d4900dd3367daf28bb393be7f276729 commit: 7d8282d25d4900dd3367daf28bb393be7f276729 branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-03T14:52:20-07:00 summary: [3.6] bpo-29212: Fix the ugly repr() ThreadPoolExecutor thread name. (GH-2315) (#3276) bpo-29212: Fix the ugly ThreadPoolExecutor thread name. Fixes the newly introduced ugly default thread name for concurrent.futures thread.ThreadPoolExecutor threads. They'll now resemble the old <=3.5 threading default Thread-x names by being named ThreadPoolExecutor-y_n.. (cherry picked from commit a3d91b43c2851312fb942f31afa12f5961706db6) files: A Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst M Lib/concurrent/futures/thread.py M Lib/test/test_concurrent_futures.py diff --git a/Lib/concurrent/futures/thread.py b/Lib/concurrent/futures/thread.py index 5ade790e3db..0b5d5373ffd 100644 --- a/Lib/concurrent/futures/thread.py +++ b/Lib/concurrent/futures/thread.py @@ -7,6 +7,7 @@ import atexit from concurrent.futures import _base +import itertools import queue import threading import weakref @@ -83,6 +84,10 @@ def _worker(executor_reference, work_queue): _base.LOGGER.critical('Exception in worker', exc_info=True) class ThreadPoolExecutor(_base.Executor): + + # Used to assign unique thread names when thread_name_prefix is not supplied. + _counter = itertools.count().__next__ + def __init__(self, max_workers=None, thread_name_prefix=''): """Initializes a new ThreadPoolExecutor instance. @@ -103,7 +108,8 @@ def __init__(self, max_workers=None, thread_name_prefix=''): self._threads = set() self._shutdown = False self._shutdown_lock = threading.Lock() - self._thread_name_prefix = thread_name_prefix + self._thread_name_prefix = (thread_name_prefix or + ("ThreadPoolExecutor-%d" % self._counter())) def submit(self, fn, *args, **kwargs): with self._shutdown_lock: diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 9b61cc069b5..03f8d1d7112 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -191,10 +191,9 @@ def test_thread_names_default(self): del executor for t in threads: - # We don't particularly care what the default name is, just that - # it has a default name implying that it is a ThreadPoolExecutor - # followed by what looks like a thread number. - self.assertRegex(t.name, r'^.*ThreadPoolExecutor.*_[0-4]$') + # Ensure that our default name is reasonably sane and unique when + # no thread_name_prefix was supplied. + self.assertRegex(t.name, r'ThreadPoolExecutor-\d+_[0-4]$') t.join() diff --git a/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst b/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst new file mode 100644 index 00000000000..ad4e939c42d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst @@ -0,0 +1,3 @@ +Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non repr() +based thread name by default when no thread_name_prefix is supplied. They will +now identify themselves as "ThreadPoolExecutor-y_n". From webhook-mailer at python.org Sun Sep 3 23:31:12 2017 From: webhook-mailer at python.org (INADA Naoki) Date: Mon, 04 Sep 2017 03:31:12 -0000 Subject: [Python-checkins] bpo-31095: fix potential crash during GC (GH-3195) Message-ID: https://github.com/python/cpython/commit/2eea952b1b9ebbc2d94fd3faca1536c6b4963725 commit: 2eea952b1b9ebbc2d94fd3faca1536c6b4963725 branch: 3.6 author: INADA Naoki committer: GitHub date: 2017-09-04T12:31:09+09:00 summary: bpo-31095: fix potential crash during GC (GH-3195) (cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst M Doc/extending/newtypes.rst M Doc/includes/noddy4.c M Modules/_collectionsmodule.c M Modules/_elementtree.c M Modules/_functoolsmodule.c M Modules/_io/bytesio.c M Modules/_json.c M Modules/_ssl.c M Modules/_struct.c M Objects/dictobject.c M Objects/setobject.c M Parser/asdl_c.py M Python/Python-ast.c diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 003b4e505d3..abd5da9db65 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -728,8 +728,9 @@ functions. With :c:func:`Py_VISIT`, :c:func:`Noddy_traverse` can be simplified: uniformity across these boring implementations. We also need to provide a method for clearing any subobjects that can -participate in cycles. We implement the method and reimplement the deallocator -to use it:: +participate in cycles. + +:: static int Noddy_clear(Noddy *self) @@ -747,13 +748,6 @@ to use it:: return 0; } - static void - Noddy_dealloc(Noddy* self) - { - Noddy_clear(self); - Py_TYPE(self)->tp_free((PyObject*)self); - } - Notice the use of a temporary variable in :c:func:`Noddy_clear`. We use the temporary variable so that we can set each member to *NULL* before decrementing its reference count. We do this because, as was discussed earlier, if the @@ -776,6 +770,23 @@ be simplified:: return 0; } +Note that :c:func:`Noddy_dealloc` may call arbitrary functions through +``__del__`` method or weakref callback. It means circular GC can be +triggered inside the function. Since GC assumes reference count is not zero, +we need to untrack the object from GC by calling :c:func:`PyObject_GC_UnTrack` +before clearing members. Here is reimplemented deallocator which uses +:c:func:`PyObject_GC_UnTrack` and :c:func:`Noddy_clear`. + +:: + + static void + Noddy_dealloc(Noddy* self) + { + PyObject_GC_UnTrack(self); + Noddy_clear(self); + Py_TYPE(self)->tp_free((PyObject*)self); + } + Finally, we add the :const:`Py_TPFLAGS_HAVE_GC` flag to the class flags:: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index eb9622a87d9..08ba4c3d91a 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -46,6 +46,7 @@ Noddy_clear(Noddy *self) static void Noddy_dealloc(Noddy* self) { + PyObject_GC_UnTrack(self); Noddy_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); } diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst new file mode 100644 index 00000000000..ca1f8bafba6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst @@ -0,0 +1,2 @@ +Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call +``PyObject_GC_UnTrack()``. diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 30157701d70..e7a24f3f058 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1706,6 +1706,8 @@ dequeiter_traverse(dequeiterobject *dio, visitproc visit, void *arg) static void dequeiter_dealloc(dequeiterobject *dio) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(dio); Py_XDECREF(dio->deque); PyObject_GC_Del(dio); } @@ -2086,6 +2088,8 @@ static PyMemberDef defdict_members[] = { static void defdict_dealloc(defdictobject *dd) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(dd); Py_CLEAR(dd->default_factory); PyDict_Type.tp_dealloc((PyObject *)dd); } diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 599ca6a4cc0..ccf5e6a78fd 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -627,6 +627,7 @@ element_gc_clear(ElementObject *self) static void element_dealloc(ElementObject* self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(self); Py_TRASHCAN_SAFE_BEGIN(self) @@ -2048,6 +2049,8 @@ elementiter_dealloc(ElementIterObject *it) { Py_ssize_t i = it->parent_stack_used; it->parent_stack_used = 0; + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(it); while (i--) Py_XDECREF(it->parent_stack[i].parent); PyMem_Free(it->parent_stack); @@ -2055,7 +2058,6 @@ elementiter_dealloc(ElementIterObject *it) Py_XDECREF(it->sought_tag); Py_XDECREF(it->root_element); - PyObject_GC_UnTrack(it); PyObject_GC_Del(it); } diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 1bcf16a7e00..5622e2a6c3b 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -116,6 +116,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw) static void partial_dealloc(partialobject *pto) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(pto); if (pto->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) pto); @@ -1038,7 +1039,11 @@ lru_cache_clear_list(lru_list_elem *link) static void lru_cache_dealloc(lru_cache_object *obj) { - lru_list_elem *list = lru_cache_unlink_list(obj); + lru_list_elem *list; + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(obj); + + list = lru_cache_unlink_list(obj); Py_XDECREF(obj->maxsize_O); Py_XDECREF(obj->func); Py_XDECREF(obj->cache); diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index a1ba121e262..6c54de733b9 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -1131,6 +1131,8 @@ bytesiobuf_traverse(bytesiobuf *self, visitproc visit, void *arg) static void bytesiobuf_dealloc(bytesiobuf *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); Py_CLEAR(self->source); Py_TYPE(self)->tp_free(self); } diff --git a/Modules/_json.c b/Modules/_json.c index 1be4c17cf95..59376a7b0fb 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -655,7 +655,8 @@ py_encode_basestring(PyObject* self UNUSED, PyObject *pystr) static void scanner_dealloc(PyObject *self) { - /* Deallocate scanner object */ + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); scanner_clear(self); Py_TYPE(self)->tp_free(self); } @@ -1793,7 +1794,8 @@ encoder_listencode_list(PyEncoderObject *s, _PyAccu *acc, static void encoder_dealloc(PyObject *self) { - /* Deallocate Encoder */ + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); encoder_clear(self); Py_TYPE(self)->tp_free(self); } diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 0fffaaceb26..ae38386ca02 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2776,6 +2776,8 @@ context_clear(PySSLContext *self) static void context_dealloc(PySSLContext *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); #ifdef OPENSSL_NPN_NEGOTIATED @@ -4284,6 +4286,7 @@ static PyTypeObject PySSLMemoryBIO_Type = { static void PySSLSession_dealloc(PySSLSession *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(self); Py_XDECREF(self->ctx); if (self->session != NULL) { diff --git a/Modules/_struct.c b/Modules/_struct.c index 2635af9db69..e9af6efa2ea 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1605,6 +1605,8 @@ typedef struct { static void unpackiter_dealloc(unpackiterobject *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); Py_XDECREF(self->so); PyBuffer_Release(&self->buf); PyObject_GC_Del(self); diff --git a/Objects/dictobject.c b/Objects/dictobject.c index b0f583a067b..690ef3bd2b3 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2006,6 +2006,8 @@ dict_dealloc(PyDictObject *mp) PyObject **values = mp->ma_values; PyDictKeysObject *keys = mp->ma_keys; Py_ssize_t i, n; + + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(mp); Py_TRASHCAN_SAFE_BEGIN(mp) if (values != NULL) { @@ -3432,6 +3434,8 @@ dictiter_new(PyDictObject *dict, PyTypeObject *itertype) static void dictiter_dealloc(dictiterobject *di) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(di); Py_XDECREF(di->di_dict); Py_XDECREF(di->di_result); PyObject_GC_Del(di); @@ -3800,6 +3804,8 @@ dictiter_reduce(dictiterobject *di) static void dictview_dealloc(_PyDictViewObject *dv) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(dv); Py_XDECREF(dv->dv_dict); PyObject_GC_Del(dv); } diff --git a/Objects/setobject.c b/Objects/setobject.c index c1bc1e12347..24272b4d14a 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -556,6 +556,7 @@ set_dealloc(PySetObject *so) setentry *entry; Py_ssize_t used = so->used; + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(so); Py_TRASHCAN_SAFE_BEGIN(so) if (so->weakreflist != NULL) @@ -812,6 +813,8 @@ typedef struct { static void setiter_dealloc(setiterobject *si) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(si); Py_XDECREF(si->si_set); PyObject_GC_Del(si); } diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 13124bbd3ad..1e5f4d9a2a5 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -630,6 +630,8 @@ def visitModule(self, mod): static void ast_dealloc(AST_object *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); Py_CLEAR(self->dict); Py_TYPE(self)->tp_free(self); } diff --git a/Python/Python-ast.c b/Python/Python-ast.c index b78a0fc714e..212211c5f43 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -512,6 +512,8 @@ typedef struct { static void ast_dealloc(AST_object *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); Py_CLEAR(self->dict); Py_TYPE(self)->tp_free(self); } From webhook-mailer at python.org Sun Sep 3 23:31:44 2017 From: webhook-mailer at python.org (INADA Naoki) Date: Mon, 04 Sep 2017 03:31:44 -0000 Subject: [Python-checkins] bpo-31095: Fix potential crash during GC (GH-3197) Message-ID: https://github.com/python/cpython/commit/4cde4bdcc86cb08ee3847500a172cc24eba37ffe commit: 4cde4bdcc86cb08ee3847500a172cc24eba37ffe branch: 2.7 author: INADA Naoki committer: GitHub date: 2017-09-04T12:31:41+09:00 summary: bpo-31095: Fix potential crash during GC (GH-3197) (cherry picked from commit a6296d34a478b4f697ea9db798146195075d496c) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst M Doc/extending/newtypes.rst M Doc/includes/noddy4.c M Modules/_collectionsmodule.c M Modules/_functoolsmodule.c M Modules/_io/bytesio.c M Modules/_json.c M Modules/_ssl.c M Objects/dictobject.c M Objects/setobject.c diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 5959e4f2b1e..7eadcae5e61 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -748,8 +748,9 @@ simplified:: uniformity across these boring implementations. We also need to provide a method for clearing any subobjects that can -participate in cycles. We implement the method and reimplement the deallocator -to use it:: +participate in cycles. + +:: static int Noddy_clear(Noddy *self) @@ -767,13 +768,6 @@ to use it:: return 0; } - static void - Noddy_dealloc(Noddy* self) - { - Noddy_clear(self); - self->ob_type->tp_free((PyObject*)self); - } - Notice the use of a temporary variable in :c:func:`Noddy_clear`. We use the temporary variable so that we can set each member to *NULL* before decrementing its reference count. We do this because, as was discussed earlier, if the @@ -796,6 +790,23 @@ decrementing of reference counts. With :c:func:`Py_CLEAR`, the return 0; } +Note that :c:func:`Noddy_dealloc` may call arbitrary functions through +``__del__`` method or weakref callback. It means circular GC can be +triggered inside the function. Since GC assumes reference count is not zero, +we need to untrack the object from GC by calling :c:func:`PyObject_GC_UnTrack` +before clearing members. Here is reimplemented deallocator which uses +:c:func:`PyObject_GC_UnTrack` and :c:func:`Noddy_clear`. + +:: + + static void + Noddy_dealloc(Noddy* self) + { + PyObject_GC_UnTrack(self); + Noddy_clear(self); + Py_TYPE(self)->tp_free((PyObject*)self); + } + Finally, we add the :const:`Py_TPFLAGS_HAVE_GC` flag to the class flags:: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index 9feb71aae3b..0fd4dc37884 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -46,6 +46,7 @@ Noddy_clear(Noddy *self) static void Noddy_dealloc(Noddy* self) { + PyObject_GC_UnTrack(self); Noddy_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); } diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst new file mode 100644 index 00000000000..ca1f8bafba6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst @@ -0,0 +1,2 @@ +Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call +``PyObject_GC_UnTrack()``. diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 1dd4b998100..2e4da4c211f 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1271,6 +1271,8 @@ dequeiter_traverse(dequeiterobject *dio, visitproc visit, void *arg) static void dequeiter_dealloc(dequeiterobject *dio) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(dio); Py_XDECREF(dio->deque); PyObject_GC_Del(dio); } @@ -1556,6 +1558,8 @@ static PyMemberDef defdict_members[] = { static void defdict_dealloc(defdictobject *dd) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(dd); Py_CLEAR(dd->default_factory); PyDict_Type.tp_dealloc((PyObject *)dd); } diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index e0781a98d5e..e9e89331b99 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -143,6 +143,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw) static void partial_dealloc(partialobject *pto) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(pto); if (pto->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) pto); diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c index 1335ae89032..0ee4b80434c 100644 --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -745,6 +745,7 @@ bytesio_setstate(bytesio *self, PyObject *state) static void bytesio_dealloc(bytesio *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ _PyObject_GC_UNTRACK(self); if (self->buf != NULL) { PyMem_Free(self->buf); diff --git a/Modules/_json.c b/Modules/_json.c index 42c93aba1e2..be1e0796960 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -840,7 +840,8 @@ py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr) static void scanner_dealloc(PyObject *self) { - /* Deallocate scanner object */ + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); scanner_clear(self); Py_TYPE(self)->tp_free(self); } @@ -2298,7 +2299,8 @@ encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ss static void encoder_dealloc(PyObject *self) { - /* Deallocate Encoder */ + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); encoder_clear(self); Py_TYPE(self)->tp_free(self); } diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 45a1d012310..213c7d21510 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2214,6 +2214,8 @@ context_clear(PySSLContext *self) static void context_dealloc(PySSLContext *self) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); #ifdef OPENSSL_NPN_NEGOTIATED diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 9506067c7db..a792b2dfa21 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1076,6 +1076,7 @@ dict_dealloc(register PyDictObject *mp) { register PyDictEntry *ep; Py_ssize_t fill = mp->ma_fill; + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(mp); Py_TRASHCAN_SAFE_BEGIN(mp) for (ep = mp->ma_table; fill > 0; ep++) { @@ -2576,6 +2577,8 @@ dictiter_new(PyDictObject *dict, PyTypeObject *itertype) static void dictiter_dealloc(dictiterobject *di) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(di); Py_XDECREF(di->di_dict); Py_XDECREF(di->di_result); PyObject_GC_Del(di); @@ -2855,6 +2858,8 @@ typedef struct { static void dictview_dealloc(dictviewobject *dv) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(dv); Py_XDECREF(dv->dv_dict); PyObject_GC_Del(dv); } diff --git a/Objects/setobject.c b/Objects/setobject.c index b3ca643c4f6..0c69fac8e6d 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -549,6 +549,7 @@ set_dealloc(PySetObject *so) { register setentry *entry; Py_ssize_t fill = so->fill; + /* bpo-31095: UnTrack is needed before calling any callbacks */ PyObject_GC_UnTrack(so); Py_TRASHCAN_SAFE_BEGIN(so) if (so->weakreflist != NULL) @@ -811,6 +812,8 @@ typedef struct { static void setiter_dealloc(setiterobject *si) { + /* bpo-31095: UnTrack is needed before calling any callbacks */ + _PyObject_GC_UNTRACK(si); Py_XDECREF(si->si_set); PyObject_GC_Del(si); } From webhook-mailer at python.org Mon Sep 4 00:00:25 2017 From: webhook-mailer at python.org (Ned Deily) Date: Mon, 04 Sep 2017 04:00:25 -0000 Subject: [Python-checkins] bpo-12383: Also ignore __PYVENV_LAUNCHER__ (#3278) Message-ID: https://github.com/python/cpython/commit/918edc0edb356d0561062c1dc267b1d68a684b70 commit: 918edc0edb356d0561062c1dc267b1d68a684b70 branch: master author: Ned Deily committer: GitHub date: 2017-09-04T00:00:21-04:00 summary: bpo-12383: Also ignore __PYVENV_LAUNCHER__ (#3278) Used in macOS framework builds. files: M Lib/test/test_subprocess.py diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 7d0708d5f7f..a0d3dcd069a 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -651,6 +651,7 @@ def is_env_var_to_ignore(n): # on adding even when the environment in exec is empty. # Gentoo sandboxes also force LD_PRELOAD and SANDBOX_* to exist. return ('VERSIONER' in n or '__CF' in n or # MacOS + '__PYVENV_LAUNCHER__' in n or # MacOS framework build n == 'LD_PRELOAD' or n.startswith('SANDBOX') or # Gentoo n == 'LC_CTYPE') # Locale coercion triggered From solipsis at pitrou.net Mon Sep 4 05:05:51 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 04 Sep 2017 09:05:51 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170904090540.90400.BD59305A46FDEB0B@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogze_4Sy', '--timeout', '7200'] From webhook-mailer at python.org Mon Sep 4 12:28:18 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 16:28:18 -0000 Subject: [Python-checkins] Add missing _sha3 module to Setup.dist (#2395) Message-ID: https://github.com/python/cpython/commit/1c1f8f30c03ca11952856f70ac5f0f7f8dcfd582 commit: 1c1f8f30c03ca11952856f70ac5f0f7f8dcfd582 branch: master author: Segev Finer committer: Benjamin Peterson date: 2017-09-04T09:28:14-07:00 summary: Add missing _sha3 module to Setup.dist (#2395) files: M Modules/Setup.dist diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 6b4c217b0a4..97c36dbd5d4 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -253,6 +253,7 @@ _symtable symtablemodule.c #_sha1 sha1module.c #_sha256 sha256module.c #_sha512 sha512module.c +#_sha3 _sha3/sha3module.c # _blake module #_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c From webhook-mailer at python.org Mon Sep 4 13:08:37 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 17:08:37 -0000 Subject: [Python-checkins] [3.6] Add missing _sha3 module to Setup.dist (GH-2395) (#3280) Message-ID: https://github.com/python/cpython/commit/39fde5f93b58af5bc7cb34d1619d9aa0b9e2ec1c commit: 39fde5f93b58af5bc7cb34d1619d9aa0b9e2ec1c branch: 3.6 author: Segev Finer committer: Benjamin Peterson date: 2017-09-04T10:08:35-07:00 summary: [3.6] Add missing _sha3 module to Setup.dist (GH-2395) (#3280) (cherry picked from commit 1c1f8f30c03ca119528) files: M Modules/Setup.dist diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 8b87fc8143f..735bacb1b4d 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -250,6 +250,7 @@ _symtable symtablemodule.c #_sha1 sha1module.c #_sha256 sha256module.c #_sha512 sha512module.c +#_sha3 _sha3/sha3module.c # _blake module #_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c From webhook-mailer at python.org Mon Sep 4 13:09:14 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 17:09:14 -0000 Subject: [Python-checkins] remove configure check for 'volatile' (#3281) Message-ID: https://github.com/python/cpython/commit/fc96f1e95ef1d6edd1eb4538da40259866422c5a commit: fc96f1e95ef1d6edd1eb4538da40259866422c5a branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T10:09:12-07:00 summary: remove configure check for 'volatile' (#3281) This is a required feature is C99, which we require. files: M configure M configure.ac M pyconfig.h.in diff --git a/configure b/configure index a6f7d2bd7f0..c242ac48266 100755 --- a/configure +++ b/configure @@ -13544,32 +13544,6 @@ fi works=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 -$as_echo_n "checking for working volatile... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -volatile int x; x = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - works=yes -else - -$as_echo "#define volatile /**/" >>confdefs.h - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $works" >&5 -$as_echo "$works" >&6; } - -works=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working signed char" >&5 $as_echo_n "checking for working signed char... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/configure.ac b/configure.ac index a5da830e896..af1cb8cdd46 100644 --- a/configure.ac +++ b/configure.ac @@ -4081,14 +4081,6 @@ AC_C_CHAR_UNSIGNED AC_C_CONST works=no -AC_MSG_CHECKING(for working volatile) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])], - [works=yes], - [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])] -) -AC_MSG_RESULT($works) - -works=no AC_MSG_CHECKING(for working signed char) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])], [works=yes], diff --git a/pyconfig.h.in b/pyconfig.h.in index 0dd05aa65b8..64b5f0371bd 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -775,6 +775,9 @@ /* Define to 1 if you have the `sched_setscheduler' function. */ #undef HAVE_SCHED_SETSCHEDULER +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + /* Define to 1 if you have the `sem_getvalue' function. */ #undef HAVE_SEM_GETVALUE @@ -1505,9 +1508,6 @@ /* Define to `int' if doesn't define. */ #undef uid_t -/* Define to empty if the keyword does not work. */ -#undef volatile - /* Define the macros needed if on a UnixWare 7.x system. */ #if defined(__USLC__) && defined(__SCO_VERSION__) From webhook-mailer at python.org Mon Sep 4 13:21:45 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 17:21:45 -0000 Subject: [Python-checkins] remove autoconf check for select() (#3283) Message-ID: https://github.com/python/cpython/commit/a2344851abd3b146ff09d3fc13adb262a7c5450b commit: a2344851abd3b146ff09d3fc13adb262a7c5450b branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T10:21:42-07:00 summary: remove autoconf check for select() (#3283) We never actually check HAVE_SELECT. files: M configure M configure.ac M pyconfig.h.in diff --git a/configure b/configure index c242ac48266..98435960c94 100755 --- a/configure +++ b/configure @@ -11328,7 +11328,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ pthread_init pthread_kill putenv pwrite readlink readlinkat readv realpath renameat \ - select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ + sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ setgid sethostname \ setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \ sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \ diff --git a/configure.ac b/configure.ac index af1cb8cdd46..863d9423023 100644 --- a/configure.ac +++ b/configure.ac @@ -3485,7 +3485,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ pthread_init pthread_kill putenv pwrite readlink readlinkat readv realpath renameat \ - select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ + sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ setgid sethostname \ setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \ sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \ diff --git a/pyconfig.h.in b/pyconfig.h.in index 64b5f0371bd..a524204e755 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -775,9 +775,6 @@ /* Define to 1 if you have the `sched_setscheduler' function. */ #undef HAVE_SCHED_SETSCHEDULER -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - /* Define to 1 if you have the `sem_getvalue' function. */ #undef HAVE_SEM_GETVALUE From webhook-mailer at python.org Mon Sep 4 13:37:26 2017 From: webhook-mailer at python.org (ericvsmith) Date: Mon, 04 Sep 2017 17:37:26 -0000 Subject: [Python-checkins] bpo-31281: Fix pathlib.Path incompatibility in fileinput (gh-3208) Message-ID: https://github.com/python/cpython/commit/06de1aeff94e524bed21d188065c4cd1590fb046 commit: 06de1aeff94e524bed21d188065c4cd1590fb046 branch: master author: Zhiming Wang committer: ericvsmith date: 2017-09-04T13:37:24-04:00 summary: bpo-31281: Fix pathlib.Path incompatibility in fileinput (gh-3208) Fix fileinput with inplace=True to accept pathlib.Path objects. files: A Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst M Lib/fileinput.py M Lib/test/test_fileinput.py diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 363c241c50e..c6fc9a1981a 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -330,7 +330,7 @@ def _readline(self): else: if self._inplace: self._backupfilename = ( - self._filename + (self._backup or ".bak")) + os.fspath(self._filename) + (self._backup or ".bak")) try: os.unlink(self._backupfilename) except OSError: diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 5df810c8f99..d7efc685d87 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -544,6 +544,19 @@ def test_pathlib_file(self): finally: remove_tempfiles(t1) + def test_pathlib_file_inplace(self): + t1 = None + try: + t1 = Path(writeTmp(1, ['Pathlib file.'])) + with FileInput(t1, inplace=True) as fi: + line = fi.readline() + self.assertEqual(line, 'Pathlib file.') + print('Modified %s' % line) + with open(t1) as f: + self.assertEqual(f.read(), 'Modified Pathlib file.\n') + finally: + remove_tempfiles(t1) + class MockFileInput: """A class that mocks out fileinput.FileInput for use during unit tests""" diff --git a/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst b/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst new file mode 100644 index 00000000000..7fc8229cf47 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst @@ -0,0 +1,2 @@ +Fix ``fileinput.FileInput(files, inplace=True)`` when ``files`` contain +``pathlib.Path`` objects. From webhook-mailer at python.org Mon Sep 4 13:40:48 2017 From: webhook-mailer at python.org (Alex Gaynor) Date: Mon, 04 Sep 2017 17:40:48 -0000 Subject: [Python-checkins] Change code owners for hashlib and ssl to the crypto team (#3284) Message-ID: https://github.com/python/cpython/commit/3239cf1ae9d60b0810f57498b0a514004f36a6bf commit: 3239cf1ae9d60b0810f57498b0a514004f36a6bf branch: master author: Alex Gaynor committer: GitHub date: 2017-09-04T13:40:45-04:00 summary: Change code owners for hashlib and ssl to the crypto team (#3284) * Change code owners for hashlib and ssl to the crypto team * Include the core CSPRNG for the crypto-team files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 447b4ef08b7..6cda5a0f767 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,14 +11,17 @@ **/*genobject* @1st1 # Hashing -**/*hashlib* @tiran -**/*pyhash* @tiran +**/*hashlib* @python/crypto-team +**/*pyhash* @python/crypto-team # Import (including importlib) **/*import* @python/import-team # SSL -**/*ssl* @tiran +**/*ssl* @python/crypto-team + +# CSPRNG +Python/bootstrap_hash.c @python/crypto-team # Email and related **/*mail* @bitdancer From webhook-mailer at python.org Mon Sep 4 13:52:53 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 17:52:53 -0000 Subject: [Python-checkins] remove check for bug last seem in Solaris 9 (#3285) Message-ID: https://github.com/python/cpython/commit/5ce1063345419407871c51c604d2553777bc6cca commit: 5ce1063345419407871c51c604d2553777bc6cca branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T10:52:51-07:00 summary: remove check for bug last seem in Solaris 9 (#3285) files: M configure M configure.ac diff --git a/configure b/configure index 98435960c94..b5d57676e38 100755 --- a/configure +++ b/configure @@ -8246,43 +8246,7 @@ $as_echo "#define HAVE_HTOLE64 1" >>confdefs.h fi -# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in -# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are -# defined, but the compiler does not support pragma redefine_extname, -# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit -# structures (such as rlimit64) without declaring them. As a -# work-around, disable LFS on such configurations - use_lfs=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Solaris LFS bug" >&5 -$as_echo_n "checking Solaris LFS bug... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _LARGEFILE_SOURCE 1 -#define _FILE_OFFSET_BITS 64 -#include - -int -main () -{ -struct rlimit foo; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - sol_lfs_bug=no -else - sol_lfs_bug=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sol_lfs_bug" >&5 -$as_echo "$sol_lfs_bug" >&6; } -if test "$sol_lfs_bug" = "yes"; then - use_lfs=no -fi - # Don't use largefile support for GNU/Hurd case $ac_sys_system in GNU*) use_lfs=no diff --git a/configure.ac b/configure.ac index 863d9423023..5786525b291 100644 --- a/configure.ac +++ b/configure.ac @@ -2168,25 +2168,7 @@ if test "$ac_cv_has_le64toh" = "yes"; then AC_DEFINE(HAVE_HTOLE64, 1, [Define this if you have le64toh()]) fi -# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in -# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are -# defined, but the compiler does not support pragma redefine_extname, -# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit -# structures (such as rlimit64) without declaring them. As a -# work-around, disable LFS on such configurations - use_lfs=yes -AC_MSG_CHECKING(Solaris LFS bug) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#define _LARGEFILE_SOURCE 1 -#define _FILE_OFFSET_BITS 64 -#include -]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes]) -AC_MSG_RESULT($sol_lfs_bug) -if test "$sol_lfs_bug" = "yes"; then - use_lfs=no -fi - # Don't use largefile support for GNU/Hurd case $ac_sys_system in GNU*) use_lfs=no From webhook-mailer at python.org Mon Sep 4 14:28:32 2017 From: webhook-mailer at python.org (larryhastings) Date: Mon, 04 Sep 2017 18:28:32 -0000 Subject: [Python-checkins] Blurbify 2.7. (#3286) Message-ID: https://github.com/python/cpython/commit/05308c73d769b4e3fdbeee0de399e7f63b86f1ab commit: 05308c73d769b4e3fdbeee0de399e7f63b86f1ab branch: 2.7 author: larryhastings committer: GitHub date: 2017-09-04T11:28:25-07:00 summary: Blurbify 2.7. (#3286) files: A Misc/NEWS.d/2.6.rst A Misc/NEWS.d/2.6a1.rst A Misc/NEWS.d/2.6a2.rst A Misc/NEWS.d/2.6a3.rst A Misc/NEWS.d/2.6b1.rst A Misc/NEWS.d/2.6b2.rst A Misc/NEWS.d/2.6b3.rst A Misc/NEWS.d/2.6rc1.rst A Misc/NEWS.d/2.6rc2.rst A Misc/NEWS.d/2.7.1.rst A Misc/NEWS.d/2.7.10.rst A Misc/NEWS.d/2.7.10rc1.rst A Misc/NEWS.d/2.7.11.rst A Misc/NEWS.d/2.7.11rc1.rst A Misc/NEWS.d/2.7.12.rst A Misc/NEWS.d/2.7.12rc1.rst A Misc/NEWS.d/2.7.13.rst A Misc/NEWS.d/2.7.13rc1.rst A Misc/NEWS.d/2.7.1rc1.rst A Misc/NEWS.d/2.7.2.rst A Misc/NEWS.d/2.7.2rc1.rst A Misc/NEWS.d/2.7.3rc1.rst A Misc/NEWS.d/2.7.3rc2.rst A Misc/NEWS.d/2.7.4.rst A Misc/NEWS.d/2.7.4rc1.rst A Misc/NEWS.d/2.7.5.rst A Misc/NEWS.d/2.7.6.rst A Misc/NEWS.d/2.7.6rc1.rst A Misc/NEWS.d/2.7.7.rst A Misc/NEWS.d/2.7.7rc1.rst A Misc/NEWS.d/2.7.8.rst A Misc/NEWS.d/2.7.9.rst A Misc/NEWS.d/2.7.9rc1.rst A Misc/NEWS.d/2.7.rst A Misc/NEWS.d/2.7a1.rst A Misc/NEWS.d/2.7a2.rst A Misc/NEWS.d/2.7a3.rst A Misc/NEWS.d/2.7a4.rst A Misc/NEWS.d/2.7b1.rst A Misc/NEWS.d/2.7b2.rst A Misc/NEWS.d/2.7rc1.rst A Misc/NEWS.d/2.7rc2.rst A Misc/NEWS.d/next/Build/008.bpo-28768.b9_a6E.rst A Misc/NEWS.d/next/Build/009.bpo-29572.iZ1XKK.rst A Misc/NEWS.d/next/Build/010.bpo-29643.4DrjEB.rst A Misc/NEWS.d/next/Build/011.bpo-27593.v87xEr.rst A Misc/NEWS.d/next/Build/012.bpo-23404.PdYVWg.rst A Misc/NEWS.d/next/Build/013.bpo-29243.WDK4hT.rst A Misc/NEWS.d/next/Core and Builtins/063.bpo-28932.QnLx8A.rst A Misc/NEWS.d/next/Core and Builtins/064.bpo-29145.2x5NOb.rst A Misc/NEWS.d/next/Core and Builtins/065.bpo-29028.BxGcd9.rst A Misc/NEWS.d/next/Core and Builtins/066.bpo-14376.xrKNqX.rst A Misc/NEWS.d/next/Core and Builtins/067.bpo-29347.1RPPGN.rst A Misc/NEWS.d/next/Core and Builtins/068.bpo-29602.qyyskC.rst A Misc/NEWS.d/next/Core and Builtins/069.bpo-28598.QxbzQn.rst A Misc/NEWS.d/next/Core and Builtins/070.bpo-29935.2ZTSxR.rst A Misc/NEWS.d/next/Core and Builtins/071.bpo-25794.j0nJ5x.rst A Misc/NEWS.d/next/Core and Builtins/072.bpo-27945.p29r3O.rst A Misc/NEWS.d/next/Core and Builtins/073.bpo-30657.Q_r7JJ.rst A Misc/NEWS.d/next/Documentation/014.bpo-12067.8RbyOz.rst A Misc/NEWS.d/next/Documentation/015.bpo-26355.SDq_8Y.rst A Misc/NEWS.d/next/Documentation/016.bpo-28929.Md7kb0.rst A Misc/NEWS.d/next/Documentation/017.bpo-30176.VivmCg.rst A Misc/NEWS.d/next/Library/018.bpo-28925.9zLygi.rst A Misc/NEWS.d/next/Library/019.bpo-19542.5tCkaK.rst A Misc/NEWS.d/next/Library/020.bpo-29019.MO2AeR.rst A Misc/NEWS.d/next/Library/021.bpo-28923._hrXiL.rst A Misc/NEWS.d/next/Library/022.bpo-28998.NfBgmb.rst A Misc/NEWS.d/next/Library/023.bpo-28427.vUd-va.rst A Misc/NEWS.d/next/Library/024.bpo-9770.WJJnwP.rst A Misc/NEWS.d/next/Library/025.bpo-13051.YzC1Te.rst A Misc/NEWS.d/next/Library/026.bpo-29142._FTyvm.rst A Misc/NEWS.d/next/Library/027.bpo-29188.RI3v1Q.rst A Misc/NEWS.d/next/Library/028.bpo-29082.D5Xs7F.rst A Misc/NEWS.d/next/Library/029.bpo-29219.kxui7t.rst A Misc/NEWS.d/next/Library/030.bpo-29335._KC7IK.rst A Misc/NEWS.d/next/Library/031.bpo-29354.TH2vMX.rst A Misc/NEWS.d/next/Library/032.bpo-29110.IBWuZ2.rst A Misc/NEWS.d/next/Library/033.bpo-27880.elFFAF.rst A Misc/NEWS.d/next/Library/034.bpo-29861.t2ZoRK.rst A Misc/NEWS.d/next/Library/035.bpo-29942.CsGNuT.rst A Misc/NEWS.d/next/Library/036.bpo-27863.pPYHHI.rst A Misc/NEWS.d/next/Library/037.bpo-30068.n4q47r.rst A Misc/NEWS.d/next/Library/038.bpo-30011.2MLfQj.rst A Misc/NEWS.d/next/Library/039.bpo-30061.ilxNPt.rst A Misc/NEWS.d/next/Library/040.bpo-30070.XM_B41.rst A Misc/NEWS.d/next/Library/041.bpo-26293.wig0YG.rst A Misc/NEWS.d/next/Library/042.bpo-30243.RHQt0v.rst A Misc/NEWS.d/next/Library/043.bpo-29990.HWV6KE.rst A Misc/NEWS.d/next/Library/044.bpo-30342.87Qgur.rst A Misc/NEWS.d/next/Library/045.bpo-30329.Yb1MTr.rst A Misc/NEWS.d/next/Library/046.bpo-30365.XVP7_M.rst A Misc/NEWS.d/next/Library/047.bpo-30365.eDwdmC.rst A Misc/NEWS.d/next/Library/048.bpo-30363.l6J41Y.rst A Misc/NEWS.d/next/Library/049.bpo-30375.9c8qM7.rst A Misc/NEWS.d/next/Library/050.bpo-30003.BOl9HE.rst A Misc/NEWS.d/next/Library/051.bpo-30414.jGl1Lb.rst A Misc/NEWS.d/next/Library/052.bpo-30310.SAkE6e.rst A Misc/NEWS.d/next/Library/053.bpo-29960.g0wr3r.rst A Misc/NEWS.d/next/Library/054.bpo-30378.R_19_5.rst A Misc/NEWS.d/next/Library/055.bpo-30418.EwISQm.rst A Misc/NEWS.d/next/Library/056.bpo-28994.9vzun1.rst A Misc/NEWS.d/next/Library/061.bpo-30746.7drQI0.rst A Misc/NEWS.d/next/Library/062.bpo-29169.8ypApm.rst A Misc/NEWS.d/next/Security/057.bpo-29591.ExKblw.rst A Misc/NEWS.d/next/Security/058.bpo-30500.j5KrEp.rst A Misc/NEWS.d/next/Security/059.bpo-30694.WkMWM_.rst A Misc/NEWS.d/next/Security/060.bpo-30730.rJsyTH.rst A Misc/NEWS.d/next/Tests/001.bpo-15083.Tz3ZZm.rst A Misc/NEWS.d/next/Tests/002.bpo-28087.m8dc4R.rst A Misc/NEWS.d/next/Tests/003.bpo-30197.hajYvd.rst A Misc/NEWS.d/next/Tests/004.bpo-30207.EiRhGi.rst A Misc/NEWS.d/next/Tests/005.bpo-30223.TYC9rA.rst A Misc/NEWS.d/next/Tests/006.bpo-30236.vOYTDq.rst A Misc/NEWS.d/next/Tests/007.bpo-11790.0actZf.rst D Misc/NEWS diff --git a/Misc/NEWS b/Misc/NEWS deleted file mode 100644 index 8489e8be7d4..00000000000 --- a/Misc/NEWS +++ /dev/null @@ -1,12486 +0,0 @@ -+++++++++++ -Python News -+++++++++++ - -What's New in Python 2.7.14 release candidate 1? -================================================ - -*Release date: 2017-08-26* - -Core and Builtins ------------------ - -- bpo-30657: Fixed possible integer overflow in PyString_DecodeEscape. - Patch by Jay Bosamiya. - -- bpo-27945: Fixed various segfaults with dict when input collections are - mutated during searching, inserting or comparing. Based on patches by - Duane Griffin and Tim Mitchell. - -- bpo-25794: Fixed type.__setattr__() and type.__delattr__() for - non-interned or unicode attribute names. Based on patch by Eryk Sun. - -- bpo-29935: Fixed error messages in the index() method of tuple and list - when pass indices of wrong type. - -- bpo-28598: Support __rmod__ for subclasses of str being called before - str.__mod__. Patch by Martijn Pieters. - -- bpo-29602: Fix incorrect handling of signed zeros in complex constructor for - complex subclasses and for inputs having a __complex__ method. Patch - by Serhiy Storchaka. - -- bpo-29347: Fixed possibly dereferencing undefined pointers - when creating weakref objects. - -- Issue #14376: Allow sys.exit to accept longs as well as ints. Patch - by Gareth Rees. - -- Issue #29028: Fixed possible use-after-free bugs in the subscription of the - buffer object with custom index object. - -- Issue #29145: Fix overflow checks in string, bytearray and unicode. - Patch by jan matejek and Xiang Zhang. - -- Issue #28932: Do not include if it does not exist. - -Extension Modules ------------------ - -- Issue #29169: Update zlib to 1.2.11. - -Library -------- - -- bpo-30746: Prohibited the '=' character in environment variable names in - ``os.putenv()`` and ``os.spawn*()``. - -- [Security] bpo-30730: Prevent environment variables injection in subprocess on - Windows. Prevent passing other environment variables and command arguments. - -- [Security] bpo-30694: Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes - of multiple security vulnerabilities including: CVE-2017-9233 (External - entity infinite loop DoS), CVE-2016-9063 (Integer overflow, re-fix), - CVE-2016-0718 (Fix regression bugs from 2.2.0's fix to CVE-2016-0718) - and CVE-2012-0876 (Counter hash flooding with SipHash). - Note: the CVE-2016-5300 (Use os-specific entropy sources like getrandom) - doesn't impact Python, since Python already gets entropy from the OS to set - the expat secret using ``XML_SetHashSalt()``. - -- [Security] bpo-30500: Fix urllib.splithost() to correctly parse - fragments. For example, ``splithost('//127.0.0.1#@evil.com/')`` now - correctly returns the ``127.0.0.1`` host, instead of treating ``@evil.com`` - as the host in an authentification (``login at host``). - -- [Security] bpo-29591: Update expat copy from 2.1.1 to 2.2.0 to get fixes - of CVE-2016-0718 and CVE-2016-4472. See - https://sourceforge.net/p/expat/bugs/537/ for more information. - -- bpo-28994: The traceback no longer displayed for SystemExit raised in - a callback registered by atexit. - -- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL - on stdin.write() if the child process is still running but closed the pipe. - -- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot - handle IPv6 addresses. - -- bpo-29960: Preserve generator state when _random.Random.setstate() - raises an exception. Patch by Bryan Olson. - -- bpo-30310: tkFont now supports unicode options (e.g. font family). - -- bpo-30414: multiprocessing.Queue._feed background running - thread do not break from main loop on exception. - -- bpo-30003: Fix handling escape characters in HZ codec. Based on patch - by Ma Lin. - -- bpo-30375: Warnings emitted when compile a regular expression now always - point to the line in the user code. Previously they could point into inners - of the re module if emitted from inside of groups or conditionals. - -- bpo-30363: Running Python with the -3 option now warns about regular - expression syntax that is invalid or has different semantic in Python 3 - or will change the behavior in future Python versions. - -- bpo-30365: Running Python with the -3 option now emits deprecation warnings - for getchildren() and getiterator() methods of the Element class in the - xml.etree.cElementTree module and when pass the html argument to - xml.etree.ElementTree.XMLParser(). - -- bpo-30365: Fixed a deprecation warning about the doctype() method of the - xml.etree.ElementTree.XMLParser class. Now it is emitted only when define - the doctype() method in the subclass of XMLParser. - -- bpo-30329: imaplib now catchs the Windows socket WSAEINVAL error - (code 10022) on shutdown(SHUT_RDWR): An invalid operation was attempted. - This error occurs sometimes on SSL connections. - -- bpo-30342: Fix sysconfig.is_python_build() if Python is built with Visual - Studio 2008 (VS 9.0). - -- bpo-29990: Fix range checking in GB18030 decoder. Original patch by Ma Lin. - -- bpo-30243: Removed the __init__ methods of _json's scanner and encoder. - Misusing them could cause memory leaks or crashes. Now scanner and encoder - objects are completely initialized in the __new__ methods. - -- Revert bpo-26293 for zipfile breakage. See also bpo-29094. - -- bpo-30070: Fixed leaks and crashes in errors handling in the parser module. - -- bpo-30061: Fixed crashes in IOBase methods next() and readlines() when - readline() or next() respectively return non-sizeable object. - Fixed possible other errors caused by not checking results of PyObject_Size(), - PySequence_Size(), or PyMapping_Size(). - -- bpo-30011: Fixed race condition in HTMLParser.unescape(). - -- bpo-30068: _io._IOBase.readlines will check if it's closed first when - hint is present. - -- bpo-27863: Fixed multiple crashes in ElementTree caused by race conditions - and wrong types. - -- bpo-29942: Fix a crash in itertools.chain.from_iterable when encountering - long runs of empty iterables. - -- bpo-29861: Release references to tasks, their arguments and their results - as soon as they are finished in multiprocessing.Pool. - -- bpo-27880: Fixed integer overflow in cPickle when pickle large strings or - too many objects. - -- bpo-29110: Fix file object leak in aifc.open() when file is given as a - filesystem path and is not in valid AIFF format. - Original patch by Anthony Zhang. - -- Issue #29354: Fixed inspect.getargs() for parameters which are cell - variables. - -- Issue #29335: Fix subprocess.Popen.wait() when the child process has - exited to a stopped instead of terminated state (ex: when under ptrace). - -- Issue #29219: Fixed infinite recursion in the repr of uninitialized - ctypes.CDLL instances. - -- Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows. - Original patch by Chi Hsuan Yen. - -- Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function - but read from /dev/urandom to get random bytes, for example in os.urandom(). - On Linux, getentropy() is implemented which getrandom() is blocking mode, - whereas os.urandom() should not block. - -- Issue #29142: In urllib, suffixes in no_proxy environment variable with - leading dots could match related hostnames again (e.g. .b.c matches a.b.c). - Patch by Milan Oberkirch. - -- Issue #13051: Fixed recursion errors in large or resized - curses.textpad.Textbox. Based on patch by Tycho Andersen. - -- Issue #9770: curses.ascii predicates now work correctly with negative - integers. - -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. - -- Issue #28998: More APIs now support longs as well as ints. - -- Issue 28923: Remove editor artifacts from Tix.py, - including encoding not recognized by codecs.lookup. - -- Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. - Original patch by Rasmus Villemoes. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #28925: cPickle now correctly propagates errors when unpickle instances - of old-style classes. - -Documentation -------------- - -- bpo-30176: Add missing attribute related constants in curses documentation. - -- bpo-28929: Link the documentation to its source file on GitHub. - -- Issue #26355: Add canonical header link on each page to corresponding major - version of the documentation. Patch by Matthias Bussonnier. - -- Issue #12067: Rewrite Comparisons section in the Expressions chapter of the - language reference. Some of the details of comparing mixed types were - incorrect or ambiguous. Added default behaviour and consistency suggestions - for user-defined classes. Based on patch from Andy Maier. - -Build ------ - - bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, - ``make install`` and some other make targets when configured with - ``--enable-optimizations``. - -- bpo-23404: Don't regenerate generated files based on file modification time - anymore: the action is now explicit. Replace ``make touch`` with - ``make regen-all``. - -- bpo-27593: sys.version and the platform module python_build(), - python_branch(), and python_revision() functions now use - git information rather than hg when building from a repo. - -- bpo-29643: Fix ``--enable-optimization`` configure option didn't work. - -- bpo-29572: Update Windows build and OS X installers to use OpenSSL 1.0.2k. - -- Issue #28768: Fix implicit declaration of function _setmode. Patch by - Masayuki Yamamoto - -Tests ------ - -- bpo-11790: Fix sporadic failures in - test_multiprocessing.WithProcessesTestCondition. - -- bpo-30236: Backported test.regrtest options -m/--match and -G/--failfast - from Python 3. - -- bpo-30223: To unify running tests in Python 2.7 and Python 3, the test - package can be run as a script. This is equivalent to running the - test.regrtest module as a script. - -- bpo-30207: To simplify backports from Python 3, the test.test_support - module was converted into a package and renamed to test.support. The - test.script_helper module was moved into the test.support package. - Names test.test_support and test.script_helper are left as aliases to - test.support and test.support.script_helper. - -- bpo-30197: Enhanced function swap_attr() in the test.test_support module. - It now works when delete replaced attribute inside the with statement. The - old value of the attribute (or None if it doesn't exist) now will be - assigned to the target of the "as" clause, if there is one. - Also backported function swap_item(). - -- bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. - Skip some tests of select.poll when running on macOS due to unresolved - issues with the underlying system poll function on some macOS versions. - -- bpo-15083: Convert ElementTree doctests to unittests. - - -What's New in Python 2.7.13 -=========================== - -*Release date: 2016-12-17* - -Core and Builtins ------------------ - -- Revert a37cc3d926ec (Issue #5322). - - -What's New in Python 2.7.13 release candidate 1? -================================================ - -*Release date: 2016-12-03* - -Core and Builtins ------------------ - -- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. - Original patch by Andreas St?hrk. - -- Issue #28847: dumbdbm no longer writes the index file in when it is not - changed and supports reading read-only files. - -- Issue #11145: Fixed miscellaneous issues with C-style formatting of types - with custom __oct__ and __hex__. - -- Issue #24469: Fixed memory leak caused by int subclasses without overridden - tp_free (e.g. C-inherited Cython classes). - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #21720: Improve exception message when the type of fromlist is unicode. - fromlist parameter of __import__() only accepts str in Python 2 and this - will help to identify the problem especially when the unicode_literals - future import is used. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #15578: Correctly incref the parent module while importing. - -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. - -- Issue #26020: set literal evaluation order did not match documented behaviour. - -- Issue #27870: A left shift of zero by a large integer no longer attempts - to allocate large amounts of memory. - -- Issue #25604: Fix a minor bug in integer true division; this bug could - potentially have caused off-by-one-ulp results on platforms with - unreliable ldexp implementations. - -- Issue #27473: Fixed possible integer overflow in str, unicode and bytearray - concatenations and repetitions. Based on patch by Xiang Zhang. - -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by - Xiang Zhang. - -- Issue #27581: Don't rely on wrapping for overflow check in - PySequence_Tuple(). Patch by Xiang Zhang. - -- Issue #23908: os functions, open() and the io.FileIO constructor now reject - unicode paths with embedded null character on Windows instead of silently - truncating them. - -- Issue #27514: Make having too many statically nested blocks a SyntaxError - instead of SystemError. - -Library -------- - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #28563: Fixed possible DoS and arbitrary code execution when handle - plural form selections in the gettext module. The expression parser now - supports exact syntax supported by GNU gettext. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #25464: Fixed HList.header_exists() in Tix module by adding - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. - -- Issue #28480: Fix error building _sqlite3 module when multithreading is - disabled. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. - -- Issue #26293: Fixed writing ZIP files that starts not from the start of the - file. Offsets in ZIP file now are relative to the start of the archive in - conforming to the specification. - -- Fix possible integer overflows and crashes in the mmap module with unusual - usage patterns. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Original patch by Xiang Zhang. - -- Issue #1703178: Fix the ability to pass the --link-objects option to the - distutils build_ext command. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #27963: Fixed possible null pointer dereference in - ctypes.set_conversion_mode(). Patch by Xiang Zhang. - -- Issue #28284: Strengthen resistance of ``_json.encode_basestring_ascii()`` to - integer overflow. - -- Issue #27611: Fixed support of default root window in the Tix module. - -- Issue #24363: When parsing HTTP header fields, if an invalid line is - encountered, skip it and continue parsing. Previously, no more header - fields were parsed, which could lead to fields for HTTP framing like - Content-Length and Transfer-Encoding being overlooked. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #25969: Update the lib2to3 grammar to handle the unpacking - generalizations added in 3.5. - -- Issue #24594: Validates persist parameter when opening MSI database - -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. - -- Issue #22450: urllib now includes an "Accept: */*" header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. - -- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file - between runs given the same Grammar.txt input regardless of the hash - randomization setting. - -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name - fields in X.509 certs. - -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter - measure sweet32 attack (CVE-2016-2183). - -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. - (Required OpenSSL 1.1.0 or LibreSSL). - -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. - -- Issue #27944: Fix some memory-corruption bugs in the log reading code of the - _hotshot module. - -- Issue #27934: Use ``float.__repr__`` instead of plain ``repr`` when JSON- - encoding an instance of a float subclass. Thanks Eddie James. - -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory - creates not a cursor. Patch by Xiang Zhang. - -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. - -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. - -- Issue #2466: posixpath.ismount now correctly recognizes mount points which - the user does not have permission to access. - -- Issue #27783: Fix possible usage of uninitialized memory in operator.methodcaller. - -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. - -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. - -- Issue #27758: Fix possible integer overflow in the _csv module for large record - lengths. - -- Issue #23369: Fixed possible integer overflow in - _json.encode_basestring_ascii. - -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. - -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 2 or 4 GiB). Previously, inputs were limited to 2 GiB, and - compression and decompression operations did not properly handle results of - 2 or 4 GiB. - -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. - -- Issue #27466: Change time format returned by http.cookie.time2netscape, - confirming the netscape cookie format and making it consistent with - documentation. - -- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong - mode no longer break tracing, trace_vinfo() now always returns a list of - pairs of strings. - -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - -- Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). - -- Issue #27330: Fixed possible leaks in the ctypes module. - -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch - by Jelle Zijlstra. - -- Issue #26386: Fixed ttk.TreeView selection operations with item id's - containing spaces. - -- Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag. - -- Issue #21201: Improves readability of multiprocessing error message. Thanks - to Wojciech Walczak for patch. - -IDLE ----- - -- Issue #27854: Make Help => IDLE Help work again on Windows. - Include idlelib/help.html in 2.7 Windows installer. - -- Issue #25507: Add back import needed for 2.x encoding warning box. - Add pointer to 'Encoding declaration' in Language Reference. - -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. - -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - -- Issue #17642: add larger font sizes for classroom projection. - -- Add version to title of IDLE help window. - -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. - -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. - -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. - Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. - -Documentation -------------- - -- Issue #28513: Documented command-line interface of zipfile. - -- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the - resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik - Nadikuditi. - -Tests ------ - -- Issue #28666: Now test.test_support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -- Issue #27369: In test_pyexpat, avoid testing an error message detail that - changed in Expat 2.2.0. - -Build ------ - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -- Issue #28258: Fixed build with Estonian locale (distclean target in - Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #15819: The Include directory in the build tree is already searched; - drop unused code trying to add it again. - -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) - -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. - -- Issue #26359: Add the --with-optimizations configure flag. - -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. - -- Issue #27806: Fix 32-bit builds on macOS Sierra 10.12 broken by removal of - deprecated QuickTime/QuickTime.h header file. Patch by Aleks Bunin. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Initial patch by Gareth Rees. - -Tools/Demos ------------ - -- Issue #27952: Get Tools/scripts/fixcid.py working with the current "re" - module, avoid invalid Python backslash escapes, and fix a bug parsing - escaped C quote signs. - -Windows -------- - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Issue #27888: Prevent Windows installer from displaying console windows and - failing when pip cannot be installed/uninstalled. - -Mac OS X --------- - -- Issue #28440: No longer add /Library/Python/site-packages, the Apple-supplied - system Python site-packages directory, to sys.path for macOS framework builds. - The coupling between the two Python instances often caused confusion and, as - of macOS 10.12, changes to the site-packages layout can cause pip component - installations to fail. This change reverts the effects introduced in 2.7.0 - by Issue #4865. If you are using a package with both the Apple system Python - 2.7 and a user-installed Python 2.7, you will need to ensure that copies of - the package are installed with both Python instances. - - -What's New in Python 2.7.12? -============================ - -*Release date: 2016-06-25* - -Build ------ - -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen executable from being cross-compiled. - -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. - -IDLE ----- - -- Issue #27365: Fix about dialog. - - -What's New in Python 2.7.12 release candidate 1? -================================================ - -*Release date: 2016-06-12* - -Core and Builtins ------------------ - -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. - -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. - -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" - format unit. - -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by - Joe Jevnik. - -- Issue #4806: Avoid masking the original TypeError exception when using star - (*) unpacking and the exception was raised from a generator. Based on - patch by Hagen F?rstenau. - -- Issue #26659: Make the builtin slice type support cycle collection. - -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. - NOTE: A direct call of super.__init__ is not endorsed! - -- Issue #13410: Fixed a bug in PyUnicode_Format where it failed to properly - ignore errors from a __int__() method. - -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of bytearray, - list, tuple, set, frozenset, dict, OrderedDict and corresponding views. - -- Issue #26581: If coding cookie is specified multiple times on a line in - Python source code file, only the first one is taken to account. - -- Issue #22836: Ensure exception reports from PyErr_Display() and - PyErr_WriteUnraisable() are sensible even when formatting them produces - secondary errors. This affects the reports produced by - sys.__excepthook__() and when __del__() raises an exception. - -- Issue #22847: Improve method cache efficiency. - -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` - are equal. - -- Issue #22995: [UPDATE] Remove the one of the pickleability tests in - _PyObject_GetState() due to regressions observed in Cython-based projects. - -- Issue #25961: Disallowed null characters in the type name. - -- Issue #22995: Instances of extension types with a state that aren't - subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. - -- Issue #20440: Massive replacing unsafe attribute setting code with special - macro Py_SETREF. - -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. - This allows sys.getsize() to work correctly with their subclasses with - __slots__ defined. - -- Issue #19543: Added Py3k warning for decoding unicode. - -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside - __getattr__. - -- Issue #24731: Fixed crash on converting objects with special methods - __str__, __trunc__, and __float__ returning instances of subclasses of - str, long, and float to subclasses of str, long, and float correspondingly. - -- Issue #26478: Fix semantic bugs when using binary operators with dictionary - views and tuples. - -- Issue #26171: Fix possible integer overflow and heap corruption in - zipimporter.get_data(). - -Library -------- - -- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - -- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team - Oststrom - -- Issue #7356: ctypes.util: Make parsing of ldconfig output independent of the - locale. - -- Issue #25738: Stop BaseHTTPServer.BaseHTTPRequestHandler.send_error() from - sending a message body for 205 Reset Content. Also, don't send the - Content-Type header field in responses that don't have a body. Based on - patch by Susumu Koshiba. - -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. - -- Issue #27211: Fix possible memory corruption in io.IOBase.readline(). - -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with - PermissionError - -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Fix by J?n Janech. - -- Removed the requirements for the ctypes and modulefinder modules to be - compatible with earlier Python versions. - -- Issue #22274: In the subprocess module, allow stderr to be redirected to - stdout even when stdout is not redirected. Patch by Akira Li. - -- Issue #12045: Avoid duplicate execution of command in ctypes.util._get_soname(). - Patch by Sijin Joseph. - -- Issue #26960: Backported #16270 from Python 3 to Python 2, to prevent urllib - from hanging when retrieving certain FTP files. - -- Issue #25745: Fixed leaking a userptr in curses panel destructor. - -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. - Patch by Georg Brandl. - -- Issue #26873: xmlrpclib now raises ResponseError on unsupported type tags - instead of silently return incorrect result. - -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. - -- Issue #26864: In urllib, change the proxy bypass host checking against - no_proxy to be case-insensitive, and to not match unrelated host names that - happen to have a bypassed hostname as a suffix. Patch by Xiang Zhang. - -- Issue #26804: urllib will prefer lower_case proxy environment variables over - UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter Jansen. - -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items. This affects assertListEqual() and assertTupleEqual(). - -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer - silently ignore keyword arguments. - -- Issue #26657: Fix directory traversal vulnerability with SimpleHTTPServer - on Windows. This fixes a regression that was introduced in 2.7.7. Based - on patch by Philipp Hagemeister. - -- Issue #19377: Add .svg to mimetypes.types_map. - -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. - -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. - -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our - own SIGWINCH handler. Patch by Eric Price. - -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). - -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes - instead of up to 1024. - -- Issue #24266: Ctrl+C during Readline history search now cancels the search - mode when compiled with Readline 7. - -- Issue #23857: Implement PEP 493, adding a Python-2-only ssl module API and - environment variable to configure the default handling of SSL/TLS certificates - for HTTPS connections. - -- Issue #26313: ssl.py _load_windows_store_certs fails if windows cert store - is empty. Patch by Baji. - -- Issue #26513: Fixes platform module detection of Windows Server - -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by - Tam?s Bence Gedai. - -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. - -- Issue #15068: Got rid of excessive buffering in the fileinput module. - The bufsize parameter is no longer used. - -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu Dupuy. - -- Issue #26475: Fixed debugging output for regular expressions with the (?x) - flag. - -- Issue #26385: Remove the file if the internal fdopen() call in - NamedTemporaryFile() fails. Based on patch by Silent Ghost. - -- Issue #26309: In the "SocketServer" module, shut down the request (closing - the connected socket) when verify_request() returns false. Based on patch - by Aviv Palivoda. - -- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates. - -- Issue #24303: Fix random EEXIST upon multiprocessing semaphores creation with - Linux PID namespaces enabled. - -- Issue #25698: Importing module if the stack is too deep no longer replaces - imported module with the empty one. - -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. - -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. - -- Issue #19883: Fixed possible integer overflows in zipimport. - -- Issue #26147: xmlrpclib now works with unicode not encodable with used - non-UTF-8 encoding. - -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). - -- Issue #21847: Fixed xmlrpclib on Unicode-disabled builds. - -- Issue #6500: Fixed infinite recursion in urllib2.Request.__getattr__(). - -- Issue #26083: Workaround a subprocess bug that raises an incorrect - "ValueError: insecure string pickle" exception instead of the actual - exception on some platforms such as Mac OS X when an exception raised - in the forked child process prior to the exec() was large enough that - it overflowed the internal errpipe_read pipe buffer. - -- Issue #24103: Fixed possible use after free in ElementTree.iterparse(). - -- Issue #20954: _args_from_interpreter_flags used by multiprocessing and some - tests no longer behaves incorrectly in the presence of the PYTHONHASHSEED - environment variable. - -- Issue #14285: When executing a package with the "python -m package" option, - and package initialization raises ImportError, a proper traceback is now - reported. - -- Issue #6478: _strptime's regexp cache now is reset after changing timezone - with time.tzset(). - -- Issue #25718: Fixed copying object with state with boolean value is false. - -- Issue #25742: :func:`locale.setlocale` now accepts a Unicode string for - its second parameter. - -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. - -- Issue #25725: Fixed a reference leak in cPickle.loads() when unpickling - invalid data including tuple instructions. - -- Issue #25663: In the Readline completer, avoid listing duplicate global - names, and search the global namespace before searching builtins. - -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. - -- Issue #23914: Fixed SystemError raised by CPickle unpickler on broken data. - -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. - -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on - current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. - -IDLE ----- - -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. - -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. - -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. - -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. - -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. - -- Issue #25507: fix incorrect change in IOBinding that prevented printing. - Change also prevented saving shell window with non-ascii characters. - Augment IOBinding htest to include all major IOBinding functions. - -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. - -- Issue #26417: Prevent spurious errors and incorrect defaults when - installing IDLE 2.7 on OS X: default configuration settings are - no longer installed from OS X specific copies. - -Documentation -------------- - -- Issue #26736: Used HTTPS for external links in the documentation if possible. - -- Issue #6953: Rework the Readline module documentation to group related - functions together, and add more details such as what underlying Readline - functions and variables are accessed. - -- Issue #26014: Guide users to the newer packaging documentation as was done - for Python 3.x. In particular, the top-level 2.7 documentation page now - links to the newer installer and distributions pages rather than the - legacy install and Distutils pages; these are still linked to in the - library/distutils doc page. - -Tests ------ - -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. - -- Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This - avoids relying on svn.python.org, which recently changed root certificate. - -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. - -Build ------ - -- Issue #22359: Avoid incorrect recursive $(MAKE), and disable the rules for - running pgen when cross-compiling. The pgen output is normally saved with - the source code anyway, and is still regenerated when doing a native build. - Patch by Jonas Wagner and Xavier de Gaye. - -- Issue #19450: Update Windows builds to use SQLite 3.8.11.0. - -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. - -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a - lower-level check for st_blocks in struct stat. - -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - -- Issue #24421: Compile Modules/_math.c once, before building extensions. - Previously it could fail to compile properly if the math and cmath builds - were concurrent. - -- Issue #25824: Fixes sys.winver to not include any architecture suffix. - -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to - ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The - old ``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls - ``PCbuild\build.bat --pgo %*``. - -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. - -- Issue #25696: Fix installation of Python on UNIX with make -j9. - -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. - -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. - -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. - -Tools/Demos ------------ - -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas - Ilsche. - -C API ------ - -- bpo-30255: PySlice_GetIndicesEx now clips the step to - [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX] instead of - [-PY_SSIZE_T_MAX-1, PY_SSIZE_T_MAX]. This makes it safe to do "step = -step" - when reversing a slice. - -- Issue #26476: Fixed compilation error when use PyErr_BadInternalCall() in C++. - Patch by Jeroen Demeyer. - -Misc ----- - -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. - - -What's New in Python 2.7.11? -============================ - -*Release date: 2015-12-05* - -Library -------- - -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory - entries. Patch by Dingyuan Wang. - - -What's New in Python 2.7.11 release candidate 1? -================================================ - -*Release date: 2015-11-21* - -Core and Builtins ------------------ - -- Issue #25678: Avoid buffer overreads when int(), long(), float(), and - compile() are passed buffer objects. These objects are not necessarily - terminated by a null byte, but the functions assumed they were. - -- Issue #25388: Fixed tokenizer hang when processing undecodable source code - with a null byte. - -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now - rejects builtin types with not defined __new__. - -- Issue #7267: format(int, 'c') now raises OverflowError when the argument is - not in range(0, 256). - -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. - -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. - -- Issue #25003: os.urandom() doesn't use getentropy() on Solaris because - getentropy() is blocking, whereas os.urandom() should not block. getentropy() - is supported since Solaris 11.3. - -- Issue #21167: NAN operations are now handled correctly when python is - compiled with ICC even if -fp-model strict is not specified. - -- Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray - object now always allocates place for trailing null byte and it's buffer now - is always null-terminated. - -- Issue #19543: encode() and decode() methods and constructors of str, - unicode and bytearray classes now emit deprecation warning for known - non-text encodings when Python is ran with the -3 option. - -- Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(), - PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() - to check for and handle errors correctly. - -- Issue #4753: On compilers where it is supported, use "computed gotos" for - bytecode dispatch in the interpreter. This improves interpretation - performance. - -- Issue #22939: Fixed integer overflow in iterator object. Original patch by - Clement Rouault. - -- Issue #24102: Fixed exception type checking in standard error handlers. - -Library -------- - -- Issue #10128: backport issue #10845's mitigation of incompatibilities between - the multiprocessing module and directory and zipfile execution. - Multiprocessing on Windows will now automatically skip rerunning __main__ in - spawned processes, rather than failing with AssertionError. - -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). - -- Issue #25590: In the Readline completer, only call getattr() once per - attribute. - -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating - ssl.SSLContext. - -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). - -- Issue #7759: Fixed the mhlib module on filesystems that doesn't support - link counting for directories. - -- Issue #892902: Fixed pickling recursive objects. - -- Issue #18010: Fix the pydoc GUI's search function to handle exceptions - from importing packages. - -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. - -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. - -- Issue #21709: Fix the logging module to not depend upon __file__ being set - properly to get the filename of its caller from the stack. This allows it - to work if run in a frozen or embedded environment where the module's - .__file__ attribute does not match its code object's .co_filename. - -- Issue #25319: When threading.Event is reinitialized, the underlying condition - should use a regular lock rather than a recursive lock. - -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the - first question mark (?) rather than the last. Patch from Xiang Zhang. - -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. - -- Issue #22958: Constructor and update method of weakref.WeakValueDictionary - now accept the self keyword argument. - -- Issue #22609: Constructor and the update method of collections.UserDict now - accept the self keyword argument. - -- Issue #25203: Failed readline.set_completer_delims() no longer left the - module in inconsistent state. - -- Issue #19143: platform module now reads Windows version from kernel32.dll to - avoid compatibility shims. - -- Issue #25135: Make deque_clear() safer by emptying the deque before clearing. - This helps avoid possible reentrancy issues. - -- Issue #24684: socket.socket.getaddrinfo() now calls - PyUnicode_AsEncodedString() instead of calling the encode() method of the - host, to handle correctly custom unicode string with an encode() method - which doesn't return a byte string. The encoder of the IDNA codec is now - called directly instead of calling the encode() method of the string. - -- Issue #24982: shutil.make_archive() with the "zip" format now adds entries - for directories (including empty directories) in ZIP file. - -- Issue #17849: Raise a sensible exception if an invalid response is - received for a HTTP tunnel request, as seen with some servers that - do not support tunnelling. Initial patch from Cory Benfield. - -- Issue #16180: Exit pdb if file has syntax error, instead of trapping user - in an infinite loop. Patch by Xavier de Gaye. - -- Issue #22812: Fix unittest discovery examples. - Patch from Pam McA'Nulty. - -- Issue #24634: Importing uuid should not try to load libc on Windows - -- Issue #23652: Make it possible to compile the select module against the - libc headers from the Linux Standard Base, which do not include some - EPOLL macros. Initial patch by Matt Frank. - -- Issue #15138: Speed up base64.urlsafe_b64{en,de}code considerably. - -- Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch - written by Matthieu Gautier. - -- Issue #23254: Document how to close the TCPServer listening socket. - Patch from Martin Panter. - -- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella. - -- Issue #24613: Calling array.fromstring() with self is no longer allowed - to prevent the use-after-free error. Patch by John Leitch. - -- Issue #24708: Fix possible integer overflow in strop.replace(). - -- Issue #24620: Random.setstate() now validates the value of state last element. - -- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. - -- Issue #24611: Fixed compiling the posix module on non-Windows platforms - without mknod() or makedev() (e.g. on Unixware). - -- Issue #18684: Fixed reading out of the buffer in the re module. - -- Issue #24259: tarfile now raises a ReadError if an archive is truncated - inside a data segment. - -- Issue #24514: tarfile now tolerates number fields consisting of only - whitespace. - -- Issue #20387: Restore semantic round-trip correctness in tokenize/untokenize - for tab-indented blocks. - -- Issue #24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() - functions of the audioop module. Fixed SystemError when the state is not a - tuple. Fixed possible memory leak. - -- Issue #24481: Fix possible memory corruption with large profiler info strings - in hotshot. - -- Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). - -- Issue #19543: io.TextIOWrapper (and hence io.open()) now uses the internal - codec marking system added to emit deprecation warning for known non-text - encodings at stream construction time when Python is ran with the -3 option. - -- Issue #24264: Fixed buffer overflow in the imageop module. - -- Issue #5633: Fixed timeit when the statement is a string and the setup is not. - -- Issue #24326: Fixed audioop.ratecv() with non-default weightB argument. - Original patch by David Moore. - -- Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port - value in the host header was set to "None". Patch by Demian Brecht. - -- Issue #24257: Fixed segmentation fault in sqlite3.Row constructor with faked - cursor type. - -- Issue #24286: Dict view were not registered with the MappingView abstract - base classes. This caused key and item views in OrderedDict to not be equal - to their regular dict counterparts. - -- Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again - when a directory with the chosen name already exists on Windows as well as - on Unix. tempfile.mkstemp() now fails early if parent directory is not - valid (not exists or is a file) on Windows. - -- Issue #6598: Increased time precision and random number range in - email.utils.make_msgid() to strengthen the uniqueness of the message ID. - -- Issue #24091: Fixed various crashes in corner cases in cElementTree. - -- Issue #15267: HTTPConnection.request() now is compatible with old-style - classes (such as TemporaryFile). Original patch by Atsuo Ishimoto. - -- Issue #20014: array.array() now accepts unicode typecodes. Based on patch by - Vajrasky Kok. - -- Issue #23637: Showing a warning no longer fails with UnicodeError. - Formatting unicode warning in the file with the path containing non-ascii - characters no longer fails with UnicodeError. - -- Issue #24134: Reverted issue #24134 changes. - -IDLE ----- - -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. - -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the - debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. - -- Change 'The program' to 'Your program' in an IDLE 'kill program?' message - to make it clearer that the program referred to is the currently running - user program, not IDLE itself. - -- Issue #24750: Improve the appearance of the IDLE editor window status bar. - Patch by Mark Roseman. - -- Issue #25313: Change the handling of new built-in text color themes to better - address the compatibility problem introduced by the addition of IDLE Dark. - Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. - -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences - dialog rather than a separate dialog. The former tabs are now a sorted - list. Patch by Mark Roseman. - -- Issue #22726: Re-activate the config dialog help button with some content - about the other buttons and the new IDLE Dark theme. - -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. - -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. - 'IDLE' now means 'Integrated Development and Learning Environment'. - -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. - -- Issue #24972: Inactive selection background now matches active selection - background, as configured by users, on all systems. Found items are now - always highlighted on Windows. Initial patch by Mark Roseman. - -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. - -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. - -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. - -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. - -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. - -- Issue #25225: Condense and rewrite Idle doc section on text colors. - -- Issue #21995: Explain some differences between IDLE and console Python. - -- Issue #22820: Explain need for *print* when running file from Idle editor. - -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. - -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. - -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Mark Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - -- Issue #23672: Allow Idle to edit and run files with astral chars in name. - Patch by Mohd Sanad Zaki Rizvi. - -- Issue #24745: Idle editor default font. Switch from Courier to - platform-sensitive TkFixedFont. This should not affect current customized - font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg - and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. - -- Issue #21192: Idle editor. When a file is run, put its name in the restart bar. - Do not print false prompts. Original patch by Adnan Umer. - -- Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy. - -- Issue #15809: IDLE shell now uses locale encoding instead of Latin1 for - decoding unicode literals. - -Documentation -------------- - -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "thread" modules. Patch from Mattip. - -- Issue #20769: Improve reload() docs. Patch by Dorian Pula. - -- Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. - -- Issue #22155: Add File Handlers subsection with createfilehandler to Tkinter - doc. Remove obsolete example from FAQ. Patch by Martin Panter. - -Tests ------ - -- Issue #24751: When running regrtest with the ``-w`` command line option, - a test run is no longer marked as a failure if all tests succeed when - re-run. - -- PCbuild\rt.bat now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. - -Build ------ - -- Issue #24915: When doing a PGO build, the test suite is now used instead of - pybench; Clang support was also added as part off this work. Initial patch by - Alecsandru Patrascu of Intel. - -- Issue #24986: It is now possible to build Python on Windows without errors - when external libraries are not available. - -- Issue #24508: Backported the MSBuild project files from Python 3.5. The - backported files replace the old project files in PCbuild; the old files moved - to PC/VS9.0 and remain supported. - -- Issue #24603: Update Windows builds and OS X 10.5 installer to use OpenSSL - 1.0.2d. - -Windows -------- - -- Issue #25022: Removed very outdated PC/example_nt/ directory. - - -What's New in Python 2.7.10? -============================ - -*Release date: 2015-05-23* - -Library -------- - -- Issue #22931: Allow '[' and ']' in cookie values. - - -What's New in Python 2.7.10 release candidate 1? -================================================ - -*Release date: 2015-05-10* - -Core and Builtins ------------------ - -- Issue #23971: Fix underestimated presizing in dict.fromkeys(). - -- Issue #23757: PySequence_Tuple() incorrectly called the concrete list API - when the data was a list subclass. - -- Issue #23629: Fix the default __sizeof__ implementation for variable-sized - objects. - -- Issue #23055: Fixed a buffer overflow in PyUnicode_FromFormatV. Analysis - and fix by Guido Vranken. - -- Issue #23048: Fix jumping out of an infinite while loop in the pdb. - -Library -------- - -- The keywords attribute of functools.partial is now always a dictionary. - -- Issue #20274: When calling a _sqlite.Connection, it now complains if passed - any keyword arguments. Previously it silently ignored them. - -- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three - METH_VARARGS methods on _sqlite.Connection. - -- Issue #24134: assertRaises() and assertRaisesRegexp() checks are not longer - successful if the callable is None. - -- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. - -- Issues #24099, #24100, and #24101: Fix use-after-free bug in heapq's siftup - and siftdown functions. - -- Backport collections.deque fixes from Python 3.5. Prevents reentrant badness - during deletion by deferring the decref until the container has been restored - to a consistent state. - -- Issue #23842: os.major(), os.minor() and os.makedev() now support ints again. - -- Issue #23811: Add missing newline to the PyCompileError error message. - Patch by Alex Shkop. - -- Issue #17898: Fix exception in gettext.py when parsing certain plural forms. - -- Issue #23865: close() methods in multiple modules now are idempotent and more - robust at shutdown. If they need to release multiple resources, all are - released even if errors occur. - -- Issue #23881: urllib.ftpwrapper constructor now closes the socket if the FTP - connection failed. - -- Issue #15133: _tkinter.tkapp.getboolean() now supports long and Tcl_Obj and - always returns bool. tkinter.BooleanVar now validates input values (accepted - bool, int, long, str, unicode, and Tcl_Obj). tkinter.BooleanVar.get() now - always returns bool. - -- Issue #23338: Fixed formatting ctypes error messages on Cygwin. - Patch by Makoto Kato. - -- Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and - arbitrary precision integers added in Tcl 8.5. - -- Issue #23834: Fix socket.sendto(), use the C long type to store the result of - sendto() instead of the C int type. - -- Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. - -- Issue #23838: linecache now clears the cache and returns an empty result on - MemoryError. - -- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. - -- Issue #21802: The reader in BufferedRWPair now is closed even when closing - writer failed in BufferedRWPair.close(). - -- Issue #23671: string.Template now allows specifying the "self" parameter as - a keyword argument. string.Formatter now allows specifying the "self" and - the "format_string" parameters as keyword arguments. - -- Issue #21560: An attempt to write a data of wrong type no longer cause - GzipFile corruption. Original patch by Wolfgang Maier. - -- Issue #23647: Increase impalib's MAXLINE to accommodate modern mailbox sizes. - -- Issue #23539: If body is None, http.client.HTTPConnection.request now sets - Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors from - some web servers. - -- Issue #23136: _strptime now uniformly handles all days in week 0, including - Dec 30 of previous year. Based on patch by Jim Carroll. - -- Issue #23138: Fixed parsing cookies with absent keys or values in cookiejar. - Patch by Demian Brecht. - -- Issue #23051: multiprocessing.Pool methods imap() and imap_unordered() now - handle exceptions raised by an iterator. Patch by Alon Diamant and Davin - Potts. - -- Issue #22928: Disabled HTTP header injections in httplib. - Original patch by Demian Brecht. - -- Issue #23615: Module tarfile is now can be reloaded with imp.reload(). - -- Issue #22853: Fixed a deadlock when use multiprocessing.Queue at import time. - Patch by Florian Finkernagel and Davin Potts. - -- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST - flag on certificate stores when it is available. - -- Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the - SSL layer but the underlying connection hasn't been closed. - -- Issue #23504: Added an __all__ to the types module. - -- Issue #23458: On POSIX, the file descriptor kept open by os.urandom() is now - set to non inheritable - -- Issue #22113: struct.pack_into() now supports new buffer protocol (in - particular accepts writable memoryview). - -- Issues #814253, #9179: Warnings now are raised when group references and - conditional group references are used in lookbehind assertions in regular - expressions. - -- Issue #23215: Multibyte codecs with custom error handlers that ignores errors - consumed too much memory and raised SystemError or MemoryError. - Original patch by Aleksi Torhamo. - -- Issue #5700: io.FileIO() called flush() after closing the file. - flush() was not called in close() if closefd=False. - -- Issue #21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty - docstrings. Initial patch by Yuyang Guo. - -- Issue #22885: Fixed arbitrary code execution vulnerability in the dumbdbm - module. Original patch by Claudiu Popa. - -- Issue #23481: Remove RC4 from the SSL module's default cipher list. - -- Issue #21849: Fixed xmlrpclib serialization of non-ASCII unicode strings in - the multiprocessing module. - -- Issue #21840: Fixed expanding unicode variables of form $var in - posixpath.expandvars(). Fixed all os.path implementations on - unicode-disabled builds. - -- Issue #23367: Fix possible overflows in the unicodedata module. - -- Issue #23363: Fix possible overflow in itertools.permutations. - -- Issue #23364: Fix possible overflow in itertools.product. - -- Issue #23365: Fixed possible integer overflow in - itertools.combinations_with_replacement. - -- Issue #23366: Fixed possible integer overflow in itertools.combinations. - -- Issue #23191: fnmatch functions that use caching are now threadsafe. - -- Issue #18518: timeit now rejects statements which can't be compiled outside - a function or a loop (e.g. "return" or "break"). - -- Issue #19996: Make :mod:`httplib` ignore headers with no name rather than - assuming the body has started. - -- Issue #20188: Support Application-Layer Protocol Negotiation (ALPN) in the ssl - module. - -- Issue #23248: Update ssl error codes from latest OpenSSL git master. - -- Issue #23098: 64-bit dev_t is now supported in the os module. - -- Issue #23063: In the disutils' check command, fix parsing of reST with code or - code-block directives. - -- Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The - availability of the function is checked during the compilation. Patch written - by Bernard Spil. - -- Backport the context argument to ftplib.FTP_TLS. - -- Issue #23111: Maximize compatibility in protocol versions of ftplib.FTP_TLS. - -- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and - fragment when it redirects to add a trailing slash. - -- Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), - instead of reading /dev/urandom, to get pseudo-random bytes. - -- Issue #23093: In the io, module allow more operations to work on detached - streams. - -- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. - -- Issue #23016: A warning no longer produces an AttributeError when sys.stderr - is None. - -- Issue #21032: Fixed socket leak if HTTPConnection.getresponse() fails. - Original patch by Martin Panter. - -- Issue #22609: Constructors and update methods of mapping classes in the - collections module now accept the self keyword argument. - -Documentation -------------- - -- Issue #23006: Improve the documentation and indexing of dict.__missing__. - Add an entry in the language datamodel special methods section. - Revise and index its discussion in the stdtypes mapping/dict section. - Backport the code example from 3.4. - -- Issue #21514: The documentation of the json module now refers to new JSON RFC - 7159 instead of obsoleted RFC 4627. - -Tools/Demos ------------ - -- Issue #23330: h2py now supports arbitrary filenames in #include. - -- Issue #6639: Module-level turtle functions no longer raise TclError after - closing the window. - -- Issue #22314: pydoc now works when the LINES environment variable is set. - -- Issue #18905: "pydoc -p 0" now outputs actually used port. Based on patch by - Wieland Hoffmann. - -- Issue #23345: Prevent test_ssl failures with large OpenSSL patch level - values (like 0.9.8zc). - -Tests ------ - -- Issue #23799: Added test.test_support.start_threads() for running and - cleaning up multiple threads. - -- Issue #22390: test.regrtest now emits a warning if temporary files or - directories are left after running a test. - -- Issue #23583: Added tests for standard IO streams in IDLE. - -- Issue #23392: Added tests for marshal C API that works with FILE*. - -- Issue #18982: Add tests for CLI of the calendar module. - -- Issue #19949: The test_xpickle test now tests compatibility with installed - Python 2.7 and reports skipped tests. Based on patch by Zachary Ware. - -- Issue #11578: Backported test for the timeit module. - -- Issue #22943: bsddb tests are locale independend now. - -IDLE ----- - -- Issue #23583: Fixed writing unicode to standard output stream in IDLE. - -- Issue #20577: Configuration of the max line length for the FormatParagraph - extension has been moved from the General tab of the Idle preferences dialog - to the FormatParagraph tab of the Config Extensions dialog. - Patch by Tal Einat. - -- Issue #16893: Update Idle doc chapter to match current Idle and add new - information. - -- Issue #23180: Rename IDLE "Windows" menu item to "Window". - Patch by Al Sweigart. - -Build ------ - -- Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure - script. - -- Issue #23032: Fix installer build failures on OS X 10.4 Tiger - by disabling assembly code in the OpenSSL build. - -- Issue #23686: Update OS X 10.5 installer and Windows builds to use - OpenSSL 1.0.2a. - -C API ------ - -- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error - -- Issue #22079: PyType_Ready() now checks that statically allocated type has - no dynamically allocated bases. - - -What's New in Python 2.7.9? -=========================== - -*Release date: 2014-12-10* - -Library -------- - -- Issue #22959: Remove the *check_hostname* parameter of - httplib.HTTPSConnection. The *context* parameter should be used instead. - -- Issue #16043: Add a default limit for the amount of data xmlrpclib.gzip_decode - will return. This resolves CVE-2013-1753. - -- Issue #16042: CVE-2013-1752: smtplib: Limit amount of data read by limiting - the call to readline(). Original patch by Christian Heimes. - -- Issue #16041: In poplib, limit maximum line length read from the server to - prevent CVE-2013-1752. - -- Issue #22960: Add a context argument to xmlrpclib.ServerProxy. - -Build ------ - -- Issue #22935: Allow the ssl module to be compiled if openssl doesn't support - SSL 3. - -- Issue #17128: Use private version of OpenSSL for 2.7.9 OS X 10.5+ installer. - - -What's New in Python 2.7.9 release candidate 1? -=============================================== - -*Release date: 2014-11-25* - -Core and Builtins ------------------ - -- Issue #21963: backout issue #1856 patch (avoid crashes and lockups when - daemon threads run while the interpreter is shutting down; instead, these - threads are now killed when they try to take the GIL), as it seems to - break some existing code. - -- Issue #22604: Fix assertion error in debug mode when dividing a complex - number by (nan+0j). - -- Issue #22470: Fixed integer overflow issues in "backslashreplace" and - "xmlcharrefreplace" error handlers. - -- Issue #22526: Fix iterating through files with lines longer than 2^31 bytes. - -- Issue #22519: Fix overflow checking in PyString_Repr. - -- Issue #22518: Fix integer overflow issues in latin-1 encoding. - -- Issue #22379: Fix empty exception message in a TypeError raised in - ``str.join``. - -- Issue #22221: Now the source encoding declaration on the second line isn't - effective if the first line contains anything except a comment. - -- Issue #22023: Fix ``%S``, ``%R`` and ``%V`` formats of - :c:func:`PyUnicode_FromFormat`. - -- Issue #21591: Correctly handle qualified exec statements in tuple form by - moving compatibility layer from run-time to AST transformation. - -Library -------- - -- Issue #22417: Verify certificates by default in httplib (PEP 476). - -- Issue #22927: Allow urllib.urlopen to take a *context* parameter to control - SSL settings for HTTPS connections. - -- Issue #22921: Allow SSLContext to take the *hostname* parameter even if - OpenSSL doesn't support SNI. - -- Issue #9003 and #22366: httplib.HTTPSConnection, urllib2.HTTPSHandler and - urllib2.urlopen now take optional arguments to allow for server certificate - checking, as recommended in public uses of HTTPS. This backport is part of PEP - 467. - -- Issue #12728: Different Unicode characters having the same uppercase but - different lowercase are now matched in case-insensitive regular expressions. - -- Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian - platforms. - -- Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat. - Based on patch by Aivars Kalv?ns. - -- Issue #22769: Fixed ttk.Treeview.tag_has() when called without arguments. - -- Issue #22787: Allow the keyfile argument of SSLContext.load_cert_chain to be - None. - -- Issue #22775: Fixed unpickling of Cookie.SimpleCookie with protocol 2. - Patch by Tim Graham. - -- Issue #22776: Brought excluded code into the scope of a try block in - SysLogHandler.emit(). - -- Issue #17381: Fixed ranges handling in case-insensitive regular expressions. - -- Issue #19329: Optimized compiling charsets in regular expressions. - -- Issue #22410: Module level functions in the re module now cache compiled - locale-dependent regular expressions taking into account the locale. - -- Issue #8876: distutils now falls back to copying files when hard linking - doesn't work. This allows use with special filesystems such as VirtualBox - shared folders. - -- Issue #9351: Defaults set with set_defaults on an argparse subparser - are no longer ignored when also set on the parent parser. - -- Issue #20421: Add a .version() method to SSL sockets exposing the actual - protocol version in use. - -- Issue #22435: Fix a file descriptor leak when SocketServer bind fails. - -- Issue #13664: GzipFile now supports non-ascii Unicode filenames. - -- Issue #13096: Fixed segfault in CTypes POINTER handling of large - values. - -- Issue #11694: Raise ConversionError in xdrlib as documented. Patch - by Filip Gruszczy?ski and Claudiu Popa. - -- Issue #1686: Fix string.Template when overriding the pattern attribute. - -- Issue #11866: Eliminated race condition in the computation of names - for new threads. - -- Issue #22219: The zipfile module CLI now adds entries for directories - (including empty directories) in ZIP file. - -- Issue #22449: In the ssl.SSLContext.load_default_certs, consult the - environmental variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. - -- Issue #8473: doctest.testfile now uses universal newline mode to read - the test file. - -- Issue #20076: Added non derived UTF-8 aliases to locale aliases table. - -- Issue #20079: Added locales supported in glibc 2.18 to locale alias table. - -- Issue #22530: Allow the ``group()`` method of regular expression match objects - to take a ``long`` as an index. - -- Issue #22517: When an io.BufferedRWPair object is deallocated, clear its - weakrefs. - -- Issue #10510: distutils register and upload methods now use HTML standards - compliant CRLF line endings. - -- Issue #9850: Fixed macpath.join() for empty first component. Patch by - Oleg Oshmyan. - -- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS - directory attributes. - -- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory - records if allowZip64 is false. - -- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re - module. - -- Issue #22423: Unhandled exception in thread no longer causes unhandled - AttributeError when sys.stderr is None. - -- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to - 65536 bytes and send a 414 error code for higher lengths. Patch contributed - by Devin Cook. - -- Lax cookie parsing in http.cookies could be a security issue when combined - with non-standard cookie handling in some Web browsers. Reported by - Sergey Bobrov. - -- Issue #21147: sqlite3 now raises an exception if the request contains a null - character instead of truncating it. Based on patch by Victor Stinner. - -- Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with - empty string or tuple argument. - -- Issue #21951: Tkinter now most likely raises MemoryError instead of crash - if the memory allocation fails. - -- Issue #22226: First letter no longer is stripped from the "status" key in - the result of Treeview.heading(). - -- Issue #22051: turtledemo no longer reloads examples to re-run them. - Initialization of variables and gui setup should be done in main(), - which is called each time a demo is run, but not on import. - -- Issue #21597: The separator between the turtledemo text pane and the drawing - canvas can now be grabbed and dragged with a mouse. The code text pane can - be widened to easily view or copy the full width of the text. The canvas - can be widened on small screens. Original patches by Jan Kanis and Lita Cho. - -- Issue #18132: Turtledemo buttons no longer disappear when the window is - shrunk. Original patches by Jan Kanis and Lita Cho. - -- Issue #22312: Fix ntpath.splitdrive IndexError. - -- Issue #22216: smtplib now resets its state more completely after a quit. The - most obvious consequence of the previous behavior was a STARTTLS failure - during a connect/starttls/quit/connect/starttls sequence. - -- Issue #21305: os.urandom now caches a fd to /dev/urandom. This is a PEP 466 - backport from Python 3. - -- Issue #21307: As part of PEP 466, backport hashlib.algorithms_guaranteed and - hashlib.algorithms_available. - -- Issue #22259: Fix segfault when attempting to fopen a file descriptor - corresponding to a directory. - -- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode. - -- Issue #22191: Fixed warnings.__all__. - -- Issue #21308: Backport numerous features from Python's ssl module. This is - part of PEP 466. - -- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. - -- Issue #8797: Raise HTTPError on failed Basic Authentication immediately. - Initial patch by Sam Bull. - -- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter. - -- Issue #21448: Changed FeedParser feed() to avoid O(N**2) behavior when - parsing long line. Original patch by Raymond Hettinger. - -- Issue #17923: glob() patterns ending with a slash no longer match non-dirs on - AIX. Based on patch by Delhallt. - -- Issue #21975: Fixed crash when using uninitialized sqlite3.Row (in particular - when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the - __new__() method. - -- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more - than 100 headers are read. Patch by Jyrki Pulliainen and Daniel Eriksson. - -- Issue #21580: Now Tkinter correctly handles binary "data" and "maskdata" - configure options of tkinter.PhotoImage. - -- Issue #19612: subprocess.communicate() now also ignores EINVAL when using at - least two pipes. - -- Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError - on closed socket. - -- Issue #16133: The asynchat.async_chat.handle_read() method now ignores - socket.error() exceptions with blocking I/O errors: EAGAIN, EALREADY, - EINPROGRESS, or EWOULDBLOCK. - -- Issue #21990: Clean-up unnecessary and slow inner class definition in - saxutils (Contributed by Alex Gaynor). - -- Issue #1730136: Fix the comparison between a tkFont.Font and an object of - another kind. - -- Issue #19884: readline: Disable the meta modifier key if stdout is not - a terminal to not write the ANSI sequence "\033[1034h" into stdout. This - sequence is used on some terminal (ex: TERM=xterm-256color") to enable - support of 8 bit characters. - -- Issue #22017: Correct reference counting error in the initialization of the - _warnings module. - -- Issue #21868: Prevent turtle crash when undo buffer set to a value less - than one. - -- Issue #21151: Fixed a segfault in the _winreg module when ``None`` is passed - as a ``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. - -- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before, - it ignored I/O errors if at least the first C call read() succeed. - -- Issue #19870: BaseCookie now parses 'secure' and 'httponly' flags. - Backport of issue #16611. - -- Issue #21923: Prevent AttributeError in distutils.sysconfig.customize_compiler - due to possible uninitialized _config_vars. - -- Issue #21323: Fix CGIHTTPServer to again handle scripts in CGI subdirectories, - broken by the fix for security issue #19435. Patch by Zach Byrne. - -- Issue #22199: Make get_makefile_filename() available in Lib/sysconfig.py - for 2.7 to match other versions of sysconfig. - -IDLE ----- - -- Issue #3068: Add Idle extension configuration dialog to Options menu. - Changes are written to HOME/.idlerc/config-extensions.cfg. - Original patch by Tal Einat. - -- Issue #16233: A module browser (File : Class Browser, Alt+C) requires an - editor window with a filename. When Class Browser is requested otherwise, - from a shell, output window, or 'Untitled' editor, Idle no longer displays - an error box. It now pops up an Open Module box (Alt+M). If a valid name - is entered and a module is opened, a corresponding browser is also opened. - -- Issue #4832: Save As to type Python files automatically adds .py to the - name you enter (even if your system does not display it). Some systems - automatically add .txt when type is Text files. - -- Issue #21986: Code objects are not normally pickled by the pickle module. - To match this, they are no longer pickled when running under Idle. - -- Issue #22221: IDLE now ignores the source encoding declaration on the second - line if the first line contains anything except a comment. - -- Issue #17390: Adjust Editor window title; remove 'Python', - move version to end. - -- Issue #14105: Idle debugger breakpoints no longer disappear - when inserting or deleting lines. - -Extension Modules ------------------ - -- Issue #22381: Update zlib to 1.2.8. - -- Issue #22176: Update the ctypes module's libffi to v3.1. This release - adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian - architectures. - -Tools/Demos ------------ - -- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names - of unittest methods (e.g. failUnlessEqual -> assertEqual). - -- Issue #22221: 2to3 and the findnocoding.py script now ignore the source - encoding declaration on the second line if the first line contains anything - except a comment. - -- Issue #22201: Command-line interface of the zipfile module now correctly - extracts ZIP files with directory entries. Patch by Ryan Wilson. - -Tests ------ - -- Issue #22236: Tkinter tests now don't reuse default root window. New root - window is created for every test class. - -- Issue #18004: test_overflow in test_list by mistake consumed 40 GiB of memory - on 64-bit systems. - -- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks - to William Orr. - -- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests. - -Build ------ - -- Issue #20221: Removed conflicting (or circular) hypot definition when - compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. - -- Issue #16537: Check whether self.extensions is empty in setup.py. Patch by - Jonathan Hosmer. - -- The documentation Makefile no longer automatically downloads Sphinx. Users are - now required to have Sphinx already installed to build the documentation. - -- Issue #21958: Define HAVE_ROUND when building with Visual Studio 2013 and - above. Patch by Zachary Turner. - -- Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/ - now display special message when and only when there are failures. - -- Issue #21166: Prevent possible segfaults and other random failures of - python --generate-posix-vars in pybuilddir.txt build target. - -- Issue #18096: Fix library order returned by python-config. - -- Issue #17219: Add library build dir for Python extension cross-builds. - -- Issue #22877: PEP 477 - OS X installer now installs pip. - -- Issue #22878: PEP 477 - "make install" and "make altinstall" can now install - or upgrade pip, using the bundled pip provided by the backported ensurepip - module. A configure option, --with-ensurepip[=upgrade|install|no], is - available to set the option for subsequent installs; the default for Python 2 - in "no" (do not install or upgrade pip). The option can also be set with - "make [alt]install ENSUREPIP=[upgrade|install|no]". - -Windows -------- - -- Issue #17896: The Windows build scripts now expect external library sources - to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``. - -- Issue #17717: The Windows build scripts now use a copy of NASM pulled from - svn.python.org to build OpenSSL. - -- Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j. - - -What's New in Python 2.7.8? -=========================== - -*Release date: 2014-06-29* - -Core and Builtins ------------------ - -- Issue #4346: In PyObject_CallMethod and PyObject_CallMethodObjArgs, don't - overwrite the error set in PyObject_GetAttr. - -- Issue #21831: Avoid integer overflow when large sizes and offsets are given to - the buffer type. CVE-2014-7185. - -- Issue #19656: Running Python with the -3 option now also warns about - non-ascii bytes literals. - -- Issue #21642: If the conditional if-else expression, allow an integer written - with no space between itself and the ``else`` keyword (e.g. ``True if 42else - False``) to be valid syntax. - -- Issue #21523: Fix over-pessimistic computation of the stack effect of - some opcodes in the compiler. This also fixes a quadratic compilation - time issue noticeable when compiling code with a large number of "and" - and "or" operators. - -Library -------- - -- Issue #21652: Prevent mimetypes.type_map from containing unicode keys on - Windows. - -- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure - files closing. - -- Issue #21672: Fix the behavior of ntpath.join on UNC-style paths. - -- Issue #19145: The times argument for itertools.repeat now handles - negative values the same way for keyword arguments as it does for - positional arguments. - -- Issue #21832: Require named tuple inputs to be exact strings. - -- Issue #8343: Named group error messages in the re module did not show - the name of the erroneous group. - -- Issue #21491: SocketServer: Fix a race condition in child processes reaping. - -- Issue #21635: The difflib SequenceMatcher.get_matching_blocks() method - cache didn't match the actual result. The former was a list of tuples - and the latter was a list of named tuples. - -- Issue #21722: The distutils "upload" command now exits with a non-zero - return code when uploading fails. Patch by Martin Dengler. - -- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths - before checking for a CGI script at that path. - -- Issue #21310: Fixed possible resource leak in failed open(). - -- Issue #21304: Backport the key derivation function hashlib.pbkdf2_hmac from - Python 3 per PEP 466. - -- Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a - valid file. - -- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods - that use 'self' in the example code is generated correctly. - -- Issue #21552: Fixed possible integer overflow of too long string lengths in - the tkinter module on 64-bit platforms. - -- Issue #14315: The zipfile module now ignores extra fields in the central - directory that are too short to be parsed instead of letting a struct.unpack - error bubble up as this "bad data" appears in many real world zip files in - the wild and is ignored by other zip tools. - -- Issue #21402: Tkinter.ttk now works when default root window is not set. - -- Issue #10203: sqlite3.Row now truly supports sequence protocol. In particulr - it supports reverse() and negative indices. Original patch by Claudiu Popa. - -- Issue #8743: Fix interoperability between set objects and the - collections.Set() abstract base class. - -- Issue #21481: Argparse equality and inequality tests now return - NotImplemented when comparing to an unknown type. - -IDLE ----- - -- Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav - Heblikar. - -- Issue #18592: Add unittest for SearchDialogBase. Patch by Phil Webster. - -- Issue #21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar. - -- Issue #21686: add unittest for HyperParser. Original patch by Saimadhav - Heblikar. - -- Issue #12387: Add missing upper(lower)case versions of default Windows key - bindings for Idle so Caps Lock does not disable them. Patch by Roger Serwy. - -- Issue #21695: Closing a Find-in-files output window while the search is - still in progress no longer closes Idle. - -- Issue #18910: Add unittest for textView. Patch by Phil Webster. - -- Issue #18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar. - -- Issue #18409: Add unittest for AutoComplete. Patch by Phil Webster. - -Tests ------ - -- Issue #20155: Changed HTTP method names in failing tests in test_httpservers - so that packet filtering software (specifically Windows Base Filtering Engine) - does not interfere with the transaction semantics expected by the tests. - -- Issue #19493: Refactored the ctypes test package to skip tests explicitly - rather than silently. - -- Issue #18492: All resources are now allowed when tests are not run by - regrtest.py. - -- Issue #21605: Added tests for Tkinter images. - -- Issue #21493: Added test for ntpath.expanduser(). Original patch by - Claudiu Popa. - -- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok. - -- Issue #13355: random.triangular() no longer fails with a ZeroDivisionError - when low equals high. - -- Issue #21522: Added Tkinter tests for Listbox.itemconfigure(), - PanedWindow.paneconfigure(), and Menu.entryconfigure(). - -- Issue #20635: Added tests for Tk geometry managers. - -Build ------ - -- Issue #21811: Anticipated fixes to support OS X versions > 10.9. - -Windows -------- - -- Issue #21671, CVE-2014-0224: The bundled version of OpenSSL has been - updated to 1.0.1h. - - -What's New in Python 2.7.7 -========================== - -*Release date: 2014-05-31* - -Build ------ - -- Issue #21462: Build the Windows installers with OpenSSL 1.0.1g. - -- Issue #19866: Include some test data in the Windows installers, so tests don't - fail. - - -What's New in Python 2.7.7 release candidate 1? -=============================================== - -*Release date: 2014-05-17* - -Core and Builtins ------------------ - -- Issue #21350: Fix file.writelines() to accept arbitrary buffer objects, - as advertised. Patch by Brian Kearns. - -- Issue #20437: Fixed 43 potential bugs when deleting object references. - -- Issue #21134: Fix segfault when str is called on an uninitialized - UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object. - -- Issue #20494: Ensure that free()d memory arenas are really released on POSIX - systems supporting anonymous memory mappings. Patch by Charles-Fran?ois - Natali. - -- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and - IndentationError. - -- Raise a better error when non-unicode codecs are used for a file's coding - cookie. - -- Issue #17976: Fixed potential problem with file.write() not detecting IO error - by inspecting the return value of fwrite(). Based on patches by Jaakko Moisio - and Victor Stinner. - -- Issue #14432: Generator now clears the borrowed reference to the thread - state. Fix a crash when a generator is created in a C thread that is - destroyed while the generator is still used. The issue was that a generator - contains a frame, and the frame kept a reference to the Python state of the - destroyed C thread. The crash occurs when a trace function is setup. - -- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. - -- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 - billion characters) input strings in _Py_dg_strtod. - -- Issue #12546: Allow \x00 to be used as a fill character when using str, int, - float, and complex __format__ methods. - -Library -------- - -- Issue #10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial - shape. - -- Issue #7776: Backport Fix ``Host:'' header and reconnection when using - http.client.HTTPConnection.set_tunnel() from Python 3. Patch by Nikolaus - Rath. - -- Issue #21306: Backport hmac.compare_digest from Python 3. This is part of PEP - 466. - -- Issue #21470: Do a better job seeding the random number generator by - using enough bytes to span the full state space of the Mersenne Twister. - -- Issue #21469: Reduced the risk of false positives in robotparser by - checking to make sure that robots.txt has been read or does not exist - prior to returning True in can_fetch(). - -- Issue #21321: itertools.islice() now releases the reference to the source - iterator when the slice is exhausted. Patch by Anton Afanasyev. - -- Issue #9291: Do not attempt to re-encode mimetype data read from registry in - ANSI mode. Initial patches by Dmitry Jemerov & Vladimir Iofik. - -- Issue #21349: Passing a memoryview to _winreg.SetValueEx now correctly raises - a TypeError where it previously crashed the interpreter. Patch by Brian Kearns - -- Issue #21529 (CVE-2014-4616): Fix arbitrary memory access in - JSONDecoder.raw_decode with a negative second parameter. Bug reported by Guido - Vranken. - -- Issue #21172: isinstance check relaxed from dict to collections.Mapping. - -- Issue #21191: In os.fdopen, never close the file descriptor when an exception - happens. - -- Issue #21149: Improved thread-safety in logging cleanup during interpreter - shutdown. Thanks to Devin Jeanpierre for the patch. - -- Fix possible overflow bug in strop.expandtabs. You shouldn't be using this - module! - -- Issue #20145: `assertRaisesRegex` now raises a TypeError if the second - argument is not a string or compiled regex. - -- Issue #21058: Fix a leak of file descriptor in tempfile.NamedTemporaryFile(), - close the file descriptor if os.fdopen() fails - -- Issue #20283: RE pattern methods now accept the string keyword parameters - as documented. The pattern and source keyword parameters are left as - deprecated aliases. - -- Issue #11599: When an external command (e.g. compiler) fails, distutils now - prints out the whole command line (instead of just the command name) if the - environment variable DISTUTILS_DEBUG is set. - -- Issue #4931: distutils should not produce unhelpful "error: None" messages - anymore. distutils.util.grok_environment_error is kept but doc-deprecated. - -- Improve the random module's default seeding to use 256 bits of entropy - from os.urandom(). This was already done for Python 3, mildly improving - security with a bigger seed space. - -- Issue #15618: Make turtle.py compatible with 'from __future__ import - unicode_literals'. Initial patch by Juancarlo A?ez. - -- Issue #20501: fileinput module no longer reads whole file into memory when using - fileinput.hook_encoded. - -- Issue #6815: os.path.expandvars() now supports non-ASCII Unicode environment - variables names and values. - -- Issue #20635: Fixed grid_columnconfigure() and grid_rowconfigure() methods of - Tkinter widgets to work in wantobjects=True mode. - -- Issue #17671: Fixed a crash when use non-initialized io.BufferedRWPair. - Based on patch by Stephen Tu. - -- Issue #8478: Untokenizer.compat processes first token from iterator input. - Patch based on lines from Georg Brandl, Eric Snow, and Gareth Rees. - -- Issue #20594: Avoid name clash with the libc function posix_close. - -- Issue #19856: shutil.move() failed to move a directory to other directory - on Windows if source name ends with os.altsep. - -- Issue #14983: email.generator now always adds a line end after each MIME - boundary marker, instead of doing so only when there is an epilogue. This - fixes an RFC compliance bug and solves an issue with signed MIME parts. - -- Issue #20013: Some imap servers disconnect if the current mailbox is - deleted, and imaplib did not handle that case gracefully. Now it - handles the 'bye' correctly. - -- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the - debug output every time it is called, regardless of the compilation cache. - -- Issue #20368: The null character now correctly passed from Tcl to Python (in - unicode strings only). Improved error handling in variables-related commands. - -- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline - translation settings. - -- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. - -- Issue #19456: ntpath.join() now joins relative paths correctly when a drive - is present. - -- Issue #8260: The read(), readline() and readlines() methods of - codecs.StreamReader returned incomplete data when were called after - readline() or read(size). Based on patch by Amaury Forgeot d'Arc. - -- Issue #20374: Fix build with GNU readline >= 6.3. - -- Issue #14548: Make multiprocessing finalizers check pid before - running to cope with possibility of gc running just after fork. - (Backport from 3.x.) - -- Issue #20262: Warnings are raised now when duplicate names are added in the - ZIP file or too long ZIP file comment is truncated. - -- Issue #20270: urllib and urlparse now support empty ports. - -- Issue #20243: TarFile no longer raise ReadError when opened in write mode. - -- Issue #20245: The open functions in the tarfile module now correctly handle - empty mode. - -- Issue #20086: Restored the use of locale-independent mapping instead of - locale-dependent str.lower() in locale.normalize(). - -- Issue #20246: Fix buffer overflow in socket.recvfrom_into. - -- Issue #19082: Working SimpleXMLRPCServer and xmlrpclib examples, both in - modules and documentation. - -- Issue #13107: argparse and optparse no longer raises an exception when output - a help on environment with too small COLUMNS. Based on patch by - Elazar Gershuni. - -- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly - asked for. - -- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. - -- Issue #1065986: pydoc can now handle unicode strings. - -- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to - limit line length. Patch by Emil Lind. - -- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl - module, rather than silently let them emit clear text data. - -- Issue #20027: Fixed locale aliases for devanagari locales. - -- Issue #20067: Tkinter variables now work when wantobjects is false. - -- Issue #19020: Tkinter now uses splitlist() instead of split() in configure - methods. - -- Issue #12226: HTTPS is now used by default when connecting to PyPI. - -- Issue #20048: Fixed ZipExtFile.peek() when it is called on the boundary of - the uncompress buffer and read() goes through more than one readbuffer. - -- Issue #20034: Updated alias mapping to most recent locale.alias file - from X.org distribution using makelocalealias.py. - -- Issue #5815: Fixed support for locales with modifiers. Fixed support for - locale encodings with hyphens. - -- Issue #20026: Fix the sqlite module to handle correctly invalid isolation - level (wrong type). - -- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and - quotechar fields. Original patch by Vajrasky Kok. - -- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the - executables used to find the mac address, with /sbin and /usr/sbin as - fallbacks. - -- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. - Original patch by Simon Sapin. - -- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). - -- Issue #19623: Fixed writing to unseekable files in the aifc module. - Fixed writing 'ulaw' (lower case) compressed AIFC files. - -- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. - Fixed integer overflow in the eventmask parameter. - -- Issue #17200: telnetlib's read_until and expect timeout was broken by the - fix to Issue #14635 in Python 2.7.4 to be interpreted as milliseconds - instead of seconds when the platform supports select.poll (ie: everywhere). - It is now treated as seconds once again. - -- Issue #19099: The struct module now supports Unicode format strings. - -- Issue #19878: Fix segfault in bz2 module after calling __init__ twice with - non-existent filename. Initial patch by Vajrasky Kok. - -- Issue #16373: Prevent infinite recursion for ABC Set class comparisons. - -- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when - no exception detail exists (no colon following the exception's name, or - a colon does follow but no text follows the colon). - -- Issue #16231: Fixed pickle.Pickler to only fallback to its default pickling - behaviour when Pickler.persistent_id returns None, but not for any other - false values. This allows false values other than None to be used as - persistent IDs. This behaviour is consistent with cPickle. - -- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with - virtual interface. Original patch by Kent Frazier. - -- Issue #11489: JSON decoder now accepts lone surrogates. - -- Fix test.test_support.bind_port() to not cause an error when Python was - compiled on a system with SO_REUSEPORT defined in the headers but run on - a system with an OS kernel that does not support that new socket option. - -- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on - big-endian platforms. - -- Issue #19449: in csv's writerow, handle non-string keys when generating the - error message that certain keys are not in the 'fieldnames' list. - -- Issue #12853: Fix NameError in distutils.command.upload. - -- Issue #19523: Closed FileHandler leak which occurred when delay was set. - -- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. - -- Issue #19480: HTMLParser now accepts all valid start-tag names as defined - by the HTML5 standard. - -- Issue #17827: Add the missing documentation for ``codecs.encode`` and - ``codecs.decode``. - -- Issue #6157: Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo. - -- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of - integers instead of a string. Based on patch by Guilherme Polo. - -- Issue #19286: Directories in ``package_data`` are no longer added to - the filelist, preventing failure outlined in the ticket. - -- Issue #6676: Ensure a meaningful exception is raised when attempting - to parse more than one XML document per pyexpat xmlparser instance. - (Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with - suggested wording by David Gutteridge) - -- Issue #21311: Avoid exception in _osx_support with non-standard compiler - configurations. Patch by John Szakmeister. - -Tools/Demos ------------ - -- Issue #3561: The Windows installer now has an option, off by default, for - placing the Python installation into the system "Path" environment variable. - This was backported from Python 3.3. - -- Add support for ``yield from`` to 2to3. - -- Add support for the PEP 465 matrix multiplication operator to 2to3. - -- Issue #19936: Added executable bits or shebang lines to Python scripts which - requires them. Disable executable bits and shebang lines in test and - benchmark files in order to prevent using a random system python, and in - source files of modules which don't provide command line interface. - -IDLE ----- - -- Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin - consolidating and improving human-validated tests of Idle. Change other files - as needed to work with htest. Running the module as __main__ runs all tests. - -- Issue #21139: Change default paragraph width to 72, the PEP 8 recommendation. - -- Issue #21284: Paragraph reformat test passes after user changes reformat width. - -- Issue #20406: Use Python application icons for Idle window title bars. - Patch mostly by Serhiy Storchaka. - -- Issue #21029: Occurrences of "print" are now consistently colored as - being a keyword (the colorizer doesn't know if print functions are - enabled in the source). - -- Issue #17721: Remove non-functional configuration dialog help button until we - make it actually gives some help when clicked. Patch by Guilherme Sim?es. - -- Issue #17390: Add Python version to Idle editor window title bar. - Original patches by Edmond Burnett and Kent Johnson. - -- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. - -- Issue #19481: print() of unicode, str or bytearray subclass instance in IDLE - no more hangs. - -- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial - shell window is present. - -- Issue #17654: Ensure IDLE menus are customized properly on OS X for - non-framework builds and for all variants of Tk. - -Tests ------ - -- Issue #17752: Fix distutils tests when run from the installed location. - -- Issue #18604: Consolidated checks for GUI availability. All platforms now - at least check whether Tk can be instantiated when the GUI resource is - requested. - -- Issue #20946: Correct alignment assumptions of some ctypes tests. - -- Issue #20743: Fix a reference leak in test_tcl. - -- Issue #20510: Rewrote test_exit in test_sys to match existing comments, - use modern unittest features, and use helpers from test.script_helper - instead of using subprocess directly. Initial patch by Gareth Rees. - -- Issue #20532: Tests which use _testcapi now are marked as CPython only. - -- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. - -- Issue #19990: Added tests for the imghdr module. Based on patch by - Claudiu Popa. - -- Issue #19804: The test_find_mac test in test_uuid is now skipped if the - ifconfig executable is not available. - -- Issue #19886: Use better estimated memory requirements for bigmem tests. - -- Backported tests for Tkinter variables. - -- Issue #19320: test_tcl no longer fails when wantobjects is false. - -- Issue #19683: Removed empty tests from test_minidom. Initial patch by - Ajitesh Gupta. - -- Issue #19928: Implemented a test for repr() of cell objects. - -- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. - -- Issue #19588: Fixed tests in test_random that were silently skipped most - of the time. Patch by Julian Gindi. - -- Issue #17883: Tweak test_tcl testLoadWithUNC to skip the test in the - event of a permission error on Windows and to properly report other - skip conditions. - -- Issue #17883: Backported _is_gui_available() in test.test_support to - avoid hanging Windows buildbots on test_ttk_guionly. - -- Issue #18702, #19572: All skipped tests now reported as skipped. - -- Issue #19085: Added basic tests for all tkinter widget options. - -- Issue #20605: Make test_socket getaddrinfo OS X segfault test more robust. - -- Issue #20939: Avoid various network test failures due to new - redirect of http://www.python.org/ to https://www.python.org: - use http://www.example.com instead. - -- Issue #21093: Prevent failures of ctypes test_macholib on OS X if a - copy of libz exists in $HOME/lib or /usr/local/lib. - -Build ------ - -- Issue #21285: Refactor and fix curses configure check to always search - in a ncursesw directory. - -Documentation -------------- - -- Issue #20255: Update the about and bugs pages. - -- Issue #18840: Introduce the json module in the tutorial, and de-emphasize - the pickle module. - -- Issue #19795: Improved markup of True/False constants. - -Windows -------- - -- Issue #21303, #20565: Updated the version of Tcl/Tk included in the - installer from 8.5.2 to 8.5.15. - -Mac OS X --------- - -- As of 2.7.8, the 32-bit-only installer will support OS X 10.5 - and later systems as is currently done for Python 3.x installers. - For 2.7.7 only, we will provide three installers: - the legacy deprecated 10.3+ 32-bit-only format; - the newer 10.5+ 32-bit-only format; - and the unchanged 10.6+ 64-/32-bit format. - Although binary installers will no longer be available from - python.org as of 2.7.8, it will still be possible to build from - source on 10.3.9 and 10.4 systems if necessary. - See Mac/BuildScript/README.txt for more information. - - -Whats' New in Python 2.7.6? -=========================== - -*Release date: 2013-11-10* - -Library -------- - -- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. - -IDLE ----- - -- Issue #19426: Fixed the opening of Python source file with specified encoding. - -Tests ------ - -- Issue #19457: Fixed xmlcharrefreplace tests on wide build when tests are - loaded from .py[co] files. - -Build ------ - -- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 2.7.6. - Some third-party projects, such as Matplotlib and PIL/Pillow, - depended on being able to build with Tcl and Tk frameworks in - /Library/Frameworks. - - -What's New in Python 2.7.6 release candidate 1? -=============================================== - -*Release date: 2013-10-26* - -Core and Builtins ------------------ - -- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the - Python executable and not removed by the linker's optimizer. - -- Issue #19279: UTF-7 decoder no more produces illegal unicode strings. - -- Issue #18739: Fix an inconsistency between math.log(n) and math.log(long(n)); - the results could be off from one another by a ulp or two. - -- Issue #13461: Fix a crash in the "replace" error handler on 64-bit platforms. - Patch by Yogesh Chaudhari. - -- Issue #15866: The xmlcharrefreplace error handler no more produces two XML - entities for a non-BMP character on narrow build. - -- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise - OverflowError when an argument of %c format is out of range. - -- Issue #18137: Detect integer overflow on precision in float.__format__() - and complex.__format__(). - -- Issue #18038: SyntaxError raised during compilation sources with illegal - encoding now always contains an encoding name. - -- Issue #18019: Fix crash in the repr of dictionaries containing their own - views. - -- Issue #18427: str.replace could crash the interpreter with huge strings. - -Library -------- - -- Issue #19393: Fix symtable.symtable function to not be confused when there are - functions or classes named "top". - -- Issue #19327: Fixed the working of regular expressions with too big charset. - -- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin - Williams. - -- Issue #19352: Fix unittest discovery when a module can be reached - through several paths (e.g. under Debian/Ubuntu with virtualenv). - -- Issue #15207: Fix mimetypes to read from correct part of Windows registry - Original patch by Dave Chambers - -- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. - Patch by Martin Matusiak. - -- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by - limiting the call to readline(). Original patch by Micha? - Jastrz?bski and Giampaolo Rodola. - -- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. - -- Issue #18458: Prevent crashes with newer versions of libedit. Its readline - emulation has changed from 0-based indexing to 1-based like gnu readline. - Original patch by Ronald Oussoren. - -- Issue #18919: If the close() method of a writer in the sunau or wave module - failed, second invocation of close() and destructor no more raise an - exception. Second invocation of close() on sunau writer now has no effects. - The aifc module now accepts lower case of names of the 'ulaw' and 'alaw' - codecs. - -- Issue #19131: The aifc module now correctly reads and writes sampwidth of - compressed streams. - -- Issue #19158: A rare race in BoundedSemaphore could allow .release() too - often. - -- Issue #18037: 2to3 now escapes '\u' and '\U' in native strings. - -- Issue #19137: The pprint module now correctly formats empty set and frozenset - and instances of set and frozenset subclasses. - -- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to - prevent readline() calls from consuming too much memory. Patch by Jyrki - Pulliainen. - -- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except - when necessary. Patch by Oscar Benjamin. - -- Properly initialize all fields of a SSL object after allocation. - -- Issue #4366: Fix building extensions on all platforms when --enable-shared - is used. - -- Issue #18950: Fix miscellaneous bugs in the sunau module. - Au_read.readframes() now updates current file position and reads correct - number of frames from multichannel stream. Au_write.writeframesraw() now - correctly updates current file position. Au_read and Au_write now correctly - work with file object if start file position is not a zero. - -- Issue #18050: Fixed an incompatibility of the re module with Python 2.7.3 - and older binaries. - -- Issue #19037: The mailbox module now makes all changes to maildir files - before moving them into place, to avoid race conditions with other programs - that may be accessing the maildir directory. - -- Issue #14984: On POSIX systems, when netrc is called without a filename - argument (and therefore is reading the user's $HOME/.netrc file), it now - enforces the same security rules as typical ftp clients: the .netrc file must - be owned by the user that owns the process and must not be readable by any - other user. - -- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch - contributed by Vajrasky Kok. - -- Issue #19018: The heapq.merge() function no longer suppresses IndexError - in the underlying iterables. - -- Issue #18784: The uuid module no more attempts to load libc via ctypes.CDLL, - if all necessary functions are already found in libuuid. - Patch by Evgeny Sologubov. - -- Issue #14971: unittest test discovery no longer gets confused when a function - has a different __name__ than its name in the TestCase class dictionary. - -- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in - the _sre module. - -- Issue #18830: inspect.getclasstree() no more produces duplicated entries even - when input list contains duplicates. - -- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast - 64-bit pointer to long (32 bits). - -- Issue #18876: The FileIO.mode attribute now better reflects the actual mode - under which the file was opened. Patch by Erik Bray. - -- Issue #18851: Avoid a double close of subprocess pipes when the child - process fails starting. - -- Issue #18418: After fork(), reinit all threads states, not only active ones. - Patch by A. Jesse Jiryu Davis. - -- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now - properly handled as unsigned. - -- Issue #16809: Fixed some tkinter incompatibilities with Tcl/Tk 8.6. - -- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj - argument. - -- Issue #17119: Fixed integer overflows when processing large Unicode strings - and tuples in the tkinter module. - -- Issue #15233: Python now guarantees that callables registered with the atexit - module will be called in a deterministic order. - -- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. - A pthread_atfork() parent handler is used to seed the PRNG with pid, time - and some stack data. - -- Issue #8865: Concurrent invocation of select.poll.poll() now raises a - RuntimeError exception. Patch by Christian Schubert. - -- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit - platforms. Patch by Yogesh Chaudhari. - -- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of - OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. - -- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. - -- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke - malloc weak symbols. - -- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes - inside subjectAltName correctly. Formerly the module has used OpenSSL's - GENERAL_NAME_print() function to get the string representation of ASN.1 - strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and - ``uniformResourceIdentifier`` (URI). - -- Issue #18756: Improve error reporting in os.urandom() when the failure - is due to something else than /dev/urandom not existing (for example, - exhausting the file descriptor limit). - -- Fix tkinter regression introduced by the security fix in issue #16248. - -- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get - docstrings and ValueError messages. Patch by Zhongyue Luo - -- Issue #17998: Fix an internal error in regular expression engine. - -- Issue #17557: Fix os.getgroups() to work with the modified behavior of - getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. - -- Issue #18455: multiprocessing should not retry connect() with same socket. - -- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + - gcc. - -- Issue #18101: Tcl.split() now process Unicode strings nested in a tuple as it - do with byte strings. - -- Issue #18347: ElementTree's html serializer now preserves the case of - closing tags. - -- Issue #17261: Ensure multiprocessing's proxies use proper address. - -- Issue #17097: Make multiprocessing ignore EINTR. - -- Issue #18155: The csv module now correctly handles csv files that use - a delimiter character that has a special meaning in regexes, instead of - throwing an exception. - -- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input - string in longer than 2 gigabytes. The ssl module does not support partial - write. - -- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data - when \r\n appears at end of 65535 bytes without other newlines. - -- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to - ruleline. This helps in handling certain types invalid urls in a conservative - manner. Patch contributed by Mher Movsisyan. - -- Implement inequality on weakref.WeakSet. - -- Issue #17981: Closed socket on error in SysLogHandler. - -- Issue #18015: Fix unpickling of 2.7.3 and 2.7.4 namedtuples. - -- Issue #17754: Make ctypes.util.find_library() independent of the locale. - -- Fix typos in the multiprocessing module. - -- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X - with port None or "0" and flags AI_NUMERICSERV. - -- Issue #18080: When building a C extension module on OS X, if the compiler - is overridden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overridden. This restores - Distutils behavior introduced in 2.7.3 and inadvertently dropped in 2.7.4. - -- Issue #18071: C extension module builds on OS X could fail with TypeError - if the Xcode command line tools were not installed. - -- Issue #18113: Fixed a refcount leak in the curses.panel module's - set_userptr() method. Reported by Atsuo Ishimoto. - -- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an - existing directory caused mkstemp and related APIs to fail instead of - retrying. Report and fix by Vlad Shcherbina. - -- Issue #19400: Prevent extension module build failures with Xcode 5 on OS X - 10.8+ when using a universal Python that included a PPC architecture, - such as with a python.org 32-bit-only binary installer. - -Tools/Demos ------------ - -- Issue #18873: 2to3 and the findnocoding.py script now detect Python source - code encoding only in comment lines. - -- Issue #18817: Fix a resource warning in Lib/aifc.py demo. - -- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. - -- Issue #18448: Fix a typo in Demo/newmetaclasses/Eiffel.py. - -- Issue #12990: The "Python Launcher" on OSX could not launch python scripts - that have paths that include wide characters. - -Build ------ - -- Issue #16067: Add description into MSI file to replace installer's temporary name. - -- Issue #18256: Compilation fix for recent AIX releases. Patch by - David Edelsohn. - -- Issue #18098: The deprecated OS X Build Applet.app fails to build on - OS X 10.8 systems because the Apple-deprecated QuickDraw headers have - been removed from Xcode 4. Skip building it in this case. - -- Issue #1584: Provide options to override default search paths for - Tcl and Tk when building _tkinter. - -- Issue #15663: Tcl/Tk 8.5.15 is now included with the OS X 10.6+ - 64-bit/32-bit installer for 10.6+. It is no longer necessary - to install a third-party version of Tcl/Tk 8.5 to work around the - problems in the Apple-supplied Tcl/Tk 8.5 shipped in OS X 10.6 - and later releases. - -- Issue #19019: Change the OS X installer build script to use CFLAGS instead - of OPT for special build options. By setting OPT, some compiler-specific - options like -fwrapv were overridden and thus not used, which could result - in broken interpreters when building with clang. - -IDLE ----- - -- Issue #18873: IDLE now detects Python source code encoding only in comment - lines. - -- Issue #18988: The "Tab" key now works when a word is already autocompleted. - -- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. - -- Issue #18429: Format / Format Paragraph, now works when comment blocks - are selected. As with text blocks, this works best when the selection - only includes complete lines. - -- Issue #18226: Add docstrings and unittests for FormatParagraph.py. - Original patches by Todd Rovito and Phil Webster. - -- Issue #18279: Format - Strip trailing whitespace no longer marks a file as - changed when it has not been changed. This fix followed the addition of a - test file originally written by Phil Webster (the issue's main goal). - -- Issue #18539: Calltips now work for float default arguments. - -- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". - Patch by Tal Einat, Roget Serwy, and Todd Rovito. - -- Issue #8515: Set __file__ when run file in IDLE. - Initial patch by Bruce Frederiksen. - -- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. - -- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". - Original patch by Sarah K. - -- Issue #15392: Create a unittest framework for IDLE. - Preliminary patch by Rajagopalasarma Jayakrishnan - See Lib/idlelib/idle_test/README.txt for how to run Idle tests. - -- Issue #14146: Highlight source line while debugging on Windows. - -- Issue #17532: Always include Options menu for IDLE on OS X. - Patch by Guilherme Sim?es. - -Tests ------ - -- Issue #18919: Added tests for the sunau module. Unified and extended tests - for audio modules: aifc, sunau and wave. - -- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as - possible, since "localhost" goes through a DNS lookup under recent Windows - versions. - -- Issue #18357: add tests for dictview set difference. - Patch by Fraser Tweedale. - -- Issue #11185: Fix test_wait4 under AIX. Patch by S?bastien Sabl?. - -- Issue #18094: test_uuid no more reports skipped tests as passed. - -- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. - -Documentation -------------- - -- Issue #18758: Fixed and improved cross-references. - -- Issue #18718: datetime documentation contradictory on leap second support. - -- Issue #17701: Improving strftime documentation. - -- Issue #17844: Refactor a documentation of Python specific encodings. - Add links to encoders and decoders for binary-to-binary codecs. - - -What's New in Python 2.7.5? -=========================== - -*Release date: 2013-05-12* - -Core and Builtins ------------------ - -- Issue #15535: Fixed regression in the pickling of named tuples by - removing the __dict__ property introduced in 2.7.4. - -- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, - such as was shipped with Centos 5 and Mac OS X 10.4. - -- Issue #17703: Fix a regression where an illegal use of Py_DECREF() after - interpreter finalization can cause a crash. - -- Issue #16447: Fixed potential segmentation fault when setting __name__ on a - class. - -- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. - -Library -------- - -- Issue #17979: Fixed the re module in build with --disable-unicode. - -- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator - .characters() and ignorableWhitespace() methods. Original patch by Sebastian - Ortiz Vasquez. - -- Issue #16601: Restarting iteration over tarfile no more continues from where - it left off. Patch by Michael Birtwell. - -- Issue #16584: in filecomp._cmp, catch IOError as well as os.error. - Patch by Till Maas. - -- Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines. - -- Issue #19267: Fix support of multibyte encoding (ex: UTF-16) in the logging - module. - -- Issue #17918: When using SSLSocket.accept(), if the SSL handshake failed - on the new socket, the socket would linger indefinitely. Thanks to - Peter Saveliev for reporting. - -- Issue #17289: The readline module now plays nicer with external modules - or applications changing the rl_completer_word_break_characters global - variable. Initial patch by Bradley Froehle. - -- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit - platforms. Patch by Federico Schwindt. - -- Issue #14173: Avoid crashing when reading a signal handler during - interpreter shutdown. - -- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. - -- Issue #17192: Restore the patch for Issue #10309 which was ommitted - in 2.7.4 when updating the bundled version of libffi used by ctypes. - -- Issue #17843: Removed test data file that was triggering false-positive virus - warnings with certain antivirus software. - -- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures - -- Issue #11714: Use 'with' statements to assure a Semaphore releases a - condition variable. Original patch by Thomas Rachel. - -- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with - Unix domain sockets. - -- Issue #17555: Fix ForkAwareThreadLock so that size of after fork - registry does not grow exponentially with generation of process. - -- Issue #17710: Fix cPickle raising a SystemError on bogus input. - -- Issue #17341: Include the invalid name in the error messages from re about - invalid group names. - -- Issue #17016: Get rid of possible pointer wraparounds and integer overflows - in the re module. Patch by Nickolai Zeldovich. - -- Issue #17536: Add to webbrowser's browser list: xdg-open, gvfs-open, - www-browser, x-www-browser, chromium browsers, iceweasel, iceape. - -- Issue #17656: Fix extraction of zip files with unicode member paths. - -- Issue #17666: Fix reading gzip files with an extra field. - -- Issue #13150, #17512: sysconfig no longer parses the Makefile and config.h - files when imported, instead doing it at build time. This makes importing - sysconfig faster and reduces Python startup time by 20%. - -- Issue #13163: Rename operands in smtplib.SMTP._get_socket to correct names; - fixes otherwise misleading output in tracebacks and when when debug is on. - -- Issue #17526: fix an IndexError raised while passing code without filename to - inspect.findsource(). Initial patch by Tyler Doyle. - -Build ------ - -- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC - 4.8. - -- Issue #17682: Add the _io module to Modules/Setup.dist (commented out). - -- Issue #17086: Search the include and library directories provided by the - compiler. - -Tests ------ - -- Issue #17928: Fix test_structmembers on 64-bit big-endian machines. - -- Issue #17883: Fix buildbot testing of Tkinter on Windows. - Patch by Zachary Ware. - -- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. - Initial patch by Dino Viehland. - -- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. - -- Issue #17065: Use process-unique key for winreg tests to avoid failures if - test is run multiple times in parallel (eg: on a buildbot host). - -IDLE ----- - -- Issue #17838: Allow sys.stdin to be reassigned. - -- Issue #14735: Update IDLE docs to omit "Control-z on Windows". - -- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). - -- Issue #17657: Show full Tk version in IDLE's about dialog. - Patch by Todd Rovito. - -- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. - -- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. - -- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. - -- Issue #14254: IDLE now handles readline correctly across shell restarts. - -- Issue #17614: IDLE no longer raises exception when quickly closing a file. - -- Issue #6698: IDLE now opens just an editor window when configured to do so. - -- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - raises an exception. - -- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - -- Issue #17390: Display Python version on Idle title bar. - Initial patch by Edmond Burnett. - -Documentation -------------- - -- Issue #15940: Specify effect of locale on time functions. - -- Issue #6696: add documentation for the Profile objects, and improve - profile/cProfile docs. Patch by Tom Pinckney. - - -What's New in Python 2.7.4? -=========================== - -*Release date: 2013-04-06* - -Build ------ - -- Issue #17550: Fix the --enable-profiling configure switch. - -Core and Builtins ------------------ - -- Issue #15801 (again): With string % formatting, relax the type check for a - mapping such that any type with a __getitem__ can be used on the right hand - side. - -IDLE ----- - -- Issue #17625: In IDLE, close the replace dialog after it is used. - -Tests ------ - -- Issue #17835: Fix test_io when the default OS pipe buffer size is larger - than one million bytes. - -- Issue #17531: Fix tests that thought group and user ids were always the int - type. Also, always allow -1 as a valid group and user id. - -- Issue #17533: Fix test_xpickle with older versions of Python 2.5. - -Documentation -------------- - -- Issue #17538: Document XML vulnerabilties - - -What's New in Python 2.7.4 release candidate 1 -============================================== - -*Release date: 2013-03-23* - -Core and Builtins ------------------ - -- Issue #10211: Buffer objects expose the new buffer interface internally - -- Issue #16445: Fixed potential segmentation fault when deleting an exception - message. - -- Issue #17275: Corrected class name in init error messages of the C version of - BufferedWriter and BufferedRandom. - -- Issue #7963: Fixed misleading error message that issued when object is - called without arguments. - -- Issue #5308: Raise ValueError when marshalling too large object (a sequence - with size >= 2**31), instead of producing illegal marshal data. - -- Issue #17043: The unicode-internal decoder no longer read past the end of - input buffer. - -- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. - -- Issue #10156: In the interpreter's initialization phase, unicode globals - are now initialized dynamically as needed. - -- Issue #16975: Fix error handling bug in the escape-decode decoder. - -- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" - in any mapping, not only in a Unicode string. - -- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by - Amaury Forgeot d'Arc. - -- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. - -- Issue #15516: Fix a bug in PyString_FromFormat where it failed to properly - ignore errors from a __int__() method. - -- Issue #16839: Fix a segfault when calling unicode() on a classic class early - in interpreter initialization. - -- Issue #16761: Calling ``int()`` and ``long()`` with *base* argument only - now raises TypeError. - -- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py - when retrieving a REG_DWORD value. This corrects functions like - winreg.QueryValueEx that may have been returning truncated values. - -- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg - when passed a REG_DWORD value. Fixes ValueError in winreg.SetValueEx when - given a long. - -- Issue #13863: Work around buggy 'fstat' implementation on Windows / NTFS that - lead to incorrect timestamps (off by one hour) being stored in .pyc files on - some systems. - -- Issue #16602: When a weakref's target was part of a long deallocation - chain, the object could remain reachable through its weakref even though - its refcount had dropped to zero. - -- Issue #9011: Fix hacky AST code that modified the CST when compiling - a negated numeric literal. - -- Issue #16306: Fix multiple error messages when unknown command line - parameters where passed to the interpreter. Patch by Hieu Nguyen. - -- Issue #15379: Fix passing of non-BMP characters as integers for the charmap - decoder (already working as unicode strings). Patch by Serhiy Storchaka. - -- Issue #16453: Fix equality testing of dead weakref objects. - -- Issue #9535: Fix pending signals that have been received but not yet - handled by Python to not persist after os.fork() in the child process. - -- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor - Stinner. - -- Issue #5057: the peepholer no longer optimizes subscription on unicode - literals (e.g. u'foo'[0]) in order to produce compatible pyc files between - narrow and wide builds. - -- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now - raises an error. - -- Issue #14700: Fix buggy overflow checks for large width and precision - in string formatting operations. - -- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass - received a nonempty dict from the constructor. - -- Issue #6074: Ensure cached bytecode files can always be updated by the - user that created them, even when the source file is read-only. - -- Issue #14783: Improve int() and long() docstrings and switch docstrings for - unicode(), slice(), range(), and xrange() to use multi-line signatures. - -- Issue #16030: Fix overflow bug in computing the `repr` of an xrange object - with large start, step or length. - -- Issue #16029: Fix overflow bug occurring when pickling xranges with large - start, step or length. - -- Issue #16037: Limit httplib's _read_status() function to work around broken - HTTP servers and reduce memory usage. It's actually a backport of a Python - 3.2 fix. Thanks to Adrien Kunysz. - -- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread - -- Issue #13992: The trashcan mechanism is now thread-safe. This eliminates - sporadic crashes in multi-thread programs when several long deallocator - chains ran concurrently and involved subclasses of built-in container - types. - -- Issue #15801: Make sure mappings passed to '%' formatting are actually - subscriptable. - -- Issue #15604: Update uses of PyObject_IsTrue() to check for and handle - errors correctly. Patch by Serhiy Storchaka. - -- Issue #14579: Fix error handling bug in the utf-16 decoder. Patch by - Serhiy Storchaka. - -- Issue #15368: An issue that caused bytecode generation to be - non-deterministic when using randomized hashing (-R) has been fixed. - -- Issue #15897: zipimport.c doesn't check return value of fseek(). - Patch by Felipe Cruz. - -- Issue #16369: Global PyTypeObjects not initialized with PyType_Ready(...). - -- Issue #15033: Fix the exit status bug when modules invoked using -m switch, - return the proper failure return value (1). Patch contributed by Jeff Knupp. - -- Issue #12268: File readline, readlines and read() methods no longer lose - data when an underlying read system call is interrupted. IOError is no - longer raised due to a read system call returning EINTR from within these - methods. - -- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by - Philip Jenvey, tested by Mageia and Debian. - -- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later - on. Initial patch by SilentGhost and Jeff Ramnani. - -- Issue #10053: Don't close FDs when FileIO.__init__ fails. Loosely based on - the work by Hirokazu Yamamoto. - -- Issue #14775: Fix a potential quadratic dict build-up due to the garbage - collector repeatedly trying to untrack dicts. - -- Issue #14494: Fix __future__.py and its documentation to note that - absolute imports are the default behavior in 3.0 instead of 2.7. - Patch by Sven Marnach. - -- Issue #14761: Fix potential leak on an error case in the import machinery. - -- Issue #14699: Fix calling the classmethod descriptor directly. - -- Issue #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError - when repr() or str() is called on such an object. - -- Issue #14658: Fix binding a special method to a builtin implementation of a - special method with a different name. - -- Issue #14612: Fix jumping around with blocks by setting f_lineno. - -- Issue #13889: Check and (if necessary) set FPU control word before calling - any of the dtoa.c string <-> float conversion functions, on MSVC builds of - Python. This fixes issues when embedding Python in a Delphi app. - -- Issue #14505: Fix file descriptor leak when deallocating file objects - created with PyFile_FromString(). - -- Issue #14474: Save and restore exception state in thread.start_new_thread() - while writing error message if the thread leaves an unhandled exception. - -- Issue #13019: Fix potential reference leaks in bytearray.extend(). Patch - by Suman Saha. - -- Issue #14378: Fix compiling ast.ImportFrom nodes with a "__future__" string as - the module name that was not interned. - -- Issue #14331: Use significantly less stack space when importing modules by - allocating path buffers on the heap instead of the stack. - -- Issue #14334: Prevent in a segfault in type.__getattribute__ when it was not - passed strings. Also fix segfaults in the __getattribute__ and __setattr__ - methods of old-style classes. - -- Issue #14161: fix the __repr__ of file objects to escape the file name. - -- Issue #1469629: Allow cycles through an object's __dict__ slot to be - collected. (For example if ``x.__dict__ is x``). - -- Issue #13521: dict.setdefault() now does only one lookup for the given key, - making it "atomic" for many purposes. Patch by Filip Gruszczy?ski. - -- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) - now fills the ``os.environ`` variable correctly. - -- Issue #10538: When using the "s*" code with PyArg_ParseTuple() to fill a - Py_buffer structure with data from an object supporting only the old - PyBuffer interface, a reference to the source objects is now properly added - to the Py_buffer.obj member. - -Library -------- - -- Issue #12718: Fix interaction with winpdb overriding __import__ by setting - importer attribute on BaseConfigurator instance. - -- Issue #17521: Corrected non-enabling of logger following two calls to - fileConfig(). - -- Issue #17508: Corrected MemoryHandler configuration in dictConfig() where - the target handler wasn't configured first. - -- Issue #10212: cStringIO and struct.unpack support new buffer objects. - -- Issue #12098: multiprocessing on Windows now starts child processes - using the same sys.flags as the current process. Initial patch by - Sergey Mezentsev. - -- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. - -- Issue #9090: When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, - retry the select() loop instead of bailing out. This is because select() - can incorrectly report a socket as ready for reading (for example, if it - received some data with an invalid checksum). - -- Issue #1285086: Get rid of the refcounting hack and speed up urllib.unquote(). - -- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused - a failure while decoding empty object literals when object_pairs_hook was - specified. - -- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when - the list is being resized concurrently. - -- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - -- Issue #14720: sqlite3: Convert datetime microseconds correctly. - Patch by Lowe Thiderman. - -- Issue #17225: JSON decoder now counts columns in the first line starting - with 1, as in other lines. - -- Issue #7842: backported fix for py_compile.compile() syntax error handling. - -- Issue #13153: Tkinter functions now raise TclError instead of ValueError when - a unicode argument contains non-BMP character. - -- Issue #9669: Protect re against infinite loops on zero-width matching in - non-greedy repeat. Patch by Matthew Barnett. - -- Issue #13169: The maximal repetition number in a regular expression has been - increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on - 64-bit). - -- Issue #16743: Fix mmap overflow check on 32 bit Windows. - -- Issue #11311: StringIO.readline(0) now returns an empty string as all other - file-like objects. - -- Issue #16800: tempfile.gettempdir() no longer left temporary files when - the disk is full. Original patch by Amir Szekely. - -- Issue #13555: cPickle now supports files larger than 2 GiB. - -- Issue #17052: unittest discovery should use self.testLoader. - -- Issue #4591: Uid and gid values larger than 2**31 are supported now. - -- Issue #17141: random.vonmisesvariate() no more hangs for large kappas. - -- Issue #17149: Fix random.vonmisesvariate to always return results in - the range [0, 2*math.pi]. - -- Issue #1470548: XMLGenerator now works with UTF-16 and UTF-32 encodings. - -- Issue #6975: os.path.realpath() now correctly resolves multiple nested - symlinks on POSIX platforms. - -- Issue #7358: cStringIO.StringIO now supports writing to and reading from - a stream larger than 2 GiB on 64-bit systems. - -- Issue #10355: In SpooledTemporaryFile class mode and name properties and - xreadlines method now work for unrolled files. encoding and newlines - properties now removed as they have no sense and always produced - AttributeError. - -- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in - avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), - and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for - 32-bit samples. max() and rms() no more returns a negative result and - various other functions now work correctly with 32-bit sample -0x80000000. - -- Issue #17073: Fix some integer overflows in sqlite3 module. - -- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple - parses nested mutating sequence. - -- Issue #5289: Fix ctypes.util.find_library on Solaris. - -- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying - stream or a decoder produces data of an unexpected type (i.e. when - io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). - -- Issue #13994: Add compatibility alias in distutils.ccompiler for - distutils.sysconfig.customize_compiler. - -- Issue #15633: httplib.HTTPResponse is now mark closed when the server - sends less than the advertised Content-Length. - -- Issue #15881: Fixed atexit hook in multiprocessing. - -- Issue #14340: Upgrade the embedded expat library to version 2.1.0. - -- Issue #11159: SAX parser now supports unicode file names. - -- Issue #6972: The zipfile module no longer overwrites files outside of - its destination path when extracting malicious zip files. - -- Issue #17049: Localized calendar methods now return unicode if a locale - includes an encoding and the result string contains month or weekday (was - regression from Python 2.6). - -- Issue #4844: ZipFile now raises BadZipfile when opens a ZIP file with an - incomplete "End of Central Directory" record. Original patch by Guilherme - Polo and Alan McIntyre. - -- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is - set to a callable object. - -- Issue #17051: Fix a memory leak in os.path.isdir() on Windows. Patch by - Robert Xiao. - -- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() - if all other iterators were very advanced before. - -- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file - descriptor argument. - -- Issue #15861: tkinter now correctly works with lists and tuples containing - strings with whitespaces, backslashes or unbalanced braces. - -- Issue #10527: Use poll() instead of select() for multiprocessing pipes. - -- Issue #9720: zipfile now writes correct local headers for files larger than - 4 GiB. - -- Issue #13899: \A, \Z, and \B now correctly match the A, Z, and B literals - when used inside character classes (e.g. '[\A]'). Patch by Matthew Barnett. - -- Issue #16398: Optimize deque.rotate() so that it only moves pointers - and doesn't touch the underlying data with increfs and decrefs. - -- Issue #15109: Fix regression in sqlite3's iterdump method where it would - die with an encoding error if the database contained string values - containing non-ASCII. (Regression was introduced by fix for 9750). - -- Issue #15545: Fix regression in sqlite3's iterdump method where it was - failing if the connection used a row factory (such as sqlite3.Row) that - produced unsortable objects. (Regression was introduced by fix for 9750). - -- Issue #16828: Fix error incorrectly raised by bz2.compress(''). Patch by - Martin Packman. - -- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. - -- Issue #10527: make multiprocessing use poll() instead of select() if available. - -- Issue #16485: Now file descriptors are closed if file header patching failed - on closing an aifc file. - -- Issue #12065: connect_ex() on an SSL socket now returns the original errno - when the socket's timeout expires (it used to return None). - -- Issue #16713: Fix the parsing of tel url with params using urlparse module. - -- Issue #16443: Add docstrings to regular expression match objects. - Patch by Anton Kasyanov. - -- Issue #8853: Allow port to be of type long for socket.getaddrinfo(). - -- Issue #16597: In buffered and text IO, call close() on the underlying stream - if invoking flush() fails. - -- Issue #15701: Fix HTTPError info method call to return the headers information. - -- Issue #16646: ftplib.FTP.makeport() might lose socket error details. - (patch by Serhiy Storchaka) - -- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the - pattern contains a wildcard in the drive or UNC path. Patch by Serhiy - Storchaka. - -- Issue #16298: In HTTPResponse.read(), close the socket when there is no - Content-Length and the incoming stream is finished. Patch by Eran - Rundstein. - -- Issue #16248: Disable code execution from the user's home directory by - tkinter when the -E flag is passed to Python. Patch by Zachary Ware. - -- Issue #16628: Fix a memory leak in ctypes.resize(). - -- Issue #13614: Fix setup.py register failure with invalid rst in description. - Patch by Julien Courteau and Pierre Paul Lefebvre. - -- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. - Patch by Serhiy Storchaka. - -- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous - list() calls aren't added to filter(), map(), and zip() which are directly - passed enumerate(). - -- Issue #1160: Fix compiling large regular expressions on UCS2 builds. - Patch by Serhiy Storchaka. - -- Issue #14313: zipfile now raises NotImplementedError when the compression - type is unknown. - -- Issue #16408: Fix file descriptors not being closed in error conditions - in the zipfile module. Patch by Serhiy Storchaka. - -- Issue #16327: The subprocess module no longer leaks file descriptors - used for stdin/stdout/stderr pipes to the child when fork() fails. - -- Issue #14396: Handle the odd rare case of waitpid returning 0 when not - expected in subprocess.Popen.wait(). - -- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access - previously-freed memory. Patch by Serhiy Storchaka. - -- Issue #16350: zlib.decompressobj().decompress() now accumulates data from - successive calls after EOF in unused_data, instead of only saving the argument - to the last call. decompressobj().flush() now correctly sets unused_data and - unconsumed_tail. A bug in the handling of MemoryError when setting the - unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. - -- Issue #12759: sre_parse now raises a proper error when the name of the group - is missing. Initial patch by Serhiy Storchaka. - -- Issue #16152: fix tokenize to ignore whitespace at the end of the code when - no newline is found. Patch by Ned Batchelder. - -- Issue #16230: Fix a crash in select.select() when one of the lists changes - size while iterated on. Patch by Serhiy Storchaka. - -- Issue #16228: Fix a crash in the json module where a list changes size - while it is being encoded. Patch by Serhiy Storchaka. - -- Issue #14897: Enhance error messages of struct.pack and - struct.pack_into. Patch by Matti M?ki. - -- Issue #12890: cgitb no longer prints spurious

tags in text - mode when the logdir option is specified. - -- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. - -- Issue #5148: Ignore 'U' in mode given to gzip.open() and gzip.GzipFile(). - -- Issue #16220: wsgiref now always calls close() on an iterable response. - Patch by Brent Tubbs. - -- Issue #16461: Wave library should be able to deal with 4GB wav files, - and sample rate of 44100 Hz. - -- Issue #16176: Properly identify Windows 8 via platform.platform() - -- Issue #15756: subprocess.poll() now properly handles errno.ECHILD to - return a returncode of 0 when the child has already exited or cannot - be waited on. - -- Issue #12376: Pass on parameters in TextTestResult.__init__ super call - -- Issue #15222: Insert blank line after each message in mbox mailboxes - -- Issue #16013: Fix CSV Reader parsing issue with ending quote characters. - Patch by Serhiy Storchaka. - -- Issue #15421: fix an OverflowError in Calendar.itermonthdates() after - datetime.MAXYEAR. Patch by C?dric Krier. - -- Issue #15970: xml.etree.ElementTree now serializes correctly the empty HTML - elements 'meta' and 'param'. - -- Issue #15676: Now "mmap" check for empty files before doing the - offset check. Patch by Steven Willis. - -- Issue #15340: Fix importing the random module when /dev/urandom cannot - be opened. This was a regression caused by the hash randomization patch. - -- Issue #15841: The readable(), writable() and seekable() methods of - io.BytesIO and io.StringIO objects now raise ValueError when the object has - been closed. Patch by Alessandro Moura. - -- Issue #16112: platform.architecture does not correctly escape argument to - /usr/bin/file. Patch by David Benjamin. - -- Issue #12776,#11839: call argparse type function (specified by add_argument) - only once. Before, the type function was called twice in the case where the - default was specified and the argument was given as well. This was - especially problematic for the FileType type, as a default file would always - be opened, even if a file argument was specified on the command line. - -- Issue #15906: Fix a regression in argparse caused by the preceding change, - when action='append', type='str' and default=[]. - -- Issue #13370: Ensure that ctypes works on Mac OS X when Python is - compiled using the clang compiler - -- Issue #15544: Fix Decimal.__float__ to work with payload-carrying NaNs. - -- Issue #15199: Fix JavaScript's default MIME type to application/javascript. - Patch by Bohuslav Kabrda. - -- Issue #15477: In cmath and math modules, add workaround for platforms whose - system-supplied log1p function doesn't respect signs of zeros. - -- Issue #11062: Fix adding a message from file to Babyl mailbox. - -- Issue #15646: Prevent equivalent of a fork bomb when using - multiprocessing on Windows without the "if __name__ == '__main__'" - idiom. - -- Issue #15567: Fix NameError when running threading._test - -- Issue #15424: Add a __sizeof__ implementation for array objects. - Patch by Ludwig H?hne. - -- Issue #15538: Fix compilation of the getnameinfo() / getaddrinfo() - emulation code. Patch by Philipp Hagemeister. - -- Issue #12288: Consider '0' and '0.0' as valid initialvalue - for tkinter SimpleDialog. - -- Issue #15489: Add a __sizeof__ implementation for BytesIO objects. - Patch by Serhiy Storchaka. - -- Issue #15469: Add a __sizeof__ implementation for deque objects. - Patch by Serhiy Storchaka. - -- Issue #15487: Add a __sizeof__ implementation for buffered I/O objects. - Patch by Serhiy Storchaka. - -- Issue #15512: Add a __sizeof__ implementation for parser. - Patch by Serhiy Storchaka. - -- Issue #15402: An issue in the struct module that caused sys.getsizeof to - return incorrect results for struct.Struct instances has been fixed. - Initial patch by Serhiy Storchaka. - -- Issue #15232: when mangle_from is True, email.Generator now correctly mangles - lines that start with 'From ' that occur in a MIME preamble or epilog. - -- Issue #13922: argparse no longer incorrectly strips '--'s that appear - after the first one. - -- Issue #12353: argparse now correctly handles null argument values. - -- Issue #6493: An issue in ctypes on Windows that caused structure bitfields - of type ctypes.c_uint32 and width 32 to incorrectly be set has been fixed. - -- Issue #14635: telnetlib will use poll() rather than select() when possible - to avoid failing due to the select() file descriptor limit. - -- Issue #15247: FileIO now raises an error when given a file descriptor - pointing to a directory. - -- Issue #14591: Fix bug in Random.jumpahead that could produce an invalid - Mersenne Twister state on 64-bit machines. - -- Issue #5346: Preserve permissions of mbox, MMDF and Babyl mailbox - files on flush(). - -- Issue #15219: Fix a reference leak when hashlib.new() is called with - invalid parameters. - -- Issue #9559: If messages were only added, a new file is no longer - created and renamed over the old file when flush() is called on an - mbox, MMDF or Babyl mailbox. - -- Issue #14653: email.utils.mktime_tz() no longer relies on system - mktime() when timezone offest is supplied. - -- Issue #6056: Make multiprocessing use setblocking(True) on the - sockets it uses. Original patch by J Derek Wilson. - -- Issue #15101: Make pool finalizer avoid joining current thread. - -- Issue #15054: A bug in tokenize.tokenize that caused string literals - with 'b' and 'br' prefixes to be incorrectly tokenized has been fixed. - Patch by Serhiy Storchaka. - -- Issue #15036: Mailbox no longer throws an error if a flush is done - between operations when removing or changing multiple items in mbox, - MMDF, or Babyl mailboxes. - -- Issue #10133: Make multiprocessing deallocate buffer if socket read - fails. Patch by Hallvard B Furuseth. - -- Issue #13854: Make multiprocessing properly handle non-integer - non-string argument to SystemExit. - -- Issue #12157: Make pool.map() empty iterables correctly. Initial - patch by mouad. - -- Issue #14036: Add an additional check to validate that port in urlparse does - not go in illegal range and returns None. - -- Issue #14888: Fix misbehaviour of the _md5 module when called on data - larger than 2**32 bytes. - -- Issue #15908: Fix misbehaviour of the sha1 module when called on data - larger than 2**32 bytes. - -- Issue #15910: Fix misbehaviour of _md5 and sha1 modules when "updating" - on data larger than 2**32 bytes. - -- Issue #14875: Use float('inf') instead of float('1e66666') in the json module. - -- Issue #14572: Prevent build failures with pre-3.5.0 versions of - sqlite3, such as was shipped with Centos 5 and Mac OS X 10.4. - -- Issue #14426: Correct the Date format in Expires attribute of Set-Cookie - Header in Cookie.py. - -- Issue #14721: Send proper header, Content-length: 0 when the body is an empty - string ''. Initial Patch contributed by Arve Knudsen. - -- Issue #14072: Fix parsing of 'tel' URIs in urlparse by making the check for - ports stricter. - -- Issue #9374: Generic parsing of query and fragment portions of url for any - scheme. Supported both by RFC3986 and RFC2396. - -- Issue #14798: Fix the functions in pyclbr to raise an ImportError - when the first part of a dotted name is not a package. Patch by - Xavier de Gaye. - -- Issue #14832: fixed the order of the argument references in the error - message produced by unittest's assertItemsEqual. - -- Issue #14829: Fix bisect issues under 64-bit Windows. - -- Issue #14777: tkinter may return undecoded UTF-8 bytes as a string when - accessing the Tk clipboard. Modify clipboard_get() to first request type - UTF8_STRING when no specific type is requested in an X11 windowing - environment, falling back to the current default type STRING if that fails. - Original patch by Thomas Kluyver. - -- Issue #12541: Be lenient with quotes around Realm field with HTTP Basic - Authentation in urllib2. - -- Issue #14662: Prevent shutil failures on OS X when destination does not - support chflag operations. Patch by Hynek Schlawack. - -- Issue #14157: Fix time.strptime failing without a year on February 29th. - Patch by Hynek Schlawack. - -- Issue #14768: os.path.expanduser('~/a') doesn't work correctly when HOME is '/'. - -- Issue #13183: Fix pdb skipping frames after hitting a breakpoint and running - step. Patch by Xavier de Gaye. - -- Issue #14664: It is now possible to use @unittest.skip{If,Unless} on a - test class that doesn't inherit from TestCase (i.e. a mixin). - -- Issue #14160: TarFile.extractfile() failed to resolve symbolic links when - the links were not located in an archive subdirectory. - -- Issue #14638: pydoc now treats non-string __name__ values as if they - were missing, instead of raising an error. - -- Issue #13684: Fix httplib tunnel issue of infinite loops for certain sites - which send EOF without trailing \r\n. - -- Issue #14308: Fix an exception when a "dummy" thread is in the threading - module's active list after a fork(). - -- Issue #14538: HTMLParser can now parse correctly start tags that contain - a bare '/'. - -- Issue #14452: SysLogHandler no longer inserts a UTF-8 BOM into the message. - -- Issue #13496: Fix potential overflow in bisect.bisect algorithm when applied - to a collection of size > sys.maxsize / 2. - -- Issue #14399: zipfile now recognizes that the archive has been modified even - if only the comment is changed. As a consequence of this fix, ZipFile is now - a new style class. - -- Issue #7978: SocketServer now restarts the select() call when EINTR is - returned. This avoids crashing the server loop when a signal is received. - Patch by Jerzy Kozera. - -- Issue #10340: asyncore - properly handle EINVAL in dispatcher constructor on - OSX; avoid to call handle_connect in case of a disconnected socket which - was not meant to connect. - -- Issue #12757: Fix the skipping of doctests when python is run with -OO so - that it works in unittest's verbose mode as well as non-verbose mode. - -- Issue #13694: asynchronous connect in asyncore.dispatcher does not set addr - attribute. - -- Issue #10484: Fix the CGIHTTPServer's PATH_INFO handling problem. - -- Issue #11199: Fix the with urllib which hangs on particular ftp urls. - -- Issue #14252: Fix subprocess.Popen.terminate() to not raise an error under - Windows when the child process has already exited. - -- Issue #14195: An issue that caused weakref.WeakSet instances to incorrectly - return True for a WeakSet instance 'a' in both 'a < a' and 'a > a' has been - fixed. - -- Issue #14159: Fix the len() of weak sets to return a better approximation - when some objects are dead or dying. Moreover, the implementation is now - O(1) rather than O(n). - -- Issue #2945: Make the distutils upload command aware of bdist_rpm products. - -- Issue #6884: Fix long-standing bugs with MANIFEST.in parsing in distutils - on Windows. - -- Issue #16441: Avoid excessive memory usage working with large gzip - files using the gzip module. - -- Issue #15782: Prevent compile errors of OS X Carbon modules _Fm, _Qd, and - _Qdoffs when compiling with an SDK of 10.7 or later. The OS X APIs they - wrap have long been deprecated and have now been removed with 10.7. - These modules were already empty for 64-bit builds and have been removed - in Python 3. - -Extension Modules ------------------ - -- Issue #17477: Update the bsddb module to pybsddb 5.3.0, supporting - db-5.x, and dropping support for db-4.1 and db-4.2. - -- Issue #17192: Update the ctypes module's libffi to v3.0.13. This - specifically addresses a stack misalignment issue on x86 and issues on - some more recent platforms. - -- Issue #12268: The io module file object write methods no longer abort early - when a write system calls is interrupted (EINTR). - -- Fix the leak of a dict in the time module when used in an embedded - interpreter that is repeatedly initialized and shutdown and reinitialized. - -- Issue #12268: File readline, readlines and read or readall methods - no longer lose data when an underlying read system call is interrupted - within an io module object. IOError is no longer raised due to a read - system call returning EINTR from within these methods. - -- Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD() - method doesn't require an argument again. - -- Issue #13590: OS X Xcode 4 - improve support for universal extension modules - In particular, fix extension module build failures when trying to use - 32-bit-only installer Pythons on systems with Xcode 4 (currently - OS X 10.8, 10.7, and optionally 10.6). - * Backport 3.3.0 fixes to 2.7 branch (for release in 2.7.4) - * Since Xcode 4 removes ppc support, extension module builds now - check for ppc compiler support and by default remove ppc and - ppc64 archs when they are not available. - * Extension module builds now revert to using system installed - headers and libs (/usr and /System/Library) if the SDK used - to build the interpreter is not installed or has moved. - * Try to avoid building extension modules with deprecated - and problematic Apple llvm-gcc compiler. If original compiler - is not available, use clang instead by default. - -IDLE ----- - -- IDLE was displaying spurious SystemExit tracebacks when running scripts - that terminated by raising SystemExit (i.e. unittest and turtledemo). - -- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase - interface and support all mandatory methods and properties. - -- Issue #16829: IDLE printing no longer fails if there are spaces or other - special characters in the file path. - -- Issue #16819: IDLE method completion now correctly works for unicode literals. - -- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by - Roger Serwy. - -- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. - Patch by Todd Rovito. - -- Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog - ended with '\'. Patch by Roger Serwy. - -- Issue #9803: Don't close IDLE on saving if breakpoint is open. - Patch by Roger Serwy. - -- Issue #14958: Change IDLE systax highlighting to recognize all string and byte - literals currently supported in Python 2.7. - -- Issue #14962: Update text coloring in IDLE shell window after changing - options. Patch by Roger Serwy. - -- Issue #10997: Prevent a duplicate entry in IDLE's "Recent Files" menu. - -- Issue #12510: Attempting to get invalid tooltip no longer closes IDLE. - Original patch by Roger Serwy. - -- Issue #10365: File open dialog now works instead of crashing - even when parent window is closed. Patch by Roger Serwy. - -- Issue #14876: Use user-selected font for highlight configuration. - Patch by Roger Serwy. - -- Issue #14409: IDLE now properly executes commands in the Shell window - when it cannot read the normal config files on startup and - has to use the built-in default key bindings. - There was previously a bug in one of the defaults. - -- Issue #3573: IDLE hangs when passing invalid command line args - (directory(ies) instead of file(s)) (Patch by Guilherme Polo) - -- Issue #5219: Prevent event handler cascade in IDLE. - -- Issue #15318: Prevent writing to sys.stdin. - -- Issue #13532, #15319: Check that arguments to sys.stdout.write are strings. - -- Issue #10365: File open dialog now works instead of crashing even when - parent window is closed while dialog is open. - -- Issue #14018: Update checks for unstable system Tcl/Tk versions on OS X - to include versions shipped with OS X 10.7 and 10.8 in addition to 10.6. - -- Issue #15853: Prevent IDLE crash on OS X when opening Preferences menu - with certain versions of Tk 8.5. Initial patch by Kevin Walzer. - -Tests ------ - -- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for - localhost tests. - -- Issue #13447: Add a test file to host regression tests for bugs in the - scripts found in the Tools directory. - -- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. - Initial patch by Thomas Wouters. - -- Issue #17299: Add test coverage for cPickle with file objects and general IO - objects. Original patch by Aman Shah. - -- Issue #11963: remove human verification from test_parser and test_subprocess. - -- Issue #17249: convert a test in test_capi to use unittest and reap threads. - -- We now run both test_email.py and test_email_renamed.py when running the - test_email regression test. test_email_renamed contains some tests that - test_email does not. - -- Issue #17041: Fix testing when Python is configured with the - --without-doc-strings option. - -- Issue #15539: Added regression tests for Tools/scripts/pindent.py. - -- Issue #15324: Fix regrtest parsing of --fromfile and --randomize options. - -- Issue #16618: Add more regression tests for glob. - Patch by Serhiy Storchaka. - -- Issue #16664: Add regression tests for glob's behaviour concerning entries - starting with a ".". Patch by Sebastian Kreft. - -- Issue #15747: ZFS always returns EOPNOTSUPP when attempting to set the - UF_IMMUTABLE flag (via either chflags or lchflags); refactor affected - tests in test_posix.py to account for this. - -- Issue #16549: Add tests for json.tools. Initial patch by Berker Peksag - and Serhiy Storchaka. - -- Issue #16559: Add more tests for the json module, including some from the - official test suite at json.org. Patch by Serhiy Storchaka. - -- Issue #16274: Fix test_asyncore on Solaris. Patch by Giampaolo Rodola'. - -- Issue #15040: Close files in mailbox tests for PyPy compatibility. - Original patch by Matti Picus. - -- Issue #15802: Fix test logic in TestMaildir.test_create_tmp. Patch - by Serhiy Storchaka. - -- Issue #15765: Extend a previous fix to Solaris and OpenBSD for quirky - getcwd() behaviour (issue #9185) to NetBSD as well. - -- Issue #15615: Add some tests for the json module's handling of invalid - input data. Patch by Kushal Das. - -- Issue #15496: Add directory removal helpers for tests on Windows. - Patch by Jeremy Kloth. - -- Issue #15043: test_gdb is now skipped entirely if gdb security settings - block loading of the gdb hooks - -- Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing - a test failure in test_ssl. - -- Issue #16698: Skip posix test_getgroups when built with OS X - deployment target prior to 10.6. - -- Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4. - -Build ------ - -- Issue #17425: Build against openssl 0.9.8y on Windows. - -- Issue #16004: Add `make touch`. - -- Issue #5033: Fix building of the sqlite3 extension module when the - SQLite library version has "beta" in it. Patch by Andreas Pelme. - -- Issue #17228: Fix building without pymalloc. - -- Issue #17086: Backport the patches from the 3.3 branch to cross-build - the package. - -- Issue #3754: fix typo in pthread AC_CACHE_VAL. - -- Issue #17029: Let h2py search the multiarch system include directory. - -- Issue #16953: Fix socket module compilation on platforms with - HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. - -- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. - -- Issue #15923: fix a mistake in asdl_c.py that resulted in a TypeError after - 2801bf875a24 (see #15801). - -- Issue #11715: Fix multiarch detection without having Debian development - tools (dpkg-dev) installed. - -- Issue #15819: Make sure we can build Python out-of-tree from a readonly - source directory. (Somewhat related to Issue #9860.) - -- Issue #15822: Ensure 2to3 grammar pickles are properly installed. - -- Issue #15560: Fix building _sqlite3 extension on OS X with an SDK. - -- Issue #8847: Disable COMDAT folding in Windows PGO builds. - -- Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs. - -- Issue #16256: OS X installer now sets correct permissions for doc directory. - -- Issue #8767: Restore building with --disable-unicode. - Patch by Stefano Taschini. - -- Build against bzip2 1.0.6 and openssl 0.9.8x on Windows. - -- Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban. - -- Issue #14437: Fix building the _io module under Cygwin. - -- Issue #15587: Enable Tk high-resolution text rendering on Macs with - Retina displays. Applies to Tkinter apps, such as IDLE, on OS X - framework builds linked with Cocoa Tk 8.5. - -- Issue #17161: make install now also installs a python2 and python man page. - -- Issue #16848: python-config now returns proper --ldflags values for OS X - framework builds. - -Tools/Demos ------------ - -- Issue #17156: pygettext.py now correctly escapes non-ascii characters. - -- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now - pindent.py works with a "with" statement. pindent.py no longer produces - improper indentation. pindent.py now works with continued lines broken after - "class" or "def" keywords and with continuations at the start of line. - -- Issue #16476: Fix json.tool to avoid including trailing whitespace. - -- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. - Patch by Serhiy Storchaka. - -Documentation -------------- - -- Issue #15041: Update "see also" list in tkinter documentation. - -- Issue #17412: update 2.7 Doc/make.bat to also use sphinx-1.0.7. - -- Issue #17047: remove doubled words in docs and docstrings - reported by Serhiy Storchaka and Matthew Barnett. - -- Issue #16406: combine the pages for uploading and registering to PyPI. - -- Issue #16403: Document how distutils uses the maintainer field in - PKG-INFO. Patch by Jyrki Pulliainen. - -- Issue #16695: Document how glob handles filenames starting with a - dot. Initial patch by Jyrki Pulliainen. - -- Issue #8890: Stop advertising an insecure practice by replacing uses - of the /tmp directory with better alternatives in the documentation. - Patch by Geoff Wilson. - -- Issue #17203: add long option names to unittest discovery docs. - -- Issue #13094: add "Why do lambdas defined in a loop with different values - all return the same result?" programming FAQ. - -- Issue #14901: Update portions of the Windows FAQ. - Patch by Ashish Nitin Patil. - -- Issue #15990: Improve argument/parameter documentation. - -- Issue #16400: Update the description of which versions of a given package - PyPI displays. - -- Issue #15677: Document that zlib and gzip accept a compression level of 0 to - mean 'no compression'. Patch by Brian Brazil. - -- Issue #8040: added a version switcher to the documentation. Patch by - Yury Selivanov. - -- Issue #16115: Improve subprocess.Popen() documentation around args, shell, - and executable arguments. - -- Issue #15979: Improve timeit documentation. - -- Issue #16036: Improve documentation of built-in int()'s signature and - arguments. - -- Issue #15935: Clarification of argparse docs, re: add_argument() type and - default arguments. Patch contributed by Chris Jerdonek. - -- Issue #13769: Document the effect of ensure_ascii to the return type - of JSON decoding functions. - -- Issue #14880: Fix kwargs notation in csv.reader, .writer & .register_dialect. - Patch by Chris Rebert. - -- Issue #14674: Add a discussion of the json module's standard compliance. - Patch by Chris Rebert. - -- Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by - Daniel Ellis. - -- Issue #13557: Clarify effect of giving two different namespaces to exec or - execfile(). - -- Issue #14034: added the argparse tutorial. - -- Issue #15250: Document that filecmp.dircmp compares files shallowly. Patch - contributed by Chris Jerdonek. - -- Issue #15116: Remove references to appscript as it is no longer being - supported. - - -What's New in Python 2.7.3 release candidate 2? -=============================================== - -*Release date: 2012-03-17* - -Library -------- - -- Issue #14234: CVE-2012-0876: Randomize hashes of xml attributes in the hash - table internal to the pyexpat module's copy of the expat library to avoid a - denial of service due to hash collisions. Patch by David Malcolm with some - modifications by the expat project. - - -What's New in Python 2.7.3 release candidate 1? -=============================================== - -*Release date: 2012-02-23* - -Core and Builtins ------------------ - -- Issue #13020: Fix a reference leak when allocating a structsequence object - fails. Patch by Suman Saha. - -- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED - environment variable, to provide an opt-in way to protect against denial of - service attacks due to hash collisions within the dict and set types. Patch - by David Malcolm, based on work by Victor Stinner. - -- Issue #11235: Fix OverflowError when trying to import a source file whose - modification time doesn't fit in a 32-bit timestamp. - -- Issue #11638: Unicode strings in 'name' and 'version' no longer cause - UnicodeDecodeErrors. - -- Fix the fix for issue #12149: it was incorrect, although it had the side - effect of appearing to resolve the issue. Thanks to Mark Shannon for - noticing. - -- Issue #13546: Fixed an overflow issue that could crash the intepreter when - calling sys.setrecursionlimit((1<<31)-1). - -- Issue #13333: The UTF-7 decoder now accepts lone surrogates (the encoder - already accepts them). - -- Issue #10519: Avoid unnecessary recursive function calls in - setobject.c. - -- Issue #13268: Fix the assert statement when a tuple is passed as the message. - -- Issue #13018: Fix reference leaks in error paths in dictobject.c. - Patch by Suman Saha. - -- Issue #12604: VTRACE macro expanded to no-op in _sre.c to avoid compiler - warnings. Patch by Josh Triplett and Petri Lehtinen. - -- Issue #7833: Extension modules built using distutils on Windows will no - longer include a "manifest" to prevent them failing at import time in some - embedded situations. - -- Issue #13186: Fix __delitem__ on old-style instances when invoked through - PySequence_DelItem. - -- Issue #13156: Revert the patch for issue #10517 (reset TLS upon fork()), - which was only relevant for the native pthread TLS implementation. - -- Issue #7732: Fix a crash on importing a module if a directory has the same - name than a Python module (e.g. "__init__.py"): don't close the file twice. - -- Issue #12973: Fix overflow checks that invoked undefined behaviour in - int.__pow__. These overflow checks were causing int.__pow__ to produce - incorrect results with recent versions of Clang, as a result of the - compiler optimizing the check away. Also fix similar overflow checks - in list_repeat (listobject.c) and islice_next (itertoolsmodule.c). These - bugs caused test failures with recent versions of Clang. - -- Issue #12266: Fix str.capitalize() to correctly uppercase/lowercase - titlecased and cased non-letter characters. - -- Issues #12610 and #12609: Verify that user generated AST has correct string - and identifier types before compiling. - -- Issue #11627: Fix segfault when __new__ on an exception returns a - non-exception class. - -- Issue #12149: Update the method cache after a type's dictionnary gets - cleared by the garbage collector. This fixes a segfault when an instance - and its type get caught in a reference cycle, and the instance's - deallocator calls one of the methods on the type (e.g. when subclassing - IOBase). Diagnosis and patch by Davide Rizzo. - -- Issue #12501: Remove Py3k warning for callable. callable() is supported - again in Python 3.2. - -- Issue #9611, #9015: FileIO.read(), FileIO.readinto(), FileIO.write() and - os.write() clamp the length to INT_MAX on Windows. - -- Issue #1195: my_fgets() now always clears errors before calling fgets(). Fix - the following case: sys.stdin.read() stopped with CTRL+d (end of file), - raw_input() interrupted by CTRL+c. - -- Issue #10860: httplib now correctly handles an empty port after port - delimiter in URLs. - -- dict_proxy objects now display their contents rather than just the class - name. - -Library -------- - -- Issue #8033: sqlite3: Fix 64-bit integer handling in user functions - on 32-bit architectures. Initial patch by Philippe Devalkeneer. - -- HTMLParser is now able to handle slashes in the start tag. - -- Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in - SimpleXMLRPCServer upon malformed POST request. - -- Issue #2489: pty.spawn could consume 100% cpu when it encountered an EOF. - -- Issue #13014: Fix a possible reference leak in SSLSocket.getpeercert(). - -- Issue #13987: HTMLParser is now able to handle EOFs in the middle of a - construct and malformed start tags. - -- Issue #13015: Fix a possible reference leak in defaultdict.__repr__. - Patch by Suman Saha. - -- Issue #13979: A bug in ctypes.util.find_library that caused - the wrong library name to be returned has been fixed. - -- Issue #1326113: distutils' build_ext command --libraries option now - correctly parses multiple values separated by whitespace or commas. - -- Issue #13993: HTMLParser is now able to handle broken end tags. - -- Issue #13960: HTMLParser is now able to handle broken comments. - -- Issue #9750: Fix sqlite3.Connection.iterdump on tables and fields - with a name that is a keyword or contains quotes. Patch by Marko - Kohtala. - -- Issue #13994: Earlier partial revert of Distutils enhancements in 2.7 - has left two versions of customize_compiler, the original in - distutils.sysconfig and another copy in distutils.ccompiler, with some - parts of distutils calling one and others using the other. - Complete the revert back to only having one in distutils.sysconfig as - is the case in 3.x. - -- Issue #13590: On OS X 10.7 and 10.6 with Xcode 4.2, building - Distutils-based packages with C extension modules may fail because - Apple has removed gcc-4.2, the version used to build python.org - 64-bit/32-bit Pythons. If the user does not explicitly override - the default C compiler by setting the CC environment variable, - Distutils will now attempt to compile extension modules with clang - if gcc-4.2 is required but not found. Also as a convenience, if - the user does explicitly set CC, substitute its value as the default - compiler in the Distutils LDSHARED configuration variable for OS X. - (Note, the python.org 32-bit-only Pythons use gcc-4.0 and the 10.4u - SDK, neither of which are available in Xcode 4. This change does not - attempt to override settings to support their use with Xcode 4.) - -- Issue #9021: Add an introduction to the copy module documentation. - -- Issue #6005: Examples in the socket library documentation use sendall, where - relevant, instead send method. - -- Issue #10811: Fix recursive usage of cursors. Instead of crashing, - raise a ProgrammingError now. - -- Issue #13676: Handle strings with embedded zeros correctly in sqlite3. - -- Issue #13806: The size check in audioop decompression functions was too - strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. - -- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC - IV attack countermeasure. - -- Issue #6631: Disallow relative file paths in urllib urlopen methods. - -- Issue #13781: Prevent gzip.GzipFile from using the dummy filename provided by - file objects opened with os.fdopen(). - -- Issue #13589: Fix some serialization primitives in the aifc module. - Patch by Oleg Plakhotnyuk. - -- Issue #13803: Under Solaris, distutils doesn't include bitness - in the directory name. - -- Issue #13642: Unquote before b64encoding user:password during Basic - Authentication. Patch contributed by Joonas Kuorilehto and Michele Orr?. - -- Issue #13636: Weak ciphers are now disabled by default in the ssl module - (except when SSLv2 is explicitly asked for). - -- Issue #12798: Updated the mimetypes documentation. - -- Issue #13639: Accept unicode filenames in tarfile.open(mode="w|gz"). - -- Issue #1785: Fix inspect and pydoc with misbehaving descriptors. - -- Issue #7502: Fix equality comparison for DocTestCase instances. Patch by - C?dric Krier. - -- Issue #11870: threading: Properly reinitialize threads internal locks and - condition variables to avoid deadlocks in child processes. - -- Issue #8035: urllib: Fix a bug where the client could remain stuck after a - redirection or an error. - -- tarfile.py: Correctly detect bzip2 compressed streams with blocksizes - other than 900k. - -- Issue #13573: The csv.writer now uses the repr() for floats rather than str(). - This allows floats to round-trip without loss of precision. - -- Issue #13439: Fix many errors in turtle docstrings. - -- Issue #12856: Ensure child processes do not inherit the parent's random - seed for filename generation in the tempfile module. Patch by Brian - Harring. - -- Issue #13458: Fix a memory leak in the ssl module when decoding a - certificate with a subjectAltName. Patch by Robert Xiao. - -- Issue #13415: os.unsetenv() doesn't ignore errors anymore. - -- Issue #13322: Fix BufferedWriter.write() to ensure that BlockingIOError is - raised when the wrapped raw file is non-blocking and the write would block. - Previous code assumed that the raw write() would raise BlockingIOError, but - RawIOBase.write() is defined to returned None when the call would block. - Patch by sbt. - -- Issue #13358: HTMLParser now calls handle_data only once for each CDATA. - -- Issue #4147: minidom's toprettyxml no longer adds whitespace around a text - node when it is the only child of an element. Initial patch by Dan - Kenigsberg. - -- Issues #1745761, #755670, #13357, #12629, #1200313: HTMLParser now correctly - handles non-valid attributes, including adjacent and unquoted attributes. - -- Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely - when called with a timeout. Patch by Arnaud Ysmal. - -- Issue #3067: Enhance the documentation and docstring of - locale.setlocale(). - -- Issue #13254: Fix Maildir initialization so that maildir contents - are read correctly. - -- Issue #13140: Fix the daemon_threads attribute of ThreadingMixIn. - -- Issue #2892: preserve iterparse events in case of SyntaxError. - -- Issue #670664: Fix HTMLParser to correctly handle the content of - ```` and ````. - -- Issue #10817: Fix urlretrieve function to raise ContentTooShortError even - when reporthook is None. Patch by Jyrki Pulliainen. - -- Issue #7334: close source files on ElementTree.parse and iterparse. - -- Issue #13232: logging: Improved logging of exceptions in the presence of - multiple encodings. - -- Issue #10332: multiprocessing: fix a race condition when a Pool is closed - before all tasks have completed. - -- Issue #1548891: The cStringIO.StringIO() constructor now encodes unicode - arguments with the system default encoding just like the write() method - does, instead of converting it to a raw buffer. This also fixes handling of - unicode input in the shlex module (#6988, #1170). - -- Issue #9168: now smtpd is able to bind privileged port. - -- Issue #12529: fix cgi.parse_header issue on strings with double-quotes and - semicolons together. Patch by Ben Darnell and Petri Lehtinen. - -- Issue #6090: zipfile raises a ValueError when a document with a timestamp - earlier than 1980 is provided. Patch contributed by Petri Lehtinen. - -- Issue #13194: zlib.compressobj().copy() and zlib.decompressobj().copy() are - now available on Windows. - -- Issue #13114: Fix the distutils commands check and register when the - long description is a Unicode string with non-ASCII characters. - -- Issue #7367: Fix pkgutil.walk_paths to skip directories whose - contents cannot be read. - -- Issue #7425: Prevent pydoc -k failures due to module import errors. - (Backport to 2.7 of existing 3.x fix) - -- Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale. - Reported and diagnosed by Thomas Kluyver. - -- Issue #7689: Allow pickling of dynamically created classes when their - metaclass is registered with copy_reg. Patch by Nicolas M. Thi?ry and - Craig Citro. - -- Issue #13058: ossaudiodev: fix a file descriptor leak on error. Patch by - Thomas Jarosch. - -- Issue #12931: xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of - failing with a UnicodeDecodeError. - -- Issue #8933: distutils' PKG-INFO files will now correctly report - Metadata-Version: 1.1 instead of 1.0 if a Classifier or Download-URL field is - present. - -- Issue #8286: The distutils command sdist will print a warning message instead - of crashing when an invalid path is given in the manifest template. - -- Issue #12841: tarfile unnecessarily checked the existence of numerical user - and group ids on extraction. If one of them did not exist the respective id - of the current user (i.e. root) was used for the file and ownership - information was lost. - -- Issue #10946: The distutils commands bdist_dumb, bdist_wininst and bdist_msi - now respect a --skip-build option given to bdist. - -- Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is - greater than FD_SETSIZE. - -- Issue #12839: Fix crash in zlib module due to version mismatch. - Fix by Richard M. Tew. - -- Issue #12786: Set communication pipes used by subprocess.Popen CLOEXEC to - avoid them being inherited by other subprocesses. - -- Issue #4106: Fix occasional exceptions printed out by multiprocessing on - interpreter shutdown. - -- Issue #11657: Fix sending file descriptors over 255 over a multiprocessing - Pipe. - -- Issue #12213: Fix a buffering bug with interleaved reads and writes that - could appear on io.BufferedRandom streams. - -- Issue #12326: sys.platform is now always 'linux2' on Linux, even if Python - is compiled on Linux 3. - -- Issue #13007: whichdb should recognize gdbm 1.9 magic numbers. - -- Issue #9173: Let shutil._make_archive work if the logger argument is None. - -- Issue #12650: Fix a race condition where a subprocess.Popen could leak - resources (FD/zombie) when killed at the wrong time. - -- Issue #12752: Fix regression which prevented locale.normalize() from - accepting unicode strings. - -- Issue #12683: urlparse updated to include svn as schemes that uses relative - paths. (svn from 1.5 onwards support relative path). - -- Issue #11933: Fix incorrect mtime comparison in distutils. - -- Issues #11104, #8688: Fix the behavior of distutils' sdist command with - manually-maintained MANIFEST files. - -- Issue #8887: "pydoc somebuiltin.somemethod" (or help('somebuiltin.somemethod') - in Python code) now finds the doc of the method. - -- Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime. - -- Issue #12514: Use try/finally to assure the timeit module restores garbage - collections when it is done. - -- Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is - given as a low fd, it gets overwritten. - -- Issue #12102: Document that buffered files must be flushed before being used - with mmap. Patch by Steffen Daode Nurpmeso. - -- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling. - -- Issue #1813: Fix codec lookup and setting/getting locales under Turkish - locales. - -- Issue #10883: Fix socket leaks in urllib when using FTP. - -- Issue #12592: Make Python build on OpenBSD 5 (and future major releases). - -- Issue #12372: POSIX semaphores are broken on AIX: don't use them. - -- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2 - directory, so that "import DLFCN" and other similar imports work on - Linux 3.0. - -- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN - commands; they aren't required and in fact postfix doesn't support that form. - -- Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by - Andreas St?hrk. - -- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets. - -- Issue #4376: ctypes now supports nested structures in an endian different than - the parent structure. Patch by Vlad Riscutia. - -- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors - if the process has only one pipe. - -- Issue #12467: warnings: fix a race condition if a warning is emitted at - shutdown, if globals()['__file__'] is None. - -- Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by - the garbage collector while the Heap lock is held. - -- Issue #9516: On Mac OS X, change Distutils to no longer globally attempt to - check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the - interpreter process. This could cause failures in non-Distutils subprocesses - and was unreliable since tests or user programs could modify the interpreter - environment after Distutils set it. Instead, have Distutils set the - deployment target only in the environment of each build subprocess. It is - still possible to globally override the default by setting - MACOSX_DEPLOYMENT_TARGET before launching the interpreter; its value must be - greater or equal to the default value, the value with which the interpreter - was built. - -- Issue #11802: The cache in filecmp now has a maximum size of 100 so that - it won't grow without bound. - -- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira - Kitada. - -- Issue #11700: mailbox proxy object close methods can now be called multiple - times without error, and _ProxyFile now closes the wrapped file. - -- Issue #12133: AbstractHTTPHandler.do_open() of urllib.request closes the HTTP - connection if its getresponse() method fails with a socket error. Patch - written by Ezio Melotti. - -- Issue #9284: Allow inspect.findsource() to find the source of doctest - functions. - -- Issue #10694: zipfile now ignores garbage at the end of a zipfile. - -- Issue #11583: Speed up os.path.isdir on Windows by using GetFileAttributes - instead of os.stat. - -- Issue #12080: Fix a performance issue in Decimal._power_exact that caused - some corner-case Decimal.__pow__ calls to take an unreasonably long time. - -- Named tuples now work correctly with vars(). - -- sys.setcheckinterval() now updates the current ticker count as well as - updating the check interval, so if the user decreases the check interval, - the ticker doesn't have to wind down to zero from the old starting point - before the new interval takes effect. And if the user increases the - interval, it makes sure the new limit takes effect right away rather have an - early task switch before recognizing the new interval. - -- Issue #12085: Fix an attribute error in subprocess.Popen destructor if the - constructor has failed, e.g. because of an undeclared keyword argument. Patch - written by Oleg Oshmyan. - -Extension Modules ------------------ - -- Issue #9041: An issue in ctypes.c_longdouble, ctypes.c_double, and - ctypes.c_float that caused an incorrect exception to be returned in the - case of overflow has been fixed. - -- bsddb module: Erratic behaviour of "DBEnv->rep_elect()" because a typo. - Possible crash. - -- Issue #13774: json: Fix a SystemError when a bogus encoding is passed to - json.loads(). - -- Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by - Vilmos Nebehaj. - -- Issue #13159: FileIO, BZ2File, and the built-in file class now use a - linear-time buffer growth strategy instead of a quadratic one. - -- Issue #13070: Fix a crash when a TextIOWrapper caught in a reference cycle - would be finalized after the reference to its underlying BufferedRWPair's - writer got cleared by the GC. - -- Issue #12881: ctypes: Fix segfault with large structure field names. - -- Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. - Thanks to Suman Saha for finding the bug and providing a patch. - -- Issue #13022: Fix: _multiprocessing.recvfd() doesn't check that - file descriptor was actually received. - -- Issue #12483: ctypes: Fix a crash when the destruction of a callback - object triggers the garbage collector. - -- Issue #12950: Fix passing file descriptors in multiprocessing, under - OpenIndiana/Illumos. - -- Issue #12764: Fix a crash in ctypes when the name of a Structure field is not - a string. - -- Issue #9651: Fix a crash when ctypes.create_string_buffer(0) was passed to - some functions like file.write(). - -- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper - signature. Without this, architectures where sizeof void* != sizeof int are - broken. Patch given by Hallvard B Furuseth. - -IDLE ----- - -- Issue #964437: Make IDLE help window non-modal. - Patch by Guilherme Polo and Roger Serwy. - -- Issue #13933: IDLE auto-complete did not work with some imported - module, like hashlib. (Patch by Roger Serwy) - -- Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. - Original patches by Marco Scataglini and Roger Serwy. - -- Issue #4625: If IDLE cannot write to its recent file or breakpoint - files, display a message popup and continue rather than crash. - (original patch by Roger Serwy) - -- Issue #8793: Prevent IDLE crash when given strings with invalid hex escape - sequences. - -- Issue #13296: Fix IDLE to clear compile __future__ flags on shell restart. - (Patch by Roger Serwy) - -- Issue #14409: IDLE now properly executes commands in the Shell window - when it cannot read the normal config files on startup and - has to use the built-in default key bindings. - There was previously a bug in one of the defaults. - -- Issue #3573: IDLE hangs when passing invalid command line args - (directory(ies) instead of file(s)). - -Build ------ - -- Issue #6807: Run msisupport.mak earlier. - -- Issue #10580: Minor grammar change in Windows installer. - -- Issue #12627: Implement PEP 394 for Python 2.7 ("python2"). - -- Issue #8746: Correct faulty configure checks so that os.chflags() and - os.lchflags() are once again built on systems that support these - functions (*BSD and OS X). Also add new stat file flags for OS X - (UF_HIDDEN and UF_COMPRESSED). - -Tools/Demos ------------ - -- Issue #14053: patchcheck.py ("make patchcheck") now works with MQ patches. - Patch by Francisco Mart?n Brugu?. - -- Issue #13930: 2to3 is now able to write its converted output files to another - directory tree as well as copying unchanged files and altering the file - suffix. See its new -o, -W and --add-suffix options. This makes it more - useful in many automated code translation workflows. - -- Issue #10639: reindent.py no longer converts newlines and will raise - an error if attempting to convert a file with mixed newlines. - -- Issue #13628: python-gdb.py is now able to retrieve more frames in the Python - traceback if Python is optimized. - -Tests ------ - -- Issue #15467: Move helpers for __sizeof__ tests into test_support. - Patch by Serhiy Storchaka. - -- Issue #11689: Fix a variable scoping error in an sqlite3 test. - Initial patch by Torsten Landschoff. - -- Issue #10881: Fix test_site failures with OS X framework builds. - -- Issue #13901: Prevent test_distutils failures on OS X with --enable-shared. - -- Issue #13304: Skip test case if user site-packages disabled (-s or - PYTHONNOUSERSITE). (Patch by Carl Meyer) - -- Issue #13218: Fix test_ssl failures on Debian/Ubuntu. - -- Issue #12821: Fix test_fcntl failures on OpenBSD 5. - -- Issue #12331: The test suite for lib2to3 can now run from an installed - Python. - -- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64' - as the processor type on some Mac systems. - -- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary - failure in name resolution. - -- Issue #11812: Solve transient socket failure to connect to 'localhost' - in test_telnetlib.py. - -- Solved a potential deadlock in test_telnetlib.py. Related to issue #11812. - -- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and - an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder - Web site. - -- Avoid failing in test_urllibnet.test_bad_address when some overzealous - DNS service (e.g. OpenDNS) resolves a non-existent domain name. The test - is now skipped instead. - -- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run - test_tk or test_ttk_guionly under a username that is not currently logged - in to the console windowserver (as may be the case under buildbot or ssh). - -- Issue #12141: Install a copy of template C module file so that - test_build_ext of test_distutils is no longer silently skipped when - run outside of a build directory. - -- Issue #8746: Add additional tests for os.chflags() and os.lchflags(). - Patch by Garrett Cooper. - -- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 - on Mac OS X. (Patch by Ronald Oussoren) - -- Issue #12057: Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2, - iso2022_kr). - -Documentation -------------- - -- Issues #13491 and #13995: Fix many errors in sqlite3 documentation. - Initial patch for #13491 by Johannes Vogel. - -- Issue #13402: Document absoluteness of sys.executable. - -- Issue #13883: PYTHONCASEOK also works on OS X, OS/2, and RiscOS. - -- Issue #2134: The tokenize documentation has been clarified to explain why - all operator and delimiter tokens are treated as token.OP tokens. - -- Issue #13513: Fix io.IOBase documentation to correctly link to the - io.IOBase.readline method instead of the readline module. - -- Issue #13237: Reorganise subprocess documentation to emphasise convenience - functions and the most commonly needed arguments to Popen. - -- Issue #13141: Demonstrate recommended style for SocketServer examples. - - -What's New in Python 2.7.2? -=========================== - -*Release date: 2011-06-11* - -Library -------- - -- Issue #12009: Fixed regression in netrc file comment handling. - -Extension Modules ------------------ - -- Issue #1221: Make pyexpat.__version__ equal to the Python version. - - -What's New in Python 2.7.2 release candidate 1? -=============================================== - -*Release date: 2011-05-29* - -Core and Builtins ------------------ - -- Issue #9670: Increase the default stack size for secondary threads on - Mac OS X and FreeBSD to reduce the chances of a crash instead of a - "maximum recursion depth" RuntimeError exception. - (patch by Ronald Oussoren) - -- Correct lookup of __dir__ on objects. This allows old-style classes to have - __dir__. It also causes errors besides AttributeError found on lookup to be - propagated. - -- Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c, - clear the end-of-file indicator after CTRL+d. - -- Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file - doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int - (length bigger than 2^31-1 bytes). - -- Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was not - written if PY_SSIZE_T_CLEAN is defined. - -- Issue #9756: When calling a method descriptor or a slot wrapper descriptor, - the check of the object type doesn't read the __class__ attribute anymore. - Fix a crash if a class override its __class__ attribute (e.g. a proxy of the - str type). Patch written by Andreas St?hrk. - -- Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_* - APIs, to avoid a crash with the pthread implementation in RHEL 5. Patch - by Charles-Fran?ois Natali. - -- Issue #6780: fix starts/endswith error message to mention that tuples are - accepted too. - -- Issue #5057: fix a bug in the peepholer that led to non-portable pyc files - between narrow and wide builds while optimizing BINARY_SUBSCR on non-BMP - chars (e.g. u"\U00012345"[0]). - -- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted - (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch - written by Charles-Francois Natali. - -- Issue #11144: Ensure that int(a_float) returns an int whenever possible. - Previously, there were some corner cases where a long was returned even - though the result was within the range of an int. - -- Issue #11450: Don't truncate hg version info in Py_GetBuildInfo() when - there are many tags (e.g. when using mq). Patch by Nadeem Vawda. - -- Issue #10451: memoryview objects could allow mutating a readable buffer. - Initial patch by Ross Lagerwall. - -- Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a - class. - -- Issue #8020: Avoid a crash where the small objects allocator would read - non-Python managed memory while it is being modified by another thread. - Patch by Matt Bandy. - -- Issue #11004: Repaired edge case in deque.count(). - -- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime() - can now handle dates after 2038. - -- Issue #4236: Py_InitModule4 now checks the import machinery directly - rather than the Py_IsInitialized flag, avoiding a Fatal Python - error in certain circumstances when an import is done in __del__. - -- Issue #11828: startswith and endswith don't accept None as slice index. - Patch by Torsten Becker. - -- Issue #10674: Remove unused 'dictmaker' rule from grammar. - -- Issue #10596: Fix float.__mod__ to have the same behaviour as - float.__divmod__ with respect to signed zeros. -4.0 % 4.0 should be - 0.0, not -0.0. - -- Issue #11386: bytearray.pop() now throws IndexError when the bytearray is - empty, instead of OverflowError. - -Library -------- - -- Issue #12161: Cause StringIO.getvalue() to raise a ValueError when used on a - closed StringIO instance. - -- Issue #12182: Fix pydoc.HTMLDoc.multicolumn() if Python uses the new (true) - division (python -Qnew). Patch written by Ralf W. Grosse-Kunstleve. - -- Issue #12175: RawIOBase.readall() now returns None if read() returns None. - -- Issue #12175: FileIO.readall() now raises a ValueError instead of an IOError - if the file is closed. - -- Issue #1441530: In imaplib, use makefile() to wrap the SSL socket to avoid - heap fragmentation and MemoryError with some malloc implementations. - -- Issue #12100: Don't reset incremental encoders of CJK codecs at each call to - their encode() method anymore, but continue to call the reset() method if the - final argument is True. - -- Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore - to be able to unload the module. - -- Issue #10154, #10090: change the normalization of UTF-8 to "UTF-8" instead - of "UTF8" in the locale module as the latter is not supported MacOSX and OpenBSD. - -- Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is - set in shell. - -- Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail - attribute when called without a max_length argument. - -- Issue #12062: In the `io` module, fix a flushing bug when doing a certain - type of I/O sequence on a file opened in read+write mode (namely: reading, - seeking a bit forward, writing, then seeking before the previous write but - still within buffered data, and writing again). - -- Issue #8498: In socket.accept(), allow specifying 0 as a backlog value in - order to accept exactly one connection. Patch by Daniel Evers. - -- Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional. - -- Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch - by Kasun Herath. - -- Issue #11999: fixed sporadic sync failure mailbox.Maildir due to its trying to - detect mtime changes by comparing to the system clock instead of to the - previous value of the mtime. - -- Issue #10684: shutil.move used to delete a folder on case insensitive - filesystems when the source and destination name where the same except - for the case. - -- Issue #11982: fix json.loads('""') to return u'' rather than ''. - -- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get - around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso. - -- Issue #10761: Fix tarfile.extractall failure when symlinked files are - present. Initial patch by Scott Leerssen. - -- Issue #11763: don't use difflib in TestCase.assertMultiLineEqual if the - strings are too long. - -- Issue #11236: getpass.getpass responds to ctrl-c or ctrl-z on terminal. - -- Issue #11768: The signal handler of the signal module only calls - Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or - parallel calls. PyErr_SetInterrupt() writes also into the wake up file. - -- Issue #11875: collections.OrderedDict's __reduce__ was temporarily - mutating the object instead of just working on a copy. - -- Issue #11442: Add a charset parameter to the Content-type in SimpleHTTPServer - to avoid XSS attacks. - -- Issue #11467: Fix urlparse behavior when handling urls which contains scheme - specific part only digits. Patch by Santoso Wijaya. - -- collections.Counter().copy() now works correctly for subclasses. - -- Issue #11474: Fix the bug with url2pathname() handling of '/C|/' on Windows. - Patch by Santoso Wijaya. - -- Issue #9233: Fix json.loads('{}') to return a dict (instead of a list), when - _json is not available. - -- Issue #11703: urllib2.geturl() does not return correct url when the original - url contains #fragment. - -- Issue #10019: Fixed regression in json module where an indent of 0 stopped - adding newlines and acted instead like 'None'. - -- Issue #5162: Treat services like frozen executables to allow child spawning - from multiprocessing.forking on Windows. - -- Issue #4877: Fix a segfault in xml.parsers.expat while attempting to parse - a closed file. - -- Issue #11830: Remove unnecessary introspection code in the decimal module. - It was causing a failed import in the Turkish locale where the locale - sensitive str.upper() method caused a name mismatch. - -- Issue #8428: Fix a race condition in multiprocessing.Pool when terminating - worker processes: new processes would be spawned while the pool is being - shut down. Patch by Charles-Fran?ois Natali. - -- Issue #7311: Fix HTMLParser to accept non-ASCII attribute values. - -- Issue #10963: Ensure that subprocess.communicate() never raises EPIPE. - -- Issue #11662: Make urllib and urllib2 ignore redirections if the - scheme is not HTTP, HTTPS or FTP (CVE-2011-1521). - -- Issue #11256: Fix inspect.getcallargs on functions that take only keyword - arguments. - -- Issue #11696: Fix ID generation in msilib. - -- Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when - trying to pack a negative (in-range) integer. - -- Issue #11675: multiprocessing.[Raw]Array objects created from an integer size - are now zeroed on creation. This matches the behaviour specified by the - documentation. - -- Issue #7639: Fix short file name generation in bdist_msi. - -- Issue #11666: let help() display named tuple attributes and methods - that start with a leading underscore. - -- Issue #11673: Fix multiprocessing Array and RawArray constructors to accept a - size of type 'long', rather than only accepting 'int'. - -- Issue #10042: Fixed the total_ordering decorator to handle cross-type - comparisons that could lead to infinite recursion. - -- Issue #10979: unittest stdout buffering now works with class and module - setup and teardown. - -- Issue #11569: use absolute path to the sysctl command in multiprocessing to - ensure that it will be found regardless of the shell PATH. This ensures - that multiprocessing.cpu_count works on default installs of MacOSX. - -- Issue #11500: Fixed a bug in the os x proxy bypass code for fully qualified - IP addresses in the proxy exception list. - -- Issue #11131: Fix sign of zero in plus and minus operations when - the context rounding mode is ROUND_FLOOR. - -- Issue #5622: Fix curses.wrapper to raise correct exception if curses - initialization fails. - -- Issue #11391: Writing to a mmap object created with - ``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a - TypeError. Patch by Charles-Fran?ois Natali. - -- Issue #11306: mailbox in certain cases adapts to an inability to open - certain files in read-write mode. Previously it detected this by - checking for EACCES, now it also checks for EROFS. - -- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors - on accept(), send() and recv(). - -- Issue #11326: Add the missing connect_ex() implementation for SSL sockets, - and make it work for non-blocking connects. - -- Issue #10956: Buffered I/O classes retry reading or writing after a signal - has arrived and the handler returned successfully. - -- Issue #10680: Fix mutually exclusive arguments for argument groups in - argparse. - -- Issue #4681: Allow mmap() to work on file sizes and offsets larger than - 4GB, even on 32-bit builds. Initial patch by Ross Lagerwall, adapted for - 32-bit Windows. - -- Issue #10360: In WeakSet, do not raise TypeErrors when testing for - membership of non-weakrefable objects. - -- Issue #10549: Fix pydoc traceback when text-documenting certain classes. - -- Issue #940286: pydoc.Helper.help() ignores input/output init parameters. - -- Issue #11171: Fix detection of config/Makefile when --prefix != - --exec-prefix, which caused Python to not start. - -- Issue #11116: any error during addition of a message to a mailbox now causes - a rollback, instead of leaving the mailbox partially modified. - -- Issue #8275: Fix passing of callback arguments with ctypes under Win64. - Patch by Stan Mihai. - -- Issue #10949: Improved robustness of rotating file handlers. - -- Issue #10955: Fix a potential crash when trying to mmap() a file past its - length. Initial patch by Ross Lagerwall. - -- Issue #10898: Allow compiling the posix module when the C library defines - a symbol named FSTAT. - -- Issue #10916: mmap should not segfault when a file is mapped using 0 as - length and a non-zero offset, and an attempt to read past the end of file - is made (IndexError is raised instead). Patch by Ross Lagerwall. - -- Issue #10875: Update Regular Expression HOWTO; patch by 'SilentGhost'. - -- Issue #10827: Changed the rules for 2-digit years. The time.asctime - function will now format any year when ``time.accept2dyear`` is - false and will accept years >= 1000 otherwise. The year range - accepted by ``time.mktime`` and ``time.strftime`` is still system - dependent, but ``time.mktime`` will now accept full range supported - by the OS. Conversion of 2-digit years to 4-digit is deprecated. - -- Issue #10869: Fixed bug where ast.increment_lineno modified the root - node twice. - -- Issue #7858: Raise an error properly when os.utime() fails under Windows - on an existing file. - -- Issue #3839: wsgiref should not override a Content-Length header set by - the application. Initial patch by Clovis Fabricio. - -- Issue #10806, issue #9905: Fix subprocess pipes when some of the standard - file descriptors (0, 1, 2) are closed in the parent process. Initial - patch by Ross Lagerwall. - -- Issue #4662: os.tempnam(), os.tmpfile() and os.tmpnam() now raise a py3k - DeprecationWarning. - -- Subclasses of collections.OrderedDict now work correctly with __missing__. - -- Issue #10753: Characters ';', '=' and ',' in the PATH_INFO environment - variable won't be quoted when the URI is constructed by the wsgiref.util 's - request_uri method. According to RFC 3986, these characters can be a part of - params in PATH component of URI and need not be quoted. - -- Issue #10738: Fix webbrowser.Opera.raise_opts - -- Issue #9824: SimpleCookie now encodes , and ; in values to cater to how - browsers actually parse cookies. - -- Issue #1379416: eliminated a source of accidental unicode promotion in - email.header.Header.encode. - -- Issue #5258/#10642: if site.py encounters a .pth file that generates an error, - it now prints the filename, line number, and traceback to stderr and skips - the rest of that individual file, instead of stopping processing entirely. - -- Issue #10750: The ``raw`` attribute of buffered IO objects is now read-only. - -- Issue #10242: unittest.TestCase.assertItemsEqual makes too many assumptions - about input. - -- Issue #10611: SystemExit should not cause a unittest test run to exit. - -- Issue #6791: Limit header line length (to 65535 bytes) in http.client, - to avoid denial of services from the other party. - -- Issue #9907: Fix tab handling on OSX when using editline by calling - rl_initialize first, then setting our custom defaults, then reading .editrc. - -- Issue #4188: Avoid creating dummy thread objects when logging operations - from the threading module (with the internal verbose flag activated). - -- Issue #9721: Fix the behavior of urljoin when the relative url starts with a - ';' character. Patch by Wes Chow. - -- Issue #10714: Limit length of incoming request in http.server to 65536 bytes - for security reasons. Initial patch by Ross Lagerwall. - -- Issue #9558: Fix distutils.command.build_ext with VS 8.0. - -- Issue #10695: passing the port as a string value to telnetlib no longer - causes debug mode to fail. - -- Issue #10478: Reentrant calls inside buffered IO objects (for example by - way of a signal handler) now raise a RuntimeError instead of freezing the - current process. - -- Issue #10497: Fix incorrect use of gettext in argparse. - -- Issue #10464: netrc now correctly handles lines with embedded '#' characters. - -- Issue #1731717: Fixed the problem where subprocess.wait() could cause an - OSError exception when The OS had been told to ignore SIGCLD in our process - or otherwise not wait for exiting child processes. - -- Issue #9509: argparse now properly handles IOErrors raised by - argparse.FileType. - -- Issue #9348: Raise an early error if argparse nargs and metavar don't match. - -- Issue #8982: Improve the documentation for the argparse Namespace object. - -- Issue #9343: Document that argparse parent parsers must be configured before - their children. - -- Issue #9026: Fix order of argparse sub-commands in help messages. - -- Issue #9347: Fix formatting for tuples in argparse type= error messages. - -Extension Modules ------------------ - -- Stop using the old interface for providing methods and attributes in the _sre - module. Among other things, this gives these classes ``__class__`` - attributes. (See #12099) - -- Issue #10169: Fix argument parsing in socket.sendto() to avoid error masking. - -- Issue #12051: Fix segfault in json.dumps() while encoding highly-nested - objects using the C accelerations. - -- Issue #12017: Fix segfault in json.loads() while decoding highly-nested - objects using the C accelerations. - -- Issue #1838: Prevent segfault in ctypes, when _as_parameter_ on a class is set - to an instance of the class. - -- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY. - -IDLE ----- - -- Issue #11718: IDLE's open module dialog couldn't find the __init__.py - file in a package. - -- Issue #12590: IDLE editor window now always displays the first line - when opening a long file. With Tk 8.5, the first line was hidden. - -- Issue #11088: don't crash when using F5 to run a script in IDLE on MacOSX - with Tk 8.5. - -- Issue #10940: Workaround an IDLE hang on Mac OS X 10.6 when using the - menu accelerators for Open Module, Go to Line, and New Indent Width. - The accelerators still work but no longer appear in the menu items. - -- Issue #10907: Warn OS X 10.6 IDLE users to use ActiveState Tcl/Tk 8.5, rather - than the currently problematic Apple-supplied one, when running with the - 64-/32-bit installer variant. - -- Issue #11052: Correct IDLE menu accelerators on Mac OS X for Save - commands. - -- Issue #6075: IDLE on Mac OS X now works with both Carbon AquaTk and - Cocoa AquaTk. - -- Issue #10404: Use ctl-button-1 on OSX for the context menu in Idle. - -- Issue #10107: Warn about unsaved files in IDLE on OSX. - -- Issue #10406: Enable Rstrip IDLE extension on OSX (just like on other - platforms). - -- Issue #6378: Further adjust idle.bat to start associated Python - -- Issue #11896: Save on Close failed despite selecting "Yes" in dialog. - -- Issue #4676: toggle failing on Tk 8.5, causing IDLE exits and - strange selection behavior. Improve selection extension behaviour. - -- Issue #3851: toggle non-functional when NumLock set on Windows. - -Build ------ - -- Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds, - ensure "make install" creates symlinks in --prefix bin for the "-32" - files in the framework bin directory like the installer does. - -- Issue #11411: Fix 'make DESTDIR=' with a relative destination. - -- Issue #10709: Add updated AIX notes in Misc/README.AIX. - -- Issue #11184: Fix large-file support on AIX. - -- Issue #941346: Fix broken shared library build on AIX. - -- Issue #11268: Prevent Mac OS X Installer failure if Documentation - package had previously been installed. - -- Issue #11079: The /Applications/Python x.x folder created by the Mac - OS X installers now includes a link to the installed documentation. - -- Issue #11054: Allow Mac OS X installer builds to again work on 10.5 with - the system-provided Python. - -- Issue #10843: Update third-party library versions used in OS X - 32-bit installer builds: bzip2 1.0.6, readline 6.1.2, SQLite 3.7.4 - (with FTS3/FTS4 and RTREE enabled), and ncursesw 5.5 (wide-char - support enabled). - -- Don't run pgen twice when using make -j. - -- Issue #7716: Under Solaris, don't assume existence of /usr/xpg4/bin/grep in - the configure script but use $GREP instead. Patch by Fabian Groffen. - -- Issue #10475: Don't hardcode compilers for LDSHARED/LDCXXSHARED on NetBSD - and DragonFly BSD. Patch by Nicolas Joly. - -- Issue #10655: Fix the build on PowerPC on Linux with GCC when building with - timestamp profiling (--with-tsc): the preprocessor test for the PowerPC - support now looks for "__powerpc__" as well as "__ppc__": the latter seems to - only be present on OS X; the former is the correct one for Linux with GCC. - -- Issue #1099: Fix the build on MacOSX when building a framework with pydebug - using GCC 4.0. - -Tests ------ - -- Issue #11164: Remove obsolete allnodes test from minidom test. - -- Issue #12205: Fix test_subprocess failure due to uninstalled test data. - -- Issue #5723: Improve json tests to be executed with and without accelerations. - -- Issue #11910: Fix test_heapq to skip the C tests when _heapq is missing. - -- Fix test_startfile to wait for child process to terminate before finishing. - -- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows - platforms. Patch by Nadeem Vawda. - -- Issue #7108: Fix test_commands to not fail when special attributes ('@' - or '.') appear in 'ls -l' output. - -- Issue #11490: test_subprocess:test_leaking_fds_on_error no longer gives a - false positive if the last directory in the path is inaccessible. - -- Issue #10822: Fix test_posix:test_getgroups failure under Solaris. Patch - by Ross Lagerwall. - -- Issue #6293: Have regrtest.py echo back sys.flags. This is done by default - in whole runs and enabled selectively using ``--header`` when running an - explicit list of tests. Original patch by Collin Winter. - -- Issue #775964: test_grp now skips YP/NIS entries instead of failing when - encountering them. - -- Issue #7110: regrtest now sends test failure reports and single-failure - tracebacks to stderr rather than stdout. - - -What's New in Python 2.7.1? -=========================== - -*Release date: 2010-11-27* - -Library -------- - -- Issue #2236: distutils' mkpath ignored the mode parameter. - -- Fix typo in one sdist option (medata-check). - -- Issue #10323: itertools.islice() now consumes the minimum number of - inputs before stopping. Formerly, the final state of the underlying - iterator was undefined. - -- Issue #10565: The collections.Iterator ABC now checks for both - ``__iter__`` and ``next``. - -- Issue #10092: Properly reset locale in calendar.Locale*Calendar classes. - -- Issue #10459: Update CJK character names to Unicode 5.2. - -- Issue #6098: Don't claim DOM level 3 conformance in minidom. - -- Issue #10561: In pdb, clear the breakpoints by the breakpoint number. - -- Issue #5762: Fix AttributeError raised by ``xml.dom.minidom`` when an empty - XML namespace attribute is encountered. - -- Issue #1710703: Write structures for an empty ZIP archive when a ZipFile is - created in modes 'a' or 'w' and then closed without adding any files. Raise - BadZipfile (rather than IOError) when opening small non-ZIP files. - -- Issue #4493: urllib2 adds '/' in front of path components which does not - start with '/. Common behavior exhibited by browsers and other clients. - -- Issue #10407: Fix one NameError in distutils. - -- Issue #10198: fix duplicate header written to wave files when writeframes() - is called without data. - -- Issue #10467: Fix BytesIO.readinto() after seeking into a position after the - end of the file. - -- Issue #5111: IPv6 Host in the Header is wrapped inside [ ]. Patch by Chandru. - -IDLE ----- - -- Issue #6378: idle.bat now runs with the appropriate Python version rather than - the system default. Patch by Sridhar Ratnakumar. - -Build ------ - -- Backport r83399 to allow test_distutils to pass on installed versions. - -- Issue #1303434: Generate ZIP file containing all PDBs. - -Tests ------ - -- Issue #9424: Replace deprecated assert* methods in the Python test suite. - -Documentation -------------- - -- Issue #10299: List the built-in functions in a table in functions.rst. - - -What's New in Python 2.7.1 release candidate 1? -=============================================== - -*Release date: 2010-11-13* - -Core and Builtins ------------------ - -- Issue #10221: dict.pop(k) now has a key error message that includes the - missing key (same message d[k] returns for missing keys). - -- Issue #10125: Don't segfault when the iterator passed to - ``file.writelines()`` closes the file. - -- Issue #10186: Fix the SyntaxError caret when the offset is equal to the - length of the offending line. - -- Issue #9997: Don't let the name "top" have special significance in scope - resolution. - -- Issue #9862: Compensate for broken PIPE_BUF in AIX by hard coding - its value as the default 512 when compiling on AIX. - -- Issue #9675: CObject use is marked as a Py3k warning, not a deprecation - warning. - -- Issue #10068: Global objects which have reference cycles with their module's - dict are now cleared again. This causes issue #7140 to appear again. - -- Issue #9869: Make long() and PyNumber_Long return something of type - long for a class whose __long__ method returns a plain int. This - fixes an interpreter crash when initializing an instance of a long - subclass from an object whose __long__ method returns a plain int. - -- Issue #10006: type.__abstractmethods__ now raises an AttributeError. - -- Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid - thread-local storage key. - -- Issue #4947: The write() method of sys.stdout and sys.stderr uses their - encoding and errors attributes instead of using utf-8 in strict mode, to get - the same behaviour than the print statement. - -- Issue #9737: Fix a crash when trying to delete a slice or an item from - a memoryview object. - -- Restore GIL in nis_cat in case of error. - -- Issue #9688: __basicsize__ and __itemsize__ must be accessed as Py_ssize_t. - -- Issue #8530: Prevent stringlib fastsearch from reading beyond the front - of an array. - -- Issue #83755: Implicit set-to-frozenset conversion was not thread-safe. - -- Issue #9416: Fix some issues with complex formatting where the - output with no type specifier failed to match the str output: - - - format(complex(-0.0, 2.0), '-') omitted the real part from the output, - - format(complex(0.0, 2.0), '-') included a sign and parentheses. - -- Issue #7616: Fix copying of overlapping memoryview slices with the Intel - compiler. - -Library -------- - -- Issue #9926: Wrapped TestSuite subclass does not get __call__ executed - -- Issue #4471: Properly shutdown socket in IMAP.shutdown(). Patch by - Lorenzo M. Catucci. - -- Issue #10126: Fix distutils' test_build when Python was built with - --enable-shared. - -- Fix typo in one sdist option (medata-check). - -- Issue #9199: Fix incorrect use of distutils.cmd.Command.announce. - -- Issue #1718574: Fix options that were supposed to accept arguments but did - not in build_clib. - -- Issue #9281: Prevent race condition with mkdir in distutils. Patch by - Arfrever. - -- Issue #10229: Fix caching error in gettext. - -- Issue #10252: Close file objects in a timely manner in distutils code and - tests. Patch by Brian Brazil, completed by ?ric Araujo. - -- Issue #10311: The signal module now restores errno before returning from - its low-level signal handler. Patch by Hallvard B Furuseth. - -- Issue #10038: json.loads() on str should always return unicode (regression - from Python 2.6). Patch by Walter D?rwald. - -- Issue #120176: Wrapped TestSuite subclass does not get __call__ executed. - -- Issue #6706: asyncore accept() method no longer raises - EWOULDBLOCK/ECONNABORTED on incomplete connection attempt but returns None - instead. - -- Issue #10266: uu.decode didn't close in_file explicitly when it was given - as a filename. Patch by Brian Brazil. - -- Issue #10246: uu.encode didn't close file objects explicitly when filenames - were given to it. Patch by Brian Brazil. - -- Issue #10253: FileIO leaks a file descriptor when trying to open a file - for append that isn't seekable. Patch by Brian Brazil. - -- Issue #6105: json.dumps now respects OrderedDict's iteration order. - -- Issue #9295: Fix a crash under Windows when calling close() on a file - object with custom buffering from two threads at once. - -- Issue #5027: The standard ``xml`` namespace is now understood by - xml.sax.saxutils.XMLGenerator as being bound to - http://www.w3.org/XML/1998/namespace. Patch by Troy J. Farrell. - -- Issue #10163: Skip unreadable registry keys during mimetypes - initialization. - -- Issue #5117: Fixed root directory related issue on posixpath.relpath() and - ntpath.relpath(). - -- Issue #9409: Fix the regex to match all kind of filenames, for interactive - debugging in doctests. - -- Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the - current directory was deleted. Patch written by W. Trevor King. - -- Issue #10045: Improved performance when writing after seeking past the - end of the "file" in cStringIO. - -- Issue #9948: Fixed problem of losing filename case information. - -- Issue #9437: Fix building C extensions with non-default LDFLAGS. - -- Issue #9759: GzipFile now raises ValueError when an operation is attempted - after the file is closed. Patch by Jeffrey Finkelstein. - -- Issue #9042: Fix interaction of custom translation classes and caching in - gettext. - -- Issue #9065: tarfile no longer uses "root" as the default for the uname and - gname field. - -- Issue #1050268: parseaddr now correctly quotes double quote and backslash - characters that appear inside quoted strings in email addresses. - -- Issue #10004: quoprimime no longer generates a traceback when confronted - with invalid characters after '=' in a Q-encoded word. - -- Issue #9950: Fix socket.sendall() crash or misbehaviour when a signal is - received. Now sendall() properly calls signal handlers if necessary, - and retries sending if these returned successfully, including on sockets - with a timeout. - -- Issue #9947: logging: Fixed locking bug in stopListening. - -- Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler. - -- Issue #9936: Fixed executable lines' search in the trace module. - -- Issue #9928: Properly initialize the types exported by the bz2 module. - -- Issue #9854: The default read() implementation in io.RawIOBase now - handles non-blocking readinto() returning None correctly. - -- Issue #9729: Fix the signature of SSLSocket.recvfrom() and - SSLSocket.sendto() to match the corresponding socket methods. Also, - fix various SSLSocket methods to raise socket.error rather than an - unhelpful TypeError when called on an unconnected socket. Original patch - by Andrew Bennetts. - -- Issue #9826: OrderedDict.__repr__ can now handle self-referential - values: d['x'] = d. - -- Issue #767645: Set os.path.supports_unicode_filenames to True on Mac OS X. - -- Issue #9837: The read() method of ZipExtFile objects (as returned by - ZipFile.open()) could return more bytes than requested. - -- Issue #9825: removed __del__ from the definition of collections.OrderedDict. - This prevents user-created self-referencing ordered dictionaries from - becoming permanently uncollectable GC garbage. The downside is that - removing __del__ means that the internal doubly-linked list has to wait for - GC collection rather than freeing memory immediately when the refcnt drops - to zero. - -- Issue #9816: random.Random.jumpahead(n) did not produce a sufficiently - different internal state for small values of n. Fixed by salting the - value. - -- Issue #9792: In case of connection failure, socket.create_connection() - would swallow the exception and raise a new one, making it impossible - to fetch the original errno, or to filter timeout errors. Now the - original error is re-raised. - -- Issue #9758: When fcntl.ioctl() was called with mutable_flag set to True, - and the passed buffer was exactly 1024 bytes long, the buffer wouldn't - be updated back after the system call. Original patch by Brian Brazil. - -- Issue #1100562: Fix deep-copying of objects derived from the list and - dict types. Patch by Michele Orr? and Bj?rn Lindqvist. - -- Issue #7005: Fixed output of None values for RawConfigParser.write and - ConfigParser.write. - -- Issue #808164: Fixed socket.close to avoid references to globals, to - avoid issues when socket.close is called from a __del__ method. - -- Issue #2986: difflib.SequenceMatcher gets a new parameter, autojunk, which - can be set to False to turn off the previously undocumented 'popularity' - heuristic. Patch by Terry Reedy and Eli Bendersky - -- Issue #8797: urllib2 does a retry for Basic Authentication failure instead of - falling into recursion. - -- Issue #1194222: email.utils.parsedate now returns RFC2822 compliant four - character years even if the message contains RFC822 two character years. - -- Issue #8750: Fixed MutableSet's methods to correctly handle - reflexive operations, namely x -= x and x ^= x. - -- Issue #9129: smtpd.py is vulnerable to DoS attacks deriving from missing - error handling when accepting a new connection. - -- Issue #658749: asyncore's connect() method now correctly interprets winsock - errors. - -- Issue #9501: Fixed logging regressions in cleanup code. - -- Issue #9214: Set operations on KeysView or ItemsView in the collections - module now correctly return a set. (Patch by Eli Bendersky.) - -- Issue #9617: Signals received during a low-level write operation aren't - ignored by the buffered IO layer anymore. - -- Issue #2521: Use weakrefs on for caching in the abc module, so that classes - are not held onto after they are deleted elsewhere. - -- Issue #9626: the view methods for collections.OrderedDict() were returning - the unordered versions inherited from dict. Those methods are now - overridden to provide ordered views. - -- Issue #8688: MANIFEST files created by distutils now include a magic - comment indicating they are generated. Manually maintained MANIFESTs - without this marker will not be overwritten or removed. - -- Issue #7467: when reading a file from a ZIP archive, its CRC is checked - and a BadZipfile error is raised if it doesn't match (as used to be the - case in Python 2.5 and earlier). - -- Issue #9550: a BufferedReader could issue an additional read when the - original read request had been satisfied, which could block indefinitely - when the underlying raw IO channel was e.g. a socket. Report and original - patch by Jason V. Miller. - -- Issue #9551: Don't raise TypeError when setting the value to None for - SafeConfigParser instances constructed with allow_no_value == True. - -- Issue #6915: Under Windows, os.listdir() didn't release the Global - Interpreter Lock around all system calls. Original patch by Ryan Kelly. - -- Issue #3757: thread-local objects now support cyclic garbage collection. - Thread-local objects involved in reference cycles will be deallocated - timely by the cyclic GC, even if the underlying thread is still running. - -- Issue #6231: Fix xml.etree.ElementInclude to include the tail of the - current node. - -- Issue #6869: Fix a refcount problem in the _ctypes extension. - -- Issue #5504: ctypes should now work with systems where mmap can't be - PROT_WRITE and PROT_EXEC. - -- Issue #8280: urllib2's Request method will remove fragements in the url. - This is how it is supposed to work, wget and curl do the same. Previous - behavior was wrong. - -- Issue #2944: asyncore doesn't handle connection refused correctly. - -- Issue #3196: email header decoding is now forgiving if an RFC2047 - encoded word encoded in base64 is lacking padding. - -- Issue #9444: Argparse now uses the first element of prefix_chars as - the option character for the added 'h/help' option if prefix_chars - does not contain a '-', instead of raising an error. - -- Issue #9354: Provide getsockopt() in asyncore's file_wrapper. - -- Issue #9428: Fix running scripts with the profile/cProfile modules from - the command line. - -- Issue #7781: Fix restricting stats by entry counts in the pstats - interactive browser. - -- Issue #9209: Do not crash in the pstats interactive browser on invalid - regular expressions. - -- Issue #7372: Fix pstats regression when stripping paths from profile - data generated with the profile module. - -- Issue #4108: In urllib.robotparser, if there are multiple 'User-agent: *' - entries, consider the first one. - -- Issue #8397: Raise an error when attempting to mix iteration and regular - reads on a BZ2File object, rather than returning incorrect results. - -- Issue #5294: Fix the behavior of pdb's "continue" command when called - in the top-level debugged frame. - -- Issue #5727: Restore the ability to use readline when calling into pdb - in doctests. - -- Issue #6719: In pdb, do not stop somewhere in the encodings machinery - if the source file to be debugged is in a non-builtin encoding. - -- Issue #8048: Prevent doctests from failing when sys.displayhook has - been reassigned. - -- Issue #8015: In pdb, do not crash when an empty line is entered as - a breakpoint command. - -- Issue #9448: Fix a leak of OS resources (mutexes or semaphores) when - re-initializing a buffered IO object by calling its ``__init__`` method. - -- Issue #7909: Do not touch paths with the special prefixes ``\\.\`` - or ``\\?\`` in ntpath.normpath(). - -- Issue #5146: Handle UID THREAD command correctly in imaplib. - -- Issue #5147: Fix the header generated for cookie files written by - http.cookiejar.MozillaCookieJar. - -- Issue #8198: In pydoc, output all help text to the correct stream - when sys.stdout is reassigned. - -- Issue #7395: Fix tracebacks in pstats interactive browser. - -- Issue #8230: Fix Lib/test/sortperf.py. - -- Issue #1713: Fix os.path.ismount(), which returned true for symbolic links - across devices. - -- Issue #8826: Properly load old-style "expires" attribute in http.cookies. - -- Issue #1690103: Fix initial namespace for code run with trace.main(). - -- Issue #8471: In doctest, properly reset the output stream to an empty - string when Unicode was previously output. - -- Issue #8620: when a Cmd is fed input that reaches EOF without a final - newline, it no longer truncates the last character of the last command line. - -- Issue #6213: Implement getstate() and setstate() methods of utf-8-sig and - utf-16 incremental encoders. - -- Issue #7113: Speed up loading in ConfigParser. Patch by ?ukasz Langa. - -- Issue #3704: cookielib was not properly handling URLs with a / in the - parameters. - -- Issue #9032: XML-RPC client retries the request on EPIPE error. The EPIPE - error occurs when the server closes the socket and the client sends a big - XML-RPC request. - -- Issue #5542: Remove special logic that closes HTTPConnection socket on EPIPE. - -- Issue #4629: getopt raises an error if an argument ends with = whereas getopt - doesn't except a value (eg. --help= is rejected if getopt uses ['help='] long - options). - -- Issue #7895: platform.mac_ver() no longer crashes after calling os.fork() - -- Issue #5395: array.fromfile() would raise a spurious EOFError when an - I/O error occurred. Now an IOError is raised instead. Patch by chuck - (Jan Hosang). - -- Issue #7646: The fnmatch pattern cache no longer grows without bound. - -- Issue #9136: Fix 'dictionary changed size during iteration' - RuntimeError produced when profiling the decimal module. This was - due to a dangerous iteration over 'locals()' in Context.__init__. - -- Fix extreme speed issue in Decimal.pow when the base is an exact - power of 10 and the exponent is tiny (for example, - Decimal(10) ** Decimal('1e-999999999')). - -- Issue #9161: Fix regression in optparse's acceptance of unicode - strings in add_option calls. - -- Issue #9130: Fix validation of relative imports in parser module. - -- Issue #9128: Fix validation of class decorators in parser module. - -- Issue #9164: Ensure sysconfig handles dupblice archs while building on OSX - -- Issue #9315: Fix for the trace module to record correct class name - for tracing methods. - -Extension Modules ------------------ - -- Issue #9054: Fix a crash occurring when using the pyexpat module - with expat version 2.0.1. - -- Issue #10003: Allow handling of SIGBREAK on Windows. Fixes a regression - introduced by issue #9324. - -- Issue #8734: Avoid crash in msvcrt.get_osfhandle() when an invalid file - descriptor is provided. Patch by Pascal Chambon. - -- Issue #7736: Release the GIL around calls to opendir() and closedir() - in the posix module. Patch by Marcin Bachry. - -- As a result of issue #2521, the _weakref module is now compiled into the - interpreter by default. - -- Issue #9324: Add parameter validation to signal.signal on Windows in order - to prevent crashes. - -- Issue #9526: Remove some outdated (int) casts that were preventing - the array module from working correctly with arrays of more than - 2**31 elements. - -- Fix memory leak in ssl._ssl._test_decode_cert. - -- Issue #8065: Fix memory leak in readline module (from failure to - free the result of history_get_history_state()). - -- Issue #9450: Fix memory leak in readline.replace_history_item and - readline.remove_history_item for readline version >= 5.0. - -- Issue #8105: Validate file descriptor passed to mmap.mmap on Windows. - -- Issue #1019882: Fix IndexError when loading certain hotshot stats. - -- Issue #9422: Fix memory leak when re-initializing a struct.Struct object. - -- Issue #7900: The getgroups(2) system call on MacOSX behaves rather oddly - compared to other unix systems. In particular, os.getgroups() does - not reflect any changes made using os.setgroups() but basically always - returns the same information as the id command. - - os.getgroups() can now return more than 16 groups on MacOSX. - -- Issue #9277: Fix bug in struct.pack for bools in standard mode - (e.g., struct.pack('>?')): if conversion to bool raised an exception - then that exception wasn't properly propagated on machines where - char is unsigned. - -- Issue #7567: Don't call `setupterm' twice. - -Tools/Demos ------------ - -- Issue #7287: Demo/imputil/knee.py was removed. - -- Issue #9188: The gdb extension now handles correctly narrow (UCS2) as well - as wide (UCS4) unicode builds for both the host interpreter (embedded - inside gdb) and the interpreter under test. - -Build ------ - -- Issue #8852: Allow the socket module to build on OpenSolaris. - -- Issue #10054: Some platforms provide uintptr_t in inttypes.h. Patch by - Akira Kitada. - -- Issue #10055: Make json C89-compliant in UCS4 mode. - -- Issue #1633863: Don't ignore $CC under AIX. - -- Issue #9810: Compile bzip2 source files in python's project file - directly. It used to be built with bzip2's makefile. - -- Issue #941346: Improve the build process under AIX and allow Python to - be built as a shared library. Patch by S?bastien Sabl?. - -- Issue #4026: Make the fcntl extension build under AIX. Patch by S?bastien - Sabl?. - -- Issue #3101: Helper functions _add_one_to_index_C() and - _add_one_to_index_F() become _Py_add_one_to_index_C() and - _Py_add_one_to_index_F(), respectively. - -- Issue #9700: define HAVE_BROKEN_POSIX_SEMAPHORES under AIX 6.x. Patch by - S?bastien Sabl?. - -- Issue #9280: Make sharedinstall depend on sharedmods. - -- Issue #9275: The OSX installer once again installs links to binaries in - ``/usr/local/bin``. - -- Issue #9392: A framework build on OSX will once again use a versioned name - of the ``2to3`` tool, that is you can use ``2to3-2.7`` to select the Python - 2.7 edition of 2to3. - -- Issue #9701: The MacOSX installer can patch the shell profile to ensure that - the "bin" directory inside the framework is on the shell's search path. This - feature now also supports the ZSH shell. - -- Issue #7473: avoid link errors when building a framework with a different - set of architectures than the one that is currently installed. - -Tests ------ - -- Issue #9978: Wait until subprocess completes initialization. (Win32KillTests - in test_os) - -- Issue #9894: Do not hardcode ENOENT in test_subprocess. - -- Issue #9323: Make test.regrtest.__file__ absolute, this was not always the - case when running profile or trace, for example. - -- Issue #9315: Added tests for the trace module. Patch by Eli Bendersky. - -- Strengthen test_unicode with explicit type checking for assertEqual tests. - -- Issue #8857: Provide a test case for socket.getaddrinfo. - -- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty. - -- Issue #8433: Fix test_curses failure with newer versions of ncurses. - -- Issue #9496: Provide a test suite for the rlcompleter module. Patch by - Michele Orr?. - -- Issue #8605: Skip test_gdb if Python is compiled with optimizations. - -- Issue #9568: Fix test_urllib2_localnet on OS X 10.3. - -Documentation -------------- - -- Issue #9817: Add expat COPYING file; add expat, libffi and expat licenses - to Doc/license.rst. - -- Issue #9524: Document that two CTRL* signals are meant for use only - with os.kill. - -- Issue #9255: Document that the 'test' package is for internal Python use - only. - -- Issue #7829: Document in dis that bytecode is an implementation detail. - - -What's New in Python 2.7? -========================= - -*Release date: 2010-07-03* - -Core and Builtins ------------------ - -- Prevent assignment to set literals. - -Library -------- - -- Issue #1868: Eliminate subtle timing issues in thread-local objects by - getting rid of the cached copy of thread-local attribute dictionary. - -- Issue #9125: Add recognition of 'except ... as ...' syntax to parser module. - -Extension Modules ------------------ - -- Issue #7673: Fix security vulnerability (CVE-2010-2089) in the audioop module, - ensure that the input string length is a multiple of the frame size. - -- Issue #9075: In the ssl module, remove the setting of a ``debug`` flag - on an OpenSSL structure. - - -What's New in Python 2.7 release candidate 2? -============================================= - -*Release date: 2010-06-20* - -Core and Builtins ------------------ - -- Issue #9058: Remove assertions about INT_MAX in UnicodeDecodeError. - -- Issue #8202: Previous change to ``sys.argv[0]`` handling for -m command line - option reverted due to unintended side effects on handling of ``sys.path``. - See tracker issue for details. - -- Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash - the interpreter with characters outside the Basic Multilingual Plane - (higher than 0x10000). - -- In the unicode/str.format(), raise a ValueError when indexes to arguments are - too large. - -Build ------ - -- Issue #8854: Fix finding Visual Studio 2008 on Windows x64. - -Library -------- - -- Issue #6589: cleanup asyncore.socket_map in case smtpd.SMTPServer constructor - raises an exception. - -- Issue #8959: fix regression caused by using unmodified libffi - library on Windows. ctypes does now again check the stack before - and after calling foreign functions. - -- Issue #8720: fix regression caused by fix for #4050 by making getsourcefile - smart enough to find source files in the linecache. - -- Issue #8986: math.erfc was incorrectly raising OverflowError for - values between -27.3 and -30.0 on some platforms. - -- Issue #8924: logging: Improved error handling for Unicode in exception text. - -- Issue #8948: cleanup functions and class / module setups and teardowns are - now honored in unittest debug methods. - -Documentation -------------- - -- Issue #8909: Added the size of the bitmap used in the installer created by - distutils' bdist_wininst. Patch by Anatoly Techtonik. - -Misc ----- - -- Issue #8362: Add maintainers.rst: list of module maintainers - - -What's New in Python 2.7 Release Candidate 1? -============================================= - -*Release date: 2010-06-05* - -Core and Builtins ------------------ - -- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the - start byte and the continuation byte(s) are now considered invalid, instead - of the number of bytes specified by the start byte. - E.g.: '\xf1\x80AB'.decode('utf-8', 'replace') now returns u'\ufffdAB' and - replaces with U+FFFD only the start byte ('\xf1') and the continuation byte - ('\x80') even if '\xf1' is the start byte of a 4-bytes sequence. - Previous versions returned a single u'\ufffd'. - -- Issue #8627: Remove bogus "Overriding __cmp__ blocks inheritance of - __hash__ in 3.x" warning. Also fix "XXX undetected error" that - arises from the "Overriding __eq__ blocks inheritance ..." warning - when turned into an exception: in this case the exception simply - gets ignored. - -- Issue #8748: Fix two issues with comparisons between complex and integer - objects. (1) The comparison could incorrectly return True in some cases - (2**53+1 == complex(2**53) == 2**53), breaking transivity of equality. - (2) The comparison raised an OverflowError for large integers, leading - to unpredictable exceptions when combining integers and complex objects - in sets or dicts. - -- Issue #5211: Implicit coercion for the complex type is now completely - removed. (Coercion for arithmetic operations was already removed in 2.7 - alpha 4, but coercion for rich comparisons was accidentally left in.) - -- Issue #3798: Write sys.exit() message to sys.stderr to use stderr encoding - and error handler, instead of writing to the C stderr file in utf-8 - -- Issue #7902: When using explicit relative import syntax, don't try implicit - relative import semantics. - -- Issue #7079: Fix a possible crash when closing a file object while using it - from another thread. Patch by Daniel Stutzbach. - -- Issue #8868: Fix that ensures that python scripts have access to the - Window Server again in a framework build on MacOSX 10.5 or earlier. - -C-API ------ - -- Issue #5753: A new C API function, :cfunc:`PySys_SetArgvEx`, allows embedders - of the interpreter to set sys.argv without also modifying sys.path. This - helps fix `CVE-2008-5983 - `_. - -Library -------- - -- Issue #8302: SkipTest in unittest.TestCase.setUpClass or setUpModule is now - reported as a skip rather than an error. - -- Issue #8351: Excessively large diffs due to - unittest.TestCase.assertSequenceEqual are no longer included in failure - reports. - -- Issue #8899: time.struct_time now has class and attribute docstrings. - -- Issue #4487: email now accepts as charset aliases all codec aliases - accepted by the codecs module. - -- Issue #6470: Drop UNC prefix in FixTk. - -- Issue #5610: feedparser no longer eats extra characters at the end of - a body part if the body part ends with a \r\n. - -- Issue #8833: tarfile created hard link entries with a size field != 0 by - mistake. - -- Issue #1368247: set_charset (and therefore MIMEText) now automatically - encodes a unicode _payload to the output_charset. - -- Issue #7150: Raise OverflowError if the result of adding or subtracting - timedelta from date or datetime falls outside of the MINYEAR:MAXYEAR range. - -- Issue #6662: Fix parsing of malformatted charref (&#bad;), patch written by - Fredrik H??rd - -- Issue #8016: Add the CP858 codec. - -- Issue #3924: Ignore cookies with invalid "version" field in cookielib. - -- Issue #6268: Fix seek() method of codecs.open(), don't read or write the BOM - twice after seek(0). Fix also reset() method of codecs, UTF-16, UTF-32 and - StreamWriter classes. - -- Issue #5640: Fix Shift-JIS incremental encoder for error handlers different - than 'strict'. - -- Issue #8782: Add a trailing newline in linecache.updatecache to the last line - of files without one. - -- Issue #8729: Return NotImplemented from ``collections.Mapping.__eq__()`` when - comparing to a non-mapping. - -- Issue #8759: Fix user paths in sysconfig for posix and os2 schemes. - -- Issue #1285086: Speed up ``urllib.quote()`` and urllib.unquote for simple - cases. - -- Issue #8688: Distutils now recalculates MANIFEST every time. - -- Issue #5099: The ``__del__()`` method of ``subprocess.Popen`` (and the methods - it calls) referenced global objects, causing errors to pop up during - interpreter shutdown. - -Extension Modules ------------------ - -- Issue #7384: If the system readline library is linked against ncurses, - the curses module must be linked against ncurses as well. Otherwise it - is not safe to load both the readline and curses modules in an application. - -- Issue #2810: Fix cases where the Windows registry API returns - ERROR_MORE_DATA, requiring a re-try in order to get the complete result. - -- Issue #8674: Fixed a number of incorrect or undefined-behaviour-inducing - overflow checks in the ``audioop`` module. - -Tests ------ - -- Issue #8889: test_support.transient_internet rewritten so that the new - checks also work on FreeBSD, which lacks EAI_NODATA. - -- Issue #8835: test_support.transient_internet() catches gaierror(EAI_NONAME) - and gaierror(EAI_NODATA) - -- Issue #7449: Skip test_socketserver if threading support is disabled - -- On darwin, ``test_site`` assumed that a framework build was being used, - leading to a failure where four directories were expected for site-packages - instead of two in a non-framework build. - -Build ------ - -- Display installer warning that Windows 2000 won't be supported in future - releases. - -- Issues #1759169, #8864: Drop _XOPEN_SOURCE on Solaris, define it for - multiprocessing only. - -Tools/Demos ------------ - -- Issue #5464: Implement plural forms in msgfmt.py. - - -What's New in Python 2.7 beta 2? -================================ - -*Release date: 2010-05-08* - -Core and Builtins ------------------ - -- Run Clang 2.7's static analyzer for ``Objects/`` and ``Python/``. - -- Issue #1533: Fix inconsistency in range function argument processing: any - non-float non-integer argument is now converted to an integer (if possible) - using its __int__ method. Previously, only small arguments were treated this - way; larger arguments (those whose __int__ was outside the range of a C long) - would produce a TypeError. - -- Issue #8202: ``sys.argv[0]`` is now set to '-m' instead of '-c' when searching - for the module file to be executed with the -m command line option. - -- Issue #7319: When -Q is used, do not silence DeprecationWarning. - -- Issue #7332: Remove the 16KB stack-based buffer in - ``PyMarshal_ReadLastObjectFromFile``, which doesn't bring any noticeable - benefit compared to the dynamic memory allocation fallback. Patch by - Charles-Fran?ois Natali. - -- Issue #8417: Raise an OverflowError when an integer larger than sys.maxsize is - passed to bytearray. - -- Issue #7072: ``isspace(0xa0)`` is true on Mac OS X. - -- Issue #8404: Fix set operations on dictionary views. - -- Issue #8084: PEP 370 now conforms to system conventions for framework builds - on MacOS X. That is, ``python setup.py install --user`` will install into - ``~/Library/Python/2.7`` instead of ``~/.local``. - -Library -------- - -- Issue #8681: Make the zlib module's error messages more informative when the - zlib itself doesn't give any detailed explanation. - -- Issue #8571: Fix an internal error when compressing or decompressing a chunk - larger than 1GB with the zlib module's compressor and decompressor objects. - -- Issue #8573: asyncore ``_strerror()`` function might throw ValueError. - -- Issue #8483: asyncore.dispatcher's __getattr__ method produced confusing error - messages when accessing undefined class attributes because of the cheap - inheritance with the underlying socket object. The cheap inheritance has been - deprecated. - -- Issue #4265: ``shutil.copyfile()`` was leaking file descriptors when disk - fills. Patch by Tres Seaver. - -- Issue #7755: Use an unencumbered audio file for tests. - -- Issue #8621: ``uuid.uuid4()`` returned the same sequence of values in the - parent and any children created using ``os.fork`` on Mac OS X 10.6. - -- Issue #8313: ``traceback.format_exception_only()`` encodes unicode message to - ASCII with backslashreplace error handler if ``str(value)`` failed. - -- Issue #8567: Fix precedence of signals in Decimal module: when a Decimal - operation raises multiple signals and more than one of those signals is - trapped, the specification determines the order in which the signals should be - handled. In many cases this order wasn't being followed, leading to the wrong - Python exception being raised. - -- Issue #7865: The close() method of :mod:`io` objects should not swallow - exceptions raised by the implicit flush(). Also ensure that calling close() - several times is supported. Patch by Pascal Chambon. - -- Issue #8576: logging updated to remove usage of find_unused_port(). - -- Issue #4687: Fix accuracy of garbage collection runtimes displayed with - gc.DEBUG_STATS. - -- Issue #8354: The siginterrupt setting is now preserved for all signals, not - just SIGCHLD. - -- Issue #7192: ``webbrowser.get("firefox")`` now works on Mac OS X, as does - ``webbrowser.get("safari")``. - -- Issue #8577: ``distutils.sysconfig.get_python_inc()`` now makes a difference - between the build dir and the source dir when looking for "python.h" or - "Include". - -- Issue #8464: tarfile no longer creates files with execute permissions set when - mode="w|" is used. - -- Issue #7834: Fix connect() of Bluetooth L2CAP sockets with recent versions of - the Linux kernel. Patch by Yaniv Aknin. - -- Issue #6312: Fix http HEAD request when the transfer encoding is chunked. It - should correctly return an empty response now. - -- Issue #7490: To facilitate sharing of doctests between 2.x and 3.x test - suites, the ``IGNORE_EXCEPTION_DETAIL`` directive now also ignores the module - location of the raised exception. Based on initial patch by Lennart Regebro. - -- Issue #8086: In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline before - the certificate footer. Patch by Kyle VanderBeek. - -- Issue #8546: Reject None given as the buffering argument to ``_pyio.open()``. - -- Issue #8549: Fix compiling the _ssl extension under AIX. Patch by Sridhar - Ratnakumar. - -- Issue #6656: Fix locale.format_string to handle escaped percents and mappings. - -- Issue #2302: Fix a race condition in SocketServer.BaseServer.shutdown, where - the method could block indefinitely if called just before the event loop - started running. This also fixes the occasional freezes witnessed in - test_httpservers. - -- Issue #5103: SSL handshake would ignore the socket timeout and block - indefinitely if the other end didn't respond. - -- The do_handshake() method of SSL objects now adjusts the blocking mode of the - SSL structure if necessary (as other methods already do). - -- Issue #7507: Quote "!" in pipes.quote(); it is special to some shells. - -- Issue #5238: Calling makefile() on an SSL object would prevent the underlying - socket from being closed until all objects get truely destroyed. - -- Issue #7943: Fix circular reference created when instantiating an SSL socket. - Initial patch by P?ter Szab?. - -- Issue #8451: Syslog module now uses basename(sys.argv[0]) instead of the - string "python" as the *ident*. openlog() arguments are all optional and - keywords. - -- Issue #8108: Fix the unwrap() method of SSL objects when the socket has a - non-infinite timeout. Also make that method friendlier with applications - wanting to continue using the socket in clear-text mode, by disabling - OpenSSL's internal readahead. Thanks to Darryl Miles for guidance. - -- Issue #8484: Load all ciphers and digest algorithms when initializing the _ssl - extension, such that verification of some SSL certificates doesn't fail - because of an "unknown algorithm". - -- Issue #8437: Fix test_gdb failures, patch written by Dave Malcolm - -- Issue #4814: The timeout parameter is now applied also for connections - resulting from PORT/EPRT commands. - -- Issue #8463: Add missing reference to bztar in shutil's documentation. - -- Issue #8438: Remove reference to the missing "surrogateescape" encoding error - handler from the new IO library. - -- Issue #3817: ftplib.FTP.abort() method now considers 225 a valid response code - as stated in RFC-959 at chapter 5.4. - -- Issue #8279: Fix test_gdb failures. - -- Issue #8322: Add a *ciphers* argument to SSL sockets, so as to change the - available cipher list. Helps fix test_ssl with OpenSSL 1.0.0. - -- Issue #2987: RFC 2732 support for urlparse (IPv6 addresses). Patch by Tony - Locke and Hans Ulrich Niedermann. - -- Issue #7585: difflib context and unified diffs now place a tab between - filename and date, conforming to the 'standards' they were originally designed - to follow. This improves compatibility with patch tools. - -- Issue #7472: Fixed typo in email.encoders module; messages using ISO-2022 - character sets will now consistently use a Content-Transfer-Encoding of 7bit - rather than sometimes being marked as 8bit. - -- Issue #8330: Fix expected output in test_gdb. - -- Issue #8374: Update the internal alias table in the :mod:`locale` module to - cover recent locale changes and additions. - -Extension Modules ------------------ - -- Issue #8644: Improved accuracy of ``timedelta.total_seconds()``. - -- Use Clang 2.7's static analyzer to find places to clean up some code. - -- Build the ossaudio extension on GNU/kFreeBSD. - -- On Windows, ctypes no longer checks the stack before and after calling a - foreign function. This allows using the unmodified libffi library. - -Tests ------ - -- Issue #8672: Add a zlib test ensuring that an incomplete stream can be handled - by a decompressor object without errors (it returns incomplete uncompressed - data). - -- Issue #8490: asyncore now has a more solid test suite which actually tests its - API. - -- Issue #8576: Remove use of find_unused_port() in test_smtplib and - test_multiprocessing. Patch by Paul Moore. - -- Issue #7449: Fix many tests to support Python compiled without thread support. - Patches written by Jerry Seutter. - -- Issue #8108: test_ftplib's non-blocking SSL server now has proper handling of - SSL shutdowns. - -Build ------ - -- Issue #8625: Turn off optimization in ``--with-pydebug`` builds with gcc. - (Optimization was unintentionally turned on in gcc --with-pydebug builds in - 2.7 beta1 as a result of the issue #1628484 fix, combined with autoconf's - strange choice of default CFLAGS produced by AC_PROG_CC for gcc.) - -- Issue #8509: Fix quoting in help strings and code snippets in configure.in. - -- Issue #3646: It is now easily possible to install a Python framework into your - home directory on Mac OS X, see Mac/README for more information. - -- Issue #8510: Update to autoconf 2.65. - -Misc ----- - -- Update the Vim syntax highlight file. - - -What's New in Python 2.7 beta 1? -================================ - -*Release date: 2010-04-10* - -Core and Builtins ------------------ - -- Issue #7301: Add environment variable $PYTHONWARNINGS. - -- Issue #8329: Don't return the same lists from select.select when no fds are - changed. - -- Issue #8259: ``1L << (2**31)`` no longer produces an 'outrageous shift error' - on 64-bit machines. The shift count for either left or right shift is - permitted to be up to sys.maxsize. - -- Ensure that tokenization of identifiers is not affected by locale. - -- Issue #1222585: Added LDCXXSHARED for C++ support. Patch by Arfrever. - -- Raise a TypeError when trying to delete a T_STRING_INPLACE struct member. - -- Issue #7994: Issue a PendingDeprecationWarning if object.__format__ is called - with a non-empty format string. This is an effort to future-proof user - code. If a derived class does not currently implement __format__ but later - adds its own __format__, it would most likely break user code that had - supplied a format string. This will be changed to a DeprecationWarning in - Python 3.3 and it will be an error in Python 3.4. - -- Issue #8268: Old-style classes (not just instances) now support weak - references. - -- Issue #8211: Save/restore CFLAGS around AC_PROG_CC in configure.in, in case it - is set. - -- Issue #1583863: A unicode subclass can now override the __unicode__ method - -- Issue #6474: Make error message from passing an inadequate number of keyword - arguments to a function correct. - -- Issue #8164: Don't allow lambda functions to have a docstring. - -- Issue #3137: Don't ignore errors at startup, especially a keyboard interrupt - (SIGINT). If an error occurs while importing the site module, the error is - printed and Python exits. Initialize the GIL before importing the site - module. - -- Code objects now support weak references. - -Library -------- - -- Issue #5277: Fix quote counting when parsing RFC 2231 encoded parameters. - -- Issue #8321: Give access to OpenSSL version numbers from the `ssl` module, - using the new attributes `ssl.OPENSSL_VERSION`, `ssl.OPENSSL_VERSION_INFO` and - `ssl.OPENSSL_VERSION_NUMBER`. - -- Issue #8310: Allow dis to examine new style classes. - -- Issue #8257: The Decimal construct now accepts a float instance directly, - converting that float to a Decimal of equal value: - - >>> Decimal(1.1) - Decimal('1.100000000000000088817841970012523233890533447265625') - -- collections.Counter() now supports a subtract() method. - -- The functools module now has a total_ordering() class decorator to simplify - the specification of rich comparisons. - -- The functools module also adds cmp_to_key() as a tool to transition old-style - comparison functions to new-style key-functions. - -- Issue #8294: The Fraction constructor now accepts Decimal and float instances - directly. - -- Issue #7279: Comparisons involving a Decimal signaling NaN now signal - InvalidOperation instead of returning False. (Comparisons involving a quiet - NaN are unchanged.) Also, Decimal quiet NaNs are now hashable; Decimal - signaling NaNs remain unhashable. - -- Issue #2531: Comparison operations between floats and Decimal instances now - return a result based on the numeric values of the operands; previously they - returned an arbitrary result based on the relative ordering of id(float) and - id(Decimal). - -- Issue #8233: When run as a script, py_compile.py optionally takes a single - argument `-` which tells it to read files to compile from stdin. Each line is - read on demand and the named file is compiled immediately. (Original patch by - Piotr O?arowski). - -- Issue #3135: Add ``inspect.getcallargs()``, which binds arguments to a - function like a normal call. - -- Backwards incompatible change: Unicode codepoints line tabulation (0x0B) and - form feed (0x0C) are now considered linebreaks, as specified in Unicode - Standard Annex #14. See issue #7643. http://www.unicode.org/reports/tr14/ - -- Comparisons using one of <, <=, >, >= between a complex instance and a - Fractions instance now raise TypeError instead of returning True/False. This - makes Fraction <=> complex comparisons consistent with int <=> complex, float - <=> complex, and complex <=> complex comparisons. - -- Addition of ``WeakSet`` to the ``weakref`` module. - -- logging: Added LOG_FTP to SysLogHandler and updated documentation. - -- Issue #8205: Remove the "Modules" directory from sys.path when Python is - running from the build directory (POSIX only). - -- Issue #7667: Fix doctest failures with non-ASCII paths. - -- Issue #7512: shutil.copystat() could raise an OSError when the filesystem - didn't support chflags() (for example ZFS under FreeBSD). The error is now - silenced. - -- Issue #7703: ctypes supports both buffer() and memoryview(). The former is - deprecated. - -- Issue #7860: platform.uname now reports the correct 'machine' type when Python - is running in WOW64 mode on 64 bit Windows. - -- logging: Added getChild utility method to Logger and added isEnabledFor method - to LoggerAdapter. - -- Issue #8201: logging: Handle situation of non-ASCII and Unicode logger names - existing at the same time, causing a Unicode error when configuration code - attempted to sort the existing loggers. - -- Issue #8200: logging: Handle errors when multiprocessing is not fully loaded - when logging occurs. - -- Issue #3890, #8222: Fix recv() and recv_into() on non-blocking SSL sockets. - Also, enable the SSL_MODE_AUTO_RETRY flag on SSL sockets, so that blocking - reads and writes are always retried by OpenSSL itself. - -- Issue #8179: Fix macpath.realpath() on a non-existing path. - -- Issue #8024: Update the Unicode database to 5.2. - -- Issue #8104: socket.recv_into() and socket.recvfrom_into() now support writing - into objects supporting the new buffer API, for example bytearrays or - memoryviews. - -- Issue #4961: Inconsistent/wrong result of askyesno function in tkMessageBox - with Tcl/Tk-8.5. - -- Issue #8140: Extend compileall to compile single files. Add -i option. - -- Issue #7774: Set sys.executable to an empty string if ``argv[0]`` has been set - to a non existent program name and Python is unable to retrieve the real - program name. - -- Issue #8117: logging: Improved algorithm for computing initial rollover time - for ``TimedRotatingFileHandler`` by using the modification time of an existing - log file to compute the next rollover time. If the log file does not exist, - the current time is used as the basis for the computation. - -- Issue #6472: The ``xml.etree`` package is updated to ElementTree 1.3. The - cElementTree module is updated too. - -- Issue #7880: Fix sysconfig when the python executable is a symbolic link. - -- Issue #7624: Fix ``isinstance(foo(), collections.Callable)`` for old-style - classes. - -- Issue #7143: email: ``get_payload()`` used to strip any trailing newline from - a base64 transfer-encoded payload *after* decoding it; it no longer does. - This is a behavior change, so email's minor version number is now bumped, to - version 4.0.2, for the 2.7 release. - -- Issue #8235: _socket: Add the constant ``SO_SETFIB``. SO_SETFIB is - a socket option available on FreeBSD 7.1 and newer. - -- Issue #8038: unittest.TestCase.assertNotRegexpMatches - -- Addition of -b command line option to unittest for buffering stdout / stderr - during test runs. - -- Issue #1220212: Added os.kill support for Windows, including support for - sending CTRL+C and CTRL+BREAK events to console subprocesses. - -Extension Modules ------------------ - -- Issue #8314: Fix unsigned long long bug in libffi on Sparc v8. - -- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument. - -- Issue #8156: bsddb module updated to version 4.8.4. - http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.8.4. This update drops - support for Berkeley DB 4.0, and adds support for 4.8. - -- Issue #3928: os.mknod() now available in Solaris, also. - -- Issue #8142: Update libffi to the 3.0.9 release. - -- Issue #8300: When passing a non-integer argument to struct.pack with any - integer format code, struct.pack first attempts to convert the non-integer - using its __index__ method. If that method is non-existent or raises - TypeError it goes on to try the __int__ method, as described below. - -- Issue #1530559: When passing a non-integer argument to struct.pack with *any* - integer format code (one of 'bBhHiIlLqQ'), struct.pack attempts to use the - argument's __int__ method to convert to an integer before packing. It also - produces a DeprecationWarning in this case. (In Python 2.6, the behaviour was - inconsistent: __int__ was used for some integer codes but not for others, and - the set of integer codes for which it was used differed between native packing - and standard packing.) - -- Issue #7347: _winreg: Add CreateKeyEx and DeleteKeyEx, as well as fix a bug in - the return value of QueryReflectionKey. - -Tools/Demos ------------ - -- Issue #7993: Add a test of IO packet processing bandwidth to ccbench. It - measures the number of UDP packets processed per second depending on the - number of background CPU-bound Python threads. - -- python-config now supports multiple options on the same command line. - -Build ------ - -- Issue #8032: For gdb7, a python-gdb.py file is added to the build, allowing to - use advanced gdb features when debugging Python. - -- Issue #1628484: The Makefile doesn't ignore the CFLAGS environment variable - anymore. It also forwards the LDFLAGS settings to the linker when building a - shared library. - -- Issue #6716: Quote -x arguments of compileall in MSI installer. - -- Issue #7705: Fix linking on FreeBSD. - -- Make sure that the FreeBSD build of the included libffi uses the proper - assembly file. - -C-API ------ - -- Issue #8276: PyEval_CallObject() is now only available in macro form. The - function declaration, which was kept for backwards compatibility reasons, is - now removed (the macro was introduced in 1997!). - -- Issue #7992: A replacement PyCObject API, PyCapsule, has been backported from - Python 3.1. All existing Python CObjects in the main distribution have been - converted to capsules. To address backwards-compatibility concerns, - PyCObject_AsVoidPtr() was changed to understand capsules. - -Tests ------ - -- Issue #3864: Skip three test_signal tests on freebsd6 because they fail if any - thread was previously started, most likely due to a platform bug. - -- Issue #8348: Fix test ftp url in test_urllib2net. - -- Issue #8204: Fix test_ttk notebook test by forcing focus. - -- Issue #8344: Fix test_ttk bug on FreeBSD. - -- Issue #8193: Fix test_zlib failure with zlib 1.2.4. - -- Issue #8248: Add some tests for the bool type. Patch by Gregory Nofi. - -- Issue #8263: Now regrtest.py will report a failure if it receives a - KeyboardInterrupt (SIGINT). - -- Issue #8180 and #8207: Fix test_pep277 on OS X and add more tests for special - Unicode normalization cases. - -- Issue #7783: test.test_support.open_urlresource invalidates the outdated files - from the local cache. - - -What's New in Python 2.7 alpha 4? -================================= - -*Release date: 2010-03-06* - -Core and Builtins ------------------ - -- Issue #7544: Preallocate thread memory before creating the thread to avoid a - fatal error in low memory condition. - -- Issue #7820: The parser tokenizer restores all bytes in the right if the BOM - check fails. - -- Issue #7309: Fix unchecked attribute access when converting - UnicodeEncodeError, UnicodeDecodeError, and UnicodeTranslateError to strings. - -- Issue #7649: "u'%c' % char" now behaves like "u'%s' % char" and raises a - UnicodeDecodeError if 'char' is a byte string that can't be decoded using the - default encoding. - -- Issue #6902: Fix problem with built-in types format incorrectly with 0 - padding. - -- Issue #2560: Remove an unnecessary 'for' loop from ``my_fgets()`` in - Parser/myreadline.c. - -- Issue #7988: Fix default alignment to be right aligned for - ``complex.__format__``. Now it matches other numeric types. - -- Issue #5211: The complex type no longer uses implicit coercion in mixed-type - binary arithmetic operations. - -Library -------- - -- Issue #7904: Changes to urllib.parse.urlsplit to handle schemes as defined by - RFC3986. Anything before :// is considered a scheme and is followed by an - authority (or netloc) and by '/' led path, which is optional. - -- Issue #1555570: email no longer inserts extra blank lines when a \r\n - combo crosses an 8192 byte boundary. - -- Issue #6906: Tk should not set Unicode environment variables on Windows. - -- Issue #1054943: Fix ``unicodedata.normalize('NFC', text)`` for the Public - Review Issue #29 (http://unicode.org/review/pr-29.html). - -- Issue #7494: Fix a crash in ``_lsprof`` (cProfile) after clearing the profiler, - reset also the pointer to the current pointer context. - -- Issue #7232: Add support for the context management protocol to the - ``tarfile.TarFile`` class. - -- Issue #7250: Fix info leak of os.environ across multi-run uses of - ``wsgiref.handlers.CGIHandler``. - -- Issue #1729305: Fix doctest to handle encode error with "backslashreplace". - -- Issue #691291: ``codecs.open()`` should not convert end of lines on reading - and writing. - -- Issue #7975: Correct regression in dict methods supported by bsddb.dbshelve. - -- Issue #7959: ctypes callback functions are now registered correctly with the - cycle garbage collector. - -- Issue #7970: ``email.Generator.flatten`` now correctly flattens - message/rfc822 messages parsed by ``email.Parser.HeaderParser``. - -- Issue #3426: ``os.path.abspath`` now returns unicode when its arg is unicode. - -- Issue #7633: In the decimal module, ``Context`` class methods (with the - exception of canonical and is_canonical) now accept instances of int and long - wherever a Decimal instance is accepted, and implicitly convert that argument - to Decimal. Previously only some arguments were converted. - -- Issue #6003: Add an argument to ``zipfile.Zipfile.writestr`` to specify the - compression type. - -- Issue #7893: ``unittest.TextTestResult`` is made public and a ``resultclass`` - argument added to the TextTestRunner constructor allowing a different result - class to be used without having to subclass. - -- Issue #7588: ``unittest.TextTestResult.getDescription`` now includes the test - name in failure reports even if the test has a docstring. - -- Issue #5801: Remove spurious empty lines in wsgiref. - -- Issue #1537721: Add a ``writeheader()`` method to ``csv.DictWriter``. - -- Issue #7427: Improve the representation of httplib.BadStatusLine exceptions. - -- Issue #7481: When a ``threading.Thread`` failed to start it would leave the - instance stuck in initial state and present in ``threading.enumerate()``. - -- Issue #1068268: The subprocess module now handles EINTR in internal - ``os.waitpid()`` and ``os.read()`` system calls where appropriate. - -- Issue #6729: Add ``ctypes.c_ssize_t`` to represent ssize_t. - -- Issue #6247: The argparse module has been added to the standard library. - -Extension Modules ------------------ - -- The sqlite3 module was updated to pysqlite 2.6.0. This fixes several obscure - bugs and allows loading SQLite extensions from shared libraries. - -- Issue #7808: Fix reference leaks in _bsddb and related tests. - -- Issue #6544: Fix a reference leak in the kqueue implementation's error - handling. - -- Stop providing crtassem.h symbols when compiling with Visual Studio 2010, as - msvcr100.dll is not a platform assembly anymore. - -- Issue #7242: On Solaris 9 and earlier calling ``os.fork()`` from within a - thread could raise an incorrect RuntimeError about not holding the import - lock. The import lock is now reinitialized after fork. - -- Issue #7999: ``os.setreuid()`` and ``os.setregid()`` would refuse to accept a - -1 parameter on some platforms such as OS X. - -Tests ------ - -- Issue #7849: The utility ``test.test_support.check_warnings()`` verifies if - warnings are effectively raised. A new utility ``check_py3k_warnings()`` is - available. - -- The four path modules (genericpath, macpath, ntpath, posixpath) share a - common TestCase for some tests: test_genericpath.CommonTest. - -- Print platform information when running the whole test suite, or using the - ``--verbose`` flag. - -- Issue #767675: Enable test_pep277 on POSIX platforms with Unicode-friendly - filesystem encoding. - -- Issue #6292: For the moment at least, the test suite runs cleanly if python - is run with the -OO flag. Tests requiring docstrings are skipped. - -- Issue #7712: test_support gained a new ``temp_cwd`` context manager which is - now also used by regrtest to run all the tests in a temporary directory. The - original CWD is saved in ``test.test_support.SAVEDCWD``. Thanks to Florent - Xicluna who helped with the patch. - -Build ------ - -- Issue #3920, #7903: Define _BSD_SOURCE on OpenBSD 4.4 through 4.9. - - -What's New in Python 2.7 alpha 3? -================================= - -*Release date: 2010-02-06* - -Core and Builtins ------------------ - -- Issue #5677: Explicitly forbid write operations on read-only file objects, - and read operations on write-only file objects. On Windows, the system C - library would return a bogus result; on Solaris, it was possible to crash the - interpreter. Patch by Stefan Krah. - -- Issue #7853: Normalize exceptions before they are passed to a context - manager's ``__exit__()`` method. - -- Issue #7385: Fix a crash in ``PyMemoryView_FromObject()`` when - ``PyObject_GetBuffer()`` fails. Patch by Florent Xicluna. - -- Issue #7819: Check ``sys.call_tracing()`` arguments types. - -- Issue #7788: Fix an interpreter crash produced by deleting a list slice with - very large step value. - -- Issue #7766: Change ``sys.getwindowsversion()`` return value to a named tuple - and add the additional members returned in an OSVERSIONINFOEX structure. The - new members are service_pack_major, service_pack_minor, suite_mask, and - product_type. - -- Issue #7561: Operations on empty bytearrays (such as ``int(bytearray())``) - could crash in many places because of the ``PyByteArray_AS_STRING()`` macro - returning NULL. The macro now returns a statically allocated empty string - instead. - -- Issue #7622: Improve the split(), rsplit(), splitlines() and replace() - methods of bytes, bytearray and unicode objects by using a common - implementation based on stringlib's fast search. Patch by Florent Xicluna. - -- Issue #7632: Fix various str -> float conversion bugs present in 2.7 alpha 2, - including: - - (1) a serious 'wrong output' bug that could occur for long (> 40 digit) input - strings, - (2) a crash in dtoa.c that occurred in debug builds when parsing certain long - numeric strings corresponding to subnormal values, - (3) a memory leak for some values large enough to cause overflow, and - (4) a number of flaws that could lead to incorrectly rounded results. - -- Issue #7319, #7770: Silence ``DeprecationWarning`` by default when the -3 - option is not used. - -- Issue #2335: Backport set literals syntax from Python 3.x. - -- Issue #2333: Backport set and dict comprehensions syntax from Python 3.x. - -- Issue #1967: Backport dictionary views from Python 3.x. - -Library -------- - -- Issue #9137: Fix issue in MutableMapping.update, which incorrectly - treated keyword arguments called 'self' or 'other' specially. - -- Issue #7835: shelve should no longer produce mysterious warnings during - interpreter shutdown. - -- Issue #2746: Don't escape ampersands and angle brackets ("&", "<", ">") in - XML processing instructions and comments. These raw characters are allowed - by the XML specification, and are necessary when outputting e.g. PHP code in - a processing instruction. Patch by Neil Muller. - -- Issue #7869: logging: Improved diagnostic for format-time errors. - -- Issue #7868: logging: Added loggerClass attribute to Manager. - -- Issue #7851: logging: Clarification on logging configuration files. - -- Issue #4772: Raise a ValueError when an unknown Bluetooth protocol is - specified, rather than fall through to AF_PACKET (in the ``socket`` module). - Also, raise ValueError rather than TypeError when an unknown TIPC address - type is specified. Patch by Brian Curtin. - -- logging: Implemented PEP 391. - -- Issue #6939: Fix file I/O objects in the `io` module to keep the original - file position when calling `truncate()`. It would previously change the file - position to the given argument, which goes against the tradition of - ftruncate() and other truncation APIs. Patch by Pascal Chambon. - -- Issue #7610: Reworked implementation of the internal ``zipfile.ZipExtFile`` - class used to represent files stored inside an archive. The new - implementation is significantly faster and can be wrapped in an - ``io.BufferedReader`` object for more speedups. It also solves an issue - where interleaved calls to ``read()`` and ``readline()`` give wrong results. - Patch by Nir Aides. - -- Issue #7792: Registering non-classes to ABCs raised an obscure error. - -- Removed the deprecated functions ``verify()`` and ``vereq()`` from - Lib/test/test_support.py. - -- Issue #7773: Fix an UnboundLocalError in ``platform.linux_distribution()`` - when the release file is empty. - -- Issue #7748: Since unicode values are supported for some metadata options in - Distutils, the DistributionMetadata get_* methods will now return a utf-8 - encoded string for them. This ensures that the upload and register commands - send the correct values to PyPI without any error. - -- Issue #1670765: Prevent ``email.generator.Generator`` from re-wrapping - headers in multipart/signed MIME parts, which fixes one of the sources of - invalid modifications to such parts by Generator. - -- Issue #7701: Fix crash in ``binascii.b2a_uu()`` in debug mode when given a - 1-byte argument. Patch by Victor Stinner. - -- Issue #3299: Fix possible crash in the _sre module when given bad argument - values in debug mode. Patch by Victor Stinner. - -- Issue #7703: Add support for the new buffer API to functions of the binascii - module. Backported from py3k by Florent Xicluna, with some additional tests. - -- Issue #2846: Add support for gzip.GzipFile reading zero-padded files. Patch - by Brian Curtin. - -- Issue #5827: Make sure that normpath preserves unicode. Initial patch by - Matt Giuca. - -- Issue #5372: Drop the reuse of .o files in Distutils' ccompiler (since - Extension extra options may change the output without changing the .c file). - Initial patch by Collin Winter. - -Extension Modules ------------------ - -- Expat: Fix DoS via XML document with malformed UTF-8 sequences - (CVE_2009_3560). - -Build ------ - -- Issue #7632: When Py_USING_MEMORY_DEBUGGER is defined, disable the private - memory allocation scheme in dtoa.c and use PyMem_Malloc and PyMem_Free - instead. Also disable caching of powers of 5. - -- Issue #7658: Ensure that the new pythonw executable works on OSX 10.4 - -- Issue #7714: Use ``gcc -dumpversion`` to detect the version of GCC on - MacOSX. - -- Issue #7661: Allow ctypes to be built from a non-ASCII directory path. - Patch by Florent Xicluna. - -Tools/Demos ------------ - -- iobench (a file I/O benchmark) and ccbench (a concurrency benchmark) were - added to the ``Tools`` directory. They were previously living in the - sandbox. - -Tests ------ - -- Issue #7728: test_timeout was changed to use ``test_support.bind_port()`` - instead of a hard coded port. - -Documentation -------------- - -- Updated "Using Python" documentation to include description of CPython's -J, - -U and -X options. - -- Updated Python manual page (options -B, -O0, -s, environment variables - PYTHONDONTWRITEBYTECODE, PYTHONNOUSERSITE). - - -What's New in Python 2.7 alpha 2? -================================= - -*Release date: 2010-01-09* - -Core and Builtins ------------------ - -- The ``__complex__()`` method is now looked up on the class of instances to - make it consistent with other special methods. - -- Issue #7462: Implement the stringlib fast search algorithm for the `rfind`, - `rindex`, `rsplit` and `rpartition` methods. Patch by Florent Xicluna. - -- Issue #5080: A number of functions and methods previously produced a - DeprecationWarning when passed a float argument where an integer was expected. - These functions and methods now raise TypeError instead. The majority of the - effects of this change are in the extension modules, but some core functions - and methods are affected: notably the 'chr', 'range' and 'xrange' builtins, - and many unicode/str methods. - -- Issue #7604: Deleting an unset slotted attribute did not raise an - AttributeError. - -- Issue #7534: Fix handling of IEEE specials (infinities, nans, negative zero) - in ** operator. The behaviour now conforms to that described in C99 Annex F. - -- Issue #7579: The msvcrt module now has docstrings for all its functions. - -- Issue #7413: Passing '\0' as the separator to datetime.datetime.isoformat() - used to drop the time part of the result. - -- Issue #1811: Improve accuracy and cross-platform consistency for true division - of integers: the result of a/b is now correctly rounded for ints a and b (at - least on IEEE 754 platforms), and in particular does not depend on the - internal representation of a long. - -- Issue #6108: ``unicode(exception)`` and ``str(exception)`` should return the - same message when only ``__str__()`` (and not ``__unicode__()``) is overridden - in the subclass. - -- Issue #6834: Replace the implementation for the 'python' and 'pythonw' - executables on OSX. - - These executables now work properly with the arch(1) command: ``arch -ppc - python`` will start a universal binary version of python in PPC mode (unlike - previous releases). - -- Issue #1680159: Unicode coercion during an 'in' operation no longer masks the - underlying error when the coercion fails for the left hand operand. - -- Issue #7491: Metaclass's __cmp__ method was ignored. - -- Issue #7466: Segmentation fault when the garbage collector is called in the - middle of populating a tuple. Patch by Florent Xicluna. - -Library -------- - -- Issue #6963: Added "maxtasksperchild" argument to ``multiprocessing.Pool``, - allowing for a maximum number of tasks within the pool to be completed by the - worker before that worker is terminated, and a new one created to replace it. - -- Issue #7617: Make sure distutils.unixccompiler.UnixCCompiler recognizes gcc - when it has a fully qualified configuration prefix. Initial patch by - Arfrever. - -- Issue #7092: Remove py3k warning when importing cPickle. 2to3 handles - renaming of `cPickle` to `pickle`. The warning was annoying since there's no - alternative to cPickle if you care about performance. Patch by Florent - Xicluna. - -- Issue #7455: Fix possible crash in cPickle on invalid input. Patch by Victor - Stinner. - -- Issue #7092: Fix the DeprecationWarnings emitted by the standard library when - using the -3 flag. Patch by Florent Xicluna. - -- Issue #7471: Improve the performance of GzipFile's buffering mechanism, and - make it implement the ``io.BufferedIOBase`` ABC to allow for further speedups - by wrapping it in an ``io.BufferedReader``. Patch by Nir Aides. - -- Issue #3972: ``httplib.HTTPConnection`` now accepts an optional source_address - parameter to allow specifying where your connections come from. - -- ``socket.create_connection()`` now accepts an optional source_address - parameter. - -- Issue #5511: ``zipfile.ZipFile`` can now be used as a context manager. - Initial patch by Brian Curtin. - -- Distutils now correctly identifies the build architecture as "x86_64" when - building on OSX 10.6 without "-arch" flags. - -- Issue #7556: Distutils' msvc9compiler now opens the MSVC Manifest file in text - mode. - -- Issue #7552: Removed line feed in the base64 Authorization header in the - Distutils upload command to avoid an error when PyPI reads it. This occurs on - long passwords. Initial patch by JP St. Pierre. - -- Issue #7231: urllib2 cannot handle https with proxy requiring auth. Patch by - Tatsuhiro Tsujikawa. - -- Issue #7349: Make methods of file objects in the io module accept None as an - argument where file-like objects (ie StringIO and BytesIO) accept them to mean - the same as passing no argument. - -- Issue #7348: ``StringIO.StringIO.readline(-1)`` now acts as if it got no - argument like other file objects. - -- Issue #7357: tarfile no longer suppresses fatal extraction errors by default. - -- Issue #7470: logging: Fix bug in Unicode encoding fallback. - -- Issue #5949: Fixed IMAP4_SSL hang when the IMAP server response is missing - proper end-of-line termination. - -- Issue #7457: Added a read_pkg_file method to - ``distutils.dist.DistributionMetadata``. - -- Issue #3745: Undo the 2.7a1 change to have hashlib to reject unicode and non - buffer API supporting objects as input. That behavior is for 3.x only. - -C-API ------ - -- Issue #7767: New function ``PyLong_AsLongLongAndOverflow()`` added, analogous - to ``PyLong_AsLongAndOverflow()``. - -- Issue #5080: The argument parsing functions ``PyArg_ParseTuple()``, - ``PyArg_ParseTupleAndKeywords()``, ``PyArg_VaParse()``, - ``PyArg_VaParseTupleAndKeywords()`` and ``PyArg_Parse()`` no longer accept - float arguments for integer format codes (other than 'L'): previously an - attempt to pass a float resulted in a DeprecationWarning; now it gives a - TypeError. For the 'L' format code (which previously had no warning) there is - now a DeprecationWarning. - -- Issue #7033: Function ``PyErr_NewExceptionWithDoc()`` added. - -Build ------ - -- Issue #6491: Allow --with-dbmliborder to specify that no dbms will be built. - -- Issue #6943: Use pkg-config to find the libffi headers when the - ``--with-system-ffi`` flag is used. - -- Issue #7609: Add a ``--with-system-expat`` option that causes the system's - expat library to be used for the pyexpat module instead of the one included - with Python. - -- Issue #7589: Only build the nis module when the correct header files are - found. - -- Switch to OpenSSL 0.9.8l and sqlite 3.6.21 on Windows. - -- Issue #7541: when using ``python-config`` with a framework install the - compiler might use the wrong library. - -Tests ------ - -- Issue #7376: Instead of running a self-test (which was failing) when called - with no arguments, doctest.py now gives a usage message. - -- Issue #7396: Fix regrtest -s, which was broken by the -j enhancement. - -- Issue #7498: test_multiprocessing now uses test_support.find_unused_port - instead of a hardcoded port number in test_rapid_restart. - - -What's New in Python 2.7 alpha 1 -================================ - -*Release date: 2009-12-05* - -Core and Builtins ------------------ - -- Issue #7419: ``locale.setlocale()`` could crash the interpreter on Windows - when called with invalid values. - -- Issue #3382: 'F' formatting for float and complex now convert the result to - upper case. This only affects 'inf' and 'nan', since 'f' no longer converts - to 'g' for large values. - -- Remove switch from "%f" formatting to "%g" formatting for floats larger than - 1e50 in absolute value. - -- Remove restrictions on precision when formatting floats. E.g., "%.120g" % - 1e-100 used to raise OverflowError, but now gives the requested 120 - significant digits instead. - -- Add Py3k warnings for parameter names in parentheses. - -- Issue #7362: Give a proper error message for ``def f((x)=3): pass``. - -- Issue #7085: Fix crash when importing some extensions in a thread on MacOSX - 10.6. - -- Issue #7117: ``repr(x)`` for a float x returns a result based on the shortest - decimal string that's guaranteed to round back to x under correct rounding - (with round-half-to-even rounding mode). Previously it gave a string based on - rounding x to 17 decimal digits. repr(x) for a complex number behaves - similarly. On platforms where the correctly-rounded strtod and dtoa code is - not supported (see below), repr is unchanged. - -- Issue #7117: On almost all platforms: float-to-string and string-to-float - conversions within Python are now correctly rounded. Places these conversions - occur include: str for floats and complex numbers; the float and complex - constructors; old-style and new-style numeric formatting; serialization and - deserialization of floats and complex numbers using marshal, pickle and json; - parsing of float and imaginary literals in Python code; Decimal-to-float - conversion. - - The conversions use a Python-adapted version of David Gay's well-known dtoa.c, - providing correctly-rounded strtod and dtoa C functions. This code is - supported on Windows, and on Unix-like platforms using gcc, icc or suncc as - the C compiler. There may be a small number of platforms on which correct - operation of this code cannot be guaranteed, so the code is not used: notably, - this applies to platforms where the C double format is not IEEE 754 binary64, - and to platforms on x86 hardware where the x87 FPU is set to 64-bit precision - and Python's configure script is unable to determine how to change the FPU - precision. On these platforms conversions use the platform strtod and dtoa, - as before. - -- Issue #7117: Backport round implementation from Python 3.x. ``round()`` now - uses the correctly-rounded string <-> float conversions described above (when - available), and so produces correctly rounded results that will display nicely - under the float repr. There are two related small changes: (1) round now - accepts any class with an ``__index__()`` method for its second argument (but - no longer accepts floats for the second argument), and (2) an excessively - large second integer argument (e.g., ``round(1.234, 10**100)``) no longer - raises an exception. - -- Issue #1757126: Fix the cyrillic-asian alias for the ptcp154 encoding. - -- Fix several issues with ``compile()``. The input can now contain Windows and - Mac newlines and is no longer required to end in a newline. - -- Remove length limitation when constructing a complex number from a unicode - string. - -- Issue #7244: ``itertools.izip_longest()`` no longer ignores exceptions raised - during the formation of an output tuple. - -- Issue #1087418: Boost performance of bitwise operations for longs. - -- Issue #1722344: ``threading._shutdown()`` is now called in ``Py_Finalize()``, - which fixes the problem of some exceptions being thrown at shutdown when the - interpreter is killed. Patch by Adam Olsen. - -- Issue #7168: Document ``PyFloat_AsString()`` and ``PyFloat_AsReprString()``, - and note that they are unsafe and deprecated. - -- Issue #7120: logging: Remove import of multiprocessing which is causing crash - in GAE. - -- Issue #7140: The ``__dict__`` of a module should not be cleared unless the - module is the only object holding a reference to it. - -- Issue #1754094: Improve the stack depth calculation in the compiler. There - should be no other effect than a small decrease in memory use. Patch by - Christopher Tur Lesniewski-Laas. - -- Issue #7084: Fix a (very unlikely) crash when printing a list from one thread, - and mutating it from another one. Patch by Scott Dial. - -- Issue #1571184: The Unicode database contains properties for more characters. - The tables for code points representing numeric values, white spaces or line - breaks are now generated from the official Unicode Character Database files, - and include information from the Unihan.txt file. - -- Issue #7050: Fix a SystemError when trying to use unpacking and augmented - assignment. - -- Issue #5329: Fix ``os.popen*`` regression from 2.5 with commands as a sequence - running through the shell. Patch by Jean-Paul Calderone and Jani Hakala. - -- Issue #7019: Raise ValueError when unmarshalling bad long data, instead of - producing internally inconsistent Python longs. - -- Issue #6990: Fix ``threading.local`` subclasses leaving old state around after - a reference cycle GC which could be recycled by new locals. - -- Issue #6300: unicode.encode, unicode.decode, str.decode, and str.encode now - take keyword arguments. - -- Issue #6922: Fix an infinite loop when trying to decode an invalid UTF-32 - stream with a non-raising error handler like "replace" or "ignore". - -- Issue #6713: Improve performance of base 10 int -> string and long -> string - conversions. - -- Issue #1590864: Fix potential deadlock when mixing threads and fork(). - -- Issue #6844: Do not emit DeprecationWarnings when accessing a "message" - attribute on exceptions that was set explicitly. - -- Issue #6846: Fix bug where bytearray.pop() returns negative integers. - -- ``classmethod()`` no longer checks if its argument is callable. - -- Issue #6750: A text file opened with ``io.open()`` could duplicate its output - when writing from multiple threads at the same time. - -- Issue #6704: Improve the col_offset in AST for "for" statements with a target - of tuple unpacking. - -- Issue #6707: ``dir()`` on an uninitialized module caused a crash. - -- Issue #6540: Fixed crash for ``bytearray.translate()`` with invalid parameters. - -- Issue #6573: ``set.union()`` stopped processing inputs if an instance of self - occurred in the argument chain. - -- Issue #1616979: Added the cp720 (Arabic DOS) encoding. - -- Issue #6070: On posix platforms import no longer copies the execute bit from - the .py file to the .pyc file if it is set. Patch by Marco N. - -- Issue #4618: When unicode arguments are passed to ``print()``, the default - separator and end should be unicode also. - -- Issue #6119: Fixed an incorrect Py3k warning about order comparisons of - built-in functions and methods. - -- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h. This fixes a - build failure on HP-UX: int32_t and uint32_t are defined in inttypes.h instead - of stdint.h on that platform. - -- Issue #4856: Remove checks for win NT. - -- Issue #2016: Fixed a crash in a corner case where the dictionary of keyword - arguments could be modified during the function call setup. - -- Removed the ipaddr module. - -- Issue #6329: Fixed iteration for memoryview objects (it was being blocked - because it wasn't recognized as a sequence). - -- Issue #6289: Encoding errors from ``compile()`` were being masked. - -- When no module is given in a relative import, the module field of the - ImportFrom AST node is now None instead of an empty string. - -- Assignment to None using import statements now raises a SyntaxError. - -- Issue #4547: When debugging a very large function, it was not always possible - to update the lineno attribute of the current frame. - -- Issue #5330: C functions called with keyword arguments were not reported by - the various profiling modules (profile, cProfile). Patch by Hagen F?rstenau. - -- Issue #5982: staticmethod and classmethod now expose the wrapped function with - ``__func__``. - -- Added support for multiple context managers in the same with-statement. - Deprecated ``contextlib.nested()`` which is no longer needed. - -- Issue #6101: A new opcode, SETUP_WITH, has been added to speed up the with - statement and correctly lookup the __enter__ and __exit__ special methods. - -- Issue #5829: complex("1e500") no longer raises OverflowError. This makes it - consistent with float("1e500") and interpretation of real and imaginary - literals. - -- Issue #3527: Removed Py_WIN_WIDE_FILENAMES which is not used any more. - -- ``__instancecheck__()`` and ``__subclasscheck__()`` are now completely ignored - on classic classes and instances. - -- Issue #5994: The marshal module now has docstrings. - -- Issue #5981: Fix three minor inf/nan issues in float.fromhex: - - (1) inf and nan strings with trailing whitespace were incorrectly rejected; - (2) parsing of strings representing infinities and nans was locale aware; and - (3) the interpretation of fromhex('-nan') didn't match that of float('-nan'). - -- Issue #5920: For ``float.__format__()``, change the behavior with the empty - presentation type (that is, not one of 'e', 'f', 'g', or 'n') to be like 'g' - but with at least one decimal point and with a default precision - of 12. Previously, the behavior the same but with a default precision of 6. - This more closely matches ``str()``, and reduces surprises when adding - alignment flags to the empty presentation type. This also affects the new - complex.__format__ in the same way. - -- Issue #5890: In subclasses of 'property' the __doc__ attribute was shadowed by - classtype's, even if it was None. property now inserts the __doc__ into the - subclass instance __dict__. - -- Issue #4426: The UTF-7 decoder was too strict and didn't accept some legal - sequences. Patch by Nick Barnes and Victor Stinner. - -- Issue #1588: Add complex.__format__. For example, ``format(complex(1, 2./3), - '.5')`` now produces a sensible result. - -- Issue #5864: Fix empty format code formatting for floats so that it never - gives more than the requested number of significant digits. - -- Issue #5793: Rationalize isdigit / isalpha / tolower, etc. Includes new - Py_ISDIGIT / Py_ISALPHA / Py_TOLOWER, etc. in pctypes.h. - -- Issue #4971: Fix titlecase for characters that are their own titlecase, but - not their own uppercase. - -- Issue #5835: Deprecate PyOS_ascii_formatd and replace it with - _PyOS_double_to_string or PyOS_double_to_string. - -- Issue #5283: Setting __class__ in __del__ caused a segfault. - -- Issue #5816: ``complex(repr(z))`` now recovers z exactly, even when z involves - nans, infs or negative zeros. - -- Implement PEP 378, Format Specifier for Thousands Separator, for floats, ints, - and longs. - -- Issue #5515: 'n' formatting for ints, longs, and floats handles leading zero - formatting poorly. - -- Issue #5772: For float.__format__, don't add a trailing ".0" if we're using no - type code and we have an exponent. - -- Issue #3166: Make long -> float (and int -> float) conversions correctly - rounded. - -- Issue #5787: ``object.__getattribute__(some_type, "__bases__")`` segfaulted on - some built-in types. - -- Issue #1869: Fix a couple of minor round() issues. ``round(5e15+1)`` was - giving 5e15+2; ``round(-0.0)`` was losing the sign of the zero. - -- Issue #5759: float() didn't call __float__ on str subclasses. - -- Issue #5704: The "-3" command-line option now implies "-t". - -- Issue #2170: Refactored ``xml.dom.minidom.normalize``, increasing both its - clarity and its speed. - -- Issue #2396: The memoryview object was backported from Python 3.1. - -- Fix a problem in PyErr_NormalizeException that leads to "undetected errors" - when hitting the recursion limit under certain circumstances. - -- Issue #1665206: Remove the last eager import in _warnings.c and make it lazy. - -- Issue #4865: On MacOSX /Library/Python/2.7/site-packages is added to the end - sys.path, for compatibility with the system install of Python. - -- Issue #4688: Add a heuristic so that tuples and dicts containing only - untrackable objects are not tracked by the garbage collector. This can reduce - the size of collections and therefore the garbage collection overhead on - long-running programs, depending on their particular use of datatypes. - -- Issue #5512: Rewrite PyLong long division algorithm (x_divrem) to improve its - performance. Long divisions and remainder operations are now between 50% and - 150% faster. - -- Issue #4258: Make it possible to use base 2**30 instead of base 2**15 for the - internal representation of integers, for performance reasons. Base 2**30 is - enabled by default on 64-bit machines. Add --enable-big-digits option to - configure, which overrides the default. Add sys.long_info structseq to - provide information about the internal format. - -- Issue #4034: Fix weird attribute error messages of the traceback object. (As a - result traceback.__members__ no longer exists.) - -- Issue #4474: PyUnicode_FromWideChar now converts characters outside the BMP to - surrogate pairs, on systems with sizeof(wchar_t) == 4 and sizeof(Py_UNICODE) - == 2. - -- Issue #5237: Allow auto-numbered fields in str.format(). For example: ``'{} - {}'.format(1, 2) == '1 2'``. - -- Issue #3652: Make the 'line' argument for ``warnings.showwarning()`` a - requirement. Means the DeprecationWarning from Python 2.6 can go away. - -- Issue #5247: Improve error message when unknown format codes are used when - using ``str.format()`` with str, unicode, long, int, and float arguments. - -- Running Python with the -3 option now also warns about classic division for - ints and longs. - -- Issue #5260: Long integers now consume less memory: average saving is 2 bytes - per long on a 32-bit system and 6 bytes per long on a 64-bit system. - -- Issue #5186: Reduce hash collisions for objects with no __hash__ method by - rotating the object pointer by 4 bits to the right. - -- Issue #4575: Fix Py_IS_INFINITY macro to work correctly on x87 FPUs: it now - forces its argument to double before testing for infinity. - -- Issue #4978: Passing keyword arguments as unicode strings is now allowed. - -- Issue #1242657: the __len__() and __length_hint__() calls in several tools - were suppressing all exceptions. These include list(), filter(), map(), - zip(), and bytearray(). - -- os.ftruncate raises OSErrors instead of IOErrors for consistency with other os - functions. - -- Issue #4991: Passing invalid file descriptors to io.FileIO now raises an - OSError. - -- Issue #4807: Port the _winreg module to Windows CE. - -- Issue #4935: The overflow checking code in the expandtabs() method common to - str, bytes and bytearray could be optimized away by the compiler, letting the - interpreter segfault instead of raising an error. - -- Issue #3720: Fix a crash when an iterator modifies its class and removes its - __next__ method. - -- Issue #4893: Use NT threading on CE. - -- Issue #4915: Port sysmodule to Windows CE. - -- Issue #4074: Change the criteria for doing a full garbage collection (i.e. - collecting the oldest generation) so that allocating lots of objects without - destroying them does not show quadratic performance. Based on a proposal by - Martin von L?wis at - http://mail.python.org/pipermail/python-dev/2008-June/080579.html. - -- Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t. - -- Issue #1180193: When importing a module from a .pyc (or .pyo) file with an - existing .py counterpart, override the co_filename attributes of all code - objects if the original filename is obsolete (which can happen if the file has - been renamed, moved, or if it is accessed through different paths). Patch by - Ziga Seilnacht and Jean-Paul Calderone. - -- Issue #4075: Use ``OutputDebugStringW()`` in Py_FatalError. - -- Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open - file with `str' filename on Windows. - -- Issue #3680: Reference cycles created through a dict, set or deque iterator - did not get collected. - -- Issue #4701: PyObject_Hash now implicitly calls PyType_Ready on types where - the tp_hash and tp_dict slots are both NULL. - -- Issue #4764: With io.open, IOError.filename is set when trying to open a - directory on POSIX systems. - -- Issue #4764: IOError.filename is set when trying to open a directory on POSIX - systems. - -- Issue #4759: None is now allowed as the first argument of - ``bytearray.translate()``. It was always allowed for ``bytes.translate()``. - -- Added test case to ensure attempts to read from a file opened for writing - fail. - -- Issue #2467: gc.DEBUG_STATS reported invalid elapsed times. Also, always print - elapsed times, not only when some objects are uncollectable/unreachable. - Original patch by Neil Schemenauer. - -- Issue #3439: Add a bit_length method to int and long. - -- Issue #2183: Simplify and optimize bytecode for list comprehensions. Original - patch by Neal Norwitz. - -- Issue #4597: Fixed exception handling when the __exit__ function of a context - manager returns a value that cannot be converted to a bool. - -- Issue #4597: Fixed several opcodes that weren't always propagating exceptions. - -- Issue #4445: Replace ``sizeof(PyStringObject)`` with - ``offsetof(PyStringObject, ob_sval) + 1`` when allocating memory for str - instances. On a typical machine this saves 3 bytes of memory (on average) per - string allocation. - -- Issue #3996: On Windows, the PyOS_CheckStack function would cause the - interpreter to abort ("Fatal Python error: Could not reset the stack!") - instead of throwing a MemoryError. - -- Issue #3689: The list reversed iterator now supports __length_hint__ instead - of __len__. Behavior now matches other reversed iterators. - -- Issue #4367: Python would segfault during compiling when the unicodedata - module couldn't be imported and \N escapes were present. - -- Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` method on - file objects with closefd=False. The file descriptor is still kept open but - the file object behaves like a closed file. The ``FileIO`` object also got a - new readonly attribute ``closefd``. - -- Issue #4348: Some bytearray methods returned that didn't cause any change to - the bytearray, returned the same bytearray instead of a copy. - -- Issue #4317: Fixed a crash in the ``imageop.rgb2rgb8()`` function. - -- Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. - -- Issue #4048: The parser module now correctly validates relative imports. - -- Issue #4225: ``from __future__ import unicode_literals`` didn't work in an - exec statement. - -- Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` method - does not return iterators for the 4th and 5th items. - -- Issue #4209: Enabling unicode_literals and the print_function in the same - __future__ import didn't work. - -- Using ``nonlocal`` as a variable name will now raise a Py3k SyntaxWarning - because it is a reserved word in 3.x. - -- On windows, ``os.chdir()`` given unicode was not working if - GetCurrentDirectoryW returned a path longer than MAX_PATH. (But It's doubtful - this code path is really executed because I cannot move to such directory on - win2k) - -- Issue #4069: When ``set.remove(element)`` is used with a set element, the - element is temporarily replaced with an equivalent frozenset. But the - eventual KeyError would always report the empty ``frozenset()`` as the missing - key. Now it correctly refers to the initial element. - -- Issue #4509: Various issues surrounding resize of bytearray objects to which - there are buffer exports. - -- Issue #4748: Lambda generators no longer return a value. - -- Issue #3582: Use native TLS functions on Windows - -- The re.sub(), re.subn() and re.split() functions now accept a flags parameter. - -- Issue #3845: In PyRun_SimpleFileExFlags avoid invalid memory access with short - file names. - -- Issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)' - to avoid compiler warnings. - -- Issue #5705: os.setuid() would not accept values > 2**31-1 but pwd.getpwnam() - returned them on 64bit platforms. - -- Issue #5108: Handle %s like %S and %R in PyUnicode_FromFormatV(): Call - PyUnicode_DecodeUTF8() once, remember the result and output it in a second - step. This avoids problems with counting UTF-8 bytes that ignores the effect - of using the replace error handler in PyUnicode_DecodeUTF8(). - -- Issue #3739: The unicode-internal encoder now reports the number of characters - consumed like any other encoder (instead of the number of bytes). - -- Issue #2422: When compiled with the ``--with-valgrind`` option, the pymalloc - allocator will be automatically disabled when running under Valgrind. This - gives improved memory leak detection when running under Valgrind, while taking - advantage of pymalloc at other times. - -Library -------- - -- Add count() and reverse() methods to collections.deque(). - -- Fix variations of extending deques: d.extend(d) d.extendleft(d) d+=d - -- Issue #6986: Fix crash in the JSON C accelerator when called with the wrong - parameter types. Patch by Victor Stinner. - -- logging: Added optional "secure" parameter to SMTPHandler, to enable use of - TLS with authentication credentials. - -- Issue #1923: Fixed the removal of meaningful spaces when PKG-INFO is generated - in Distutils. Patch by Stephen Emslie. - -- Issue #4120: Drop reference to CRT from manifest when building extensions with - msvc9compiler. - -- Issue #7333: The ``posix`` module gains an ``initgroups()`` function providing - access to the initgroups(3) C library call on Unix systems which implement it. - Patch by Jean-Paul Calderone. - -- Issue #7408: Fixed distutils.tests.sdist so it doesn't check for group - ownership when the group is not forced, because the group may be different - from the user's group and inherit from its container when the test is run. - -- Issue #1515: Enable use of deepcopy() with instance methods. Patch by Robert - Collins. - -- Issue #7403: logging: Fixed possible race condition in lock creation. - -- Issue #6845: Add restart support for binary upload in ftplib. The - ``storbinary()`` method of FTP and FTP_TLS objects gains an optional "rest" - argument. Patch by Pablo Mouzo. - -- Issue #5788: ``datetime.timedelta`` objects get a new ``total_seconds()`` - method returning the total number of seconds in the duration. Patch by Brian - Quinlan. - -- Issue #6615: logging: Used weakrefs in internal handler list. - -- Issue #1488943: ``difflib.Differ`` doesn't always add hints for tab - characters. - -- Issue #6123: tarfile now opens empty archives correctly and consistently - raises ReadError on empty files. - -- Issue #7354: distutils.tests.test_msvc9compiler - dragfullwindows can be 2. - -- Issue #5037: Proxy the __unicode__ special method to __unicode__ instead of - __str__. - -- Issue #7341: Close the internal file object in the TarFile constructor in case - of an error. - -- Issue #7293: ``distutils.test_msvc9compiler`` is fixed to work on any fresh - Windows box. Help provided by David Bolen. - -- Issue #7328: pydoc no longer corrupts sys.path when run with the '-m' switch. - -- Issue #2054: ftplib now provides an FTP_TLS class to do secure FTP using TLS - or SSL. Patch by Giampaolo Rodola'. - -- Issue #4969: The mimetypes module now reads the MIME database from the - registry under Windows. Patch by Gabriel Genellina. - -- Issue #6816: runpy now provides a run_path function that allows Python code to - execute file paths that refer to source or compiled Python files as well as - zipfiles, directories and other valid sys.path entries that contain a - __main__.py file. This allows applications that run other Python scripts to - support the same flexibility as the CPython command line itself. - -- Issue #7318: multiprocessing now uses a timeout when it fails to establish a - connection with another process, rather than looping endlessly. The default - timeout is 20 seconds, which should be amply sufficient for local connections. - -- Issue #7197: Allow unittest.TextTestRunner objects to be pickled and - unpickled. This fixes crashes under Windows when trying to run - test_multiprocessing in verbose mode. - -- Issue #7282: Fix a memory leak when an RLock was used in a thread other than - those started through ``threading.Thread`` (for example, using - ``thread.start_new_thread()``. - -- Issue #7264: Fix a possible deadlock when deallocating thread-local objects - which are part of a reference cycle. - -- Issue #7211: Allow 64-bit values for the ``ident`` and ``data`` fields of - kevent objects on 64-bit systems. Patch by Michael Broghton. - -- Issue #6896: ``mailbox.Maildir`` now invalidates its internal cache each time - a modification is done through it. This fixes inconsistencies and test - failures on systems with slightly bogus mtime behaviour. - -- Issue #7246 & Issue #7208: getpass now properly flushes input before reading - from stdin so that existing input does not confuse it and lead to incorrect - entry or an IOError. It also properly flushes it afterwards to avoid the - terminal echoing the input afterwards on OSes such as Solaris. - -- Issue #7233: Fix a number of two-argument Decimal methods to make sure that - they accept an int or long as the second argument. Also fix buggy handling of - large arguments (those with coefficient longer than the current precision) in - shift and rotate. - -- Issue #4750: Store the basename of the original filename in the gzip FNAME - header as required by RFC 1952. - -- Issue #1180: Added a new global option to ignore ~/.pydistutils.cfg in - Distutils. - -- Issue #7218: Fix test_site for win32, the directory comparison was done with - an uppercase. - -- Issue #7205: Fix a possible deadlock when using a BZ2File object from several - threads at once. - -- Issue #7071: byte-compilation in Distutils is now done with respect to - sys.dont_write_bytecode. - -- Issue #7066: archive_util.make_archive now restores the cwd if an error is - raised. Initial patch by Ezio Melotti. - -- Issue #6218: io.StringIO and io.BytesIO instances are now picklable with - protocol 2. - -- Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424. - -- Issue #7099: Decimal.is_normal now returns True for numbers with exponent - larger than emax. - -- Issue #5833: Fix extra space character in readline completion with the GNU - readline library version 6.0. - -- Issue #7133: SSL objects now support the new buffer API. - -- Issue #7149: urllib fails on OSX in the proxy detection code. - -- Issue #7069: Make inspect.isabstract() return a boolean. - -- Add support to the ``ihooks`` module for relative imports. - -- Issue #6894: Fixed the issue urllib2 doesn't respect "no_proxy" environment. - -- Issue #7086: Added TCP support to SysLogHandler, and tidied up some - anachronisms in the code which were a relic of 1.5.2 compatibility. - -- Issue #7082: When falling back to the MIME 'name' parameter, the correct place - to look for it is the Content-Type header. - -- Issue #7048: Force Decimal.logb to round its result when that result is too - large to fit in the current precision. - -- Issue #6516: Added owner/group support when creating tar archives in - Distutils. - -- Issue #7031: Add ``TestCase.assert(Not)IsInstance()`` methods. - -- Issue #6790: Make it possible again to pass an ``array.array`` to - ``httplib.HTTPConnection.send``. Patch by Kirk McDonald. - -- Issue #6236, #6348: Fix various failures in the `io` module under AIX and - other platforms, when using a non-gcc compiler. Patch by egreen. - -- Issue #6954: Fixed crash when using DISTUTILS_DEBUG flag in Distutils. - -- Issue #6851: Fix urllib.urlopen crash on secondairy threads on OSX 10.6 - -- Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...) does now - always result in NULL. - -- Issue #5042: ctypes Structure sub-subclass does now initialize correctly with - base class positional arguments. - -- Issue #6938: Fix a TypeError in string formatting of a multiprocessing debug - message. - -- Issue #6635: Fix profiler printing usage message. - -- Issue #6856: Add a filter keyword argument to TarFile.add(). - -- Issue #6163: Fixed HP-UX runtime library dir options in - distutils.unixcompiler. Initial patch by Sridhar Ratnakumar and Michael - Haubenwallner. - -- Issue #6857: Default format() alignment should be '>' for Decimal instances. - -- Issue #6795: int(Decimal('nan')) now raises ValueError instead of returning - NaN or raising InvalidContext. Also, fix infinite recursion in - long(Decimal('nan')). - -- Issue #6850: Fix bug in Decimal._parse_format_specifier for formats with no - type specifier. - -- Issue #4937: plat-mac/bundlebuilder refers to non-existing version.plist. - -- Issue #6838: Use a list to accumulate the value instead of repeatedly - concatenating strings in httplib's HTTPResponse._read_chunked providing a - significant speed increase when downloading large files servend with a - Transfer-Encoding of 'chunked'. - -- Issue #5275: In Cookie's Cookie.load(), properly handle non-string arguments - as documented. - -- Issue #2666: Handle BROWSER environment variable properly for unknown browser - names in the webbrowser module. - -- Issue #6054: Do not normalize stored pathnames in tarfile. - -- Issue #6794: Fix Decimal.compare_total and Decimal.compare_total_mag: NaN - payloads are now ordered by integer value rather than lexicographically. - -- Issue #6693: New functions in site.py to get user/global site packages paths. - -- The thread.lock type now supports weak references. - -- Issue #1356969: Add missing info methods in Tix.HList. - -- Issue #1522587: New constants and methods for the Tix.Grid widget. - -- Issue #1250469: Fix the return value of Tix.PanedWindow.panes. - -- Issue #1119673: Do not override Tkinter.Text methods when creating a - ScrolledText. - -- Issue #6665: Fix fnmatch to properly match filenames with newlines in them. - -- Issue #1135: Add the XView and YView mix-ins to avoid duplicating the xview* - and yview* methods. - -- Issue #6629: Fix a data corruption issue in the new `io` package, which could - occur when writing to a BufferedRandom object (e.g. a file opened in "rb+" or - "wb+" mode) after having buffered a certain amount of data for reading. This - bug was not present in the pure Python implementation. - -- Issue #4660: If a multiprocessing.JoinableQueue.put() was preempted, it was - possible to get a spurious 'task_done() called too many times' error. - -- Issue #1628205: Socket file objects returned by socket.socket.makefile() now - properly handles EINTR within the read, readline, write & flush methods. The - socket.sendall() method now properly handles interrupted system calls. - -- Issue #6595: The Decimal constructor now allows arbitrary Unicode decimal - digits in input, as recommended by the standard. Previously it was restricted - to accepting [0-9]. - -- Issue #6511: ZipFile now raises BadZipfile (instead of an IOError) when - opening an empty or very small file. - -- Issue #6553: Fixed a crash in cPickle.load(), when given a file-like object - containing incomplete data. - -- Issue #6545: Removed assert statements in distutils.Extension, so the behavior - is similar when used with -O. - -- unittest has been split up into a package. All old names should still work. - -- Issue #6431: Make Fraction type return NotImplemented when it doesn't know how - to handle a comparison without loss of precision. Also add correct handling - of infinities and nans for comparisons with float. - -- Issue #6415: Fixed warnings.warn segfault on bad formatted string. - -- Issue #6466: Now distutils.cygwinccompiler and distutils.emxccompiler uses the - same refactored function to get gcc/ld/dllwrap versions numbers. It's - ``distutils.util.get_compiler_versions()``. Added deprecation warnings for - the obsolete get_versions() functions. - -- Issue #6433: Fixed issues with multiprocessing.pool.map hanging on empty list. - -- Issue #6314: logging: Extra checks on the "level" argument in more places. - -- Issue #2622: Fixed an ImportError when importing email.messsage from a - standalone application built with py2exe or py2app. - -- Issue #6455: Fixed test_build_ext under win32. - -- Issue #6377: Enabled the compiler option, and deprecate its usage as an - attribute. - -- Issue #6413: Fixed the log level in distutils.dist for announce. - -- Issue #3392: The subprocess communicate() method no longer fails in select() - when file descriptors are large; communicate() now uses poll() when possible. - -- Issue #6403: Fixed package path usage in build_ext. - -- Issues #5155, #5313, #5331: multiprocessing.Process._bootstrap was - unconditionally calling "os.close(sys.stdin.fileno())" resulting in file - descriptor errors. - -- Issue #6365: Distutils build_ext inplace mode was copying the compiled - extension in a subdirectory if the extension name had dots. - -- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. - -- Issue #5230: pydoc would report no documentation found if a module generated a - 'not found' import error when loaded; it now reports the import errors. - Thanks to Lucas Prado Melo for initial fix and collaboration on the tests. - -- Issue #6314: ``logging.basicConfig()`` performs extra checks on the "level" - argument. - -- Issue #6164: Added an AIX specific linker argument in Distutils unixcompiler. - Original patch by Sridhar Ratnakumar. - -- Issue #6274: Fixed possible file descriptors leak in subprocess.py. - -- Issue #6189: Restored compatibility of subprocess.py with Python 2.2. - -- Issue #6287: Added the license field in Distutils documentation. - -- Issue #6286: Now Distutils upload command is based on urllib2 instead of - httplib, allowing the usage of http_proxy. - -- Issue #6271: mmap tried to close invalid file handle (-1) for anonymous maps - on Unix. - -- Issue #6215: All bug fixes and enhancements from the Python 3.1 io library - (including the fast C implementation) have been backported to the standard - ``io`` module. - -- Issue #6258: Support AMD64 in bdist_msi. - -- Issue #6252: Fixed bug in next rollover time computation in - TimedRotatingFileHandler. - -- Issue #6263: Fixed syntax error in distutils.cygwincompiler. - -- Issue #5201: distutils.sysconfig.parse_makefile() now understands ``$$`` in - Makefiles. This prevents compile errors when using syntax like: - ``LDFLAGS='-rpath=\$$LIB:/some/other/path'``. Patch by Floris Bruynooghe. - -- Issue #5767: Removed sgmlop support from xmlrpclib. - -- Issue #6131: test_modulefinder leaked when run after test_distutils. Patch by - Hirokazu Yamamoto. - -- Issue #6048: Now Distutils uses the tarfile module in archive_util. - -- Issue #6121: pydoc now ignores leading and trailing spaces in the argument to - the 'help' function. - -- In unittest, using a skipping decorator on a class is now equivalent to - skipping every test on the class. The ClassTestSuite class has been removed. - -- Issue #6050: Don't fail extracting a directory from a zipfile if the directory - already exists. - -- Issue #5311: bdist_msi can now build packages that do not depend on a specific - Python version. - -- Issue #1309352: fcntl now converts its third arguments to a C `long` rather - than an int, which makes some operations possible under 64-bit Linux (e.g. - DN_MULTISHOT with F_NOTIFY). - -- Issue #1424152: Fix for httplib, urllib2 to support SSL while working through - proxy. Original patch by Christopher Li, changes made by Senthil Kumaran. - -- Issue #1983: Fix functions taking or returning a process identifier to use the - dedicated C type ``pid_t`` instead of a C ``int``. Some platforms have a - process identifier type wider than the standard C integer type. - -- Issue #4066: smtplib.SMTP_SSL._get_socket now correctly returns the socket. - Patch by Farhan Ahmad, test by Marcin Bachry. - -- Issue #6062: In distutils, fixed the package option of build_ext. Feedback - and tests on pywin32 by Tim Golden. - -- Issue #6053: Fixed distutils tests on win32. Patch by Hirokazu Yamamoto. - -- Issue #6046: Fixed the library extension when distutils build_ext is used in - place. Initial patch by Roumen Petrov. - -- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a - subcommand. - -- Issue #2116: Weak references and weak dictionaries now support copy()ing and - deepcopy()ing. - -- Issue #1655: Make imaplib IPv6-capable. Patch by Derek Morr. - -- Issue #5918: Fix a crash in the parser module. - -- Issue #1664: Make nntplib IPv6-capable. Patch by Derek Morr. - -- Issue #6022: A test file was created in the current working directory by - test_get_outputs in Distutils. - -- Issue #4050: inspect.findsource/getsource now raise an IOError if the 'source' - file is a binary. Patch by Brodie Rao, tests by Daniel Diniz. - -- Issue #5977: distutils build_ext.get_outputs was not taking into account the - inplace option. Initial patch by kxroberto. - -- Issue #5984: distutils.command.build_ext.check_extensions_list checks were - broken for old-style extensions. - -- Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when - trying to print a traceback. - -- Issue #5976: Fixed Distutils test_check_environ. - -- Issue #5900: Ensure RUNPATH is added to extension modules with RPATH if GNU ld - is used. Original patch by Floris Bruynooghe. - -- Issue #5941: Distutils build_clib command was not working anymore because of - an incomplete customization of the archiver command. Added ARFLAGS in the - Makefile besides AR and make Distutils use it. Original patch by David - Cournapeau. - -- Issue #5955: aifc's close method did not close the file it wrapped, now it - does. This also means getfp method now returns the real fp. - -- Issue #4875: On win32, ctypes.util.find_library does no longer return - directories. - -- Issue #5142: Add the ability to skip modules while stepping to pdb. - -- Issue #1309567: Fix linecache behavior of stripping subdirectories when - looking for files given by a relative filename. - -- Issue #5692: In ``zipfile.Zipfile``, fix wrong path calculation when - extracting a file to the root directory. - -- Issue #5913: ``os.listdir()`` should fail for empty path on windows. - -- Issue #5084: Unpickling now interns the attribute names of pickled objects, - saving memory and avoiding growth in size of subsequent pickles. Proposal and - original patch by Jake McGuire. - -- Issue #3002: ``shutil.copyfile()`` and ``shutil.copytree()`` now raise an - error when a named pipe is encountered, rather than blocking infinitely. - -- Issue #3959: The ipaddr module has been added to the standard library. - Contributed by Google. - -- Issue #2245: aifc now skips chunk types it doesn't recognize, per spec. - -- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive anymore. - -- Issue #4305: ctypes should now build again on mipsel-linux-gnu - -- Issue #1734234: Massively speedup ``unicodedata.normalize()`` when the string - is already in normalized form, by performing a quick check beforehand. - Original patch by Rauli Ruohonen. - -- Issue #5853: Calling a function of the mimetypes module from several threads - at once could hit the recursion limit if the mimetypes database hadn't been - initialized before. - -- Issue #5854: Updated __all__ to include some missing names and remove some - names which should not be exported. - -- Issue #5810: Fixed Distutils test_build_scripts so it uses - ``sysconfig.get_config_vars()``. - -- Issue #4951: Fixed failure in test_httpservers. - -- Issue #3102: All global symbols that the _ctypes extension defines are now - prefixed with 'Py' or '_ctypes'. - -- Issue #5041: ctypes does now allow pickling wide character. - -- Issue #5812: For the two-argument form of the Fraction constructor, - ``Fraction(m, n)``, m and n are permitted to be arbitrary Rational instances. - -- Issue #5812: Fraction('1e6') is valid: more generally, any string that's valid - for float() is now valid for Fraction(), with the exception of strings - representing NaNs and infinities. - -- Issue #5795: Fixed test_distutils failure on Debian ppc. - -- Issue #5768: Fixed bug in Unicode output logic and test case for same. - -- Issue #1161031: Fix readwrite select flag handling: POLLPRI now results in a - handle_expt_event call, not handle_read_event, and POLLERR and POLLNVAL now - call handle_close, not handle_expt_event. Also, dispatcher now has an - 'ignore_log_types' attribute for suppressing log messages, which is set to - 'warning' by default. - -- Issue #5607: Fixed Distutils test_get_platform for Mac OS X fat binaries. - -- Issue #5741: Don't disallow "%%" (which is an escape for "%") when setting a - value in SafeConfigParser. - -- Issue #5732: Added a new command in Distutils: check. - -- Issue #5731: Distutils bdist_wininst no longer worked on non-Windows - platforms. Initial patch by Paul Moore. - -- Issue #2254: Fix CGIHTTPServer information disclosure. Relative paths are now - collapsed within the url properly before looking in cgi_directories. - -- Issue #5095: Added bdist_msi to the list of bdist supported formats. Initial - fix by Steven Bethard. - -- Issue #1491431: Fixed distutils.filelist.glob_to_re for edge cases. Initial - fix by Wayne Davison. - -- Issue #5693: TestSuite.__iter__ can now be consistently overridden in - subclasses. - -- Issue #5694: Removed spurious test output in Distutils (test_clean). - -- Issue #5471: Fix os.path.expanduser() for $HOME set to '/'. - -- Issue #1326077: Fix the formatting of SyntaxErrors by the traceback module. - -- Issue #1726172: Fix IndexError in the case of and empty response in ftplib. - -- Issue #2625: Added missing iteritems() call to the for loop in - mailbox.MH.get_message(). - -- Issue #5585: Add the ability to call an initializer to - multiprocessing.manager so that users can install custom handlers/etc. - -- Issue #3551: Patch multiprocessing to raise a proper exception if the size of - the object when writefile is called causes an ERROR_NO_SYSTEM_RESOURCES. Added - docs to note the limitation. - -- unittest.assertNotEqual() now uses the inequality operator (!=) instead of the - equality operator. - -- Issue #6001: Test discovery for unittest. Implemented in - unittest.TestLoader.discover and from the command line. - -- Issue #5679: The methods unittest.TestCase.addCleanup and doCleanups were - added. addCleanup allows you to add cleanup functions that will be called - unconditionally (after setUp if setUp fails, otherwise after tearDown). This - allows for much simpler resource allocation and deallocation during tests. - -- Issue #3379: unittest.main now takes an optional exit argument. If False main - doesn't call sys.exit allowing it to be used from the interactive interpreter. - -- Issue #5995: unittest.main now takes an optional verbosity argument allowing - test modules to be run with a higher than default verbosity. - -- Issue #5995: A fix to allow you to run "python -m unittest test_module" or - "python -m unittest test_module.TestClass" from the command line. - -- Issue #5728: unittest.TestResult has new startTestRun and stopTestRun methods; - called immediately before and after a test run. - -- Issue #5663: Better failure messages for unittest asserts. Default assertTrue - and assertFalse messages are now useful. TestCase has a longMessage attribute. - This defaults to False, but if set to True useful error messages are shown in - addition to explicit messages passed to assert methods. - -- Issue #3110: Add additional protect around SEM_VALUE_MAX for multiprocessing. - -- In Pdb, prevent the reassignment of __builtin__._ by sys.displayhook on - printing out values. - -- Issue #4572: Added SEEK_* symbolic constants to io module. - -- Issue #1665206 (partially): Move imports in cgitb to the top of the module - instead of performing them in functions. Helps prevent import deadlocking in - threads. - -- Issue #5647: MutableSet.__iand__() no longer mutates self during iteration. - -- Actually make the SimpleXMLRPCServer CGI handler work. - -- Issue #2522: locale.format() now checks its first argument to ensure it has - been passed only one pattern, avoiding mysterious errors where it appeared - that it was failing to do localization. - -- Issue #5583: Added optional extensions in Distutils. Initial patch by Georg - Brandl. - -- Issue #5619: Multiprocessing children disobey the debug flag and causes popups - on windows buildbots. Patch applied to work around this issue. - -- Issue #5632: Thread.ident was None for the main thread and threads not created - with the threading module. - -- Issue #5400: Added patch for multiprocessing on netbsd compilation/support. - -- Issue #5387: Fixed mmap.move crash by integer overflow. - -- Issue #5261: Patch multiprocessing's semaphore.c to support context manager - use: "with multiprocessing.Lock()" works now. - -- Issue #5177: Multiprocessing's SocketListener class now uses - socket.SO_REUSEADDR on all connections so that the user no longer needs to - wait 120 seconds for the socket to expire. - -- Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined - (part of issue #5035). - -- Issue #5561: Removed the sys.version_info shortcuts from platform's - python_version() and python_version_tuple() since they produced different - output compared to previous Python versions. - -- Issue #1034053: unittest now supports skipping tests and expected failures. - -- The unittest.TestCase.assertRaises() method now returns a context manager when - not given a callable so that code to be tested can be written inline using a - with statement. - -- Issue #2578: The unittest.TestCase.assertEqual() now displays the differences - in lists, tuples, dicts and sets on failure. Many new handy type and - comparison specific assert* methods have been added that fail with error - messages actually useful for debugging. Contributed in part by Google. - -- Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop forever - on incomplete input. That caused tarfile.open() to hang when used with mode - 'r' or 'r:bz2' and a fileobj argument that contained no data or partial bzip2 - compressed data. - -- Issue #5536: urllib.urlretrieve makes sure to close the file it's writing to - even if an exception occurs. - -- Issue #5381: Added object_pairs_hook to the json module. This allows - OrderedDicts to be built by the decoder. - -- Issue #2110: Add support for thousands separator and 'n' type specifier to - ``Decimal.__format__()``. - -- Fix Decimal.__format__ bug that swapped the meanings of the '<' and '>' - alignment characters. - -- Issue #1222: ``locale.format()`` bug when the thousands separator is a space - character. - -- Issue #5472: Fixed distutils.test_util tear down. Original patch by Tim - Golden. - -- collections.deque objects now have a read-only attribute called maxlen. - -- Issue #2638: Show a window constructed with tkSimpleDialog.Dialog only after - it is has been populated and properly configured in order to prevent window - flashing. - -- Issue #4792: Prevent a segfault in _tkinter by using the guaranteed to be safe - interp argument given to the PythonCmd in place of the Tcl interpreter taken - from a PythonCmd_ClientData. - -- Issue #5193: Guarantee that Tkinter.Text.search returns a string. - -- Issue #5394: Removed > 2.3 syntax from distutils.msvc9compiler. - Original patch by Akira Kitada. - -- Issue #5385: Fixed mmap crash after resize failure on windows. - -- Issue #5179: Fixed subprocess handle leak on failure on windows. - -- PEP 372: Added collections.OrderedDict(). - -- The _asdict() for method for namedtuples now returns an OrderedDict(). - -- The configparser module now defaults to using an ordered dictionary. - -- Issue #4308: httplib.IncompleteRead's repr doesn't include all of the data all - ready received. - -- Issue #5401: Fixed a performance problem in mimetypes when ``from mimetypes - import guess_extension`` was used. - -- Issue #1733986: Fixed mmap crash on Windows in accessing elements of second - map object with same tagname but larger size than first map. - -- Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer - overrun. - -- Issue #1533164: Installed but not listed *.pyo was breaking Distutils - bdist_rpm command. - -- Issue #5378: Added --quiet option to Distutils bdist_rpm command. - -- Issue #5052: Make Distutils compatible with 2.3 again. - -- Deprecated methods of symtable.Symbol have been removed: is_keywordarg(), - is_vararg(), and is_in_tuple(). - -- Issue #5316: Fixed buildbot failures introduced by multiple inheritance in - Distutils tests. - -- Issue #5287: Add exception handling around findCaller() call to help out - IronPython. - -- Issue #5282: Fixed mmap resize on 32bit Windows and Unix. When ``offset > - 0``, the file was resized to wrong size. - -- Issue #5292: Fixed mmap crash on its boundary access m[len(m)]. - -- Issue #2279: distutils.sdist.add_defaults now add files from the package_data - and the data_files metadata. - -- Issue #5257: Refactored all tests in distutils, so they use - support.TempdirManager, to avoid writing in the tests directory. - -- Issue #4524: distutils build_script command failed with --with-suffix=3. - Initial patch by Amaury Forgeot d'Arc. - -- Issue #2461: Added tests for distutils.util. - -- Issue #1008086: Fixed socket.inet_aton() to always return 4 bytes even on LP64 - platforms (most 64-bit Linux, bsd, unix systems). - -- Issue #5203: Fixed ctypes segfaults when passing a unicode string to a - function without argtypes (only occurs if HAVE_USABLE_WCHAR_T is false). - -- Issue #3386: distutils.sysconfig.get_python_lib prefix argument was ignored - under NT and OS2. Patch by Philip Jenvey. - -- Issue #5128: Make compileall properly inspect bytecode to determine if needs - to be recreated. This avoids a timing hole thanks to the old reliance on the - ctime of the files involved. - -- Issue #5122: Synchronize tk load failure check to prevent a potential - deadlock. - -- Issue #1818: collections.namedtuple() now supports a keyword argument 'rename' - which lets invalid fieldnames be automatically converted to positional names - in the form, _1, _2, ... - -- Issue #4890: Handle empty text search pattern in Tkinter.Text.search. - -- Issue #5170: Fixed Unicode output bug in logging and added test case. This is - a regression which did not occur in 2.5. - -- Issue #4512 (part 2): Promote ``ZipImporter._get_filename()`` to be a public - documented method ``ZipImporter.get_filename()``. - -- Issue #4195: The ``runpy`` module (and the ``-m`` switch) now support the - execution of packages by looking for and executing a ``__main__`` submodule - when a package name is supplied. Initial patch by Andi Vajda. - -- Issue #1731706: Call Tcl_ConditionFinalize for Tcl_Conditions that will not be - used again (this requires Tcl/Tk 8.3.1), also fix a memory leak in Tkapp_Call - when calling from a thread different than the one that created the Tcl - interpreter. Patch by Robert Hancock. - -- Issue #1520877: Now distutils.sysconfig reads $AR from the - environment/Makefile. Patch by Douglas Greiman. - -- Issue #4285: Change sys.version_info to be a named tuple. Patch by Ross - Light. - -- Issue #1276768: The verbose option was not used in the code of - distutils.file_util and distutils.dir_util. - -- Issue #5132: Fixed trouble building extensions under Solaris with - --enabled-shared activated. Initial patch by Dave Peterson. - -- Issue #1581476: Always use the Tcl global namespace when calling into Tcl. - -- Issue #2047: shutil.move() could believe that its destination path was inside - its source path if it began with the same letters (e.g. "src" vs. "src.new"). - -- Issue #4920: Fixed .next() vs .__next__() issues in the ABCs for Iterator and - MutableSet. - -- Added the ttk module. See issue #2983: Ttk support for Tkinter. - -- Issue #5021: doctest.testfile() did not create __name__ and - collections.namedtuple() relied on __name__ being defined. - -- Backport importlib from Python 3.1. Only the import_module() function has been - backported to help facilitate transitions from 2.7 to 3.1. - -- Issue #1885: distutils: When running sdist with --formats=tar,gztar the tar - file was overridden by the gztar one. - -- Issue #4863: distutils.mwerkscompiler has been removed. - -- Added new itertools functions: combinations_with_replacement() and compress(). - -- Issue #5032: Added a step argument to itertools.count() and allowed - non-integer arguments. - -- Fix and properly document the multiprocessing module's logging support, expose - the internal levels and provide proper usage examples. - -- Issue #1672332: Fix unpickling of subnormal floats, which was - producing a ValueError on some platforms. - -- Issue #3881: Help Tcl to load even when started through the unreadable local - symlink to "Program Files" on Vista. - -- Issue #4710: Extract directories properly in the zipfile module; allow adding - directories to a zipfile. - -- Issue #3807: _multiprocessing build fails when configure is passed - --without-threads argument. When this occurs, _multiprocessing will be - disabled, and not compiled. - -- Issue #5008: When a file is opened in append mode with the new IO library, do - an explicit seek to the end of file (so that e.g. tell() returns the file size - rather than 0). This is consistent with the behaviour of the traditional 2.x - file object. - -- Issue #5013: Fixed a bug in FileHandler which occurred when the delay - parameter was set. - -- Issue #4998: The memory saving effect of __slots__ had been lost on Fractions - which inherited from numbers.py which did not have __slots__ defined. The - numbers hierarchy now has its own __slots__ declarations. - -- Issue #3321: _multiprocessing.Connection() doesn't check handle; added checks - for *nix machines for negative handles and large int handles. Without this - check it is possible to segfault the interpreter. - -- Issue #4449: AssertionError in mp_benchmarks.py, caused by an underlying issue - in sharedctypes.py. - -- Issue #1225107: inspect.isclass() returned True for instances with a custom - __getattr__. - -- Issue #3997: Zipfiles generated with more than 65536 files could not be opened - with other applications. - -- Issue #1162154: ``inspect.getmembers()`` now skips attributes that raise - AttributeError, e.g. a __slots__ attribute which has not been set. - -- Issue #1696199: Add collections.Counter() for rapid and convenient counting. - -- Issue #3860: GzipFile and BZ2File now support the context management protocol. - -- Issue #4272: Add an optional argument to the GzipFile constructor to override - the timestamp in the gzip stream. The default value remains the current time. - The information can be used by e.g. gunzip when decompressing. Patch by - Jacques Frechet. - -- Restore Python 2.3 compatibility for decimal.py. - -- Issue #1702551: distutils sdist was not excluding VCS directories under - Windows. Initial solution by Guy Dalberto. - -- The _tkinter module functions "createfilehandler", "deletefilehandler", - "createtimerhandler", "mainloop", "dooneevent" and "quit" have been deprecated - for removal in 3.x - -- Issue #4796: Added Decimal.from_float() and - Context.create_decimal_from_float() to the decimal module. - -- Issue #4812: Add missing underscore prefix to some internal-use-only constants - in the decimal module. (Dec_0 becomes _Dec_0, etc.) - -- Issue #4795: inspect.isgeneratorfunction() returns False instead of None when - the function is not a generator. - -- Issue #4702: Throwing a DistutilsPlatformError instead of IOError in case no - MSVC compiler is found under Windows. Original patch by Philip Jenvey. - -- Issue #4646: distutils was choking on empty options arg in the setup function. - Original patch by Thomas Heller. - -- Fractions.from_float() no longer loses precision for integers too big to cast - as floats. - -- Issue #4790: The nsmallest() and nlargest() functions in the heapq module did - unnecessary work in the common case where no key function was specified. - -- Issue #3767: Convert Tk object to string in tkColorChooser. - -- Issue #3248: Allow placing ScrolledText in a PanedWindow. - -- Issue #4444: Allow assertRaises() to be used as a context handler, so that the - code under test can be written inline if more practical. - -- Issue #4739: Add pydoc help topics for symbols, so that e.g. help('@') works - as expected in the interactive environment. - -- Issue #4756: zipfile.is_zipfile() now supports file-like objects. Patch by - Gabriel Genellina. - -- Issue #4400: .pypirc default generated file was broken in distutils. - -- Issue #4736: io.BufferedRWPair's closed property now functions properly. - -- Issue #3954: Fix a potential SystemError in _hotshot.logreader error handling. - -- Issue #4574: Fix a crash in io.IncrementalNewlineDecoder when a carriage - return encodes to more than one byte in the source encoding (e.g. UTF-16) and - gets split on a chunk boundary. - -- Issue #4223: inspect.getsource() will now correctly display source code for - packages loaded via zipimport (or any other conformant PEP 302 - loader). Original patch by Alexander Belopolsky. - -- Issue #4201: pdb can now access and display source code loaded via zipimport - (or any other conformant PEP 302 loader). Original patch by Alexander - Belopolsky. - -- Issue #4197: Doctests in modules loaded via zipimport (or any other PEP 302 - conformant loader) will now work correctly in most cases (they are still - subject to the constraints that exist for all code running from inside a - module loaded via a PEP 302 loader and attempting to perform IO operations - based on __file__). Original patch by Alexander Belopolsky. - -- Issues #4082 and #4512: Add runpy support to zipimport in a manner that allows - backporting to maintenance branches. Original patch by Alexander Belopolsky. - -- Issue #4163: Use unicode-friendly word splitting in the textwrap functions - when given a Unicode string. - -- Issue #4616: TarFile.utime(): Restore directory times on Windows. - -- Issue #4084: Fix max, min, max_mag and min_mag Decimal methods to give correct - results in the case where one argument is a quiet NaN and the other is a - finite number that requires rounding. - -- Issue #1030250: Distutils created directories even when run with the --dry-run - option. - -- Issue #4483: _dbm module now builds on systems with gdbm & gdbm_compat libs. - -- Issue #4529: Fix the parser module's validation of try-except-finally - statements. - -- Issue #4458: getopt.gnu_getopt() now recognizes a single "-" as an argument, - not a malformed option. - -- Added the subprocess.check_output() convenience function to get output from a - subprocess on success or raise an exception on error. - -- Issue #1055234: cgi.parse_header(): Fixed parsing of header parameters to - support unusual filenames (such as those containing semi-colons) in - Content-Disposition headers. - -- Issue #4384: Added logging integration with warnings module using - captureWarnings(). This change includes a NullHandler which does nothing; it - will be of use to library developers who want to avoid the "No handlers could - be found for logger XXX" message which can appear if the library user doesn't - configure logging. - -- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an - exception. - -- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if the - ctypes module is not present. - -- FileIO's mode attribute now always includes ``"b"``. - -- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. - -- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values - for any header, matching what the documentation has claimed for a while. - -- Issue #3774: Fixed an error when create a Tkinter menu item without command - and then remove it. - -- Fixed a modulefinder crash on certain relative imports. - -- Issue #4150: Pdb's "up" command now works for generator frames in post-mortem - debugging. - -- Issue #4092: Return ArgInfo as promised in the documentation from - inspect.getargvalues. - -- Issue #3935: Properly support list subclasses in bisect's C implementation. - -- Issue #4014: Don't claim that Python has an Alpha release status, in addition - to claiming it is Mature. - -- Issue #4730: Fixed the cPickle module to handle correctly astral characters - when protocol 0 is used. - -- Issue #1594: MacOS.GetCreatorAndType now always returns a big-endian result, - to be consistent with Apple tools. - -- Issue #900949: plat-mac/videoreader.py no longer relies on a non-existing - module. - -- Issue #16278952: plat-mac/videoreader.py now correctly imports MediaDescr - -- Issue #1737832: plat-mac/EasyDialog.py no longer uses the broken aepack - module. - -- Issue #1149804: macostools.mkdirs now even works when another process creates - one of the needed subdirectories. - -- Issue #900506: added --no-zipimport flag to the bundlebuilder script. - -- Issue #841800: bundlebuilder now works with 'python -O'. - -- Issue #4861: ctypes.util.find_library(): Robustify. Fix library detection on - biarch systems. Try to rely on ldconfig only, without using objdump and gcc. - -- Issue #5104: The socket module now raises OverflowError when 16-bit port and - protocol numbers are supplied outside the allowed 0-65536 range on bind() and - getservbyport(). - -- Issue #999042: The Python compiler now handles explict global statements - correctly (should be assigned using STORE_GLOBAL opcode). - -- Issue #2703: SimpleXMLRPCDispatcher.__init__: Provide default values for new - arguments introduced in 2.5. - -- Issue #5828 (Invalid behavior of unicode.lower): Fixed bogus logic in - makeunicodedata.py and regenerated the Unicode database (This fixes - u'\u1d79'.lower() == '\x00'). - -- Windows locale mapping updated to Vista. - -IDLE ----- - -- Issue #5150: IDLE's format menu now has an option to strip trailing - whitespace. - -- Issue #5847: Remove -n switch on "Edit with IDLE" menu item. - -- idle.py modified and simplified to better support developing experimental - versions of IDLE which are not installed in the standard location. - -- Issue #5559: OutputWindow/PyShell right click menu "Go to file/line" - wasn't working with file paths containing spaces. - -- Issue #5783: Windows: Version string for the .chm help file changed, - file not being accessed. Patch by Guilherme Polo/ - -- Issue #1529142: Allow multiple IDLE GUI/subprocess pairs to exist - simultaneously. Thanks to David Scherer for suggesting the use of an - ephemeral port for the GUI. Patch by Weeble. - -- Remove port spec from run.py and fix bug where subprocess fails to - extract port from command line when warnings are present. - -- Issue #5129: Tk 8.5 Text widget requires 'wordprocessor' tabstyle attr - to handle mixed space/tab properly. Patch by Guilherme Polo. - -- Issue #3549: On MacOS the preferences menu was not present - -Tools/Demos ------------ - -- Ttk demos added in Demo/tkinter/ttk/. - -- Issue #4677: Add two list comprehension tests to pybench. - -Build ------ - -- Issue #6603: Change READ_TIMESTAMP macro in ceval.c so that it compiles - correctly under gcc on x86-64. This fixes a reported problem with the - --with-tsc build on x86-64. - -- Add 2 new options to ``--with-universal-archs`` on MacOSX: ``intel`` builds a - distribution with ``i386`` and ``x86_64`` architectures, while ``3-way`` - builds a distribution with the ``ppc``, ``i386`` and ``x86_64`` architectures. - -- Issue #6802: Fix build issues on MacOSX 10.6. - -- Issue #6244: Allow detect_tkinter to look for Tcl/Tk 8.6. - -- Issue #5390: Add uninstall icon independent of whether file extensions are - installed. - -- Issue #5809: Specifying both --enable-framework and --enable-shared is an - error. Configure now explicitly tells you about this. - -- Issue #3585: Add pkg-config support. It creates a python-2.7.pc file and a - python.pc symlink in the $(LIBDIR)/pkgconfig directory. Patch by Clinton Roy. - -- Issue #6094: Build correctly with Subversion 1.7. - -- Issue #5726: Make Modules/ld_so_aix return the actual exit code of the linker, - rather than always exit successfully. Patch by Floris Bruynooghe. - -- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify - the order that backends for the dbm extension are checked. - -- Link the shared python library with $(MODLIBS). - -- Issue #5134: Silence compiler warnings when compiling sqlite with VC++. - -- Issue #4494: Fix build with Py_NO_ENABLE_SHARED on Windows. - -- Issue #4895: Use _strdup on Windows CE. - -- Issue #4472: ``configure --enable-shared`` now works on OSX. - -- Issues #4728 and #4060: WORDS_BIGEDIAN is now correct in Universal builds. - -- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". - -- Issue #4289: Remove Cancel button from AdvancedDlg. - -- Issue #1656675: Register a drop handler for .py* files on Windows. - -- Issue #4120: Exclude manifest from extension modules in VS2008. - -- Issue #4091: Install pythonxy.dll in system32 again. - -- Issue #4018: Disable "for me" installations on Vista. - -- Issue #3758: Add ``patchcheck`` build target to ``.PHONY``. - -- Issue #4204: Fixed module build errors on FreeBSD 4. - -Documentation -------------- - -- Issue #6556: Fixed the Distutils configuration files location explanation for - Windows. - -- Issue #6801: symmetric_difference_update also accepts ``|``. Thanks to Carl - Chenet. - -C-API ------ - -- Issue #7528: Add PyLong_AsLongAndOverflow (backported from py3k). - -- Issue #7228: Add '%lld' and '%llu' support to PyString_FromFormat(V) and - PyErr_Format, on machines with HAVE_LONG_LONG defined. - -- Add new C-API function PyOS_string_to_double, and deprecated PyOS_ascii_atof - and PyOS_ascii_strtod. - -- Removed _PyOS_double_to_string. Use PyOS_double_to_string instead. This is in - preparation for (but not strictly related to) issue #7117, short float repr. - -- Issue #6624: PyArg_ParseTuple with "s" format when parsing argument with NULL: - Bogus TypeError detail string. - -- Issue #5954: Add a PyFrame_GetLineNumber() function to replace most uses of - PyCode_Addr2Line(). - -- Issue #5959: Add a PyCode_NewEmpty() function to create a new empty code - object at a specified file, function, and line number. - -- Issue #1419652: Change the first argument to PyImport_AppendInittab() to - ``const char *`` as the string is stored beyond the call. - -- Some PyBytes_* aliases have been removed because they don't exist in 3.x. - -- Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for negative - arguments. Previously, it raised TypeError. - -- Issue #4720: The format for PyArg_ParseTupleAndKeywords can begin with '|'. - -- Issue #3632: From the gdb debugger, the 'pyo' macro can now be called when the - GIL is released, or owned by another thread. - -- Issue #4122: On Windows, fix a compilation error when using the - Py_UNICODE_ISSPACE macro in an extension module. - -- Issue #4293: Py_AddPendingCall() is now thread safe and can be used for - asynchronous notifications to python from any thread. Documentation added. - -Extension Modules ------------------ - -- Issue #6508: Add posix.{getresuid,getresgid,setresuid,setresgid}. - -- Issue #7078: Set struct.__doc__ from _struct.__doc__. - -- Issue #3366: Add erf, erfc, expm1, gamma, lgamma functions to math module. - -- Issue #6823: Allow time.strftime() to accept a tuple with a isdst field - outside of the range of [-1, 1] by normalizing the value to within that range. - -- Issue #6877: Make it possible to link the readline extension to libedit on - OSX. - -- Issue #6944: Fix a SystemError when socket.getnameinfo() was called with - something other than a tuple as first argument. - -- Issue #6865: Fix reference counting issue in the initialization of the pwd - module. - -- Issue #6848: Fix curses module build failure on OS X 10.6. - -- Fix a segfault in expat when given a specially crafted input lead to the - tokenizer not stopping. CVE-2009-3720. - -- Issue #6561: '\d' in a regex now matches only characters with Unicode category - 'Nd' (Number, Decimal Digit). Previously it also matched characters with - category 'No'. - -- Issue #1523: Remove deprecated overflow wrapping for struct.pack with an - integer format code ('bBhHiIlLqQ'). Packing an out-of-range integer now - consistently raises struct.error. - -- Issues #1530559, #1741130: Fix various struct.pack inconsistencies for the - integer formats ('bBhHiIlLqQ'). In the following, '*' represents any of '=', - '<', '>'. - - - Packing a float now always gives a Deprecation Warning. Previously it - only warned for 'I', 'L', '*B', '*H', '*I', '*L'. - - - If x is not an int, long or float, then packing x will always result in - struct.error. Previously an x with an __int__ method could be packed by - 'b', 'B', 'h', 'H', 'i', 'l', '*b', '*h' ,'*i', '*l', and an x with a - __long__ method could be packed by 'q', 'Q', '*q', '*Q'; for x with - neither __int__ nor __long__, TypeError used to be raised (with a - confusing error message) for 'I', 'L', '*B', '*H', '*I', '*L', and - struct.error in other cases. - - Note: as of Python 2.7 beta 1, the above is out of date. In 2.7 beta 1, any - argument with an __int__ method can be packed, but use of this feature - triggers a DeprecationWarning. - -- Issue #4873: Fix resource leaks in error cases of pwd and grp. - -- Issue #4751: For hashlib algorithms provided by OpenSSL, the Python GIL is now - released during computation on data lengths >= 2048 bytes. - -- Issue #3745: Fix hashlib to always reject unicode and non buffer-api - supporting objects as input no matter how it was compiled (built in - implementations or external openssl library). NOTE: Undone in 2.7a2. - -- Issue #4397: Fix occasional test_socket failure on OS X. - -- Issue #4279: Fix build of parsermodule under Cygwin. - -- Issue #4051: Prevent conflict of UNICODE macros in cPickle. - -- Issue #4228: Pack negative values the same way as 2.4 in struct's L format. - -- Issue #1040026: Fix os.times result on systems where HZ is incorrect. - -- Issues #3167, #3682: Fix test_math failures for log, log10 on Solaris, - OpenBSD. - -- Issue #4365: Add crtassem.h constants to the msvcrt module. - -- Issue #4396: The parser module now correctly validates the with statement. - -- Issue #5228: Make functools.partial objects can now be pickled. - -Tests ------ - -- Issue #7431: Use TESTFN in test_linecache instead of trying to create a file - in the Lib/test directory, which might be read-only for the user running the - tests. - -- Issue #7324: Add a sanity check to regrtest argument parsing to catch the case - of an option with no handler. - -- Issue #7312: Add a -F flag to run the selected tests in a loop until a test - fails. Can be combined with -j. - -- Issue #7295: Do not use a hardcoded file name in test_tarfile. - -- Issue #7270: Add some dedicated unit tests for multi-thread synchronization - primitives such as Lock, RLock, Condition, Event and Semaphore. - -- Issue #7222: Make thread "reaping" more reliable so that reference - leak-chasing test runs give sensible results. The previous method of reaping - threads could return successfully while some Thread objects were still - referenced. This also introduces a new private function: ``thread._count()``. - -- Issue #7151: Fixed regrtest -j so that output to stderr from a test no longer - runs the risk of causing the worker thread to fail. - -- Issue #7055: test___all__ now greedily detects all modules which have an - __all__ attribute, rather than using a hardcoded and incomplete list. - -- Issue #7058: Added save/restore for things like sys.argv and cwd to - runtest_inner in regrtest, with warnings if the called test modifies them, - and a new section in the summary report at the end. - -- Issue #7042: Fix test_signal (test_itimer_virtual) failure on OS X 10.6. - -- Issue #6806: test_platform failed under OS X 10.6.0 because ``sw_ver`` leaves - off the trailing 0 in the version number. - -- Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to - Lib/lib-tk/test/test_tkinter/test_loadtk. With this, these tests demonstrate - the same behaviour as test_ttkguionly (and now also test_tk) which is to skip - the tests if DISPLAY is defined but can't be used. - -- Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running - regression tests in parallel, shortening the total runtime. - -- Issue #5354: New test support function import_fresh_module() makes it easy to - import both normal and optimised versions of modules. test_heapq and - test_warnings have been adjusted to use it, tests for other modules with both - C and Python implementations in the stdlib can be adjusted to use it over - time. - -- Fix test_warnings to no longer reset the warnings filter. - -- Fix test_logging to no longer reset the warnings filter. - -- Issue #5635: Fix running test_sys with tracing enabled. - -- regrtest no longer treats ImportError as equivalent to SkipTest. Imports that - should cause a test to be skipped are now done using import_module from test - support, which does the conversion. - -- Issue #5083: New 'gui' resource for regrtest. - -- Issue #5837: Certain sequences of calls to set() and unset() for - support.EnvironmentVarGuard objects restored the environment variables - incorrectly on __exit__. - -- Issue #2389: Array objects are now pickled in a portable manner. - -Misc ----- - -- Issue #5611: Auto-detect whether a C file uses tabs or spaces in Vim. - - -What's New in Python 2.6 final -============================== - -*Release date: 01-Oct-2008* - -Core and Builtins ------------------ - -- Issue #3967: Fixed a crash in the count() and find() methods of string-like - objects, when the "start" parameter is a huge value. - -- Issue #3965: Fixed a crash on Windows when open() is given an invalid - filename or mode, and the filename is a unicode string. - -- Bug #3951: Py_USING_MEMORY_DEBUGGER should not be enabled by default. - -Library -------- - -- Issue #3965: Allow repeated calls to turtle.Screen, by making it a - true singleton object. - -- Issue #3895: It was possible to crash the interpreter when an external timer - was used with cProfile that returned an object that could not be converted - into a float. - -- Issue #3950: Made turtle respect scale factors. - -- Issue #3547: Fixed ctypes structures bitfields of varying integer - sizes. - -- Issue #3879: A regression in urllib.getproxies_environment was fixed. - -- Issue #3863: Disabled a unit test of fork being called from a thread - when running on platforms known to exhibit OS bugs when attempting that. - -Build ------ - -- Bug #3989: Package the 2to3 script (as 2to3.py) in the Windows - installer. - -- Bug #3887: Package x64 version of CRT for AMD64 Windows binaries. - - -What's New in Python 2.6 release candidate 2? -============================================= - -*Release date: 17-Sep-2008* - -Core and Builtins ------------------ - -Extension Modules ------------------ - -- Security Issue #2: imageop did not validate arguments correctly and could - segfault as a result. - -- Issue #3886: Possible integer overflows in the _hashopenssl module were - closed. - -Tools/Demos ------------ - -- Issue #3850: recursion tests in Tools/scripts/find_recursion_limit.py can raise - AttributeError instead of RuntimeError, depending in which C API call - exactly the recursion limit is exceeded. Consequently, both exception types - are caught and silenced. - -Build ------ - -- Issue #3617: Include a licensing statement regarding the Microsoft - C runtime in the Windows installer. - - -What's New in Python 2.6 release candidate 1? -============================================= - -*Release date: 12-Sep-2008* - -Core and Builtins ------------------ - -- Issue #3642: Suppress warning in obmalloc when size_t is larger than uint. - -- Issue #3743: In a few places, PY_FORMAT_SIZE_T was incorrectly used with - PyString_FromFormat or PyErr_Format to display size_t values. The macro - PY_FORMAT_SIZE_T is designed to select the correct format for the OS - ``printf`` function, whereas PyString_FromFormat has an independent - implementation and uses "%zd" on all platforms for size_t values. - This makes a difference on win64, where ``printf`` needs "%Id" to display - 64bit values. - -- Issue #3634: _weakref.ref(Exception).__init__() gave invalid return value on - error. - -- Issue #3777: long() applied to a float object now always return a long - object; previously an int would be returned for small values. the __long__ - method is allowed to return either an int or a long, but the behaviour of - float objects should not change to respect backward compatibility. - -- Issue #3751: str.rpartition would perform a left-partition when called with - a unicode argument. - -- Issue #3683: Fix compilation when --without-threads is given. - -- Issue #3668: Fix a memory leak with the "s*" argument parser in - PyArg_ParseTuple and friends, which occurred when the argument for "s*" - was correctly parsed but parsing of subsequent arguments failed. - -- Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to - match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__ - mechanism. In the process, fix a bug where isinstance() and issubclass(), - when given a tuple of classes as second argument, were looking up - __instancecheck__ / __subclasscheck__ on the tuple rather than on each - type object. - -- Fix crashes on memory allocation failure found with failmalloc. - -- Fix memory leaks found with valgrind and update suppressions file. - -- Fix compiler warnings in opt mode which would lead to invalid memory reads. - -- Fix problem using wrong name in decimal module reported by pychecker. - -- Silenced another compiler warning about a used but not defined - function 'stringlib_contains_obj'. - -- Added warnings on the use of ``__getslice__``, ``__setslice__``, or - ``__delslice__``. - -- Issue #3678: Correctly pass LDFLAGS and LDLAST to the linker on shared - library targets in the Makefile. - -- Issue #1204: The configure script now tests for additional libraries - that may be required when linking against readline. This fixes issues - with x86_64 builds on some platforms (a few Linux flavors and OpenBSD). - -C-API ------ - -- Aliased PyObject_Bytes to PyObject_Str. - -Library -------- - -- Issue #3640: Pickling a list or a dict uses less local variables, to reduce - stack usage in the case of deeply nested objects. - -- Issue #3629: Fix sre "bytecode" validator for an end case. - -- Issue #3811: The Unicode database was updated to 5.1. - -- Issue #3781: Further warnings.catch_warnings() cleanup to prevent - silent misbehaviour when a single instance is nested in multiple - with statements, or when the methods are invoked in the wrong order. - -- Issue #3809: Fixed spurious 'test.blah' file left behind by test_logging. - -- Issue #3781: Clean up the API for warnings.catch_warnings() by having it - return a list or None rather than a custom object. - -- Issue #1638033: Cookie.Morsel gained the httponly attribute. - -- Issue #3535: zipfile couldn't read some zip files larger than 2GB. - -- Issue #3776: Deprecate the bsddb package for removal in 3.0. - -- Issue #3762: platform.architecture() fails if python is lanched via - its symbolic link. - -- Issue #3772: Fixed regression problem in StreamHandler.emit(). - -- Issue #600362: Relocated parse_qs() and parse_qsl(), from the cgi module - to the urlparse one. Added a PendingDeprecationWarning in the old - module, it will be deprecated in the future. - -- Issue #2562: Fix distutils PKG-INFO writing logic to allow having - non-ascii characters and Unicode in setup.py meta-data. - -- Issue #3726: Allow spaces in separators in logging configuration files. - -- Issue #3719: platform.architecture() fails if there are spaces in the - path to the Python binary. - -- Issue #3602: Moved test.test_support.catch_warning() to - warnings.catch_warnings() along with some API cleanup. Expanding the tests - for catch_warnings() also led to an improvement in the raising of a - DeprecationWarning related to warnings.warn_explicit(). - -- The deprecation warnings for the old camelCase threading API were removed. - -- logging: fixed lack of use of encoding attribute specified on a stream. - -- Silenced a trivial compiler warning in the sqlite module. - -- Fixed two format strings in the _collections module. - -- Issue #3703: _fileio.FileIO gave unhelpful error message when trying to open a - directory. - -- Issue #3708: os.urandom no longer goes into an infinite loop when passed a - non-integer floating point number. - -- Issue #3110: multiprocessing fails to compiel on solaris 10 due to missing - SEM_VALUE_MAX. - -Extension Modules ------------------ - -- Issue #4301: Patch the logging module to add processName support, remove - _check_logger_class from multiprocessing. - -- Issue #2975: When compiling several extension modules with Visual Studio 2008 - from the same python interpreter, some environment variables would grow - without limit. - -- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by - exploitation of poor argument checking. - -- sqlite3: Changed docstring of iterdump() to mark method as "Non-standard". - -- Issue #3103: Reduced globals symbols used by sqlite3 module and made sure all - remaining ones have "pysqlite_" prefix. - -- Issue #3846: Release the GIL during sqlite3_prepare calls. This improves - concurrent access to the same SQLite database from multiple - threads/processes. - -Tests ------ - -- Issue #3781: Add test.test_support.check_warnings() as a convenience - wrapper for warnings.catch_warnings() that makes it easier to check - that expected warning messages are being reported. - -- Issue #3796: Some tests functions were not enabled in test_float. - -- Issue #3768: Move test_py3kwarn over to the new API for catch_warnings(). - -Build ------ - -- Issue #3833: Use a different upgrade code for Win64 installers. - -- Issue #2271: Set SecureCustomProperties so that installation will properly - use the TARGETDIR even for unprivileged users. - -- Allow passing the MSI file name to merge.py. - -- Issue #3758: Rename the 'check' target to 'patchcheck' so as to not clash - with GNU build target guidelines. - - -What's New in Python 2.6 beta 3? -================================ - -*Release date: 20-Aug-2008* - -Core and Builtins ------------------ - -- Issue #1878: Remove Py_TPFLAGS_HAVE_VERSION_TAG from - Py_TPFLAGS_DEFAULT when not building the core. This means 3rd party - extensions do not automatically benefit from the class attribute - cache; they will have to explicitly add Py_TPFLAGS_HAVE_VERSION_TAG - to their tp_flags field if they care. This is a backwards - compatibility feature; in 3.0, all types will use the cache by - default. - -- Keyword arguments can now follow starred arguments. (``f(a, *args, - keyword=23)`` is now valid syntax.) - -- ctypes function pointers that are COM methods have a boolean True - value again. - -- Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple, - by denying s# to parse objects that have a releasebuffer procedure, - and introducing s*. - -- Issue #3537: Fix an assertion failure when an empty but presized dict - object was stored in the freelist. - -- Issue #1481296: Make long(float('nan')) and int(float('nan')) raise - ValueError consistently across platforms. - -- Issue #3479: On platforms where sizeof(int) is smaller than sizeof(long) - (64bit Unix, for example), unichr() would truncate its argument and return - u'\x00' for unichr(2**32). Now it properly raises an OverflowError. - -- Apply security patches from Apple. - -- Issue #2542: Now that issubclass() may call arbitrary code, ensure that - PyErr_ExceptionMatches returns 0 when an exception occurs there. - -- Issue #1819: function calls with several named parameters are now on - average 35% faster (as measured by pybench). - -- Issue #2378: An unexpected UnboundLocalError or NameError could appear when - the python debugger steps into a class statement: the free variables (local - variables defined in an outer scope) would be deleted from the outer scope. - -- Issue #2620: Overflow checking when allocating or reallocating memory - was not always being done properly in some python types and extension - modules. PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have - all been updated to perform better checks and places in the code that - would previously leak memory on the error path when such an allocation - failed have been fixed. - -Library -------- - -- Issue #3612: Added some missing basic types in ctypes.wintypes. - -- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of - symtable.Symbol have been deprecated for removal in 3.0 and the next release. - -- Issue #2234: distutils failed for some versions of the cygwin compiler. The - version reported by these tools does not necessarily follow the python - version numbering scheme, so the module is less strict when parsing it. - -- Issue #2235: Added Py3k warnings for types which will become unhashable - under the stricter __hash__ inheritance rules in 3.0. Several types - which did not meet the rules for hash invariants and were already - unhashable in 3.0 have now been explicitly flagged as unhashable in - 2.6 as well (collections.Mapping, collections.Set, unittest.TestSuite, - xml.dom.minidom.NamedNodeMap, numbers.Number, UserList.UserList) - -- Update __all__ for cookielib, csv, os, urllib2, and weakref to include things - imported into the module but exposed as part of the module's API. - -- Remove an unneeded import of abc.ABCMeta from 'inspect'. - -- Remove unneeded imports of 'sys' and 'warnings' from 'io'. - -- Remove unneeded imports of 'warnings' from shelve, filecmp, and dummy_thread. - -- Issue #3575: Incremental decoder's decode function now takes bytearray - by using 's*' instead of 't#'. - -- Issue #2222: Fixed reference leak when occurred os.rename() - fails unicode conversion on 2nd parameter. (windows only) - -- Issue #2464: urllib2 now supports a malformation in the URL received - in a redirect. - -- Silence the DeprecationWarning raised when importing mimetools in - BaseHTTPServer, cgi (and rfc822), httplib. - -- Issue #2776: fixed small issue when handling a URL with double slash - after a 302 response in the case of not going through a proxy. - -- Issue #2676: in the email package, content-type parsing was hanging on - pathological input because of quadratic or exponential behaviour of a - regular expression. - -- Issue #3476: binary buffered reading through the new "io" library is now - thread-safe. - -- Silence the DeprecationWarning of rfc822 when it is imported by mimetools - since mimetools itself is deprecated. Because modules are cached, all - subsequent imports of rfc822 will not raise a visible DeprecationWarning. - -- Issue #3134: shutil referenced undefined WindowsError symbol. - -- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to - menu entries were not deleted. - -- Copied the implementation of reduce() to _functools.reduce() to have a - version that did not raise a DeprecationWarning under -3. - -- Issue #3205: When iterating over a BZ2File fails allocating memory, raise - a MemoryError rather than silently stop the iteration. - -- Issue #3487: sre "bytecode" validator. Passing invalid "re-bytecode" - to _sre.compile() will now be rejected. This should not affect anybody - since the re.compile() function never generates invalid re-bytecode. - -- Issue #3436: Make csv.DictReader's fieldnames attribute a property so that - upon first access it can be automatically initialized from the csv file if - it wasn't initialized during instantiation. - -- Issue #2338: Create imp.reload() to help with transitioning to Python 3.0 as - the reload() built-in has been removed. - -- Changed code in the following modules/packages to remove warnings raised - while running under the ``-3`` flag: aifc, asynchat, asyncore, bdb, bsddb, - ConfigParser, cookielib, csv, difflib, distutils, DocXMLRPCServer, email, - filecmp, fileinput, inspect, logging, modulefinder, pdb, pickle, profile, - pstats, pydoc, re, rlcompleter, SimpleXMLRPCServer, shelve, socket, - subprocess, sqlite3, tarfile, Tkinter, test.test_support, textwrap, - threading, tokenize, traceback, urlparse, wsgiref, xml, xmlrpclib. - -- Issue #3039: Fix tarfile.TarFileCompat.writestr() which always - raised an AttributeError. - -- Issue #2523: Fix quadratic behaviour when read()ing a binary file without - asking for a specific length. This problem only affected files opened - using the new "io" module, not the built-in open() function. - -- Issue #3449: Update decimal module to use most recent specification - (v. 1.68) and tests (v. 2.58) from IBM. - -- Issue #3437: Bug fix in robotparser parsing of Allow: lines. - -- Issue #1592: Improve error reporting when operations are attempted - on a closed shelf. - -- Deprecate the "ast" parser function aliases. - -- Issue #3120: On 64-bit Windows the subprocess module was truncating handles. - -- Issue #3303: Fix a crash in locale.strcoll() when calling it with - invalid arguments. - -- Issue #3302: Fix several crashes when calling locale's gettext functions - with None arguments. - -- Issue #3389: Allow resolving dotted names for handlers in logging - configuration files. - -- Deprecate the sunaudio module for removal in Python 3.0. - -- Issue #3394: zipfile.writestr sets external attributes when passed a - file name rather than a ZipInfo instance, so files are extracted with - mode 0600 rather than 000 under Unix. - -- Issue #1857: subprocess.Popen.poll gained an additional _deadstate keyword - argument in python 2.5, this broke code that subclassed Popen to include its - own poll method. Fixed my moving _deadstate to an _internal_poll method. - -Build ------ - -- Generate the PatternGrammar pickle during "make install". - -Documentation -------------- - -- Issue #2235: the C API function PyObject_HashNotImplemented and its - interaction with the tp_hash slot (added in 2.6b2) are now documented - -- Issue #643841: The language reference now provides more detailed - coverage of the lookup process for special methods. The disclaimers - regarding lack of coverage of new-style classes have also been - removed, since the coverage is now fairly reasonable. - - -What's New in Python 2.6 beta 2? -================================ - -*Release date: 17-Jul-2008* - -Core and Builtins ------------------ - -- Issue #3156: Fix inconsistent behavior of the bytearray type: all - its methods now allow for items objects that can be converted to - an integer using operator.index(). - -- Issue #3360: Fix incorrect parsing of '020000000000.0', which - produced a ValueError instead of giving the correct float. - -- Issue #3083: Add alternate (#) formatting for bin, oct, hex output - for str.format(). This adds the prefix 0b, 0o, or 0x, respectively. - -- Issue #3008: the float type has a new instance method 'float.hex' - and a new class method 'float.fromhex' to convert floating-point - numbers to and from hexadecimal strings, respectively. - -- Issue #2235: __hash__ is once again inherited by default. To allow - collections.Hashable to remain meaningful in the presence of the - default hash implementation (object.__hash__), it is now possible - to explicit block inheritance of hash by setting __hash__=None at - the Python level, or tp_hash=PyObject_HashNotImplemented at the C - level. - -- Issue #3221: Issue a RuntimeWarning instead of raising SystemError if - the parent module cannot be found while performing an absolute import. - This means that an incorrectly defined __package__ attribute will - now only prevent relative imports in that module rather than causing - all imports from that module to fail. - -- Issue #2517: Allow unicode messages in Exceptions again by correctly - bypassing the instance dictionary when looking up __unicode__ on - new-style classes. - -- Issue #3242: Fix a crash inside the print statement, if sys.stdout is - set to a custom object whose write() method happens to install - another file in sys.stdout. - -- Issue #3088: Corrected a race condition in classes derived from - threading.local: the first member set by a thread could be saved in - another thread's dictionary. - -- Issue #3004: Minor change to slice.indices(): the start and stop - arguments are now treated identically, making the behaviour easier - to describe and understand. For example, slice(None, -10, - 1).indices(9) now returns (0, 0, 1) instead of (0, -1, 1), and - slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, - 10, -1). - -- Issue #3219: Calling a function with repeated keyword arguments, - f(a=2, a=23), would not cause a syntax error. This was a regression - from 2.4 caused by the switch to the new compiler. - -- Issue #2862: Make int and float freelist management consistent with - other freelists. Changes their CompactFreeList apis into - ClearFreeList apis and calls them via gc.collect(). - -Library -------- - -- Issue #3554: ctypes.string_at and ctypes.wstring_at did call Python - api functions without holding the GIL, which could lead to a fatal - error when they failed. - -- Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. - -- Issue #3395: fix reference in test_multiprocessing to old debugInfo method - -- Issue #3312: Fix two crashes in sqlite3. - -- Issue #1608818: Fix misbehavior in os.listdir() if readdir() fails. - -- Issue #3125: Remove copy_reg in multiprocessing and replace it with - ForkingPickler.register() to resolve conflict with ctypes. - -- Issue #3090: Fixed ARCHFLAGS parsing on OS/X - -- Issue #3313: Fixed a crash when a failed dlopen() call does not set - a valid dlerror() message. - -- Issue #3258: Fixed a crash when a ctypes POINTER type to an - incomplete structure was created. - -- Issue #3339: dummy_thread.acquire() should not return None. - -- Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. - -- Issue #3301: Bisect module behaved badly when lo was negative. - -- Issue #839496: SimpleHTTPServer used to open text files in text mode. This is - both unnecessary (HTTP allows text content to be sent in several forms) and - wrong because the actual transmitted size could differ from the - content-length. The problem had been corrected in the 2.4 branch, but never - merged into trunk. - -- Issue #2663: add filtering capability to shutil.copytree(). - -- Issue #1622: Correct interpretation of various ZIP header fields. - -- Issue #1526: Allow more than 64k files to be added to Zip64 file. - -- Issue #1746: Correct handling of zipfile archive comments (previously - archives with comments over 4k were flagged as invalid). Allow writing - Zip files with archives by setting the 'comment' attribute of a ZipFile. - -- Issue #449227: The rlcompleter module now adds "(" to callable objects - when completed. - -- Issue #3190: Pydoc now hides the automatic module attribute __package__ (the - handling is now the same as that of other special attributes like __name__). - -- Issue #2885 (partial): The urllib.urlopen() function has been deprecated for - removal in Python 3.0 in favor of urllib2.urlopen(). - -- Issue #2113: Fix error in subprocess.Popen if the select system call is - interrupted by a signal. - -- Issue #3309: Fix bz2.BZFile iterator to release its internal lock - properly when raising an exception due to the bz2file being closed. - Prevents a deadlock. - -- Issue #3094: httplib.HTTPSConnection Host: headers no longer include the - redundant ":443" port number designation when the connection is using the - default https port (443). - -- Issue #874900: after an os.fork() call the threading module state is cleaned - up in the child process to prevent deadlock and report proper thread counts - if the new process uses the threading module. - -Tests ------ - -- test.test_support.catch_warning now keeps track of all warnings it sees - and is now better documented. Explicit unit tests for this context manager - have been added to test_warnings. - -Build ------ - -- Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. - -Documentation -------------- - -- Document that robotparser has been renamed to urllib.robotparser in - Python 3.0. - -- Document that urlparse has been renamed to urllib.parse in Python 3.0. - -- Document that urllib2 is split across multiple modules and renamed in - Python 3.0. - -- Document that urllib is split across multiple modules and renamed in - Python 3.0. - - -What's New in Python 2.6 beta 1? -================================ - -*Release date: 18-June-2008* - -Core and Builtins ------------------ - -- Issue #3211: warnings.warn_explicit() did not guard against its 'registry' - argument being anything other than a dict or None. Also fixed a bug in error - handling when 'message' and 'category' were both set to None, triggering a - bus error. - -- 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(), - intersection(), intersection_update(), difference(), and difference_update(). - -- Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. - -- New environment variable PYTHONIOENCODING. - -- Patch #2488: Add sys.maxsize. - -- Issue #2353: file.xreadlines() now emits a Py3k warning. - -- Issue #2863: generators now have a ``gen.__name__`` attribute that - equals ``gen.gi_code.co_name``, like ``func.__name___`` that equals - ``func.func_code.co_name``. The repr() of a generator now also - contains this name. - -- Issue #2831: enumerate() now has a ``start`` argument. - -- Issue #2801: fix bug in the float.is_integer method where a - ValueError was sometimes incorrectly raised. - -- Issue #2790: sys.flags was not properly exposing its bytes_warning - attribute. - -- Issue #2196: hasattr() now lets exceptions which do not inherit - Exception (KeyboardInterrupt, and SystemExit) propagate instead of - ignoring them. - -- Added checks for integer overflows, contributed by Google. Some are - only available if asserts are left in the code, in cases where they - can't be triggered from Python code. - -Extension Modules ------------------ -- Issue #1179: [CVE-2007-4965] Integer overflow in imageop module. - -- Issue #3116: marshal.dumps() had quadratic behavior for strings > 32Mb. - -- Issue #2138: Add factorial() to the math module. - -- The heapq module does comparisons using LT instead of LE. This - makes its implementation match that used by list.sort(). - -- Issue #2819: add full-precision summation function to math module, - based on Hettinger's ASPN Python Cookbook recipe. - -- Issue #2592: delegate nb_index and the floor/truediv slots in - weakref.proxy. - -- Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the - platform. - -- Support for Windows 9x has been removed from the winsound module. - -- bsddb module updated to version 4.7.3. - http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3. This - code should be compatible with Python 3.0. - -- Issue #2858: Fix potential memory corruption when - bsddb.db.DBEnv.lock_get and other bsddb.db object constructors - raised an exception. - -- Issue #2669: bsddb/__init__.py iteration no longer silently fails when - the database has changed size during iteration. It now raises a - RuntimeError in the same manner as a dictionary. - -- Issue #2870: cmathmodule.c compile error. - -- Added a threading.Thread.ident property. - -Library -------- - -- logging.config: Removed out-of-date comment in _install_handlers and - used issubclass in place of equality comparison of classes. - -- Issue #2722: Now the os.getcwd() supports very long path names. - -- Issue #2888: Fixed the behaviour of pprint when working with nested - structures, to match the behaviour of 2.5 and 3.0 (now follows the common - sense). - -- Issue #1817: cgi now correctly handles the querystring on POST requests - -- 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. - -- The rfc822 module has been deprecated for removal in 3.0. - -- The mimetools module has been deprecated for removal in 3.0. - -- The ctypes.byref function now takes an optional second parameter - which specifies an offset in bytes for the constructed pointer-like object. - -- Added the ast module. - -- Added the multiprocessing module, PEP 371. - -- Factored out the indentation cleaning from inspect.getdoc() into - inspect.cleandoc() to ease standalone use. - -- Issue #1798: Add ctypes calling convention that allows safe access - to errno. - -- Issue #2404: ctypes objects support the new pep3118 buffer interface. - -- Patch #2125: Add GetInteger and GetString methods for - msilib.Record objects. - -- Issue #2782: The datetime module's strftime methods now accept - unicode format strings just as time.strftime always has. - -- The sgmllib and htmllib modules have been deprecated for removal - in Python 3.0. - -- Issue #3011: locale module alias table was updated to the latest - version from the X.org locale.alias file. - -- Issue #1797 (partial fix): ctypes NULL function pointers have a - False boolean value now. - -- Issue #2985: Allow 64-bit integer responses (````) in XMLRPC - transfers. - -- Issue #2877: The UserString.MutableString class has been removed in - Python 3.0. - -- Do not close external file objects passed to tarfile.open(mode='w:bz2') - when the TarFile is closed. - -- Issue #2959: For consistency with other file-like objects, gzip's - GzipFile.close() can now be called multiple times without raising - an exception. - -- Issue #1390: Raise ValueError in toxml when an invalid comment would - otherwise be produced. - -- Issue #2914: TimedRotatingFileHandler now takes an optional keyword - argument "utc" to use UTC time rather than local time. - -- Issue #2929: TimedRotatingFileHandler was using the wrong path when - deleting old log files (filename only instead of full path). - -- Issue #1775025: You can now specify zipfile members to open(), - read() or extract() via a ZipInfo instance. This allows handling - duplicate filenames in zipfiles. - -- Issue #961805: Fix Text.edit_modified() in Tkinter. - -- Issue #1793: Function ctypes.util.find_msvcrt() added that returns - the name of the C runtime library that Python uses. - ctypes.util.find_library(name) now call this function when name is - 'm' or 'c'. - -- The statvfs module has been deprecated for removal in Python 3.0. - -- The sunaudiodev and SUNAUDIODEV modules have been deprecated for - removal in Python 3.0. - -- The WAIT module from IRIX has been deprecated for removal in Python - 3.0. - -- The torgb module from IRIX has been deprecated for removal in Python - 3.0. - -- The SV module from IRIX has been deprecated for removal in Python - 3.0. - -- The readcd module from IRIX has been deprecated for removal in - Python 3.0. - -- The panelparser module from IRIX has been deprecated for removal in - Python 3.0. - -- The panel module from IRIX has been deprecated for removal in Python - 3.0. - -- The jpeg module from IRIX has been deprecated for removal in Python - 3.0. - -- The IOCTL module from IRIX has been deprecated for removal in Python - 3.0. - -- The IN module from IRIX has been deprecated for removal in Python - 3.0. - -- The imgfile module from IRIX has been deprecated for removal in - Python 3.0. - -- The GLWS module from IRIX has been deprecated for removal in Python - 3.0. - -- The GET module from IRIX has been deprecated for removal in Python - 3.0. - -- The fm module from IRIX has been deprecated for removal in Python - 3.0. - -- The FL, flp, and fl modules from IRIX have been deprecated for - removal in Python 3.0. - -- The FILE module on IRIX has been deprecated for removal in Python - 3.0. - -- The ERRNO module on IRIX has been deprecated for removal in Python - 3.0. - -- The DEVICE, GL, gl, and cgen modules (which indirectly includes - cgensupport) have been deprecated for removal in Python 3.0. - -- The CL, CL_old, and cl modules for IRIX have been deprecated for - removal in Python 3.0. - -- The cdplayer module for IRIX has been deprecated for removal in - Python 3.0. - -- The cddb module for IRIX has been deprecated for removal in Python - 3.0. - -- The cd and CD modules for IRIX have been deprecated for removal in - Python 3.0. - -- The al and AL modules for IRIX have been deprecated for removal in - Python 3.0. - -- Issue #1713041: fix pprint's handling of maximum depth. - -- The timing module has been deprecated for removal in Python 3.0. - -- The sv module has been deprecated for removal in Python 3.0. - -- The multifile module has been deprecated as per PEP 4. - -- The imageop module has been deprecated for removal in Python 3.0. - -- Issue #2250: Exceptions raised during evaluation of names in - rlcompleter's ``Completer.complete()`` method are now caught and - ignored. - -- Issue #2659: Added ``break_on_hyphens`` option to textwrap - TextWrapper class. - -- The mhlib module has been deprecated for removal in Python 3.0. - -- The linuxaudiodev module has been deprecated for removal in Python - 3.0. - -- The ihooks module has been deprecated for removal in Python 3.0. - -- The fpformat module has been deprecated for removal in Python 3.0. - -- The dl module has been deprecated for removal in Python 3.0. - -- The Canvas module has been deprecated for removal in Python 3.0. - -- The compiler package has been deprecated for removal in Python 3.0. - -- The Bastion and rexec modules have been deprecated for removal in - Python 3.0. - -- The bsddb185 module has been deprecated for removal in Python 3.0. - -- The pure module has been deprecated for removal in Python 3.0. - -- Issue #2487: change the semantics of math.ldexp(x, n) when n is too - large to fit in a C long. ldexp(x, n) now returns a zero (with - suitable sign) if n is large and negative; previously, it raised - OverflowError. - -- The toaiff module has been deprecated for removal in Python 3.0. - -- The test.testall module has been deprecated for removal in Python - 3.0. - -- The new module has been deprecated for removal in Python 3.0. - -- The user module has been deprecated for removal in Python 3.0. - -- The stringold module has been deprecated for removal in Python 3.0. - -- The mutex module has been deprecated for removal in Python 3.0. - -- The imputil module has been deprecated for removal in Python 3.0. - -- test.test_support.catch_warning() gained a 'record' argument. - -- os.path.walk is deprecated in favor of os.walk. - -- pdb gained the "until" command. - -- 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 - environment to control the '-arch' flags that are used to build - an extension. This was added for compatibility with Apple's build - of Python. - -- The bundled OSX-specific copy of libbffi is now in sync with the version - shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. - -- The threading module gained aliases for names that will be removed in the - 3.x series. - -Build ------ - -- The Windows installer now includes Tk 8.5, bzip2 1.0.5, and SQLite 3.5.9. - -- Patch #1722225: Support QNX 6. - -- ``Lib/lib-old`` is now added to sys.path. - -- On MacOS X it is now possible to install the framework in 64-bit - mode or even as a 4-way universal binary (that is, PPC, i386, - PPC64 and x86_64 support in one binary). - - This is controlled by the configure argument ``--with-universal-archs``: - - - ``--with-universal-archs=all``: install 4-way universal - - - ``--with-universal-archs=32-bit``: install 2-way universal, 32-bit (the default) - - - ``--with-universal-archs=64-bit``: install 2-way universal, 64-bit - - This option should be used in combination with ``--enable-universalsdk=``. - - NOTE: 64-bit and 4-way builds are only suppported on Mac OS X 10.5 (or later). - -C API ------ - -- Add ``PyType_Modified()`` as a public API to clear the type cache. - -- The PyBytes functions have been renamed to PyByteArray. - -- The PyString functions have been renamed to PyBytes. A batch of - defines were added so that the linker still sees the original - PyString names. - - -What's New in Python 2.6 alpha 3? -================================= - -*Release date: 08-May-2008* - -Core and builtins ------------------ - -- Issue #2719: backported the ``next()`` builtin from Python 3. - -- Issue #2681: The octal literal ``0o8`` was incorrecly acctepted. Now - it properly raises a SyntaxError. - -- Issue #2617: Reserved -J and -X arguments for Jython, IronPython and - other implementations of Python. - -- Implemented PEP 370: Per user site-packages directory. - -Extension Modules ------------------ - -- Issue #2670: Fix a failure in urllib2.build_opener(), when passed - two handlers that derive the same default base class. - -- Added kill, terminate and send_signal(sig) to subprocess.Popen. - -- Added phase(z) -> phi, polar(z) -> r, phi and rect(r, phi) -> z to - the cmath module. - -- Four new methods were added to the math and cmath modules: acosh, - asinh, atanh and log1p. - -- zlib.decompressobj().flush(value) no longer crashes the interpreter - when passed a value less than or equal to zero. - -- Issue #1631171: Re-implement the 'warnings' module in C (the - original Python code has been kept as backup). This will allow for - using the 'warning's machinery in such places as the parser where - use of pure Python code is not possible. Both the ``showarning()`` - and ``formatwarning()`` gain an optional 'line' argument which is - not called by default for backwards-compatibility reasons. Setting - ``warnings.showwarning()`` to an implementation that lacks support - for the ``line`` argument will raise a DeprecationWarning. - -Library -------- - -- The audiodev module has been deprecated for removal in Python 3.0. - -- Issue #2750: Add the 'json' package. Based on simplejson 1.9 and - contributed by Bob Ippolito. - -- Issue #1734346: Support Unicode file names for zipfiles. - -- Issue #2581: distutils: Vista UAC/elevation support for - bdist_wininst. - -- Issue #2635: Fix bug in 'fix_sentence_endings' textwrap.fill option, - where an extra space was added after a word containing (but not - ending in) '.', '!' or '?'. - -- Add from_buffer() and from_buffer_copy() class methods to ctypes - data types. - -- Issue #2682: ctypes callback functions no longer contain a cyclic - reference to themselves. - -- The getpass module has been improved on Unix. It now uses /dev/tty - by default and uses stderr instead of stdout. A GetPassWarning is - issued when input echo cannot be controlled. - -- Issue #2014: Allow XML-RPC datetime objects to have dates before - 1900-01-01. - -- Issue #2439: Added new function pkgutil.get_data(), which is a - convenience wrapper for the PEP 302 get_data() API. - -- Issue #2616: The ctypes.pointer() and ctypes.POINTER() functions are - now implemented in C for better performance. - -- Issue #2408: The ``_types`` module, which was used as in - implementation detail of the public ``types`` module, has been - removed and replaced by pure python code. - -- Issue #2513: distutils on Windows is now capable of cross-compiling - extension modules between 32 and 64 bit platforms. See the distutls - build documentation for more information. - -- Issue #815646: Individual file objects may now be used from multiple - threads at once without fear of crashing the Python interpreter. If - file.close() is called while an object is in use by another thread - an IOError exception will be raised and the file will not be closed. - -- The bundled libffi copy is now in sync with the recently released - libffi3.0.5 version, apart from some small changes to - Modules/_ctypes/libffi/configure.ac. - -- Issue #2385: distutils.core.run_script() makes __file__ available, - so the controlled environment will more closely mirror the typical - script environment. This supports setup.py scripts that refer to - data files. - -Tests ------ - -- Issue #2550: The approach used by client/server code for obtaining - ports to listen on in network-oriented tests has been refined in an - effort to facilitate running multiple instances of the entire - regression test suite in parallel without issue. - test_support.bind_port() has been fixed such that it will always - return a unique port -- which wasn't always the case with the - previous implementation, especially if socket options had been set - that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The - new implementation of bind_port() will actually raise an exception - if it is passed an AF_INET/SOCK_STREAM socket with either the - SO_REUSEADDR or SO_REUSEPORT socket option set. Furthermore, if - available, bind_port() will set the SO_EXCLUSIVEADDRUSE option on - the socket it's been passed. This currently only applies to - Windows. This option prevents any other sockets from binding to the - host/port we've bound to, thus removing the possibility of the - 'non-deterministic' behaviour, as Microsoft puts it, that occurs - when a second SOCK_STREAM socket binds and accepts to a host/port - that's already been bound by another socket. The optional preferred - port parameter to bind_port() has been removed. Under no - circumstances should tests be hard coding ports! - - test_support.find_unused_port() has also been introduced, which will - pass a temporary socket object to bind_port() in order to obtain an - unused port. The temporary socket object is then closed and - deleted, and the port is returned. This method should only be used - for obtaining an unused port in order to pass to an external program - (i.e. the -accept [port] argument to openssl's s_server mode) or as - a parameter to a server-oriented class that doesn't give you direct - access to the underlying socket used. - - Finally, test_support.HOST has been introduced, which should be used - for the host argument of any relevant socket calls (i.e. bind and - connect). - - The following tests were updated to following the new conventions: - test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, - test_poplib, test_ftplib, test_telnetlib, test_socketserver, - test_asynchat and test_socket_ssl. - - It is now possible for multiple instances of the regression test - suite to run in parallel without issue. - -Build ------ - -- Issue #1496032: On alpha, use -mieee when gcc is the compiler. - -- Issue #2544: On HP-UX systems, use 'gcc -shared' for linking when - gcc is used as compiler. - -- Issue #2573: On MacOS X it is now possible to install the framework - with a different name using --with-framework-name=NAME. - -C API ------ - -- Added implementation of copysign, acosh, asinh, atanh and log1p to - the new files Include/pymath.h and Python/pymath.h for platforms - which provide the functions through their libm. The files also - contains several helpers and constants for math. - -- Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings. - - -What's New in Python 2.6 alpha 2? -================================= - -*Release date: 02-Apr-2008* - -Core and builtins ------------------ - -- Issue #1733757: The interpreter would hang on shutdown if the - tracing function set by sys.settrace is still active and happens to - call threading.currentThread(). - -- Patch #1442: properly report exceptions when the PYTHONSTARTUP file - cannot be executed. - -- The compilation of a class nested in another class used to leak one - reference on the outer class name. - -- Patch #1810: compile() can now compile _ast trees as returned by - ``compile(..., PyCF_ONLY_AST)``. - -- Patch #2426: Added sqlite3.Connection.iterdump method to allow easy - dumping of databases. Contributed by Paul Kippes at PyCon 2008. - -- Patch #2477: Added from __future__ import unicode_literals. - -- Added backport of bytearray type. - -- Issue #2355: add Py3k warning for buffer(). - -- Issue #1477: With narrow Unicode builds, the unicode escape sequence - \Uxxxxxxxx did not accept values outside the Basic Multilingual - Plane. This affected raw unicode literals and the - 'raw-unicode-escape' codec. Now UTF-16 surrogates are generated in - this case, like normal unicode literals and the 'unicode-escape' - codec. - -- Issue #2348: add Py3k warning for file.softspace. - -- Issue #2346/#2347: add Py3k warnings for __methods__ and - __members__. - -- Issue #2358: Add a Py3k warning on sys.exc_clear() usage. - -- Issue #2400: Allow relative imports to "import *". - -- Issue #1745: Backport print function with ``from __future__ import - print_function``. - -- Issue #2332: add new attribute names for instance method objects. - The two changes are: im_self -> __self__ and im_func -> __func__ - -- Issue #2379: Raise a Py3K warning for __getitem__ or __getslice__ on - exception instances. - -- Issue #2371: Add a Py3k warning when catching an exception that - doesn't derive from BaseException. - -- Issue #2341: Add a Py3k warning when raising an exception that - doesn't derive from BaseException. - -- Issue #2321: use pymalloc for unicode object string data to reduce - memory usage in some circumstances. - -- PEP 3127: octal literals now start with "0o". Old-style octal - literals are still valid. There are binary literals with a prefix of - "0b". This also affects int(x, 0). - -- Issue #2359: Adding deprecation warnings for array.{read,write}. - -- Issue #1779871: GNU gcc can now build Python on OS X because the - flags -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd are no - longer passed. - -- Add a warning when asserting a non-empty tuple which is always true. - -- Issue #2179: speed up with statement execution by storing the exit - method on the stack instead of in a temporary variable (patch by - Jeffrey Yaskin) - -- Issue #2238: Some syntax errors in *args and **kwargs expressions - could give bogus error messages. - -- Issue #2143: Fix embedded readline() hang on SSL socket EOF. - -Extension Modules ------------------ - -- Patch #2240: Implement signal.setitimer and signal.getitimer. - -Library -------- - -- Issue #2315: logging.handlers: TimedRotatingFileHandler now accounts - for daylight savings time in calculating the next rollover. - -- Issue #2316: logging.handlers: TimedRotatingFileHandler now - calculates rollovers correctly even when nothing is logged for a - while. - -- Issue #2317: logging.handlers: TimedRotatingFileHandler now uses - improved logic for removing old files. - -- Issue #2495: tokenize.untokenize now inserts a space between two - consecutive string literals; previously, ["" ""] was rendered as - [""""], which is incorrect python code. - -- Issue #2248: return the result of the QUIT command. from - SMTP.quit(). - -- Backport of Python 3.0's io module. - -- Issue #2482: Make sure that the coefficient of a Decimal is always - stored as a str instance, not as a unicode instance. This ensures - that str(Decimal) is always an instance of str. - -- Issue #2478: fix failure of decimal.Decimal(0).sqrt() - -- Issue #2432: give DictReader the dialect and line_num attributes - advertised in the docs. - -- Issue #2460: Make Ellipsis object copyable. - -- Issue #1681432: Add triangular distribution to the random module - -- Issue #2136: urllib2's auth handler now allows single-quoted realms - in the WWW-Authenticate header. - -- Issue #2434: Enhanced platform.win32_ver() to also work on Python - installation which do not have the win32all package installed. - -- Added support to platform.uname() to also report the machine and - processor information on Windows XP and later. As a result, - platform.machine() and platform.processor() will report this - information as well. - -- The library implementing the 2to3 conversion, lib2to3, was added to - the standard distribution. - -- Issue #1747858: Fix chown to work with large uid's and gid's on - 64-bit platforms. - -- Issue #1202: zlib.crc32 and zlib.adler32 no longer return different - values on 32-bit vs. 64-bit python interpreters. Both were correct, - but they now both return a signed integer object for consistency. - -- Issue #1158: add %f format (fractions of a second represented as - microseconds) to datetime objects. Understood by both strptime and - strftime. - -- Issue #705836: struct.pack(">f", x) now raises OverflowError on all - platforms when x is too large to fit into an IEEE 754 float; - previously it only raised OverflowError on non IEEE 754 platforms. - -- Issues #2166, #1741 and #1531505: now distutils deals with HOME - correctly under win32 - -- Patch #1858: distutils: added multiple server support in .pypirc - -- Issue #1106316: pdb.post_mortem()'s parameter, "traceback", is now - optional: it defaults to the traceback of the exception that is - currently being handled (is mandatory to be in the middle of an - exception, otherwise it raises ValueError). - -- Issue #1193577: A .shutdown() method has been added to SocketServers - which terminates the .serve_forever() loop. - -- Issue #2220: handle rlcompleter attribute match failure more - gracefully. - -- Issue #2225: py_compile, when executed as a script, now returns a - non- zero status code if not all files could be compiled - successfully. - -- Bug #1725737: In distutils' sdist, exclude RCS, CVS etc. also in the - root directory, and also exclude .hg, .git, .bzr, and _darcs. - -- Issue #1872: The struct module typecode for _Bool has been changed - from 't' to '?'. - -- The bundled libffi copy is now in sync with the recently released - libffi3.0.4 version, apart from some small changes to - Modules/_ctypes/libffi/configure.ac. On OS X, preconfigured libffi - files are used. On all linux systems the --with-system-ffi - configure option defaults to "yes". - -- Issue #1577: shutil.move() now calls os.rename() if the destination - is a directory instead of copying-then-remove-source. - -Tests ------ - -- test_nis no longer fails when test.test_support.verbose is true and - NIS is not set up on the testing machine. - -- Output comparison tests are no longer supported. - -- Rewrite test_errno to use unittest and no longer be a no-op. - -- GHOP 234: Convert test_extcall to doctest. - -- GHOP 290: Convert test_dbm and test_dummy_threading to unittest. - -- GHOP 293: Convert test_strftime, test_getargs, and test_pep247 to - unittest. - -- Issue #2055: Convert test_fcntl to unittest. - -- Issue #1960: Convert test_gdbm to unittest. - -- GHOP 294: Convert test_contains, test_crypt, and test_select to - unittest. - -- GHOP 238: Convert test_tokenize to use doctest. - -- GHOP 237: Rewrite test_thread using unittest. - -- Patch #2232: os.tmpfile might fail on Windows if the user has no - permission to create files in the root directory. - -Build ------ - -- A new script 2to3 is now installed, to run the 2.x to 3.x converter. - -- Python/memmove.c and Python/strerror.c have been removed; both - functions are in the C89 standard library. - -- Patch #2284: Add -x64 option to rt.bat. - -C API ------ - -- Patch #2477: Added PyParser_ParseFileFlagsEx() and - PyParser_ParseStringFlagsFilenameEx(). - - -What's New in Python 2.6 alpha 1? -================================= - -*Release date: 29-Feb-2008* - -Core and builtins ------------------ - -- Issue #2051: pyc and pyo files are no longer created with permission - 644. The mode is now inherited from the py file. - -- Issue #2067: file.__exit__() now calls subclasses' close() method. - -- Patch #1759: Backport of PEP 3129 class decorators. - -- Issue #1881: An internal parser limit has been increased. Also see - issue #215555 for a discussion. - -- Added the future_builtins module, which contains hex() and oct(). - These are the PEP 3127 version of these functions, designed to be - compatible with the hex() and oct() builtins from Python 3.0. They - differ slightly in their output formats from the existing, unchanged - Python 2.6 builtins. The expected usage of the future_builtins - module is: - from future_builtins import hex, oct - -- Issue #1600: Modified PyOS_ascii_formatd to use at most 2 digit - exponents for exponents with absolute value < 100. Follows C99 - standard. This is a change on Windows, which would use 3 digits. - Also, added 'n' to the formats that PyOS_ascii_formatd understands, - so that any alterations it does to the resulting string will be - available in stringlib/formatter.h (for float.__format__). - -- Implemented PEP 3101, Advanced String Formatting. This adds a new - builtin format(); a format() method for str and unicode; a - __format__() method to object, str, unicode, int, long, float, and - datetime; the class string.Formatter; and the C API - PyObject_Format(). - -- Fixed several potential crashes, all caused by specially crafted - __del__ methods exploiting objects in temporarily inconsistent - state. - -- Issue #2115: Important speedup in setting __slot__ attributes. Also - prevent a possible crash: an Abstract Base Class would try to access - a slot on a registered virtual subclass. - -- Fixed repr() and str() of complex numbers with infinity or nan as - real or imaginary part. - -- Clear all free lists during a gc.collect() of the highest generation - in order to allow pymalloc to free more arenas. Python may give back - memory to the OS earlier. - -- Issue #2045: Fix an infinite recursion triggered when printing a - subclass of collections.defaultdict, if its default_factory is set - to a bound method. - -- Fixed a minor memory leak in dictobject.c. The content of the free - list was not freed on interpreter shutdown. - -- Limit free list of method and built-in function objects to 256 - entries each. - -- Patch #1953: Added ``sys._compact_freelists()`` and the C API - functions ``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` - to compact the internal free lists of pre-allocted ints and floats. - -- Issue #1983: Fixed return type of fork(), fork1() and forkpty() - calls. Python expected the return type int but the fork familie - returns pi_t. - -- Issue #1678380: Fix a bug that identifies 0j and -0j when they - appear in the same code unit. - -- Issue #2025: Add tuple.count() and tuple.index() methods to comply - with the collections.Sequence API. - -- Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and - linebreak detection - -- Added ``PyType_ClearCache()`` and ``sys._clear_type_cache`` to clear - the internal lookup cache for ref leak tests. - -- Patch #1473257: generator objects gain a gi_code attribute. This is - the same object as the func_code attribute of the function that - produced the generator. - -- Issue #1920: "while 0" statements were completely removed by the - compiler, even in the presence of an "else" clause, which is - supposed to be run when the condition is false. Now the compiler - correctly emits bytecode for the "else" suite. - -- A few crashers fixed: weakref_in_del.py (issue #1377858); - loosing_dict_ref.py (issue #1303614, test67.py); - borrowed_ref_[34].py (not in tracker). - -- Issue #1069410: The "can't load dll" message box on Windows is - suppressed while an extension is loaded by calling SetErrorMode in - dynload_win.c. The error is still reported properly. - -- Issue #1915: Python compiles with --enable-unicode=no again. However - several extension methods and modules do not work without unicode - support. - -- Issue #1882: when compiling code from a string, encoding cookies in the - second line of code were not always recognized correctly. - -- Issue #1679: "0x" was taken as a valid integer literal. - -- Issue #1865: ``bytes`` as an alias for ``str`` and b"" as an alias "" were - added. - -- sys.float_info / PyFloat_GetInfo: The floating point information - object was converted from a dict to a specialized structseq object. - -- Patch #1816: Added sys.flags structseq. It exposes the status of - most command line arguments and PYTHON* environment variables. - -- Objects/structseq.c: Implemented new structseq representation. The - patch makes structseqs (e.g. the return value of os.stat) more - readable. - -- Patch #1700288: added a type attribute cache that caches method - accesses, resulting in speedups in heavily object-oriented code. - -- Bug #1776: __import__() no longer accepts filenames on any platform. - The first parameter to __import__() must be a valid module name. - -- Patch #1668: renamed THREADDEBUG envvar to PYTHONTHREADDEBUG. - -- Patch #602345: Add -B command line option, PYTHONDONTWRITEBYTECODE - envvar and sys.dont_write_bytecode attribute. All these can be set - to forbid Python to attempt to write compiled bytecode files. - -- Improve some exception messages when Windows fails to load an - extension module. Now we get for example '%1 is not a valid Win32 - application' instead of 'error code 193'. - -- Bug #1481296: Fixed long(float('nan')) != 0L. - -- Issue #1640: Added math.isinf(x), math.isnan(x) and math.copysign(x, - y) functions. - -- Issue #1635: Platform independent creation and representation of NaN - and INF. float("nan"), float("inf") and float("-inf") now work on - every platform with IEEE 754 semantics. - -- Compiler now generates simpler and faster code for dictionary - literals. The oparg for BUILD_MAP now indicates an estimated - dictionary size. There is a new opcode, STORE_MAP, for adding - entries to the dictionary. - -- Issue #1638: %zd configure test fails on Linux. - -- Issue #1620: New property decorator syntax was modifying the - decorator in place instead of creating a new decorator object. - -- Issue #1538: Avoid copying string in split/rsplit if the split char - is not found. - -- Issue #1553: An erroneous __length_hint__ can make list() raise a - SystemError. - -- PEP 366: Allow explicit relative imports when executing modules - inside packages with the -m switch via a new module level - __package__ attribute. - -- Issue #1402: Fix a crash on exit, when another thread is still - running, and if the deallocation of its frames somehow calls the - PyGILState_Ensure() / PyGILState_Release() functions. - -- Expose the Py_Py3kWarningFlag as sys.py3kwarning. - -- Issue #1445: Fix a SystemError when accessing the ``cell_contents`` - attribute of an empty cell object. - -- Issue #1460: The utf-7 incremental decoder did not accept truncated - input. It now correctly saves its state between chunks of data. - -- Patch #1739468: Directories and zipfiles containing a __main__.py - file can now be directly executed by passing their name to the - interpreter. The directory/zipfile is automatically inserted as the - first entry in sys.path. - -- Issue #1265: Fix a problem with sys.settrace, if the tracing - function uses a generator expression when at the same time the - executed code is closing a paused generator. - -- sets and frozensets now have an isdisjoint() method. - -- optimize the performance of builtin.sum(). - -- Fix warnings found by the new version of the Coverity checker. - -- The enumerate() built-in function is no longer bounded to sequences - smaller than LONG_MAX. Formerly, it raised an OverflowError. Now, - automatically shifts from ints to longs. - -- Issue #1686386: Tuple's tp_repr did not take into account the - possibility of having a self-referential tuple, which is possible - from C code. Nor did object's tp_str consider that a type's tp_str - could do something that could lead to an inifinite recursion. - Py_ReprEnter() and Py_EnterRecursiveCall(), respectively, fixed the - issues. - -- Issue #1164: It was possible to trigger deadlock when using the - 'print' statement to write to a file since the GIL was not released - as needed. Now PyObject_Print() does the right thing along with - various tp_print implementations of the built-in types and those in - the collections module. - -- Issue #1147: Exceptions were directly allowing string exceptions in - their throw() method even though string exceptions no longer - allowed. - -- Issue #1096: Prevent a segfault from getting the repr of a very - deeply nested list by using the recursion counter. - -- Issue #1202533: Fix infinite recursion calls triggered by calls to - PyObject_Call() never calling back out to Python code to trigger - recursion depth updates/checks. Required the creation of a static - RuntimeError instance in case normalizing an exception put the - recursion check value past its limit. Fixes crashers - infinite_rec_(1|2|4|5).py. - -- Patch #1031213: Decode source line in SyntaxErrors back to its - original source encoding. - -- Patch #1673759: add a missing overflow check when formatting floats - with %G. - -- Prevent expandtabs() on string and unicode objects from causing a - segfault when a large width is passed on 32-bit platforms. - -- Issue #1733488: Fix compilation of bufferobject.c on AIX. - -- Issue #1722485: remove docstrings again when running with -OO. - -- Add new attribute names for function objects. All the func_* become - __*__ attributes. (Some already existed, e.g., __doc__ and - __name__.) - -- Add -3 option to the interpreter to warn about features that are - deprecated and will be changed/removed in Python 3.0. - -- Patch #1686487: you can now pass any mapping after '**' in function - calls. - -- except clauses may now be spelled either "except E, target:" or - "except E as target:". This is to provide forwards compatibility - with Python 3.0. - -- Deprecate BaseException.message as per PEP 352. - -- Issue #1303614: don't expose object's __dict__ when the dict is - inherited from a built-in base. - -- When __slots__ are set to a unicode string, make it work the same as - setting a plain string, ie don't expand to single letter identifiers. - -- Request #1191699: Slices can now be pickled. - -- Request #1193128: str.translate() now allows a None argument for - translations that only remove characters without re-mapping the - remaining characters. - -- Patch #1682205: a TypeError while unpacking an iterable is no longer - masked by a generic one with the message "unpack non-sequence". - -- Remove unused file Python/fmod.c. - -- Bug #1683368: The object.__init__() and object.__new__() methods are - now stricter in rejecting excess arguments. The only time when - either allows excess arguments is when it is not overridden and the - other one is. For backwards compatibility, when both are - overridden, it is a deprecation warning (for now; maybe a Py3k - warning later). Also, type.__init__() insists on the same signature - as supported by type.__new__(). - -- Patch #1675423: PyComplex_AsCComplex() now tries to convert an - object to complex using its __complex__() method before falling back - to the __float__() method. Therefore, the functions in the cmath - module now can operate on objects that define a __complex__() - method. - -- Patch #1623563: allow __class__ assignment for classes with - __slots__. The old and the new class are still required to have the - same slot names. - -- Patch #1642547: Fix an error/crash when encountering syntax errors - in complex if statements. - -- Patch #1462488: Python no longer segfaults when - ``object.__reduce_ex__()`` is called with an object that is faking - its type. - -- Patch #1680015: Don't modify __slots__ tuple if it contains a - unicode name. - -- Patch #1444529: the builtin compile() now accepts keyword arguments. - -- Bug #1678647: write a newline after printing an exception in any - case, even when converting the value to a string failed. - -- The dir() function has been extended to call the __dir__() method on - its argument, if it exists. If not, it will work like before. This - allows customizing the output of dir() in the presence of a - __getattr__(). - -- Patch #922167: Python no longer segfaults when faced with infinitely - self-recursive reload() calls (as reported by bug #742342). - -- Patch #1675981: remove unreachable code from ``type.__new__()`` - method. - -- Patch #1491866: change the complex() constructor to allow - parthensized forms. This means complex(repr(x)) now works instead of - raising a ValueError. - -- Patch #703779: unset __file__ in __main__ after running a file. This - makes the filenames the warning module prints much more sensible - when a PYTHONSTARTUP file is used. - -- Variant of patch #697613: don't exit the interpreter on a SystemExit - exception if the -i command line option or PYTHONINSPECT environment - variable is given, but break into the interactive interpreter just - like on other exceptions or normal program exit. - -- Patch #1638879: don't accept strings with embedded NUL bytes in - long(). - -- Bug #1674503: close the file opened by execfile() in an error - condition. - -- Patch #1674228: when assigning a slice (old-style), check for the - sq_ass_slice instead of the sq_slice slot. - -- When printing an unraisable error, don't print exceptions. before - the name. This duplicates the behavior whening normally printing - exceptions. - -- Bug #1653736: Properly discard third argument to - slot_nb_inplace_power. - -- PEP 352: Raising a string exception now triggers a TypeError. - Attempting to catch a string exception raises DeprecationWarning. - -- Bug #1377858: Fix the segfaulting of the interpreter when an object - created a weakref on itself during a __del__ call for new-style - classes (classic classes still have the bug). - -- Bug #1579370: Make PyTraceBack_Here use the current thread, not the - frame's thread state. - -- patch #1630975: Fix crash when replacing sys.stdout in - sitecustomize.py. - -- Prevent seg fault on shutdown which could occur if an object raised - a warning. - -- Bug #1566280: Explicitly invoke threading._shutdown from Py_Main, to - avoid relying on atexit. - -- Bug #1590891: random.randrange don't return correct value for big - number. - -- Patch #1586791: Better exception messages for some operations on - strings, tuples and lists. - -- Bug #1067760: Deprecate passing floats to file.seek. - -- Bug #1591996: Correctly forward exception in instance_contains(). - -- Bug #1588287: fix invalid assertion for `1,2` in debug builds. - -- Bug #1576657: when setting a KeyError for a tuple key, make sure - that the tuple isn't used as the "exception arguments tuple". - -- Bug #1565514: SystemError not raised on too many nested blocks. - -- Bug #1576174: WindowsError now displays the windows error code - again, no longer the posix error code. - -- Patch #1549049: Support long values in structmember, issue warnings - if the assigned value for structmember fields gets truncated. - -- Update the peephole optimizer to remove more dead code (jumps after - returns) and inline unconditional jumps to returns. - -- Bug #1545497: when given an explicit base, int() did ignore NULs - embedded in the string to convert. - -- Bug #1569998: break inside a try statement (outside a loop) is now - recognized and rejected. - -- list.pop(x) accepts any object x following the __index__ protocol. - -- A number of places, including integer negation and absolute value, - were fixed to not rely on undefined behaviour of the C compiler - anymore. - -- Bug #1566800: make sure that EnvironmentError can be called with any - number of arguments, as was the case in Python 2.4. - -- Patch #1567691: super() and new.instancemethod() now don't accept - keyword arguments any more (previously they accepted them, but - didn't use them). - -- Fix a bug in the parser's future statement handling that led to - "with" not being recognized as a keyword after, e.g., this - statement: from __future__ import division, with_statement - -- Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)). - -- Fix %zd string formatting on Mac OS X so it prints negative numbers. - -- Allow exception instances to be directly sliced again. - -- Bug #1551432: Exceptions do not define an explicit __unicode__ - method. This allows calling unicode() on exceptions classes - directly to succeed. - -- Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack. - Also make sure that every exception class has __module__ set to - 'exceptions'. - -- Bug #1550983: emit better error messages for erroneous relative - imports (if not in package and if beyond toplevel package). - -- Overflow checking code in integer division ran afoul of new gcc - optimizations. Changed to be more standard-conforming. - -- Patch #1542451: disallow continue anywhere under a finally. - -- Patch #1546288: fix seg fault in dict_equal due to ref counting bug. - -- The return tuple from str.rpartition(sep) is (tail, sep, head) where - head is the original string if sep was not found. - -- Bug #1520864: unpacking singleton tuples in list comprehensions and - generator expressions (x for x, in ... ) works again. Fixing this - problem required changing the .pyc magic number. This means that - .pyc files generated before 2.5c2 will be regenerated. - -- ``with`` and ``as`` are now keywords. - -- Bug #1664966: Fix crash in exec if Unicode filename can't be - decoded. - -- Issue #1537: Changed GeneratorExit's base class from Exception to - BaseException. - -- Issue #1703448: A joined thread could show up in the - threading.enumerate() list after the join() for a brief period until - it actually exited. - -Library -------- - -- Patch #2274: Add heapq.heappushpop(). - -- Add inspect.isabstract(object) to fix bug #2223 - -- Add a __format__ method to Decimal, to support PEP 3101. - -- Add a timing parameter when using trace.Trace to print out - timestamps. - -- Issue #1627: httplib now ignores negative Content-Length headers. - -- Issue #900744: If an invalid chunked-encoding header is sent by a - server, httplib will now raise IncompleteRead and close the - connection instead of raising ValueError. - -- Issue #1492: The content type of BaseHTTPServer error messages can - now be overridden. - -- Issue #1781: ConfigParser now does not let you add the "default" section - (ignore-case) - -- Removed uses of dict.has_key() from distutils, and uses of - callable() from copy_reg.py, so the interpreter now starts up - without warnings when '-3' is given. More work like this needs to - be done in the rest of the stdlib. - -- Issue #1916: added isgenerator() and isgeneratorfunction() to - inspect.py. - -- Issue #1224: Fixed bad url parsing when path begins with double - slash. - -- ctypes instances that are not or do not contain pointers can now be - pickled. - -- Patch #1966: Break infinite loop in httplib when the servers - implements the chunked encoding incorrectly. - -- Rename rational.py to fractions.py and the rational.Rational class - to fractions.Fraction, to avoid the name clash with the abstract - base class numbers.Rational. See discussion in issue #1682. - -- The pickletools module now provides an optimize() function that - eliminates unused PUT opcodes from a pickle string. - -- Patch #2021: Allow tempfile.NamedTemporaryFile and - SpooledTemporaryFile to be used in with statements by correctly - supporting the context management protocol. - -- Patch #1979: Add rich comparisons to Decimal, and make Decimal - comparisons involving a NaN follow the IEEE 754 standard. - -- Issue #2004: tarfile.py: Use mode 0700 for temporary directories and - default permissions for missing directories. - -- Issue #175006: The debugger used to skip the condition of a "while" - statement after the first iteration. Now it correctly steps on the - expression, and breakpoints on the "while" statement are honored on - each loop. - -- Issue #1765140: add an optional delay argument to FileHandler and - its subclasses. Defaults to false (existing behaviour), but if true, - defers opening the file until the first call to emit(). - -- The pprint module now supports sets and frozensets. - -- Issue #1221598: add optional callbacks to ftplib.FTP's storbinary() - and storlines() methods. (Contributed by Phil Schwartz) - -- Issue #1715: include sub-extension modules in pydoc's text output. - -- Issue #1836: fix an off-by-one bug in TimedRotatingHandler's - rollover time calculation. - -- Issue #1021: fix a bug to allow basicConfig to accept NOTSET as a - level. - -- Issue #932563: add LoggerAdapter convenience class to make it easier - to add contextual information in logging output. - -- Issue #1760556: fix a bug to avoid FileHandler throwing an exception - in flush(). - -- Bug #1530959: distutils' build command now uses different build - directory when building extension modules against versions of Python - compiled with ``--with-pydebug``. - -- Issue #1555501: move plistlib from plat-mac directory to general - library. - -- Issue #1269: fix a bug in pstats.add_callers() and add a unit test - file for pstats. - -- Issue #1669: don't allow shutil.rmtree() to be called on a symlink - to a directory. - -- Issue #1664522: in urllib, don't read non-existing directories in - ftp mode, returning a 0-byte file -- raise an IOError instead. - -- Issue #856047: respect the ``no_proxy`` environment variable when - using the ``http_proxy`` etc. environment variables in urllib. - -- Issue #1178141: add a getcode() method to the addinfourls that - urllib.open() returns so that you can retrieve the HTTP status code. - -- Issue #1003: Fix zipfile decryption check, it would fail zip files - with extended local headers. - -- Issue #1189216: Fix the zipfile module to work on archives with - headers past the 2**31 byte boundary. - -- Issue #1336: fix a race condition in subprocess.Popen if the garbage - collector kicked in at the wrong time that would cause the process - to hang when the child wrote to stderr. - -- Issue #1146: fix how textwrap breaks a long word that would start in - the last column of a line. - -- Issue #1693149: trace.py --ignore-module - accept multiple - comma-separated modules to be given. - -- Issue #1822: MIMEMultipart.is_multipart() behaves correctly for a - just-created (and empty) instance. Thanks Jonathan Share. - -- Issue #1861: Added an attribute to the sched module which returns an - ordered list of upcoming events (displayed as named tuples). - -- Issue #1837: The queue module now also supports a LIFO queue and a - priority queue. - -- Patch #1048820: Add insert-mode editing to curses.textpad.Textbox - (patch by Stefan Wehr). Also, fix an off-by-one bug in - Textbox.gather(). - -- Issue #1831: ctypes now raises a TypeError if conflicting positional - and named arguments are passed to a Structure or Union initializer. - When too many positional arguments are passed, also a TypeError is - raised instead of a ValueError. - -- Convert the internal ctypes array type cache to a WeakValueDict so - that array types do not live longer than needed. - -- Issue #1786: pdb should use its own stdin/stdout around an exec call - and when creating a recursive instance. - -- Issue #1698398: ZipFile.printdir() crashed because the format string - expected a tuple type of length six instead of time.struct_time - object. - -- Issue #1780: The Decimal constructor now accepts arbitrary leading - and trailing whitespace when constructing from a string. - Context.create_decimal no longer accepts trailing newlines. - -- Decimal.as_tuple(), difflib.find_longest_match() and inspect - functions that returned a tuple now return a named tuple. - -- Doctest now returns results as a named tuple for readability: - (0, 7) --> TestResults(failed=0, attempted=7) - -- Issue #846388: re.match is interruptible now, which is particularly - good for long regular expression matches. - -- Patch #1137: allow setting buffer_size attribute on pyexpat Parser - objects to set the character data buffer size. - -- Issue #1757: The hash of a Decimal instance is no longer affected by - the current context. - -- Patch #467924: add ZipFile.extract() and ZipFile.extractall() in the - zipfile module. - -- Issue #1646: Make socket support the TIPC protocol. - -- Bug #1742: return os.curdir from os.path.relpath() if both arguments - are equal instead of raising an exception. - -- Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'. - -- Patch #1698: allow '@' in username parsed by urlparse.py. - -- Issue #1735: TarFile.extractall() now correctly sets directory - permissions and times. - -- Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint. - -- Bug #1687: Fxed plistlib.py restricts to Python int when - writing - -- Issue #1700: Regular expression inline flags incorrectly handle - certain unicode characters. - -- Issue #1689: PEP 3141, numeric abstract base classes. - -- Tk issue #1851526: Return results from Python callbacks to Tcl as - Tcl objects. - -- Issue #1642: Fix segfault in ctypes when trying to delete attributes. - -- Issue #1727780: Support loading pickles of random.Random objects - created on 32-bit systems on 64-bit systems, and vice versa. As a - consequence of the change, Random pickles created by Python 2.6 - cannot be loaded in Python 2.5. - -- Issue #1455: The distutils package now supports VS 2005 and VS 2008 - for both the msvccompiler and cygwincompiler. - -- Issue #1531: tarfile.py: Read fileobj from the current offset, do - not seek to the start. - -- Issue #1534: Added a dictionary sys.float_info with information - about the internal floating point type to the sys module. - -- Issue #1429818: patch for trace and doctest modules so they play - nicely together. - -- doctest made a bad assumption that a package's __loader__.get_data() - method used universal newlines. - -- Issue #1705170: contextlib.contextmanager was still swallowing - StopIteration in some cases. This should no longer happen. - -- Issue #1292: On alpha, arm, ppc, and s390 linux systems the - --with-system-ffi configure option defaults to "yes". - -- IN module for FreeBSD 8 is added and preexisting FreeBSD 6 and 7 - files are updated. - -- Issues #1181, #1287: unsetenv() is now called when the - os.environ.pop() and os.environ.clear() methods are used. - -- ctypes will now work correctly on 32-bit systems when Python is - configured with --with-system-ffi. - -- Patch #1203: ctypes now does work on OS X when Python is built with - --disable-toolbox-glue. - -- collections.deque() now supports a "maxlen" argument. - -- itertools.count() is no longer bounded to LONG_MAX. Formerly, it - raised an OverflowError. Now, automatically shifts from ints to - longs. - -- Added itertools.product() which forms the Cartesian product of the - input iterables. - -- Added itertools.combinations() and itertools.permutations(). - -- Patch #1541463: optimize performance of cgi.FieldStorage operations. - -- Decimal is fully updated to the latest Decimal Specification - (v1.66). - -- Bug #1153: repr.repr() now doesn't require set and dictionary items - to be orderable to properly represent them. - -- A 'c_longdouble' type was added to the ctypes module. - -- Bug #1709599: Run test_1565150 only if the file system is NTFS. - -- When encountering a password-protected robots.txt file the - RobotFileParser no longer prompts interactively for a username and - password (bug 813986). - -- TarFile.__init__() no longer fails if no name argument is passed and - the fileobj argument has no usable name attribute (e.g. StringIO). - -- The functools module now provides 'reduce', for forward - compatibility with Python 3000. - -- Server-side SSL support and cert verification added, by Bill - Janssen. - -- socket.ssl deprecated; use new ssl module instead. - -- uuid creation is now threadsafe. - -- EUC-KR codec now handles the cheot-ga-keut composed make-up hangul - syllables. - -- GB18030 codec now can encode additional two-byte characters that are - missing in GBK. - -- Add new codecs for UTF-32, UTF-32-LE and UTF-32-BE. - -- Bug #1704793: Return UTF-16 pair if unicodedata.lookup cannot - represent the result in a single character. - -- Bug #978833: Close https sockets by releasing the _ssl object. - -- Change location of the package index to pypi.python.org/pypi - -- Bug #1701409: Fix a segfault in printing ctypes.c_char_p and - ctypes.c_wchar_p when they point to an invalid location. As a - sideeffect the representation of these instances has changed. - -- tarfile.py: Added "exclude" keyword argument to TarFile.add(). - -- Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple - attribute. - -- The urlopen function of urllib2 now has an optional timeout - parameter (note that it actually works with HTTP, HTTPS, FTP and - FTPS connections). - -- In ftplib, the FTP.ntransfercmd method, when in passive mode, now - uses the socket.create_connection function, using the timeout - specified at connection time. - -- Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it - reads a file that ends with incomplete sequence and sizehint - argument for .read() is specified. - -- Bug #1730389: Change time.strptime() to use ``\s+`` instead of - ``\s*`` when matching spaces in the specified format argument. - -- Bugs #1668596/#1720897: distutils now copies data files even if - package_dir is empty. - -- sha now raises a DeprecationWarning upon import. - -- md5 now raises a DeprecationWarning upon import. - -- Issue #1385: The hmac module now computes the correct hmac when - using hashes with a block size other than 64 bytes (such as sha384 - and sha512). - -- mimify now raises a DeprecationWarning upon import. - -- MimeWriter now raises a DeprecationWarning upon import. - -- tarfile.py: Improved unicode support. Unicode input names are now - officially supported. Added "errors" argument to the TarFile class. - -- urllib.ftpwrapper class now accepts an optional timeout. - -- shlex.split() now has an optional "posix" parameter. - -- The posixfile module now raises a DeprecationWarning. - -- Remove the gopherlib module. This also leads to the removal of - gopher support in urllib/urllib2. - -- Fix bug in marshal where bad data would cause a segfault due to lack - of an infinite recursion check. - -- Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in - the directories). - -- HTML-escape the plain traceback in cgitb's HTML output, to prevent - the traceback inadvertently or maliciously closing the comment and - injecting HTML into the error page. - -- The popen2 module and os.popen* are deprecated. Use the subprocess - module. - -- Added an optional credentials argument to SMTPHandler, for use with - SMTP servers which require authentication. - -- Patch #1695948: Added optional timeout parameter to SocketHandler. - -- Bug #1652788: Minor fix for currentframe. - -- Patch #1598415: Added WatchedFileHandler to better support external - log file rotation using e.g. newsyslog or logrotate. This handler is - only useful in Unix/Linux environments. - -- Bug #1706381: Specifying the SWIG option "-c++" in the setup.py file - (as opposed to the command line) will now write file names ending in - ".cpp" too. - -- As specified in RFC 2616, an HTTP response like 2xx indicates that - the client's request was successfully received, understood, and - accepted. Now in these cases no error is raised in urllib (issue - #1177) and urllib2. - -- Bug #1290505: time.strptime's internal cache of locale information - is now properly recreated when the locale is changed. - -- Patch #1685563: remove (don't add) duplicate paths in - distutils.MSVCCompiler. - -- Added a timeout parameter to the constructor of other protocols - (telnetlib, ftplib, smtplib and poplib). This is second part of the - work started with create_connection() and timeout in httplib, and - closes patch #723312. - -- Patch #1676823: Added create_connection() to socket.py, which may be - called with a timeout, and use it from httplib (whose HTTPConnection - and HTTPSConnection now accept an optional timeout). - -- Bug #978833: Revert r50844, as it broke _socketobject.dup. - -- Bug #1675967: re patterns pickled with Python 2.4 and earlier can - now be unpickled with Python 2.5 and newer. - -- Patch #1630118: add a SpooledTemporaryFile class to tempfile.py. - -- Patch #1273829: os.walk() now has a "followlinks" parameter. If set - to True (which is not the default), it visits symlinks pointing to - directories. - -- Bug #1681228: the webbrowser module now correctly uses the default - GNOME or KDE browser, depending on whether there is a session of one - of those present. Also, it tries the Windows default browser before - trying Mozilla variants. - -- Patch #1339796: add a relpath() function to os.path. - -- Patch #1681153: the wave module now closes a file object it opened if - initialization failed. - -- Bug #767111: fix long-standing bug in urllib which caused an - AttributeError instead of an IOError when the server's response - didn't contain a valid HTTP status line. - -- Patch #957650: "%var%" environment variable references are now - properly expanded in ntpath.expandvars(), also "~user" home - directory references are recognized and handled on Windows. - -- Patch #1429539: pdb now correctly initializes the __main__ module - for the debugged script, which means that imports from __main__ work - correctly now. - -- The nonobvious commands.getstatus() function is now deprecated. - -- Patch #1393667: pdb now has a "run" command which restarts the - debugged Python program, optionally with different arguments. - -- Patch #1649190: Adding support for _Bool to ctypes as c_bool. - -- Patch #1530482: add pydoc.render_doc() which returns the - documentation for a thing instead of paging it to stdout, which - pydoc.doc() does. - -- Patch #1533909: the timeit module now accepts callables in addition - to strings for the code to time and the setup code. Also added two - convenience functions for instantiating a Timer and calling its - methods. - -- Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" - parameter which can be set to False to prevent the default - delete-on-close behavior. - -- Patch #1581073: add a flag to textwrap that prevents the dropping of - whitespace while wrapping. - -- Patch #1603688: ConfigParser.SafeConfigParser now checks values that - are set for invalid interpolation sequences that would lead to - errors on reading back those values. - -- Added support for the POSIX.1-2001 (pax) format to - tarfile.py. Extended and cleaned up the test suite. Added a new - testtar.tar. - -- Patch #1449244: Support Unicode strings in - email.message.Message.{set_charset,get_content_charset}. - -- Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" - to pydoc's help keywords. - -- Patch #1555098: use str.join() instead of repeated string - concatenation in robotparser. - -- Patch #1635454: the csv.DictWriter class now includes the offending - field names in its exception message if you try to write a record - with a dictionary containing fields not in the CSV field names list. - -- Patch #1668100: urllib2 now correctly raises URLError instead of - OSError if accessing a local file via the file:// protocol fails. - -- Patch #1677862: Require a space or tab after import in .pth files. - -- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they - trap the IndexError caused by passing in an invalid breakpoint - number. - -- Patch #1599845: Add an option to disable the implicit calls to - server_bind() and server_activate() in the constructors for - TCPServer, SimpleXMLRPCServer and DocXMLRPCServer. - -- Bug #1531963: Make SocketServer.TCPServer's server_address always be - equal to calling getsockname() on the server's socket. Fixed by - patch #1545011. - -- Patch #742598: Add .timeout attribute to SocketServer that calls - .handle_timeout() when no requests are received. - -- Bug #1651235: When a tuple was passed to a ctypes function call, - Python would crash instead of raising an error. - -- Bug #1646630: ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0) - returned string up to the first NUL character. - -- Patch #957003: Implement smtplib.LMTP. - -- Patch #1481079: add support for HTTP_REFERER to CGIHTTPServer. - -- Patch #1675424: Added tests for uncovered code in the zipfile - module. The KeyError raised by Zipfile.getinfo for nonexistent - names now has a descriptive message. - -- Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', ''). - -- unittest now verifies more of its assumptions. In particular, - TestCase and TestSuite subclasses (not instances) are no longer - accepted in TestSuite.addTest(). This should cause no - incompatibility since it never made sense with ordinary subclasses - -- the failure just occurred later, with a more cumbersome - exception. - -- Patch #787789: allow passing custom TestRunner instances to - unittest's main() function. - -- Patches #1550273, #1550272: fix a few bugs in unittest and add a - comprehensive test suite for the module. - -- Patch #1001604: glob.glob() now returns unicode filenames if it was - given a unicode argument and os.listdir() returns unicode filenames. - -- Patch #1673619: setup.py identifies extension modules it doesn't - know how to build and those it knows how to build but that fail to - build. - -- Patch #912410: Replace HTML entity references for attribute values - in HTMLParser. - -- Patch #1663234: you can now run doctest on test files and modules - using "python -m doctest [-v] filename ...". - -- Patch #1121142: Implement ZipFile.open. - -- Taught setup.py how to locate Berkeley DB on Macs using MacPorts. - -- Added heapq.merge() for merging sorted input streams. - -- Added collections.namedtuple() for assigning field names to tuples. - -- Added itertools.izip_longest(). - -- Have the encoding package's search function dynamically import using - absolute import semantics. - -- Patch #1647484: Renamed GzipFile's filename attribute to name. - -- Patch #1517891: Mode 'a' for ZipFile now creates the file if it - doesn't exist. - -- Patch #698833: Support file decryption in zipfile. - -- Patch #685268: Consider a package's __path__ in imputil. - -- Patch #1463026: Support default namespace in XMLGenerator. - -- Patch #1571379: Make trace's --ignore-dir facility work in the face - of relative directory names. - -- Bug #1600860: Search for shared python library in LIBDIR, not - lib/python/config, on "linux" and "gnu" systems. - -- Patch #1652681: tarfile.py: create nonexistent files in append mode - and allow appending to empty files. - -- Bug #1124861: Automatically create pipes if GetStdHandle fails in - subprocess. - -- Patch #1634778: add missing encoding aliases for iso8859_15 and - iso8859_16. - -- Patch #1638243: the compiler package is now able to correctly - compile a with statement; previously, executing code containing a - with statement compiled by the compiler package crashed the - interpreter. - -- Bug #1643943: Fix time.strptime's support for the %U directive. - -- Patch #1507247: tarfile.py: use current umask for intermediate - directories. - -- Patch #1627441: close sockets properly in urllib2. - -- Bug #494589: make ntpath.expandvars behave according to its - docstring. - -- Changed platform module API python_version_tuple() to actually - return a tuple (it used to return a list). - -- Added new platform module APIs python_branch(), python_revision(), - python_implementation() and linux_distribution(). - -- Added support for IronPython and Jython to the platform module. - -- The sets module has been deprecated. Use the built-in set/frozenset - types instead. - -- Bug #1610795: make ctypes.util.find_library work on BSD systems. - -- Fixes for 64-bit Windows: In ctypes.wintypes, correct the - definitions of HANDLE, WPARAM, LPARAM data types. Make - parameterless foreign function calls work. - -- The version number of the ctypes package changed to "1.1.0". - -- Bug #1627575: logging: Added _open() method to FileHandler which can - be used to reopen files. The FileHandler instance now saves the - encoding (which can be None) in an attribute called "encoding". - -- Bug #411881: logging.handlers: bare except clause removed from - SMTPHandler.emit. Now, only ImportError is trapped. - -- Bug #411881: logging.handlers: bare except clause removed from - SocketHandler.createSocket. Now, only socket.error is trapped. - -- Bug #411881: logging: bare except clause removed from - LogRecord.__init__. Now, only ValueError, TypeError and - AttributeError are trapped. - -- Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj - argument. - -- Patch #1182394 from Shane Holloway: speed up HMAC.hexdigest. - -- Patch #1262036: Prevent TarFiles from being added to themselves - under certain conditions. - -- Patch #1230446: tarfile.py: fix ExFileObject so that read() and - tell() work correctly together with readline(). - -- Patch #1484695: The tarfile module now raises a HeaderError - exception if a buffer given to frombuf() is invalid. - -- Bug #1503765: Fix a problem in logging.config with spaces in comma- - separated lists read from logging config files. - -- Patch #1604907: Fix problems in logging.handlers caused at logging - shutdown when syslog handlers fail to initialize because of syslogd - problems. - -- Patch #1608267: fix a race condition in os.makedirs() if the - directory to be created is already there. - -- Patch #1610437: fix a tarfile bug with long filename headers. - -- Patch #1371075: Make ConfigParser accept optional dict type for - ordering, sorting, etc. - -- Bug #1563807: _ctypes built on AIX fails with ld ffi error. - -- Bug #1598620: A ctypes Structure cannot contain itself. - -- Patch #1070046: Marshal new-style objects like InstanceType in - xmlrpclib. - -- cStringIO.truncate(-1) now raises an IOError, like StringIO and - regular files. - -- Patch #1472877: Fix Tix subwidget name resolution. - -- Patch #1594554: Always close a tkSimpleDialog on ok(), even if an - exception occurs. - -- Patch #1538878: Don't make tkSimpleDialog dialogs transient if the - parent window is withdrawn. - -- Bug #1597824: return the registered function from atexit.register() - to facilitate usage as a decorator. - -- Patch #1360200: Use unmangled_version RPM spec field to deal with - file name mangling. - -- Patch #1359217: Process 2xx response in an ftplib transfer that - precedes an 1xx response. - -- Patch #1355023: support whence argument for GzipFile.seek. - -- Patch #1065257: Support passing open files as body in - HTTPConnection.request(). - -- Bug #1569790: mailbox.py: Maildir.get_folder() and MH.get_folder() - weren't passing the message factory on to newly created Maildir/MH - objects. - -- Patch #1514543: mailbox.py: In the Maildir class, report errors if - there's a filename clash instead of possibly losing a message. - (Patch by David Watson.) - -- Patch #1514544: Try to ensure that messages/indexes have been - physically written to disk after calling .flush() or - .close(). (Patch by David Watson.) - -- Patch #1592250: Add elide argument to Tkinter.Text.search. - -- Patch #838546: Make terminal become controlling in pty.fork(). - -- Patch #1351744: Add askyesnocancel helper for tkMessageBox. - -- Patch #1060577: Extract list of RPM files from spec file in - bdist_rpm. - -- Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. - -- Patch #1583880: fix tarfile's problems with long names and posix/ - GNU modes. - -- Bug #1586448: the compiler module now emits the same bytecode for - list comprehensions as the built-in compiler, using the LIST_APPEND - opcode. - -- Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and - fix all codecs file wrappers to work correctly with the "with" - statement (bug #1586513). - -- Lib/modulefinder.py now handles absolute and relative imports - correctly. - -- Patch #1567274: Support SMTP over TLS. - -- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes - isn't considered as requiring executable stacks. - -- ctypes callback functions only support 'fundamental' data types as - result type. Raise an error when something else is used. This is a - partial fix for Bug #1574584. - -- Fix turtle so that time.sleep is imported for the entire library. - Allows the demo2 function to be executed on its own instead of only - when the module is run as a script. - -- Bug #1565150: Fix subsecond processing for os.utime on Windows. - -- Support for MSVC 8 was added to bdist_wininst. - -- Bug #1446043: correctly raise a LookupError if an encoding name - given to encodings.search_function() contains a dot. - -- Bug #1560617: in pyclbr, return full module name not only for - classes, but also for functions. - -- Bug #1457823: cgi.(Sv)FormContentDict's constructor now takes - keep_blank_values and strict_parsing keyword arguments. - -- Bug #1566602: correct failure of posixpath unittest when $HOME ends - with a slash. - -- Bug #1565661: in webbrowser, split() the command for the default - GNOME browser in case it is a command with args. - -- Made the error message for time.strptime when the data and - format do match be more clear. - -- Fix a bug in traceback.format_exception_only() that led to an error - being raised when print_exc() was called without an exception set. - In version 2.4, this printed "None", restored that behavior. - -- Make webbrowser.BackgroundBrowser usable in Windows (it wasn't - because the close_fds arg to subprocess.Popen is not supported). - -- Reverted patch #1504333 to sgmllib because it introduced an infinite - loop. - -- Patch #1553314: Fix the inspect.py slowdown that was hurting IPython - & SAGE by adding smarter caching in inspect.getmodule() - -- Fix missing import of the types module in logging.config. - -- Patch #1550886: Fix decimal module context management implementation - to match the localcontext() example from PEP 343. - -- Bug #1545341: The 'classifier' keyword argument to the Distutils - setup() function now accepts tuples as well as lists. - -- Bug #1541863: uuid.uuid1 failed to generate unique identifiers on - systems with low clock resolution. - -- Bug #1531862: Do not close standard file descriptors in subprocess. - -- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when - the first chunk fed to the decoder started with a BOM, but was - longer than 3 bytes. - -- The implementation of UnicodeError objects has been simplified - (start and end attributes are now stored directly as Py_ssize_t - members). - -- Issue #829951: In the smtplib module, SMTP.starttls() now complies - with RFC 3207 and forgets any knowledge obtained from the server not - obtained from the TLS negotiation itself. Patch contributed by Bill - Fenner. - -- Issue #1339: The smtplib.SMTP class has been refactored a bit such - that the SMTP.starttls() caller no longer needs to call ehlo() - beforehand. SMTP.starttls() now raises an exception of the server - does not claim to support starttls. Adds the - SMTP.ehlo_or_helo_if_needed() method. Patch contributed by Bill - Fenner. - -- Patch #1089358: Add signal.siginterrupt, a wrapper around - siginterrupt(3). - -Extension Modules ------------------ - -- Patch #1657: added select.epoll and select.kqueue. - -- Patch #1506171: added operator.methodcaller(). - -- Patch #1826: operator.attrgetter() now supports dotted attribute paths. - -- Patch #1957: syslogmodule: Release GIL when calling syslog(3). - -- Bug #2112: mmap.error is now a subclass of EnvironmentError and not - a direct EnvironmentError. - -- Bug #2111: mmap segfaults when trying to write a block opened with - PROT_READ. - -- Bug #2063: correct order of utime and stime in os.times() result on - Windows. - -- Patch #1736: Fix file name handling of _msi.FCICreate. - -- Updated ``big5hkscs`` codec to the HKSCS revision of 2004. - -- Issue #1940: make it possible to use curses.filter() before - curses.initscr() as the documentation says. - -- Backport of _fileio module from Python 3.0. - -- Patch #1087741: mmap.mmap is now a class, not a factory function. It - is also subclassable now. - -- Patch #1648: added ``sys.getprofile()`` and ``sys.gettrace()``. - -- Patch #1663329: added ``os.closerange()`` function to quickly close - a range of file descriptors without considering errors. - -- Patch #976880: ``mmap`` objects now have an ``rfind`` method that - works as expected. ``mmap.find`` also takes an optional ``end`` - parameter. - -- _winreg's HKEY object has gained __enter__ and __exit__ methods to - support the context management protocol. The _winreg module also - gained a new function ``ExpandEnvironmentStrings`` to expand - REG_EXPAND_SZ keys. - -- itertools.starmap() now accepts any iterable input. Previously, it - required the function inputs to be tuples. - -- itertools.chain() now has an alternate constructor, - chain.from_iterable(). - -- Issue #1646: Make socket support TIPC. The socket module now has - support for TIPC under Linux, see http://tipc.sf.net/ for more - information. - -- Added interface for Windows' WSAIoctl to socket object and added an - example for a simple network sniffer. - -- Bug #1301: Bad assert in _tkinter fixed. - -- Added bdist_wininst executable for VS 2008. - -- Bug #1604: collections.deque.__init__(iterable) now clears any prior - contents before adding elements from the iterable. This fix brings - the behavior into line with that for list.__init__(). - -- Added wide char functions to msvcrt module: getwch, getwche, putwch - and ungetwch. The functions accept or return unicode. - -- os.access now returns True on Windows for any existing directory. - -- Added warnpy3k function to the warnings module. - -- Marshal.dumps() now expects exact type matches for int, long, float, - complex, tuple, list, dict, set, and frozenset. Formerly, it would - silently miscode subclasses of those types. Now, it raises a - ValueError instead. - -- Patch #1388440: Add set_completion_display_matches_hook and - get_completion_type to readline. - -- Bug #1649098: Avoid declaration of zero-sized array declaration in - structure. - -- Removed the rgbimg module; been deprecated since Python 2.5. - -- Bug #1721309: prevent bsddb module from freeing random memory. - -- Bug #1233: fix bsddb.dbshelve.DBShelf append method to work as - intended for RECNO databases. - -- pybsddb.sf.net Bug #477182: Load the database flags at database open - time so that opening a database previously created with the DB_DUP - or DB_DUPSORT flag set will keep the proper behavior on subsequent - opens. Specifically: dictionary assignment to a DB object will - replace all values for a given key when the database allows - duplicate values. DB users should use DB.put(k, v) when they want - to store duplicates; not DB[k] = v. - -- Add the bsddb.db.DBEnv.lock_id_free method. - -- Bug #1686475: Support stat'ing open files on Windows again. - -- Patch #1185447: binascii.b2a_qp() now correctly quotes binary - characters with ASCII value less than 32. Also, it correctly quotes - dots only if they occur on a single line, as opposed to the previous - behavior of quoting dots if they are the second character of any - line. - -- Bug #1622896: fix a rare corner case where the bz2 module raised an - error in spite of a succesful compression. - -- Patch #1654417: make operator.{get,set,del}slice use the full range - of Py_ssize_t. - -- Patch #1646728: datetime.fromtimestamp fails with negative - fractional times. With unittest. - -- Patch #1490190: posixmodule now includes os.chflags() and - os.lchflags() functions on platforms where the underlying system - calls are available. - -- Patch #1494140: Add documentation for the new struct.Struct object. - -- Patch #1432399: Support the HCI protocol for bluetooth sockets - -- Patch #1657276: Make NETLINK_DNRTMSG conditional. - -- Bug #1653736: Complain about keyword arguments to time.isoformat. - -- Bug #1486663: don't reject keyword arguments for subclasses of - built-in types. - -- Patch #1610575: The struct module now supports the 't' code, for C99 - _Bool. - -- Patch #1635058: ensure that htonl and friends never accept or return - negative numbers, per the underlying C implementation. - -- Patch #1544279: Improve thread-safety of the socket module by moving - the sock_addr_t storage out of the socket object. - -- Patch #1019808: fix bug that causes an incorrect error to be - returned when a socket timeout is set and a connection attempt - fails. - -- Speed up function calls into the math module. - -- Bug #1588217: don't parse "= " as a soft line break in binascii's - a2b_qp() function, instead leave it in the string as quopri.decode() - does. - -- Bug #1599782: Fix segfault on bsddb.db.DB().type(). - -- Bug #1567666: Emulate GetFileAttributesExA for Win95. - -- Patch #1576166: Support os.utime for directories on Windows NT+. - -- Patch #1572724: fix typo ('=' instead of '==') in _msi.c. - -- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault - when encoding non-BMP unicode characters. - -- Bug #1556784: allow format strings longer than 127 characters in - datetime's strftime function. - -- Fix itertools.count(n) to work with negative numbers again. - -- RLIMIT_SBSIZE was added to the resource module where available. - -- Bug #1551427: fix a wrong NULL pointer check in the win32 version of - os.urandom(). - -- Bug #1548092: fix curses.tparm seg fault on invalid input. - -- Patch #1114: fix curses module compilation on 64-bit AIX, & possibly - other 64-bit LP64 platforms where attr_t is not the same size as a - long. (Contributed by Luke Mewburn.) - -- Bug #1550714: fix SystemError from itertools.tee on negative value - for n. - -- Fixed a few bugs on cjkcodecs: - - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT - correctly. - - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 - codepoints to conform the standard. - - iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 0213:2 - codepoints now. - -- Bug #1552726: in readline.c, avoid repeatedly polling in interactive - mode by only placing a timeout on the select() if an input hook has - been defined. This prevents an interactive Python from waking up 10 - times per second. Patch by Richard Boulton. - -- fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments - were transposed. - -- Added support for linking the bsddb module against BerkeleyDB 4.5.x, - 4.6.x and 4.7.x. - -- Bug #1633621: if curses.resizeterm() or curses.resize_term() is - called, update _curses.LINES, _curses.COLS, curses.LINES and - curses.COLS. - -- Fix an off-by-one bug in locale.strxfrm(). - -- Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. - -- Build using system ffi library on arm*-linux*. - -- Bug #1372: zlibmodule.c: int overflow in PyZlib_decompress - -- bsddb module: Fix memory leak when using database cursors on - databases without a DBEnv. - -- The sqlite3 module was updated to pysqlite 2.4.1. - -IDLE ----- - -- Bug #813342: Start the IDLE subprocess with -Qnew if the parent is - started with that option. - -- IDLE: Honor the "Cancel" action in the save dialog (Debian bug - #299092). - -Tests ------ -- bpo-30357: test_thread: setUp() now uses support.threading_setup() and - support.threading_cleanup() to wait until threads complete to avoid - random side effects on following tests. Initial patch written by Grzegorz - Grzywacz. - -- Refactor test_logging to use unittest. - -- Refactor test_profile and test_cprofile to use the same code to - profile. - -- Make test_runpy reentrant by fixing _check_module to clear out any - module being tested. Was causing an error by __import__ doing a - reload on the second run and thus suppressing bytecode recreation. - -- Capture socket connection resets and timeouts in test_socket_ssl and - test_urllib2net and raise test.test_support.ResourceDenied. - -- Patch #1559413: Fix test_cmd_line if sys.executable contains a - space. - -- Added test.test_support.TransientResource which is a context manager - to surround calls to resources that are not guaranteed to work even - if test.test_support.requires says that the resource should exist. - -- Added a test for slicing of an exception. - -- Added test.test_support.EnvironmentVarGuard. It's a class that - provides a context manager so that one can temporarily set or unset - environment variables. - -- Added some tests for modulefinder. - -- Converted test_imp to use unittest. - -- Fix bsddb test_basics.test06_Transactions to check the version - number properly. - -- test.test_support.catch_warning is a new context manager that can be - used to catch the warnings issued by the warning framework. - -Tools ------ - -- Tools/scripts/reindent.py now creates the backup file using - shutil.copy to preserve user/group and permissions. Added also a - --nobackup option to not create the backup if the user is concerned - regarding this. Check issue #1050828 for more details. - -- Tools/scripts/win_add2path.py was added. The simple script modifes - the PATH environment var of the HKCU tree and adds the python bin - and script directory. - -- Tools/18n/pygettext.py was added to the list of scripts installed by - Tools/scripts/setup.py (tracker item 642309). - -- Added IronPython and Jython support to pybench (part of which was - patch #1563844). - -- Made some minor changes to pybench output to allow the user to see - which Python version is running pybench. - -- Added support for the new platform module feature - platform.python_implementation(); this will now be saved in the - benchmark pickle. - -Documentation -------------- - -- RFE #1765140: Updated documentation on FileHandler and subclasses to - include new optional delay argument. - -- Bug #932563: Added section on getting contextual information into - logging output, and added documentation for the new LoggerAdapter - class. - -- Bug #1295: Added information about caching of formatted exception - information in the LogRecord by Formatter.format(). - -- Bug #1637365: add subsection about "__name__ == __main__" to the - Python tutorial. - -- Patch #1698768: updated the "using Python on the Mac" intro. - -- Bug #1569057: Document that calling file.next() when the file is - open for writing is undefined. - -- Patch #1489771: the syntax rules in Python Reference Manual were - updated to reflect the current Python syntax. - -- Patch #1686451: Fix return type for - PySequence_{Count,Index,Fast_GET_SIZE}. - -- Patch #1679379: add documentation for fnmatch.translate(). - -- Bug #1629566: clarify the docs on the return values of parsedate() - and parsedate_tz() in email.utils and rfc822. - -- Patch #1671450: add a section about subclassing built-in types to the - "extending and embedding" tutorial. - -- Bug #1629125: fix wrong data type (int -> Py_ssize_t) in PyDict_Next - docs. - -- Bug #1565919: document set types in the Language Reference. - -- Bug #1546052: clarify that PyString_FromString(AndSize) copies the - string pointed to by its parameter. - -- Bug #1566663: remove obsolete example from datetime docs. - -- Bug #1541682: Fix example in the "Refcount details" API docs. - Additionally, remove a faulty example showing PySequence_SetItem - applied to a newly created list object and add notes that this isn't - a good idea. - -Tools/Demos ------------ - -- Patch #1552024: add decorator support to unparse.py demo script. - -- Make auto-generated python.vim file list built-ins and exceptions in - alphatbetical order. Makes output more deterministic and easier to - tell if the file is stale or not. - -- Bug #1546372: Fixed small bugglet in pybench that caused a missing - file not to get reported properly. - -Build ------ - -- Have the search path for building extensions follow the declared - order in $CPPFLAGS and $LDFLAGS when adding directories from those - environment variables. - -- Bug #1983: Added a check to pyport to verify that sizeof(pid_t) is - smaller or equal sizeof(long). - -- Bug #1234: Fixed semaphore errors on AIX 5.2 - -- Issue #1726: Remove Python/atof.c from PCBuild/pythoncore.vcproj. - -- Removed PCbuild8/ directory and added a new build directory for VS - 2005 based on the VS 2008 build directory to PC/VS8.0. The script - PCbuild/vs8to9.py was added to sync changes from PCbuild to - PC/VS8.0. - -- Moved PCbuild/ directory for VS 2003 to PC/VS7.1 and renamed - PCBuild9/ directory to PCBuild/. - -- Bug #1699: Define _BSD_SOURCE only on OpenBSD. - -- Bug #1608: use -fwrapv when GCC supports it. This is important, - newer GCC versions may optimize away overflow buffer overflow checks - without this option! - -- Patch #1418: Make the AC_REPLACE_FUNCS object files actually work. - -- Add a FAST_LOOPS build option that speeds-up looping by trading away - periodic threadstate and signal checking in tight loops. By - default, this option is turned-off. It should only be enabled in - debugged, performance critical applications. - -- Patch #786737: Allow building in a tree of symlinks pointing to a - readonly source. - -- Bug #1737210: Change Manufacturer of Windows installer to PSF. - -- Bug #1746880: Correctly install DLLs into system32 folder on Win64. - -- Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD - 4.1+. - -- Stop supporting AtheOS and cause a build error in configure for the - platform. - -- Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS - returned by python-config if Python was built with --enable-shared - because that prevented the shared library from being used. - -- Patch #1569798: fix a bug in distutils when building Python from a - directory within sys.exec_prefix. - -- Bug #1675511: Use -Kpic instead of -xcode=pic32 on Solaris/x86. - -- Disable _XOPEN_SOURCE on NetBSD 1.x. - -- configure now checks whether gcc supports the PyArg_ParseTuple - format attribute. - -- Bug #1578513: Cross compilation was broken by a change to configure. - Repair so that it's back to how it was in 2.4.3. - -- Patch #1576954: Update VC6 build directory; remove redundant files - in VC7. - -- Bug #1568842: Fix test for uintptr_t. - -- Patch #1540470: for OpenBSD 4.0. - -- Fix build failure on kfreebsd and on the hurd. - -- Fix the build of the library reference in info format. - -- Allow Emacs 22 for building the documentation in info format. - -- Makefile.pre.in(buildbottest): Run an optional script - pybuildbot.identify to include some information about the build - environment. - -C API ------ - -- Unified naming convention for free lists and their limits. All free - lists in Object/ are named ``free_list``, the counter ``numfree`` - and the upper limit is a macro ``PyName_MAXFREELIST`` inside an - #ifndef block. - -- ``PySet_Add()`` can now modify a newly created frozenset. Similarly - to ``PyTuple_SetItem``, it can be used to populate a brand new - frozenset; but it does not steal a reference to the added item. - -- Added ``PySet_Check()`` and ``PyFrozenSet_Check()`` to the set API. - -- Backport of PyUnicode_FromString(), _FromStringAndSize(), _Format - and _FormatV from Python 3.0. Made PyLong_AsSsize_t and - PyLong_FromSsize_t public functions. - -- Patch #1720595: add T_BOOL to the range of structmember types. - -- Issue #1534: Added ``PyFloat_GetMax()``, ``PyFloat_GetMin()`` and - ``PyFloat_GetInfo()`` to the float API. - -- Issue #1521: On 64bit platforms, using PyArgs_ParseTuple with the t# - of w# format code incorrectly truncated the length to an int, even - when PY_SSIZE_T_CLEAN is set. The str.decode method used to return - incorrect results with huge strings. - -- Issue #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, - Py_TYPE and Py_REFCNT. - -- PEP 3123: Provide forward compatibility with Python 3.0, while - keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, - and PyVarObject_HEAD_INIT. - -- Py_ssize_t fields work in structmember when HAVE_LONG_LONG is not - defined. - -- Patch #1733960: Allow T_LONGLONG to accept ints. - -- T_PYSSIZET can now be used in PyMemberDef lists for Py_ssize_t members. - -- Added a new API function ``PyImport_ImportModuleNoBlock``. - -- Bug #1637022: Prefix AST symbols with _Py_. - -- Fix some leftovers from the conversion from int to Py_ssize_t - (relevant to strings and sequences of more than 2**31 items). - -- Make _PyGILState_NoteThreadState() static, it was not used anywhere - outside of pystate.c and should not be necessary. - -- ``PyImport_Import`` and ``PyImport_ImportModule`` now always do - absolute imports. In earlier versions they might have used relative - imports under some conditions. - -- Added case insensitive comparison methods ``PyOS_stricmp(char*, - char*)`` and ``PyOS_strnicmp(char*, char*, Py_ssize_t)``. - -- Bug #1542693: remove semi-colon at end of PyImport_ImportModuleEx - macro so it can be used as an expression. - -Windows -------- - -- Patch #1706: Drop support for Win9x, WinME and NT4. Python now - requires Windows 2000 or greater. The _WINVER and NTDDI_VERSION - macros are set to Win2k for x86/32bit builds and WinXP for AMD64 - builds. - -- Conditionalize definition of _CRT_SECURE_NO_DEPRECATE and - _CRT_NONSTDC_NO_DEPRECATE. - -- Bug #1216: Restore support for Visual Studio 2002. - -Mac ---- - -- cfmfile now raises a DeprecationWarning. - -- buildtools now raises a DeprecationWarning. - -- Removed the macfs module. It had been deprecated since Python 2.5. - This lead to the deprecation of macostools.touched() as it relied - solely on macfs and was a no-op under OS X. - ----- - -**(For information about older versions, consult the HISTORY file.)** diff --git a/Misc/NEWS.d/2.6.rst b/Misc/NEWS.d/2.6.rst new file mode 100644 index 00000000000..71753a7270d --- /dev/null +++ b/Misc/NEWS.d/2.6.rst @@ -0,0 +1,102 @@ +.. bpo: 3967 +.. date: 7179 +.. nonce: q7G-yg +.. release date: 01-Oct-2008 +.. section: Core and Builtins + +Fixed a crash in the count() and find() methods of string-like objects, when +the "start" parameter is a huge value. + +.. + +.. bpo: 3965 +.. date: 7178 +.. nonce: oD6PeM +.. section: Core and Builtins + +Fixed a crash on Windows when open() is given an invalid filename or mode, +and the filename is a unicode string. + +.. + +.. bpo: 3951 +.. date: 7177 +.. nonce: WMRS35 +.. section: Core and Builtins + +Py_USING_MEMORY_DEBUGGER should not be enabled by default. + +.. + +.. bpo: 3965 +.. date: 7176 +.. nonce: 67WKTr +.. section: Library + +Allow repeated calls to turtle.Screen, by making it a true singleton object. + +.. + +.. bpo: 3895 +.. date: 7175 +.. nonce: 7zAG5K +.. section: Library + +It was possible to crash the interpreter when an external timer was used +with cProfile that returned an object that could not be converted into a +float. + +.. + +.. bpo: 3950 +.. date: 7174 +.. nonce: zZXLaL +.. section: Library + +Made turtle respect scale factors. + +.. + +.. bpo: 3547 +.. date: 7173 +.. nonce: MEAOsx +.. section: Library + +Fixed ctypes structures bitfields of varying integer sizes. + +.. + +.. bpo: 3879 +.. date: 7172 +.. nonce: F8u7Is +.. section: Library + +A regression in urllib.getproxies_environment was fixed. + +.. + +.. bpo: 3863 +.. date: 7171 +.. nonce: 5nuS5x +.. section: Library + +Disabled a unit test of fork being called from a thread when running on +platforms known to exhibit OS bugs when attempting that. + +.. + +.. bpo: 3989 +.. date: 7170 +.. nonce: RW3kS6 +.. section: Build + +Package the 2to3 script (as 2to3.py) in the Windows installer. + +.. + +.. bpo: 3887 +.. date: 7169 +.. nonce: qYeYwa +.. section: Build + +Package x64 version of CRT for AMD64 Windows binaries. diff --git a/Misc/NEWS.d/2.6a1.rst b/Misc/NEWS.d/2.6a1.rst new file mode 100644 index 00000000000..8edf052299f --- /dev/null +++ b/Misc/NEWS.d/2.6a1.rst @@ -0,0 +1,5507 @@ +.. bpo: 2051 +.. date: 6793 +.. nonce: ra69cz +.. release date: 29-Feb-2008 +.. section: Core and Builtins + +pyc and pyo files are no longer created with permission 644. The mode is now +inherited from the py file. + +.. + +.. bpo: 2067 +.. date: 6792 +.. nonce: dnOq_n +.. section: Core and Builtins + +file.__exit__() now calls subclasses' close() method. + +.. + +.. bpo: 1759 +.. date: 6791 +.. nonce: q41gVI +.. section: Core and Builtins + +Backport of PEP 3129 class decorators. + +.. + +.. bpo: 1881 +.. date: 6790 +.. nonce: Z0XsUF +.. section: Core and Builtins + +An internal parser limit has been increased. Also see issue #215555 for a +discussion. + +.. + +.. bpo: 0 +.. date: 6789 +.. nonce: t4RIVL +.. section: Core and Builtins + +Added the future_builtins module, which contains hex() and oct(). These are +the PEP 3127 version of these functions, designed to be compatible with the +hex() and oct() builtins from Python 3.0. They differ slightly in their +output formats from the existing, unchanged Python 2.6 builtins. The +expected usage of the future_builtins module is: from future_builtins +import hex, oct + +.. + +.. bpo: 1600 +.. date: 6788 +.. nonce: s9YmZq +.. section: Core and Builtins + +Modified PyOS_ascii_formatd to use at most 2 digit exponents for exponents +with absolute value < 100. Follows C99 standard. This is a change on +Windows, which would use 3 digits. Also, added 'n' to the formats that +PyOS_ascii_formatd understands, so that any alterations it does to the +resulting string will be available in stringlib/formatter.h (for +float.__format__). + +.. + +.. bpo: 0 +.. date: 6787 +.. nonce: 3heWL4 +.. section: Core and Builtins + +Implemented PEP 3101, Advanced String Formatting. This adds a new builtin +format(); a format() method for str and unicode; a __format__() method to +object, str, unicode, int, long, float, and datetime; the class +string.Formatter; and the C API PyObject_Format(). + +.. + +.. bpo: 0 +.. date: 6786 +.. nonce: 5DONqn +.. section: Core and Builtins + +Fixed several potential crashes, all caused by specially crafted __del__ +methods exploiting objects in temporarily inconsistent state. + +.. + +.. bpo: 2115 +.. date: 6785 +.. nonce: 0hltM5 +.. section: Core and Builtins + +Important speedup in setting __slot__ attributes. Also prevent a possible +crash: an Abstract Base Class would try to access a slot on a registered +virtual subclass. + +.. + +.. bpo: 0 +.. date: 6784 +.. nonce: mw1G3G +.. section: Core and Builtins + +Fixed repr() and str() of complex numbers with infinity or nan as real or +imaginary part. + +.. + +.. bpo: 0 +.. date: 6783 +.. nonce: 9iXgfq +.. section: Core and Builtins + +Clear all free lists during a gc.collect() of the highest generation in +order to allow pymalloc to free more arenas. Python may give back memory to +the OS earlier. + +.. + +.. bpo: 2045 +.. date: 6782 +.. nonce: r1Y5JL +.. section: Core and Builtins + +Fix an infinite recursion triggered when printing a subclass of +collections.defaultdict, if its default_factory is set to a bound method. + +.. + +.. bpo: 0 +.. date: 6781 +.. nonce: Ix4aiT +.. section: Core and Builtins + +Fixed a minor memory leak in dictobject.c. The content of the free list was +not freed on interpreter shutdown. + +.. + +.. bpo: 0 +.. date: 6780 +.. nonce: cL2Owz +.. section: Core and Builtins + +Limit free list of method and built-in function objects to 256 entries each. + +.. + +.. bpo: 1953 +.. date: 6779 +.. nonce: e_mPMK +.. section: Core and Builtins + +Added ``sys._compact_freelists()`` and the C API functions +``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` to compact the +internal free lists of pre-allocted ints and floats. + +.. + +.. bpo: 1983 +.. date: 6778 +.. nonce: 8sFEOx +.. section: Core and Builtins + +Fixed return type of fork(), fork1() and forkpty() calls. Python expected +the return type int but the fork familie returns pi_t. + +.. + +.. bpo: 1678380 +.. date: 6777 +.. nonce: QDsVif +.. section: Core and Builtins + +Fix a bug that identifies 0j and -0j when they appear in the same code unit. + +.. + +.. bpo: 2025 +.. date: 6776 +.. nonce: S9iuHk +.. section: Core and Builtins + +Add tuple.count() and tuple.index() methods to comply with the +collections.Sequence API. + +.. + +.. bpo: 1970 +.. date: 6775 +.. nonce: QefSF6 +.. section: Core and Builtins + +Speedup unicode whitespace and linebreak detection. (Patch by Antoine +Pitrou.) + +.. + +.. bpo: 0 +.. date: 6774 +.. nonce: YYnDHc +.. section: Core and Builtins + +Added ``PyType_ClearCache()`` and ``sys._clear_type_cache`` to clear the +internal lookup cache for ref leak tests. + +.. + +.. bpo: 1473257 +.. date: 6773 +.. nonce: Z579K3 +.. section: Core and Builtins + +generator objects gain a gi_code attribute. This is the same object as the +func_code attribute of the function that produced the generator. + +.. + +.. bpo: 1920 +.. date: 6772 +.. nonce: z8WX6L +.. section: Core and Builtins + +"while 0" statements were completely removed by the compiler, even in the +presence of an "else" clause, which is supposed to be run when the condition +is false. Now the compiler correctly emits bytecode for the "else" suite. + +.. + +.. bpo: 0 +.. date: 6771 +.. nonce: VpT9Pm +.. section: Core and Builtins + +A few crashers fixed: weakref_in_del.py (issue #1377858); +loosing_dict_ref.py (issue #1303614, test67.py); borrowed_ref_[34].py (not +in tracker). + +.. + +.. bpo: 1069410 +.. date: 6770 +.. nonce: GX0t-e +.. section: Core and Builtins + +The "can't load dll" message box on Windows is suppressed while an extension +is loaded by calling SetErrorMode in dynload_win.c. The error is still +reported properly. + +.. + +.. bpo: 1915 +.. date: 6769 +.. nonce: MAhEEN +.. section: Core and Builtins + +Python compiles with --enable-unicode=no again. However several extension +methods and modules do not work without unicode support. + +.. + +.. bpo: 1882 +.. date: 6768 +.. nonce: -TxSag +.. section: Core and Builtins + +when compiling code from a string, encoding cookies in the second line of +code were not always recognized correctly. + +.. + +.. bpo: 1679 +.. date: 6767 +.. nonce: 48PPdV +.. section: Core and Builtins + +"0x" was taken as a valid integer literal. + +.. + +.. bpo: 1865 +.. date: 6766 +.. nonce: wGzYDz +.. section: Core and Builtins + +``bytes`` as an alias for ``str`` and b"" as an alias "" were added. + +.. + +.. bpo: 0 +.. date: 6765 +.. nonce: x2ieFr +.. section: Core and Builtins + +sys.float_info / PyFloat_GetInfo: The floating point information object was +converted from a dict to a specialized structseq object. + +.. + +.. bpo: 1816 +.. date: 6764 +.. nonce: YBjd5H +.. section: Core and Builtins + +Added sys.flags structseq. It exposes the status of most command line +arguments and PYTHON* environment variables. + +.. + +.. bpo: 0 +.. date: 6763 +.. nonce: wmc0sT +.. section: Core and Builtins + +Objects/structseq.c: Implemented new structseq representation. The patch +makes structseqs (e.g. the return value of os.stat) more readable. + +.. + +.. bpo: 1700288 +.. date: 6762 +.. nonce: lwJfDZ +.. section: Core and Builtins + +added a type attribute cache that caches method accesses, resulting in +speedups in heavily object-oriented code. + +.. + +.. bpo: 1776 +.. date: 6761 +.. nonce: JYdqH- +.. section: Core and Builtins + +__import__() no longer accepts filenames on any platform. The first +parameter to __import__() must be a valid module name. + +.. + +.. bpo: 1668 +.. date: 6760 +.. nonce: mZ5kSj +.. section: Core and Builtins + +renamed THREADDEBUG envvar to PYTHONTHREADDEBUG. + +.. + +.. bpo: 602345 +.. date: 6759 +.. nonce: OOgFXY +.. section: Core and Builtins + +Add -B command line option, PYTHONDONTWRITEBYTECODE envvar and +sys.dont_write_bytecode attribute. All these can be set to forbid Python to +attempt to write compiled bytecode files. + +.. + +.. bpo: 0 +.. date: 6758 +.. nonce: _7a_Ll +.. section: Core and Builtins + +Improve some exception messages when Windows fails to load an extension +module. Now we get for example '%1 is not a valid Win32 application' instead +of 'error code 193'. + +.. + +.. bpo: 1481296 +.. date: 6757 +.. nonce: nRMqCX +.. section: Core and Builtins + +Fixed long(float('nan')) != 0L. + +.. + +.. bpo: 1640 +.. date: 6756 +.. nonce: INvUrF +.. section: Core and Builtins + +Added math.isinf(x), math.isnan(x) and math.copysign(x, y) functions. + +.. + +.. bpo: 1635 +.. date: 6755 +.. nonce: fiXSfN +.. section: Core and Builtins + +Platform independent creation and representation of NaN and INF. +float("nan"), float("inf") and float("-inf") now work on every platform with +IEEE 754 semantics. + +.. + +.. bpo: 0 +.. date: 6754 +.. nonce: MNMsrF +.. section: Core and Builtins + +Compiler now generates simpler and faster code for dictionary literals. The +oparg for BUILD_MAP now indicates an estimated dictionary size. There is a +new opcode, STORE_MAP, for adding entries to the dictionary. + +.. + +.. bpo: 1638 +.. date: 6753 +.. nonce: eg4t3m +.. section: Core and Builtins + +%zd configure test fails on Linux. + +.. + +.. bpo: 1620 +.. date: 6752 +.. nonce: 9qBeVK +.. section: Core and Builtins + +New property decorator syntax was modifying the decorator in place instead +of creating a new decorator object. + +.. + +.. bpo: 1538 +.. date: 6751 +.. nonce: OkvKJR +.. section: Core and Builtins + +Avoid copying string in split/rsplit if the split char is not found. + +.. + +.. bpo: 1553 +.. date: 6750 +.. nonce: FCgNDE +.. section: Core and Builtins + +An erroneous __length_hint__ can make list() raise a SystemError. + +.. + +.. bpo: 0 +.. date: 6749 +.. nonce: zw_5PA +.. section: Core and Builtins + +PEP 366: Allow explicit relative imports when executing modules inside +packages with the -m switch via a new module level __package__ attribute. + +.. + +.. bpo: 1402 +.. date: 6748 +.. nonce: ZTegLQ +.. section: Core and Builtins + +Fix a crash on exit, when another thread is still running, and if the +deallocation of its frames somehow calls the PyGILState_Ensure() / +PyGILState_Release() functions. + +.. + +.. bpo: 0 +.. date: 6747 +.. nonce: J3Bwhy +.. section: Core and Builtins + +Expose the Py_Py3kWarningFlag as sys.py3kwarning. + +.. + +.. bpo: 1445 +.. date: 6746 +.. nonce: 6-yfkc +.. section: Core and Builtins + +Fix a SystemError when accessing the ``cell_contents`` attribute of an empty +cell object. + +.. + +.. bpo: 1460 +.. date: 6745 +.. nonce: y7TP5m +.. section: Core and Builtins + +The utf-7 incremental decoder did not accept truncated input. It now +correctly saves its state between chunks of data. + +.. + +.. bpo: 1739468 +.. date: 6744 +.. nonce: yM3B3r +.. section: Core and Builtins + +Directories and zipfiles containing a __main__.py file can now be directly +executed by passing their name to the interpreter. The directory/zipfile is +automatically inserted as the first entry in sys.path. + +.. + +.. bpo: 1265 +.. date: 6743 +.. nonce: 4-IaJd +.. section: Core and Builtins + +Fix a problem with sys.settrace, if the tracing function uses a generator +expression when at the same time the executed code is closing a paused +generator. + +.. + +.. bpo: 0 +.. date: 6742 +.. nonce: 7h4lCb +.. section: Core and Builtins + +sets and frozensets now have an isdisjoint() method. + +.. + +.. bpo: 0 +.. date: 6741 +.. nonce: 1AoYAQ +.. section: Core and Builtins + +optimize the performance of builtin.sum(). + +.. + +.. bpo: 0 +.. date: 6740 +.. nonce: FHJ_J8 +.. section: Core and Builtins + +Fix warnings found by the new version of the Coverity checker. + +.. + +.. bpo: 0 +.. date: 6739 +.. nonce: 6dncrc +.. section: Core and Builtins + +The enumerate() built-in function is no longer bounded to sequences smaller +than LONG_MAX. Formerly, it raised an OverflowError. Now, automatically +shifts from ints to longs. + +.. + +.. bpo: 1686386 +.. date: 6738 +.. nonce: mFw2O5 +.. section: Core and Builtins + +Tuple's tp_repr did not take into account the possibility of having a self- +referential tuple, which is possible from C code. Nor did object's tp_str +consider that a type's tp_str could do something that could lead to an +inifinite recursion. Py_ReprEnter() and Py_EnterRecursiveCall(), +respectively, fixed the issues. + +.. + +.. bpo: 1164 +.. date: 6737 +.. nonce: uMHT40 +.. section: Core and Builtins + +It was possible to trigger deadlock when using the 'print' statement to +write to a file since the GIL was not released as needed. Now +PyObject_Print() does the right thing along with various tp_print +implementations of the built-in types and those in the collections module. + +.. + +.. bpo: 1147 +.. date: 6736 +.. nonce: aoJ7OF +.. section: Core and Builtins + +Exceptions were directly allowing string exceptions in their throw() method +even though string exceptions no longer allowed. + +.. + +.. bpo: 1096 +.. date: 6735 +.. nonce: O7aCp5 +.. section: Core and Builtins + +Prevent a segfault from getting the repr of a very deeply nested list by +using the recursion counter. + +.. + +.. bpo: 1202533 +.. date: 6734 +.. nonce: an8trG +.. section: Core and Builtins + +Fix infinite recursion calls triggered by calls to PyObject_Call() never +calling back out to Python code to trigger recursion depth updates/checks. +Required the creation of a static RuntimeError instance in case normalizing +an exception put the recursion check value past its limit. Fixes crashers +infinite_rec_(1|2|4|5).py. + +.. + +.. bpo: 1031213 +.. date: 6733 +.. nonce: -pIcnp +.. section: Core and Builtins + +Decode source line in SyntaxErrors back to its original source encoding. + +.. + +.. bpo: 1673759 +.. date: 6732 +.. nonce: BiojUu +.. section: Core and Builtins + +add a missing overflow check when formatting floats with %G. + +.. + +.. bpo: 0 +.. date: 6731 +.. nonce: irpf7S +.. section: Core and Builtins + +Prevent expandtabs() on string and unicode objects from causing a segfault +when a large width is passed on 32-bit platforms. + +.. + +.. bpo: 1733488 +.. date: 6730 +.. nonce: tl7wNc +.. section: Core and Builtins + +Fix compilation of bufferobject.c on AIX. + +.. + +.. bpo: 1722485 +.. date: 6729 +.. nonce: k6MqIQ +.. section: Core and Builtins + +remove docstrings again when running with -OO. + +.. + +.. bpo: 0 +.. date: 6728 +.. nonce: 7Ddptw +.. section: Core and Builtins + +Add new attribute names for function objects. All the func_* become __*__ +attributes. (Some already existed, e.g., __doc__ and __name__.) + +.. + +.. bpo: 0 +.. date: 6727 +.. nonce: yXfECI +.. section: Core and Builtins + +Add -3 option to the interpreter to warn about features that are deprecated +and will be changed/removed in Python 3.0. + +.. + +.. bpo: 1686487 +.. date: 6726 +.. nonce: K8mtCR +.. section: Core and Builtins + +you can now pass any mapping after '**' in function calls. + +.. + +.. bpo: 0 +.. date: 6725 +.. nonce: JKXn1u +.. section: Core and Builtins + +except clauses may now be spelled either "except E, target:" or "except E as +target:". This is to provide forwards compatibility with Python 3.0. + +.. + +.. bpo: 0 +.. date: 6724 +.. nonce: 8LZd6s +.. section: Core and Builtins + +Deprecate BaseException.message as per PEP 352. + +.. + +.. bpo: 1303614 +.. date: 6723 +.. nonce: 4vwOmy +.. section: Core and Builtins + +don't expose object's __dict__ when the dict is inherited from a built-in +base. + +.. + +.. bpo: 0 +.. date: 6722 +.. nonce: VN88wa +.. section: Core and Builtins + +When __slots__ are set to a unicode string, make it work the same as setting +a plain string, ie don't expand to single letter identifiers. + +.. + +.. bpo: 1191699 +.. date: 6721 +.. nonce: V0UWcO +.. section: Core and Builtins + +Slices can now be pickled. + +.. + +.. bpo: 1193128 +.. date: 6720 +.. nonce: hTWYjG +.. section: Core and Builtins + +str.translate() now allows a None argument for translations that only remove +characters without re-mapping the remaining characters. + +.. + +.. bpo: 1682205 +.. date: 6719 +.. nonce: Ma5xwn +.. section: Core and Builtins + +a TypeError while unpacking an iterable is no longer masked by a generic one +with the message "unpack non-sequence". + +.. + +.. bpo: 0 +.. date: 6718 +.. nonce: 3y4NCG +.. section: Core and Builtins + +Remove unused file Python/fmod.c. + +.. + +.. bpo: 1683368 +.. date: 6717 +.. nonce: 4DybJV +.. section: Core and Builtins + +The object.__init__() and object.__new__() methods are now stricter in +rejecting excess arguments. The only time when either allows excess +arguments is when it is not overridden and the other one is. For backwards +compatibility, when both are overridden, it is a deprecation warning (for +now; maybe a Py3k warning later). Also, type.__init__() insists on the same +signature as supported by type.__new__(). + +.. + +.. bpo: 1675423 +.. date: 6716 +.. nonce: 1JoPlp +.. section: Core and Builtins + +PyComplex_AsCComplex() now tries to convert an object to complex using its +__complex__() method before falling back to the __float__() method. +Therefore, the functions in the cmath module now can operate on objects that +define a __complex__() method. + +.. + +.. bpo: 1623563 +.. date: 6715 +.. nonce: AMQ5t2 +.. section: Core and Builtins + +allow __class__ assignment for classes with __slots__. The old and the new +class are still required to have the same slot names. + +.. + +.. bpo: 1642547 +.. date: 6714 +.. nonce: jkS5Ql +.. section: Core and Builtins + +Fix an error/crash when encountering syntax errors in complex if statements. + +.. + +.. bpo: 1462488 +.. date: 6713 +.. nonce: Ci87cu +.. section: Core and Builtins + +Python no longer segfaults when ``object.__reduce_ex__()`` is called with an +object that is faking its type. + +.. + +.. bpo: 1680015 +.. date: 6712 +.. nonce: FS6aET +.. section: Core and Builtins + +Don't modify __slots__ tuple if it contains a unicode name. + +.. + +.. bpo: 1444529 +.. date: 6711 +.. nonce: 69vMCk +.. section: Core and Builtins + +the builtin compile() now accepts keyword arguments. + +.. + +.. bpo: 1678647 +.. date: 6710 +.. nonce: Ok4Qvk +.. section: Core and Builtins + +write a newline after printing an exception in any case, even when +converting the value to a string failed. + +.. + +.. bpo: 0 +.. date: 6709 +.. nonce: ec6gzH +.. section: Core and Builtins + +The dir() function has been extended to call the __dir__() method on its +argument, if it exists. If not, it will work like before. This allows +customizing the output of dir() in the presence of a __getattr__(). + +.. + +.. bpo: 922167 +.. date: 6708 +.. nonce: gnPICc +.. section: Core and Builtins + +Python no longer segfaults when faced with infinitely self-recursive +reload() calls (as reported by bug #742342). + +.. + +.. bpo: 1675981 +.. date: 6707 +.. nonce: YDAUpa +.. section: Core and Builtins + +remove unreachable code from ``type.__new__()`` method. + +.. + +.. bpo: 1491866 +.. date: 6706 +.. nonce: RNQumX +.. section: Core and Builtins + +change the complex() constructor to allow parthensized forms. This means +complex(repr(x)) now works instead of raising a ValueError. + +.. + +.. bpo: 703779 +.. date: 6705 +.. nonce: 609S2B +.. section: Core and Builtins + +unset __file__ in __main__ after running a file. This makes the filenames +the warning module prints much more sensible when a PYTHONSTARTUP file is +used. + +.. + +.. bpo: 697613 +.. date: 6704 +.. nonce: bnztSz +.. section: Core and Builtins + +Don't exit the interpreter on a SystemExit exception if the -i command line +option or PYTHONINSPECT environment variable is given, but break into the +interactive interpreter just like on other exceptions or normal program +exit. + +.. + +.. bpo: 1638879 +.. date: 6703 +.. nonce: 25rW83 +.. section: Core and Builtins + +don't accept strings with embedded NUL bytes in long(). + +.. + +.. bpo: 1674503 +.. date: 6702 +.. nonce: k_dwnR +.. section: Core and Builtins + +close the file opened by execfile() in an error condition. + +.. + +.. bpo: 1674228 +.. date: 6701 +.. nonce: 936l-6 +.. section: Core and Builtins + +when assigning a slice (old-style), check for the sq_ass_slice instead of +the sq_slice slot. + +.. + +.. bpo: 0 +.. date: 6700 +.. nonce: 4R0u4H +.. section: Core and Builtins + +When printing an unraisable error, don't print exceptions. before the name. +This duplicates the behavior whening normally printing exceptions. + +.. + +.. bpo: 1653736 +.. date: 6699 +.. nonce: puX_f- +.. section: Core and Builtins + +Properly discard third argument to slot_nb_inplace_power. + +.. + +.. bpo: 0 +.. date: 6698 +.. nonce: LM67G- +.. section: Core and Builtins + +PEP 352: Raising a string exception now triggers a TypeError. Attempting to +catch a string exception raises DeprecationWarning. + +.. + +.. bpo: 1377858 +.. date: 6697 +.. nonce: PoWq_L +.. section: Core and Builtins + +Fix the segfaulting of the interpreter when an object created a weakref on +itself during a __del__ call for new-style classes (classic classes still +have the bug). + +.. + +.. bpo: 1579370 +.. date: 6696 +.. nonce: 0Jm29g +.. section: Core and Builtins + +Make PyTraceBack_Here use the current thread, not the frame's thread state. + +.. + +.. bpo: 1630975 +.. date: 6695 +.. nonce: MoA2CT +.. section: Core and Builtins + +Fix crash when replacing sys.stdout in sitecustomize.py. + +.. + +.. bpo: 0 +.. date: 6694 +.. nonce: fKwD4u +.. section: Core and Builtins + +Prevent seg fault on shutdown which could occur if an object raised a +warning. + +.. + +.. bpo: 1566280 +.. date: 6693 +.. nonce: dDNq9b +.. section: Core and Builtins + +Explicitly invoke threading._shutdown from Py_Main, to avoid relying on +atexit. + +.. + +.. bpo: 1590891 +.. date: 6692 +.. nonce: VyFkXx +.. section: Core and Builtins + +random.randrange don't return correct value for big number. + +.. + +.. bpo: 1586791 +.. date: 6691 +.. nonce: xyEZ-z +.. section: Core and Builtins + +Better exception messages for some operations on strings, tuples and lists. + +.. + +.. bpo: 1067760 +.. date: 6690 +.. nonce: HtgVCb +.. section: Core and Builtins + +Deprecate passing floats to file.seek. + +.. + +.. bpo: 1591996 +.. date: 6689 +.. nonce: j1ATtE +.. section: Core and Builtins + +Correctly forward exception in instance_contains(). + +.. + +.. bpo: 1588287 +.. date: 6688 +.. nonce: Mux8Eb +.. section: Core and Builtins + +fix invalid assertion for `1,2` in debug builds. + +.. + +.. bpo: 1576657 +.. date: 6687 +.. nonce: JfJVvT +.. section: Core and Builtins + +when setting a KeyError for a tuple key, make sure that the tuple isn't used +as the "exception arguments tuple". + +.. + +.. bpo: 1565514 +.. date: 6686 +.. nonce: 3kM2zk +.. section: Core and Builtins + +SystemError not raised on too many nested blocks. + +.. + +.. bpo: 1576174 +.. date: 6685 +.. nonce: Ks0OoN +.. section: Core and Builtins + +WindowsError now displays the windows error code again, no longer the posix +error code. + +.. + +.. bpo: 1549049 +.. date: 6684 +.. nonce: ufVmC9 +.. section: Core and Builtins + +Support long values in structmember, issue warnings if the assigned value +for structmember fields gets truncated. + +.. + +.. bpo: 0 +.. date: 6683 +.. nonce: v9ZHkl +.. section: Core and Builtins + +Update the peephole optimizer to remove more dead code (jumps after returns) +and inline unconditional jumps to returns. + +.. + +.. bpo: 1545497 +.. date: 6682 +.. nonce: 0YntFv +.. section: Core and Builtins + +when given an explicit base, int() did ignore NULs embedded in the string to +convert. + +.. + +.. bpo: 1569998 +.. date: 6681 +.. nonce: mqCYRs +.. section: Core and Builtins + +break inside a try statement (outside a loop) is now recognized and +rejected. + +.. + +.. bpo: 0 +.. date: 6680 +.. nonce: MdIC85 +.. section: Core and Builtins + +list.pop(x) accepts any object x following the __index__ protocol. + +.. + +.. bpo: 0 +.. date: 6679 +.. nonce: nWa36P +.. section: Core and Builtins + +A number of places, including integer negation and absolute value, were +fixed to not rely on undefined behaviour of the C compiler anymore. + +.. + +.. bpo: 1566800 +.. date: 6678 +.. nonce: 46JUvD +.. section: Core and Builtins + +make sure that EnvironmentError can be called with any number of arguments, +as was the case in Python 2.4. + +.. + +.. bpo: 1567691 +.. date: 6677 +.. nonce: rDDApW +.. section: Core and Builtins + +super() and new.instancemethod() now don't accept keyword arguments any more +(previously they accepted them, but didn't use them). + +.. + +.. bpo: 0 +.. date: 6676 +.. nonce: FEPr2V +.. section: Core and Builtins + +Fix a bug in the parser's future statement handling that led to "with" not +being recognized as a keyword after, e.g., this statement: from __future__ +import division, with_statement + +.. + +.. bpo: 1557232 +.. date: 6675 +.. nonce: 2eVXVS +.. section: Core and Builtins + +fix seg fault with def f((((x)))) and def f(((x),)). + +.. + +.. bpo: 0 +.. date: 6674 +.. nonce: aEwDvG +.. section: Core and Builtins + +Fix %zd string formatting on Mac OS X so it prints negative numbers. + +.. + +.. bpo: 0 +.. date: 6673 +.. nonce: _XQgGS +.. section: Core and Builtins + +Allow exception instances to be directly sliced again. + +.. + +.. bpo: 1551432 +.. date: 6672 +.. nonce: 4Fco_l +.. section: Core and Builtins + +Exceptions do not define an explicit __unicode__ method. This allows +calling unicode() on exceptions classes directly to succeed. + +.. + +.. bpo: 1542051 +.. date: 6671 +.. nonce: lVPfnC +.. section: Core and Builtins + +Exceptions now correctly call PyObject_GC_UnTrack. Also make sure that every +exception class has __module__ set to 'exceptions'. + +.. + +.. bpo: 1550983 +.. date: 6670 +.. nonce: cUpUA- +.. section: Core and Builtins + +emit better error messages for erroneous relative imports (if not in package +and if beyond toplevel package). + +.. + +.. bpo: 0 +.. date: 6669 +.. nonce: _4DitC +.. section: Core and Builtins + +Overflow checking code in integer division ran afoul of new gcc +optimizations. Changed to be more standard-conforming. + +.. + +.. bpo: 1542451 +.. date: 6668 +.. nonce: 2iFYEe +.. section: Core and Builtins + +disallow continue anywhere under a finally. + +.. + +.. bpo: 1546288 +.. date: 6667 +.. nonce: IBkaPv +.. section: Core and Builtins + +fix seg fault in dict_equal due to ref counting bug. + +.. + +.. bpo: 0 +.. date: 6666 +.. nonce: kNIYss +.. section: Core and Builtins + +The return tuple from str.rpartition(sep) is (tail, sep, head) where head is +the original string if sep was not found. + +.. + +.. bpo: 1520864 +.. date: 6665 +.. nonce: G6F34n +.. section: Core and Builtins + +unpacking singleton tuples in list comprehensions and generator expressions +(x for x, in ... ) works again. Fixing this problem required changing the +.pyc magic number. This means that .pyc files generated before 2.5c2 will +be regenerated. + +.. + +.. bpo: 0 +.. date: 6664 +.. nonce: R3bZAP +.. section: Core and Builtins + +``with`` and ``as`` are now keywords. + +.. + +.. bpo: 1664966 +.. date: 6663 +.. nonce: wU2avG +.. section: Core and Builtins + +Fix crash in exec if Unicode filename can't be decoded. + +.. + +.. bpo: 1537 +.. date: 6662 +.. nonce: Qt9CQA +.. section: Core and Builtins + +Changed GeneratorExit's base class from Exception to BaseException. + +.. + +.. bpo: 1703448 +.. date: 6661 +.. nonce: dAcXJT +.. section: Core and Builtins + +A joined thread could show up in the threading.enumerate() list after the +join() for a brief period until it actually exited. + +.. + +.. bpo: 2274 +.. date: 6660 +.. nonce: COHFzM +.. section: Library + +Add heapq.heappushpop(). + +.. + +.. bpo: 0 +.. date: 6659 +.. nonce: fQAzb9 +.. section: Library + +Add inspect.isabstract(object) to fix bug #2223 + +.. + +.. bpo: 0 +.. date: 6658 +.. nonce: JXuX8j +.. section: Library + +Add a __format__ method to Decimal, to support PEP 3101. + +.. + +.. bpo: 0 +.. date: 6657 +.. nonce: ofhiG1 +.. section: Library + +Add a timing parameter when using trace.Trace to print out timestamps. + +.. + +.. bpo: 1627 +.. date: 6656 +.. nonce: -5gXNT +.. section: Library + +httplib now ignores negative Content-Length headers. + +.. + +.. bpo: 900744 +.. date: 6655 +.. nonce: s5RLjb +.. section: Library + +If an invalid chunked-encoding header is sent by a server, httplib will now +raise IncompleteRead and close the connection instead of raising ValueError. + +.. + +.. bpo: 1492 +.. date: 6654 +.. nonce: 4bp5zb +.. section: Library + +The content type of BaseHTTPServer error messages can now be overridden. + +.. + +.. bpo: 1781 +.. date: 6653 +.. nonce: m_snIp +.. section: Library + +ConfigParser now does not let you add the "default" section (ignore-case) + +.. + +.. bpo: 0 +.. date: 6652 +.. nonce: a5mTI6 +.. section: Library + +Removed uses of dict.has_key() from distutils, and uses of callable() from +copy_reg.py, so the interpreter now starts up without warnings when '-3' is +given. More work like this needs to be done in the rest of the stdlib. + +.. + +.. bpo: 1916 +.. date: 6651 +.. nonce: w1JiGM +.. section: Library + +added isgenerator() and isgeneratorfunction() to inspect.py. + +.. + +.. bpo: 1224 +.. date: 6650 +.. nonce: UN2SxX +.. section: Library + +Fixed bad url parsing when path begins with double slash. + +.. + +.. bpo: 0 +.. date: 6649 +.. nonce: T9Y4k2 +.. section: Library + +ctypes instances that are not or do not contain pointers can now be pickled. + +.. + +.. bpo: 1966 +.. date: 6648 +.. nonce: 8viueu +.. section: Library + +Break infinite loop in httplib when the servers implements the chunked +encoding incorrectly. + +.. + +.. bpo: 0 +.. date: 6647 +.. nonce: p6a6jJ +.. section: Library + +Rename rational.py to fractions.py and the rational.Rational class to +fractions.Fraction, to avoid the name clash with the abstract base class +numbers.Rational. See discussion in issue #1682. + +.. + +.. bpo: 0 +.. date: 6646 +.. nonce: KqfmO5 +.. section: Library + +The pickletools module now provides an optimize() function that eliminates +unused PUT opcodes from a pickle string. + +.. + +.. bpo: 2021 +.. date: 6645 +.. nonce: jhrI3F +.. section: Library + +Allow tempfile.NamedTemporaryFile and SpooledTemporaryFile to be used in +with statements by correctly supporting the context management protocol. + +.. + +.. bpo: 1979 +.. date: 6644 +.. nonce: Ji_oHm +.. section: Library + +Add rich comparisons to Decimal, and make Decimal comparisons involving a +NaN follow the IEEE 754 standard. + +.. + +.. bpo: 2004 +.. date: 6643 +.. nonce: JJ0sxf +.. section: Library + +tarfile.py: Use mode 0700 for temporary directories and default permissions +for missing directories. + +.. + +.. bpo: 175006 +.. date: 6642 +.. nonce: 1yQpV- +.. section: Library + +The debugger used to skip the condition of a "while" statement after the +first iteration. Now it correctly steps on the expression, and breakpoints +on the "while" statement are honored on each loop. + +.. + +.. bpo: 1765140 +.. date: 6641 +.. nonce: 9htIhK +.. section: Library + +add an optional delay argument to FileHandler and its subclasses. Defaults +to false (existing behaviour), but if true, defers opening the file until +the first call to emit(). + +.. + +.. bpo: 0 +.. date: 6640 +.. nonce: kWAgVm +.. section: Library + +The pprint module now supports sets and frozensets. + +.. + +.. bpo: 1221598 +.. date: 6639 +.. nonce: Tv3Q8D +.. section: Library + +add optional callbacks to ftplib.FTP's storbinary() and storlines() methods. +(Contributed by Phil Schwartz) + +.. + +.. bpo: 1715 +.. date: 6638 +.. nonce: JieRLT +.. section: Library + +include sub-extension modules in pydoc's text output. + +.. + +.. bpo: 1836 +.. date: 6637 +.. nonce: dvWiAW +.. section: Library + +fix an off-by-one bug in TimedRotatingHandler's rollover time calculation. + +.. + +.. bpo: 1021 +.. date: 6636 +.. nonce: oJ2Efg +.. section: Library + +fix a bug to allow basicConfig to accept NOTSET as a level. + +.. + +.. bpo: 932563 +.. date: 6635 +.. nonce: KzDj52 +.. section: Library + +add LoggerAdapter convenience class to make it easier to add contextual +information in logging output. + +.. + +.. bpo: 1760556 +.. date: 6634 +.. nonce: TJk_Du +.. section: Library + +fix a bug to avoid FileHandler throwing an exception in flush(). + +.. + +.. bpo: 1530959 +.. date: 6633 +.. nonce: FpNHxq +.. section: Library + +distutils' build command now uses different build directory when building +extension modules against versions of Python compiled with ``--with- +pydebug``. + +.. + +.. bpo: 1555501 +.. date: 6632 +.. nonce: ZWMYzK +.. section: Library + +move plistlib from plat-mac directory to general library. + +.. + +.. bpo: 1269 +.. date: 6631 +.. nonce: mXhB8y +.. section: Library + +fix a bug in pstats.add_callers() and add a unit test file for pstats. + +.. + +.. bpo: 1669 +.. date: 6630 +.. nonce: wYb4kk +.. section: Library + +don't allow shutil.rmtree() to be called on a symlink to a directory. + +.. + +.. bpo: 1664522 +.. date: 6629 +.. nonce: iKq42P +.. section: Library + +in urllib, don't read non-existing directories in ftp mode, returning a +0-byte file -- raise an IOError instead. + +.. + +.. bpo: 856047 +.. date: 6628 +.. nonce: u8LcMz +.. section: Library + +respect the ``no_proxy`` environment variable when using the ``http_proxy`` +etc. environment variables in urllib. + +.. + +.. bpo: 1178141 +.. date: 6627 +.. nonce: kOvNOH +.. section: Library + +add a getcode() method to the addinfourls that urllib.open() returns so that +you can retrieve the HTTP status code. + +.. + +.. bpo: 1003 +.. date: 6626 +.. nonce: WwyOlb +.. section: Library + +Fix zipfile decryption check, it would fail zip files with extended local +headers. + +.. + +.. bpo: 1189216 +.. date: 6625 +.. nonce: ux7ujo +.. section: Library + +Fix the zipfile module to work on archives with headers past the 2**31 byte +boundary. + +.. + +.. bpo: 1336 +.. date: 6624 +.. nonce: r4ZdAS +.. section: Library + +fix a race condition in subprocess.Popen if the garbage collector kicked in +at the wrong time that would cause the process to hang when the child wrote +to stderr. + +.. + +.. bpo: 1146 +.. date: 6623 +.. nonce: 3Fg8Y4 +.. section: Library + +fix how textwrap breaks a long word that would start in the last column of a +line. + +.. + +.. bpo: 1693149 +.. date: 6622 +.. nonce: UDBT5O +.. section: Library + +trace.py --ignore-module - accept multiple comma-separated modules to be +given. + +.. + +.. bpo: 1822 +.. date: 6621 +.. nonce: p-ABc6 +.. section: Library + +MIMEMultipart.is_multipart() behaves correctly for a just-created (and +empty) instance. Thanks Jonathan Share. + +.. + +.. bpo: 1861 +.. date: 6620 +.. nonce: YK39Pw +.. section: Library + +Added an attribute to the sched module which returns an ordered list of +upcoming events (displayed as named tuples). + +.. + +.. bpo: 1837 +.. date: 6619 +.. nonce: ltZfCW +.. section: Library + +The queue module now also supports a LIFO queue and a priority queue. + +.. + +.. bpo: 1048820 +.. date: 6618 +.. nonce: hKddPS +.. section: Library + +Add insert-mode editing to curses.textpad.Textbox (patch by Stefan Wehr). +Also, fix an off-by-one bug in Textbox.gather(). + +.. + +.. bpo: 1831 +.. date: 6617 +.. nonce: nEy8wq +.. section: Library + +ctypes now raises a TypeError if conflicting positional and named arguments +are passed to a Structure or Union initializer. When too many positional +arguments are passed, also a TypeError is raised instead of a ValueError. + +.. + +.. bpo: 0 +.. date: 6616 +.. nonce: 2_XlvX +.. section: Library + +Convert the internal ctypes array type cache to a WeakValueDict so that +array types do not live longer than needed. + +.. + +.. bpo: 1786 +.. date: 6615 +.. nonce: glzSfE +.. section: Library + +pdb should use its own stdin/stdout around an exec call and when creating a +recursive instance. + +.. + +.. bpo: 1698398 +.. date: 6614 +.. nonce: yxfh1R +.. section: Library + +ZipFile.printdir() crashed because the format string expected a tuple type +of length six instead of time.struct_time object. + +.. + +.. bpo: 1780 +.. date: 6613 +.. nonce: PEqfgx +.. section: Library + +The Decimal constructor now accepts arbitrary leading and trailing +whitespace when constructing from a string. Context.create_decimal no longer +accepts trailing newlines. + +.. + +.. bpo: 0 +.. date: 6612 +.. nonce: e5MNna +.. section: Library + +Decimal.as_tuple(), difflib.find_longest_match() and inspect functions that +returned a tuple now return a named tuple. + +.. + +.. bpo: 0 +.. date: 6611 +.. nonce: r8_kX- +.. section: Library + +Doctest now returns results as a named tuple for readability: (0, 7) --> +TestResults(failed=0, attempted=7) + +.. + +.. bpo: 846388 +.. date: 6610 +.. nonce: h2AmOT +.. section: Library + +re.match is interruptible now, which is particularly good for long regular +expression matches. + +.. + +.. bpo: 1137 +.. date: 6609 +.. nonce: USs2NO +.. section: Library + +allow setting buffer_size attribute on pyexpat Parser objects to set the +character data buffer size. + +.. + +.. bpo: 1757 +.. date: 6608 +.. nonce: ZXonpG +.. section: Library + +The hash of a Decimal instance is no longer affected by the current context. + +.. + +.. bpo: 467924 +.. date: 6607 +.. nonce: VqzBRz +.. section: Library + +add ZipFile.extract() and ZipFile.extractall() in the zipfile module. + +.. + +.. bpo: 1646 +.. date: 6606 +.. nonce: 0Shvv6 +.. section: Library + +Make socket support the TIPC protocol. + +.. + +.. bpo: 1742 +.. date: 6605 +.. nonce: vdh5mh +.. section: Library + +return os.curdir from os.path.relpath() if both arguments are equal instead +of raising an exception. + +.. + +.. bpo: 1637 +.. date: 6604 +.. nonce: 9ck-BF +.. section: Library + +fix urlparse for URLs like 'http://x.com?arg=/foo'. + +.. + +.. bpo: 1698 +.. date: 6603 +.. nonce: KTC0EP +.. section: Library + +allow '@' in username parsed by urlparse.py. + +.. + +.. bpo: 1735 +.. date: 6602 +.. nonce: Xgf-_n +.. section: Library + +TarFile.extractall() now correctly sets directory permissions and times. + +.. + +.. bpo: 1713 +.. date: 6601 +.. nonce: SO4g7K +.. section: Library + +posixpath.ismount() claims symlink to a mountpoint is a mountpoint. + +.. + +.. bpo: 1687 +.. date: 6600 +.. nonce: qmmQ39 +.. section: Library + +Fxed plistlib.py restricts to Python int when writing + +.. + +.. bpo: 1700 +.. date: 6599 +.. nonce: u0StFP +.. section: Library + +Regular expression inline flags incorrectly handle certain unicode +characters. + +.. + +.. bpo: 1689 +.. date: 6598 +.. nonce: dx0XAO +.. section: Library + +PEP 3141, numeric abstract base classes. + +.. + +.. bpo: 0 +.. date: 6597 +.. nonce: BOT6AN +.. section: Library + +Tk issue #1851526: Return results from Python callbacks to Tcl as Tcl +objects. + +.. + +.. bpo: 1642 +.. date: 6596 +.. nonce: doGg1I +.. section: Library + +Fix segfault in ctypes when trying to delete attributes. + +.. + +.. bpo: 1727780 +.. date: 6595 +.. nonce: X0UJbf +.. section: Library + +Support loading pickles of random.Random objects created on 32-bit systems +on 64-bit systems, and vice versa. As a consequence of the change, Random +pickles created by Python 2.6 cannot be loaded in Python 2.5. + +.. + +.. bpo: 1455 +.. date: 6594 +.. nonce: qerPO1 +.. section: Library + +The distutils package now supports VS 2005 and VS 2008 for both the +msvccompiler and cygwincompiler. + +.. + +.. bpo: 1531 +.. date: 6593 +.. nonce: hM8cSV +.. section: Library + +tarfile.py: Read fileobj from the current offset, do not seek to the start. + +.. + +.. bpo: 1534 +.. date: 6592 +.. nonce: 2S_yfp +.. section: Library + +Added a dictionary sys.float_info with information about the internal +floating point type to the sys module. + +.. + +.. bpo: 1429818 +.. date: 6591 +.. nonce: f7q9_- +.. section: Library + +patch for trace and doctest modules so they play nicely together. + +.. + +.. bpo: 0 +.. date: 6590 +.. nonce: ydUJ45 +.. section: Library + +doctest made a bad assumption that a package's __loader__.get_data() method +used universal newlines. + +.. + +.. bpo: 1705170 +.. date: 6589 +.. nonce: 0iNdat +.. section: Library + +contextlib.contextmanager was still swallowing StopIteration in some cases. +This should no longer happen. + +.. + +.. bpo: 1292 +.. date: 6588 +.. nonce: kW3YuR +.. section: Library + +On alpha, arm, ppc, and s390 linux systems the --with-system-ffi configure +option defaults to "yes". + +.. + +.. bpo: 0 +.. date: 6587 +.. nonce: nGUzBY +.. section: Library + +IN module for FreeBSD 8 is added and preexisting FreeBSD 6 and 7 files are +updated. + +.. + +.. bpo: 1181 +.. date: 6586 +.. nonce: -eJDB_ +.. section: Library + +unsetenv() is now called when the os.environ.pop() and os.environ.clear() +methods are used. (See also: bpo-1287) + +.. + +.. bpo: 0 +.. date: 6585 +.. nonce: 76qRj0 +.. section: Library + +ctypes will now work correctly on 32-bit systems when Python is configured +with --with-system-ffi. + +.. + +.. bpo: 1203 +.. date: 6584 +.. nonce: MPohFL +.. section: Library + +ctypes now does work on OS X when Python is built with --disable-toolbox- +glue. + +.. + +.. bpo: 0 +.. date: 6583 +.. nonce: 4gk9jK +.. section: Library + +collections.deque() now supports a "maxlen" argument. + +.. + +.. bpo: 0 +.. date: 6582 +.. nonce: KEzbqu +.. section: Library + +itertools.count() is no longer bounded to LONG_MAX. Formerly, it raised an +OverflowError. Now, automatically shifts from ints to longs. + +.. + +.. bpo: 0 +.. date: 6581 +.. nonce: 8OaKab +.. section: Library + +Added itertools.product() which forms the Cartesian product of the input +iterables. + +.. + +.. bpo: 0 +.. date: 6580 +.. nonce: w2hxqg +.. section: Library + +Added itertools.combinations() and itertools.permutations(). + +.. + +.. bpo: 1541463 +.. date: 6579 +.. nonce: xGnI_Z +.. section: Library + +optimize performance of cgi.FieldStorage operations. + +.. + +.. bpo: 0 +.. date: 6578 +.. nonce: oJ3eSC +.. section: Library + +Decimal is fully updated to the latest Decimal Specification (v1.66). + +.. + +.. bpo: 1153 +.. date: 6577 +.. nonce: oxsMZ- +.. section: Library + +repr.repr() now doesn't require set and dictionary items to be orderable to +properly represent them. + +.. + +.. bpo: 0 +.. date: 6576 +.. nonce: 3NxHdM +.. section: Library + +A 'c_longdouble' type was added to the ctypes module. + +.. + +.. bpo: 1709599 +.. date: 6575 +.. nonce: ZInQo1 +.. section: Library + +Run test_1565150 only if the file system is NTFS. + +.. + +.. bpo: 0 +.. date: 6574 +.. nonce: dXPH7w +.. section: Library + +When encountering a password-protected robots.txt file the RobotFileParser +no longer prompts interactively for a username and password (bug 813986). + +.. + +.. bpo: 0 +.. date: 6573 +.. nonce: -jXdBx +.. section: Library + +TarFile.__init__() no longer fails if no name argument is passed and the +fileobj argument has no usable name attribute (e.g. StringIO). + +.. + +.. bpo: 0 +.. date: 6572 +.. nonce: OzvBf4 +.. section: Library + +The functools module now provides 'reduce', for forward compatibility with +Python 3000. + +.. + +.. bpo: 0 +.. date: 6571 +.. nonce: NBttxY +.. section: Library + +Server-side SSL support and cert verification added, by Bill Janssen. + +.. + +.. bpo: 0 +.. date: 6570 +.. nonce: fKSKr7 +.. section: Library + +socket.ssl deprecated; use new ssl module instead. + +.. + +.. bpo: 0 +.. date: 6569 +.. nonce: z663Ql +.. section: Library + +uuid creation is now threadsafe. + +.. + +.. bpo: 0 +.. date: 6568 +.. nonce: NGc_vS +.. section: Library + +EUC-KR codec now handles the cheot-ga-keut composed make-up hangul +syllables. + +.. + +.. bpo: 0 +.. date: 6567 +.. nonce: abpzUy +.. section: Library + +GB18030 codec now can encode additional two-byte characters that are missing +in GBK. + +.. + +.. bpo: 0 +.. date: 6566 +.. nonce: hoSWQ5 +.. section: Library + +Add new codecs for UTF-32, UTF-32-LE and UTF-32-BE. + +.. + +.. bpo: 1704793 +.. date: 6565 +.. nonce: o6G2FY +.. section: Library + +Return UTF-16 pair if unicodedata.lookup cannot represent the result in a +single character. + +.. + +.. bpo: 978833 +.. date: 6564 +.. nonce: nosP-g +.. section: Library + +Close https sockets by releasing the _ssl object. + +.. + +.. bpo: 0 +.. date: 6563 +.. nonce: Ha8_ga +.. section: Library + +Change location of the package index to pypi.python.org/pypi + +.. + +.. bpo: 1701409 +.. date: 6562 +.. nonce: x3Qs1t +.. section: Library + +Fix a segfault in printing ctypes.c_char_p and ctypes.c_wchar_p when they +point to an invalid location. As a sideeffect the representation of these +instances has changed. + +.. + +.. bpo: 0 +.. date: 6561 +.. nonce: QHd-OV +.. section: Library + +tarfile.py: Added "exclude" keyword argument to TarFile.add(). + +.. + +.. bpo: 1734723 +.. date: 6560 +.. nonce: zfdFr7 +.. section: Library + +Fix repr.Repr() so it doesn't ignore the maxtuple attribute. + +.. + +.. bpo: 0 +.. date: 6559 +.. nonce: A7KLfz +.. section: Library + +The urlopen function of urllib2 now has an optional timeout parameter (note +that it actually works with HTTP, HTTPS, FTP and FTPS connections). + +.. + +.. bpo: 0 +.. date: 6558 +.. nonce: mMxho- +.. section: Library + +In ftplib, the FTP.ntransfercmd method, when in passive mode, now uses the +socket.create_connection function, using the timeout specified at connection +time. + +.. + +.. bpo: 1728403 +.. date: 6557 +.. nonce: SusWve +.. section: Library + +Fix a bug that CJKCodecs StreamReader hangs when it reads a file that ends +with incomplete sequence and sizehint argument for .read() is specified. + +.. + +.. bpo: 1730389 +.. date: 6556 +.. nonce: WVvA-8 +.. section: Library + +Change time.strptime() to use ``\s+`` instead of ``\s*`` when matching +spaces in the specified format argument. + +.. + +.. bpo: 1668596 +.. date: 6555 +.. nonce: 5l2Qnk +.. section: Library + +distutils now copies data files even if package_dir is empty. (See also: +bpo-1720897) + +.. + +.. bpo: 0 +.. date: 6554 +.. nonce: jWDgV4 +.. section: Library + +sha now raises a DeprecationWarning upon import. + +.. + +.. bpo: 0 +.. date: 6553 +.. nonce: fepG9O +.. section: Library + +md5 now raises a DeprecationWarning upon import. + +.. + +.. bpo: 1385 +.. date: 6552 +.. nonce: pms34F +.. section: Library + +The hmac module now computes the correct hmac when using hashes with a block +size other than 64 bytes (such as sha384 and sha512). + +.. + +.. bpo: 0 +.. date: 6551 +.. nonce: soFpEB +.. section: Library + +mimify now raises a DeprecationWarning upon import. + +.. + +.. bpo: 0 +.. date: 6550 +.. nonce: eSD3F7 +.. section: Library + +MimeWriter now raises a DeprecationWarning upon import. + +.. + +.. bpo: 0 +.. date: 6549 +.. nonce: CQZoRW +.. section: Library + +tarfile.py: Improved unicode support. Unicode input names are now officially +supported. Added "errors" argument to the TarFile class. + +.. + +.. bpo: 0 +.. date: 6548 +.. nonce: NLgbaM +.. section: Library + +urllib.ftpwrapper class now accepts an optional timeout. + +.. + +.. bpo: 0 +.. date: 6547 +.. nonce: aRmxLC +.. section: Library + +shlex.split() now has an optional "posix" parameter. + +.. + +.. bpo: 0 +.. date: 6546 +.. nonce: 16HcrE +.. section: Library + +The posixfile module now raises a DeprecationWarning. + +.. + +.. bpo: 0 +.. date: 6545 +.. nonce: oUYKUV +.. section: Library + +Remove the gopherlib module. This also leads to the removal of gopher +support in urllib/urllib2. + +.. + +.. bpo: 0 +.. date: 6544 +.. nonce: NH6RAh +.. section: Library + +Fix bug in marshal where bad data would cause a segfault due to lack of an +infinite recursion check. + +.. + +.. bpo: 0 +.. date: 6543 +.. nonce: 9XHU1_ +.. section: Library + +Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in the +directories). + +.. + +.. bpo: 0 +.. date: 6542 +.. nonce: Sbs4OF +.. section: Library + +HTML-escape the plain traceback in cgitb's HTML output, to prevent the +traceback inadvertently or maliciously closing the comment and injecting +HTML into the error page. + +.. + +.. bpo: 0 +.. date: 6541 +.. nonce: fDPaFU +.. section: Library + +The popen2 module and os.popen* are deprecated. Use the subprocess module. + +.. + +.. bpo: 0 +.. date: 6540 +.. nonce: DiM9IG +.. section: Library + +Added an optional credentials argument to SMTPHandler, for use with SMTP +servers which require authentication. + +.. + +.. bpo: 1695948 +.. date: 6539 +.. nonce: Gkj_1M +.. section: Library + +Added optional timeout parameter to SocketHandler. + +.. + +.. bpo: 1652788 +.. date: 6538 +.. nonce: Wp3YON +.. section: Library + +Minor fix for currentframe. + +.. + +.. bpo: 1598415 +.. date: 6537 +.. nonce: z3zZwM +.. section: Library + +Added WatchedFileHandler to better support external log file rotation using +e.g. newsyslog or logrotate. This handler is only useful in Unix/Linux +environments. + +.. + +.. bpo: 1706381 +.. date: 6536 +.. nonce: LwHKFI +.. section: Library + +Specifying the SWIG option "-c++" in the setup.py file (as opposed to the +command line) will now write file names ending in ".cpp" too. + +.. + +.. bpo: 0 +.. date: 6535 +.. nonce: 960i58 +.. section: Library + +As specified in RFC 2616, an HTTP response like 2xx indicates that the +client's request was successfully received, understood, and accepted. Now +in these cases no error is raised in urllib (issue #1177) and urllib2. + +.. + +.. bpo: 1290505 +.. date: 6534 +.. nonce: bXfrzq +.. section: Library + +time.strptime's internal cache of locale information is now properly +recreated when the locale is changed. + +.. + +.. bpo: 1685563 +.. date: 6533 +.. nonce: ce_7tt +.. section: Library + +remove (don't add) duplicate paths in distutils.MSVCCompiler. + +.. + +.. bpo: 0 +.. date: 6532 +.. nonce: 0VS9AQ +.. section: Library + +Added a timeout parameter to the constructor of other protocols (telnetlib, +ftplib, smtplib and poplib). This is second part of the work started with +create_connection() and timeout in httplib, and closes patch #723312. + +.. + +.. bpo: 1676823 +.. date: 6531 +.. nonce: Ujlmqa +.. section: Library + +Added create_connection() to socket.py, which may be called with a timeout, +and use it from httplib (whose HTTPConnection and HTTPSConnection now accept +an optional timeout). + +.. + +.. bpo: 978833 +.. date: 6530 +.. nonce: zF4H2Y +.. section: Library + +Revert r50844, as it broke _socketobject.dup. + +.. + +.. bpo: 1675967 +.. date: 6529 +.. nonce: 1iw5U2 +.. section: Library + +re patterns pickled with Python 2.4 and earlier can now be unpickled with +Python 2.5 and newer. + +.. + +.. bpo: 1630118 +.. date: 6528 +.. nonce: eZiVxq +.. section: Library + +add a SpooledTemporaryFile class to tempfile.py. + +.. + +.. bpo: 1273829 +.. date: 6527 +.. nonce: mj4QNT +.. section: Library + +os.walk() now has a "followlinks" parameter. If set to True (which is not +the default), it visits symlinks pointing to directories. + +.. + +.. bpo: 1681228 +.. date: 6526 +.. nonce: 4MMQ01 +.. section: Library + +the webbrowser module now correctly uses the default GNOME or KDE browser, +depending on whether there is a session of one of those present. Also, it +tries the Windows default browser before trying Mozilla variants. + +.. + +.. bpo: 1339796 +.. date: 6525 +.. nonce: Nn-Kby +.. section: Library + +add a relpath() function to os.path. + +.. + +.. bpo: 1681153 +.. date: 6524 +.. nonce: fQELcx +.. section: Library + +the wave module now closes a file object it opened if initialization failed. + +.. + +.. bpo: 767111 +.. date: 6523 +.. nonce: C9lOY0 +.. section: Library + +fix long-standing bug in urllib which caused an AttributeError instead of an +IOError when the server's response didn't contain a valid HTTP status line. + +.. + +.. bpo: 957650 +.. date: 6522 +.. nonce: 2j9cb4 +.. section: Library + +"%var%" environment variable references are now properly expanded in +ntpath.expandvars(), also "~user" home directory references are recognized +and handled on Windows. + +.. + +.. bpo: 1429539 +.. date: 6521 +.. nonce: _VYWyV +.. section: Library + +pdb now correctly initializes the __main__ module for the debugged script, +which means that imports from __main__ work correctly now. + +.. + +.. bpo: 0 +.. date: 6520 +.. nonce: 8oczdW +.. section: Library + +The nonobvious commands.getstatus() function is now deprecated. + +.. + +.. bpo: 1393667 +.. date: 6519 +.. nonce: qba-ui +.. section: Library + +pdb now has a "run" command which restarts the debugged Python program, +optionally with different arguments. + +.. + +.. bpo: 1649190 +.. date: 6518 +.. nonce: WRBz2d +.. section: Library + +Adding support for _Bool to ctypes as c_bool. + +.. + +.. bpo: 1530482 +.. date: 6517 +.. nonce: 1HDrw- +.. section: Library + +add pydoc.render_doc() which returns the documentation for a thing instead +of paging it to stdout, which pydoc.doc() does. + +.. + +.. bpo: 1533909 +.. date: 6516 +.. nonce: I3IRRD +.. section: Library + +the timeit module now accepts callables in addition to strings for the code +to time and the setup code. Also added two convenience functions for +instantiating a Timer and calling its methods. + +.. + +.. bpo: 1537850 +.. date: 6515 +.. nonce: mojZP- +.. section: Library + +tempfile.NamedTemporaryFile now has a "delete" parameter which can be set to +False to prevent the default delete-on-close behavior. + +.. + +.. bpo: 1581073 +.. date: 6514 +.. nonce: Im5bIV +.. section: Library + +add a flag to textwrap that prevents the dropping of whitespace while +wrapping. + +.. + +.. bpo: 1603688 +.. date: 6513 +.. nonce: Mv_jlM +.. section: Library + +ConfigParser.SafeConfigParser now checks values that are set for invalid +interpolation sequences that would lead to errors on reading back those +values. + +.. + +.. bpo: 0 +.. date: 6512 +.. nonce: ZYo06p +.. section: Library + +Added support for the POSIX.1-2001 (pax) format to tarfile.py. Extended and +cleaned up the test suite. Added a new testtar.tar. + +.. + +.. bpo: 1449244 +.. date: 6511 +.. nonce: uHkKjk +.. section: Library + +Support Unicode strings in +email.message.Message.{set_charset,get_content_charset}. + +.. + +.. bpo: 1542681 +.. date: 6510 +.. nonce: 5y5uCV +.. section: Library + +add entries for "with", "as" and "CONTEXTMANAGERS" to pydoc's help keywords. + +.. + +.. bpo: 1555098 +.. date: 6509 +.. nonce: mO79lM +.. section: Library + +use str.join() instead of repeated string concatenation in robotparser. + +.. + +.. bpo: 1635454 +.. date: 6508 +.. nonce: 8Gv5Ek +.. section: Library + +the csv.DictWriter class now includes the offending field names in its +exception message if you try to write a record with a dictionary containing +fields not in the CSV field names list. + +.. + +.. bpo: 1668100 +.. date: 6507 +.. nonce: BfAU9i +.. section: Library + +urllib2 now correctly raises URLError instead of OSError if accessing a +local file via the file:// protocol fails. + +.. + +.. bpo: 1677862 +.. date: 6506 +.. nonce: YuXNs6 +.. section: Library + +Require a space or tab after import in .pth files. + +.. + +.. bpo: 1192590 +.. date: 6505 +.. nonce: d2uMgi +.. section: Library + +Fix pdb's "ignore" and "condition" commands so they trap the IndexError +caused by passing in an invalid breakpoint number. + +.. + +.. bpo: 1599845 +.. date: 6504 +.. nonce: 9zhNQX +.. section: Library + +Add an option to disable the implicit calls to server_bind() and +server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and +DocXMLRPCServer. + +.. + +.. bpo: 1531963 +.. date: 6503 +.. nonce: p5GJcu +.. section: Library + +Make SocketServer.TCPServer's server_address always be equal to calling +getsockname() on the server's socket. Fixed by patch #1545011. + +.. + +.. bpo: 742598 +.. date: 6502 +.. nonce: -50Nso +.. section: Library + +Add .timeout attribute to SocketServer that calls .handle_timeout() when no +requests are received. + +.. + +.. bpo: 1651235 +.. date: 6501 +.. nonce: cY8CV7 +.. section: Library + +When a tuple was passed to a ctypes function call, Python would crash +instead of raising an error. + +.. + +.. bpo: 1646630 +.. date: 6500 +.. nonce: rkS7gc +.. section: Library + +ctypes.string_at(buf, 0) and ctypes.wstring_at(buf, 0) returned string up to +the first NUL character. + +.. + +.. bpo: 957003 +.. date: 6499 +.. nonce: SskRob +.. section: Library + +Implement smtplib.LMTP. + +.. + +.. bpo: 1481079 +.. date: 6498 +.. nonce: gEYAkC +.. section: Library + +add support for HTTP_REFERER to CGIHTTPServer. + +.. + +.. bpo: 1675424 +.. date: 6497 +.. nonce: 8A9fwo +.. section: Library + +Added tests for uncovered code in the zipfile module. The KeyError raised +by Zipfile.getinfo for nonexistent names now has a descriptive message. + +.. + +.. bpo: 1115886 +.. date: 6496 +.. nonce: Q-42A9 +.. section: Library + +os.path.splitext('.cshrc') gives now ('.cshrc', ''). + +.. + +.. bpo: 0 +.. date: 6495 +.. nonce: wlVTpz +.. section: Library + +unittest now verifies more of its assumptions. In particular, TestCase and +TestSuite subclasses (not instances) are no longer accepted in +TestSuite.addTest(). This should cause no incompatibility since it never +made sense with ordinary subclasses -- the failure just occurred later, with +a more cumbersome exception. + +.. + +.. bpo: 787789 +.. date: 6494 +.. nonce: jzIMu8 +.. section: Library + +allow passing custom TestRunner instances to unittest's main() function. + +.. + +.. bpo: 1550273 +.. date: 6493 +.. nonce: Ra8QUZ +.. section: Library + +fix a few bugs in unittest and add a comprehensive test suite for the +module. (See also: bpo-1550272) + +.. + +.. bpo: 1001604 +.. date: 6492 +.. nonce: Vdqhuq +.. section: Library + +glob.glob() now returns unicode filenames if it was given a unicode argument +and os.listdir() returns unicode filenames. + +.. + +.. bpo: 1673619 +.. date: 6491 +.. nonce: j16YPr +.. section: Library + +setup.py identifies extension modules it doesn't know how to build and those +it knows how to build but that fail to build. + +.. + +.. bpo: 912410 +.. date: 6490 +.. nonce: mh0cGH +.. section: Library + +Replace HTML entity references for attribute values in HTMLParser. + +.. + +.. bpo: 1663234 +.. date: 6489 +.. nonce: YZlp53 +.. section: Library + +you can now run doctest on test files and modules using "python -m doctest +[-v] filename ...". + +.. + +.. bpo: 1121142 +.. date: 6488 +.. nonce: EulpqL +.. section: Library + +Implement ZipFile.open. + +.. + +.. bpo: 0 +.. date: 6487 +.. nonce: jimAik +.. section: Library + +Taught setup.py how to locate Berkeley DB on Macs using MacPorts. + +.. + +.. bpo: 0 +.. date: 6486 +.. nonce: qbUsHo +.. section: Library + +Added heapq.merge() for merging sorted input streams. + +.. + +.. bpo: 0 +.. date: 6485 +.. nonce: c69oKw +.. section: Library + +Added collections.namedtuple() for assigning field names to tuples. + +.. + +.. bpo: 0 +.. date: 6484 +.. nonce: 5y6Y9N +.. section: Library + +Added itertools.izip_longest(). + +.. + +.. bpo: 0 +.. date: 6483 +.. nonce: VzsTJi +.. section: Library + +Have the encoding package's search function dynamically import using +absolute import semantics. + +.. + +.. bpo: 1647484 +.. date: 6482 +.. nonce: FkN5SP +.. section: Library + +Renamed GzipFile's filename attribute to name. + +.. + +.. bpo: 1517891 +.. date: 6481 +.. nonce: AvYw8j +.. section: Library + +Mode 'a' for ZipFile now creates the file if it doesn't exist. + +.. + +.. bpo: 698833 +.. date: 6480 +.. nonce: UagENp +.. section: Library + +Support file decryption in zipfile. + +.. + +.. bpo: 685268 +.. date: 6479 +.. nonce: j7gRo3 +.. section: Library + +Consider a package's __path__ in imputil. + +.. + +.. bpo: 1463026 +.. date: 6478 +.. nonce: _0rmmb +.. section: Library + +Support default namespace in XMLGenerator. + +.. + +.. bpo: 1571379 +.. date: 6477 +.. nonce: TLNfnP +.. section: Library + +Make trace's --ignore-dir facility work in the face of relative directory +names. + +.. + +.. bpo: 1600860 +.. date: 6476 +.. nonce: gY3F66 +.. section: Library + +Search for shared python library in LIBDIR, not lib/python/config, on +"linux" and "gnu" systems. + +.. + +.. bpo: 1652681 +.. date: 6475 +.. nonce: ZiYQdm +.. section: Library + +tarfile.py: create nonexistent files in append mode and allow appending to +empty files. + +.. + +.. bpo: 1124861 +.. date: 6474 +.. nonce: aulyJj +.. section: Library + +Automatically create pipes if GetStdHandle fails in subprocess. + +.. + +.. bpo: 1634778 +.. date: 6473 +.. nonce: pScHLI +.. section: Library + +add missing encoding aliases for iso8859_15 and iso8859_16. + +.. + +.. bpo: 1638243 +.. date: 6472 +.. nonce: SAVlQC +.. section: Library + +the compiler package is now able to correctly compile a with statement; +previously, executing code containing a with statement compiled by the +compiler package crashed the interpreter. + +.. + +.. bpo: 1643943 +.. date: 6471 +.. nonce: a4nxv3 +.. section: Library + +Fix time.strptime's support for the %U directive. + +.. + +.. bpo: 1507247 +.. date: 6470 +.. nonce: AYqRTm +.. section: Library + +tarfile.py: use current umask for intermediate directories. + +.. + +.. bpo: 1627441 +.. date: 6469 +.. nonce: nTrbqY +.. section: Library + +close sockets properly in urllib2. + +.. + +.. bpo: 494589 +.. date: 6468 +.. nonce: 2kCbNY +.. section: Library + +make ntpath.expandvars behave according to its docstring. + +.. + +.. bpo: 0 +.. date: 6467 +.. nonce: ezpU0D +.. section: Library + +Changed platform module API python_version_tuple() to actually return a +tuple (it used to return a list). + +.. + +.. bpo: 0 +.. date: 6466 +.. nonce: 2-kVtg +.. section: Library + +Added new platform module APIs python_branch(), python_revision(), +python_implementation() and linux_distribution(). + +.. + +.. bpo: 0 +.. date: 6465 +.. nonce: qzrIXP +.. section: Library + +Added support for IronPython and Jython to the platform module. + +.. + +.. bpo: 0 +.. date: 6464 +.. nonce: MS8C3z +.. section: Library + +The sets module has been deprecated. Use the built-in set/frozenset types +instead. + +.. + +.. bpo: 1610795 +.. date: 6463 +.. nonce: FEIux6 +.. section: Library + +make ctypes.util.find_library work on BSD systems. + +.. + +.. bpo: 0 +.. date: 6462 +.. nonce: rfv0pM +.. section: Library + +Fixes for 64-bit Windows: In ctypes.wintypes, correct the definitions of +HANDLE, WPARAM, LPARAM data types. Make parameterless foreign function +calls work. + +.. + +.. bpo: 0 +.. date: 6461 +.. nonce: iCu2EB +.. section: Library + +The version number of the ctypes package changed to "1.1.0". + +.. + +.. bpo: 1627575 +.. date: 6460 +.. nonce: ekqcHu +.. section: Library + +logging: Added _open() method to FileHandler which can be used to reopen +files. The FileHandler instance now saves the encoding (which can be None) +in an attribute called "encoding". + +.. + +.. bpo: 411881 +.. date: 6459 +.. nonce: SdPBJS +.. section: Library + +logging.handlers: bare except clause removed from SMTPHandler.emit. Now, +only ImportError is trapped. + +.. + +.. bpo: 411881 +.. date: 6458 +.. nonce: Hui5Li +.. section: Library + +logging.handlers: bare except clause removed from +SocketHandler.createSocket. Now, only socket.error is trapped. + +.. + +.. bpo: 411881 +.. date: 6457 +.. nonce: EB2bof +.. section: Library + +logging: bare except clause removed from LogRecord.__init__. Now, only +ValueError, TypeError and AttributeError are trapped. + +.. + +.. bpo: 1504073 +.. date: 6456 +.. nonce: i48FvZ +.. section: Library + +Fix tarfile.open() for mode "r" with a fileobj argument. + +.. + +.. bpo: 1182394 +.. date: 6455 +.. nonce: oDRBxu +.. section: Library + +Speed up ``HMAC.hexdigest``. (Patch by Shane Holloway.) + +.. + +.. bpo: 1262036 +.. date: 6454 +.. nonce: 1Y1xgB +.. section: Library + +Prevent TarFiles from being added to themselves under certain conditions. + +.. + +.. bpo: 1230446 +.. date: 6453 +.. nonce: OwOxzM +.. section: Library + +tarfile.py: fix ExFileObject so that read() and tell() work correctly +together with readline(). + +.. + +.. bpo: 1484695 +.. date: 6452 +.. nonce: kbpUdY +.. section: Library + +The tarfile module now raises a HeaderError exception if a buffer given to +frombuf() is invalid. + +.. + +.. bpo: 1503765 +.. date: 6451 +.. nonce: N5UCHi +.. section: Library + +Fix a problem in logging.config with spaces in comma- separated lists read +from logging config files. + +.. + +.. bpo: 1604907 +.. date: 6450 +.. nonce: AXQii8 +.. section: Library + +Fix problems in logging.handlers caused at logging shutdown when syslog +handlers fail to initialize because of syslogd problems. + +.. + +.. bpo: 1608267 +.. date: 6449 +.. nonce: ldcDih +.. section: Library + +fix a race condition in os.makedirs() if the directory to be created is +already there. + +.. + +.. bpo: 1610437 +.. date: 6448 +.. nonce: pXPK4x +.. section: Library + +fix a tarfile bug with long filename headers. + +.. + +.. bpo: 1371075 +.. date: 6447 +.. nonce: NE7BY3 +.. section: Library + +Make ConfigParser accept optional dict type for ordering, sorting, etc. + +.. + +.. bpo: 1563807 +.. date: 6446 +.. nonce: r5ah8b +.. section: Library + +_ctypes built on AIX fails with ld ffi error. + +.. + +.. bpo: 1598620 +.. date: 6445 +.. nonce: jHuKUn +.. section: Library + +A ctypes Structure cannot contain itself. + +.. + +.. bpo: 1070046 +.. date: 6444 +.. nonce: E13xc_ +.. section: Library + +Marshal new-style objects like InstanceType in xmlrpclib. + +.. + +.. bpo: 0 +.. date: 6443 +.. nonce: P-fEXH +.. section: Library + +cStringIO.truncate(-1) now raises an IOError, like StringIO and regular +files. + +.. + +.. bpo: 1472877 +.. date: 6442 +.. nonce: qL083L +.. section: Library + +Fix Tix subwidget name resolution. + +.. + +.. bpo: 1594554 +.. date: 6441 +.. nonce: SqL3iT +.. section: Library + +Always close a tkSimpleDialog on ok(), even if an exception occurs. + +.. + +.. bpo: 1538878 +.. date: 6440 +.. nonce: m2hjNu +.. section: Library + +Don't make tkSimpleDialog dialogs transient if the parent window is +withdrawn. + +.. + +.. bpo: 1597824 +.. date: 6439 +.. nonce: ORR2oo +.. section: Library + +return the registered function from atexit.register() to facilitate usage as +a decorator. + +.. + +.. bpo: 1360200 +.. date: 6438 +.. nonce: 2ymI3x +.. section: Library + +Use unmangled_version RPM spec field to deal with file name mangling. + +.. + +.. bpo: 1359217 +.. date: 6437 +.. nonce: RlkDVQ +.. section: Library + +Process 2xx response in an ftplib transfer that precedes an 1xx response. + +.. + +.. bpo: 1355023 +.. date: 6436 +.. nonce: gz3jFH +.. section: Library + +support whence argument for GzipFile.seek. + +.. + +.. bpo: 1065257 +.. date: 6435 +.. nonce: dzuo9U +.. section: Library + +Support passing open files as body in HTTPConnection.request(). + +.. + +.. bpo: 1569790 +.. date: 6434 +.. nonce: XNZtnX +.. section: Library + +mailbox.py: Maildir.get_folder() and MH.get_folder() weren't passing the +message factory on to newly created Maildir/MH objects. + +.. + +.. bpo: 1514543 +.. date: 6433 +.. nonce: JxSqun +.. section: Library + +mailbox.py: In the Maildir class, report errors if there's a filename clash +instead of possibly losing a message. (Patch by David Watson.) + +.. + +.. bpo: 1514544 +.. date: 6432 +.. nonce: nfmx-- +.. section: Library + +Try to ensure that messages/indexes have been physically written to disk +after calling .flush() or .close(). (Patch by David Watson.) + +.. + +.. bpo: 1592250 +.. date: 6431 +.. nonce: cErfyc +.. section: Library + +Add elide argument to Tkinter.Text.search. + +.. + +.. bpo: 838546 +.. date: 6430 +.. nonce: yBohhh +.. section: Library + +Make terminal become controlling in pty.fork(). + +.. + +.. bpo: 1351744 +.. date: 6429 +.. nonce: a4x3Q4 +.. section: Library + +Add askyesnocancel helper for tkMessageBox. + +.. + +.. bpo: 1060577 +.. date: 6428 +.. nonce: 7Hpowm +.. section: Library + +Extract list of RPM files from spec file in bdist_rpm. + +.. + +.. bpo: 1586613 +.. date: 6427 +.. nonce: pIXli0 +.. section: Library + +fix zlib and bz2 codecs' incremental en/decoders. + +.. + +.. bpo: 1583880 +.. date: 6426 +.. nonce: nwiLAW +.. section: Library + +fix tarfile's problems with long names and posix/ GNU modes. + +.. + +.. bpo: 1586448 +.. date: 6425 +.. nonce: FmFoc_ +.. section: Library + +the compiler module now emits the same bytecode for list comprehensions as +the built-in compiler, using the LIST_APPEND opcode. + +.. + +.. bpo: 0 +.. date: 6424 +.. nonce: 2gBgWG +.. section: Library + +Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all +codecs file wrappers to work correctly with the "with" statement (bug +#1586513). + +.. + +.. bpo: 0 +.. date: 6423 +.. nonce: zvhpow +.. section: Library + +Lib/modulefinder.py now handles absolute and relative imports correctly. + +.. + +.. bpo: 1567274 +.. date: 6422 +.. nonce: LA_DH5 +.. section: Library + +Support SMTP over TLS. + +.. + +.. bpo: 1560695 +.. date: 6421 +.. nonce: kVpjpW +.. section: Library + +Add .note.GNU-stack to ctypes' sysv.S so that ctypes isn't considered as +requiring executable stacks. + +.. + +.. bpo: 0 +.. date: 6420 +.. nonce: fKDGbU +.. section: Library + +ctypes callback functions only support 'fundamental' data types as result +type. Raise an error when something else is used. This is a partial fix +for Bug #1574584. + +.. + +.. bpo: 0 +.. date: 6419 +.. nonce: yLdVeX +.. section: Library + +Fix turtle so that time.sleep is imported for the entire library. Allows the +demo2 function to be executed on its own instead of only when the module is +run as a script. + +.. + +.. bpo: 1565150 +.. date: 6418 +.. nonce: DJh_i- +.. section: Library + +Fix subsecond processing for os.utime on Windows. + +.. + +.. bpo: 0 +.. date: 6417 +.. nonce: p_gre9 +.. section: Library + +Support for MSVC 8 was added to bdist_wininst. + +.. + +.. bpo: 1446043 +.. date: 6416 +.. nonce: yKz_Q4 +.. section: Library + +correctly raise a LookupError if an encoding name given to +encodings.search_function() contains a dot. + +.. + +.. bpo: 1560617 +.. date: 6415 +.. nonce: aAisSJ +.. section: Library + +in pyclbr, return full module name not only for classes, but also for +functions. + +.. + +.. bpo: 1457823 +.. date: 6414 +.. nonce: CRxLz4 +.. section: Library + +cgi.(Sv)FormContentDict's constructor now takes keep_blank_values and +strict_parsing keyword arguments. + +.. + +.. bpo: 1566602 +.. date: 6413 +.. nonce: bB3CAB +.. section: Library + +correct failure of posixpath unittest when $HOME ends with a slash. + +.. + +.. bpo: 1565661 +.. date: 6412 +.. nonce: AP25Qm +.. section: Library + +in webbrowser, split() the command for the default GNOME browser in case it +is a command with args. + +.. + +.. bpo: 0 +.. date: 6411 +.. nonce: DZkwqI +.. section: Library + +Made the error message for time.strptime when the data and format do match +be more clear. + +.. + +.. bpo: 0 +.. date: 6410 +.. nonce: 7duvEn +.. section: Library + +Fix a bug in traceback.format_exception_only() that led to an error being +raised when print_exc() was called without an exception set. In version 2.4, +this printed "None", restored that behavior. + +.. + +.. bpo: 0 +.. date: 6409 +.. nonce: 709mp_ +.. section: Library + +Make webbrowser.BackgroundBrowser usable in Windows (it wasn't because the +close_fds arg to subprocess.Popen is not supported). + +.. + +.. bpo: 1504333 +.. date: 6408 +.. nonce: y46ekU +.. section: Library + +Reverted change to sgmllib because it introduced an infinite loop. + +.. + +.. bpo: 1553314 +.. date: 6407 +.. nonce: RCumD0 +.. section: Library + +Fix the inspect.py slowdown that was hurting IPython & SAGE by adding +smarter caching in inspect.getmodule() + +.. + +.. bpo: 0 +.. date: 6406 +.. nonce: 6I6WXA +.. section: Library + +Fix missing import of the types module in logging.config. + +.. + +.. bpo: 1550886 +.. date: 6405 +.. nonce: DuV8q5 +.. section: Library + +Fix decimal module context management implementation to match the +localcontext() example from PEP 343. + +.. + +.. bpo: 1545341 +.. date: 6404 +.. nonce: EaLhZZ +.. section: Library + +The 'classifier' keyword argument to the Distutils setup() function now +accepts tuples as well as lists. + +.. + +.. bpo: 1541863 +.. date: 6403 +.. nonce: HUh40x +.. section: Library + +uuid.uuid1 failed to generate unique identifiers on systems with low clock +resolution. + +.. + +.. bpo: 1531862 +.. date: 6402 +.. nonce: yyYfx5 +.. section: Library + +Do not close standard file descriptors in subprocess. + +.. + +.. bpo: 0 +.. date: 6401 +.. nonce: lISaKl +.. section: Library + +Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the +first chunk fed to the decoder started with a BOM, but was longer than 3 +bytes. + +.. + +.. bpo: 0 +.. date: 6400 +.. nonce: RFXvgt +.. section: Library + +The implementation of UnicodeError objects has been simplified (start and +end attributes are now stored directly as Py_ssize_t members). + +.. + +.. bpo: 829951 +.. date: 6399 +.. nonce: v5y-W2 +.. section: Library + +In the smtplib module, SMTP.starttls() now complies with RFC 3207 and +forgets any knowledge obtained from the server not obtained from the TLS +negotiation itself. Patch contributed by Bill Fenner. + +.. + +.. bpo: 1339 +.. date: 6398 +.. nonce: zNAkVN +.. section: Library + +The smtplib.SMTP class has been refactored a bit such that the +SMTP.starttls() caller no longer needs to call ehlo() beforehand. +SMTP.starttls() now raises an exception of the server does not claim to +support starttls. Adds the SMTP.ehlo_or_helo_if_needed() method. Patch +contributed by Bill Fenner. + +.. + +.. bpo: 1089358 +.. date: 6397 +.. nonce: 91PLbW +.. section: Library + +Add signal.siginterrupt, a wrapper around siginterrupt(3). + +.. + +.. bpo: 1657 +.. date: 6396 +.. nonce: KEujtl +.. section: Library + +added select.epoll and select.kqueue. + +.. + +.. bpo: 1506171 +.. date: 6395 +.. nonce: h2Yotv +.. section: Library + +added operator.methodcaller(). + +.. + +.. bpo: 1826 +.. date: 6394 +.. nonce: P9qpop +.. section: Library + +operator.attrgetter() now supports dotted attribute paths. + +.. + +.. bpo: 1957 +.. date: 6393 +.. nonce: oQ_zDG +.. section: Library + +syslogmodule: Release GIL when calling syslog(3). + +.. + +.. bpo: 2112 +.. date: 6392 +.. nonce: CfSrtY +.. section: Library + +mmap.error is now a subclass of EnvironmentError and not a direct +EnvironmentError. + +.. + +.. bpo: 2111 +.. date: 6391 +.. nonce: nUPHdZ +.. section: Library + +mmap segfaults when trying to write a block opened with PROT_READ. + +.. + +.. bpo: 2063 +.. date: 6390 +.. nonce: -AQbR3 +.. section: Library + +correct order of utime and stime in os.times() result on Windows. + +.. + +.. bpo: 1736 +.. date: 6389 +.. nonce: Ag5pGB +.. section: Library + +Fix file name handling of _msi.FCICreate. + +.. + +.. bpo: 0 +.. date: 6388 +.. nonce: zNsGmS +.. section: Library + +Updated ``big5hkscs`` codec to the HKSCS revision of 2004. + +.. + +.. bpo: 1940 +.. date: 6387 +.. nonce: VTj9uW +.. section: Library + +make it possible to use curses.filter() before curses.initscr() as the +documentation says. + +.. + +.. bpo: 0 +.. date: 6386 +.. nonce: J1VXc3 +.. section: Library + +Backport of _fileio module from Python 3.0. + +.. + +.. bpo: 1087741 +.. date: 6385 +.. nonce: pcDAZm +.. section: Library + +mmap.mmap is now a class, not a factory function. It is also subclassable +now. + +.. + +.. bpo: 1648 +.. date: 6384 +.. nonce: 1C5JXG +.. section: Library + +added ``sys.getprofile()`` and ``sys.gettrace()``. + +.. + +.. bpo: 1663329 +.. date: 6383 +.. nonce: m0g8vu +.. section: Library + +added ``os.closerange()`` function to quickly close a range of file +descriptors without considering errors. + +.. + +.. bpo: 976880 +.. date: 6382 +.. nonce: R51uQk +.. section: Library + +``mmap`` objects now have an ``rfind`` method that works as expected. +``mmap.find`` also takes an optional ``end`` parameter. + +.. + +.. bpo: 0 +.. date: 6381 +.. nonce: wrGXou +.. section: Library + +_winreg's HKEY object has gained __enter__ and __exit__ methods to support +the context management protocol. The _winreg module also gained a new +function ``ExpandEnvironmentStrings`` to expand REG_EXPAND_SZ keys. + +.. + +.. bpo: 0 +.. date: 6380 +.. nonce: ke0PK4 +.. section: Library + +itertools.starmap() now accepts any iterable input. Previously, it required +the function inputs to be tuples. + +.. + +.. bpo: 0 +.. date: 6379 +.. nonce: JNKKZ8 +.. section: Library + +itertools.chain() now has an alternate constructor, chain.from_iterable(). + +.. + +.. bpo: 1646 +.. date: 6378 +.. nonce: DqQiG7 +.. section: Library + +Make socket support TIPC. The socket module now has support for TIPC under +Linux, see http://tipc.sf.net/ for more information. + +.. + +.. bpo: 0 +.. date: 6377 +.. nonce: YrJhGa +.. section: Library + +Added interface for Windows' WSAIoctl to socket object and added an example +for a simple network sniffer. + +.. + +.. bpo: 1301 +.. date: 6376 +.. nonce: w3N8In +.. section: Library + +Bad assert in _tkinter fixed. + +.. + +.. bpo: 0 +.. date: 6375 +.. nonce: 1zmfDo +.. section: Library + +Added bdist_wininst executable for VS 2008. + +.. + +.. bpo: 1604 +.. date: 6374 +.. nonce: d3HHRR +.. section: Library + +collections.deque.__init__(iterable) now clears any prior contents before +adding elements from the iterable. This fix brings the behavior into line +with that for list.__init__(). + +.. + +.. bpo: 0 +.. date: 6373 +.. nonce: hHIPo7 +.. section: Library + +Added wide char functions to msvcrt module: getwch, getwche, putwch and +ungetwch. The functions accept or return unicode. + +.. + +.. bpo: 0 +.. date: 6372 +.. nonce: OFK-oY +.. section: Library + +os.access now returns True on Windows for any existing directory. + +.. + +.. bpo: 0 +.. date: 6371 +.. nonce: vDe3M3 +.. section: Library + +Added warnpy3k function to the warnings module. + +.. + +.. bpo: 0 +.. date: 6370 +.. nonce: brR3xl +.. section: Library + +Marshal.dumps() now expects exact type matches for int, long, float, +complex, tuple, list, dict, set, and frozenset. Formerly, it would silently +miscode subclasses of those types. Now, it raises a ValueError instead. + +.. + +.. bpo: 1388440 +.. date: 6369 +.. nonce: L0q4gk +.. section: Library + +Add set_completion_display_matches_hook and get_completion_type to readline. + +.. + +.. bpo: 1649098 +.. date: 6368 +.. nonce: ahOvw- +.. section: Library + +Avoid declaration of zero-sized array declaration in structure. + +.. + +.. bpo: 0 +.. date: 6367 +.. nonce: -gsoXT +.. section: Library + +Removed the rgbimg module; been deprecated since Python 2.5. + +.. + +.. bpo: 1721309 +.. date: 6366 +.. nonce: Xm2Y60 +.. section: Library + +prevent bsddb module from freeing random memory. + +.. + +.. bpo: 1233 +.. date: 6365 +.. nonce: 85-yC3 +.. section: Library + +fix bsddb.dbshelve.DBShelf append method to work as intended for RECNO +databases. + +.. + +.. bpo: 0 +.. date: 6364 +.. nonce: P617AK +.. section: Library + +pybsddb.sf.net Bug #477182: Load the database flags at database open time so +that opening a database previously created with the DB_DUP or DB_DUPSORT +flag set will keep the proper behavior on subsequent opens. Specifically: +dictionary assignment to a DB object will replace all values for a given key +when the database allows duplicate values. DB users should use DB.put(k, v) +when they want to store duplicates; not DB[k] = v. + +.. + +.. bpo: 0 +.. date: 6363 +.. nonce: 5NHGNc +.. section: Library + +Add the bsddb.db.DBEnv.lock_id_free method. + +.. + +.. bpo: 1686475 +.. date: 6362 +.. nonce: gwpzpq +.. section: Library + +Support stat'ing open files on Windows again. + +.. + +.. bpo: 1185447 +.. date: 6361 +.. nonce: 4SdEiu +.. section: Library + +binascii.b2a_qp() now correctly quotes binary characters with ASCII value +less than 32. Also, it correctly quotes dots only if they occur on a single +line, as opposed to the previous behavior of quoting dots if they are the +second character of any line. + +.. + +.. bpo: 1622896 +.. date: 6360 +.. nonce: 4WbmkO +.. section: Library + +fix a rare corner case where the bz2 module raised an error in spite of a +succesful compression. + +.. + +.. bpo: 1654417 +.. date: 6359 +.. nonce: H1p2ET +.. section: Library + +make operator.{get,set,del}slice use the full range of Py_ssize_t. + +.. + +.. bpo: 1646728 +.. date: 6358 +.. nonce: qkvzER +.. section: Library + +datetime.fromtimestamp fails with negative fractional times. With unittest. + +.. + +.. bpo: 1490190 +.. date: 6357 +.. nonce: n7enEK +.. section: Library + +posixmodule now includes os.chflags() and os.lchflags() functions on +platforms where the underlying system calls are available. + +.. + +.. bpo: 1494140 +.. date: 6356 +.. nonce: --CKWP +.. section: Library + +Add documentation for the new struct.Struct object. + +.. + +.. bpo: 1432399 +.. date: 6355 +.. nonce: uVk0JY +.. section: Library + +Support the HCI protocol for bluetooth sockets + +.. + +.. bpo: 1657276 +.. date: 6354 +.. nonce: fcUdLm +.. section: Library + +Make NETLINK_DNRTMSG conditional. + +.. + +.. bpo: 1653736 +.. date: 6353 +.. nonce: tNuUq7 +.. section: Library + +Complain about keyword arguments to time.isoformat. + +.. + +.. bpo: 1486663 +.. date: 6352 +.. nonce: sR35oQ +.. section: Library + +don't reject keyword arguments for subclasses of built-in types. + +.. + +.. bpo: 1610575 +.. date: 6351 +.. nonce: xC0F2x +.. section: Library + +The struct module now supports the 't' code, for C99 _Bool. + +.. + +.. bpo: 1635058 +.. date: 6350 +.. nonce: 1H4WNl +.. section: Library + +ensure that htonl and friends never accept or return negative numbers, per +the underlying C implementation. + +.. + +.. bpo: 1544279 +.. date: 6349 +.. nonce: oS9QmK +.. section: Library + +Improve thread-safety of the socket module by moving the sock_addr_t storage +out of the socket object. + +.. + +.. bpo: 1019808 +.. date: 6348 +.. nonce: WZeJ5G +.. section: Library + +fix bug that causes an incorrect error to be returned when a socket timeout +is set and a connection attempt fails. + +.. + +.. bpo: 0 +.. date: 6347 +.. nonce: yggQVa +.. section: Library + +Speed up function calls into the math module. + +.. + +.. bpo: 1588217 +.. date: 6346 +.. nonce: CZ-jdO +.. section: Library + +don't parse "= " as a soft line break in binascii's a2b_qp() function, +instead leave it in the string as quopri.decode() does. + +.. + +.. bpo: 1599782 +.. date: 6345 +.. nonce: nZV6k1 +.. section: Library + +Fix segfault on bsddb.db.DB().type(). + +.. + +.. bpo: 1567666 +.. date: 6344 +.. nonce: Yy8nbf +.. section: Library + +Emulate GetFileAttributesExA for Win95. + +.. + +.. bpo: 1576166 +.. date: 6343 +.. nonce: uPuEL3 +.. section: Library + +Support os.utime for directories on Windows NT+. + +.. + +.. bpo: 1572724 +.. date: 6342 +.. nonce: AS17ot +.. section: Library + +fix typo ('=' instead of '==') in _msi.c. + +.. + +.. bpo: 1572832 +.. date: 6341 +.. nonce: usqHny +.. section: Library + +fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP +unicode characters. + +.. + +.. bpo: 1556784 +.. date: 6340 +.. nonce: 1CAZai +.. section: Library + +allow format strings longer than 127 characters in datetime's strftime +function. + +.. + +.. bpo: 0 +.. date: 6339 +.. nonce: IX1su7 +.. section: Library + +Fix itertools.count(n) to work with negative numbers again. + +.. + +.. bpo: 0 +.. date: 6338 +.. nonce: E13nLX +.. section: Library + +RLIMIT_SBSIZE was added to the resource module where available. + +.. + +.. bpo: 1551427 +.. date: 6337 +.. nonce: FbxrjA +.. section: Library + +fix a wrong NULL pointer check in the win32 version of os.urandom(). + +.. + +.. bpo: 1548092 +.. date: 6336 +.. nonce: CQ3Zbs +.. section: Library + +fix curses.tparm seg fault on invalid input. + +.. + +.. bpo: 1114 +.. date: 6335 +.. nonce: hs32Do +.. section: Library + +fix curses module compilation on 64-bit AIX, & possibly other 64-bit LP64 +platforms where attr_t is not the same size as a long. (Contributed by Luke +Mewburn.) + +.. + +.. bpo: 1550714 +.. date: 6334 +.. nonce: _3LprN +.. section: Library + +fix SystemError from itertools.tee on negative value for n. + +.. + +.. bpo: 0 +.. date: 6333 +.. nonce: 44hgU5 +.. section: Library + +Fixed a few bugs on cjkcodecs: - gbk and gb18030 codec now handle U+30FB +KATAKANA MIDDLE DOT correctly. - iso2022_jp_2 codec now encodes into G0 +for KS X 1001, GB2312 codepoints to conform the standard. - iso2022_jp_3 +and iso2022_jp_2004 codec can encode JIS X 0213:2 codepoints now. + +.. + +.. bpo: 1552726 +.. date: 6332 +.. nonce: KRiUv4 +.. section: Library + +in readline.c, avoid repeatedly polling in interactive mode by only placing +a timeout on the select() if an input hook has been defined. This prevents +an interactive Python from waking up 10 times per second. Patch by Richard +Boulton. + +.. + +.. bpo: 0 +.. date: 6331 +.. nonce: a94xwS +.. section: Library + +fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments were +transposed. + +.. + +.. bpo: 0 +.. date: 6330 +.. nonce: m3uTkK +.. section: Library + +Added support for linking the bsddb module against BerkeleyDB 4.5.x, 4.6.x +and 4.7.x. + +.. + +.. bpo: 1633621 +.. date: 6329 +.. nonce: M5Ndcj +.. section: Library + +if curses.resizeterm() or curses.resize_term() is called, update +_curses.LINES, _curses.COLS, curses.LINES and curses.COLS. + +.. + +.. bpo: 0 +.. date: 6328 +.. nonce: HrtEA6 +.. section: Library + +Fix an off-by-one bug in locale.strxfrm(). + +.. + +.. bpo: 0 +.. date: 6327 +.. nonce: ojYwDU +.. section: Library + +Fix libffi configure for hppa*-*-linux* | parisc*-*-linux*. + +.. + +.. bpo: 0 +.. date: 6326 +.. nonce: A1idYz +.. section: Library + +Build using system ffi library on arm*-linux*. + +.. + +.. bpo: 1372 +.. date: 6325 +.. nonce: VpXOJ9 +.. section: Library + +zlibmodule.c: int overflow in PyZlib_decompress + +.. + +.. bpo: 0 +.. date: 6324 +.. nonce: at5Xd_ +.. section: Library + +bsddb module: Fix memory leak when using database cursors on databases +without a DBEnv. + +.. + +.. bpo: 0 +.. date: 6323 +.. nonce: ilOhKQ +.. section: Library + +The sqlite3 module was updated to pysqlite 2.4.1. + +.. + +.. bpo: 813342 +.. date: 6322 +.. nonce: s5yukE +.. section: IDLE + +Start the IDLE subprocess with -Qnew if the parent is started with that +option. + +.. + +.. bpo: 0 +.. date: 6321 +.. nonce: JiyCdF +.. section: IDLE + +IDLE: Honor the "Cancel" action in the save dialog (Debian bug #299092). + +.. + +.. bpo: 30357 +.. date: 6320 +.. nonce: n4CPEa +.. section: Tests + +test_thread: setUp() now uses support.threading_setup() and +support.threading_cleanup() to wait until threads complete to avoid random +side effects on following tests. Initial patch written by Grzegorz Grzywacz. + +.. + +.. bpo: 0 +.. date: 6319 +.. nonce: PVjNrU +.. section: Tests + +Refactor test_logging to use unittest. + +.. + +.. bpo: 0 +.. date: 6318 +.. nonce: 7j-hhA +.. section: Tests + +Refactor test_profile and test_cprofile to use the same code to profile. + +.. + +.. bpo: 0 +.. date: 6317 +.. nonce: q9s3e7 +.. section: Tests + +Make test_runpy reentrant by fixing _check_module to clear out any module +being tested. Was causing an error by __import__ doing a reload on the +second run and thus suppressing bytecode recreation. + +.. + +.. bpo: 0 +.. date: 6316 +.. nonce: 7jQnkY +.. section: Tests + +Capture socket connection resets and timeouts in test_socket_ssl and +test_urllib2net and raise test.test_support.ResourceDenied. + +.. + +.. bpo: 1559413 +.. date: 6315 +.. nonce: GoWQim +.. section: Tests + +Fix test_cmd_line if sys.executable contains a space. + +.. + +.. bpo: 0 +.. date: 6314 +.. nonce: vjtR_D +.. section: Tests + +Added test.test_support.TransientResource which is a context manager to +surround calls to resources that are not guaranteed to work even if +test.test_support.requires says that the resource should exist. + +.. + +.. bpo: 0 +.. date: 6313 +.. nonce: 6z7bKB +.. section: Tests + +Added a test for slicing of an exception. + +.. + +.. bpo: 0 +.. date: 6312 +.. nonce: ieil_O +.. section: Tests + +Added test.test_support.EnvironmentVarGuard. It's a class that provides a +context manager so that one can temporarily set or unset environment +variables. + +.. + +.. bpo: 0 +.. date: 6311 +.. nonce: jmumH0 +.. section: Tests + +Added some tests for modulefinder. + +.. + +.. bpo: 0 +.. date: 6310 +.. nonce: 0Kz44H +.. section: Tests + +Converted test_imp to use unittest. + +.. + +.. bpo: 0 +.. date: 6309 +.. nonce: smrRfs +.. section: Tests + +Fix bsddb test_basics.test06_Transactions to check the version number +properly. + +.. + +.. bpo: 0 +.. date: 6308 +.. nonce: Z4K3CJ +.. section: Tests + +test.test_support.catch_warning is a new context manager that can be used to +catch the warnings issued by the warning framework. + +.. + +.. bpo: 0 +.. date: 6307 +.. nonce: lEqBYO +.. section: Tools/Demos + +Tools/scripts/reindent.py now creates the backup file using shutil.copy to +preserve user/group and permissions. Added also a --nobackup option to not +create the backup if the user is concerned regarding this. Check issue +#1050828 for more details. + +.. + +.. bpo: 0 +.. date: 6306 +.. nonce: JHrA97 +.. section: Tools/Demos + +Tools/scripts/win_add2path.py was added. The simple script modifes the PATH +environment var of the HKCU tree and adds the python bin and script +directory. + +.. + +.. bpo: 0 +.. date: 6305 +.. nonce: cj1Ip_ +.. section: Tools/Demos + +Tools/18n/pygettext.py was added to the list of scripts installed by +Tools/scripts/setup.py (tracker item 642309). + +.. + +.. bpo: 0 +.. date: 6304 +.. nonce: q6eo5q +.. section: Tools/Demos + +Added IronPython and Jython support to pybench (part of which was patch +#1563844). + +.. + +.. bpo: 0 +.. date: 6303 +.. nonce: xPqVA4 +.. section: Tools/Demos + +Made some minor changes to pybench output to allow the user to see which +Python version is running pybench. + +.. + +.. bpo: 0 +.. date: 6302 +.. nonce: Ufn_76 +.. section: Tools/Demos + +Added support for the new platform module feature +platform.python_implementation(); this will now be saved in the benchmark +pickle. + +.. + +.. bpo: 0 +.. date: 6301 +.. nonce: SJGror +.. section: Documentation + +RFE #1765140: Updated documentation on FileHandler and subclasses to include +new optional delay argument. + +.. + +.. bpo: 932563 +.. date: 6300 +.. nonce: ujYdrI +.. section: Documentation + +Added section on getting contextual information into logging output, and +added documentation for the new LoggerAdapter class. + +.. + +.. bpo: 1295 +.. date: 6299 +.. nonce: WBH2ZB +.. section: Documentation + +Added information about caching of formatted exception information in the +LogRecord by Formatter.format(). + +.. + +.. bpo: 1637365 +.. date: 6298 +.. nonce: hHynKK +.. section: Documentation + +add subsection about "__name__ == __main__" to the Python tutorial. + +.. + +.. bpo: 1698768 +.. date: 6297 +.. nonce: e4h7Jp +.. section: Documentation + +updated the "using Python on the Mac" intro. + +.. + +.. bpo: 1569057 +.. date: 6296 +.. nonce: DqDgin +.. section: Documentation + +Document that calling file.next() when the file is open for writing is +undefined. + +.. + +.. bpo: 1489771 +.. date: 6295 +.. nonce: Ygchql +.. section: Documentation + +the syntax rules in Python Reference Manual were updated to reflect the +current Python syntax. + +.. + +.. bpo: 1686451 +.. date: 6294 +.. nonce: ODrdFR +.. section: Documentation + +Fix return type for PySequence_{Count,Index,Fast_GET_SIZE}. + +.. + +.. bpo: 1679379 +.. date: 6293 +.. nonce: T_NdX4 +.. section: Documentation + +add documentation for fnmatch.translate(). + +.. + +.. bpo: 1629566 +.. date: 6292 +.. nonce: IkETIS +.. section: Documentation + +clarify the docs on the return values of parsedate() and parsedate_tz() in +email.utils and rfc822. + +.. + +.. bpo: 1671450 +.. date: 6291 +.. nonce: nJrEYa +.. section: Documentation + +add a section about subclassing built-in types to the "extending and +embedding" tutorial. + +.. + +.. bpo: 1629125 +.. date: 6290 +.. nonce: 9JdHlD +.. section: Documentation + +fix wrong data type (int -> Py_ssize_t) in PyDict_Next docs. + +.. + +.. bpo: 1565919 +.. date: 6289 +.. nonce: hwpjHv +.. section: Documentation + +document set types in the Language Reference. + +.. + +.. bpo: 1546052 +.. date: 6288 +.. nonce: 3_Kcqu +.. section: Documentation + +clarify that PyString_FromString(AndSize) copies the string pointed to by +its parameter. + +.. + +.. bpo: 1566663 +.. date: 6287 +.. nonce: mAgcIO +.. section: Documentation + +remove obsolete example from datetime docs. + +.. + +.. bpo: 1541682 +.. date: 6286 +.. nonce: 10BXyV +.. section: Documentation + +Fix example in the "Refcount details" API docs. Additionally, remove a +faulty example showing PySequence_SetItem applied to a newly created list +object and add notes that this isn't a good idea. + +.. + +.. bpo: 1552024 +.. date: 6285 +.. nonce: FQsYLY +.. section: Tools/Demos + +add decorator support to unparse.py demo script. + +.. + +.. bpo: 0 +.. date: 6284 +.. nonce: whjkV0 +.. section: Tools/Demos + +Make auto-generated python.vim file list built-ins and exceptions in +alphatbetical order. Makes output more deterministic and easier to tell if +the file is stale or not. + +.. + +.. bpo: 1546372 +.. date: 6283 +.. nonce: MVtd4U +.. section: Tools/Demos + +Fixed small bugglet in pybench that caused a missing file not to get +reported properly. + +.. + +.. bpo: 0 +.. date: 6282 +.. nonce: keNFft +.. section: Build + +Have the search path for building extensions follow the declared order in +$CPPFLAGS and $LDFLAGS when adding directories from those environment +variables. + +.. + +.. bpo: 1983 +.. date: 6281 +.. nonce: DMUUfR +.. section: Build + +Added a check to pyport to verify that sizeof(pid_t) is smaller or equal +sizeof(long). + +.. + +.. bpo: 1234 +.. date: 6280 +.. nonce: uVPtek +.. section: Build + +Fixed semaphore errors on AIX 5.2 + +.. + +.. bpo: 1726 +.. date: 6279 +.. nonce: VPW3gd +.. section: Build + +Remove Python/atof.c from PCBuild/pythoncore.vcproj. + +.. + +.. bpo: 0 +.. date: 6278 +.. nonce: v3vkcE +.. section: Build + +Removed PCbuild8/ directory and added a new build directory for VS 2005 +based on the VS 2008 build directory to PC/VS8.0. The script +PCbuild/vs8to9.py was added to sync changes from PCbuild to PC/VS8.0. + +.. + +.. bpo: 0 +.. date: 6277 +.. nonce: PiHUNm +.. section: Build + +Moved PCbuild/ directory for VS 2003 to PC/VS7.1 and renamed PCBuild9/ +directory to PCBuild/. + +.. + +.. bpo: 1699 +.. date: 6276 +.. nonce: p7AIXC +.. section: Build + +Define _BSD_SOURCE only on OpenBSD. + +.. + +.. bpo: 1608 +.. date: 6275 +.. nonce: H08Msy +.. section: Build + +use -fwrapv when GCC supports it. This is important, newer GCC versions may +optimize away overflow buffer overflow checks without this option! + +.. + +.. bpo: 1418 +.. date: 6274 +.. nonce: DbqMV4 +.. section: Build + +Make the AC_REPLACE_FUNCS object files actually work. + +.. + +.. bpo: 0 +.. date: 6273 +.. nonce: voVF_6 +.. section: Build + +Add a FAST_LOOPS build option that speeds-up looping by trading away +periodic threadstate and signal checking in tight loops. By default, this +option is turned-off. It should only be enabled in debugged, performance +critical applications. + +.. + +.. bpo: 786737 +.. date: 6272 +.. nonce: mJJr01 +.. section: Build + +Allow building in a tree of symlinks pointing to a readonly source. + +.. + +.. bpo: 1737210 +.. date: 6271 +.. nonce: hMxaQH +.. section: Build + +Change Manufacturer of Windows installer to PSF. + +.. + +.. bpo: 1746880 +.. date: 6270 +.. nonce: hrR2KM +.. section: Build + +Correctly install DLLs into system32 folder on Win64. + +.. + +.. bpo: 0 +.. date: 6269 +.. nonce: xKHD52 +.. section: Build + +Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD 4.1+. + +.. + +.. bpo: 0 +.. date: 6268 +.. nonce: 3JXjJ7 +.. section: Build + +Stop supporting AtheOS and cause a build error in configure for the +platform. + +.. + +.. bpo: 1655392 +.. date: 6267 +.. nonce: bwAdWN +.. section: Build + +don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS returned by python- +config if Python was built with --enable-shared because that prevented the +shared library from being used. + +.. + +.. bpo: 1569798 +.. date: 6266 +.. nonce: 7Camzj +.. section: Build + +fix a bug in distutils when building Python from a directory within +sys.exec_prefix. + +.. + +.. bpo: 1675511 +.. date: 6265 +.. nonce: j8xiLT +.. section: Build + +Use -Kpic instead of -xcode=pic32 on Solaris/x86. + +.. + +.. bpo: 0 +.. date: 6264 +.. nonce: D_HO5I +.. section: Build + +Disable _XOPEN_SOURCE on NetBSD 1.x. + +.. + +.. bpo: 0 +.. date: 6263 +.. nonce: ipd_yd +.. section: Build + +configure now checks whether gcc supports the PyArg_ParseTuple format +attribute. + +.. + +.. bpo: 1578513 +.. date: 6262 +.. nonce: MkcqR2 +.. section: Build + +Cross compilation was broken by a change to configure. Repair so that it's +back to how it was in 2.4.3. + +.. + +.. bpo: 1576954 +.. date: 6261 +.. nonce: Rd2jyj +.. section: Build + +Update VC6 build directory; remove redundant files in VC7. + +.. + +.. bpo: 1568842 +.. date: 6260 +.. nonce: xBW1d2 +.. section: Build + +Fix test for uintptr_t. + +.. + +.. bpo: 1540470 +.. date: 6259 +.. nonce: JS-AGw +.. section: Build + +for OpenBSD 4.0. + +.. + +.. bpo: 0 +.. date: 6258 +.. nonce: 7uKaSk +.. section: Build + +Fix build failure on kfreebsd and on the hurd. + +.. + +.. bpo: 0 +.. date: 6257 +.. nonce: cPAQ_M +.. section: Build + +Fix the build of the library reference in info format. + +.. + +.. bpo: 0 +.. date: 6256 +.. nonce: vXo4QU +.. section: Build + +Allow Emacs 22 for building the documentation in info format. + +.. + +.. bpo: 0 +.. date: 6255 +.. nonce: UHEp2F +.. section: Build + +Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify to +include some information about the build environment. + +.. + +.. bpo: 0 +.. date: 6254 +.. nonce: Wws2go +.. section: C API + +Unified naming convention for free lists and their limits. All free lists in +Object/ are named ``free_list``, the counter ``numfree`` and the upper limit +is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. + +.. + +.. bpo: 0 +.. date: 6253 +.. nonce: vwQmXR +.. section: C API + +``PySet_Add()`` can now modify a newly created frozenset. Similarly to +``PyTuple_SetItem``, it can be used to populate a brand new frozenset; but +it does not steal a reference to the added item. + +.. + +.. bpo: 0 +.. date: 6252 +.. nonce: b3Psyt +.. section: C API + +Added ``PySet_Check()`` and ``PyFrozenSet_Check()`` to the set API. + +.. + +.. bpo: 0 +.. date: 6251 +.. nonce: UrXjnD +.. section: C API + +Backport of PyUnicode_FromString(), _FromStringAndSize(), _Format and +_FormatV from Python 3.0. Made PyLong_AsSsize_t and PyLong_FromSsize_t +public functions. + +.. + +.. bpo: 1720595 +.. date: 6250 +.. nonce: FdLtKP +.. section: C API + +add T_BOOL to the range of structmember types. + +.. + +.. bpo: 1534 +.. date: 6249 +.. nonce: k9vjbw +.. section: C API + +Added ``PyFloat_GetMax()``, ``PyFloat_GetMin()`` and ``PyFloat_GetInfo()`` +to the float API. + +.. + +.. bpo: 1521 +.. date: 6248 +.. nonce: eHI3IG +.. section: C API + +On 64bit platforms, using PyArgs_ParseTuple with the t# of w# format code +incorrectly truncated the length to an int, even when PY_SSIZE_T_CLEAN is +set. The str.decode method used to return incorrect results with huge +strings. + +.. + +.. bpo: 1629 +.. date: 6247 +.. nonce: YktpXQ +.. section: C API + +Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. + +.. + +.. bpo: 0 +.. date: 6246 +.. nonce: g8xMae +.. section: C API + +PEP 3123: Provide forward compatibility with Python 3.0, while keeping +backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and +PyVarObject_HEAD_INIT. + +.. + +.. bpo: 0 +.. date: 6245 +.. nonce: sGL89S +.. section: C API + +Py_ssize_t fields work in structmember when HAVE_LONG_LONG is not defined. + +.. + +.. bpo: 1733960 +.. date: 6244 +.. nonce: 8rUKMs +.. section: C API + +Allow T_LONGLONG to accept ints. + +.. + +.. bpo: 0 +.. date: 6243 +.. nonce: VY6LgN +.. section: C API + +T_PYSSIZET can now be used in PyMemberDef lists for Py_ssize_t members. + +.. + +.. bpo: 0 +.. date: 6242 +.. nonce: ZkzATk +.. section: C API + +Added a new API function ``PyImport_ImportModuleNoBlock``. + +.. + +.. bpo: 1637022 +.. date: 6241 +.. nonce: wBq1VS +.. section: C API + +Prefix AST symbols with _Py_. + +.. + +.. bpo: 0 +.. date: 6240 +.. nonce: YAicka +.. section: C API + +Fix some leftovers from the conversion from int to Py_ssize_t (relevant to +strings and sequences of more than 2**31 items). + +.. + +.. bpo: 0 +.. date: 6239 +.. nonce: A7o-lD +.. section: C API + +Make _PyGILState_NoteThreadState() static, it was not used anywhere outside +of pystate.c and should not be necessary. + +.. + +.. bpo: 0 +.. date: 6238 +.. nonce: ZpnpHT +.. section: C API + +``PyImport_Import`` and ``PyImport_ImportModule`` now always do absolute +imports. In earlier versions they might have used relative imports under +some conditions. + +.. + +.. bpo: 0 +.. date: 6237 +.. nonce: 15u7sP +.. section: C API + +Added case insensitive comparison methods ``PyOS_stricmp(char*, char*)`` and +``PyOS_strnicmp(char*, char*, Py_ssize_t)``. + +.. + +.. bpo: 1542693 +.. date: 6236 +.. nonce: ZPZ9Df +.. section: C API + +remove semi-colon at end of PyImport_ImportModuleEx macro so it can be used +as an expression. + +.. + +.. bpo: 1706 +.. date: 6235 +.. nonce: D8C2K3 +.. section: Windows + +Drop support for Win9x, WinME and NT4. Python now requires Windows 2000 or +greater. The _WINVER and NTDDI_VERSION macros are set to Win2k for x86/32bit +builds and WinXP for AMD64 builds. + +.. + +.. bpo: 0 +.. date: 6234 +.. nonce: cKizM7 +.. section: Windows + +Conditionalize definition of _CRT_SECURE_NO_DEPRECATE and +_CRT_NONSTDC_NO_DEPRECATE. + +.. + +.. bpo: 1216 +.. date: 6233 +.. nonce: DblJmV +.. section: Windows + +Restore support for Visual Studio 2002. + +.. + +.. bpo: 0 +.. date: 6232 +.. nonce: 2DB1Bg +.. section: macOS + +cfmfile now raises a DeprecationWarning. + +.. + +.. bpo: 0 +.. date: 6231 +.. nonce: r4EkYd +.. section: macOS + +buildtools now raises a DeprecationWarning. + +.. + +.. bpo: 0 +.. date: 6230 +.. nonce: Mdk5q1 +.. section: macOS + +Removed the macfs module. It had been deprecated since Python 2.5. This +lead to the deprecation of macostools.touched() as it relied solely on macfs +and was a no-op under OS X. diff --git a/Misc/NEWS.d/2.6a2.rst b/Misc/NEWS.d/2.6a2.rst new file mode 100644 index 00000000000..fe6cd26fdb1 --- /dev/null +++ b/Misc/NEWS.d/2.6a2.rst @@ -0,0 +1,694 @@ +.. bpo: 1733757 +.. date: 6865 +.. nonce: cyKvMt +.. release date: 02-Apr-2008 +.. section: Core and Builtins + +The interpreter would hang on shutdown if the tracing function set by +sys.settrace is still active and happens to call threading.currentThread(). + +.. + +.. bpo: 1442 +.. date: 6864 +.. nonce: h73ZTm +.. section: Core and Builtins + +properly report exceptions when the PYTHONSTARTUP file cannot be executed. + +.. + +.. bpo: 0 +.. date: 6863 +.. nonce: q3LWX0 +.. section: Core and Builtins + +The compilation of a class nested in another class used to leak one +reference on the outer class name. + +.. + +.. bpo: 1810 +.. date: 6862 +.. nonce: ESXjRG +.. section: Core and Builtins + +compile() can now compile _ast trees as returned by ``compile(..., +PyCF_ONLY_AST)``. + +.. + +.. bpo: 2426 +.. date: 6861 +.. nonce: H-NFT6 +.. section: Core and Builtins + +Added sqlite3.Connection.iterdump method to allow easy dumping of databases. +Contributed by Paul Kippes at PyCon 2008. + +.. + +.. bpo: 2477 +.. date: 6860 +.. nonce: iEeee2 +.. section: Core and Builtins + +Added from __future__ import unicode_literals. + +.. + +.. bpo: 0 +.. date: 6859 +.. nonce: MQCT3j +.. section: Core and Builtins + +Added backport of bytearray type. + +.. + +.. bpo: 2355 +.. date: 6858 +.. nonce: 3IrFJn +.. section: Core and Builtins + +add Py3k warning for buffer(). + +.. + +.. bpo: 1477 +.. date: 6857 +.. nonce: kL8T9Y +.. section: Core and Builtins + +With narrow Unicode builds, the unicode escape sequence \Uxxxxxxxx did not +accept values outside the Basic Multilingual Plane. This affected raw +unicode literals and the 'raw-unicode-escape' codec. Now UTF-16 surrogates +are generated in this case, like normal unicode literals and the 'unicode- +escape' codec. + +.. + +.. bpo: 2348 +.. date: 6856 +.. nonce: bTKRrx +.. section: Core and Builtins + +add Py3k warning for file.softspace. + +.. + +.. bpo: 2346 +.. date: 6855 +.. nonce: ZdxBIW +.. section: Core and Builtins + +add Py3k warnings for __methods__ and __members__. (See also: bpo-2347) + +.. + +.. bpo: 2358 +.. date: 6854 +.. nonce: -9p_qA +.. section: Core and Builtins + +Add a Py3k warning on sys.exc_clear() usage. + +.. + +.. bpo: 2400 +.. date: 6853 +.. nonce: Vh9y6O +.. section: Core and Builtins + +Allow relative imports to "import *". + +.. + +.. bpo: 1745 +.. date: 6852 +.. nonce: E7-cUG +.. section: Core and Builtins + +Backport print function with ``from __future__ import print_function``. + +.. + +.. bpo: 2332 +.. date: 6851 +.. nonce: J5iU51 +.. section: Core and Builtins + +add new attribute names for instance method objects. The two changes are: +im_self -> __self__ and im_func -> __func__ + +.. + +.. bpo: 2379 +.. date: 6850 +.. nonce: 9-tqgC +.. section: Core and Builtins + +Raise a Py3K warning for __getitem__ or __getslice__ on exception instances. + +.. + +.. bpo: 2371 +.. date: 6849 +.. nonce: xuvdpy +.. section: Core and Builtins + +Add a Py3k warning when catching an exception that doesn't derive from +BaseException. + +.. + +.. bpo: 2341 +.. date: 6848 +.. nonce: LmD2N7 +.. section: Core and Builtins + +Add a Py3k warning when raising an exception that doesn't derive from +BaseException. + +.. + +.. bpo: 2321 +.. date: 6847 +.. nonce: v7FzTy +.. section: Core and Builtins + +use pymalloc for unicode object string data to reduce memory usage in some +circumstances. + +.. + +.. bpo: 0 +.. date: 6846 +.. nonce: O8A72m +.. section: Core and Builtins + +PEP 3127: octal literals now start with "0o". Old-style octal literals are +still valid. There are binary literals with a prefix of "0b". This also +affects int(x, 0). + +.. + +.. bpo: 2359 +.. date: 6845 +.. nonce: cR7f7i +.. section: Core and Builtins + +Adding deprecation warnings for array.{read,write}. + +.. + +.. bpo: 1779871 +.. date: 6844 +.. nonce: Q9u7-T +.. section: Core and Builtins + +GNU gcc can now build Python on OS X because the flags -Wno-long-double, +-no-cpp-precomp, and -mno-fused-madd are no longer passed. + +.. + +.. bpo: 0 +.. date: 6843 +.. nonce: 00spAB +.. section: Core and Builtins + +Add a warning when asserting a non-empty tuple which is always true. + +.. + +.. bpo: 2179 +.. date: 6842 +.. nonce: 6ZA8c- +.. section: Core and Builtins + +speed up with statement execution by storing the exit method on the stack +instead of in a temporary variable (patch by Jeffrey Yaskin) + +.. + +.. bpo: 2238 +.. date: 6841 +.. nonce: LMUvyp +.. section: Core and Builtins + +Some syntax errors in *args and **kwargs expressions could give bogus error +messages. + +.. + +.. bpo: 2143 +.. date: 6840 +.. nonce: 39hw9G +.. section: Core and Builtins + +Fix embedded readline() hang on SSL socket EOF. + +.. + +.. bpo: 2240 +.. date: 6839 +.. nonce: WNReGo +.. section: Library + +Implement signal.setitimer and signal.getitimer. + +.. + +.. bpo: 2315 +.. date: 6838 +.. nonce: pqno5o +.. section: Library + +logging.handlers: TimedRotatingFileHandler now accounts for daylight savings +time in calculating the next rollover. + +.. + +.. bpo: 2316 +.. date: 6837 +.. nonce: ZS89xB +.. section: Library + +logging.handlers: TimedRotatingFileHandler now calculates rollovers +correctly even when nothing is logged for a while. + +.. + +.. bpo: 2317 +.. date: 6836 +.. nonce: 4RDUg2 +.. section: Library + +logging.handlers: TimedRotatingFileHandler now uses improved logic for +removing old files. + +.. + +.. bpo: 2495 +.. date: 6835 +.. nonce: XaNV_D +.. section: Library + +tokenize.untokenize now inserts a space between two consecutive string +literals; previously, ["" ""] was rendered as [""""], which is incorrect +python code. + +.. + +.. bpo: 2248 +.. date: 6834 +.. nonce: EFdgNK +.. section: Library + +return the result of the QUIT command. from SMTP.quit(). + +.. + +.. bpo: 0 +.. date: 6833 +.. nonce: lDMF2h +.. section: Library + +Backport of Python 3.0's io module. + +.. + +.. bpo: 2482 +.. date: 6832 +.. nonce: gt5k7F +.. section: Library + +Make sure that the coefficient of a Decimal is always stored as a str +instance, not as a unicode instance. This ensures that str(Decimal) is +always an instance of str. + +.. + +.. bpo: 2478 +.. date: 6831 +.. nonce: A33H1n +.. section: Library + +fix failure of decimal.Decimal(0).sqrt() + +.. + +.. bpo: 2432 +.. date: 6830 +.. nonce: K_Wmv6 +.. section: Library + +give DictReader the dialect and line_num attributes advertised in the docs. + +.. + +.. bpo: 2460 +.. date: 6829 +.. nonce: N-GQGP +.. section: Library + +Make Ellipsis object copyable. + +.. + +.. bpo: 1681432 +.. date: 6828 +.. nonce: UMEj9l +.. section: Library + +Add triangular distribution to the random module + +.. + +.. bpo: 2136 +.. date: 6827 +.. nonce: pMUClw +.. section: Library + +urllib2's auth handler now allows single-quoted realms in the WWW- +Authenticate header. + +.. + +.. bpo: 2434 +.. date: 6826 +.. nonce: 7NhX4x +.. section: Library + +Enhanced platform.win32_ver() to also work on Python installation which do +not have the win32all package installed. + +.. + +.. bpo: 0 +.. date: 6825 +.. nonce: Mua_8k +.. section: Library + +Added support to platform.uname() to also report the machine and processor +information on Windows XP and later. As a result, platform.machine() and +platform.processor() will report this information as well. + +.. + +.. bpo: 0 +.. date: 6824 +.. nonce: TVfcNn +.. section: Library + +The library implementing the 2to3 conversion, lib2to3, was added to the +standard distribution. + +.. + +.. bpo: 1747858 +.. date: 6823 +.. nonce: q45meX +.. section: Library + +Fix chown to work with large uid's and gid's on 64-bit platforms. + +.. + +.. bpo: 1202 +.. date: 6822 +.. nonce: aihbD5 +.. section: Library + +zlib.crc32 and zlib.adler32 no longer return different values on 32-bit vs. +64-bit python interpreters. Both were correct, but they now both return a +signed integer object for consistency. + +.. + +.. bpo: 1158 +.. date: 6821 +.. nonce: AkVzAm +.. section: Library + +add %f format (fractions of a second represented as microseconds) to +datetime objects. Understood by both strptime and strftime. + +.. + +.. bpo: 705836 +.. date: 6820 +.. nonce: g5peII +.. section: Library + +struct.pack(">f", x) now raises OverflowError on all platforms when x is too +large to fit into an IEEE 754 float; previously it only raised OverflowError +on non IEEE 754 platforms. + +.. + +.. bpo: 2166 +.. date: 6819 +.. nonce: WF2f5f +.. section: Library + +now distutils deals with HOME correctly under win32 (See also: bpo-1741, +bpo-1531505) + +.. + +.. bpo: 1858 +.. date: 6818 +.. nonce: jGCMLw +.. section: Library + +distutils: added multiple server support in .pypirc + +.. + +.. bpo: 1106316 +.. date: 6817 +.. nonce: uk36rF +.. section: Library + +pdb.post_mortem()'s parameter, "traceback", is now optional: it defaults to +the traceback of the exception that is currently being handled (is mandatory +to be in the middle of an exception, otherwise it raises ValueError). + +.. + +.. bpo: 1193577 +.. date: 6816 +.. nonce: b-BahY +.. section: Library + +A .shutdown() method has been added to SocketServers which terminates the +.serve_forever() loop. + +.. + +.. bpo: 2220 +.. date: 6815 +.. nonce: qjYxWH +.. section: Library + +handle rlcompleter attribute match failure more gracefully. + +.. + +.. bpo: 2225 +.. date: 6814 +.. nonce: a0QsFA +.. section: Library + +py_compile, when executed as a script, now returns a non- zero status code +if not all files could be compiled successfully. + +.. + +.. bpo: 1725737 +.. date: 6813 +.. nonce: nvfK6A +.. section: Library + +In distutils' sdist, exclude RCS, CVS etc. also in the root directory, and +also exclude .hg, .git, .bzr, and _darcs. + +.. + +.. bpo: 1872 +.. date: 6812 +.. nonce: m8TmRv +.. section: Library + +The struct module typecode for _Bool has been changed from 't' to '?'. + +.. + +.. bpo: 0 +.. date: 6811 +.. nonce: VqAlAz +.. section: Library + +The bundled libffi copy is now in sync with the recently released +libffi3.0.4 version, apart from some small changes to +Modules/_ctypes/libffi/configure.ac. On OS X, preconfigured libffi files +are used. On all linux systems the --with-system-ffi configure option +defaults to "yes". + +.. + +.. bpo: 1577 +.. date: 6810 +.. nonce: njrgUJ +.. section: Library + +shutil.move() now calls os.rename() if the destination is a directory +instead of copying-then-remove-source. + +.. + +.. bpo: 0 +.. date: 6809 +.. nonce: K5ZD7T +.. section: Tests + +test_nis no longer fails when test.test_support.verbose is true and NIS is +not set up on the testing machine. + +.. + +.. bpo: 0 +.. date: 6808 +.. nonce: 1ZE-e2 +.. section: Tests + +Output comparison tests are no longer supported. + +.. + +.. bpo: 0 +.. date: 6807 +.. nonce: N2wGxu +.. section: Tests + +Rewrite test_errno to use unittest and no longer be a no-op. + +.. + +.. bpo: 0 +.. date: 6806 +.. nonce: f80pTz +.. section: Tests + +GHOP 234: Convert test_extcall to doctest. + +.. + +.. bpo: 0 +.. date: 6805 +.. nonce: IG1fWw +.. section: Tests + +GHOP 290: Convert test_dbm and test_dummy_threading to unittest. + +.. + +.. bpo: 0 +.. date: 6804 +.. nonce: 2Pr5hV +.. section: Tests + +GHOP 293: Convert test_strftime, test_getargs, and test_pep247 to unittest. + +.. + +.. bpo: 2055 +.. date: 6803 +.. nonce: yoFv4H +.. section: Tests + +Convert test_fcntl to unittest. + +.. + +.. bpo: 1960 +.. date: 6802 +.. nonce: 8bFRO9 +.. section: Tests + +Convert test_gdbm to unittest. + +.. + +.. bpo: 0 +.. date: 6801 +.. nonce: 5VXuUU +.. section: Tests + +GHOP 294: Convert test_contains, test_crypt, and test_select to unittest. + +.. + +.. bpo: 0 +.. date: 6800 +.. nonce: Huq18v +.. section: Tests + +GHOP 238: Convert test_tokenize to use doctest. + +.. + +.. bpo: 0 +.. date: 6799 +.. nonce: yrOIgp +.. section: Tests + +GHOP 237: Rewrite test_thread using unittest. + +.. + +.. bpo: 2232 +.. date: 6798 +.. nonce: gT2U-l +.. section: Tests + +os.tmpfile might fail on Windows if the user has no permission to create +files in the root directory. + +.. + +.. bpo: 0 +.. date: 6797 +.. nonce: xClq5J +.. section: Build + +A new script 2to3 is now installed, to run the 2.x to 3.x converter. + +.. + +.. bpo: 0 +.. date: 6796 +.. nonce: K_qDWf +.. section: Build + +Python/memmove.c and Python/strerror.c have been removed; both functions are +in the C89 standard library. + +.. + +.. bpo: 2284 +.. date: 6795 +.. nonce: g5HXfy +.. section: Build + +Add -x64 option to rt.bat. + +.. + +.. bpo: 2477 +.. date: 6794 +.. nonce: ff3qxW +.. section: C API + +Added PyParser_ParseFileFlagsEx() and PyParser_ParseStringFlagsFilenameEx(). diff --git a/Misc/NEWS.d/2.6a3.rst b/Misc/NEWS.d/2.6a3.rst new file mode 100644 index 00000000000..5653d3850b1 --- /dev/null +++ b/Misc/NEWS.d/2.6a3.rst @@ -0,0 +1,356 @@ +.. bpo: 2719 +.. date: 6897 +.. nonce: 4NH_Xn +.. release date: 08-May-2008 +.. section: Core and Builtins + +backported the ``next()`` builtin from Python 3. + +.. + +.. bpo: 2681 +.. date: 6896 +.. nonce: 8UXx90 +.. section: Core and Builtins + +The octal literal ``0o8`` was incorrecly acctepted. Now it properly raises a +SyntaxError. + +.. + +.. bpo: 2617 +.. date: 6895 +.. nonce: 1gTS6r +.. section: Core and Builtins + +Reserved -J and -X arguments for Jython, IronPython and other +implementations of Python. + +.. + +.. bpo: 0 +.. date: 6894 +.. nonce: aRO9gE +.. section: Core and Builtins + +Implemented PEP 370: Per user site-packages directory. + +.. + +.. bpo: 2670 +.. date: 6893 +.. nonce: VM2Luj +.. section: Library + +Fix a failure in urllib2.build_opener(), when passed two handlers that +derive the same default base class. + +.. + +.. bpo: 0 +.. date: 6892 +.. nonce: 7fblHZ +.. section: Library + +Added kill, terminate and send_signal(sig) to subprocess.Popen. + +.. + +.. bpo: 0 +.. date: 6891 +.. nonce: 88WSiY +.. section: Library + +Added phase(z) -> phi, polar(z) -> r, phi and rect(r, phi) -> z to the cmath +module. + +.. + +.. bpo: 0 +.. date: 6890 +.. nonce: 6dejMd +.. section: Library + +Four new methods were added to the math and cmath modules: acosh, asinh, +atanh and log1p. + +.. + +.. bpo: 0 +.. date: 6889 +.. nonce: v-VAd8 +.. section: Library + +zlib.decompressobj().flush(value) no longer crashes the interpreter when +passed a value less than or equal to zero. + +.. + +.. bpo: 1631171 +.. date: 6888 +.. nonce: 8Bc0Zl +.. section: Library + +Re-implement the 'warnings' module in C (the original Python code has been +kept as backup). This will allow for using the 'warning's machinery in such +places as the parser where use of pure Python code is not possible. Both +the ``showarning()`` and ``formatwarning()`` gain an optional 'line' +argument which is not called by default for backwards-compatibility reasons. +Setting ``warnings.showwarning()`` to an implementation that lacks support +for the ``line`` argument will raise a DeprecationWarning. + +.. + +.. bpo: 0 +.. date: 6887 +.. nonce: CNqdrb +.. section: Library + +The audiodev module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 2750 +.. date: 6886 +.. nonce: nv-hkg +.. section: Library + +Add the 'json' package. Based on simplejson 1.9 and contributed by Bob +Ippolito. + +.. + +.. bpo: 1734346 +.. date: 6885 +.. nonce: lfR8ca +.. section: Library + +Support Unicode file names for zipfiles. + +.. + +.. bpo: 2581 +.. date: 6884 +.. nonce: fOkdCT +.. section: Library + +distutils: Vista UAC/elevation support for bdist_wininst. + +.. + +.. bpo: 2635 +.. date: 6883 +.. nonce: F8Y92w +.. section: Library + +Fix bug in 'fix_sentence_endings' textwrap.fill option, where an extra space +was added after a word containing (but not ending in) '.', '!' or '?'. + +.. + +.. bpo: 0 +.. date: 6882 +.. nonce: lYk3LA +.. section: Library + +Add from_buffer() and from_buffer_copy() class methods to ctypes data types. + +.. + +.. bpo: 2682 +.. date: 6881 +.. nonce: NLrJe2 +.. section: Library + +ctypes callback functions no longer contain a cyclic reference to +themselves. + +.. + +.. bpo: 0 +.. date: 6880 +.. nonce: TTWJof +.. section: Library + +The getpass module has been improved on Unix. It now uses /dev/tty by +default and uses stderr instead of stdout. A GetPassWarning is issued when +input echo cannot be controlled. + +.. + +.. bpo: 2014 +.. date: 6879 +.. nonce: CKvu6Y +.. section: Library + +Allow XML-RPC datetime objects to have dates before 1900-01-01. + +.. + +.. bpo: 2439 +.. date: 6878 +.. nonce: Kwwv4U +.. section: Library + +Added new function pkgutil.get_data(), which is a convenience wrapper for +the PEP 302 get_data() API. + +.. + +.. bpo: 2616 +.. date: 6877 +.. nonce: UHPY7r +.. section: Library + +The ctypes.pointer() and ctypes.POINTER() functions are now implemented in C +for better performance. + +.. + +.. bpo: 2408 +.. date: 6876 +.. nonce: GhLvZ5 +.. section: Library + +The ``_types`` module, which was used as in implementation detail of the +public ``types`` module, has been removed and replaced by pure python code. + +.. + +.. bpo: 2513 +.. date: 6875 +.. nonce: x3Kj5E +.. section: Library + +distutils on Windows is now capable of cross-compiling extension modules +between 32 and 64 bit platforms. See the distutls build documentation for +more information. + +.. + +.. bpo: 815646 +.. date: 6874 +.. nonce: GhCmJD +.. section: Library + +Individual file objects may now be used from multiple threads at once +without fear of crashing the Python interpreter. If file.close() is called +while an object is in use by another thread an IOError exception will be +raised and the file will not be closed. + +.. + +.. bpo: 0 +.. date: 6873 +.. nonce: NdBuEp +.. section: Library + +The bundled libffi copy is now in sync with the recently released +libffi3.0.5 version, apart from some small changes to +Modules/_ctypes/libffi/configure.ac. + +.. + +.. bpo: 2385 +.. date: 6872 +.. nonce: qIBVVF +.. section: Library + +distutils.core.run_script() makes __file__ available, so the controlled +environment will more closely mirror the typical script environment. This +supports setup.py scripts that refer to data files. + +.. + +.. bpo: 2550 +.. date: 6871 +.. nonce: wbV22J +.. section: Tests + +The approach used by client/server code for obtaining ports to listen on in +network-oriented tests has been refined in an effort to facilitate running +multiple instances of the entire regression test suite in parallel without +issue. test_support.bind_port() has been fixed such that it will always +return a unique port -- which wasn't always the case with the previous +implementation, especially if socket options had been set that affected +address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The new implementation of +bind_port() will actually raise an exception if it is passed an +AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or SO_REUSEPORT +socket option set. Furthermore, if available, bind_port() will set the +SO_EXCLUSIVEADDRUSE option on the socket it's been passed. This currently +only applies to Windows. This option prevents any other sockets from +binding to the host/port we've bound to, thus removing the possibility of +the 'non-deterministic' behaviour, as Microsoft puts it, that occurs when a +second SOCK_STREAM socket binds and accepts to a host/port that's already +been bound by another socket. The optional preferred port parameter to +bind_port() has been removed. Under no circumstances should tests be hard +coding ports! + +test_support.find_unused_port() has also been introduced, which will pass a +temporary socket object to bind_port() in order to obtain an unused port. +The temporary socket object is then closed and deleted, and the port is +returned. This method should only be used for obtaining an unused port in +order to pass to an external program (i.e. the -accept [port] argument to +openssl's s_server mode) or as a parameter to a server-oriented class that +doesn't give you direct access to the underlying socket used. + +Finally, test_support.HOST has been introduced, which should be used for the +host argument of any relevant socket calls (i.e. bind and connect). + +The following tests were updated to following the new conventions: +test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, +test_poplib, test_ftplib, test_telnetlib, test_socketserver, test_asynchat +and test_socket_ssl. + +It is now possible for multiple instances of the regression test suite to +run in parallel without issue. + +.. + +.. bpo: 1496032 +.. date: 6870 +.. nonce: DcJtNu +.. section: Build + +On alpha, use -mieee when gcc is the compiler. + +.. + +.. bpo: 2544 +.. date: 6869 +.. nonce: -H_NZm +.. section: Build + +On HP-UX systems, use 'gcc -shared' for linking when gcc is used as +compiler. + +.. + +.. bpo: 2573 +.. date: 6868 +.. nonce: 4wDeJ7 +.. section: Build + +On MacOS X it is now possible to install the framework with a different name +using --with-framework-name=NAME. + +.. + +.. bpo: 0 +.. date: 6867 +.. nonce: yznsKq +.. section: C API + +Added implementation of copysign, acosh, asinh, atanh and log1p to the new +files Include/pymath.h and Python/pymath.h for platforms which provide the +functions through their libm. The files also contains several helpers and +constants for math. + +.. + +.. bpo: 0 +.. date: 6866 +.. nonce: Kr65an +.. section: C API + +Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings. diff --git a/Misc/NEWS.d/2.6b1.rst b/Misc/NEWS.d/2.6b1.rst new file mode 100644 index 00000000000..e680708a921 --- /dev/null +++ b/Misc/NEWS.d/2.6b1.rst @@ -0,0 +1,1149 @@ +.. bpo: 3211 +.. date: 7017 +.. nonce: 53eouC +.. release date: 18-June-2008 +.. section: Core and Builtins + +warnings.warn_explicit() did not guard against its 'registry' argument being +anything other than a dict or None. Also fixed a bug in error handling when +'message' and 'category' were both set to None, triggering a bus error. + +.. + +.. bpo: 3100 +.. date: 7016 +.. nonce: FGUaxt +.. section: Core and Builtins + +Corrected a crash on deallocation of a subclassed weakref which holds the +last (strong) reference to its referent. + +.. + +.. bpo: 0 +.. date: 7015 +.. nonce: habgq9 +.. section: Core and Builtins + +Add future_builtins.ascii(). + +.. + +.. bpo: 0 +.. date: 7014 +.. nonce: ZqCwWn +.. section: Core and Builtins + +Several set methods now accept multiple arguments: update(), union(), +intersection(), intersection_update(), difference(), and +difference_update(). + +.. + +.. bpo: 2898 +.. date: 7013 +.. nonce: 3Al5vX +.. section: Core and Builtins + +Added sys.getsizeof() to retrieve size of objects in bytes. + +.. + +.. bpo: 0 +.. date: 7012 +.. nonce: 7NZKM7 +.. section: Core and Builtins + +New environment variable PYTHONIOENCODING. + +.. + +.. bpo: 2488 +.. date: 7011 +.. nonce: SglN-p +.. section: Core and Builtins + +Add sys.maxsize. + +.. + +.. bpo: 2353 +.. date: 7010 +.. nonce: IYOwih +.. section: Core and Builtins + +file.xreadlines() now emits a Py3k warning. + +.. + +.. bpo: 2863 +.. date: 7009 +.. nonce: rpJxY7 +.. section: Core and Builtins + +generators now have a ``gen.__name__`` attribute that equals +``gen.gi_code.co_name``, like ``func.__name___`` that equals +``func.func_code.co_name``. The repr() of a generator now also contains +this name. + +.. + +.. bpo: 2831 +.. date: 7008 +.. nonce: Clokao +.. section: Core and Builtins + +enumerate() now has a ``start`` argument. + +.. + +.. bpo: 2801 +.. date: 7007 +.. nonce: mKH_h9 +.. section: Core and Builtins + +fix bug in the float.is_integer method where a ValueError was sometimes +incorrectly raised. + +.. + +.. bpo: 2790 +.. date: 7006 +.. nonce: XESeko +.. section: Core and Builtins + +sys.flags was not properly exposing its bytes_warning attribute. + +.. + +.. bpo: 2196 +.. date: 7005 +.. nonce: Bzc5vC +.. section: Core and Builtins + +hasattr() now lets exceptions which do not inherit Exception +(KeyboardInterrupt, and SystemExit) propagate instead of ignoring them. + +.. + +.. bpo: 0 +.. date: 7004 +.. nonce: PBmDwc +.. section: Core and Builtins + +Added checks for integer overflows, contributed by Google. Some are only +available if asserts are left in the code, in cases where they can't be +triggered from Python code. + +.. + +.. bpo: 1179 +.. date: 7003 +.. nonce: ZiG6Oq +.. section: Library + +[CVE-2007-4965] Integer overflow in imageop module. + +.. + +.. bpo: 3116 +.. date: 7002 +.. nonce: A_baFS +.. section: Library + +marshal.dumps() had quadratic behavior for strings > 32Mb. + +.. + +.. bpo: 2138 +.. date: 7001 +.. nonce: 1v8Wds +.. section: Library + +Add factorial() to the math module. + +.. + +.. bpo: 0 +.. date: 7000 +.. nonce: Zg08xh +.. section: Library + +The heapq module does comparisons using LT instead of LE. This makes its +implementation match that used by list.sort(). + +.. + +.. bpo: 2819 +.. date: 6999 +.. nonce: 8rJOqA +.. section: Library + +add full-precision summation function to math module, based on Hettinger's +ASPN Python Cookbook recipe. + +.. + +.. bpo: 2592 +.. date: 6998 +.. nonce: dyYM9F +.. section: Library + +delegate nb_index and the floor/truediv slots in weakref.proxy. + +.. + +.. bpo: 0 +.. date: 6997 +.. nonce: 9pq1AU +.. section: Library + +Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the platform. + +.. + +.. bpo: 0 +.. date: 6996 +.. nonce: xpuGyu +.. section: Library + +Support for Windows 9x has been removed from the winsound module. + +.. + +.. bpo: 0 +.. date: 6995 +.. nonce: QqGmIr +.. section: Library + +bsddb module updated to version 4.7.3. +http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3. This code should +be compatible with Python 3.0. + +.. + +.. bpo: 2858 +.. date: 6994 +.. nonce: klmpfU +.. section: Library + +Fix potential memory corruption when bsddb.db.DBEnv.lock_get and other +bsddb.db object constructors raised an exception. + +.. + +.. bpo: 2669 +.. date: 6993 +.. nonce: ThHCIr +.. section: Library + +bsddb/__init__.py iteration no longer silently fails when the database has +changed size during iteration. It now raises a RuntimeError in the same +manner as a dictionary. + +.. + +.. bpo: 2870 +.. date: 6992 +.. nonce: dmu5w6 +.. section: Library + +cmathmodule.c compile error. + +.. + +.. bpo: 0 +.. date: 6991 +.. nonce: F-3bCT +.. section: Library + +Added a threading.Thread.ident property. + +.. + +.. bpo: 0 +.. date: 6990 +.. nonce: eoz_IQ +.. section: Library + +logging.config: Removed out-of-date comment in _install_handlers and used +issubclass in place of equality comparison of classes. + +.. + +.. bpo: 2722 +.. date: 6989 +.. nonce: wqgrWN +.. section: Library + +Now the os.getcwd() supports very long path names. + +.. + +.. bpo: 2888 +.. date: 6988 +.. nonce: gJe46M +.. section: Library + +Fixed the behaviour of pprint when working with nested structures, to match +the behaviour of 2.5 and 3.0 (now follows the common sense). + +.. + +.. bpo: 1817 +.. date: 6987 +.. nonce: pPMpU3 +.. section: Library + +cgi now correctly handles the querystring on POST requests + +.. + +.. bpo: 3136 +.. date: 6986 +.. nonce: h_BTKr +.. section: Library + +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. + +.. + +.. bpo: 3126 +.. date: 6985 +.. nonce: fTafXl +.. section: Library + +StreamHandler and FileHandler check before calling "flush" and "close" that +the stream object has these, using hasattr (thanks to bobf for the patch). + +.. + +.. bpo: 2912 +.. date: 6984 +.. nonce: eOMCRu +.. section: Library + +platform.uname now tries to determine unknown information even if os.uname +exists. + +.. + +.. bpo: 0 +.. date: 6983 +.. nonce: suPcSI +.. section: Library + +The rfc822 module has been deprecated for removal in 3.0. + +.. + +.. bpo: 0 +.. date: 6982 +.. nonce: UOZNCJ +.. section: Library + +The mimetools module has been deprecated for removal in 3.0. + +.. + +.. bpo: 0 +.. date: 6981 +.. nonce: RqZ_5y +.. section: Library + +The ctypes.byref function now takes an optional second parameter which +specifies an offset in bytes for the constructed pointer-like object. + +.. + +.. bpo: 0 +.. date: 6980 +.. nonce: oTWuUu +.. section: Library + +Added the ast module. + +.. + +.. bpo: 0 +.. date: 6979 +.. nonce: fHFiuS +.. section: Library + +Added the multiprocessing module, PEP 371. + +.. + +.. bpo: 0 +.. date: 6978 +.. nonce: nlfVuP +.. section: Library + +Factored out the indentation cleaning from inspect.getdoc() into +inspect.cleandoc() to ease standalone use. + +.. + +.. bpo: 1798 +.. date: 6977 +.. nonce: AzgRaY +.. section: Library + +Add ctypes calling convention that allows safe access to errno. + +.. + +.. bpo: 2404 +.. date: 6976 +.. nonce: y3Vi2t +.. section: Library + +ctypes objects support the new pep3118 buffer interface. + +.. + +.. bpo: 2125 +.. date: 6975 +.. nonce: wZgsqd +.. section: Library + +Add GetInteger and GetString methods for msilib.Record objects. + +.. + +.. bpo: 2782 +.. date: 6974 +.. nonce: cDdM9Y +.. section: Library + +The datetime module's strftime methods now accept unicode format strings +just as time.strftime always has. + +.. + +.. bpo: 0 +.. date: 6973 +.. nonce: lhIEH0 +.. section: Library + +The sgmllib and htmllib modules have been deprecated for removal in Python +3.0. + +.. + +.. bpo: 3011 +.. date: 6972 +.. nonce: 6bdKsn +.. section: Library + +locale module alias table was updated to the latest version from the X.org +locale.alias file. + +.. + +.. bpo: 1797 +.. date: 6971 +.. nonce: q7se8Q +.. section: Library + +ctypes NULL function pointers have a False boolean value now. + +.. + +.. bpo: 2985 +.. date: 6970 +.. nonce: Lj8FT6 +.. section: Library + +Allow 64-bit integer responses (````) in XMLRPC transfers. + +.. + +.. bpo: 2877 +.. date: 6969 +.. nonce: DHx0Vp +.. section: Library + +The UserString.MutableString class has been removed in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6968 +.. nonce: eAZNNA +.. section: Library + +Do not close external file objects passed to tarfile.open(mode='w:bz2') when +the TarFile is closed. + +.. + +.. bpo: 2959 +.. date: 6967 +.. nonce: VfcUGd +.. section: Library + +For consistency with other file-like objects, gzip's GzipFile.close() can +now be called multiple times without raising an exception. + +.. + +.. bpo: 1390 +.. date: 6966 +.. nonce: r5VD4K +.. section: Library + +Raise ValueError in toxml when an invalid comment would otherwise be +produced. + +.. + +.. bpo: 2914 +.. date: 6965 +.. nonce: vFi4D6 +.. section: Library + +TimedRotatingFileHandler now takes an optional keyword argument "utc" to use +UTC time rather than local time. + +.. + +.. bpo: 2929 +.. date: 6964 +.. nonce: rN0khF +.. section: Library + +TimedRotatingFileHandler was using the wrong path when deleting old log +files (filename only instead of full path). + +.. + +.. bpo: 1775025 +.. date: 6963 +.. nonce: 0zA_rX +.. section: Library + +You can now specify zipfile members to open(), read() or extract() via a +ZipInfo instance. This allows handling duplicate filenames in zipfiles. + +.. + +.. bpo: 961805 +.. date: 6962 +.. nonce: lic8H4 +.. section: Library + +Fix Text.edit_modified() in Tkinter. + +.. + +.. bpo: 1793 +.. date: 6961 +.. nonce: uqwZq4 +.. section: Library + +Function ctypes.util.find_msvcrt() added that returns the name of the C +runtime library that Python uses. ctypes.util.find_library(name) now call +this function when name is 'm' or 'c'. + +.. + +.. bpo: 0 +.. date: 6960 +.. nonce: TYfaoC +.. section: Library + +The statvfs module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6959 +.. nonce: YxHVfd +.. section: Library + +The sunaudiodev and SUNAUDIODEV modules have been deprecated for removal in +Python 3.0. + +.. + +.. bpo: 0 +.. date: 6958 +.. nonce: xxpvg4 +.. section: Library + +The WAIT module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6957 +.. nonce: 2EEuVl +.. section: Library + +The torgb module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6956 +.. nonce: DxcqyJ +.. section: Library + +The SV module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6955 +.. nonce: T3Yn6K +.. section: Library + +The readcd module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6954 +.. nonce: H9XINa +.. section: Library + +The panelparser module from IRIX has been deprecated for removal in Python +3.0. + +.. + +.. bpo: 0 +.. date: 6953 +.. nonce: zVi2Qa +.. section: Library + +The panel module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6952 +.. nonce: G7TA5T +.. section: Library + +The jpeg module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6951 +.. nonce: mVA78R +.. section: Library + +The IOCTL module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6950 +.. nonce: J4KyX6 +.. section: Library + +The IN module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6949 +.. nonce: Nuh6UM +.. section: Library + +The imgfile module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6948 +.. nonce: UBseEw +.. section: Library + +The GLWS module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6947 +.. nonce: xgzC-j +.. section: Library + +The GET module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6946 +.. nonce: NgBwkl +.. section: Library + +The fm module from IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6945 +.. nonce: 9kD1K- +.. section: Library + +The FL, flp, and fl modules from IRIX have been deprecated for removal in +Python 3.0. + +.. + +.. bpo: 0 +.. date: 6944 +.. nonce: AYoVJR +.. section: Library + +The FILE module on IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6943 +.. nonce: CQ38ij +.. section: Library + +The ERRNO module on IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6942 +.. nonce: R-9YLH +.. section: Library + +The DEVICE, GL, gl, and cgen modules (which indirectly includes cgensupport) +have been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6941 +.. nonce: dKOF2g +.. section: Library + +The CL, CL_old, and cl modules for IRIX have been deprecated for removal in +Python 3.0. + +.. + +.. bpo: 0 +.. date: 6940 +.. nonce: 5cFkYd +.. section: Library + +The cdplayer module for IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6939 +.. nonce: 5y0yek +.. section: Library + +The cddb module for IRIX has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6938 +.. nonce: 0pHLuS +.. section: Library + +The cd and CD modules for IRIX have been deprecated for removal in Python +3.0. + +.. + +.. bpo: 0 +.. date: 6937 +.. nonce: eF0f6O +.. section: Library + +The al and AL modules for IRIX have been deprecated for removal in Python +3.0. + +.. + +.. bpo: 1713041 +.. date: 6936 +.. nonce: JzsT_z +.. section: Library + +fix pprint's handling of maximum depth. + +.. + +.. bpo: 0 +.. date: 6935 +.. nonce: FpBuBP +.. section: Library + +The timing module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6934 +.. nonce: Lz9Ysd +.. section: Library + +The sv module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6933 +.. nonce: kwju7- +.. section: Library + +The multifile module has been deprecated as per PEP 4. + +.. + +.. bpo: 0 +.. date: 6932 +.. nonce: G-Cuj6 +.. section: Library + +The imageop module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 2250 +.. date: 6931 +.. nonce: v4HLiv +.. section: Library + +Exceptions raised during evaluation of names in rlcompleter's +``Completer.complete()`` method are now caught and ignored. + +.. + +.. bpo: 2659 +.. date: 6930 +.. nonce: FuhwDb +.. section: Library + +Added ``break_on_hyphens`` option to textwrap TextWrapper class. + +.. + +.. bpo: 0 +.. date: 6929 +.. nonce: w8Xvgj +.. section: Library + +The mhlib module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6928 +.. nonce: f4HWLF +.. section: Library + +The linuxaudiodev module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6927 +.. nonce: O9UJsR +.. section: Library + +The ihooks module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6926 +.. nonce: JFJhmk +.. section: Library + +The fpformat module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6925 +.. nonce: BVxyeG +.. section: Library + +The dl module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6924 +.. nonce: MCsyLJ +.. section: Library + +The Canvas module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6923 +.. nonce: aVjhm5 +.. section: Library + +The compiler package has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6922 +.. nonce: R6-PB3 +.. section: Library + +The Bastion and rexec modules have been deprecated for removal in Python +3.0. + +.. + +.. bpo: 0 +.. date: 6921 +.. nonce: BvlchT +.. section: Library + +The bsddb185 module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6920 +.. nonce: Lt4pJF +.. section: Library + +The pure module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 2487 +.. date: 6919 +.. nonce: n2AhZO +.. section: Library + +change the semantics of math.ldexp(x, n) when n is too large to fit in a C +long. ldexp(x, n) now returns a zero (with suitable sign) if n is large and +negative; previously, it raised OverflowError. + +.. + +.. bpo: 0 +.. date: 6918 +.. nonce: 6I_VH_ +.. section: Library + +The toaiff module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6917 +.. nonce: qWQme_ +.. section: Library + +The test.testall module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6916 +.. nonce: HPixGU +.. section: Library + +The new module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6915 +.. nonce: sQ0aEE +.. section: Library + +The user module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6914 +.. nonce: J-y7uq +.. section: Library + +The stringold module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6913 +.. nonce: u1RhAc +.. section: Library + +The mutex module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6912 +.. nonce: NlWeSy +.. section: Library + +The imputil module has been deprecated for removal in Python 3.0. + +.. + +.. bpo: 0 +.. date: 6911 +.. nonce: iI_4rp +.. section: Library + +test.test_support.catch_warning() gained a 'record' argument. + +.. + +.. bpo: 0 +.. date: 6910 +.. nonce: 0DtsL9 +.. section: Library + +os.path.walk is deprecated in favor of os.walk. + +.. + +.. bpo: 0 +.. date: 6909 +.. nonce: MWVgy8 +.. section: Library + +pdb gained the "until" command. + +.. + +.. bpo: 0 +.. date: 6908 +.. nonce: R978mb +.. section: Library + +The Mac Modules (including Carbon) have been deprecated for removal in +Python 3.0. + +.. + +.. bpo: 0 +.. date: 6907 +.. nonce: 2hRfXS +.. section: Library + +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. + +.. + +.. bpo: 0 +.. date: 6906 +.. nonce: HjodSi +.. section: Library + +The bundled OSX-specific copy of libbffi is now in sync with the version +shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. + +.. + +.. bpo: 0 +.. date: 6905 +.. nonce: iTp3z3 +.. section: Library + +The threading module gained aliases for names that will be removed in the +3.x series. + +.. + +.. bpo: 0 +.. date: 6904 +.. nonce: 0CBHNl +.. section: Build + +The Windows installer now includes Tk 8.5, bzip2 1.0.5, and SQLite 3.5.9. + +.. + +.. bpo: 1722225 +.. date: 6903 +.. nonce: j9OSPy +.. section: Build + +Support QNX 6. + +.. + +.. bpo: 0 +.. date: 6902 +.. nonce: CBo5JG +.. section: Build + +``Lib/lib-old`` is now added to sys.path. + +.. + +.. bpo: 0 +.. date: 6901 +.. nonce: sehDt_ +.. section: Build + +On MacOS X it is now possible to install the framework in 64-bit mode or +even as a 4-way universal binary (that is, PPC, i386, PPC64 and x86_64 +support in one binary). + +This is controlled by the configure argument ``--with-universal-archs``: + +- ``--with-universal-archs=all``: install 4-way universal + +- ``--with-universal-archs=32-bit``: install 2-way universal, 32-bit (the +default) + +- ``--with-universal-archs=64-bit``: install 2-way universal, 64-bit + +This option should be used in combination with ``--enable-universalsdk=``. + +NOTE: 64-bit and 4-way builds are only suppported on Mac OS X 10.5 (or +later). + +.. + +.. bpo: 0 +.. date: 6900 +.. nonce: dWsqLp +.. section: C API + +Add ``PyType_Modified()`` as a public API to clear the type cache. + +.. + +.. bpo: 0 +.. date: 6899 +.. nonce: kBP7ih +.. section: C API + +The PyBytes functions have been renamed to PyByteArray. + +.. + +.. bpo: 0 +.. date: 6898 +.. nonce: Ab5wDH +.. section: C API + +The PyString functions have been renamed to PyBytes. A batch of defines were +added so that the linker still sees the original PyString names. diff --git a/Misc/NEWS.d/2.6b2.rst b/Misc/NEWS.d/2.6b2.rst new file mode 100644 index 00000000000..d4e77afecb5 --- /dev/null +++ b/Misc/NEWS.d/2.6b2.rst @@ -0,0 +1,424 @@ +.. bpo: 3156 +.. date: 7059 +.. nonce: hdm5KM +.. release date: 17-Jul-2008 +.. section: Core and Builtins + +Fix inconsistent behavior of the bytearray type: all its methods now allow +for items objects that can be converted to an integer using +operator.index(). + +.. + +.. bpo: 3360 +.. date: 7058 +.. nonce: IrjlMc +.. section: Core and Builtins + +Fix incorrect parsing of '020000000000.0', which produced a ValueError +instead of giving the correct float. + +.. + +.. bpo: 3083 +.. date: 7057 +.. nonce: -lGbUY +.. section: Core and Builtins + +Add alternate (#) formatting for bin, oct, hex output for str.format(). +This adds the prefix 0b, 0o, or 0x, respectively. + +.. + +.. bpo: 3008 +.. date: 7056 +.. nonce: YsZO12 +.. section: Core and Builtins + +the float type has a new instance method 'float.hex' and a new class method +'float.fromhex' to convert floating-point numbers to and from hexadecimal +strings, respectively. + +.. + +.. bpo: 2235 +.. date: 7055 +.. nonce: 8Brs_N +.. section: Core and Builtins + +__hash__ is once again inherited by default. To allow collections.Hashable +to remain meaningful in the presence of the default hash implementation +(object.__hash__), it is now possible to explicit block inheritance of hash +by setting __hash__=None at the Python level, or +tp_hash=PyObject_HashNotImplemented at the C level. + +.. + +.. bpo: 3221 +.. date: 7054 +.. nonce: -0HAEB +.. section: Core and Builtins + +Issue a RuntimeWarning instead of raising SystemError if the parent module +cannot be found while performing an absolute import. This means that an +incorrectly defined __package__ attribute will now only prevent relative +imports in that module rather than causing all imports from that module to +fail. + +.. + +.. bpo: 2517 +.. date: 7053 +.. nonce: YHwfKp +.. section: Core and Builtins + +Allow unicode messages in Exceptions again by correctly bypassing the +instance dictionary when looking up __unicode__ on new-style classes. + +.. + +.. bpo: 3242 +.. date: 7052 +.. nonce: uFneM1 +.. section: Core and Builtins + +Fix a crash inside the print statement, if sys.stdout is set to a custom +object whose write() method happens to install another file in sys.stdout. + +.. + +.. bpo: 3088 +.. date: 7051 +.. nonce: bSHlNi +.. section: Core and Builtins + +Corrected a race condition in classes derived from threading.local: the +first member set by a thread could be saved in another thread's dictionary. + +.. + +.. bpo: 3004 +.. date: 7050 +.. nonce: P4g_vU +.. section: Core and Builtins + +Minor change to slice.indices(): the start and stop arguments are now +treated identically, making the behaviour easier to describe and understand. +For example, slice(None, -10, 1).indices(9) now returns (0, 0, 1) instead of +(0, -1, 1), and slice(None, 10, -1).indices(10) returns (9, 9, -1) instead +of (9, 10, -1). + +.. + +.. bpo: 3219 +.. date: 7049 +.. nonce: 6awi9c +.. section: Core and Builtins + +Calling a function with repeated keyword arguments, f(a=2, a=23), would not +cause a syntax error. This was a regression from 2.4 caused by the switch +to the new compiler. + +.. + +.. bpo: 2862 +.. date: 7048 +.. nonce: R-Avyy +.. section: Core and Builtins + +Make int and float freelist management consistent with other freelists. +Changes their CompactFreeList apis into ClearFreeList apis and calls them +via gc.collect(). + +.. + +.. bpo: 3554 +.. date: 7047 +.. nonce: _5DO8B +.. section: Library + +ctypes.string_at and ctypes.wstring_at did call Python api functions without +holding the GIL, which could lead to a fatal error when they failed. + +.. + +.. bpo: 799428 +.. date: 7046 +.. nonce: kA7sJS +.. section: Library + +Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. + +.. + +.. bpo: 3395 +.. date: 7045 +.. nonce: j6q9M6 +.. section: Library + +fix reference in test_multiprocessing to old debugInfo method + +.. + +.. bpo: 3312 +.. date: 7044 +.. nonce: pGNZVY +.. section: Library + +Fix two crashes in sqlite3. + +.. + +.. bpo: 1608818 +.. date: 7043 +.. nonce: FtvGGk +.. section: Library + +Fix misbehavior in os.listdir() if readdir() fails. + +.. + +.. bpo: 3125 +.. date: 7042 +.. nonce: fEAPxY +.. section: Library + +Remove copy_reg in multiprocessing and replace it with +ForkingPickler.register() to resolve conflict with ctypes. + +.. + +.. bpo: 3090 +.. date: 7041 +.. nonce: Dl5Ar4 +.. section: Library + +Fixed ARCHFLAGS parsing on OS/X + +.. + +.. bpo: 3313 +.. date: 7040 +.. nonce: wvm6HP +.. section: Library + +Fixed a crash when a failed dlopen() call does not set a valid dlerror() +message. + +.. + +.. bpo: 3258 +.. date: 7039 +.. nonce: JBBmgi +.. section: Library + +Fixed a crash when a ctypes POINTER type to an incomplete structure was +created. + +.. + +.. bpo: 3339 +.. date: 7038 +.. nonce: L4Fn9f +.. section: Library + +dummy_thread.acquire() should not return None. + +.. + +.. bpo: 3285 +.. date: 7037 +.. nonce: 9B3FF_ +.. section: Library + +Fractions from_float() and from_decimal() accept Integral arguments. + +.. + +.. bpo: 3301 +.. date: 7036 +.. nonce: 063oaQ +.. section: Library + +Bisect module behaved badly when lo was negative. + +.. + +.. bpo: 839496 +.. date: 7035 +.. nonce: pl02h- +.. section: Library + +SimpleHTTPServer used to open text files in text mode. This is both +unnecessary (HTTP allows text content to be sent in several forms) and wrong +because the actual transmitted size could differ from the content-length. +The problem had been corrected in the 2.4 branch, but never merged into +trunk. + +.. + +.. bpo: 2663 +.. date: 7034 +.. nonce: j037TB +.. section: Library + +add filtering capability to shutil.copytree(). + +.. + +.. bpo: 1622 +.. date: 7033 +.. nonce: Yi7nBf +.. section: Library + +Correct interpretation of various ZIP header fields. + +.. + +.. bpo: 1526 +.. date: 7032 +.. nonce: GTmFzB +.. section: Library + +Allow more than 64k files to be added to Zip64 file. + +.. + +.. bpo: 1746 +.. date: 7031 +.. nonce: 9HT8Dq +.. section: Library + +Correct handling of zipfile archive comments (previously archives with +comments over 4k were flagged as invalid). Allow writing Zip files with +archives by setting the 'comment' attribute of a ZipFile. + +.. + +.. bpo: 449227 +.. date: 7030 +.. nonce: 5LsZeI +.. section: Library + +The rlcompleter module now adds "(" to callable objects when completed. + +.. + +.. bpo: 3190 +.. date: 7029 +.. nonce: VtDnou +.. section: Library + +Pydoc now hides the automatic module attribute __package__ (the handling is +now the same as that of other special attributes like __name__). + +.. + +.. bpo: 2885 +.. date: 7028 +.. nonce: uiHEVr +.. section: Library + +The urllib.urlopen() function has been deprecated for removal in Python 3.0 +in favor of urllib2.urlopen(). + +.. + +.. bpo: 2113 +.. date: 7027 +.. nonce: bYWyrt +.. section: Library + +Fix error in subprocess.Popen if the select system call is interrupted by a +signal. + +.. + +.. bpo: 3309 +.. date: 7026 +.. nonce: Y7DVRF +.. section: Library + +Fix bz2.BZFile iterator to release its internal lock properly when raising +an exception due to the bz2file being closed. Prevents a deadlock. + +.. + +.. bpo: 3094 +.. date: 7025 +.. nonce: DuUvkr +.. section: Library + +httplib.HTTPSConnection Host: headers no longer include the redundant ":443" +port number designation when the connection is using the default https port +(443). + +.. + +.. bpo: 874900 +.. date: 7024 +.. nonce: O4a6qo +.. section: Library + +after an os.fork() call the threading module state is cleaned up in the +child process to prevent deadlock and report proper thread counts if the new +process uses the threading module. + +.. + +.. bpo: 0 +.. date: 7023 +.. nonce: qnkMJb +.. section: Tests + +test.test_support.catch_warning now keeps track of all warnings it sees and +is now better documented. Explicit unit tests for this context manager have +been added to test_warnings. + +.. + +.. bpo: 3215 +.. date: 7022 +.. nonce: JA6IUI +.. section: Build + +Build sqlite3 as sqlite3.dll, not sqlite3.pyd. + +.. + +.. bpo: 0 +.. date: 7021 +.. nonce: A25wbC +.. section: Documentation + +Document that robotparser has been renamed to urllib.robotparser in Python +3.0. + +.. + +.. bpo: 0 +.. date: 7020 +.. nonce: k24KZW +.. section: Documentation + +Document that urlparse has been renamed to urllib.parse in Python 3.0. + +.. + +.. bpo: 0 +.. date: 7019 +.. nonce: wtGKB7 +.. section: Documentation + +Document that urllib2 is split across multiple modules and renamed in Python +3.0. + +.. + +.. bpo: 0 +.. date: 7018 +.. nonce: kWfaYS +.. section: Documentation + +Document that urllib is split across multiple modules and renamed in Python +3.0. diff --git a/Misc/NEWS.d/2.6b3.rst b/Misc/NEWS.d/2.6b3.rst new file mode 100644 index 00000000000..6b23d6c19c5 --- /dev/null +++ b/Misc/NEWS.d/2.6b3.rst @@ -0,0 +1,531 @@ +.. bpo: 1878 +.. date: 7111 +.. nonce: exCmjh +.. release date: 20-Aug-2008 +.. section: Core and Builtins + +Remove Py_TPFLAGS_HAVE_VERSION_TAG from Py_TPFLAGS_DEFAULT when not building +the core. This means 3rd party extensions do not automatically benefit from +the class attribute cache; they will have to explicitly add +Py_TPFLAGS_HAVE_VERSION_TAG to their tp_flags field if they care. This is a +backwards compatibility feature; in 3.0, all types will use the cache by +default. + +.. + +.. bpo: 0 +.. date: 7110 +.. nonce: 7crJgG +.. section: Core and Builtins + +Keyword arguments can now follow starred arguments. (``f(a, *args, +keyword=23)`` is now valid syntax.) + +.. + +.. bpo: 0 +.. date: 7109 +.. nonce: OfzhCP +.. section: Core and Builtins + +ctypes function pointers that are COM methods have a boolean True value +again. + +.. + +.. bpo: 3139 +.. date: 7108 +.. nonce: j4FT95 +.. section: Core and Builtins + +Make buffer-interface thread-safe wrt. PyArg_ParseTuple, by denying s# to +parse objects that have a releasebuffer procedure, and introducing s*. + +.. + +.. bpo: 3537 +.. date: 7107 +.. nonce: Jd1RRZ +.. section: Core and Builtins + +Fix an assertion failure when an empty but presized dict object was stored +in the freelist. + +.. + +.. bpo: 1481296 +.. date: 7106 +.. nonce: 9MXKTf +.. section: Core and Builtins + +Make long(float('nan')) and int(float('nan')) raise ValueError consistently +across platforms. + +.. + +.. bpo: 3479 +.. date: 7105 +.. nonce: 2x4rkT +.. section: Core and Builtins + +On platforms where sizeof(int) is smaller than sizeof(long) (64bit Unix, for +example), unichr() would truncate its argument and return u'\x00' for +unichr(2**32). Now it properly raises an OverflowError. + +.. + +.. bpo: 0 +.. date: 7104 +.. nonce: dpio6h +.. section: Core and Builtins + +Apply security patches from Apple. + +.. + +.. bpo: 2542 +.. date: 7103 +.. nonce: OGrPLh +.. section: Core and Builtins + +Now that issubclass() may call arbitrary code, ensure that +PyErr_ExceptionMatches returns 0 when an exception occurs there. + +.. + +.. bpo: 1819 +.. date: 7102 +.. nonce: LzrD36 +.. section: Core and Builtins + +function calls with several named parameters are now on average 35% faster +(as measured by pybench). + +.. + +.. bpo: 2378 +.. date: 7101 +.. nonce: jnJN2_ +.. section: Core and Builtins + +An unexpected UnboundLocalError or NameError could appear when the python +debugger steps into a class statement: the free variables (local variables +defined in an outer scope) would be deleted from the outer scope. + +.. + +.. bpo: 2620 +.. date: 7100 +.. nonce: g7NRZZ +.. section: Core and Builtins + +Overflow checking when allocating or reallocating memory was not always +being done properly in some python types and extension modules. +PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have all been +updated to perform better checks and places in the code that would +previously leak memory on the error path when such an allocation failed have +been fixed. + +.. + +.. bpo: 3612 +.. date: 7099 +.. nonce: RX3nFS +.. section: Library + +Added some missing basic types in ctypes.wintypes. + +.. + +.. bpo: 0 +.. date: 7098 +.. nonce: 6arfb- +.. section: Library + +The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of +symtable.Symbol have been deprecated for removal in 3.0 and the next +release. + +.. + +.. bpo: 2234 +.. date: 7097 +.. nonce: ZY7qAp +.. section: Library + +distutils failed for some versions of the cygwin compiler. The version +reported by these tools does not necessarily follow the python version +numbering scheme, so the module is less strict when parsing it. + +.. + +.. bpo: 2235 +.. date: 7096 +.. nonce: lZ4uDf +.. section: Library + +Added Py3k warnings for types which will become unhashable under the +stricter __hash__ inheritance rules in 3.0. Several types which did not meet +the rules for hash invariants and were already unhashable in 3.0 have now +been explicitly flagged as unhashable in 2.6 as well (collections.Mapping, +collections.Set, unittest.TestSuite, xml.dom.minidom.NamedNodeMap, +numbers.Number, UserList.UserList) + +.. + +.. bpo: 0 +.. date: 7095 +.. nonce: njv0Yv +.. section: Library + +Update __all__ for cookielib, csv, os, urllib2, and weakref to include +things imported into the module but exposed as part of the module's API. + +.. + +.. bpo: 0 +.. date: 7094 +.. nonce: IOULx3 +.. section: Library + +Remove an unneeded import of abc.ABCMeta from 'inspect'. + +.. + +.. bpo: 0 +.. date: 7093 +.. nonce: ui1bpi +.. section: Library + +Remove unneeded imports of 'sys' and 'warnings' from 'io'. + +.. + +.. bpo: 0 +.. date: 7092 +.. nonce: 5UlHtd +.. section: Library + +Remove unneeded imports of 'warnings' from shelve, filecmp, and +dummy_thread. + +.. + +.. bpo: 3575 +.. date: 7091 +.. nonce: f0B44V +.. section: Library + +Incremental decoder's decode function now takes bytearray by using 's*' +instead of 't#'. + +.. + +.. bpo: 2222 +.. date: 7090 +.. nonce: 76LS-7 +.. section: Library + +Fixed reference leak when occurred os.rename() fails unicode conversion on +2nd parameter. (windows only) + +.. + +.. bpo: 2464 +.. date: 7089 +.. nonce: Hm7gBN +.. section: Library + +urllib2 now supports a malformation in the URL received in a redirect. + +.. + +.. bpo: 0 +.. date: 7088 +.. nonce: 1-8Grp +.. section: Library + +Silence the DeprecationWarning raised when importing mimetools in +BaseHTTPServer, cgi (and rfc822), httplib. + +.. + +.. bpo: 2776 +.. date: 7087 +.. nonce: pcfDP0 +.. section: Library + +fixed small issue when handling a URL with double slash after a 302 response +in the case of not going through a proxy. + +.. + +.. bpo: 2676 +.. date: 7086 +.. nonce: muz1Bh +.. section: Library + +in the email package, content-type parsing was hanging on pathological input +because of quadratic or exponential behaviour of a regular expression. + +.. + +.. bpo: 3476 +.. date: 7085 +.. nonce: Gdp5Hg +.. section: Library + +binary buffered reading through the new "io" library is now thread-safe. + +.. + +.. bpo: 0 +.. date: 7084 +.. nonce: 4jao1V +.. section: Library + +Silence the DeprecationWarning of rfc822 when it is imported by mimetools +since mimetools itself is deprecated. Because modules are cached, all +subsequent imports of rfc822 will not raise a visible DeprecationWarning. + +.. + +.. bpo: 3134 +.. date: 7083 +.. nonce: sGPHeo +.. section: Library + +shutil referenced undefined WindowsError symbol. + +.. + +.. bpo: 1342811 +.. date: 7082 +.. nonce: Mf5TLp +.. section: Library + +Fix leak in Tkinter.Menu.delete. Commands associated to menu entries were +not deleted. + +.. + +.. bpo: 0 +.. date: 7081 +.. nonce: XIC5LX +.. section: Library + +Copied the implementation of reduce() to _functools.reduce() to have a +version that did not raise a DeprecationWarning under -3. + +.. + +.. bpo: 3205 +.. date: 7080 +.. nonce: RcrD2G +.. section: Library + +When iterating over a BZ2File fails allocating memory, raise a MemoryError +rather than silently stop the iteration. + +.. + +.. bpo: 3487 +.. date: 7079 +.. nonce: LoL0Xp +.. section: Library + +sre "bytecode" validator. Passing invalid "re-bytecode" to _sre.compile() +will now be rejected. This should not affect anybody since the re.compile() +function never generates invalid re-bytecode. + +.. + +.. bpo: 3436 +.. date: 7078 +.. nonce: H10Gz5 +.. section: Library + +Make csv.DictReader's fieldnames attribute a property so that upon first +access it can be automatically initialized from the csv file if it wasn't +initialized during instantiation. + +.. + +.. bpo: 2338 +.. date: 7077 +.. nonce: jB97v8 +.. section: Library + +Create imp.reload() to help with transitioning to Python 3.0 as the reload() +built-in has been removed. + +.. + +.. bpo: 0 +.. date: 7076 +.. nonce: YAmZW- +.. section: Library + +Changed code in the following modules/packages to remove warnings raised +while running under the ``-3`` flag: aifc, asynchat, asyncore, bdb, bsddb, +ConfigParser, cookielib, csv, difflib, distutils, DocXMLRPCServer, email, +filecmp, fileinput, inspect, logging, modulefinder, pdb, pickle, profile, +pstats, pydoc, re, rlcompleter, SimpleXMLRPCServer, shelve, socket, +subprocess, sqlite3, tarfile, Tkinter, test.test_support, textwrap, +threading, tokenize, traceback, urlparse, wsgiref, xml, xmlrpclib. + +.. + +.. bpo: 3039 +.. date: 7075 +.. nonce: 6106lp +.. section: Library + +Fix tarfile.TarFileCompat.writestr() which always raised an AttributeError. + +.. + +.. bpo: 2523 +.. date: 7074 +.. nonce: F9osM5 +.. section: Library + +Fix quadratic behaviour when read()ing a binary file without asking for a +specific length. This problem only affected files opened using the new "io" +module, not the built-in open() function. + +.. + +.. bpo: 3449 +.. date: 7073 +.. nonce: HIJRJS +.. section: Library + +Update decimal module to use most recent specification (v. 1.68) and tests +(v. 2.58) from IBM. + +.. + +.. bpo: 3437 +.. date: 7072 +.. nonce: mFS0ML +.. section: Library + +Bug fix in robotparser parsing of Allow: lines. + +.. + +.. bpo: 1592 +.. date: 7071 +.. nonce: zq1SOI +.. section: Library + +Improve error reporting when operations are attempted on a closed shelf. + +.. + +.. bpo: 0 +.. date: 7070 +.. nonce: q6AI_C +.. section: Library + +Deprecate the "ast" parser function aliases. + +.. + +.. bpo: 3120 +.. date: 7069 +.. nonce: x-kAFj +.. section: Library + +On 64-bit Windows the subprocess module was truncating handles. + +.. + +.. bpo: 3303 +.. date: 7068 +.. nonce: MGj8zT +.. section: Library + +Fix a crash in locale.strcoll() when calling it with invalid arguments. + +.. + +.. bpo: 3302 +.. date: 7067 +.. nonce: qnZ5Ic +.. section: Library + +Fix several crashes when calling locale's gettext functions with None +arguments. + +.. + +.. bpo: 3389 +.. date: 7066 +.. nonce: Dhf3EA +.. section: Library + +Allow resolving dotted names for handlers in logging configuration files. + +.. + +.. bpo: 0 +.. date: 7065 +.. nonce: wtYP5i +.. section: Library + +Deprecate the sunaudio module for removal in Python 3.0. + +.. + +.. bpo: 3394 +.. date: 7064 +.. nonce: PDdapW +.. section: Library + +zipfile.writestr sets external attributes when passed a file name rather +than a ZipInfo instance, so files are extracted with mode 0600 rather than +000 under Unix. + +.. + +.. bpo: 1857 +.. date: 7063 +.. nonce: VLu5_h +.. section: Library + +subprocess.Popen.poll gained an additional _deadstate keyword argument in +python 2.5, this broke code that subclassed Popen to include its own poll +method. Fixed my moving _deadstate to an _internal_poll method. + +.. + +.. bpo: 0 +.. date: 7062 +.. nonce: y_hE4z +.. section: Build + +Generate the PatternGrammar pickle during "make install". + +.. + +.. bpo: 2235 +.. date: 7061 +.. nonce: BMunQV +.. section: Documentation + +the C API function PyObject_HashNotImplemented and its interaction with the +tp_hash slot (added in 2.6b2) are now documented + +.. + +.. bpo: 643841 +.. date: 7060 +.. nonce: Dc77Ec +.. section: Documentation + +The language reference now provides more detailed coverage of the lookup +process for special methods. The disclaimers regarding lack of coverage of +new-style classes have also been removed, since the coverage is now fairly +reasonable. diff --git a/Misc/NEWS.d/2.6rc1.rst b/Misc/NEWS.d/2.6rc1.rst new file mode 100644 index 00000000000..8555980cef8 --- /dev/null +++ b/Misc/NEWS.d/2.6rc1.rst @@ -0,0 +1,517 @@ +.. bpo: 3642 +.. date: 7164 +.. nonce: TraQw9 +.. release date: 12-Sep-2008 +.. section: Core and Builtins + +Suppress warning in obmalloc when size_t is larger than uint. + +.. + +.. bpo: 3743 +.. date: 7163 +.. nonce: _AUYYI +.. section: Core and Builtins + +In a few places, PY_FORMAT_SIZE_T was incorrectly used with +PyString_FromFormat or PyErr_Format to display size_t values. The macro +PY_FORMAT_SIZE_T is designed to select the correct format for the OS +``printf`` function, whereas PyString_FromFormat has an independent +implementation and uses "%zd" on all platforms for size_t values. This makes +a difference on win64, where ``printf`` needs "%Id" to display 64bit values. + +.. + +.. bpo: 3634 +.. date: 7162 +.. nonce: q1zzTV +.. section: Core and Builtins + +_weakref.ref(Exception).__init__() gave invalid return value on error. + +.. + +.. bpo: 3777 +.. date: 7161 +.. nonce: NkvE9K +.. section: Core and Builtins + +long() applied to a float object now always return a long object; previously +an int would be returned for small values. the __long__ method is allowed to +return either an int or a long, but the behaviour of float objects should +not change to respect backward compatibility. + +.. + +.. bpo: 3751 +.. date: 7160 +.. nonce: afWsF3 +.. section: Core and Builtins + +str.rpartition would perform a left-partition when called with a unicode +argument. + +.. + +.. bpo: 3683 +.. date: 7159 +.. nonce: CbyWTH +.. section: Core and Builtins + +Fix compilation when --without-threads is given. + +.. + +.. bpo: 3668 +.. date: 7158 +.. nonce: y5pFso +.. section: Core and Builtins + +Fix a memory leak with the "s*" argument parser in PyArg_ParseTuple and +friends, which occurred when the argument for "s*" was correctly parsed but +parsing of subsequent arguments failed. + +.. + +.. bpo: 2534 +.. date: 7157 +.. nonce: ZzJgOR +.. section: Core and Builtins + +speed up isinstance() and issubclass() by 50-70%, so as to match Python 2.5 +speed despite the __instancecheck__ / __subclasscheck__ mechanism. In the +process, fix a bug where isinstance() and issubclass(), when given a tuple +of classes as second argument, were looking up __instancecheck__ / +__subclasscheck__ on the tuple rather than on each type object. + +.. + +.. bpo: 0 +.. date: 7156 +.. nonce: IOhEYG +.. section: Core and Builtins + +Fix crashes on memory allocation failure found with failmalloc. + +.. + +.. bpo: 0 +.. date: 7155 +.. nonce: 7fUtnU +.. section: Core and Builtins + +Fix memory leaks found with valgrind and update suppressions file. + +.. + +.. bpo: 0 +.. date: 7154 +.. nonce: C2iKX_ +.. section: Core and Builtins + +Fix compiler warnings in opt mode which would lead to invalid memory reads. + +.. + +.. bpo: 0 +.. date: 7153 +.. nonce: F8qIAG +.. section: Core and Builtins + +Fix problem using wrong name in decimal module reported by pychecker. + +.. + +.. bpo: 0 +.. date: 7152 +.. nonce: 9G7-79 +.. section: Core and Builtins + +Silenced another compiler warning about a used but not defined function +'stringlib_contains_obj'. + +.. + +.. bpo: 0 +.. date: 7151 +.. nonce: cL5FNH +.. section: Core and Builtins + +Added warnings on the use of ``__getslice__``, ``__setslice__``, or +``__delslice__``. + +.. + +.. bpo: 3678 +.. date: 7150 +.. nonce: tSSebH +.. section: Core and Builtins + +Correctly pass LDFLAGS and LDLAST to the linker on shared library targets in +the Makefile. + +.. + +.. bpo: 1204 +.. date: 7149 +.. nonce: 9IuIp4 +.. section: Core and Builtins + +The configure script now tests for additional libraries that may be required +when linking against readline. This fixes issues with x86_64 builds on some +platforms (a few Linux flavors and OpenBSD). + +.. + +.. bpo: 0 +.. date: 7148 +.. nonce: Amo-aR +.. section: C API + +Aliased PyObject_Bytes to PyObject_Str. + +.. + +.. bpo: 3640 +.. date: 7147 +.. nonce: wZzbae +.. section: Library + +Pickling a list or a dict uses less local variables, to reduce stack usage +in the case of deeply nested objects. + +.. + +.. bpo: 3629 +.. date: 7146 +.. nonce: 2q6K2c +.. section: Library + +Fix sre "bytecode" validator for an end case. + +.. + +.. bpo: 3811 +.. date: 7145 +.. nonce: 1qgQ9c +.. section: Library + +The Unicode database was updated to 5.1. + +.. + +.. bpo: 3781 +.. date: 7144 +.. nonce: HYW5OU +.. section: Library + +Further warnings.catch_warnings() cleanup to prevent silent misbehaviour +when a single instance is nested in multiple with statements, or when the +methods are invoked in the wrong order. + +.. + +.. bpo: 3809 +.. date: 7143 +.. nonce: 2A-aqP +.. section: Library + +Fixed spurious 'test.blah' file left behind by test_logging. + +.. + +.. bpo: 3781 +.. date: 7142 +.. nonce: jpkn0I +.. section: Library + +Clean up the API for warnings.catch_warnings() by having it return a list or +None rather than a custom object. + +.. + +.. bpo: 1638033 +.. date: 7141 +.. nonce: kT2UVI +.. section: Library + +Cookie.Morsel gained the httponly attribute. + +.. + +.. bpo: 3535 +.. date: 7140 +.. nonce: dxRVxE +.. section: Library + +zipfile couldn't read some zip files larger than 2GB. + +.. + +.. bpo: 3776 +.. date: 7139 +.. nonce: Ct7r55 +.. section: Library + +Deprecate the bsddb package for removal in 3.0. + +.. + +.. bpo: 3762 +.. date: 7138 +.. nonce: R3t7Yb +.. section: Library + +platform.architecture() fails if python is lanched via its symbolic link. + +.. + +.. bpo: 3772 +.. date: 7137 +.. nonce: 9RUdoE +.. section: Library + +Fixed regression problem in StreamHandler.emit(). + +.. + +.. bpo: 600362 +.. date: 7136 +.. nonce: bb-Gpk +.. section: Library + +Relocated parse_qs() and parse_qsl(), from the cgi module to the urlparse +one. Added a PendingDeprecationWarning in the old module, it will be +deprecated in the future. + +.. + +.. bpo: 2562 +.. date: 7135 +.. nonce: gvBsX4 +.. section: Library + +Fix distutils PKG-INFO writing logic to allow having non-ascii characters +and Unicode in setup.py meta-data. + +.. + +.. bpo: 3726 +.. date: 7134 +.. nonce: oNy3vR +.. section: Library + +Allow spaces in separators in logging configuration files. + +.. + +.. bpo: 3719 +.. date: 7133 +.. nonce: vt_7GX +.. section: Library + +platform.architecture() fails if there are spaces in the path to the Python +binary. + +.. + +.. bpo: 3602 +.. date: 7132 +.. nonce: SFNmF7 +.. section: Library + +Moved test.test_support.catch_warning() to warnings.catch_warnings() along +with some API cleanup. Expanding the tests for catch_warnings() also led to +an improvement in the raising of a DeprecationWarning related to +warnings.warn_explicit(). + +.. + +.. bpo: 0 +.. date: 7131 +.. nonce: Fxi-Xv +.. section: Library + +The deprecation warnings for the old camelCase threading API were removed. + +.. + +.. bpo: 0 +.. date: 7130 +.. nonce: _Wmj88 +.. section: Library + +logging: fixed lack of use of encoding attribute specified on a stream. + +.. + +.. bpo: 0 +.. date: 7129 +.. nonce: yON-CX +.. section: Library + +Silenced a trivial compiler warning in the sqlite module. + +.. + +.. bpo: 0 +.. date: 7128 +.. nonce: UdFFop +.. section: Library + +Fixed two format strings in the _collections module. + +.. + +.. bpo: 3703 +.. date: 7127 +.. nonce: JVWmi4 +.. section: Library + +_fileio.FileIO gave unhelpful error message when trying to open a directory. + +.. + +.. bpo: 3708 +.. date: 7126 +.. nonce: dbhr5L +.. section: Library + +os.urandom no longer goes into an infinite loop when passed a non-integer +floating point number. + +.. + +.. bpo: 3110 +.. date: 7125 +.. nonce: TXNjN7 +.. section: Library + +multiprocessing fails to compiel on solaris 10 due to missing SEM_VALUE_MAX. + +.. + +.. bpo: 4301 +.. date: 7124 +.. nonce: To_Er1 +.. section: Library + +Patch the logging module to add processName support, remove +_check_logger_class from multiprocessing. + +.. + +.. bpo: 2975 +.. date: 7123 +.. nonce: 3nTVpN +.. section: Library + +When compiling several extension modules with Visual Studio 2008 from the +same python interpreter, some environment variables would grow without +limit. + +.. + +.. bpo: 3643 +.. date: 7122 +.. nonce: r2JHSh +.. section: Library + +Added a few more checks to _testcapi to prevent segfaults by exploitation of +poor argument checking. + +.. + +.. bpo: 0 +.. date: 7121 +.. nonce: WeFjzv +.. section: Library + +sqlite3: Changed docstring of iterdump() to mark method as "Non-standard". + +.. + +.. bpo: 3103 +.. date: 7120 +.. nonce: WO-2NA +.. section: Library + +Reduced globals symbols used by sqlite3 module and made sure all remaining +ones have "pysqlite_" prefix. + +.. + +.. bpo: 3846 +.. date: 7119 +.. nonce: IF6rMt +.. section: Library + +Release the GIL during sqlite3_prepare calls. This improves concurrent +access to the same SQLite database from multiple threads/processes. + +.. + +.. bpo: 3781 +.. date: 7118 +.. nonce: c8hFsy +.. section: Tests + +Add test.test_support.check_warnings() as a convenience wrapper for +warnings.catch_warnings() that makes it easier to check that expected +warning messages are being reported. + +.. + +.. bpo: 3796 +.. date: 7117 +.. nonce: 04E6Gg +.. section: Tests + +Some tests functions were not enabled in test_float. + +.. + +.. bpo: 3768 +.. date: 7116 +.. nonce: wK7GYq +.. section: Tests + +Move test_py3kwarn over to the new API for catch_warnings(). + +.. + +.. bpo: 3833 +.. date: 7115 +.. nonce: 8gZDgB +.. section: Build + +Use a different upgrade code for Win64 installers. + +.. + +.. bpo: 2271 +.. date: 7114 +.. nonce: 8MXC-o +.. section: Build + +Set SecureCustomProperties so that installation will properly use the +TARGETDIR even for unprivileged users. + +.. + +.. bpo: 0 +.. date: 7113 +.. nonce: 4XBUzg +.. section: Build + +Allow passing the MSI file name to merge.py. + +.. + +.. bpo: 3758 +.. date: 7112 +.. nonce: xZ4Rlj +.. section: Build + +Rename the 'check' target to 'patchcheck' so as to not clash with GNU build +target guidelines. diff --git a/Misc/NEWS.d/2.6rc2.rst b/Misc/NEWS.d/2.6rc2.rst new file mode 100644 index 00000000000..37d435d83bc --- /dev/null +++ b/Misc/NEWS.d/2.6rc2.rst @@ -0,0 +1,39 @@ +.. bpo: 0 +.. date: 7168 +.. nonce: 0ihWh2 +.. release date: 17-Sep-2008 +.. section: Library + +Security Issue #2: imageop did not validate arguments correctly and could +segfault as a result. + +.. + +.. bpo: 3886 +.. date: 7167 +.. nonce: l6kzFl +.. section: Library + +Possible integer overflows in the _hashopenssl module were closed. + +.. + +.. bpo: 3850 +.. date: 7166 +.. nonce: AJBbYw +.. section: Tools/Demos + +recursion tests in Tools/scripts/find_recursion_limit.py can raise +AttributeError instead of RuntimeError, depending in which C API call +exactly the recursion limit is exceeded. Consequently, both exception types +are caught and silenced. + +.. + +.. bpo: 3617 +.. date: 7165 +.. nonce: aR1Dim +.. section: Build + +Include a licensing statement regarding the Microsoft C runtime in the +Windows installer. diff --git a/Misc/NEWS.d/2.7.1.rst b/Misc/NEWS.d/2.7.1.rst new file mode 100644 index 00000000000..00072c17bf3 --- /dev/null +++ b/Misc/NEWS.d/2.7.1.rst @@ -0,0 +1,187 @@ +.. bpo: 2236 +.. date: 8293 +.. nonce: 1Mj4VJ +.. release date: 2010-11-27 +.. section: Library + +distutils' mkpath ignored the mode parameter. + +.. + +.. bpo: 0 +.. date: 8292 +.. nonce: NFeWRc +.. section: Library + +Fix typo in one sdist option (medata-check). + +.. + +.. bpo: 10323 +.. date: 8291 +.. nonce: rFKI3X +.. section: Library + +itertools.islice() now consumes the minimum number of inputs before +stopping. Formerly, the final state of the underlying iterator was +undefined. + +.. + +.. bpo: 10565 +.. date: 8290 +.. nonce: g3L9da +.. section: Library + +The collections.Iterator ABC now checks for both ``__iter__`` and ``next``. + +.. + +.. bpo: 10092 +.. date: 8289 +.. nonce: -B7ynY +.. section: Library + +Properly reset locale in calendar.Locale*Calendar classes. + +.. + +.. bpo: 10459 +.. date: 8288 +.. nonce: G0RFoD +.. section: Library + +Update CJK character names to Unicode 5.2. + +.. + +.. bpo: 6098 +.. date: 8287 +.. nonce: CKisab +.. section: Library + +Don't claim DOM level 3 conformance in minidom. + +.. + +.. bpo: 10561 +.. date: 8286 +.. nonce: gxs6bQ +.. section: Library + +In pdb, clear the breakpoints by the breakpoint number. + +.. + +.. bpo: 5762 +.. date: 8285 +.. nonce: ADvGzb +.. section: Library + +Fix AttributeError raised by ``xml.dom.minidom`` when an empty XML namespace +attribute is encountered. + +.. + +.. bpo: 1710703 +.. date: 8284 +.. nonce: NAAh-d +.. section: Library + +Write structures for an empty ZIP archive when a ZipFile is created in modes +'a' or 'w' and then closed without adding any files. Raise BadZipfile +(rather than IOError) when opening small non-ZIP files. + +.. + +.. bpo: 4493 +.. date: 8283 +.. nonce: idMjMG +.. section: Library + +urllib2 adds '/' in front of path components which does not start with '/. +Common behavior exhibited by browsers and other clients. + +.. + +.. bpo: 10407 +.. date: 8282 +.. nonce: f8LrF_ +.. section: Library + +Fix one NameError in distutils. + +.. + +.. bpo: 10198 +.. date: 8281 +.. nonce: 7ruhdY +.. section: Library + +fix duplicate header written to wave files when writeframes() is called +without data. + +.. + +.. bpo: 10467 +.. date: 8280 +.. nonce: uNWGiY +.. section: Library + +Fix BytesIO.readinto() after seeking into a position after the end of the +file. + +.. + +.. bpo: 5111 +.. date: 8279 +.. nonce: XegYFR +.. section: Library + +IPv6 Host in the Header is wrapped inside [ ]. Patch by Chandru. + +.. + +.. bpo: 6378 +.. date: 8278 +.. nonce: ovcYOt +.. section: IDLE + +idle.bat now runs with the appropriate Python version rather than the system +default. Patch by Sridhar Ratnakumar. + +.. + +.. bpo: 0 +.. date: 8277 +.. nonce: 64ssfS +.. section: Build + +Backport r83399 to allow test_distutils to pass on installed versions. + +.. + +.. bpo: 1303434 +.. date: 8276 +.. nonce: AVO6EG +.. section: Build + +Generate ZIP file containing all PDBs. + +.. + +.. bpo: 9424 +.. date: 8275 +.. nonce: BO5Jfa +.. section: Tests + +Replace deprecated assert* methods in the Python test suite. + +.. + +.. bpo: 10299 +.. date: 8274 +.. nonce: ERtbPa +.. section: Documentation + +List the built-in functions in a table in functions.rst. diff --git a/Misc/NEWS.d/2.7.10.rst b/Misc/NEWS.d/2.7.10.rst new file mode 100644 index 00000000000..45e82325a21 --- /dev/null +++ b/Misc/NEWS.d/2.7.10.rst @@ -0,0 +1,7 @@ +.. bpo: 22931 +.. date: 9589 +.. nonce: 4CuWYD +.. release date: 2015-05-23 +.. section: Library + +Allow '[' and ']' in cookie values. diff --git a/Misc/NEWS.d/2.7.10rc1.rst b/Misc/NEWS.d/2.7.10rc1.rst new file mode 100644 index 00000000000..cad34e3b9a2 --- /dev/null +++ b/Misc/NEWS.d/2.7.10rc1.rst @@ -0,0 +1,906 @@ +.. bpo: 23971 +.. date: 9588 +.. nonce: fQZtJr +.. release date: 2015-05-10 +.. section: Core and Builtins + +Fix underestimated presizing in dict.fromkeys(). + +.. + +.. bpo: 23757 +.. date: 9587 +.. nonce: Q9kwY_ +.. section: Core and Builtins + +PySequence_Tuple() incorrectly called the concrete list API when the data +was a list subclass. + +.. + +.. bpo: 23629 +.. date: 9586 +.. nonce: r9Mt2C +.. section: Core and Builtins + +Fix the default __sizeof__ implementation for variable-sized objects. + +.. + +.. bpo: 23055 +.. date: 9585 +.. nonce: rRkRIJ +.. section: Core and Builtins + +Fixed a buffer overflow in PyUnicode_FromFormatV. Analysis and fix by Guido +Vranken. + +.. + +.. bpo: 23048 +.. date: 9584 +.. nonce: X5BUd3 +.. section: Core and Builtins + +Fix jumping out of an infinite while loop in the pdb. + +.. + +.. bpo: 0 +.. date: 9583 +.. nonce: fgX8Qe +.. section: Library + +The keywords attribute of functools.partial is now always a dictionary. + +.. + +.. bpo: 20274 +.. date: 9582 +.. nonce: uVHogg +.. section: Library + +When calling a _sqlite.Connection, it now complains if passed any keyword +arguments. Previously it silently ignored them. + +.. + +.. bpo: 20274 +.. date: 9581 +.. nonce: hBst4M +.. section: Library + +Remove ignored and erroneous "kwargs" parameters from three METH_VARARGS +methods on _sqlite.Connection. + +.. + +.. bpo: 24134 +.. date: 9580 +.. nonce: TT0kHE +.. section: Library + +assertRaises() and assertRaisesRegexp() checks are not longer successful if +the callable is None. + +.. + +.. bpo: 23008 +.. date: 9579 +.. nonce: OZFCd- +.. section: Library + +Fixed resolving attributes with boolean value is False in pydoc. + +.. + +.. bpo: 24099 +.. date: 9578 +.. nonce: 2uAHX7 +.. section: Library + +Fix use-after-free bug in heapq's siftup and siftdown functions. (See also: +bpo-24100, bpo-24101) + +.. + +.. bpo: 0 +.. date: 9577 +.. nonce: OuI94b +.. section: Library + +Backport collections.deque fixes from Python 3.5. Prevents reentrant +badness during deletion by deferring the decref until the container has been +restored to a consistent state. + +.. + +.. bpo: 23842 +.. date: 9576 +.. nonce: 8UD2q_ +.. section: Library + +os.major(), os.minor() and os.makedev() now support ints again. + +.. + +.. bpo: 23811 +.. date: 9575 +.. nonce: B6tzf9 +.. section: Library + +Add missing newline to the PyCompileError error message. Patch by Alex +Shkop. + +.. + +.. bpo: 17898 +.. date: 9574 +.. nonce: EsbCnX +.. section: Library + +Fix exception in gettext.py when parsing certain plural forms. + +.. + +.. bpo: 23865 +.. date: 9573 +.. nonce: PtSLgU +.. section: Library + +close() methods in multiple modules now are idempotent and more robust at +shutdown. If they need to release multiple resources, all are released even +if errors occur. + +.. + +.. bpo: 23881 +.. date: 9572 +.. nonce: CYmvWv +.. section: Library + +urllib.ftpwrapper constructor now closes the socket if the FTP connection +failed. + +.. + +.. bpo: 15133 +.. date: 9571 +.. nonce: iHpkhw +.. section: Library + +_tkinter.tkapp.getboolean() now supports long and Tcl_Obj and always returns +bool. tkinter.BooleanVar now validates input values (accepted bool, int, +long, str, unicode, and Tcl_Obj). tkinter.BooleanVar.get() now always +returns bool. + +.. + +.. bpo: 23338 +.. date: 9570 +.. nonce: ZYMGN1 +.. section: Library + +Fixed formatting ctypes error messages on Cygwin. Patch by Makoto Kato. + +.. + +.. bpo: 16840 +.. date: 9569 +.. nonce: kKIhPm +.. section: Library + +Tkinter now supports 64-bit integers added in Tcl 8.4 and arbitrary +precision integers added in Tcl 8.5. + +.. + +.. bpo: 23834 +.. date: 9568 +.. nonce: 1w5YIz +.. section: Library + +Fix socket.sendto(), use the C long type to store the result of sendto() +instead of the C int type. + +.. + +.. bpo: 21526 +.. date: 9567 +.. nonce: QQEXrR +.. section: Library + +Tkinter now supports new boolean type in Tcl 8.5. + +.. + +.. bpo: 23838 +.. date: 9566 +.. nonce: IX6FPX +.. section: Library + +linecache now clears the cache and returns an empty result on MemoryError. + +.. + +.. bpo: 23742 +.. date: 9565 +.. nonce: _EkAIa +.. section: Library + +ntpath.expandvars() no longer loses unbalanced single quotes. + +.. + +.. bpo: 21802 +.. date: 9564 +.. nonce: ygSM2A +.. section: Library + +The reader in BufferedRWPair now is closed even when closing writer failed +in BufferedRWPair.close(). + +.. + +.. bpo: 23671 +.. date: 9563 +.. nonce: zWPm-a +.. section: Library + +string.Template now allows specifying the "self" parameter as a keyword +argument. string.Formatter now allows specifying the "self" and the +"format_string" parameters as keyword arguments. + +.. + +.. bpo: 21560 +.. date: 9562 +.. nonce: lqfYv8 +.. section: Library + +An attempt to write a data of wrong type no longer cause GzipFile +corruption. Original patch by Wolfgang Maier. + +.. + +.. bpo: 23647 +.. date: 9561 +.. nonce: pX2qrx +.. section: Library + +Increase impalib's MAXLINE to accommodate modern mailbox sizes. + +.. + +.. bpo: 23539 +.. date: 9560 +.. nonce: 5BVUim +.. section: Library + +If body is None, http.client.HTTPConnection.request now sets Content-Length +to 0 for PUT, POST, and PATCH headers to avoid 411 errors from some web +servers. + +.. + +.. bpo: 23136 +.. date: 9559 +.. nonce: 1bnpnb +.. section: Library + +_strptime now uniformly handles all days in week 0, including Dec 30 of +previous year. Based on patch by Jim Carroll. + +.. + +.. bpo: 23138 +.. date: 9558 +.. nonce: 4vMoMZ +.. section: Library + +Fixed parsing cookies with absent keys or values in cookiejar. Patch by +Demian Brecht. + +.. + +.. bpo: 23051 +.. date: 9557 +.. nonce: Vi5tCZ +.. section: Library + +multiprocessing.Pool methods imap() and imap_unordered() now handle +exceptions raised by an iterator. Patch by Alon Diamant and Davin Potts. + +.. + +.. bpo: 22928 +.. date: 9556 +.. nonce: 1bJJIG +.. section: Library + +Disabled HTTP header injections in httplib. Original patch by Demian Brecht. + +.. + +.. bpo: 23615 +.. date: 9555 +.. nonce: SRSoav +.. section: Library + +Module tarfile is now can be reloaded with imp.reload(). + +.. + +.. bpo: 22853 +.. date: 9554 +.. nonce: LUBedC +.. section: Library + +Fixed a deadlock when use multiprocessing.Queue at import time. Patch by +Florian Finkernagel and Davin Potts. + +.. + +.. bpo: 23476 +.. date: 9553 +.. nonce: 82QV9I +.. section: Library + +In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST flag on +certificate stores when it is available. + +.. + +.. bpo: 23576 +.. date: 9552 +.. nonce: 98F-PP +.. section: Library + +Avoid stalling in SSL reads when EOF has been reached in the SSL layer but +the underlying connection hasn't been closed. + +.. + +.. bpo: 23504 +.. date: 9551 +.. nonce: o31h5I +.. section: Library + +Added an __all__ to the types module. + +.. + +.. bpo: 23458 +.. date: 9550 +.. nonce: QGBFRr +.. section: Library + +On POSIX, the file descriptor kept open by os.urandom() is now set to non +inheritable + +.. + +.. bpo: 22113 +.. date: 9549 +.. nonce: L5Fo5c +.. section: Library + +struct.pack_into() now supports new buffer protocol (in particular accepts +writable memoryview). + +.. + +.. bpo: 814253 +.. date: 9548 +.. nonce: AJWDsY +.. section: Library + +Warnings now are raised when group references and conditional group +references are used in lookbehind assertions in regular expressions. (See +also: bpo-9179) + +.. + +.. bpo: 23215 +.. date: 9547 +.. nonce: VHVSVX +.. section: Library + +Multibyte codecs with custom error handlers that ignores errors consumed too +much memory and raised SystemError or MemoryError. Original patch by Aleksi +Torhamo. + +.. + +.. bpo: 5700 +.. date: 9546 +.. nonce: iA5yzL +.. section: Library + +io.FileIO() called flush() after closing the file. flush() was not called in +close() if closefd=False. + +.. + +.. bpo: 21548 +.. date: 9545 +.. nonce: Rr1l-c +.. section: Library + +Fix pydoc.synopsis() and pydoc.apropos() on modules with empty docstrings. +Initial patch by Yuyang Guo. + +.. + +.. bpo: 22885 +.. date: 9544 +.. nonce: c3937m +.. section: Library + +Fixed arbitrary code execution vulnerability in the dumbdbm module. +Original patch by Claudiu Popa. + +.. + +.. bpo: 23481 +.. date: 9543 +.. nonce: ZWwliG +.. section: Library + +Remove RC4 from the SSL module's default cipher list. + +.. + +.. bpo: 21849 +.. date: 9542 +.. nonce: XUnTp8 +.. section: Library + +Fixed xmlrpclib serialization of non-ASCII unicode strings in the +multiprocessing module. + +.. + +.. bpo: 21840 +.. date: 9541 +.. nonce: PrOwSC +.. section: Library + +Fixed expanding unicode variables of form $var in posixpath.expandvars(). +Fixed all os.path implementations on unicode-disabled builds. + +.. + +.. bpo: 23367 +.. date: 9540 +.. nonce: kHnFiz +.. section: Library + +Fix possible overflows in the unicodedata module. + +.. + +.. bpo: 23363 +.. date: 9539 +.. nonce: -koaol +.. section: Library + +Fix possible overflow in itertools.permutations. + +.. + +.. bpo: 23364 +.. date: 9538 +.. nonce: 3yBV-6 +.. section: Library + +Fix possible overflow in itertools.product. + +.. + +.. bpo: 23365 +.. date: 9537 +.. nonce: h5jLQ9 +.. section: Library + +Fixed possible integer overflow in itertools.combinations_with_replacement. + +.. + +.. bpo: 23366 +.. date: 9536 +.. nonce: tyAfm8 +.. section: Library + +Fixed possible integer overflow in itertools.combinations. + +.. + +.. bpo: 23191 +.. date: 9535 +.. nonce: 55Cwcb +.. section: Library + +fnmatch functions that use caching are now threadsafe. + +.. + +.. bpo: 18518 +.. date: 9534 +.. nonce: JXgicC +.. section: Library + +timeit now rejects statements which can't be compiled outside a function or +a loop (e.g. "return" or "break"). + +.. + +.. bpo: 19996 +.. date: 9533 +.. nonce: FvMyH0 +.. section: Library + +Make :mod:`httplib` ignore headers with no name rather than assuming the +body has started. + +.. + +.. bpo: 20188 +.. date: 9532 +.. nonce: xocY-2 +.. section: Library + +Support Application-Layer Protocol Negotiation (ALPN) in the ssl module. + +.. + +.. bpo: 23248 +.. date: 9531 +.. nonce: FjcyCP +.. section: Library + +Update ssl error codes from latest OpenSSL git master. + +.. + +.. bpo: 23098 +.. date: 9530 +.. nonce: 7VwF3K +.. section: Library + +64-bit dev_t is now supported in the os module. + +.. + +.. bpo: 23063 +.. date: 9529 +.. nonce: 9-UJRs +.. section: Library + +In the disutils' check command, fix parsing of reST with code or code-block +directives. + +.. + +.. bpo: 21356 +.. date: 9528 +.. nonce: 8NY75J +.. section: Library + +Make ssl.RAND_egd() optional to support LibreSSL. The availability of the +function is checked during the compilation. Patch written by Bernard Spil. + +.. + +.. bpo: 0 +.. date: 9527 +.. nonce: SZRSxn +.. section: Library + +Backport the context argument to ftplib.FTP_TLS. + +.. + +.. bpo: 23111 +.. date: 9526 +.. nonce: A6CAZK +.. section: Library + +Maximize compatibility in protocol versions of ftplib.FTP_TLS. + +.. + +.. bpo: 23112 +.. date: 9525 +.. nonce: dZGf82 +.. section: Library + +Fix SimpleHTTPServer to correctly carry the query string and fragment when +it redirects to add a trailing slash. + +.. + +.. bpo: 22585 +.. date: 9524 +.. nonce: F4BkNo +.. section: Library + +On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), instead of +reading /dev/urandom, to get pseudo-random bytes. + +.. + +.. bpo: 23093 +.. date: 9523 +.. nonce: cP7OqD +.. section: Library + +In the io, module allow more operations to work on detached streams. + +.. + +.. bpo: 23071 +.. date: 9522 +.. nonce: 3BSqF7 +.. section: Library + +Added missing names to codecs.__all__. Patch by Martin Panter. + +.. + +.. bpo: 23016 +.. date: 9521 +.. nonce: wctkY3 +.. section: Library + +A warning no longer produces an AttributeError when sys.stderr is None. + +.. + +.. bpo: 21032 +.. date: 9520 +.. nonce: wxT_41 +.. section: Library + +Fixed socket leak if HTTPConnection.getresponse() fails. Original patch by +Martin Panter. + +.. + +.. bpo: 22609 +.. date: 9519 +.. nonce: mmLoeb +.. section: Library + +Constructors and update methods of mapping classes in the collections module +now accept the self keyword argument. + +.. + +.. bpo: 23006 +.. date: 9518 +.. nonce: 6-u4Mv +.. section: Documentation + +Improve the documentation and indexing of dict.__missing__. Add an entry in +the language datamodel special methods section. Revise and index its +discussion in the stdtypes mapping/dict section. Backport the code example +from 3.4. + +.. + +.. bpo: 21514 +.. date: 9517 +.. nonce: 1H16T6 +.. section: Documentation + +The documentation of the json module now refers to new JSON RFC 7159 instead +of obsoleted RFC 4627. + +.. + +.. bpo: 23330 +.. date: 9516 +.. nonce: LTlKDp +.. section: Tools/Demos + +h2py now supports arbitrary filenames in #include. + +.. + +.. bpo: 6639 +.. date: 9515 +.. nonce: rmjUmG +.. section: Tools/Demos + +Module-level turtle functions no longer raise TclError after closing the +window. + +.. + +.. bpo: 22314 +.. date: 9514 +.. nonce: ws6xsH +.. section: Tools/Demos + +pydoc now works when the LINES environment variable is set. + +.. + +.. bpo: 18905 +.. date: 9513 +.. nonce: oKTvz5 +.. section: Tools/Demos + +"pydoc -p 0" now outputs actually used port. Based on patch by Wieland +Hoffmann. + +.. + +.. bpo: 23345 +.. date: 9512 +.. nonce: HIGBKx +.. section: Tools/Demos + +Prevent test_ssl failures with large OpenSSL patch level values (like +0.9.8zc). + +.. + +.. bpo: 23799 +.. date: 9511 +.. nonce: IZtmH_ +.. section: Tests + +Added test.test_support.start_threads() for running and cleaning up multiple +threads. + +.. + +.. bpo: 22390 +.. date: 9510 +.. nonce: UPVFnq +.. section: Tests + +test.regrtest now emits a warning if temporary files or directories are left +after running a test. + +.. + +.. bpo: 23583 +.. date: 9509 +.. nonce: bY8AbM +.. section: Tests + +Added tests for standard IO streams in IDLE. + +.. + +.. bpo: 23392 +.. date: 9508 +.. nonce: Pe7_WK +.. section: Tests + +Added tests for marshal C API that works with FILE*. + +.. + +.. bpo: 18982 +.. date: 9507 +.. nonce: TynSM6 +.. section: Tests + +Add tests for CLI of the calendar module. + +.. + +.. bpo: 19949 +.. date: 9506 +.. nonce: yw7T54 +.. section: Tests + +The test_xpickle test now tests compatibility with installed Python 2.7 and +reports skipped tests. Based on patch by Zachary Ware. + +.. + +.. bpo: 11578 +.. date: 9505 +.. nonce: 1IaAXh +.. section: Tests + +Backported test for the timeit module. + +.. + +.. bpo: 22943 +.. date: 9504 +.. nonce: t0MW3A +.. section: Tests + +bsddb tests are locale independend now. + +.. + +.. bpo: 23583 +.. date: 9503 +.. nonce: ApIRL5 +.. section: IDLE + +Fixed writing unicode to standard output stream in IDLE. + +.. + +.. bpo: 20577 +.. date: 9502 +.. nonce: Y71IMj +.. section: IDLE + +Configuration of the max line length for the FormatParagraph extension has +been moved from the General tab of the Idle preferences dialog to the +FormatParagraph tab of the Config Extensions dialog. Patch by Tal Einat. + +.. + +.. bpo: 16893 +.. date: 9501 +.. nonce: JfHAA4 +.. section: IDLE + +Update Idle doc chapter to match current Idle and add new information. + +.. + +.. bpo: 23180 +.. date: 9500 +.. nonce: cE_89F +.. section: IDLE + +Rename IDLE "Windows" menu item to "Window". Patch by Al Sweigart. + +.. + +.. bpo: 15506 +.. date: 9499 +.. nonce: nh8KlR +.. section: Build + +Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure script. + +.. + +.. bpo: 23032 +.. date: 9498 +.. nonce: F8fiIl +.. section: Build + +Fix installer build failures on OS X 10.4 Tiger by disabling assembly code +in the OpenSSL build. + +.. + +.. bpo: 23686 +.. date: 9497 +.. nonce: QZBsvh +.. section: Build + +Update OS X 10.5 installer and Windows builds to use OpenSSL 1.0.2a. + +.. + +.. bpo: 23998 +.. date: 9496 +.. nonce: z7mlLW +.. section: C API + +PyImport_ReInitLock() now checks for lock allocation error + +.. + +.. bpo: 22079 +.. date: 9495 +.. nonce: zhs2qM +.. section: C API + +PyType_Ready() now checks that statically allocated type has no dynamically +allocated bases. diff --git a/Misc/NEWS.d/2.7.11.rst b/Misc/NEWS.d/2.7.11.rst new file mode 100644 index 00000000000..bb8fd15845a --- /dev/null +++ b/Misc/NEWS.d/2.7.11.rst @@ -0,0 +1,8 @@ +.. bpo: 25624 +.. date: 9702 +.. nonce: ed-fM0 +.. release date: 2015-12-05 +.. section: Library + +ZipFile now always writes a ZIP_STORED header for directory entries. Patch +by Dingyuan Wang. diff --git a/Misc/NEWS.d/2.7.11rc1.rst b/Misc/NEWS.d/2.7.11rc1.rst new file mode 100644 index 00000000000..f995ed0aff1 --- /dev/null +++ b/Misc/NEWS.d/2.7.11rc1.rst @@ -0,0 +1,1127 @@ +.. bpo: 25678 +.. date: 9701 +.. nonce: aOCs4y +.. release date: 2015-11-21 +.. section: Core and Builtins + +Avoid buffer overreads when int(), long(), float(), and compile() are passed +buffer objects. These objects are not necessarily terminated by a null +byte, but the functions assumed they were. + +.. + +.. bpo: 25388 +.. date: 9700 +.. nonce: Yl4HRL +.. section: Core and Builtins + +Fixed tokenizer hang when processing undecodable source code with a null +byte. + +.. + +.. bpo: 22995 +.. date: 9699 +.. nonce: 90kpuP +.. section: Core and Builtins + +Default implementation of __reduce__ and __reduce_ex__ now rejects builtin +types with not defined __new__. + +.. + +.. bpo: 7267 +.. date: 9698 +.. nonce: eje_k4 +.. section: Core and Builtins + +format(int, 'c') now raises OverflowError when the argument is not in +range(0, 256). + +.. + +.. bpo: 24806 +.. date: 9697 +.. nonce: Nb0znT +.. section: Core and Builtins + +Prevent builtin types that are not allowed to be subclassed from being +subclassed through multiple inheritance. + +.. + +.. bpo: 24848 +.. date: 9696 +.. nonce: HlUSuy +.. section: Core and Builtins + +Fixed a number of bugs in UTF-7 decoding of misformed data. + +.. + +.. bpo: 25003 +.. date: 9695 +.. nonce: -bdxOl +.. section: Core and Builtins + +os.urandom() doesn't use getentropy() on Solaris because getentropy() is +blocking, whereas os.urandom() should not block. getentropy() is supported +since Solaris 11.3. + +.. + +.. bpo: 21167 +.. date: 9694 +.. nonce: uom-Dq +.. section: Core and Builtins + +NAN operations are now handled correctly when python is compiled with ICC +even if -fp-model strict is not specified. + +.. + +.. bpo: 24467 +.. date: 9693 +.. nonce: BAJ80- +.. section: Core and Builtins + +Fixed possible buffer over-read in bytearray. The bytearray object now +always allocates place for trailing null byte and it's buffer now is always +null-terminated. + +.. + +.. bpo: 19543 +.. date: 9692 +.. nonce: OT7JMe +.. section: Core and Builtins + +encode() and decode() methods and constructors of str, unicode and bytearray +classes now emit deprecation warning for known non-text encodings when +Python is ran with the -3 option. + +.. + +.. bpo: 24115 +.. date: 9691 +.. nonce: y9e_MO +.. section: Core and Builtins + +Update uses of PyObject_IsTrue(), PyObject_Not(), PyObject_IsInstance(), +PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle +errors correctly. + +.. + +.. bpo: 4753 +.. date: 9690 +.. nonce: o7jpYf +.. section: Core and Builtins + +On compilers where it is supported, use "computed gotos" for bytecode +dispatch in the interpreter. This improves interpretation performance. + +.. + +.. bpo: 22939 +.. date: 9689 +.. nonce: grBMzV +.. section: Core and Builtins + +Fixed integer overflow in iterator object. Original patch by Clement +Rouault. + +.. + +.. bpo: 24102 +.. date: 9688 +.. nonce: 9T6h3m +.. section: Core and Builtins + +Fixed exception type checking in standard error handlers. + +.. + +.. bpo: 10128 +.. date: 9687 +.. nonce: 0pRKCf +.. section: Library + +backport issue #10845's mitigation of incompatibilities between the +multiprocessing module and directory and zipfile execution. Multiprocessing +on Windows will now automatically skip rerunning __main__ in spawned +processes, rather than failing with AssertionError. + +.. + +.. bpo: 25578 +.. date: 9686 +.. nonce: G6S-ft +.. section: Library + +Fix (another) memory leak in SSLSocket.getpeercer(). + +.. + +.. bpo: 25590 +.. date: 9685 +.. nonce: aCt-yW +.. section: Library + +In the Readline completer, only call getattr() once per attribute. + +.. + +.. bpo: 25530 +.. date: 9684 +.. nonce: hDFkwu +.. section: Library + +Disable the vulnerable SSLv3 protocol by default when creating +ssl.SSLContext. + +.. + +.. bpo: 25569 +.. date: 9683 +.. nonce: CfvQjK +.. section: Library + +Fix memory leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 7759 +.. date: 9682 +.. nonce: a72qAb +.. section: Library + +Fixed the mhlib module on filesystems that doesn't support link counting for +directories. + +.. + +.. bpo: 892902 +.. date: 9681 +.. nonce: V_kMwt +.. section: Library + +Fixed pickling recursive objects. + +.. + +.. bpo: 18010 +.. date: 9680 +.. nonce: pHcjnp +.. section: Library + +Fix the pydoc GUI's search function to handle exceptions from importing +packages. + +.. + +.. bpo: 25515 +.. date: 9679 +.. nonce: fQsyYG +.. section: Library + +Always use os.urandom as a source of randomness in uuid.uuid4. + +.. + +.. bpo: 21827 +.. date: 9678 +.. nonce: k2oreR +.. section: Library + +Fixed textwrap.dedent() for the case when largest common whitespace is a +substring of smallest leading whitespace. Based on patch by Robert Li. + +.. + +.. bpo: 21709 +.. date: 9677 +.. nonce: hiATOK +.. section: Library + +Fix the logging module to not depend upon __file__ being set properly to get +the filename of its caller from the stack. This allows it to work if run in +a frozen or embedded environment where the module's .__file__ attribute does +not match its code object's .co_filename. + +.. + +.. bpo: 25319 +.. date: 9676 +.. nonce: iyuglv +.. section: Library + +When threading.Event is reinitialized, the underlying condition should use a +regular lock rather than a recursive lock. + +.. + +.. bpo: 25232 +.. date: 9675 +.. nonce: KhKjCE +.. section: Library + +Fix CGIRequestHandler to split the query from the URL at the first question +mark (?) rather than the last. Patch from Xiang Zhang. + +.. + +.. bpo: 24657 +.. date: 9674 +.. nonce: h2Ag7y +.. section: Library + +Prevent CGIRequestHandler from collapsing slashes in the query part of the +URL as if it were a path. Patch from Xiang Zhang. + +.. + +.. bpo: 22958 +.. date: 9673 +.. nonce: 04wca1 +.. section: Library + +Constructor and update method of weakref.WeakValueDictionary now accept the +self keyword argument. + +.. + +.. bpo: 22609 +.. date: 9672 +.. nonce: aTCKbk +.. section: Library + +Constructor and the update method of collections.UserDict now accept the +self keyword argument. + +.. + +.. bpo: 25203 +.. date: 9671 +.. nonce: IgDEbt +.. section: Library + +Failed readline.set_completer_delims() no longer left the module in +inconsistent state. + +.. + +.. bpo: 19143 +.. date: 9670 +.. nonce: 76SBSO +.. section: Library + +platform module now reads Windows version from kernel32.dll to avoid +compatibility shims. + +.. + +.. bpo: 25135 +.. date: 9669 +.. nonce: gVHNy- +.. section: Library + +Make deque_clear() safer by emptying the deque before clearing. This helps +avoid possible reentrancy issues. + +.. + +.. bpo: 24684 +.. date: 9668 +.. nonce: 7ewUAL +.. section: Library + +socket.socket.getaddrinfo() now calls PyUnicode_AsEncodedString() instead of +calling the encode() method of the host, to handle correctly custom unicode +string with an encode() method which doesn't return a byte string. The +encoder of the IDNA codec is now called directly instead of calling the +encode() method of the string. + +.. + +.. bpo: 24982 +.. date: 9667 +.. nonce: sGMMAR +.. section: Library + +shutil.make_archive() with the "zip" format now adds entries for directories +(including empty directories) in ZIP file. + +.. + +.. bpo: 17849 +.. date: 9666 +.. nonce: prwvGY +.. section: Library + +Raise a sensible exception if an invalid response is received for a HTTP +tunnel request, as seen with some servers that do not support tunnelling. +Initial patch from Cory Benfield. + +.. + +.. bpo: 16180 +.. date: 9665 +.. nonce: 6IUcNS +.. section: Library + +Exit pdb if file has syntax error, instead of trapping user in an infinite +loop. Patch by Xavier de Gaye. + +.. + +.. bpo: 22812 +.. date: 9664 +.. nonce: kLCF0G +.. section: Library + +Fix unittest discovery examples. Patch from Pam McA'Nulty. + +.. + +.. bpo: 24634 +.. date: 9663 +.. nonce: 7bnVgr +.. section: Library + +Importing uuid should not try to load libc on Windows + +.. + +.. bpo: 23652 +.. date: 9662 +.. nonce: DdZRSr +.. section: Library + +Make it possible to compile the select module against the libc headers from +the Linux Standard Base, which do not include some EPOLL macros. Initial +patch by Matt Frank. + +.. + +.. bpo: 15138 +.. date: 9661 +.. nonce: PXj7mj +.. section: Library + +Speed up base64.urlsafe_b64{en,de}code considerably. + +.. + +.. bpo: 23319 +.. date: 9660 +.. nonce: FXyUH- +.. section: Library + +Fix ctypes.BigEndianStructure, swap correctly bytes. Patch written by +Matthieu Gautier. + +.. + +.. bpo: 23254 +.. date: 9659 +.. nonce: zNiy1X +.. section: Library + +Document how to close the TCPServer listening socket. Patch from Martin +Panter. + +.. + +.. bpo: 17527 +.. date: 9658 +.. nonce: ve9fyw +.. section: Library + +Add PATCH to wsgiref.validator. Patch from Luca Sbardella. + +.. + +.. bpo: 24613 +.. date: 9657 +.. nonce: QZrd_P +.. section: Library + +Calling array.fromstring() with self is no longer allowed to prevent the +use-after-free error. Patch by John Leitch. + +.. + +.. bpo: 24708 +.. date: 9656 +.. nonce: WIZWbu +.. section: Library + +Fix possible integer overflow in strop.replace(). + +.. + +.. bpo: 24620 +.. date: 9655 +.. nonce: rrnxB- +.. section: Library + +Random.setstate() now validates the value of state last element. + +.. + +.. bpo: 13938 +.. date: 9654 +.. nonce: e5NSE1 +.. section: Library + +2to3 converts StringTypes to a tuple. Patch from Mark Hammond. + +.. + +.. bpo: 24611 +.. date: 9653 +.. nonce: _KNs8d +.. section: Library + +Fixed compiling the posix module on non-Windows platforms without mknod() or +makedev() (e.g. on Unixware). + +.. + +.. bpo: 18684 +.. date: 9652 +.. nonce: S2es0F +.. section: Library + +Fixed reading out of the buffer in the re module. + +.. + +.. bpo: 24259 +.. date: 9651 +.. nonce: vMAi1A +.. section: Library + +tarfile now raises a ReadError if an archive is truncated inside a data +segment. + +.. + +.. bpo: 24514 +.. date: 9650 +.. nonce: _xRb2r +.. section: Library + +tarfile now tolerates number fields consisting of only whitespace. + +.. + +.. bpo: 20387 +.. date: 9649 +.. nonce: aAbWbQ +.. section: Library + +Restore semantic round-trip correctness in tokenize/untokenize for tab- +indented blocks. + +.. + +.. bpo: 24456 +.. date: 9648 +.. nonce: swkJgS +.. section: Library + +Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() functions of +the audioop module. Fixed SystemError when the state is not a tuple. Fixed +possible memory leak. + +.. + +.. bpo: 24481 +.. date: 9647 +.. nonce: EsJTQ7 +.. section: Library + +Fix possible memory corruption with large profiler info strings in hotshot. + +.. + +.. bpo: 24489 +.. date: 9646 +.. nonce: GJnMcW +.. section: Library + +ensure a previously set C errno doesn't disturb cmath.polar(). + +.. + +.. bpo: 19543 +.. date: 9645 +.. nonce: 8XxBDj +.. section: Library + +io.TextIOWrapper (and hence io.open()) now uses the internal codec marking +system added to emit deprecation warning for known non-text encodings at +stream construction time when Python is ran with the -3 option. + +.. + +.. bpo: 24264 +.. date: 9644 +.. nonce: 3zMc38 +.. section: Library + +Fixed buffer overflow in the imageop module. + +.. + +.. bpo: 5633 +.. date: 9643 +.. nonce: JNzKZq +.. section: Library + +Fixed timeit when the statement is a string and the setup is not. + +.. + +.. bpo: 24326 +.. date: 9642 +.. nonce: 4t_6Gy +.. section: Library + +Fixed audioop.ratecv() with non-default weightB argument. Original patch by +David Moore. + +.. + +.. bpo: 22095 +.. date: 9641 +.. nonce: iISzxM +.. section: Library + +Fixed HTTPConnection.set_tunnel with default port. The port value in the +host header was set to "None". Patch by Demian Brecht. + +.. + +.. bpo: 24257 +.. date: 9640 +.. nonce: L_efq0 +.. section: Library + +Fixed segmentation fault in sqlite3.Row constructor with faked cursor type. + +.. + +.. bpo: 24286 +.. date: 9639 +.. nonce: QTU65z +.. section: Library + +Dict view were not registered with the MappingView abstract base classes. +This caused key and item views in OrderedDict to not be equal to their +regular dict counterparts. + +.. + +.. bpo: 22107 +.. date: 9638 +.. nonce: 2F8k4W +.. section: Library + +tempfile.gettempdir() and tempfile.mkdtemp() now try again when a directory +with the chosen name already exists on Windows as well as on Unix. +tempfile.mkstemp() now fails early if parent directory is not valid (not +exists or is a file) on Windows. + +.. + +.. bpo: 6598 +.. date: 9637 +.. nonce: JdZNDt +.. section: Library + +Increased time precision and random number range in email.utils.make_msgid() +to strengthen the uniqueness of the message ID. + +.. + +.. bpo: 24091 +.. date: 9636 +.. nonce: vBNeTI +.. section: Library + +Fixed various crashes in corner cases in cElementTree. + +.. + +.. bpo: 15267 +.. date: 9635 +.. nonce: xT65mc +.. section: Library + +HTTPConnection.request() now is compatible with old-style classes (such as +TemporaryFile). Original patch by Atsuo Ishimoto. + +.. + +.. bpo: 20014 +.. date: 9634 +.. nonce: NfHQd1 +.. section: Library + +array.array() now accepts unicode typecodes. Based on patch by Vajrasky +Kok. + +.. + +.. bpo: 23637 +.. date: 9633 +.. nonce: 1yFWAy +.. section: Library + +Showing a warning no longer fails with UnicodeError. Formatting unicode +warning in the file with the path containing non-ascii characters no longer +fails with UnicodeError. + +.. + +.. bpo: 24134 +.. date: 9632 +.. nonce: 4cPfh1 +.. section: Library + +Reverted issue #24134 changes. + +.. + +.. bpo: 15348 +.. date: 9631 +.. nonce: d1Fg01 +.. section: IDLE + +Stop the debugger engine (normally in a user process) before closing the +debugger window (running in the IDLE process). This prevents the +RuntimeErrors that were being caught and ignored. + +.. + +.. bpo: 24455 +.. date: 9630 +.. nonce: x6YqtE +.. section: IDLE + +Prevent IDLE from hanging when a) closing the shell while the debugger is +active (15347); b) closing the debugger with the [X] button (15348); and c) +activating the debugger when already active (24455). The patch by Mark +Roseman does this by making two changes. 1. Suspend and resume the +gui.interaction method with the tcl vwait mechanism intended for this +purpose (instead of root.mainloop & .quit). 2. In gui.run, allow any +existing interaction to terminate first. + +.. + +.. bpo: 0 +.. date: 9629 +.. nonce: Yp9LRY +.. section: IDLE + +Change 'The program' to 'Your program' in an IDLE 'kill program?' message to +make it clearer that the program referred to is the currently running user +program, not IDLE itself. + +.. + +.. bpo: 24750 +.. date: 9628 +.. nonce: xgsi-K +.. section: IDLE + +Improve the appearance of the IDLE editor window status bar. Patch by Mark +Roseman. + +.. + +.. bpo: 25313 +.. date: 9627 +.. nonce: xMXHpO +.. section: IDLE + +Change the handling of new built-in text color themes to better address the +compatibility problem introduced by the addition of IDLE Dark. Consistently +use the revised idleConf.CurrentTheme everywhere in idlelib. + +.. + +.. bpo: 24782 +.. date: 9626 +.. nonce: PCsWad +.. section: IDLE + +Extension configuration is now a tab in the IDLE Preferences dialog rather +than a separate dialog. The former tabs are now a sorted list. Patch by +Mark Roseman. + +.. + +.. bpo: 22726 +.. date: 9625 +.. nonce: x8T0dA +.. section: IDLE + +Re-activate the config dialog help button with some content about the other +buttons and the new IDLE Dark theme. + +.. + +.. bpo: 24820 +.. date: 9624 +.. nonce: TFPJhr +.. section: IDLE + +IDLE now has an 'IDLE Dark' built-in text color theme. It is more or less +IDLE Classic inverted, with a cobalt blue background. Strings, comments, +keywords, ... are still green, red, orange, ... . To use it with IDLEs +released before November 2015, hit the 'Save as New Custom Theme' button and +enter a new name, such as 'Custom Dark'. The custom theme will work with +any IDLE release, and can be modified. + +.. + +.. bpo: 25224 +.. date: 9623 +.. nonce: 5Llwo4 +.. section: IDLE + +README.txt is now an idlelib index for IDLE developers and curious users. +The previous user content is now in the IDLE doc chapter. 'IDLE' now means +'Integrated Development and Learning Environment'. + +.. + +.. bpo: 24820 +.. date: 9622 +.. nonce: ZUz9Fn +.. section: IDLE + +Users can now set breakpoint colors in Settings -> Custom Highlighting. +Original patch by Mark Roseman. + +.. + +.. bpo: 24972 +.. date: 9621 +.. nonce: uc0uNo +.. section: IDLE + +Inactive selection background now matches active selection background, as +configured by users, on all systems. Found items are now always highlighted +on Windows. Initial patch by Mark Roseman. + +.. + +.. bpo: 24570 +.. date: 9620 +.. nonce: s3EkNn +.. section: IDLE + +Idle: make calltip and completion boxes appear on Macs affected by a tk +regression. Initial patch by Mark Roseman. + +.. + +.. bpo: 24988 +.. date: 9619 +.. nonce: tXqq4T +.. section: IDLE + +Idle ScrolledList context menus (used in debugger) now work on Mac Aqua. +Patch by Mark Roseman. + +.. + +.. bpo: 24801 +.. date: 9618 +.. nonce: -bj_Ou +.. section: IDLE + +Make right-click for context menu work on Mac Aqua. Patch by Mark Roseman. + +.. + +.. bpo: 25173 +.. date: 9617 +.. nonce: EZzrPg +.. section: IDLE + +Associate tkinter messageboxes with a specific widget. For Mac OSX, make +them a 'sheet'. Patch by Mark Roseman. + +.. + +.. bpo: 25198 +.. date: 9616 +.. nonce: -j_BV7 +.. section: IDLE + +Enhance the initial html viewer now used for Idle Help. * Properly indent +fixed-pitch text (patch by Mark Roseman). * Give code snippet a very Sphinx- +like light blueish-gray background. * Re-use initial width and height set by +users for shell and editor. * When the Table of Contents (TOC) menu is used, +put the section header at the top of the screen. + +.. + +.. bpo: 25225 +.. date: 9615 +.. nonce: 9pvdq6 +.. section: IDLE + +Condense and rewrite Idle doc section on text colors. + +.. + +.. bpo: 21995 +.. date: 9614 +.. nonce: C5Rmzx +.. section: IDLE + +Explain some differences between IDLE and console Python. + +.. + +.. bpo: 22820 +.. date: 9613 +.. nonce: hix_8X +.. section: IDLE + +Explain need for *print* when running file from Idle editor. + +.. + +.. bpo: 25224 +.. date: 9612 +.. nonce: UVMYQq +.. section: IDLE + +Doc: augment Idle feature list and no-subprocess section. + +.. + +.. bpo: 25219 +.. date: 9611 +.. nonce: 8_9DYg +.. section: IDLE + +Update doc for Idle command line options. Some were missing and notes were +not correct. + +.. + +.. bpo: 24861 +.. date: 9610 +.. nonce: Ecg2yT +.. section: IDLE + +Most of idlelib is private and subject to change. Use idleib.idle.* to start +Idle. See idlelib.__init__.__doc__. + +.. + +.. bpo: 25199 +.. date: 9609 +.. nonce: ih7yY3 +.. section: IDLE + +Idle: add synchronization comments for future maintainers. + +.. + +.. bpo: 16893 +.. date: 9608 +.. nonce: bZtPgJ +.. section: IDLE + +Replace help.txt with help.html for Idle doc display. The new +idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks +better than help.txt and will better document Idle as released. The tkinter +html viewer that works for this file was written by Mark Roseman. The now +unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +.. + +.. bpo: 24199 +.. date: 9607 +.. nonce: VKnZEv +.. section: IDLE + +Deprecate unused idlelib.idlever with possible removal in 3.6. + +.. + +.. bpo: 24790 +.. date: 9606 +.. nonce: hD1hlj +.. section: IDLE + +Remove extraneous code (which also create 2 & 3 conflicts). + +.. + +.. bpo: 23672 +.. date: 9605 +.. nonce: 8td2se +.. section: IDLE + +Allow Idle to edit and run files with astral chars in name. Patch by Mohd +Sanad Zaki Rizvi. + +.. + +.. bpo: 24745 +.. date: 9604 +.. nonce: edbziT +.. section: IDLE + +Idle editor default font. Switch from Courier to platform-sensitive +TkFixedFont. This should not affect current customized font selections. If +there is a problem, edit $HOME/.idlerc/config-main.cfg and remove 'fontxxx' +entries from [Editor Window]. Patch by Mark Roseman. + +.. + +.. bpo: 21192 +.. date: 9603 +.. nonce: CdbipH +.. section: IDLE + +Idle editor. When a file is run, put its name in the restart bar. Do not +print false prompts. Original patch by Adnan Umer. + +.. + +.. bpo: 13884 +.. date: 9602 +.. nonce: vVcO1E +.. section: IDLE + +Idle menus. Remove tearoff lines. Patch by Roger Serwy. + +.. + +.. bpo: 15809 +.. date: 9601 +.. nonce: mfawdr +.. section: IDLE + +IDLE shell now uses locale encoding instead of Latin1 for decoding unicode +literals. + +.. + +.. bpo: 24952 +.. date: 9600 +.. nonce: aJv9x1 +.. section: Documentation + +Clarify the default size argument of stack_size() in the "threading" and +"thread" modules. Patch from Mattip. + +.. + +.. bpo: 20769 +.. date: 9599 +.. nonce: ZUc9z9 +.. section: Documentation + +Improve reload() docs. Patch by Dorian Pula. + +.. + +.. bpo: 23589 +.. date: 9598 +.. nonce: rjU421 +.. section: Documentation + +Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. + +.. + +.. bpo: 22155 +.. date: 9597 +.. nonce: 6Kq5Tv +.. section: Documentation + +Add File Handlers subsection with createfilehandler to Tkinter doc. Remove +obsolete example from FAQ. Patch by Martin Panter. + +.. + +.. bpo: 24751 +.. date: 9596 +.. nonce: pL2pbj +.. section: Tests + +When running regrtest with the ``-w`` command line option, a test run is no +longer marked as a failure if all tests succeed when re-run. + +.. + +.. bpo: 0 +.. date: 9595 +.. nonce: yeHJKJ +.. section: Tests + +PCbuild\rt.bat now accepts an unlimited number of arguments to pass along to +regrtest.py. Previously there was a limit of 9. + +.. + +.. bpo: 24915 +.. date: 9594 +.. nonce: N9MrQY +.. section: Build + +When doing a PGO build, the test suite is now used instead of pybench; Clang +support was also added as part off this work. Initial patch by Alecsandru +Patrascu of Intel. + +.. + +.. bpo: 24986 +.. date: 9593 +.. nonce: 1WyXeU +.. section: Build + +It is now possible to build Python on Windows without errors when external +libraries are not available. + +.. + +.. bpo: 24508 +.. date: 9592 +.. nonce: m8-La8 +.. section: Build + +Backported the MSBuild project files from Python 3.5. The backported files +replace the old project files in PCbuild; the old files moved to PC/VS9.0 +and remain supported. + +.. + +.. bpo: 24603 +.. date: 9591 +.. nonce: PyHyF5 +.. section: Build + +Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2d. + +.. + +.. bpo: 25022 +.. date: 9590 +.. nonce: vAt_zr +.. section: Windows + +Removed very outdated PC/example_nt/ directory. diff --git a/Misc/NEWS.d/2.7.12.rst b/Misc/NEWS.d/2.7.12.rst new file mode 100644 index 00000000000..1b2099a4a05 --- /dev/null +++ b/Misc/NEWS.d/2.7.12.rst @@ -0,0 +1,26 @@ +.. bpo: 27641 +.. date: 9821 +.. nonce: Fhtvhi +.. release date: 2016-06-25 +.. section: Build + +The configure script now inserts comments into the makefile to prevent the +pgen executable from being cross-compiled. + +.. + +.. bpo: 26930 +.. date: 9820 +.. nonce: 9JUeSD +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2h. + +.. + +.. bpo: 27365 +.. date: 9819 +.. nonce: y8CVsn +.. section: IDLE + +Fix about dialog. diff --git a/Misc/NEWS.d/2.7.12rc1.rst b/Misc/NEWS.d/2.7.12rc1.rst new file mode 100644 index 00000000000..c86df3979d3 --- /dev/null +++ b/Misc/NEWS.d/2.7.12rc1.rst @@ -0,0 +1,1161 @@ +.. bpo: 20041 +.. date: 9818 +.. nonce: TypyGp +.. release date: 2016-06-12 +.. section: Core and Builtins + +Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. + +.. + +.. bpo: 25702 +.. date: 9817 +.. nonce: ipxyJs +.. section: Core and Builtins + +A --with-lto configure option has been added that will enable link time +optimizations at build time during a make profile-opt. Some compilers and +toolchains are known to not produce stable code when using LTO, be sure to +test things thoroughly before relying on it. It can provide a few % speed up +over profile-opt alone. + +.. + +.. bpo: 26168 +.. date: 9816 +.. nonce: -nPBL6 +.. section: Core and Builtins + +Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. + +.. + +.. bpo: 27039 +.. date: 9815 +.. nonce: Zj7tV7 +.. section: Core and Builtins + +Fixed bytearray.remove() for values greater than 127. Patch by Joe Jevnik. + +.. + +.. bpo: 4806 +.. date: 9814 +.. nonce: BOapuA +.. section: Core and Builtins + +Avoid masking the original TypeError exception when using star (*) unpacking +and the exception was raised from a generator. Based on patch by Hagen +F?rstenau. + +.. + +.. bpo: 26659 +.. date: 9813 +.. nonce: 5PRa83 +.. section: Core and Builtins + +Make the builtin slice type support cycle collection. + +.. + +.. bpo: 26718 +.. date: 9812 +.. nonce: K5PQ8j +.. section: Core and Builtins + +super.__init__ no longer leaks memory if called multiple times. NOTE: A +direct call of super.__init__ is not endorsed! + +.. + +.. bpo: 13410 +.. date: 9811 +.. nonce: wyldQ4 +.. section: Core and Builtins + +Fixed a bug in PyUnicode_Format where it failed to properly ignore errors +from a __int__() method. + +.. + +.. bpo: 26494 +.. date: 9810 +.. nonce: Ar7ILt +.. section: Core and Builtins + +Fixed crash on iterating exhausting iterators. Affected classes are generic +sequence iterators, iterators of bytearray, list, tuple, set, frozenset, +dict, OrderedDict and corresponding views. + +.. + +.. bpo: 26581 +.. date: 9809 +.. nonce: yNA7nm +.. section: Core and Builtins + +If coding cookie is specified multiple times on a line in Python source code +file, only the first one is taken to account. + +.. + +.. bpo: 22836 +.. date: 9808 +.. nonce: cimt1y +.. section: Core and Builtins + +Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() +are sensible even when formatting them produces secondary errors. This +affects the reports produced by sys.__excepthook__() and when __del__() +raises an exception. + +.. + +.. bpo: 22847 +.. date: 9807 +.. nonce: 6baj9f +.. section: Core and Builtins + +Improve method cache efficiency. + +.. + +.. bpo: 25843 +.. date: 9806 +.. nonce: t2kGug +.. section: Core and Builtins + +When compiling code, don't merge constants if they are equal but have a +different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now +correctly compiled to two different functions: ``f1()`` returns ``1`` +(``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` +are equal. + +.. + +.. bpo: 22995 +.. date: 9805 +.. nonce: Rhr9Dh +.. section: Core and Builtins + +[UPDATE] Remove the one of the pickleability tests in _PyObject_GetState() +due to regressions observed in Cython-based projects. + +.. + +.. bpo: 25961 +.. date: 9804 +.. nonce: Hdjjw0 +.. section: Core and Builtins + +Disallowed null characters in the type name. + +.. + +.. bpo: 22995 +.. date: 9803 +.. nonce: Wq0E86 +.. section: Core and Builtins + +Instances of extension types with a state that aren't subclasses of list or +dict and haven't implemented any pickle-related methods (__reduce__, +__reduce_ex__, __getnewargs__, __getnewargs_ex__, or __getstate__), can no +longer be pickled. Including memoryview. + +.. + +.. bpo: 20440 +.. date: 9802 +.. nonce: GCwOfH +.. section: Core and Builtins + +Massive replacing unsafe attribute setting code with special macro +Py_SETREF. + +.. + +.. bpo: 25421 +.. date: 9801 +.. nonce: c47YEL +.. section: Core and Builtins + +__sizeof__ methods of builtin types now use dynamic basic size. This allows +sys.getsize() to work correctly with their subclasses with __slots__ +defined. + +.. + +.. bpo: 19543 +.. date: 9800 +.. nonce: FLtPTG +.. section: Core and Builtins + +Added Py3k warning for decoding unicode. + +.. + +.. bpo: 24097 +.. date: 9799 +.. nonce: Vt4E-i +.. section: Core and Builtins + +Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. + +.. + +.. bpo: 24731 +.. date: 9798 +.. nonce: F4USDN +.. section: Core and Builtins + +Fixed crash on converting objects with special methods __str__, __trunc__, +and __float__ returning instances of subclasses of str, long, and float to +subclasses of str, long, and float correspondingly. + +.. + +.. bpo: 26478 +.. date: 9797 +.. nonce: n0dB8e +.. section: Core and Builtins + +Fix semantic bugs when using binary operators with dictionary views and +tuples. + +.. + +.. bpo: 26171 +.. date: 9796 +.. nonce: 8SaQEa +.. section: Core and Builtins + +Fix possible integer overflow and heap corruption in zipimporter.get_data(). + +.. + +.. bpo: 26556 +.. date: 9795 +.. nonce: v5j2uL +.. section: Library + +Update expat to 2.1.1, fixes CVE-2015-1283. + +.. + +.. bpo: 0 +.. date: 9794 +.. nonce: qP8WT- +.. section: Library + +Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team +Oststrom + +.. + +.. bpo: 7356 +.. date: 9793 +.. nonce: cS5wgj +.. section: Library + +ctypes.util: Make parsing of ldconfig output independent of the locale. + +.. + +.. bpo: 25738 +.. date: 9792 +.. nonce: I_1jpQ +.. section: Library + +Stop BaseHTTPServer.BaseHTTPRequestHandler.send_error() from sending a +message body for 205 Reset Content. Also, don't send the Content-Type +header field in responses that don't have a body. Based on patch by Susumu +Koshiba. + +.. + +.. bpo: 21313 +.. date: 9791 +.. nonce: W30MBr +.. section: Library + +Fix the "platform" module to tolerate when sys.version contains truncated +build information. + +.. + +.. bpo: 27211 +.. date: 9790 +.. nonce: _7HYjx +.. section: Library + +Fix possible memory corruption in io.IOBase.readline(). + +.. + +.. bpo: 27114 +.. date: 9789 +.. nonce: bGCuAM +.. section: Library + +Fix SSLContext._load_windows_store_certs fails with PermissionError + +.. + +.. bpo: 14132 +.. date: 9788 +.. nonce: Gpiuxk +.. section: Library + +Fix urllib.request redirect handling when the target only has a query +string. Fix by J?n Janech. + +.. + +.. bpo: 0 +.. date: 9787 +.. nonce: bMrCz8 +.. section: Library + +Removed the requirements for the ctypes and modulefinder modules to be +compatible with earlier Python versions. + +.. + +.. bpo: 22274 +.. date: 9786 +.. nonce: 0RHDMN +.. section: Library + +In the subprocess module, allow stderr to be redirected to stdout even when +stdout is not redirected. Patch by Akira Li. + +.. + +.. bpo: 12045 +.. date: 9785 +.. nonce: LEH09W +.. section: Library + +Avoid duplicate execution of command in ctypes.util._get_soname(). Patch by +Sijin Joseph. + +.. + +.. bpo: 26960 +.. date: 9784 +.. nonce: 2l_IOl +.. section: Library + +Backported #16270 from Python 3 to Python 2, to prevent urllib from hanging +when retrieving certain FTP files. + +.. + +.. bpo: 25745 +.. date: 9783 +.. nonce: -n8acU +.. section: Library + +Fixed leaking a userptr in curses panel destructor. + +.. + +.. bpo: 17765 +.. date: 9782 +.. nonce: hiSVS1 +.. section: Library + +weakref.ref() no longer silently ignores keyword arguments. Patch by Georg +Brandl. + +.. + +.. bpo: 26873 +.. date: 9781 +.. nonce: _qIPUp +.. section: Library + +xmlrpclib now raises ResponseError on unsupported type tags instead of +silently return incorrect result. + +.. + +.. bpo: 24114 +.. date: 9780 +.. nonce: RMRMtM +.. section: Library + +Fix an uninitialized variable in `ctypes.util`. + +The bug only occurs on SunOS when the ctypes implementation searches for the +`crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. + +.. + +.. bpo: 26864 +.. date: 9779 +.. nonce: DFsgvI +.. section: Library + +In urllib, change the proxy bypass host checking against no_proxy to be +case-insensitive, and to not match unrelated host names that happen to have +a bypassed hostname as a suffix. Patch by Xiang Zhang. + +.. + +.. bpo: 26804 +.. date: 9778 +.. nonce: 6b9_UW +.. section: Library + +urllib will prefer lower_case proxy environment variables over UPPER_CASE or +Mixed_Case ones. Patch contributed by Hans-Peter Jansen. + +.. + +.. bpo: 26837 +.. date: 9777 +.. nonce: IKt9NJ +.. section: Library + +assertSequenceEqual() now correctly outputs non-stringified differing items. +This affects assertListEqual() and assertTupleEqual(). + +.. + +.. bpo: 26822 +.. date: 9776 +.. nonce: rYSL4W +.. section: Library + +itemgetter, attrgetter and methodcaller objects no longer silently ignore +keyword arguments. + +.. + +.. bpo: 26657 +.. date: 9775 +.. nonce: dfteub +.. section: Library + +Fix directory traversal vulnerability with SimpleHTTPServer on Windows. +This fixes a regression that was introduced in 2.7.7. Based on patch by +Philipp Hagemeister. + +.. + +.. bpo: 19377 +.. date: 9774 +.. nonce: Al9S53 +.. section: Library + +Add .svg to mimetypes.types_map. + +.. + +.. bpo: 13952 +.. date: 9773 +.. nonce: SOoTVE +.. section: Library + +Add .csv to mimetypes.types_map. Patch by Geoff Wilson. + +.. + +.. bpo: 16329 +.. date: 9772 +.. nonce: nuXD8W +.. section: Library + +Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 23735 +.. date: 9771 +.. nonce: Y5oQ9r +.. section: Library + +Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH +handler. Patch by Eric Price. + +.. + +.. bpo: 26644 +.. date: 9770 +.. nonce: 7tt1tk +.. section: Library + +Raise ValueError rather than SystemError when a negative length is passed to +SSLSocket.recv() or read(). + +.. + +.. bpo: 23804 +.. date: 9769 +.. nonce: PP63Ff +.. section: Library + +Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to +1024. + +.. + +.. bpo: 24266 +.. date: 9768 +.. nonce: YZgVyM +.. section: Library + +Ctrl+C during Readline history search now cancels the search mode when +compiled with Readline 7. + +.. + +.. bpo: 23857 +.. date: 9767 +.. nonce: u94yEL +.. section: Library + +Implement PEP 493, adding a Python-2-only ssl module API and environment +variable to configure the default handling of SSL/TLS certificates for HTTPS +connections. + +.. + +.. bpo: 26313 +.. date: 9766 +.. nonce: xhX2Gu +.. section: Library + +ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch +by Baji. + +.. + +.. bpo: 26513 +.. date: 9765 +.. nonce: HoPepy +.. section: Library + +Fixes platform module detection of Windows Server + +.. + +.. bpo: 23718 +.. date: 9764 +.. nonce: AMPC0o +.. section: Library + +Fixed parsing time in week 0 before Jan 1. Original patch by Tam?s Bence +Gedai. + +.. + +.. bpo: 26177 +.. date: 9763 +.. nonce: HlSWer +.. section: Library + +Fixed the keys() method for Canvas and Scrollbar widgets. + +.. + +.. bpo: 15068 +.. date: 9762 +.. nonce: bcHtiw +.. section: Library + +Got rid of excessive buffering in the fileinput module. The bufsize +parameter is no longer used. + +.. + +.. bpo: 2202 +.. date: 9761 +.. nonce: EPsrOA +.. section: Library + +Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls. +Initial patch by Mathieu Dupuy. + +.. + +.. bpo: 26475 +.. date: 9760 +.. nonce: JXVccY +.. section: Library + +Fixed debugging output for regular expressions with the (?x) flag. + +.. + +.. bpo: 26385 +.. date: 9759 +.. nonce: mfwNyt +.. section: Library + +Remove the file if the internal fdopen() call in NamedTemporaryFile() fails. +Based on patch by Silent Ghost. + +.. + +.. bpo: 26309 +.. date: 9758 +.. nonce: TSTJ3A +.. section: Library + +In the "SocketServer" module, shut down the request (closing the connected +socket) when verify_request() returns false. Based on patch by Aviv +Palivoda. + +.. + +.. bpo: 25939 +.. date: 9757 +.. nonce: I-qK2E +.. section: Library + +On Windows open the cert store readonly in ssl.enum_certificates. + +.. + +.. bpo: 24303 +.. date: 9756 +.. nonce: FDBJWM +.. section: Library + +Fix random EEXIST upon multiprocessing semaphores creation with Linux PID +namespaces enabled. + +.. + +.. bpo: 25698 +.. date: 9755 +.. nonce: Id3NAo +.. section: Library + +Importing module if the stack is too deep no longer replaces imported module +with the empty one. + +.. + +.. bpo: 12923 +.. date: 9754 +.. nonce: HPAu-B +.. section: Library + +Reset FancyURLopener's redirect counter even if there is an exception. +Based on patches by Brian Brazil and Daniel Rocco. + +.. + +.. bpo: 25945 +.. date: 9753 +.. nonce: guNgNM +.. section: Library + +Fixed a crash when unpickle the functools.partial object with wrong state. +Fixed a leak in failed functools.partial constructor. "args" and "keywords" +attributes of functools.partial have now always types tuple and dict +correspondingly. + +.. + +.. bpo: 19883 +.. date: 9752 +.. nonce: z9TsO6 +.. section: Library + +Fixed possible integer overflows in zipimport. + +.. + +.. bpo: 26147 +.. date: 9751 +.. nonce: UA8O6s +.. section: Library + +xmlrpclib now works with unicode not encodable with used non-UTF-8 encoding. + +.. + +.. bpo: 16620 +.. date: 9750 +.. nonce: rxpn_Y +.. section: Library + +Fixed AttributeError in msilib.Directory.glob(). + +.. + +.. bpo: 21847 +.. date: 9749 +.. nonce: smLnll +.. section: Library + +Fixed xmlrpclib on Unicode-disabled builds. + +.. + +.. bpo: 6500 +.. date: 9748 +.. nonce: n8NGo4 +.. section: Library + +Fixed infinite recursion in urllib2.Request.__getattr__(). + +.. + +.. bpo: 26083 +.. date: 9747 +.. nonce: siyOnS +.. section: Library + +Workaround a subprocess bug that raises an incorrect "ValueError: insecure +string pickle" exception instead of the actual exception on some platforms +such as Mac OS X when an exception raised in the forked child process prior +to the exec() was large enough that it overflowed the internal errpipe_read +pipe buffer. + +.. + +.. bpo: 24103 +.. date: 9746 +.. nonce: gWAG0r +.. section: Library + +Fixed possible use after free in ElementTree.iterparse(). + +.. + +.. bpo: 20954 +.. date: 9745 +.. nonce: H9-NYO +.. section: Library + +_args_from_interpreter_flags used by multiprocessing and some tests no +longer behaves incorrectly in the presence of the PYTHONHASHSEED environment +variable. + +.. + +.. bpo: 14285 +.. date: 9744 +.. nonce: Z5YcQy +.. section: Library + +When executing a package with the "python -m package" option, and package +initialization raises ImportError, a proper traceback is now reported. + +.. + +.. bpo: 6478 +.. date: 9743 +.. nonce: -Bi9Hb +.. section: Library + +_strptime's regexp cache now is reset after changing timezone with +time.tzset(). + +.. + +.. bpo: 25718 +.. date: 9742 +.. nonce: D9mHZF +.. section: Library + +Fixed copying object with state with boolean value is false. + +.. + +.. bpo: 25742 +.. date: 9741 +.. nonce: y6AAQ4 +.. section: Library + +:func:`locale.setlocale` now accepts a Unicode string for its second +parameter. + +.. + +.. bpo: 10131 +.. date: 9740 +.. nonce: a7tptz +.. section: Library + +Fixed deep copying of minidom documents. Based on patch by Marian Ganisin. + +.. + +.. bpo: 25725 +.. date: 9739 +.. nonce: mGRrqb +.. section: Library + +Fixed a reference leak in cPickle.loads() when unpickling invalid data +including tuple instructions. + +.. + +.. bpo: 25663 +.. date: 9738 +.. nonce: Ofwfqa +.. section: Library + +In the Readline completer, avoid listing duplicate global names, and search +the global namespace before searching builtins. + +.. + +.. bpo: 25688 +.. date: 9737 +.. nonce: 8P1HOv +.. section: Library + +Fixed file leak in ElementTree.iterparse() raising an error. + +.. + +.. bpo: 23914 +.. date: 9736 +.. nonce: vQS48b +.. section: Library + +Fixed SystemError raised by CPickle unpickler on broken data. + +.. + +.. bpo: 25924 +.. date: 9735 +.. nonce: Uxr2vt +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on OS X versions +10.5 or higher. Original patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26406 +.. date: 9734 +.. nonce: ihvhF4 +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on current versions +of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 5124 +.. date: 9733 +.. nonce: 4kwBvM +.. section: IDLE + +Paste with text selected now replaces the selection on X11. This matches how +paste works on Windows, Mac, most modern Linux apps, and ttk widgets. +Original patch by Serhiy Storchaka. + +.. + +.. bpo: 24759 +.. date: 9732 +.. nonce: ccmySu +.. section: IDLE + +Make clear in idlelib.idle_test.__init__ that the directory is a private +implementation of test.test_idle and tool for maintainers. + +.. + +.. bpo: 26673 +.. date: 9731 +.. nonce: dh0_Ij +.. section: IDLE + +When tk reports font size as 0, change to size 10. Such fonts on Linux +prevented the configuration dialog from opening. + +.. + +.. bpo: 27044 +.. date: 9730 +.. nonce: 4y7tyM +.. section: IDLE + +Add ConfigDialog.remove_var_callbacks to stop memory leaks. + +.. + +.. bpo: 0 +.. date: 9729 +.. nonce: _YJfG7 +.. section: IDLE + +In the 'IDLE-console differences' section of the IDLE doc, clarify how +running with IDLE affects sys.modules and the standard streams. + +.. + +.. bpo: 25507 +.. date: 9728 +.. nonce: bx-miX +.. section: IDLE + +fix incorrect change in IOBinding that prevented printing. Change also +prevented saving shell window with non-ascii characters. Augment IOBinding +htest to include all major IOBinding functions. + +.. + +.. bpo: 25905 +.. date: 9727 +.. nonce: FzNb3B +.. section: IDLE + +Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION MARK in +README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to +utf-8 and open it with 'utf-8'. + +.. + +.. bpo: 26417 +.. date: 9726 +.. nonce: XmSxEK +.. section: IDLE + +Prevent spurious errors and incorrect defaults when installing IDLE 2.7 on +OS X: default configuration settings are no longer installed from OS X +specific copies. + +.. + +.. bpo: 26736 +.. date: 9725 +.. nonce: U_Hyqo +.. section: Documentation + +Used HTTPS for external links in the documentation if possible. + +.. + +.. bpo: 6953 +.. date: 9724 +.. nonce: Zk6rno +.. section: Documentation + +Rework the Readline module documentation to group related functions +together, and add more details such as what underlying Readline functions +and variables are accessed. + +.. + +.. bpo: 26014 +.. date: 9723 +.. nonce: C3Hbb7 +.. section: Documentation + +Guide users to the newer packaging documentation as was done for Python 3.x. +In particular, the top-level 2.7 documentation page now links to the newer +installer and distributions pages rather than the legacy install and +Distutils pages; these are still linked to in the library/distutils doc +page. + +.. + +.. bpo: 21916 +.. date: 9722 +.. nonce: muwCyp +.. section: Tests + +Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle +Zijlstra. + +.. + +.. bpo: 25940 +.. date: 9721 +.. nonce: PgiLVN +.. section: Tests + +Changed test_ssl to use self-signed.pythontest.net. This avoids relying on +svn.python.org, which recently changed root certificate. + +.. + +.. bpo: 25616 +.. date: 9720 +.. nonce: Qr-60p +.. section: Tests + +Tests for OrderedDict are extracted from test_collections into separate file +test_ordered_dict. + +.. + +.. bpo: 22359 +.. date: 9719 +.. nonce: laY9yB +.. section: Build + +Avoid incorrect recursive $(MAKE), and disable the rules for running pgen +when cross-compiling. The pgen output is normally saved with the source +code anyway, and is still regenerated when doing a native build. Patch by +Jonas Wagner and Xavier de Gaye. + +.. + +.. bpo: 19450 +.. date: 9718 +.. nonce: iS8xhV +.. section: Build + +Update Windows builds to use SQLite 3.8.11.0. + +.. + +.. bpo: 27229 +.. date: 9717 +.. nonce: C2NDch +.. section: Build + +Fix the cross-compiling pgen rule for in-tree builds. Patch by Xavier de +Gaye. + +.. + +.. bpo: 17603 +.. date: 9716 +.. nonce: 102DA- +.. section: Build + +Avoid error about nonexistant fileblocks.o file by using a lower-level check +for st_blocks in struct stat. + +.. + +.. bpo: 26465 +.. date: 9715 +.. nonce: _YR608 +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2g. + +.. + +.. bpo: 24421 +.. date: 9714 +.. nonce: 2zY7vM +.. section: Build + +Compile Modules/_math.c once, before building extensions. Previously it +could fail to compile properly if the math and cmath builds were concurrent. + +.. + +.. bpo: 25824 +.. date: 9713 +.. nonce: u0HToh +.. section: Build + +Fixes sys.winver to not include any architecture suffix. + +.. + +.. bpo: 25348 +.. date: 9712 +.. nonce: u6_BaQ +.. section: Build + +Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for +building with Profile-Guided Optimization. The old +``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls +``PCbuild\build.bat --pgo %*``. + +.. + +.. bpo: 25827 +.. date: 9711 +.. nonce: yg3DMM +.. section: Build + +Add support for building with ICC to ``configure``, including a new +``--with-icc`` flag. + +.. + +.. bpo: 25696 +.. date: 9710 +.. nonce: 2R_wIv +.. section: Build + +Fix installation of Python on UNIX with make -j9. + +.. + +.. bpo: 26930 +.. date: 9709 +.. nonce: Sqz2O3 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2h. + +.. + +.. bpo: 26268 +.. date: 9708 +.. nonce: I3-YLh +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2f. + +.. + +.. bpo: 25136 +.. date: 9707 +.. nonce: Vi-fmO +.. section: Build + +Support Apple Xcode 7's new textual SDK stub libraries. + +.. + +.. bpo: 26799 +.. date: 9706 +.. nonce: gK2VXX +.. section: Tools/Demos + +Fix python-gdb.py: don't get C types once when the Python code is loaded, +but get C types on demand. The C types can change if python-gdb.py is loaded +before the Python executable. Patch written by Thomas Ilsche. + +.. + +.. bpo: 30255 +.. date: 9705 +.. nonce: EGf-zW +.. section: C API + +PySlice_GetIndicesEx now clips the step to [-PY_SSIZE_T_MAX, PY_SSIZE_T_MAX] +instead of [-PY_SSIZE_T_MAX-1, PY_SSIZE_T_MAX]. This makes it safe to do +"step = -step" when reversing a slice. + +.. + +.. bpo: 26476 +.. date: 9704 +.. nonce: oJrb6q +.. section: C API + +Fixed compilation error when use PyErr_BadInternalCall() in C++. Patch by +Jeroen Demeyer. + +.. + +.. bpo: 17500 +.. date: 9703 +.. nonce: QTZbRV +.. section: Windows + +Remove unused and outdated icons. (See also: +https://github.com/python/pythondotorg/issues/945) diff --git a/Misc/NEWS.d/2.7.13.rst b/Misc/NEWS.d/2.7.13.rst new file mode 100644 index 00000000000..0d065e841da --- /dev/null +++ b/Misc/NEWS.d/2.7.13.rst @@ -0,0 +1,7 @@ +.. bpo: 5322 +.. date: 9926 +.. nonce: _CaEiN +.. release date: 2016-12-17 +.. section: Core and Builtins + +Revert a37cc3d926ec. diff --git a/Misc/NEWS.d/2.7.13rc1.rst b/Misc/NEWS.d/2.7.13rc1.rst new file mode 100644 index 00000000000..26ffeea2b37 --- /dev/null +++ b/Misc/NEWS.d/2.7.13rc1.rst @@ -0,0 +1,1025 @@ +.. bpo: 5322 +.. date: 9925 +.. nonce: 8Fq059 +.. release date: 2016-12-03 +.. section: Core and Builtins + +Fixed setting __new__ to a PyCFunction inside Python code. Original patch by +Andreas St?hrk. + +.. + +.. bpo: 28847 +.. date: 9924 +.. nonce: iG6VRD +.. section: Core and Builtins + +dumbdbm no longer writes the index file in when it is not changed and +supports reading read-only files. + +.. + +.. bpo: 11145 +.. date: 9923 +.. nonce: 3BeZaz +.. section: Core and Builtins + +Fixed miscellaneous issues with C-style formatting of types with custom +__oct__ and __hex__. + +.. + +.. bpo: 24469 +.. date: 9922 +.. nonce: dl8lJ4 +.. section: Core and Builtins + +Fixed memory leak caused by int subclasses without overridden tp_free (e.g. +C-inherited Cython classes). + +.. + +.. bpo: 19398 +.. date: 9921 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 21720 +.. date: 9920 +.. nonce: XSd6LI +.. section: Core and Builtins + +Improve exception message when the type of fromlist is unicode. fromlist +parameter of __import__() only accepts str in Python 2 and this will help to +identify the problem especially when the unicode_literals future import is +used. + +.. + +.. bpo: 26906 +.. date: 9919 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 9918 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 9917 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28350 +.. date: 9916 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 27942 +.. date: 9915 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 15578 +.. date: 9914 +.. nonce: xSQWiu +.. section: Core and Builtins + +Correctly incref the parent module while importing. + +.. + +.. bpo: 26307 +.. date: 9913 +.. nonce: Puk2rd +.. section: Core and Builtins + +The profile-opt build now applies PGO to the built-in modules. + +.. + +.. bpo: 26020 +.. date: 9912 +.. nonce: niLbLa +.. section: Core and Builtins + +set literal evaluation order did not match documented behaviour. + +.. + +.. bpo: 27870 +.. date: 9911 +.. nonce: Y0u34u +.. section: Core and Builtins + +A left shift of zero by a large integer no longer attempts to allocate large +amounts of memory. + +.. + +.. bpo: 25604 +.. date: 9910 +.. nonce: UkeHGy +.. section: Core and Builtins + +Fix a minor bug in integer true division; this bug could potentially have +caused off-by-one-ulp results on platforms with unreliable ldexp +implementations. + +.. + +.. bpo: 27473 +.. date: 9909 +.. nonce: d8HWze +.. section: Core and Builtins + +Fixed possible integer overflow in str, unicode and bytearray concatenations +and repetitions. Based on patch by Xiang Zhang. + +.. + +.. bpo: 27507 +.. date: 9908 +.. nonce: 3pX0Be +.. section: Core and Builtins + +Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. + +.. + +.. bpo: 27581 +.. date: 9907 +.. nonce: KezjNt +.. section: Core and Builtins + +Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by +Xiang Zhang. + +.. + +.. bpo: 23908 +.. date: 9906 +.. nonce: xXL6_c +.. section: Core and Builtins + +os functions, open() and the io.FileIO constructor now reject unicode paths +with embedded null character on Windows instead of silently truncating them. + +.. + +.. bpo: 27514 +.. date: 9905 +.. nonce: NLbwPG +.. section: Core and Builtins + +Make having too many statically nested blocks a SyntaxError instead of +SystemError. + +.. + +.. bpo: 25659 +.. date: 9904 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 28563 +.. date: 9903 +.. nonce: iweEiw +.. section: Library + +Fixed possible DoS and arbitrary code execution when handle plural form +selections in the gettext module. The expression parser now supports exact +syntax supported by GNU gettext. + +.. + +.. bpo: 28387 +.. date: 9902 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 28449 +.. date: 9901 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 25464 +.. date: 9900 +.. nonce: DTGbbr +.. section: Library + +Fixed HList.header_exists() in Tix module by adding a workaround to Tix +library bug. + +.. + +.. bpo: 28488 +.. date: 9899 +.. nonce: TgO112 +.. section: Library + +shutil.make_archive() no longer adds entry "./" to ZIP archive. + +.. + +.. bpo: 28480 +.. date: 9898 +.. nonce: Qh4Xeq +.. section: Library + +Fix error building _sqlite3 module when multithreading is disabled. + +.. + +.. bpo: 24452 +.. date: 9897 +.. nonce: m9Kyg3 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. + +.. + +.. bpo: 26293 +.. date: 9896 +.. nonce: 2mjvwX +.. section: Library + +Fixed writing ZIP files that starts not from the start of the file. Offsets +in ZIP file now are relative to the start of the archive in conforming to +the specification. + +.. + +.. bpo: 0 +.. date: 9895 +.. nonce: 81jNns +.. section: Library + +Fix possible integer overflows and crashes in the mmap module with unusual +usage patterns. + +.. + +.. bpo: 27897 +.. date: 9894 +.. nonce: wfWe9B +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Original patch by Xiang Zhang. + +.. + +.. bpo: 1703178 +.. date: 9893 +.. nonce: meb49K +.. section: Library + +Fix the ability to pass the --link-objects option to the distutils build_ext +command. + +.. + +.. bpo: 28253 +.. date: 9892 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 27963 +.. date: 9891 +.. nonce: XDgr3L +.. section: Library + +Fixed possible null pointer dereference in ctypes.set_conversion_mode(). +Patch by Xiang Zhang. + +.. + +.. bpo: 28284 +.. date: 9890 +.. nonce: kHbh7e +.. section: Library + +Strengthen resistance of ``_json.encode_basestring_ascii()`` to integer +overflow. + +.. + +.. bpo: 27611 +.. date: 9889 +.. nonce: yfOkD6 +.. section: Library + +Fixed support of default root window in the Tix module. + +.. + +.. bpo: 24363 +.. date: 9888 +.. nonce: PVQg7r +.. section: Library + +When parsing HTTP header fields, if an invalid line is encountered, skip it +and continue parsing. Previously, no more header fields were parsed, which +could lead to fields for HTTP framing like Content-Length and Transfer- +Encoding being overlooked. + +.. + +.. bpo: 27599 +.. date: 9887 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 25969 +.. date: 9886 +.. nonce: qSPkl- +.. section: Library + +Update the lib2to3 grammar to handle the unpacking generalizations added in +3.5. + +.. + +.. bpo: 24594 +.. date: 9885 +.. nonce: 9CnFVS +.. section: Library + +Validates persist parameter when opening MSI database + +.. + +.. bpo: 27570 +.. date: 9884 +.. nonce: pU0Zie +.. section: Library + +Avoid zero-length memcpy() etc calls with null source pointers in the +"ctypes" and "array" modules. + +.. + +.. bpo: 22450 +.. date: 9883 +.. nonce: aWpdde +.. section: Library + +urllib now includes an "Accept: */*" header among the default headers. This +makes the results of REST API requests more consistent and predictable +especially when proxy servers are involved. + +.. + +.. bpo: 0 +.. date: 9882 +.. nonce: PVZStR +.. section: Library + +lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between +runs given the same Grammar.txt input regardless of the hash randomization +setting. + +.. + +.. bpo: 27691 +.. date: 9881 +.. nonce: TMYF5_ +.. section: Library + +Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 +certs. + +.. + +.. bpo: 27850 +.. date: 9880 +.. nonce: kIVQ0m +.. section: Library + +Remove 3DES from ssl module's default cipher list to counter measure sweet32 +attack (CVE-2016-2183). + +.. + +.. bpo: 27766 +.. date: 9879 +.. nonce: WI70Tc +.. section: Library + +Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL +1.1.0 or LibreSSL). + +.. + +.. bpo: 26470 +.. date: 9878 +.. nonce: QGu_wo +.. section: Library + +Port ssl and hashlib module to OpenSSL 1.1.0. + +.. + +.. bpo: 27944 +.. date: 9877 +.. nonce: EVXdfk +.. section: Library + +Fix some memory-corruption bugs in the log reading code of the _hotshot +module. + +.. + +.. bpo: 27934 +.. date: 9876 +.. nonce: ucQE3p +.. section: Library + +Use ``float.__repr__`` instead of plain ``repr`` when JSON- encoding an +instance of a float subclass. Thanks Eddie James. + +.. + +.. bpo: 27861 +.. date: 9875 +.. nonce: DBYuo9 +.. section: Library + +Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a +cursor. Patch by Xiang Zhang. + +.. + +.. bpo: 19884 +.. date: 9874 +.. nonce: MO8AWH +.. section: Library + +Avoid spurious output on OS X with Gnu Readline. + +.. + +.. bpo: 10513 +.. date: 9873 +.. nonce: tQIQD_ +.. section: Library + +Fix a regression in Connection.commit(). Statements should not be reset +after a commit. + +.. + +.. bpo: 2466 +.. date: 9872 +.. nonce: VRNlkg +.. section: Library + +posixpath.ismount now correctly recognizes mount points which the user does +not have permission to access. + +.. + +.. bpo: 27783 +.. date: 9871 +.. nonce: 6fCCY9 +.. section: Library + +Fix possible usage of uninitialized memory in operator.methodcaller. + +.. + +.. bpo: 27774 +.. date: 9870 +.. nonce: FDcik1 +.. section: Library + +Fix possible Py_DECREF on unowned object in _sre. + +.. + +.. bpo: 27760 +.. date: 9869 +.. nonce: gxMjp4 +.. section: Library + +Fix possible integer overflow in binascii.b2a_qp. + +.. + +.. bpo: 0 +.. date: 9868 +.. nonce: Ny9oPv +.. section: Library + +In the curses module, raise an error if window.getstr() or window.instr() is +passed a negative value. + +.. + +.. bpo: 27758 +.. date: 9867 +.. nonce: x9DC4R +.. section: Library + +Fix possible integer overflow in the _csv module for large record lengths. + +.. + +.. bpo: 23369 +.. date: 9866 +.. nonce: nqChyE +.. section: Library + +Fixed possible integer overflow in _json.encode_basestring_ascii. + +.. + +.. bpo: 27568 +.. date: 9865 +.. nonce: OnuO9s +.. section: Library + +Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the HTTP_PROXY variable +when REQUEST_METHOD environment is set, which indicates that the script is +in CGI mode. + +.. + +.. bpo: 27130 +.. date: 9864 +.. nonce: zVvNDt +.. section: Library + +In the "zlib" module, fix handling of large buffers (typically 2 or 4 GiB). +Previously, inputs were limited to 2 GiB, and compression and decompression +operations did not properly handle results of 2 or 4 GiB. + +.. + +.. bpo: 23804 +.. date: 9863 +.. nonce: ipFvxc +.. section: Library + +Fix SSL zero-length recv() calls to not block and not raise an error about +unclean EOF. + +.. + +.. bpo: 27466 +.. date: 9862 +.. nonce: C_3a8E +.. section: Library + +Change time format returned by http.cookie.time2netscape, confirming the +netscape cookie format and making it consistent with documentation. + +.. + +.. bpo: 22115 +.. date: 9861 +.. nonce: Vpj2aH +.. section: Library + +Fixed tracing Tkinter variables: trace_vdelete() with wrong mode no longer +break tracing, trace_vinfo() now always returns a list of pairs of strings. + +.. + +.. bpo: 27079 +.. date: 9860 +.. nonce: c7d0Ym +.. section: Library + +Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +.. + +.. bpo: 22636 +.. date: 9859 +.. nonce: 3fQW_g +.. section: Library + +Avoid shell injection problems with ctypes.util.find_library(). + +.. + +.. bpo: 27330 +.. date: 9858 +.. nonce: GJaFCV +.. section: Library + +Fixed possible leaks in the ctypes module. + +.. + +.. bpo: 27238 +.. date: 9857 +.. nonce: Q6v6Qv +.. section: Library + +Got rid of bare excepts in the turtle module. Original patch by Jelle +Zijlstra. + +.. + +.. bpo: 26386 +.. date: 9856 +.. nonce: 9L3Ut4 +.. section: Library + +Fixed ttk.TreeView selection operations with item id's containing spaces. + +.. + +.. bpo: 25455 +.. date: 9855 +.. nonce: tj_49f +.. section: Library + +Fixed a crash in repr of cElementTree.Element with recursive tag. + +.. + +.. bpo: 21201 +.. date: 9854 +.. nonce: wLCKiA +.. section: Library + +Improves readability of multiprocessing error message. Thanks to Wojciech +Walczak for patch. + +.. + +.. bpo: 27854 +.. date: 9853 +.. nonce: 8L_TJb +.. section: IDLE + +Make Help => IDLE Help work again on Windows. Include idlelib/help.html in +2.7 Windows installer. + +.. + +.. bpo: 25507 +.. date: 9852 +.. nonce: bQVsMZ +.. section: IDLE + +Add back import needed for 2.x encoding warning box. Add pointer to +'Encoding declaration' in Language Reference. + +.. + +.. bpo: 15308 +.. date: 9851 +.. nonce: zZxn8m +.. section: IDLE + +Add 'interrupt execution' (^C) to Shell menu. Patch by Roger Serwy, updated +by Bayard Randel. + +.. + +.. bpo: 27922 +.. date: 9850 +.. nonce: UEtEv9 +.. section: IDLE + +Stop IDLE tests from 'flashing' gui widgets on the screen. + +.. + +.. bpo: 17642 +.. date: 9849 +.. nonce: B0BNOB +.. section: IDLE + +add larger font sizes for classroom projection. + +.. + +.. bpo: 0 +.. date: 9848 +.. nonce: zWZs6o +.. section: IDLE + +Add version to title of IDLE help window. + +.. + +.. bpo: 25564 +.. date: 9847 +.. nonce: GN0p14 +.. section: IDLE + +In section on IDLE -- console differences, mention that using exec means +that __builtins__ is defined for each statement. + +.. + +.. bpo: 27714 +.. date: 9846 +.. nonce: bUEDsI +.. section: IDLE + +text_textview and test_autocomplete now pass when re-run in the same +process. This occurs when test_idle fails when run with the -w option but +without -jn. Fix warning from test_config. + +.. + +.. bpo: 27452 +.. date: 9845 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 27365 +.. date: 9844 +.. nonce: y7ys_A +.. section: IDLE + +Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +.. + +.. bpo: 27245 +.. date: 9843 +.. nonce: u9aKO1 +.. section: IDLE + +IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE +was started from a console or by import, a cascade of warnings was emitted. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 28513 +.. date: 9842 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 16484 +.. date: 9841 +.. nonce: ITzcGg +.. section: Documentation + +Change the default PYTHONDOCS URL to "https:", and fix the resulting links +to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi. + +.. + +.. bpo: 28666 +.. date: 9840 +.. nonce: sbGV2K +.. section: Tests + +Now test.test_support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 9839 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 27369 +.. date: 9838 +.. nonce: LG7U2D +.. section: Tests + +In test_pyexpat, avoid testing an error message detail that changed in Expat +2.2.0. + +.. + +.. bpo: 10656 +.. date: 9837 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 9836 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28248 +.. date: 9835 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 28258 +.. date: 9834 +.. nonce: pQNUId +.. section: Build + +Fixed build with Estonian locale (distclean target in Makefile). Patch by +Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 9833 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 15819 +.. date: 9832 +.. nonce: Wi3naX +.. section: Build + +The Include directory in the build tree is already searched; drop unused +code trying to add it again. + +.. + +.. bpo: 27566 +.. date: 9831 +.. nonce: xDWjEb +.. section: Build + +Fix clean target in freeze makefile (patch by Lisa Roach) + +.. + +.. bpo: 27983 +.. date: 9830 +.. nonce: jL_1n8 +.. section: Build + +Cause lack of llvm-profdata tool when using clang as required for PGO +linking to be a configure time error rather than make time when --with- +optimizations is enabled. Also improve our ability to find the llvm- +profdata tool on MacOS and some Linuxes. + +.. + +.. bpo: 26359 +.. date: 9829 +.. nonce: WXBL-Y +.. section: Build + +Add the --with-optimizations configure flag. + +.. + +.. bpo: 10910 +.. date: 9828 +.. nonce: ZdRayb +.. section: Build + +Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD +version checks for the original ctype UTF-8 workaround. + +.. + +.. bpo: 27806 +.. date: 9827 +.. nonce: DEhPsm +.. section: Build + +Fix 32-bit builds on macOS Sierra 10.12 broken by removal of deprecated +QuickTime/QuickTime.h header file. Patch by Aleks Bunin. + +.. + +.. bpo: 28676 +.. date: 9826 +.. nonce: 41PL3Q +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Initial patch by +Gareth Rees. + +.. + +.. bpo: 27952 +.. date: 9825 +.. nonce: OO-hBo +.. section: Tools/Demos + +Get Tools/scripts/fixcid.py working with the current "re" module, avoid +invalid Python backslash escapes, and fix a bug parsing escaped C quote +signs. + +.. + +.. bpo: 27932 +.. date: 9824 +.. nonce: mtgl-6 +.. section: Windows + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 27888 +.. date: 9823 +.. nonce: xClILd +.. section: Windows + +Prevent Windows installer from displaying console windows and failing when +pip cannot be installed/uninstalled. + +.. + +.. bpo: 28440 +.. date: 9822 +.. nonce: KBMmDg +.. section: macOS + +No longer add /Library/Python/site-packages, the Apple-supplied system +Python site-packages directory, to sys.path for macOS framework builds. The +coupling between the two Python instances often caused confusion and, as of +macOS 10.12, changes to the site-packages layout can cause pip component +installations to fail. This change reverts the effects introduced in 2.7.0 +by Issue #4865. If you are using a package with both the Apple system +Python 2.7 and a user-installed Python 2.7, you will need to ensure that +copies of the package are installed with both Python instances. diff --git a/Misc/NEWS.d/2.7.1rc1.rst b/Misc/NEWS.d/2.7.1rc1.rst new file mode 100644 index 00000000000..8de80ed40e3 --- /dev/null +++ b/Misc/NEWS.d/2.7.1rc1.rst @@ -0,0 +1,1726 @@ +.. bpo: 10221 +.. date: 8273 +.. nonce: 4NppnX +.. release date: 2010-11-13 +.. section: Core and Builtins + +dict.pop(k) now has a key error message that includes the missing key (same +message d[k] returns for missing keys). + +.. + +.. bpo: 10125 +.. date: 8272 +.. nonce: Zs0ZsA +.. section: Core and Builtins + +Don't segfault when the iterator passed to ``file.writelines()`` closes the +file. + +.. + +.. bpo: 10186 +.. date: 8271 +.. nonce: _LgTkO +.. section: Core and Builtins + +Fix the SyntaxError caret when the offset is equal to the length of the +offending line. + +.. + +.. bpo: 9997 +.. date: 8270 +.. nonce: mGq7Dd +.. section: Core and Builtins + +Don't let the name "top" have special significance in scope resolution. + +.. + +.. bpo: 9862 +.. date: 8269 +.. nonce: 18PjRQ +.. section: Core and Builtins + +Compensate for broken PIPE_BUF in AIX by hard coding its value as the +default 512 when compiling on AIX. + +.. + +.. bpo: 9675 +.. date: 8268 +.. nonce: grRY0l +.. section: Core and Builtins + +CObject use is marked as a Py3k warning, not a deprecation warning. + +.. + +.. bpo: 10068 +.. date: 8267 +.. nonce: CYBiNW +.. section: Core and Builtins + +Global objects which have reference cycles with their module's dict are now +cleared again. This causes issue #7140 to appear again. + +.. + +.. bpo: 9869 +.. date: 8266 +.. nonce: gwgHCl +.. section: Core and Builtins + +Make long() and PyNumber_Long return something of type long for a class +whose __long__ method returns a plain int. This fixes an interpreter crash +when initializing an instance of a long subclass from an object whose +__long__ method returns a plain int. + +.. + +.. bpo: 10006 +.. date: 8265 +.. nonce: QMA2kC +.. section: Core and Builtins + +type.__abstractmethods__ now raises an AttributeError. + +.. + +.. bpo: 9797 +.. date: 8264 +.. nonce: YxisFn +.. section: Core and Builtins + +pystate.c wrongly assumed that zero couldn't be a valid thread-local storage +key. + +.. + +.. bpo: 4947 +.. date: 8263 +.. nonce: abA0AT +.. section: Core and Builtins + +The write() method of sys.stdout and sys.stderr uses their encoding and +errors attributes instead of using utf-8 in strict mode, to get the same +behaviour than the print statement. + +.. + +.. bpo: 9737 +.. date: 8262 +.. nonce: JlusIM +.. section: Core and Builtins + +Fix a crash when trying to delete a slice or an item from a memoryview +object. + +.. + +.. bpo: 0 +.. date: 8261 +.. nonce: MI1h1F +.. section: Core and Builtins + +Restore GIL in nis_cat in case of error. + +.. + +.. bpo: 9688 +.. date: 8260 +.. nonce: PTAKBL +.. section: Core and Builtins + +__basicsize__ and __itemsize__ must be accessed as Py_ssize_t. + +.. + +.. bpo: 8530 +.. date: 8259 +.. nonce: 4OlxZq +.. section: Core and Builtins + +Prevent stringlib fastsearch from reading beyond the front of an array. + +.. + +.. bpo: 83755 +.. date: 8258 +.. nonce: LFoGKM +.. section: Core and Builtins + +Implicit set-to-frozenset conversion was not thread-safe. + +.. + +.. bpo: 9416 +.. date: 8257 +.. nonce: EqecrW +.. section: Core and Builtins + +Fix some issues with complex formatting where the output with no type +specifier failed to match the str output: + +- format(complex(-0.0, 2.0), '-') omitted the real part from the output, - +format(complex(0.0, 2.0), '-') included a sign and parentheses. + +.. + +.. bpo: 7616 +.. date: 8256 +.. nonce: AOGmSj +.. section: Core and Builtins + +Fix copying of overlapping memoryview slices with the Intel compiler. + +.. + +.. bpo: 9926 +.. date: 8255 +.. nonce: J4BGGY +.. section: Library + +Wrapped TestSuite subclass does not get __call__ executed + +.. + +.. bpo: 4471 +.. date: 8254 +.. nonce: ZJDlrs +.. section: Library + +Properly shutdown socket in IMAP.shutdown(). Patch by Lorenzo M. Catucci. + +.. + +.. bpo: 10126 +.. date: 8253 +.. nonce: zvTZV- +.. section: Library + +Fix distutils' test_build when Python was built with --enable-shared. + +.. + +.. bpo: 0 +.. date: 8252 +.. nonce: NFeWRc +.. section: Library + +Fix typo in one sdist option (medata-check). + +.. + +.. bpo: 9199 +.. date: 8251 +.. nonce: 8WF_Pp +.. section: Library + +Fix incorrect use of distutils.cmd.Command.announce. + +.. + +.. bpo: 1718574 +.. date: 8250 +.. nonce: iqLV20 +.. section: Library + +Fix options that were supposed to accept arguments but did not in +build_clib. + +.. + +.. bpo: 9281 +.. date: 8249 +.. nonce: 0xYNfM +.. section: Library + +Prevent race condition with mkdir in distutils. Patch by Arfrever. + +.. + +.. bpo: 10229 +.. date: 8248 +.. nonce: 10oNS7 +.. section: Library + +Fix caching error in gettext. + +.. + +.. bpo: 10252 +.. date: 8247 +.. nonce: pGhEYO +.. section: Library + +Close file objects in a timely manner in distutils code and tests. Patch by +Brian Brazil, completed by ?ric Araujo. + +.. + +.. bpo: 10311 +.. date: 8246 +.. nonce: u1t7up +.. section: Library + +The signal module now restores errno before returning from its low-level +signal handler. Patch by Hallvard B Furuseth. + +.. + +.. bpo: 10038 +.. date: 8245 +.. nonce: 5EKcD7 +.. section: Library + +json.loads() on str should always return unicode (regression from Python +2.6). Patch by Walter D?rwald. + +.. + +.. bpo: 120176 +.. date: 8244 +.. nonce: 9k2NaP +.. section: Library + +Wrapped TestSuite subclass does not get __call__ executed. + +.. + +.. bpo: 6706 +.. date: 8243 +.. nonce: Es-Yrw +.. section: Library + +asyncore accept() method no longer raises EWOULDBLOCK/ECONNABORTED on +incomplete connection attempt but returns None instead. + +.. + +.. bpo: 10266 +.. date: 8242 +.. nonce: BZ9duO +.. section: Library + +uu.decode didn't close in_file explicitly when it was given as a filename. +Patch by Brian Brazil. + +.. + +.. bpo: 10246 +.. date: 8241 +.. nonce: NPG3oL +.. section: Library + +uu.encode didn't close file objects explicitly when filenames were given to +it. Patch by Brian Brazil. + +.. + +.. bpo: 10253 +.. date: 8240 +.. nonce: TL1F90 +.. section: Library + +FileIO leaks a file descriptor when trying to open a file for append that +isn't seekable. Patch by Brian Brazil. + +.. + +.. bpo: 6105 +.. date: 8239 +.. nonce: qt9xTV +.. section: Library + +json.dumps now respects OrderedDict's iteration order. + +.. + +.. bpo: 9295 +.. date: 8238 +.. nonce: M7y0mB +.. section: Library + +Fix a crash under Windows when calling close() on a file object with custom +buffering from two threads at once. + +.. + +.. bpo: 5027 +.. date: 8237 +.. nonce: 6mYRNc +.. section: Library + +The standard ``xml`` namespace is now understood by +xml.sax.saxutils.XMLGenerator as being bound to +http://www.w3.org/XML/1998/namespace. Patch by Troy J. Farrell. + +.. + +.. bpo: 10163 +.. date: 8236 +.. nonce: Lrvd6I +.. section: Library + +Skip unreadable registry keys during mimetypes initialization. + +.. + +.. bpo: 5117 +.. date: 8235 +.. nonce: FzD7qd +.. section: Library + +Fixed root directory related issue on posixpath.relpath() and +ntpath.relpath(). + +.. + +.. bpo: 9409 +.. date: 8234 +.. nonce: HRnhHT +.. section: Library + +Fix the regex to match all kind of filenames, for interactive debugging in +doctests. + +.. + +.. bpo: 6612 +.. date: 8233 +.. nonce: qaqnnh +.. section: Library + +Fix site and sysconfig to catch os.getcwd() error, eg. if the current +directory was deleted. Patch written by W. Trevor King. + +.. + +.. bpo: 10045 +.. date: 8232 +.. nonce: iz6KpQ +.. section: Library + +Improved performance when writing after seeking past the end of the "file" +in cStringIO. + +.. + +.. bpo: 9948 +.. date: 8231 +.. nonce: FOv8kp +.. section: Library + +Fixed problem of losing filename case information. + +.. + +.. bpo: 9437 +.. date: 8230 +.. nonce: a95HEb +.. section: Library + +Fix building C extensions with non-default LDFLAGS. + +.. + +.. bpo: 9759 +.. date: 8229 +.. nonce: aGsQic +.. section: Library + +GzipFile now raises ValueError when an operation is attempted after the file +is closed. Patch by Jeffrey Finkelstein. + +.. + +.. bpo: 9042 +.. date: 8228 +.. nonce: dQTK_C +.. section: Library + +Fix interaction of custom translation classes and caching in gettext. + +.. + +.. bpo: 9065 +.. date: 8227 +.. nonce: PTsv6_ +.. section: Library + +tarfile no longer uses "root" as the default for the uname and gname field. + +.. + +.. bpo: 1050268 +.. date: 8226 +.. nonce: oOtGVD +.. section: Library + +parseaddr now correctly quotes double quote and backslash characters that +appear inside quoted strings in email addresses. + +.. + +.. bpo: 10004 +.. date: 8225 +.. nonce: NTY_zM +.. section: Library + +quoprimime no longer generates a traceback when confronted with invalid +characters after '=' in a Q-encoded word. + +.. + +.. bpo: 9950 +.. date: 8224 +.. nonce: omOgj_ +.. section: Library + +Fix socket.sendall() crash or misbehaviour when a signal is received. Now +sendall() properly calls signal handlers if necessary, and retries sending +if these returned successfully, including on sockets with a timeout. + +.. + +.. bpo: 9947 +.. date: 8223 +.. nonce: YCbARo +.. section: Library + +logging: Fixed locking bug in stopListening. + +.. + +.. bpo: 9945 +.. date: 8222 +.. nonce: DTIygY +.. section: Library + +logging: Fixed locking bugs in addHandler/removeHandler. + +.. + +.. bpo: 9936 +.. date: 8221 +.. nonce: evd1vv +.. section: Library + +Fixed executable lines' search in the trace module. + +.. + +.. bpo: 9928 +.. date: 8220 +.. nonce: S5LHD8 +.. section: Library + +Properly initialize the types exported by the bz2 module. + +.. + +.. bpo: 9854 +.. date: 8219 +.. nonce: DxDKln +.. section: Library + +The default read() implementation in io.RawIOBase now handles non-blocking +readinto() returning None correctly. + +.. + +.. bpo: 9729 +.. date: 8218 +.. nonce: mSCrBH +.. section: Library + +Fix the signature of SSLSocket.recvfrom() and SSLSocket.sendto() to match +the corresponding socket methods. Also, fix various SSLSocket methods to +raise socket.error rather than an unhelpful TypeError when called on an +unconnected socket. Original patch by Andrew Bennetts. + +.. + +.. bpo: 9826 +.. date: 8217 +.. nonce: OHvlzj +.. section: Library + +OrderedDict.__repr__ can now handle self-referential values: d['x'] = d. + +.. + +.. bpo: 767645 +.. date: 8216 +.. nonce: YgbDPp +.. section: Library + +Set os.path.supports_unicode_filenames to True on Mac OS X. + +.. + +.. bpo: 9837 +.. date: 8215 +.. nonce: EZowT2 +.. section: Library + +The read() method of ZipExtFile objects (as returned by ZipFile.open()) +could return more bytes than requested. + +.. + +.. bpo: 9825 +.. date: 8214 +.. nonce: MVYNUl +.. section: Library + +removed __del__ from the definition of collections.OrderedDict. This +prevents user-created self-referencing ordered dictionaries from becoming +permanently uncollectable GC garbage. The downside is that removing __del__ +means that the internal doubly-linked list has to wait for GC collection +rather than freeing memory immediately when the refcnt drops to zero. + +.. + +.. bpo: 9816 +.. date: 8213 +.. nonce: jOgfeD +.. section: Library + +random.Random.jumpahead(n) did not produce a sufficiently different internal +state for small values of n. Fixed by salting the value. + +.. + +.. bpo: 9792 +.. date: 8212 +.. nonce: 6d8KN7 +.. section: Library + +In case of connection failure, socket.create_connection() would swallow the +exception and raise a new one, making it impossible to fetch the original +errno, or to filter timeout errors. Now the original error is re-raised. + +.. + +.. bpo: 9758 +.. date: 8211 +.. nonce: bTCX3s +.. section: Library + +When fcntl.ioctl() was called with mutable_flag set to True, and the passed +buffer was exactly 1024 bytes long, the buffer wouldn't be updated back +after the system call. Original patch by Brian Brazil. + +.. + +.. bpo: 1100562 +.. date: 8210 +.. nonce: w61Crx +.. section: Library + +Fix deep-copying of objects derived from the list and dict types. Patch by +Michele Orr? and Bj?rn Lindqvist. + +.. + +.. bpo: 7005 +.. date: 8209 +.. nonce: MVOzyL +.. section: Library + +Fixed output of None values for RawConfigParser.write and +ConfigParser.write. + +.. + +.. bpo: 808164 +.. date: 8208 +.. nonce: P5YO_B +.. section: Library + +Fixed socket.close to avoid references to globals, to avoid issues when +socket.close is called from a __del__ method. + +.. + +.. bpo: 2986 +.. date: 8207 +.. nonce: BeBn_s +.. section: Library + +difflib.SequenceMatcher gets a new parameter, autojunk, which can be set to +False to turn off the previously undocumented 'popularity' heuristic. Patch +by Terry Reedy and Eli Bendersky + +.. + +.. bpo: 8797 +.. date: 8206 +.. nonce: IkQxYA +.. section: Library + +urllib2 does a retry for Basic Authentication failure instead of falling +into recursion. + +.. + +.. bpo: 1194222 +.. date: 8205 +.. nonce: UXCJLq +.. section: Library + +email.utils.parsedate now returns RFC2822 compliant four character years +even if the message contains RFC822 two character years. + +.. + +.. bpo: 8750 +.. date: 8204 +.. nonce: ldqODt +.. section: Library + +Fixed MutableSet's methods to correctly handle reflexive operations, namely +x -= x and x ^= x. + +.. + +.. bpo: 9129 +.. date: 8203 +.. nonce: AYXAAf +.. section: Library + +smtpd.py is vulnerable to DoS attacks deriving from missing error handling +when accepting a new connection. + +.. + +.. bpo: 658749 +.. date: 8202 +.. nonce: THL2I_ +.. section: Library + +asyncore's connect() method now correctly interprets winsock errors. + +.. + +.. bpo: 9501 +.. date: 8201 +.. nonce: G-M-pc +.. section: Library + +Fixed logging regressions in cleanup code. + +.. + +.. bpo: 9214 +.. date: 8200 +.. nonce: j1o-Zo +.. section: Library + +Set operations on KeysView or ItemsView in the collections module now +correctly return a set. (Patch by Eli Bendersky.) + +.. + +.. bpo: 9617 +.. date: 8199 +.. nonce: blJoL4 +.. section: Library + +Signals received during a low-level write operation aren't ignored by the +buffered IO layer anymore. + +.. + +.. bpo: 2521 +.. date: 8198 +.. nonce: iTl7ZU +.. section: Library + +Use weakrefs on for caching in the abc module, so that classes are not held +onto after they are deleted elsewhere. + +.. + +.. bpo: 9626 +.. date: 8197 +.. nonce: Vowb6X +.. section: Library + +the view methods for collections.OrderedDict() were returning the unordered +versions inherited from dict. Those methods are now overridden to provide +ordered views. + +.. + +.. bpo: 8688 +.. date: 8196 +.. nonce: fFdtWn +.. section: Library + +MANIFEST files created by distutils now include a magic comment indicating +they are generated. Manually maintained MANIFESTs without this marker will +not be overwritten or removed. + +.. + +.. bpo: 7467 +.. date: 8195 +.. nonce: 2aq5Vk +.. section: Library + +when reading a file from a ZIP archive, its CRC is checked and a BadZipfile +error is raised if it doesn't match (as used to be the case in Python 2.5 +and earlier). + +.. + +.. bpo: 9550 +.. date: 8194 +.. nonce: gz0PSS +.. section: Library + +a BufferedReader could issue an additional read when the original read +request had been satisfied, which could block indefinitely when the +underlying raw IO channel was e.g. a socket. Report and original patch by +Jason V. Miller. + +.. + +.. bpo: 9551 +.. date: 8193 +.. nonce: 2q2VFJ +.. section: Library + +Don't raise TypeError when setting the value to None for SafeConfigParser +instances constructed with allow_no_value == True. + +.. + +.. bpo: 6915 +.. date: 8192 +.. nonce: Nh2L6- +.. section: Library + +Under Windows, os.listdir() didn't release the Global Interpreter Lock +around all system calls. Original patch by Ryan Kelly. + +.. + +.. bpo: 3757 +.. date: 8191 +.. nonce: Dfue1t +.. section: Library + +thread-local objects now support cyclic garbage collection. Thread-local +objects involved in reference cycles will be deallocated timely by the +cyclic GC, even if the underlying thread is still running. + +.. + +.. bpo: 6231 +.. date: 8190 +.. nonce: fvS6jF +.. section: Library + +Fix xml.etree.ElementInclude to include the tail of the current node. + +.. + +.. bpo: 6869 +.. date: 8189 +.. nonce: SI1hyJ +.. section: Library + +Fix a refcount problem in the _ctypes extension. + +.. + +.. bpo: 5504 +.. date: 8188 +.. nonce: DyvVKo +.. section: Library + +ctypes should now work with systems where mmap can't be PROT_WRITE and +PROT_EXEC. + +.. + +.. bpo: 8280 +.. date: 8187 +.. nonce: PrpMXx +.. section: Library + +urllib2's Request method will remove fragements in the url. This is how it +is supposed to work, wget and curl do the same. Previous behavior was +wrong. + +.. + +.. bpo: 2944 +.. date: 8186 +.. nonce: uva4MG +.. section: Library + +asyncore doesn't handle connection refused correctly. + +.. + +.. bpo: 3196 +.. date: 8185 +.. nonce: oFknaj +.. section: Library + +email header decoding is now forgiving if an RFC2047 encoded word encoded in +base64 is lacking padding. + +.. + +.. bpo: 9444 +.. date: 8184 +.. nonce: KdKxOB +.. section: Library + +Argparse now uses the first element of prefix_chars as the option character +for the added 'h/help' option if prefix_chars does not contain a '-', +instead of raising an error. + +.. + +.. bpo: 9354 +.. date: 8183 +.. nonce: 4mGRrJ +.. section: Library + +Provide getsockopt() in asyncore's file_wrapper. + +.. + +.. bpo: 9428 +.. date: 8182 +.. nonce: 0pea6y +.. section: Library + +Fix running scripts with the profile/cProfile modules from the command line. + +.. + +.. bpo: 7781 +.. date: 8181 +.. nonce: qJIM6S +.. section: Library + +Fix restricting stats by entry counts in the pstats interactive browser. + +.. + +.. bpo: 9209 +.. date: 8180 +.. nonce: q5h2aM +.. section: Library + +Do not crash in the pstats interactive browser on invalid regular +expressions. + +.. + +.. bpo: 7372 +.. date: 8179 +.. nonce: bjWkFm +.. section: Library + +Fix pstats regression when stripping paths from profile data generated with +the profile module. + +.. + +.. bpo: 4108 +.. date: 8178 +.. nonce: SGW4tp +.. section: Library + +In urllib.robotparser, if there are multiple 'User-agent: *' entries, +consider the first one. + +.. + +.. bpo: 8397 +.. date: 8177 +.. nonce: xNl1c0 +.. section: Library + +Raise an error when attempting to mix iteration and regular reads on a +BZ2File object, rather than returning incorrect results. + +.. + +.. bpo: 5294 +.. date: 8176 +.. nonce: OW1qhg +.. section: Library + +Fix the behavior of pdb's "continue" command when called in the top-level +debugged frame. + +.. + +.. bpo: 5727 +.. date: 8175 +.. nonce: sYm_N8 +.. section: Library + +Restore the ability to use readline when calling into pdb in doctests. + +.. + +.. bpo: 6719 +.. date: 8174 +.. nonce: _9t4CD +.. section: Library + +In pdb, do not stop somewhere in the encodings machinery if the source file +to be debugged is in a non-builtin encoding. + +.. + +.. bpo: 8048 +.. date: 8173 +.. nonce: UMKE5S +.. section: Library + +Prevent doctests from failing when sys.displayhook has been reassigned. + +.. + +.. bpo: 8015 +.. date: 8172 +.. nonce: YNaP75 +.. section: Library + +In pdb, do not crash when an empty line is entered as a breakpoint command. + +.. + +.. bpo: 9448 +.. date: 8171 +.. nonce: UD0blh +.. section: Library + +Fix a leak of OS resources (mutexes or semaphores) when re-initializing a +buffered IO object by calling its ``__init__`` method. + +.. + +.. bpo: 7909 +.. date: 8170 +.. nonce: KNWthV +.. section: Library + +Do not touch paths with the special prefixes ``\\.\`` or ``\\?\`` in +ntpath.normpath(). + +.. + +.. bpo: 5146 +.. date: 8169 +.. nonce: f9NwCU +.. section: Library + +Handle UID THREAD command correctly in imaplib. + +.. + +.. bpo: 5147 +.. date: 8168 +.. nonce: ANusbF +.. section: Library + +Fix the header generated for cookie files written by +http.cookiejar.MozillaCookieJar. + +.. + +.. bpo: 8198 +.. date: 8167 +.. nonce: WrGm2c +.. section: Library + +In pydoc, output all help text to the correct stream when sys.stdout is +reassigned. + +.. + +.. bpo: 7395 +.. date: 8166 +.. nonce: FkZk7v +.. section: Library + +Fix tracebacks in pstats interactive browser. + +.. + +.. bpo: 8230 +.. date: 8165 +.. nonce: pBkzM8 +.. section: Library + +Fix Lib/test/sortperf.py. + +.. + +.. bpo: 1713 +.. date: 8164 +.. nonce: fknkI- +.. section: Library + +Fix os.path.ismount(), which returned true for symbolic links across +devices. + +.. + +.. bpo: 8826 +.. date: 8163 +.. nonce: PcQ9NA +.. section: Library + +Properly load old-style "expires" attribute in http.cookies. + +.. + +.. bpo: 1690103 +.. date: 8162 +.. nonce: 5tT47_ +.. section: Library + +Fix initial namespace for code run with trace.main(). + +.. + +.. bpo: 8471 +.. date: 8161 +.. nonce: RqN6fc +.. section: Library + +In doctest, properly reset the output stream to an empty string when Unicode +was previously output. + +.. + +.. bpo: 8620 +.. date: 8160 +.. nonce: qQR7E1 +.. section: Library + +when a Cmd is fed input that reaches EOF without a final newline, it no +longer truncates the last character of the last command line. + +.. + +.. bpo: 6213 +.. date: 8159 +.. nonce: oyAtZ0 +.. section: Library + +Implement getstate() and setstate() methods of utf-8-sig and utf-16 +incremental encoders. + +.. + +.. bpo: 7113 +.. date: 8158 +.. nonce: vO-_y8 +.. section: Library + +Speed up loading in ConfigParser. Patch by ?ukasz Langa. + +.. + +.. bpo: 3704 +.. date: 8157 +.. nonce: UbuUn3 +.. section: Library + +cookielib was not properly handling URLs with a / in the parameters. + +.. + +.. bpo: 9032 +.. date: 8156 +.. nonce: zX39th +.. section: Library + +XML-RPC client retries the request on EPIPE error. The EPIPE error occurs +when the server closes the socket and the client sends a big XML-RPC +request. + +.. + +.. bpo: 5542 +.. date: 8155 +.. nonce: v5vo1o +.. section: Library + +Remove special logic that closes HTTPConnection socket on EPIPE. + +.. + +.. bpo: 4629 +.. date: 8154 +.. nonce: warUcf +.. section: Library + +getopt raises an error if an argument ends with = whereas getopt doesn't +except a value (eg. --help= is rejected if getopt uses ['help='] long +options). + +.. + +.. bpo: 7895 +.. date: 8153 +.. nonce: citB4G +.. section: Library + +platform.mac_ver() no longer crashes after calling os.fork() + +.. + +.. bpo: 5395 +.. date: 8152 +.. nonce: _AaZih +.. section: Library + +array.fromfile() would raise a spurious EOFError when an I/O error occurred. +Now an IOError is raised instead. Patch by chuck (Jan Hosang). + +.. + +.. bpo: 7646 +.. date: 8151 +.. nonce: af6LG8 +.. section: Library + +The fnmatch pattern cache no longer grows without bound. + +.. + +.. bpo: 9136 +.. date: 8150 +.. nonce: GFQg0c +.. section: Library + +Fix 'dictionary changed size during iteration' RuntimeError produced when +profiling the decimal module. This was due to a dangerous iteration over +'locals()' in Context.__init__. + +.. + +.. bpo: 0 +.. date: 8149 +.. nonce: aX1_fT +.. section: Library + +Fix extreme speed issue in Decimal.pow when the base is an exact power of 10 +and the exponent is tiny (for example, Decimal(10) ** +Decimal('1e-999999999')). + +.. + +.. bpo: 9161 +.. date: 8148 +.. nonce: 8Az_aI +.. section: Library + +Fix regression in optparse's acceptance of unicode strings in add_option +calls. + +.. + +.. bpo: 9130 +.. date: 8147 +.. nonce: cB_z-D +.. section: Library + +Fix validation of relative imports in parser module. + +.. + +.. bpo: 9128 +.. date: 8146 +.. nonce: 2OKBVh +.. section: Library + +Fix validation of class decorators in parser module. + +.. + +.. bpo: 9164 +.. date: 8145 +.. nonce: SK5COV +.. section: Library + +Ensure sysconfig handles dupblice archs while building on OSX + +.. + +.. bpo: 9315 +.. date: 8144 +.. nonce: cZkTvS +.. section: Library + +Fix for the trace module to record correct class name for tracing methods. + +.. + +.. bpo: 9054 +.. date: 8143 +.. nonce: UkA-OR +.. section: Library + +Fix a crash occurring when using the pyexpat module with expat version +2.0.1. + +.. + +.. bpo: 10003 +.. date: 8142 +.. nonce: AzaOdd +.. section: Library + +Allow handling of SIGBREAK on Windows. Fixes a regression introduced by +issue #9324. + +.. + +.. bpo: 8734 +.. date: 8141 +.. nonce: f1CtFi +.. section: Library + +Avoid crash in msvcrt.get_osfhandle() when an invalid file descriptor is +provided. Patch by Pascal Chambon. + +.. + +.. bpo: 7736 +.. date: 8140 +.. nonce: 7n0AS1 +.. section: Library + +Release the GIL around calls to opendir() and closedir() in the posix +module. Patch by Marcin Bachry. + +.. + +.. bpo: 0 +.. date: 8139 +.. nonce: Z5wyzY +.. section: Library + +As a result of issue #2521, the _weakref module is now compiled into the +interpreter by default. + +.. + +.. bpo: 9324 +.. date: 8138 +.. nonce: c_m8af +.. section: Library + +Add parameter validation to signal.signal on Windows in order to prevent +crashes. + +.. + +.. bpo: 9526 +.. date: 8137 +.. nonce: 8aO189 +.. section: Library + +Remove some outdated (int) casts that were preventing the array module from +working correctly with arrays of more than 2**31 elements. + +.. + +.. bpo: 0 +.. date: 8136 +.. nonce: yfc3zR +.. section: Library + +Fix memory leak in ssl._ssl._test_decode_cert. + +.. + +.. bpo: 8065 +.. date: 8135 +.. nonce: c5wBHe +.. section: Library + +Fix memory leak in readline module (from failure to free the result of +history_get_history_state()). + +.. + +.. bpo: 9450 +.. date: 8134 +.. nonce: 16iwLn +.. section: Library + +Fix memory leak in readline.replace_history_item and +readline.remove_history_item for readline version >= 5.0. + +.. + +.. bpo: 8105 +.. date: 8133 +.. nonce: GM5E7v +.. section: Library + +Validate file descriptor passed to mmap.mmap on Windows. + +.. + +.. bpo: 1019882 +.. date: 8132 +.. nonce: VnQ_2J +.. section: Library + +Fix IndexError when loading certain hotshot stats. + +.. + +.. bpo: 9422 +.. date: 8131 +.. nonce: MWxuZj +.. section: Library + +Fix memory leak when re-initializing a struct.Struct object. + +.. + +.. bpo: 7900 +.. date: 8130 +.. nonce: s8mvNz +.. section: Library + +The getgroups(2) system call on MacOSX behaves rather oddly compared to +other unix systems. In particular, os.getgroups() does not reflect any +changes made using os.setgroups() but basically always returns the same +information as the id command. + +os.getgroups() can now return more than 16 groups on MacOSX. + +.. + +.. bpo: 9277 +.. date: 8129 +.. nonce: yRnO3Z +.. section: Library + +Fix bug in struct.pack for bools in standard mode (e.g., struct.pack('>?')): +if conversion to bool raised an exception then that exception wasn't +properly propagated on machines where char is unsigned. + +.. + +.. bpo: 7567 +.. date: 8128 +.. nonce: hujTBu +.. section: Library + +Don't call `setupterm' twice. + +.. + +.. bpo: 7287 +.. date: 8127 +.. nonce: 6G503Q +.. section: Tools/Demos + +Demo/imputil/knee.py was removed. + +.. + +.. bpo: 9188 +.. date: 8126 +.. nonce: XIcIjV +.. section: Tools/Demos + +The gdb extension now handles correctly narrow (UCS2) as well as wide (UCS4) +unicode builds for both the host interpreter (embedded inside gdb) and the +interpreter under test. + +.. + +.. bpo: 8852 +.. date: 8125 +.. nonce: WD9-r5 +.. section: Build + +Allow the socket module to build on OpenSolaris. + +.. + +.. bpo: 10054 +.. date: 8124 +.. nonce: Pi5IJn +.. section: Build + +Some platforms provide uintptr_t in inttypes.h. Patch by Akira Kitada. + +.. + +.. bpo: 10055 +.. date: 8123 +.. nonce: xfTPZn +.. section: Build + +Make json C89-compliant in UCS4 mode. + +.. + +.. bpo: 1633863 +.. date: 8122 +.. nonce: 08O8Og +.. section: Build + +Don't ignore $CC under AIX. + +.. + +.. bpo: 9810 +.. date: 8121 +.. nonce: JACTWC +.. section: Build + +Compile bzip2 source files in python's project file directly. It used to be +built with bzip2's makefile. + +.. + +.. bpo: 941346 +.. date: 8120 +.. nonce: 4aE21V +.. section: Build + +Improve the build process under AIX and allow Python to be built as a shared +library. Patch by S?bastien Sabl?. + +.. + +.. bpo: 4026 +.. date: 8119 +.. nonce: 2Kz_uL +.. section: Build + +Make the fcntl extension build under AIX. Patch by S?bastien Sabl?. + +.. + +.. bpo: 3101 +.. date: 8118 +.. nonce: zq3p0s +.. section: Build + +Helper functions _add_one_to_index_C() and _add_one_to_index_F() become +_Py_add_one_to_index_C() and _Py_add_one_to_index_F(), respectively. + +.. + +.. bpo: 9700 +.. date: 8117 +.. nonce: tC4cof +.. section: Build + +define HAVE_BROKEN_POSIX_SEMAPHORES under AIX 6.x. Patch by S?bastien +Sabl?. + +.. + +.. bpo: 9280 +.. date: 8116 +.. nonce: 2PISFF +.. section: Build + +Make sharedinstall depend on sharedmods. + +.. + +.. bpo: 9275 +.. date: 8115 +.. nonce: DcFin- +.. section: Build + +The OSX installer once again installs links to binaries in +``/usr/local/bin``. + +.. + +.. bpo: 9392 +.. date: 8114 +.. nonce: aY7w6w +.. section: Build + +A framework build on OSX will once again use a versioned name of the +``2to3`` tool, that is you can use ``2to3-2.7`` to select the Python 2.7 +edition of 2to3. + +.. + +.. bpo: 9701 +.. date: 8113 +.. nonce: hgaEU8 +.. section: Build + +The MacOSX installer can patch the shell profile to ensure that the "bin" +directory inside the framework is on the shell's search path. This feature +now also supports the ZSH shell. + +.. + +.. bpo: 7473 +.. date: 8112 +.. nonce: NuS196 +.. section: Build + +avoid link errors when building a framework with a different set of +architectures than the one that is currently installed. + +.. + +.. bpo: 9978 +.. date: 8111 +.. nonce: PgNzKW +.. section: Tests + +Wait until subprocess completes initialization. (Win32KillTests in test_os) + +.. + +.. bpo: 9894 +.. date: 8110 +.. nonce: 9cw69_ +.. section: Tests + +Do not hardcode ENOENT in test_subprocess. + +.. + +.. bpo: 9323 +.. date: 8109 +.. nonce: qAJ8-i +.. section: Tests + +Make test.regrtest.__file__ absolute, this was not always the case when +running profile or trace, for example. + +.. + +.. bpo: 9315 +.. date: 8108 +.. nonce: f1i0qq +.. section: Tests + +Added tests for the trace module. Patch by Eli Bendersky. + +.. + +.. bpo: 0 +.. date: 8107 +.. nonce: AVwNn9 +.. section: Tests + +Strengthen test_unicode with explicit type checking for assertEqual tests. + +.. + +.. bpo: 8857 +.. date: 8106 +.. nonce: Hy6Qmf +.. section: Tests + +Provide a test case for socket.getaddrinfo. + +.. + +.. bpo: 7564 +.. date: 8105 +.. nonce: ps-pN3 +.. section: Tests + +Skip test_ioctl if another process is attached to /dev/tty. + +.. + +.. bpo: 8433 +.. date: 8104 +.. nonce: kMuB7u +.. section: Tests + +Fix test_curses failure with newer versions of ncurses. + +.. + +.. bpo: 9496 +.. date: 8103 +.. nonce: UDIGR0 +.. section: Tests + +Provide a test suite for the rlcompleter module. Patch by Michele Orr?. + +.. + +.. bpo: 8605 +.. date: 8102 +.. nonce: jxIp6Y +.. section: Tests + +Skip test_gdb if Python is compiled with optimizations. + +.. + +.. bpo: 9568 +.. date: 8101 +.. nonce: OoJYE5 +.. section: Tests + +Fix test_urllib2_localnet on OS X 10.3. + +.. + +.. bpo: 9817 +.. date: 8100 +.. nonce: sk3Q3T +.. section: Documentation + +Add expat COPYING file; add expat, libffi and expat licenses to +Doc/license.rst. + +.. + +.. bpo: 9524 +.. date: 8099 +.. nonce: Es25xw +.. section: Documentation + +Document that two CTRL* signals are meant for use only with os.kill. + +.. + +.. bpo: 9255 +.. date: 8098 +.. nonce: tp81US +.. section: Documentation + +Document that the 'test' package is for internal Python use only. + +.. + +.. bpo: 7829 +.. date: 8097 +.. nonce: o1BLF0 +.. section: Documentation + +Document in dis that bytecode is an implementation detail. diff --git a/Misc/NEWS.d/2.7.2.rst b/Misc/NEWS.d/2.7.2.rst new file mode 100644 index 00000000000..346afb15b8b --- /dev/null +++ b/Misc/NEWS.d/2.7.2.rst @@ -0,0 +1,16 @@ +.. bpo: 12009 +.. date: 8463 +.. nonce: nQPg8Y +.. release date: 2011-06-11 +.. section: Library + +Fixed regression in netrc file comment handling. + +.. + +.. bpo: 1221 +.. date: 8462 +.. nonce: vFJB6t +.. section: Library + +Make pyexpat.__version__ equal to the Python version. diff --git a/Misc/NEWS.d/2.7.2rc1.rst b/Misc/NEWS.d/2.7.2rc1.rst new file mode 100644 index 00000000000..0b6f7c02d21 --- /dev/null +++ b/Misc/NEWS.d/2.7.2rc1.rst @@ -0,0 +1,1661 @@ +.. bpo: 9670 +.. date: 8461 +.. nonce: D4p50W +.. release date: 2011-05-29 +.. section: Core and Builtins + +Increase the default stack size for secondary threads on Mac OS X and +FreeBSD to reduce the chances of a crash instead of a "maximum recursion +depth" RuntimeError exception. (patch by Ronald Oussoren) + +.. + +.. bpo: 0 +.. date: 8460 +.. nonce: w122h9 +.. section: Core and Builtins + +Correct lookup of __dir__ on objects. This allows old-style classes to have +__dir__. It also causes errors besides AttributeError found on lookup to be +propagated. + +.. + +.. bpo: 1195 +.. date: 8459 +.. nonce: rUvlec +.. section: Core and Builtins + +Fix input() if it is interrupted by CTRL+d and then CTRL+c, clear the end- +of-file indicator after CTRL+d. + +.. + +.. bpo: 8651 +.. date: 8458 +.. nonce: KT0VWy +.. section: Core and Builtins + +PyArg_Parse*() functions raise an OverflowError if the file doesn't have +PY_SSIZE_T_CLEAN define and the size doesn't fit in an int (length bigger +than 2^31-1 bytes). + +.. + +.. bpo: 8651 +.. date: 8457 +.. nonce: d-KV9c +.. section: Core and Builtins + +Fix "z#" format of PyArg_Parse*() function: the size was not written if +PY_SSIZE_T_CLEAN is defined. + +.. + +.. bpo: 9756 +.. date: 8456 +.. nonce: L962XN +.. section: Core and Builtins + +When calling a method descriptor or a slot wrapper descriptor, the check of +the object type doesn't read the __class__ attribute anymore. Fix a crash if +a class override its __class__ attribute (e.g. a proxy of the str type). +Patch written by Andreas St?hrk. + +.. + +.. bpo: 10517 +.. date: 8455 +.. nonce: eHRgPe +.. section: Core and Builtins + +After fork(), reinitialize the TLS used by the PyGILState_* APIs, to avoid a +crash with the pthread implementation in RHEL 5. Patch by Charles-Fran?ois +Natali. + +.. + +.. bpo: 6780 +.. date: 8454 +.. nonce: MS1yFK +.. section: Core and Builtins + +fix starts/endswith error message to mention that tuples are accepted too. + +.. + +.. bpo: 5057 +.. date: 8453 +.. nonce: BMmS2n +.. section: Core and Builtins + +fix a bug in the peepholer that led to non-portable pyc files between narrow +and wide builds while optimizing BINARY_SUBSCR on non-BMP chars (e.g. +u"\U00012345"[0]). + +.. + +.. bpo: 11650 +.. date: 8452 +.. nonce: r47Jvk +.. section: Core and Builtins + +PyOS_StdioReadline() retries fgets() if it was interrupted (EINTR), for +example if the program is stopped with CTRL+z on Mac OS X. Patch written by +Charles-Francois Natali. + +.. + +.. bpo: 11144 +.. date: 8451 +.. nonce: FE1cYC +.. section: Core and Builtins + +Ensure that int(a_float) returns an int whenever possible. Previously, there +were some corner cases where a long was returned even though the result was +within the range of an int. + +.. + +.. bpo: 11450 +.. date: 8450 +.. nonce: ulI9xJ +.. section: Core and Builtins + +Don't truncate hg version info in Py_GetBuildInfo() when there are many tags +(e.g. when using mq). Patch by Nadeem Vawda. + +.. + +.. bpo: 10451 +.. date: 8449 +.. nonce: wlYiI8 +.. section: Core and Builtins + +memoryview objects could allow mutating a readable buffer. Initial patch by +Ross Lagerwall. + +.. + +.. bpo: 10892 +.. date: 8448 +.. nonce: ATjwD_ +.. section: Core and Builtins + +Don't segfault when trying to delete __abstractmethods__ from a class. + +.. + +.. bpo: 8020 +.. date: 8447 +.. nonce: aERuZE +.. section: Core and Builtins + +Avoid a crash where the small objects allocator would read non-Python +managed memory while it is being modified by another thread. Patch by Matt +Bandy. + +.. + +.. bpo: 11004 +.. date: 8446 +.. nonce: 2Wj4t8 +.. section: Core and Builtins + +Repaired edge case in deque.count(). + +.. + +.. bpo: 8278 +.. date: 8445 +.. nonce: 8P-kMi +.. section: Core and Builtins + +On Windows and with a NTFS filesystem, os.stat() and os.utime() can now +handle dates after 2038. + +.. + +.. bpo: 4236 +.. date: 8444 +.. nonce: kMjQK6 +.. section: Core and Builtins + +Py_InitModule4 now checks the import machinery directly rather than the +Py_IsInitialized flag, avoiding a Fatal Python error in certain +circumstances when an import is done in __del__. + +.. + +.. bpo: 11828 +.. date: 8443 +.. nonce: nBlnst +.. section: Core and Builtins + +startswith and endswith don't accept None as slice index. Patch by Torsten +Becker. + +.. + +.. bpo: 10674 +.. date: 8442 +.. nonce: ZNFQ1f +.. section: Core and Builtins + +Remove unused 'dictmaker' rule from grammar. + +.. + +.. bpo: 10596 +.. date: 8441 +.. nonce: r05xzm +.. section: Core and Builtins + +Fix float.__mod__ to have the same behaviour as float.__divmod__ with +respect to signed zeros. -4.0 % 4.0 should be 0.0, not -0.0. + +.. + +.. bpo: 11386 +.. date: 8440 +.. nonce: wrrB8K +.. section: Core and Builtins + +bytearray.pop() now throws IndexError when the bytearray is empty, instead +of OverflowError. + +.. + +.. bpo: 12161 +.. date: 8439 +.. nonce: CmDpNV +.. section: Library + +Cause StringIO.getvalue() to raise a ValueError when used on a closed +StringIO instance. + +.. + +.. bpo: 12182 +.. date: 8438 +.. nonce: IWruZQ +.. section: Library + +Fix pydoc.HTMLDoc.multicolumn() if Python uses the new (true) division +(python -Qnew). Patch written by Ralf W. Grosse-Kunstleve. + +.. + +.. bpo: 12175 +.. date: 8437 +.. nonce: 9M55CV +.. section: Library + +RawIOBase.readall() now returns None if read() returns None. + +.. + +.. bpo: 12175 +.. date: 8436 +.. nonce: U3k4iw +.. section: Library + +FileIO.readall() now raises a ValueError instead of an IOError if the file +is closed. + +.. + +.. bpo: 1441530 +.. date: 8435 +.. nonce: pSlnFk +.. section: Library + +In imaplib, use makefile() to wrap the SSL socket to avoid heap +fragmentation and MemoryError with some malloc implementations. + +.. + +.. bpo: 12100 +.. date: 8434 +.. nonce: 4sb-gJ +.. section: Library + +Don't reset incremental encoders of CJK codecs at each call to their +encode() method anymore, but continue to call the reset() method if the +final argument is True. + +.. + +.. bpo: 12124 +.. date: 8433 +.. nonce: qpMI7g +.. section: Library + +zipimport doesn't keep a reference to zlib.decompress() anymore to be able +to unload the module. + +.. + +.. bpo: 10154 +.. date: 8432 +.. nonce: 4iPVr8 +.. section: Library + +change the normalization of UTF-8 to "UTF-8" instead of "UTF8" in the locale +module as the latter is not supported MacOSX and OpenBSD. (See also: +bpo-10090) + +.. + +.. bpo: 9516 +.. date: 8431 +.. nonce: WLkxuC +.. section: Library + +avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is set in shell. + +.. + +.. bpo: 12050 +.. date: 8430 +.. nonce: v6HF9i +.. section: Library + +zlib.decompressobj().decompress() now clears the unconsumed_tail attribute +when called without a max_length argument. + +.. + +.. bpo: 12062 +.. date: 8429 +.. nonce: fUVuyO +.. section: Library + +In the `io` module, fix a flushing bug when doing a certain type of I/O +sequence on a file opened in read+write mode (namely: reading, seeking a bit +forward, writing, then seeking before the previous write but still within +buffered data, and writing again). + +.. + +.. bpo: 8498 +.. date: 8428 +.. nonce: XooGVI +.. section: Library + +In socket.accept(), allow specifying 0 as a backlog value in order to accept +exactly one connection. Patch by Daniel Evers. + +.. + +.. bpo: 12012 +.. date: 8427 +.. nonce: raFUoR +.. section: Library + +ssl.PROTOCOL_SSLv2 becomes optional. + +.. + +.. bpo: 11927 +.. date: 8426 +.. nonce: UqvRAV +.. section: Library + +SMTP_SSL now uses port 465 by default as documented. Patch by Kasun Herath. + +.. + +.. bpo: 11999 +.. date: 8425 +.. nonce: aLa-HD +.. section: Library + +fixed sporadic sync failure mailbox.Maildir due to its trying to detect +mtime changes by comparing to the system clock instead of to the previous +value of the mtime. + +.. + +.. bpo: 10684 +.. date: 8424 +.. nonce: Ctye6o +.. section: Library + +shutil.move used to delete a folder on case insensitive filesystems when the +source and destination name where the same except for the case. + +.. + +.. bpo: 11982 +.. date: 8423 +.. nonce: 4CiHRO +.. section: Library + +fix json.loads('""') to return u'' rather than ''. + +.. + +.. bpo: 11277 +.. date: 8422 +.. nonce: 4nCUxv +.. section: Library + +mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get around a mmap +bug with sparse files. Patch written by Steffen Daode Nurpmeso. + +.. + +.. bpo: 10761 +.. date: 8421 +.. nonce: rwSQE7 +.. section: Library + +Fix tarfile.extractall failure when symlinked files are present. Initial +patch by Scott Leerssen. + +.. + +.. bpo: 11763 +.. date: 8420 +.. nonce: LPGrnG +.. section: Library + +don't use difflib in TestCase.assertMultiLineEqual if the strings are too +long. + +.. + +.. bpo: 11236 +.. date: 8419 +.. nonce: DyWdnL +.. section: Library + +getpass.getpass responds to ctrl-c or ctrl-z on terminal. + +.. + +.. bpo: 11768 +.. date: 8418 +.. nonce: HRg5Hy +.. section: Library + +The signal handler of the signal module only calls Py_AddPendingCall() for +the first signal to fix a deadlock on reentrant or parallel calls. +PyErr_SetInterrupt() writes also into the wake up file. + +.. + +.. bpo: 11875 +.. date: 8417 +.. nonce: xFn-yD +.. section: Library + +collections.OrderedDict's __reduce__ was temporarily mutating the object +instead of just working on a copy. + +.. + +.. bpo: 11442 +.. date: 8416 +.. nonce: Jta8go +.. section: Library + +Add a charset parameter to the Content-type in SimpleHTTPServer to avoid XSS +attacks. + +.. + +.. bpo: 11467 +.. date: 8415 +.. nonce: th8B0N +.. section: Library + +Fix urlparse behavior when handling urls which contains scheme specific part +only digits. Patch by Santoso Wijaya. + +.. + +.. bpo: 0 +.. date: 8414 +.. nonce: MOd782 +.. section: Library + +collections.Counter().copy() now works correctly for subclasses. + +.. + +.. bpo: 11474 +.. date: 8413 +.. nonce: UKTAWA +.. section: Library + +Fix the bug with url2pathname() handling of '/C|/' on Windows. Patch by +Santoso Wijaya. + +.. + +.. bpo: 9233 +.. date: 8412 +.. nonce: AIRcqi +.. section: Library + +Fix json.loads('{}') to return a dict (instead of a list), when _json is not +available. + +.. + +.. bpo: 11703 +.. date: 8411 +.. nonce: hwI5Mw +.. section: Library + +urllib2.geturl() does not return correct url when the original url contains +#fragment. + +.. + +.. bpo: 10019 +.. date: 8410 +.. nonce: J7QVFU +.. section: Library + +Fixed regression in json module where an indent of 0 stopped adding newlines +and acted instead like 'None'. + +.. + +.. bpo: 5162 +.. date: 8409 +.. nonce: UYJrO- +.. section: Library + +Treat services like frozen executables to allow child spawning from +multiprocessing.forking on Windows. + +.. + +.. bpo: 4877 +.. date: 8408 +.. nonce: 4B7uDJ +.. section: Library + +Fix a segfault in xml.parsers.expat while attempting to parse a closed file. + +.. + +.. bpo: 11830 +.. date: 8407 +.. nonce: tFEtWl +.. section: Library + +Remove unnecessary introspection code in the decimal module. It was causing +a failed import in the Turkish locale where the locale sensitive str.upper() +method caused a name mismatch. + +.. + +.. bpo: 8428 +.. date: 8406 +.. nonce: vVu7J6 +.. section: Library + +Fix a race condition in multiprocessing.Pool when terminating worker +processes: new processes would be spawned while the pool is being shut down. +Patch by Charles-Fran?ois Natali. + +.. + +.. bpo: 7311 +.. date: 8405 +.. nonce: lRokCQ +.. section: Library + +Fix HTMLParser to accept non-ASCII attribute values. + +.. + +.. bpo: 10963 +.. date: 8404 +.. nonce: _J-MW9 +.. section: Library + +Ensure that subprocess.communicate() never raises EPIPE. + +.. + +.. bpo: 11662 +.. date: 8403 +.. nonce: GpHbgk +.. section: Library + +Make urllib and urllib2 ignore redirections if the scheme is not HTTP, HTTPS +or FTP (CVE-2011-1521). + +.. + +.. bpo: 11256 +.. date: 8402 +.. nonce: AVqrHZ +.. section: Library + +Fix inspect.getcallargs on functions that take only keyword arguments. + +.. + +.. bpo: 11696 +.. date: 8401 +.. nonce: dzz7nM +.. section: Library + +Fix ID generation in msilib. + +.. + +.. bpo: 9696 +.. date: 8400 +.. nonce: Nh0u8J +.. section: Library + +Fix exception incorrectly raised by xdrlib.Packer.pack_int when trying to +pack a negative (in-range) integer. + +.. + +.. bpo: 11675 +.. date: 8399 +.. nonce: qFfmkU +.. section: Library + +multiprocessing.[Raw]Array objects created from an integer size are now +zeroed on creation. This matches the behaviour specified by the +documentation. + +.. + +.. bpo: 7639 +.. date: 8398 +.. nonce: PKfmwz +.. section: Library + +Fix short file name generation in bdist_msi. + +.. + +.. bpo: 11666 +.. date: 8397 +.. nonce: Hni56e +.. section: Library + +let help() display named tuple attributes and methods that start with a +leading underscore. + +.. + +.. bpo: 11673 +.. date: 8396 +.. nonce: uXlx4W +.. section: Library + +Fix multiprocessing Array and RawArray constructors to accept a size of type +'long', rather than only accepting 'int'. + +.. + +.. bpo: 10042 +.. date: 8395 +.. nonce: SCtRiD +.. section: Library + +Fixed the total_ordering decorator to handle cross-type comparisons that +could lead to infinite recursion. + +.. + +.. bpo: 10979 +.. date: 8394 +.. nonce: FjyVrT +.. section: Library + +unittest stdout buffering now works with class and module setup and +teardown. + +.. + +.. bpo: 11569 +.. date: 8393 +.. nonce: fp461F +.. section: Library + +use absolute path to the sysctl command in multiprocessing to ensure that it +will be found regardless of the shell PATH. This ensures that +multiprocessing.cpu_count works on default installs of MacOSX. + +.. + +.. bpo: 11500 +.. date: 8392 +.. nonce: SOGd4Y +.. section: Library + +Fixed a bug in the os x proxy bypass code for fully qualified IP addresses +in the proxy exception list. + +.. + +.. bpo: 11131 +.. date: 8391 +.. nonce: PnmRwo +.. section: Library + +Fix sign of zero in plus and minus operations when the context rounding mode +is ROUND_FLOOR. + +.. + +.. bpo: 5622 +.. date: 8390 +.. nonce: dM7tnW +.. section: Library + +Fix curses.wrapper to raise correct exception if curses initialization +fails. + +.. + +.. bpo: 11391 +.. date: 8389 +.. nonce: hdoRPe +.. section: Library + +Writing to a mmap object created with ``mmap.PROT_READ|mmap.PROT_EXEC`` +would segfault instead of raising a TypeError. Patch by Charles-Fran?ois +Natali. + +.. + +.. bpo: 11306 +.. date: 8388 +.. nonce: 2rXDt4 +.. section: Library + +mailbox in certain cases adapts to an inability to open certain files in +read-write mode. Previously it detected this by checking for EACCES, now it +also checks for EROFS. + +.. + +.. bpo: 11265 +.. date: 8387 +.. nonce: Y51oyn +.. section: Library + +asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), +send() and recv(). + +.. + +.. bpo: 11326 +.. date: 8386 +.. nonce: 2GUPyU +.. section: Library + +Add the missing connect_ex() implementation for SSL sockets, and make it +work for non-blocking connects. + +.. + +.. bpo: 10956 +.. date: 8385 +.. nonce: ArNOt6 +.. section: Library + +Buffered I/O classes retry reading or writing after a signal has arrived and +the handler returned successfully. + +.. + +.. bpo: 10680 +.. date: 8384 +.. nonce: pAmFnC +.. section: Library + +Fix mutually exclusive arguments for argument groups in argparse. + +.. + +.. bpo: 4681 +.. date: 8383 +.. nonce: I20jgq +.. section: Library + +Allow mmap() to work on file sizes and offsets larger than 4GB, even on +32-bit builds. Initial patch by Ross Lagerwall, adapted for 32-bit Windows. + +.. + +.. bpo: 10360 +.. date: 8382 +.. nonce: JAYw4l +.. section: Library + +In WeakSet, do not raise TypeErrors when testing for membership of non- +weakrefable objects. + +.. + +.. bpo: 10549 +.. date: 8381 +.. nonce: 15cASW +.. section: Library + +Fix pydoc traceback when text-documenting certain classes. + +.. + +.. bpo: 940286 +.. date: 8380 +.. nonce: cPglIg +.. section: Library + +pydoc.Helper.help() ignores input/output init parameters. + +.. + +.. bpo: 11171 +.. date: 8379 +.. nonce: ZXEFXT +.. section: Library + +Fix detection of config/Makefile when --prefix != --exec-prefix, which +caused Python to not start. + +.. + +.. bpo: 11116 +.. date: 8378 +.. nonce: J0xgWH +.. section: Library + +any error during addition of a message to a mailbox now causes a rollback, +instead of leaving the mailbox partially modified. + +.. + +.. bpo: 8275 +.. date: 8377 +.. nonce: -TRADs +.. section: Library + +Fix passing of callback arguments with ctypes under Win64. Patch by Stan +Mihai. + +.. + +.. bpo: 10949 +.. date: 8376 +.. nonce: sknBTt +.. section: Library + +Improved robustness of rotating file handlers. + +.. + +.. bpo: 10955 +.. date: 8375 +.. nonce: RSqPRN +.. section: Library + +Fix a potential crash when trying to mmap() a file past its length. Initial +patch by Ross Lagerwall. + +.. + +.. bpo: 10898 +.. date: 8374 +.. nonce: 2VhVxS +.. section: Library + +Allow compiling the posix module when the C library defines a symbol named +FSTAT. + +.. + +.. bpo: 10916 +.. date: 8373 +.. nonce: xpdEg8 +.. section: Library + +mmap should not segfault when a file is mapped using 0 as length and a non- +zero offset, and an attempt to read past the end of file is made (IndexError +is raised instead). Patch by Ross Lagerwall. + +.. + +.. bpo: 10875 +.. date: 8372 +.. nonce: RSNYLS +.. section: Library + +Update Regular Expression HOWTO; patch by 'SilentGhost'. + +.. + +.. bpo: 10827 +.. date: 8371 +.. nonce: vjZCZr +.. section: Library + +Changed the rules for 2-digit years. The time.asctime function will now +format any year when ``time.accept2dyear`` is false and will accept years >= +1000 otherwise. The year range accepted by ``time.mktime`` and +``time.strftime`` is still system dependent, but ``time.mktime`` will now +accept full range supported by the OS. Conversion of 2-digit years to +4-digit is deprecated. + +.. + +.. bpo: 10869 +.. date: 8370 +.. nonce: 3xBkWx +.. section: Library + +Fixed bug where ast.increment_lineno modified the root node twice. + +.. + +.. bpo: 7858 +.. date: 8369 +.. nonce: DKZMOA +.. section: Library + +Raise an error properly when os.utime() fails under Windows on an existing +file. + +.. + +.. bpo: 3839 +.. date: 8368 +.. nonce: zMNSit +.. section: Library + +wsgiref should not override a Content-Length header set by the application. +Initial patch by Clovis Fabricio. + +.. + +.. bpo: 10806 +.. date: 8367 +.. nonce: dEztuB +.. section: Library + +Fix subprocess pipes when some of the standard file descriptors (0, 1, 2) +are closed in the parent process. Initial patch by Ross Lagerwall. (See +also: bpo-9905) + +.. + +.. bpo: 4662 +.. date: 8366 +.. nonce: m3fHnI +.. section: Library + +os.tempnam(), os.tmpfile() and os.tmpnam() now raise a py3k +DeprecationWarning. + +.. + +.. bpo: 0 +.. date: 8365 +.. nonce: t8RJ2P +.. section: Library + +Subclasses of collections.OrderedDict now work correctly with __missing__. + +.. + +.. bpo: 10753 +.. date: 8364 +.. nonce: pjcQCT +.. section: Library + +Characters ';', '=' and ',' in the PATH_INFO environment variable won't be +quoted when the URI is constructed by the wsgiref.util 's request_uri +method. According to RFC 3986, these characters can be a part of params in +PATH component of URI and need not be quoted. + +.. + +.. bpo: 10738 +.. date: 8363 +.. nonce: GT7QZa +.. section: Library + +Fix webbrowser.Opera.raise_opts + +.. + +.. bpo: 9824 +.. date: 8362 +.. nonce: vJBIAh +.. section: Library + +SimpleCookie now encodes , and ; in values to cater to how browsers actually +parse cookies. + +.. + +.. bpo: 1379416 +.. date: 8361 +.. nonce: fpWgER +.. section: Library + +eliminated a source of accidental unicode promotion in +email.header.Header.encode. + +.. + +.. bpo: 5258 +.. date: 8360 +.. nonce: fNenmJ +.. section: Library + +if site.py encounters a .pth file that generates an error, it now prints the +filename, line number, and traceback to stderr and skips the rest of that +individual file, instead of stopping processing entirely. (See also: +bpo-10642) + +.. + +.. bpo: 10750 +.. date: 8359 +.. nonce: o-KFTn +.. section: Library + +The ``raw`` attribute of buffered IO objects is now read-only. + +.. + +.. bpo: 10242 +.. date: 8358 +.. nonce: uwgK8s +.. section: Library + +unittest.TestCase.assertItemsEqual makes too many assumptions about input. + +.. + +.. bpo: 10611 +.. date: 8357 +.. nonce: y67Wpv +.. section: Library + +SystemExit should not cause a unittest test run to exit. + +.. + +.. bpo: 6791 +.. date: 8356 +.. nonce: b5b4M7 +.. section: Library + +Limit header line length (to 65535 bytes) in http.client, to avoid denial of +services from the other party. + +.. + +.. bpo: 9907 +.. date: 8355 +.. nonce: EC_Wry +.. section: Library + +Fix tab handling on OSX when using editline by calling rl_initialize first, +then setting our custom defaults, then reading .editrc. + +.. + +.. bpo: 4188 +.. date: 8354 +.. nonce: nIr5eF +.. section: Library + +Avoid creating dummy thread objects when logging operations from the +threading module (with the internal verbose flag activated). + +.. + +.. bpo: 9721 +.. date: 8353 +.. nonce: G8i-SO +.. section: Library + +Fix the behavior of urljoin when the relative url starts with a ';' +character. Patch by Wes Chow. + +.. + +.. bpo: 10714 +.. date: 8352 +.. nonce: 2ytXWI +.. section: Library + +Limit length of incoming request in http.server to 65536 bytes for security +reasons. Initial patch by Ross Lagerwall. + +.. + +.. bpo: 9558 +.. date: 8351 +.. nonce: Zu3z6Q +.. section: Library + +Fix distutils.command.build_ext with VS 8.0. + +.. + +.. bpo: 10695 +.. date: 8350 +.. nonce: 9PoZLI +.. section: Library + +passing the port as a string value to telnetlib no longer causes debug mode +to fail. + +.. + +.. bpo: 10478 +.. date: 8349 +.. nonce: 3rusTg +.. section: Library + +Reentrant calls inside buffered IO objects (for example by way of a signal +handler) now raise a RuntimeError instead of freezing the current process. + +.. + +.. bpo: 10497 +.. date: 8348 +.. nonce: KCVp0v +.. section: Library + +Fix incorrect use of gettext in argparse. + +.. + +.. bpo: 10464 +.. date: 8347 +.. nonce: oT76Cm +.. section: Library + +netrc now correctly handles lines with embedded '#' characters. + +.. + +.. bpo: 1731717 +.. date: 8346 +.. nonce: 1WiN2u +.. section: Library + +Fixed the problem where subprocess.wait() could cause an OSError exception +when The OS had been told to ignore SIGCLD in our process or otherwise not +wait for exiting child processes. + +.. + +.. bpo: 9509 +.. date: 8345 +.. nonce: Oh-iMy +.. section: Library + +argparse now properly handles IOErrors raised by argparse.FileType. + +.. + +.. bpo: 9348 +.. date: 8344 +.. nonce: zsJPPj +.. section: Library + +Raise an early error if argparse nargs and metavar don't match. + +.. + +.. bpo: 8982 +.. date: 8343 +.. nonce: fTONNH +.. section: Library + +Improve the documentation for the argparse Namespace object. + +.. + +.. bpo: 9343 +.. date: 8342 +.. nonce: 9T-Qyz +.. section: Library + +Document that argparse parent parsers must be configured before their +children. + +.. + +.. bpo: 9026 +.. date: 8341 +.. nonce: 2xqEFT +.. section: Library + +Fix order of argparse sub-commands in help messages. + +.. + +.. bpo: 9347 +.. date: 8340 +.. nonce: R8xBsQ +.. section: Library + +Fix formatting for tuples in argparse type= error messages. + +.. + +.. bpo: 0 +.. date: 8339 +.. nonce: qXxXWp +.. section: Library + +Stop using the old interface for providing methods and attributes in the +_sre module. Among other things, this gives these classes ``__class__`` +attributes. (See #12099) + +.. + +.. bpo: 10169 +.. date: 8338 +.. nonce: OXJ9Nh +.. section: Library + +Fix argument parsing in socket.sendto() to avoid error masking. + +.. + +.. bpo: 12051 +.. date: 8337 +.. nonce: 7HjY_U +.. section: Library + +Fix segfault in json.dumps() while encoding highly-nested objects using the +C accelerations. + +.. + +.. bpo: 12017 +.. date: 8336 +.. nonce: w25YNq +.. section: Library + +Fix segfault in json.loads() while decoding highly-nested objects using the +C accelerations. + +.. + +.. bpo: 1838 +.. date: 8335 +.. nonce: EzKU3z +.. section: Library + +Prevent segfault in ctypes, when _as_parameter_ on a class is set to an +instance of the class. + +.. + +.. bpo: 678250 +.. date: 8334 +.. nonce: a5vtlO +.. section: Library + +Make mmap flush a noop on ACCESS_READ and ACCESS_COPY. + +.. + +.. bpo: 11718 +.. date: 8333 +.. nonce: giS1iY +.. section: IDLE + +IDLE's open module dialog couldn't find the __init__.py file in a package. + +.. + +.. bpo: 12590 +.. date: 8332 +.. nonce: dcDjo7 +.. section: IDLE + +IDLE editor window now always displays the first line when opening a long +file. With Tk 8.5, the first line was hidden. + +.. + +.. bpo: 11088 +.. date: 8331 +.. nonce: 08NI5v +.. section: IDLE + +don't crash when using F5 to run a script in IDLE on MacOSX with Tk 8.5. + +.. + +.. bpo: 10940 +.. date: 8330 +.. nonce: qwi3cm +.. section: IDLE + +Workaround an IDLE hang on Mac OS X 10.6 when using the menu accelerators +for Open Module, Go to Line, and New Indent Width. The accelerators still +work but no longer appear in the menu items. + +.. + +.. bpo: 10907 +.. date: 8329 +.. nonce: BHHc_r +.. section: IDLE + +Warn OS X 10.6 IDLE users to use ActiveState Tcl/Tk 8.5, rather than the +currently problematic Apple-supplied one, when running with the 64-/32-bit +installer variant. + +.. + +.. bpo: 11052 +.. date: 8328 +.. nonce: avmtSQ +.. section: IDLE + +Correct IDLE menu accelerators on Mac OS X for Save commands. + +.. + +.. bpo: 6075 +.. date: 8327 +.. nonce: AHKNEZ +.. section: IDLE + +IDLE on Mac OS X now works with both Carbon AquaTk and Cocoa AquaTk. + +.. + +.. bpo: 10404 +.. date: 8326 +.. nonce: CBzs_G +.. section: IDLE + +Use ctl-button-1 on OSX for the context menu in Idle. + +.. + +.. bpo: 10107 +.. date: 8325 +.. nonce: Bsx-F4 +.. section: IDLE + +Warn about unsaved files in IDLE on OSX. + +.. + +.. bpo: 10406 +.. date: 8324 +.. nonce: HKSefS +.. section: IDLE + +Enable Rstrip IDLE extension on OSX (just like on other platforms). + +.. + +.. bpo: 6378 +.. date: 8323 +.. nonce: Vr_x3W +.. section: IDLE + +Further adjust idle.bat to start associated Python + +.. + +.. bpo: 11896 +.. date: 8322 +.. nonce: XPwdkw +.. section: IDLE + +Save on Close failed despite selecting "Yes" in dialog. + +.. + +.. bpo: 4676 +.. date: 8321 +.. nonce: qQkued +.. section: IDLE + + toggle failing on Tk 8.5, causing IDLE exits and strange selection +behavior. Improve selection extension behaviour. + +.. + +.. bpo: 3851 +.. date: 8320 +.. nonce: iy6ENX +.. section: IDLE + + toggle non-functional when NumLock set on Windows. + +.. + +.. bpo: 11217 +.. date: 8319 +.. nonce: mIEwfc +.. section: Build + +For 64-bit/32-bit Mac OS X universal framework builds, ensure "make install" +creates symlinks in --prefix bin for the "-32" files in the framework bin +directory like the installer does. + +.. + +.. bpo: 11411 +.. date: 8318 +.. nonce: 1m9fjv +.. section: Build + +Fix 'make DESTDIR=' with a relative destination. + +.. + +.. bpo: 10709 +.. date: 8317 +.. nonce: QpLCFk +.. section: Build + +Add updated AIX notes in Misc/README.AIX. + +.. + +.. bpo: 11184 +.. date: 8316 +.. nonce: sGfAXw +.. section: Build + +Fix large-file support on AIX. + +.. + +.. bpo: 941346 +.. date: 8315 +.. nonce: heMADD +.. section: Build + +Fix broken shared library build on AIX. + +.. + +.. bpo: 11268 +.. date: 8314 +.. nonce: Lgcka6 +.. section: Build + +Prevent Mac OS X Installer failure if Documentation package had previously +been installed. + +.. + +.. bpo: 11079 +.. date: 8313 +.. nonce: Y0Hh5V +.. section: Build + +The /Applications/Python x.x folder created by the Mac OS X installers now +includes a link to the installed documentation. + +.. + +.. bpo: 11054 +.. date: 8312 +.. nonce: BN3sYU +.. section: Build + +Allow Mac OS X installer builds to again work on 10.5 with the system- +provided Python. + +.. + +.. bpo: 10843 +.. date: 8311 +.. nonce: EdyFR6 +.. section: Build + +Update third-party library versions used in OS X 32-bit installer builds: +bzip2 1.0.6, readline 6.1.2, SQLite 3.7.4 (with FTS3/FTS4 and RTREE +enabled), and ncursesw 5.5 (wide-char support enabled). + +.. + +.. bpo: 0 +.. date: 8310 +.. nonce: nsY3xU +.. section: Build + +Don't run pgen twice when using make -j. + +.. + +.. bpo: 7716 +.. date: 8309 +.. nonce: KkZ-2b +.. section: Build + +Under Solaris, don't assume existence of /usr/xpg4/bin/grep in the configure +script but use $GREP instead. Patch by Fabian Groffen. + +.. + +.. bpo: 10475 +.. date: 8308 +.. nonce: LVKSbB +.. section: Build + +Don't hardcode compilers for LDSHARED/LDCXXSHARED on NetBSD and DragonFly +BSD. Patch by Nicolas Joly. + +.. + +.. bpo: 10655 +.. date: 8307 +.. nonce: WauLJp +.. section: Build + +Fix the build on PowerPC on Linux with GCC when building with timestamp +profiling (--with-tsc): the preprocessor test for the PowerPC support now +looks for "__powerpc__" as well as "__ppc__": the latter seems to only be +present on OS X; the former is the correct one for Linux with GCC. + +.. + +.. bpo: 1099 +.. date: 8306 +.. nonce: KikOsu +.. section: Build + +Fix the build on MacOSX when building a framework with pydebug using GCC +4.0. + +.. + +.. bpo: 11164 +.. date: 8305 +.. nonce: w2nrYU +.. section: Tests + +Remove obsolete allnodes test from minidom test. + +.. + +.. bpo: 12205 +.. date: 8304 +.. nonce: gVhWmC +.. section: Tests + +Fix test_subprocess failure due to uninstalled test data. + +.. + +.. bpo: 5723 +.. date: 8303 +.. nonce: Lfg1OX +.. section: Tests + +Improve json tests to be executed with and without accelerations. + +.. + +.. bpo: 11910 +.. date: 8302 +.. nonce: HhQx49 +.. section: Tests + +Fix test_heapq to skip the C tests when _heapq is missing. + +.. + +.. bpo: 0 +.. date: 8301 +.. nonce: i8QOXe +.. section: Tests + +Fix test_startfile to wait for child process to terminate before finishing. + +.. + +.. bpo: 11719 +.. date: 8300 +.. nonce: ojamUL +.. section: Tests + +Fix message about unexpected test_msilib skip on non-Windows platforms. +Patch by Nadeem Vawda. + +.. + +.. bpo: 7108 +.. date: 8299 +.. nonce: xaF3OE +.. section: Tests + +Fix test_commands to not fail when special attributes ('@' or '.') appear in +'ls -l' output. + +.. + +.. bpo: 11490 +.. date: 8298 +.. nonce: I86Gxz +.. section: Tests + +test_subprocess:test_leaking_fds_on_error no longer gives a false positive +if the last directory in the path is inaccessible. + +.. + +.. bpo: 10822 +.. date: 8297 +.. nonce: P0VrIZ +.. section: Tests + +Fix test_posix:test_getgroups failure under Solaris. Patch by Ross +Lagerwall. + +.. + +.. bpo: 6293 +.. date: 8296 +.. nonce: J7ur1U +.. section: Tests + +Have regrtest.py echo back sys.flags. This is done by default in whole runs +and enabled selectively using ``--header`` when running an explicit list of +tests. Original patch by Collin Winter. + +.. + +.. bpo: 775964 +.. date: 8295 +.. nonce: 7a2XLN +.. section: Tests + +test_grp now skips YP/NIS entries instead of failing when encountering them. + +.. + +.. bpo: 7110 +.. date: 8294 +.. nonce: SyQreJ +.. section: Tests + +regrtest now sends test failure reports and single-failure tracebacks to +stderr rather than stdout. diff --git a/Misc/NEWS.d/2.7.3rc1.rst b/Misc/NEWS.d/2.7.3rc1.rst new file mode 100644 index 00000000000..1fdc19f5fdf --- /dev/null +++ b/Misc/NEWS.d/2.7.3rc1.rst @@ -0,0 +1,1916 @@ +.. bpo: 13020 +.. date: 8656 +.. nonce: 7y51PJ +.. release date: 2012-02-23 +.. section: Core and Builtins + +Fix a reference leak when allocating a structsequence object fails. Patch +by Suman Saha. + +.. + +.. bpo: 13703 +.. date: 8655 +.. nonce: 8FylqY +.. section: Core and Builtins + +oCERT-2011-003: add -R command-line option and PYTHONHASHSEED environment +variable, to provide an opt-in way to protect against denial of service +attacks due to hash collisions within the dict and set types. Patch by +David Malcolm, based on work by Victor Stinner. + +.. + +.. bpo: 11235 +.. date: 8654 +.. nonce: 6wzkv- +.. section: Core and Builtins + +Fix OverflowError when trying to import a source file whose modification +time doesn't fit in a 32-bit timestamp. + +.. + +.. bpo: 11638 +.. date: 8653 +.. nonce: M-D70Z +.. section: Core and Builtins + +Unicode strings in 'name' and 'version' no longer cause UnicodeDecodeErrors. + +.. + +.. bpo: 0 +.. date: 8652 +.. nonce: 2J4kRL +.. section: Core and Builtins + +Fix the fix for issue #12149: it was incorrect, although it had the side +effect of appearing to resolve the issue. Thanks to Mark Shannon for +noticing. + +.. + +.. bpo: 13546 +.. date: 8651 +.. nonce: iNNZwK +.. section: Core and Builtins + +Fixed an overflow issue that could crash the intepreter when calling +sys.setrecursionlimit((1<<31)-1). + +.. + +.. bpo: 13333 +.. date: 8650 +.. nonce: jkzjPN +.. section: Core and Builtins + +The UTF-7 decoder now accepts lone surrogates (the encoder already accepts +them). + +.. + +.. bpo: 10519 +.. date: 8649 +.. nonce: vnPUhZ +.. section: Core and Builtins + +Avoid unnecessary recursive function calls in setobject.c. + +.. + +.. bpo: 13268 +.. date: 8648 +.. nonce: 1add1A +.. section: Core and Builtins + +Fix the assert statement when a tuple is passed as the message. + +.. + +.. bpo: 13018 +.. date: 8647 +.. nonce: WRySxn +.. section: Core and Builtins + +Fix reference leaks in error paths in dictobject.c. Patch by Suman Saha. + +.. + +.. bpo: 12604 +.. date: 8646 +.. nonce: dDegux +.. section: Core and Builtins + +VTRACE macro expanded to no-op in _sre.c to avoid compiler warnings. Patch +by Josh Triplett and Petri Lehtinen. + +.. + +.. bpo: 7833 +.. date: 8645 +.. nonce: NcSnnJ +.. section: Core and Builtins + +Extension modules built using distutils on Windows will no longer include a +"manifest" to prevent them failing at import time in some embedded +situations. + +.. + +.. bpo: 13186 +.. date: 8644 +.. nonce: 8x-IKP +.. section: Core and Builtins + +Fix __delitem__ on old-style instances when invoked through +PySequence_DelItem. + +.. + +.. bpo: 13156 +.. date: 8643 +.. nonce: YQ_oHA +.. section: Core and Builtins + +Revert the patch for issue #10517 (reset TLS upon fork()), which was only +relevant for the native pthread TLS implementation. + +.. + +.. bpo: 7732 +.. date: 8642 +.. nonce: Su45lo +.. section: Core and Builtins + +Fix a crash on importing a module if a directory has the same name than a +Python module (e.g. "__init__.py"): don't close the file twice. + +.. + +.. bpo: 12973 +.. date: 8641 +.. nonce: i36yPj +.. section: Core and Builtins + +Fix overflow checks that invoked undefined behaviour in int.__pow__. These +overflow checks were causing int.__pow__ to produce incorrect results with +recent versions of Clang, as a result of the compiler optimizing the check +away. Also fix similar overflow checks in list_repeat (listobject.c) and +islice_next (itertoolsmodule.c). These bugs caused test failures with +recent versions of Clang. + +.. + +.. bpo: 12266 +.. date: 8640 +.. nonce: SifsgD +.. section: Core and Builtins + +Fix str.capitalize() to correctly uppercase/lowercase titlecased and cased +non-letter characters. + +.. + +.. bpo: 12610 +.. date: 8639 +.. nonce: ppRi5I +.. section: Core and Builtins + +Verify that user generated AST has correct string and identifier types +before compiling. (See also: bpo-12609) + +.. + +.. bpo: 11627 +.. date: 8638 +.. nonce: sfRw_E +.. section: Core and Builtins + +Fix segfault when __new__ on an exception returns a non-exception class. + +.. + +.. bpo: 12149 +.. date: 8637 +.. nonce: tp-PTF +.. section: Core and Builtins + +Update the method cache after a type's dictionnary gets cleared by the +garbage collector. This fixes a segfault when an instance and its type get +caught in a reference cycle, and the instance's deallocator calls one of the +methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by +Davide Rizzo. + +.. + +.. bpo: 12501 +.. date: 8636 +.. nonce: 25PdW1 +.. section: Core and Builtins + +Remove Py3k warning for callable. callable() is supported again in Python +3.2. + +.. + +.. bpo: 9611 +.. date: 8635 +.. nonce: tQEmuh +.. section: Core and Builtins + +FileIO.read(), FileIO.readinto(), FileIO.write() and os.write() clamp the +length to INT_MAX on Windows. (See also: bpo-9015) + +.. + +.. bpo: 1195 +.. date: 8634 +.. nonce: Tp_J8Y +.. section: Core and Builtins + +my_fgets() now always clears errors before calling fgets(). Fix the +following case: sys.stdin.read() stopped with CTRL+d (end of file), +raw_input() interrupted by CTRL+c. + +.. + +.. bpo: 10860 +.. date: 8633 +.. nonce: _w3Kvl +.. section: Core and Builtins + +httplib now correctly handles an empty port after port delimiter in URLs. + +.. + +.. bpo: 0 +.. date: 8632 +.. nonce: dh7XT7 +.. section: Core and Builtins + +dict_proxy objects now display their contents rather than just the class +name. + +.. + +.. bpo: 8033 +.. date: 8631 +.. nonce: vZ-AWU +.. section: Library + +sqlite3: Fix 64-bit integer handling in user functions on 32-bit +architectures. Initial patch by Philippe Devalkeneer. + +.. + +.. bpo: 0 +.. date: 8630 +.. nonce: Apd_xz +.. section: Library + +HTMLParser is now able to handle slashes in the start tag. + +.. + +.. bpo: 14001 +.. date: 8629 +.. nonce: Za_h38 +.. section: Library + +CVE-2012-0845: xmlrpc: Fix an endless loop in SimpleXMLRPCServer upon +malformed POST request. + +.. + +.. bpo: 2489 +.. date: 8628 +.. nonce: EENP1J +.. section: Library + +pty.spawn could consume 100% cpu when it encountered an EOF. + +.. + +.. bpo: 13014 +.. date: 8627 +.. nonce: bfZLHS +.. section: Library + +Fix a possible reference leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 13987 +.. date: 8626 +.. nonce: rZLDDo +.. section: Library + +HTMLParser is now able to handle EOFs in the middle of a construct and +malformed start tags. + +.. + +.. bpo: 13015 +.. date: 8625 +.. nonce: bxws6S +.. section: Library + +Fix a possible reference leak in defaultdict.__repr__. Patch by Suman Saha. + +.. + +.. bpo: 13979 +.. date: 8624 +.. nonce: Q0ci2w +.. section: Library + +A bug in ctypes.util.find_library that caused the wrong library name to be +returned has been fixed. + +.. + +.. bpo: 1326113 +.. date: 8623 +.. nonce: QvF-XL +.. section: Library + +distutils' build_ext command --libraries option now correctly parses +multiple values separated by whitespace or commas. + +.. + +.. bpo: 13993 +.. date: 8622 +.. nonce: 4g3z3P +.. section: Library + +HTMLParser is now able to handle broken end tags. + +.. + +.. bpo: 13960 +.. date: 8621 +.. nonce: g0TjwZ +.. section: Library + +HTMLParser is now able to handle broken comments. + +.. + +.. bpo: 9750 +.. date: 8620 +.. nonce: CsQyVM +.. section: Library + +Fix sqlite3.Connection.iterdump on tables and fields with a name that is a +keyword or contains quotes. Patch by Marko Kohtala. + +.. + +.. bpo: 13994 +.. date: 8619 +.. nonce: pnLrEB +.. section: Library + +Earlier partial revert of Distutils enhancements in 2.7 has left two +versions of customize_compiler, the original in distutils.sysconfig and +another copy in distutils.ccompiler, with some parts of distutils calling +one and others using the other. Complete the revert back to only having one +in distutils.sysconfig as is the case in 3.x. + +.. + +.. bpo: 13590 +.. date: 8618 +.. nonce: b6Qvrj +.. section: Library + +On OS X 10.7 and 10.6 with Xcode 4.2, building Distutils-based packages with +C extension modules may fail because Apple has removed gcc-4.2, the version +used to build python.org 64-bit/32-bit Pythons. If the user does not +explicitly override the default C compiler by setting the CC environment +variable, Distutils will now attempt to compile extension modules with clang +if gcc-4.2 is required but not found. Also as a convenience, if the user +does explicitly set CC, substitute its value as the default compiler in the +Distutils LDSHARED configuration variable for OS X. (Note, the python.org +32-bit-only Pythons use gcc-4.0 and the 10.4u SDK, neither of which are +available in Xcode 4. This change does not attempt to override settings to +support their use with Xcode 4.) + +.. + +.. bpo: 9021 +.. date: 8617 +.. nonce: A0WRsT +.. section: Library + +Add an introduction to the copy module documentation. + +.. + +.. bpo: 6005 +.. date: 8616 +.. nonce: cy8Z22 +.. section: Library + +Examples in the socket library documentation use sendall, where relevant, +instead send method. + +.. + +.. bpo: 10811 +.. date: 8615 +.. nonce: m6b_ZC +.. section: Library + +Fix recursive usage of cursors. Instead of crashing, raise a +ProgrammingError now. + +.. + +.. bpo: 13676 +.. date: 8614 +.. nonce: IwPgKL +.. section: Library + +Handle strings with embedded zeros correctly in sqlite3. + +.. + +.. bpo: 13806 +.. date: 8613 +.. nonce: Y34Lg3 +.. section: Library + +The size check in audioop decompression functions was too strict and could +reject valid compressed data. Patch by Oleg Plakhotnyuk. + +.. + +.. bpo: 13885 +.. date: 8612 +.. nonce: fTNryk +.. section: Library + +CVE-2011-3389: the _ssl module would always disable the CBC IV attack +countermeasure. + +.. + +.. bpo: 6631 +.. date: 8611 +.. nonce: FyxhCp +.. section: Library + +Disallow relative file paths in urllib urlopen methods. + +.. + +.. bpo: 13781 +.. date: 8610 +.. nonce: xWnNcZ +.. section: Library + +Prevent gzip.GzipFile from using the dummy filename provided by file objects +opened with os.fdopen(). + +.. + +.. bpo: 13589 +.. date: 8609 +.. nonce: sQsnEf +.. section: Library + +Fix some serialization primitives in the aifc module. Patch by Oleg +Plakhotnyuk. + +.. + +.. bpo: 13803 +.. date: 8608 +.. nonce: WnPIts +.. section: Library + +Under Solaris, distutils doesn't include bitness in the directory name. + +.. + +.. bpo: 13642 +.. date: 8607 +.. nonce: 8qUg-G +.. section: Library + +Unquote before b64encoding user:password during Basic Authentication. Patch +contributed by Joonas Kuorilehto and Michele Orr?. + +.. + +.. bpo: 13636 +.. date: 8606 +.. nonce: eWRf1t +.. section: Library + +Weak ciphers are now disabled by default in the ssl module (except when +SSLv2 is explicitly asked for). + +.. + +.. bpo: 12798 +.. date: 8605 +.. nonce: ggdsmY +.. section: Library + +Updated the mimetypes documentation. + +.. + +.. bpo: 13639 +.. date: 8604 +.. nonce: X0z3dn +.. section: Library + +Accept unicode filenames in tarfile.open(mode="w|gz"). + +.. + +.. bpo: 1785 +.. date: 8603 +.. nonce: DKL5I8 +.. section: Library + +Fix inspect and pydoc with misbehaving descriptors. + +.. + +.. bpo: 7502 +.. date: 8602 +.. nonce: lIMyju +.. section: Library + +Fix equality comparison for DocTestCase instances. Patch by C?dric Krier. + +.. + +.. bpo: 11870 +.. date: 8601 +.. nonce: 85bAB9 +.. section: Library + +threading: Properly reinitialize threads internal locks and condition +variables to avoid deadlocks in child processes. + +.. + +.. bpo: 8035 +.. date: 8600 +.. nonce: yzn_Oa +.. section: Library + +urllib: Fix a bug where the client could remain stuck after a redirection or +an error. + +.. + +.. bpo: 0 +.. date: 8599 +.. nonce: xZO873 +.. section: Library + +tarfile.py: Correctly detect bzip2 compressed streams with blocksizes other +than 900k. + +.. + +.. bpo: 13573 +.. date: 8598 +.. nonce: 2oPaJa +.. section: Library + +The csv.writer now uses the repr() for floats rather than str(). This allows +floats to round-trip without loss of precision. + +.. + +.. bpo: 13439 +.. date: 8597 +.. nonce: H8wdOt +.. section: Library + +Fix many errors in turtle docstrings. + +.. + +.. bpo: 12856 +.. date: 8596 +.. nonce: 7eIfN8 +.. section: Library + +Ensure child processes do not inherit the parent's random seed for filename +generation in the tempfile module. Patch by Brian Harring. + +.. + +.. bpo: 13458 +.. date: 8595 +.. nonce: EHyzED +.. section: Library + +Fix a memory leak in the ssl module when decoding a certificate with a +subjectAltName. Patch by Robert Xiao. + +.. + +.. bpo: 13415 +.. date: 8594 +.. nonce: Ap8joO +.. section: Library + +os.unsetenv() doesn't ignore errors anymore. + +.. + +.. bpo: 13322 +.. date: 8593 +.. nonce: Ect89q +.. section: Library + +Fix BufferedWriter.write() to ensure that BlockingIOError is raised when the +wrapped raw file is non-blocking and the write would block. Previous code +assumed that the raw write() would raise BlockingIOError, but +RawIOBase.write() is defined to returned None when the call would block. +Patch by sbt. + +.. + +.. bpo: 13358 +.. date: 8592 +.. nonce: kPO1ja +.. section: Library + +HTMLParser now calls handle_data only once for each CDATA. + +.. + +.. bpo: 4147 +.. date: 8591 +.. nonce: wQbNcw +.. section: Library + +minidom's toprettyxml no longer adds whitespace around a text node when it +is the only child of an element. Initial patch by Dan Kenigsberg. + +.. + +.. bpo: 1745761 +.. date: 8590 +.. nonce: zfO1ng +.. section: Library + +HTMLParser now correctly handles non-valid attributes, including adjacent +and unquoted attributes. (See also: bpo-755670, bpo-13357, bpo-12629, +bpo-1200313) + +.. + +.. bpo: 13373 +.. date: 8589 +.. nonce: 8wM3bP +.. section: Library + +multiprocessing.Queue.get() could sometimes block indefinitely when called +with a timeout. Patch by Arnaud Ysmal. + +.. + +.. bpo: 3067 +.. date: 8588 +.. nonce: yjMIU9 +.. section: Library + +Enhance the documentation and docstring of locale.setlocale(). + +.. + +.. bpo: 13254 +.. date: 8587 +.. nonce: CKJxT0 +.. section: Library + +Fix Maildir initialization so that maildir contents are read correctly. + +.. + +.. bpo: 13140 +.. date: 8586 +.. nonce: EguPSD +.. section: Library + +Fix the daemon_threads attribute of ThreadingMixIn. + +.. + +.. bpo: 2892 +.. date: 8585 +.. nonce: kugtRq +.. section: Library + +preserve iterparse events in case of SyntaxError. + +.. + +.. bpo: 670664 +.. date: 8584 +.. nonce: dPMzKt +.. section: Library + +Fix HTMLParser to correctly handle the content of ```` +and ````. + +.. + +.. bpo: 10817 +.. date: 8583 +.. nonce: 2NZ4yV +.. section: Library + +Fix urlretrieve function to raise ContentTooShortError even when reporthook +is None. Patch by Jyrki Pulliainen. + +.. + +.. bpo: 7334 +.. date: 8582 +.. nonce: HVmJ5I +.. section: Library + +close source files on ElementTree.parse and iterparse. + +.. + +.. bpo: 13232 +.. date: 8581 +.. nonce: WWF7QZ +.. section: Library + +logging: Improved logging of exceptions in the presence of multiple +encodings. + +.. + +.. bpo: 10332 +.. date: 8580 +.. nonce: E9qFmi +.. section: Library + +multiprocessing: fix a race condition when a Pool is closed before all tasks +have completed. + +.. + +.. bpo: 1548891 +.. date: 8579 +.. nonce: isTjAs +.. section: Library + +The cStringIO.StringIO() constructor now encodes unicode arguments with the +system default encoding just like the write() method does, instead of +converting it to a raw buffer. This also fixes handling of unicode input in +the shlex module (#6988, #1170). + +.. + +.. bpo: 9168 +.. date: 8578 +.. nonce: eLGWkL +.. section: Library + +now smtpd is able to bind privileged port. + +.. + +.. bpo: 12529 +.. date: 8577 +.. nonce: TX2NNI +.. section: Library + +fix cgi.parse_header issue on strings with double-quotes and semicolons +together. Patch by Ben Darnell and Petri Lehtinen. + +.. + +.. bpo: 6090 +.. date: 8576 +.. nonce: 8BVasJ +.. section: Library + +zipfile raises a ValueError when a document with a timestamp earlier than +1980 is provided. Patch contributed by Petri Lehtinen. + +.. + +.. bpo: 13194 +.. date: 8575 +.. nonce: b0HQpu +.. section: Library + +zlib.compressobj().copy() and zlib.decompressobj().copy() are now available +on Windows. + +.. + +.. bpo: 13114 +.. date: 8574 +.. nonce: qtS6EQ +.. section: Library + +Fix the distutils commands check and register when the long description is a +Unicode string with non-ASCII characters. + +.. + +.. bpo: 7367 +.. date: 8573 +.. nonce: 2xoC41 +.. section: Library + +Fix pkgutil.walk_paths to skip directories whose contents cannot be read. + +.. + +.. bpo: 7425 +.. date: 8572 +.. nonce: e4gH2x +.. section: Library + +Prevent pydoc -k failures due to module import errors. (Backport to 2.7 of +existing 3.x fix) + +.. + +.. bpo: 13099 +.. date: 8571 +.. nonce: hhmbgp +.. section: Library + +Fix sqlite3.Cursor.lastrowid under a Turkish locale. Reported and diagnosed +by Thomas Kluyver. + +.. + +.. bpo: 7689 +.. date: 8570 +.. nonce: --iH31 +.. section: Library + +Allow pickling of dynamically created classes when their metaclass is +registered with copy_reg. Patch by Nicolas M. Thi?ry and Craig Citro. + +.. + +.. bpo: 13058 +.. date: 8569 +.. nonce: KJ3kEA +.. section: Library + +ossaudiodev: fix a file descriptor leak on error. Patch by Thomas Jarosch. + +.. + +.. bpo: 12931 +.. date: 8568 +.. nonce: b6La4G +.. section: Library + +xmlrpclib now encodes Unicode URI to ISO-8859-1, instead of failing with a +UnicodeDecodeError. + +.. + +.. bpo: 8933 +.. date: 8567 +.. nonce: yiVHCJ +.. section: Library + +distutils' PKG-INFO files will now correctly report Metadata-Version: 1.1 +instead of 1.0 if a Classifier or Download-URL field is present. + +.. + +.. bpo: 8286 +.. date: 8566 +.. nonce: 9gJAZN +.. section: Library + +The distutils command sdist will print a warning message instead of crashing +when an invalid path is given in the manifest template. + +.. + +.. bpo: 12841 +.. date: 8565 +.. nonce: VRTnfy +.. section: Library + +tarfile unnecessarily checked the existence of numerical user and group ids +on extraction. If one of them did not exist the respective id of the current +user (i.e. root) was used for the file and ownership information was lost. + +.. + +.. bpo: 10946 +.. date: 8564 +.. nonce: HYgRut +.. section: Library + +The distutils commands bdist_dumb, bdist_wininst and bdist_msi now respect a +--skip-build option given to bdist. + +.. + +.. bpo: 12287 +.. date: 8563 +.. nonce: _b1Hy3 +.. section: Library + +Fix a stack corruption in ossaudiodev module when the FD is greater than +FD_SETSIZE. + +.. + +.. bpo: 12839 +.. date: 8562 +.. nonce: YFQywe +.. section: Library + +Fix crash in zlib module due to version mismatch. Fix by Richard M. Tew. + +.. + +.. bpo: 12786 +.. date: 8561 +.. nonce: Wv58St +.. section: Library + +Set communication pipes used by subprocess.Popen CLOEXEC to avoid them being +inherited by other subprocesses. + +.. + +.. bpo: 4106 +.. date: 8560 +.. nonce: CWHsfS +.. section: Library + +Fix occasional exceptions printed out by multiprocessing on interpreter +shutdown. + +.. + +.. bpo: 11657 +.. date: 8559 +.. nonce: K6NkKs +.. section: Library + +Fix sending file descriptors over 255 over a multiprocessing Pipe. + +.. + +.. bpo: 12213 +.. date: 8558 +.. nonce: nL3AJE +.. section: Library + +Fix a buffering bug with interleaved reads and writes that could appear on +io.BufferedRandom streams. + +.. + +.. bpo: 12326 +.. date: 8557 +.. nonce: oR88Sz +.. section: Library + +sys.platform is now always 'linux2' on Linux, even if Python is compiled on +Linux 3. + +.. + +.. bpo: 13007 +.. date: 8556 +.. nonce: 6OcUii +.. section: Library + +whichdb should recognize gdbm 1.9 magic numbers. + +.. + +.. bpo: 9173 +.. date: 8555 +.. nonce: 7CSZen +.. section: Library + +Let shutil._make_archive work if the logger argument is None. + +.. + +.. bpo: 12650 +.. date: 8554 +.. nonce: hY2GLb +.. section: Library + +Fix a race condition where a subprocess.Popen could leak resources +(FD/zombie) when killed at the wrong time. + +.. + +.. bpo: 12752 +.. date: 8553 +.. nonce: 3uiyON +.. section: Library + +Fix regression which prevented locale.normalize() from accepting unicode +strings. + +.. + +.. bpo: 12683 +.. date: 8552 +.. nonce: pySdFM +.. section: Library + +urlparse updated to include svn as schemes that uses relative paths. (svn +from 1.5 onwards support relative path). + +.. + +.. bpo: 11933 +.. date: 8551 +.. nonce: voGTke +.. section: Library + +Fix incorrect mtime comparison in distutils. + +.. + +.. bpo: 11104 +.. date: 8550 +.. nonce: EZRzAK +.. section: Library + +Fix the behavior of distutils' sdist command with manually-maintained +MANIFEST files. (See also: bpo-8688) + +.. + +.. bpo: 8887 +.. date: 8549 +.. nonce: GV2FAG +.. section: Library + +"pydoc somebuiltin.somemethod" (or help('somebuiltin.somemethod') in Python +code) now finds the doc of the method. + +.. + +.. bpo: 12603 +.. date: 8548 +.. nonce: wO8DQ8 +.. section: Library + +Fix pydoc.synopsis() on files with non-negative st_mtime. + +.. + +.. bpo: 12514 +.. date: 8547 +.. nonce: e1PR4a +.. section: Library + +Use try/finally to assure the timeit module restores garbage collections +when it is done. + +.. + +.. bpo: 12607 +.. date: 8546 +.. nonce: t5RWHt +.. section: Library + +In subprocess, fix issue where if stdin, stdout or stderr is given as a low +fd, it gets overwritten. + +.. + +.. bpo: 12102 +.. date: 8545 +.. nonce: VJSgGA +.. section: Library + +Document that buffered files must be flushed before being used with mmap. +Patch by Steffen Daode Nurpmeso. + +.. + +.. bpo: 12560 +.. date: 8544 +.. nonce: 9ydkW_ +.. section: Library + +Build libpython.so on OpenBSD. Patch by Stefan Sperling. + +.. + +.. bpo: 1813 +.. date: 8543 +.. nonce: M1IkRm +.. section: Library + +Fix codec lookup and setting/getting locales under Turkish locales. + +.. + +.. bpo: 10883 +.. date: 8542 +.. nonce: _e0WlS +.. section: Library + +Fix socket leaks in urllib when using FTP. + +.. + +.. bpo: 12592 +.. date: 8541 +.. nonce: -EZrk3 +.. section: Library + +Make Python build on OpenBSD 5 (and future major releases). + +.. + +.. bpo: 12372 +.. date: 8540 +.. nonce: 7QRSzO +.. section: Library + +POSIX semaphores are broken on AIX: don't use them. + +.. + +.. bpo: 12571 +.. date: 8539 +.. nonce: qrkjgh +.. section: Library + +Add a plat-linux3 directory mirroring the plat-linux2 directory, so that +"import DLFCN" and other similar imports work on Linux 3.0. + +.. + +.. bpo: 7484 +.. date: 8538 +.. nonce: 0bZoAH +.. section: Library + +smtplib no longer puts <> around addresses in VRFY and EXPN commands; they +aren't required and in fact postfix doesn't support that form. + +.. + +.. bpo: 11603 +.. date: 8537 +.. nonce: B016rQ +.. section: Library + +Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. + +.. + +.. bpo: 12502 +.. date: 8536 +.. nonce: p8Kedr +.. section: Library + +asyncore: fix polling loop with AF_UNIX sockets. + +.. + +.. bpo: 4376 +.. date: 8535 +.. nonce: 6yUats +.. section: Library + +ctypes now supports nested structures in an endian different than the parent +structure. Patch by Vlad Riscutia. + +.. + +.. bpo: 12493 +.. date: 8534 +.. nonce: qaPq_Q +.. section: Library + +subprocess: Popen.communicate() now also handles EINTR errors if the process +has only one pipe. + +.. + +.. bpo: 12467 +.. date: 8533 +.. nonce: x0sMKt +.. section: Library + +warnings: fix a race condition if a warning is emitted at shutdown, if +globals()['__file__'] is None. + +.. + +.. bpo: 12352 +.. date: 8532 +.. nonce: Htm8Oe +.. section: Library + +Fix a deadlock in multiprocessing.Heap when a block is freed by the garbage +collector while the Heap lock is held. + +.. + +.. bpo: 9516 +.. date: 8531 +.. nonce: v8AhHk +.. section: Library + +On Mac OS X, change Distutils to no longer globally attempt to check or set +the MACOSX_DEPLOYMENT_TARGET environment variable for the interpreter +process. This could cause failures in non-Distutils subprocesses and was +unreliable since tests or user programs could modify the interpreter +environment after Distutils set it. Instead, have Distutils set the +deployment target only in the environment of each build subprocess. It is +still possible to globally override the default by setting +MACOSX_DEPLOYMENT_TARGET before launching the interpreter; its value must be +greater or equal to the default value, the value with which the interpreter +was built. + +.. + +.. bpo: 11802 +.. date: 8530 +.. nonce: 6ktAp2 +.. section: Library + +The cache in filecmp now has a maximum size of 100 so that it won't grow +without bound. + +.. + +.. bpo: 12404 +.. date: 8529 +.. nonce: bS5-Qf +.. section: Library + +Remove C89 incompatible code from mmap module. Patch by Akira Kitada. + +.. + +.. bpo: 11700 +.. date: 8528 +.. nonce: VpdGS5 +.. section: Library + +mailbox proxy object close methods can now be called multiple times without +error, and _ProxyFile now closes the wrapped file. + +.. + +.. bpo: 12133 +.. date: 8527 +.. nonce: Ag9yty +.. section: Library + +AbstractHTTPHandler.do_open() of urllib.request closes the HTTP connection +if its getresponse() method fails with a socket error. Patch written by Ezio +Melotti. + +.. + +.. bpo: 9284 +.. date: 8526 +.. nonce: -NhBcF +.. section: Library + +Allow inspect.findsource() to find the source of doctest functions. + +.. + +.. bpo: 10694 +.. date: 8525 +.. nonce: JD6qXr +.. section: Library + +zipfile now ignores garbage at the end of a zipfile. + +.. + +.. bpo: 11583 +.. date: 8524 +.. nonce: Wu1xMh +.. section: Library + +Speed up os.path.isdir on Windows by using GetFileAttributes instead of +os.stat. + +.. + +.. bpo: 12080 +.. date: 8523 +.. nonce: oDmVxk +.. section: Library + +Fix a performance issue in Decimal._power_exact that caused some corner-case +Decimal.__pow__ calls to take an unreasonably long time. + +.. + +.. bpo: 0 +.. date: 8522 +.. nonce: aMnclC +.. section: Library + +Named tuples now work correctly with vars(). + +.. + +.. bpo: 0 +.. date: 8521 +.. nonce: qdHiJw +.. section: Library + +sys.setcheckinterval() now updates the current ticker count as well as +updating the check interval, so if the user decreases the check interval, +the ticker doesn't have to wind down to zero from the old starting point +before the new interval takes effect. And if the user increases the +interval, it makes sure the new limit takes effect right away rather have an +early task switch before recognizing the new interval. + +.. + +.. bpo: 12085 +.. date: 8520 +.. nonce: cu9-Sp +.. section: Library + +Fix an attribute error in subprocess.Popen destructor if the constructor has +failed, e.g. because of an undeclared keyword argument. Patch written by +Oleg Oshmyan. + +.. + +.. bpo: 9041 +.. date: 8519 +.. nonce: iLXuHK +.. section: Library + +An issue in ctypes.c_longdouble, ctypes.c_double, and ctypes.c_float that +caused an incorrect exception to be returned in the case of overflow has +been fixed. + +.. + +.. bpo: 0 +.. date: 8518 +.. nonce: zRuNTM +.. section: Library + +bsddb module: Erratic behaviour of "DBEnv->rep_elect()" because a typo. +Possible crash. + +.. + +.. bpo: 13774 +.. date: 8517 +.. nonce: -HkPbH +.. section: Library + +json: Fix a SystemError when a bogus encoding is passed to json.loads(). + +.. + +.. bpo: 9975 +.. date: 8516 +.. nonce: 2SRKp5 +.. section: Library + +socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. + +.. + +.. bpo: 13159 +.. date: 8515 +.. nonce: Zoj0wD +.. section: Library + +FileIO, BZ2File, and the built-in file class now use a linear-time buffer +growth strategy instead of a quadratic one. + +.. + +.. bpo: 13070 +.. date: 8514 +.. nonce: zcoYVY +.. section: Library + +Fix a crash when a TextIOWrapper caught in a reference cycle would be +finalized after the reference to its underlying BufferedRWPair's writer got +cleared by the GC. + +.. + +.. bpo: 12881 +.. date: 8513 +.. nonce: IpOO6j +.. section: Library + +ctypes: Fix segfault with large structure field names. + +.. + +.. bpo: 13013 +.. date: 8512 +.. nonce: KLH96V +.. section: Library + +ctypes: Fix a reference leak in PyCArrayType_from_ctype. Thanks to Suman +Saha for finding the bug and providing a patch. + +.. + +.. bpo: 13022 +.. date: 8511 +.. nonce: zeo8hs +.. section: Library + +Fix: _multiprocessing.recvfd() doesn't check that file descriptor was +actually received. + +.. + +.. bpo: 12483 +.. date: 8510 +.. nonce: IpGhKV +.. section: Library + +ctypes: Fix a crash when the destruction of a callback object triggers the +garbage collector. + +.. + +.. bpo: 12950 +.. date: 8509 +.. nonce: Z7xl-R +.. section: Library + +Fix passing file descriptors in multiprocessing, under OpenIndiana/Illumos. + +.. + +.. bpo: 12764 +.. date: 8508 +.. nonce: YtBoIj +.. section: Library + +Fix a crash in ctypes when the name of a Structure field is not a string. + +.. + +.. bpo: 9651 +.. date: 8507 +.. nonce: INPcwf +.. section: Library + +Fix a crash when ctypes.create_string_buffer(0) was passed to some functions +like file.write(). + +.. + +.. bpo: 10309 +.. date: 8506 +.. nonce: -z_Mxz +.. section: Library + +Define _GNU_SOURCE so that mremap() gets the proper signature. Without +this, architectures where sizeof void* != sizeof int are broken. Patch +given by Hallvard B Furuseth. + +.. + +.. bpo: 964437 +.. date: 8505 +.. nonce: buwNGK +.. section: IDLE + +Make IDLE help window non-modal. Patch by Guilherme Polo and Roger Serwy. + +.. + +.. bpo: 13933 +.. date: 8504 +.. nonce: 5CAw8l +.. section: IDLE + +IDLE auto-complete did not work with some imported module, like hashlib. +(Patch by Roger Serwy) + +.. + +.. bpo: 13506 +.. date: 8503 +.. nonce: ztXHhD +.. section: IDLE + +Add '' to path for IDLE Shell when started and restarted with Restart Shell. +Original patches by Marco Scataglini and Roger Serwy. + +.. + +.. bpo: 4625 +.. date: 8502 +.. nonce: 2pS4tW +.. section: IDLE + +If IDLE cannot write to its recent file or breakpoint files, display a +message popup and continue rather than crash. (original patch by Roger +Serwy) + +.. + +.. bpo: 8793 +.. date: 8501 +.. nonce: 2eA1HO +.. section: IDLE + +Prevent IDLE crash when given strings with invalid hex escape sequences. + +.. + +.. bpo: 13296 +.. date: 8500 +.. nonce: bMHIFe +.. section: IDLE + +Fix IDLE to clear compile __future__ flags on shell restart. (Patch by Roger +Serwy) + +.. + +.. bpo: 14409 +.. date: 8499 +.. nonce: 8SNyRR +.. section: IDLE + +IDLE now properly executes commands in the Shell window when it cannot read +the normal config files on startup and has to use the built-in default key +bindings. There was previously a bug in one of the defaults. + +.. + +.. bpo: 3573 +.. date: 8498 +.. nonce: yIQRtd +.. section: IDLE + +IDLE hangs when passing invalid command line args (directory(ies) instead of +file(s)). + +.. + +.. bpo: 6807 +.. date: 8497 +.. nonce: lfskSG +.. section: Build + +Run msisupport.mak earlier. + +.. + +.. bpo: 10580 +.. date: 8496 +.. nonce: GkwWHF +.. section: Build + +Minor grammar change in Windows installer. + +.. + +.. bpo: 12627 +.. date: 8495 +.. nonce: pVGmbv +.. section: Build + +Implement PEP 394 for Python 2.7 ("python2"). + +.. + +.. bpo: 8746 +.. date: 8494 +.. nonce: z-aagT +.. section: Build + +Correct faulty configure checks so that os.chflags() and os.lchflags() are +once again built on systems that support these functions (*BSD and OS X). +Also add new stat file flags for OS X (UF_HIDDEN and UF_COMPRESSED). + +.. + +.. bpo: 14053 +.. date: 8493 +.. nonce: tR4DDC +.. section: Tools/Demos + +patchcheck.py ("make patchcheck") now works with MQ patches. Patch by +Francisco Mart?n Brugu?. + +.. + +.. bpo: 13930 +.. date: 8492 +.. nonce: jUdfJ- +.. section: Tools/Demos + +2to3 is now able to write its converted output files to another directory +tree as well as copying unchanged files and altering the file suffix. See +its new -o, -W and --add-suffix options. This makes it more useful in many +automated code translation workflows. + +.. + +.. bpo: 10639 +.. date: 8491 +.. nonce: ZGu-0K +.. section: Tools/Demos + +reindent.py no longer converts newlines and will raise an error if +attempting to convert a file with mixed newlines. + +.. + +.. bpo: 13628 +.. date: 8490 +.. nonce: XznUD3 +.. section: Tools/Demos + +python-gdb.py is now able to retrieve more frames in the Python traceback if +Python is optimized. + +.. + +.. bpo: 15467 +.. date: 8489 +.. nonce: Ilkvjd +.. section: Tests + +Move helpers for __sizeof__ tests into test_support. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 11689 +.. date: 8488 +.. nonce: n1UPYK +.. section: Tests + +Fix a variable scoping error in an sqlite3 test. Initial patch by Torsten +Landschoff. + +.. + +.. bpo: 10881 +.. date: 8487 +.. nonce: CG7Ecn +.. section: Tests + +Fix test_site failures with OS X framework builds. + +.. + +.. bpo: 13901 +.. date: 8486 +.. nonce: ICKGPH +.. section: Tests + +Prevent test_distutils failures on OS X with --enable-shared. + +.. + +.. bpo: 13304 +.. date: 8485 +.. nonce: jDDi97 +.. section: Tests + +Skip test case if user site-packages disabled (-s or PYTHONNOUSERSITE). +(Patch by Carl Meyer) + +.. + +.. bpo: 13218 +.. date: 8484 +.. nonce: EZ3jnV +.. section: Tests + +Fix test_ssl failures on Debian/Ubuntu. + +.. + +.. bpo: 12821 +.. date: 8483 +.. nonce: fmA715 +.. section: Tests + +Fix test_fcntl failures on OpenBSD 5. + +.. + +.. bpo: 12331 +.. date: 8482 +.. nonce: ZSPeJW +.. section: Tests + +The test suite for lib2to3 can now run from an installed Python. + +.. + +.. bpo: 12549 +.. date: 8481 +.. nonce: S4urNL +.. section: Tests + +Correct test_platform to not fail when OS X returns 'x86_64' as the +processor type on some Mac systems. + +.. + +.. bpo: 0 +.. date: 8480 +.. nonce: EofQqr +.. section: Tests + +Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary +failure in name resolution. + +.. + +.. bpo: 11812 +.. date: 8479 +.. nonce: jeNaCB +.. section: Tests + +Solve transient socket failure to connect to 'localhost' in +test_telnetlib.py. + +.. + +.. bpo: 0 +.. date: 8478 +.. nonce: cUdl39 +.. section: Tests + +Solved a potential deadlock in test_telnetlib.py. Related to issue #11812. + +.. + +.. bpo: 0 +.. date: 8477 +.. nonce: QtTimW +.. section: Tests + +Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and an +overzealous DNS service (e.g. OpenDNS) redirects to a placeholder Web site. + +.. + +.. bpo: 0 +.. date: 8476 +.. nonce: Vvh-2P +.. section: Tests + +Avoid failing in test_urllibnet.test_bad_address when some overzealous DNS +service (e.g. OpenDNS) resolves a non-existent domain name. The test is now +skipped instead. + +.. + +.. bpo: 8716 +.. date: 8475 +.. nonce: -qUe-z +.. section: Tests + +Avoid crashes caused by Aqua Tk on OSX when attempting to run test_tk or +test_ttk_guionly under a username that is not currently logged in to the +console windowserver (as may be the case under buildbot or ssh). + +.. + +.. bpo: 12141 +.. date: 8474 +.. nonce: -5YCgZ +.. section: Tests + +Install a copy of template C module file so that test_build_ext of +test_distutils is no longer silently skipped when run outside of a build +directory. + +.. + +.. bpo: 8746 +.. date: 8473 +.. nonce: I497O- +.. section: Tests + +Add additional tests for os.chflags() and os.lchflags(). Patch by Garrett +Cooper. + +.. + +.. bpo: 10736 +.. date: 8472 +.. nonce: 60t_7a +.. section: Tests + +Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9 on Mac OS X. (Patch +by Ronald Oussoren) + +.. + +.. bpo: 12057 +.. date: 8471 +.. nonce: 7QVG6T +.. section: Tests + +Add tests for ISO 2022 codecs (iso2022_jp, iso2022_jp_2, iso2022_kr). + +.. + +.. bpo: 13491 +.. date: 8470 +.. nonce: zMFNID +.. section: Documentation + +Fix many errors in sqlite3 documentation. Initial patch for #13491 by +Johannes Vogel. (See also: bpo-13995) + +.. + +.. bpo: 13402 +.. date: 8469 +.. nonce: VSNrG0 +.. section: Documentation + +Document absoluteness of sys.executable. + +.. + +.. bpo: 13883 +.. date: 8468 +.. nonce: atFSNh +.. section: Documentation + +PYTHONCASEOK also works on OS X, OS/2, and RiscOS. + +.. + +.. bpo: 2134 +.. date: 8467 +.. nonce: lkdzru +.. section: Documentation + +The tokenize documentation has been clarified to explain why all operator +and delimiter tokens are treated as token.OP tokens. + +.. + +.. bpo: 13513 +.. date: 8466 +.. nonce: Z6l39q +.. section: Documentation + +Fix io.IOBase documentation to correctly link to the io.IOBase.readline +method instead of the readline module. + +.. + +.. bpo: 13237 +.. date: 8465 +.. nonce: EVVjZK +.. section: Documentation + +Reorganise subprocess documentation to emphasise convenience functions and +the most commonly needed arguments to Popen. + +.. + +.. bpo: 13141 +.. date: 8464 +.. nonce: rDLimI +.. section: Documentation + +Demonstrate recommended style for SocketServer examples. diff --git a/Misc/NEWS.d/2.7.3rc2.rst b/Misc/NEWS.d/2.7.3rc2.rst new file mode 100644 index 00000000000..8927310b2ea --- /dev/null +++ b/Misc/NEWS.d/2.7.3rc2.rst @@ -0,0 +1,10 @@ +.. bpo: 14234 +.. date: 8657 +.. nonce: 3-5k8_ +.. release date: 2012-03-17 +.. section: Library + +CVE-2012-0876: Randomize hashes of xml attributes in the hash table internal +to the pyexpat module's copy of the expat library to avoid a denial of +service due to hash collisions. Patch by David Malcolm with some +modifications by the expat project. diff --git a/Misc/NEWS.d/2.7.4.rst b/Misc/NEWS.d/2.7.4.rst new file mode 100644 index 00000000000..5fbe3ab3780 --- /dev/null +++ b/Misc/NEWS.d/2.7.4.rst @@ -0,0 +1,64 @@ +.. bpo: 17550 +.. date: 9013 +.. nonce: zn8gOk +.. release date: 2013-04-06 +.. section: Build + +Fix the --enable-profiling configure switch. + +.. + +.. bpo: 15801 +.. date: 9012 +.. nonce: zsLcEY +.. section: Core and Builtins + +With string % formatting, relax the type check for a mapping such that any +type with a __getitem__ can be used on the right hand side. + +.. + +.. bpo: 17625 +.. date: 9011 +.. nonce: SoDm9J +.. section: IDLE + +In IDLE, close the replace dialog after it is used. + +.. + +.. bpo: 17835 +.. date: 9010 +.. nonce: mJdR71 +.. section: Tests + +Fix test_io when the default OS pipe buffer size is larger than one million +bytes. + +.. + +.. bpo: 17531 +.. date: 9009 +.. nonce: 7PzWC2 +.. section: Tests + +Fix tests that thought group and user ids were always the int type. Also, +always allow -1 as a valid group and user id. + +.. + +.. bpo: 17533 +.. date: 9008 +.. nonce: XGejM9 +.. section: Tests + +Fix test_xpickle with older versions of Python 2.5. + +.. + +.. bpo: 17538 +.. date: 9007 +.. nonce: M8FVLz +.. section: Documentation + +Document XML vulnerabilties diff --git a/Misc/NEWS.d/2.7.4rc1.rst b/Misc/NEWS.d/2.7.4rc1.rst new file mode 100644 index 00000000000..bb0bd5f9481 --- /dev/null +++ b/Misc/NEWS.d/2.7.4rc1.rst @@ -0,0 +1,3419 @@ +.. bpo: 10211 +.. date: 9006 +.. nonce: JF6QJN +.. release date: 2013-03-23 +.. section: Core and Builtins + +Buffer objects expose the new buffer interface internally + +.. + +.. bpo: 16445 +.. date: 9005 +.. nonce: EF19nl +.. section: Core and Builtins + +Fixed potential segmentation fault when deleting an exception message. + +.. + +.. bpo: 17275 +.. date: 9004 +.. nonce: Aqerft +.. section: Core and Builtins + +Corrected class name in init error messages of the C version of +BufferedWriter and BufferedRandom. + +.. + +.. bpo: 7963 +.. date: 9003 +.. nonce: FWJtUT +.. section: Core and Builtins + +Fixed misleading error message that issued when object is called without +arguments. + +.. + +.. bpo: 5308 +.. date: 9002 +.. nonce: s5uAbP +.. section: Core and Builtins + +Raise ValueError when marshalling too large object (a sequence with size >= +2**31), instead of producing illegal marshal data. + +.. + +.. bpo: 17043 +.. date: 9001 +.. nonce: 4OVhGk +.. section: Core and Builtins + +The unicode-internal decoder no longer read past the end of input buffer. + +.. + +.. bpo: 16979 +.. date: 9000 +.. nonce: jTR3Oe +.. section: Core and Builtins + +Fix error handling bugs in the unicode-escape-decode decoder. + +.. + +.. bpo: 10156 +.. date: 8999 +.. nonce: iEZGhY +.. section: Core and Builtins + +In the interpreter's initialization phase, unicode globals are now +initialized dynamically as needed. + +.. + +.. bpo: 16975 +.. date: 8998 +.. nonce: H9EsG9 +.. section: Core and Builtins + +Fix error handling bug in the escape-decode decoder. + +.. + +.. bpo: 14850 +.. date: 8997 +.. nonce: EhU_If +.. section: Core and Builtins + +Now a charmap decoder treats U+FFFE as "undefined mapping" in any mapping, +not only in a Unicode string. + +.. + +.. bpo: 11461 +.. date: 8996 +.. nonce: xwn_Zw +.. section: Core and Builtins + +Fix the incremental UTF-16 decoder. Original patch by Amaury Forgeot d'Arc. + +.. + +.. bpo: 16367 +.. date: 8995 +.. nonce: lewlCg +.. section: Core and Builtins + +Fix FileIO.readall() on Windows for files larger than 2 GB. + +.. + +.. bpo: 15516 +.. date: 8994 +.. nonce: 5-JJO7 +.. section: Core and Builtins + +Fix a bug in PyString_FromFormat where it failed to properly ignore errors +from a __int__() method. + +.. + +.. bpo: 16839 +.. date: 8993 +.. nonce: aEw6ZB +.. section: Core and Builtins + +Fix a segfault when calling unicode() on a classic class early in +interpreter initialization. + +.. + +.. bpo: 16761 +.. date: 8992 +.. nonce: Z2d0Tr +.. section: Core and Builtins + +Calling ``int()`` and ``long()`` with *base* argument only now raises +TypeError. + +.. + +.. bpo: 16759 +.. date: 8991 +.. nonce: U0-CFS +.. section: Core and Builtins + +Support the full DWORD (unsigned long) range in Reg2Py when retrieving a +REG_DWORD value. This corrects functions like winreg.QueryValueEx that may +have been returning truncated values. + +.. + +.. bpo: 14420 +.. date: 8990 +.. nonce: uknqaC +.. section: Core and Builtins + +Support the full DWORD (unsigned long) range in Py2Reg when passed a +REG_DWORD value. Fixes ValueError in winreg.SetValueEx when given a long. + +.. + +.. bpo: 13863 +.. date: 8989 +.. nonce: jfoNlP +.. section: Core and Builtins + +Work around buggy 'fstat' implementation on Windows / NTFS that lead to +incorrect timestamps (off by one hour) being stored in .pyc files on some +systems. + +.. + +.. bpo: 16602 +.. date: 8988 +.. nonce: FjnLTD +.. section: Core and Builtins + +When a weakref's target was part of a long deallocation chain, the object +could remain reachable through its weakref even though its refcount had +dropped to zero. + +.. + +.. bpo: 9011 +.. date: 8987 +.. nonce: ENWTWf +.. section: Core and Builtins + +Fix hacky AST code that modified the CST when compiling a negated numeric +literal. + +.. + +.. bpo: 16306 +.. date: 8986 +.. nonce: H29SXn +.. section: Core and Builtins + +Fix multiple error messages when unknown command line parameters where +passed to the interpreter. Patch by Hieu Nguyen. + +.. + +.. bpo: 15379 +.. date: 8985 +.. nonce: Ix2NTb +.. section: Core and Builtins + +Fix passing of non-BMP characters as integers for the charmap decoder +(already working as unicode strings). Patch by Serhiy Storchaka. + +.. + +.. bpo: 16453 +.. date: 8984 +.. nonce: 0Zm9en +.. section: Core and Builtins + +Fix equality testing of dead weakref objects. + +.. + +.. bpo: 9535 +.. date: 8983 +.. nonce: hkixPD +.. section: Core and Builtins + +Fix pending signals that have been received but not yet handled by Python to +not persist after os.fork() in the child process. + +.. + +.. bpo: 15001 +.. date: 8982 +.. nonce: oD3gtX +.. section: Core and Builtins + +fix segfault on "del sys.modules['__main__']". Patch by Victor Stinner. + +.. + +.. bpo: 5057 +.. date: 8981 +.. nonce: 5HFeht +.. section: Core and Builtins + +the peepholer no longer optimizes subscription on unicode literals (e.g. +u'foo'[0]) in order to produce compatible pyc files between narrow and wide +builds. + +.. + +.. bpo: 8401 +.. date: 8980 +.. nonce: TslRZr +.. section: Core and Builtins + +assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error. + +.. + +.. bpo: 14700 +.. date: 8979 +.. nonce: 1hIs61 +.. section: Core and Builtins + +Fix buggy overflow checks for large width and precision in string formatting +operations. + +.. + +.. bpo: 16345 +.. date: 8978 +.. nonce: azvPpP +.. section: Core and Builtins + +Fix an infinite loop when ``fromkeys`` on a dict subclass received a +nonempty dict from the constructor. + +.. + +.. bpo: 6074 +.. date: 8977 +.. nonce: CXlveH +.. section: Core and Builtins + +Ensure cached bytecode files can always be updated by the user that created +them, even when the source file is read-only. + +.. + +.. bpo: 14783 +.. date: 8976 +.. nonce: Sk4dfh +.. section: Core and Builtins + +Improve int() and long() docstrings and switch docstrings for unicode(), +slice(), range(), and xrange() to use multi-line signatures. + +.. + +.. bpo: 16030 +.. date: 8975 +.. nonce: ljwmkM +.. section: Core and Builtins + +Fix overflow bug in computing the `repr` of an xrange object with large +start, step or length. + +.. + +.. bpo: 16029 +.. date: 8974 +.. nonce: zGzl68 +.. section: Core and Builtins + +Fix overflow bug occurring when pickling xranges with large start, step or +length. + +.. + +.. bpo: 16037 +.. date: 8973 +.. nonce: tA7cA2 +.. section: Core and Builtins + +Limit httplib's _read_status() function to work around broken HTTP servers +and reduce memory usage. It's actually a backport of a Python 3.2 fix. +Thanks to Adrien Kunysz. + +.. + +.. bpo: 16588 +.. date: 8972 +.. nonce: YKgxOa +.. section: Core and Builtins + +Silence unused-but-set warnings in Python/thread_pthread + +.. + +.. bpo: 13992 +.. date: 8971 +.. nonce: Jasaf2 +.. section: Core and Builtins + +The trashcan mechanism is now thread-safe. This eliminates sporadic crashes +in multi-thread programs when several long deallocator chains ran +concurrently and involved subclasses of built-in container types. + +.. + +.. bpo: 15801 +.. date: 8970 +.. nonce: gpcQV3 +.. section: Core and Builtins + +Make sure mappings passed to '%' formatting are actually subscriptable. + +.. + +.. bpo: 15604 +.. date: 8969 +.. nonce: q1V3sc +.. section: Core and Builtins + +Update uses of PyObject_IsTrue() to check for and handle errors correctly. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 14579 +.. date: 8968 +.. nonce: Bcg1J1 +.. section: Core and Builtins + +Fix error handling bug in the utf-16 decoder. Patch by Serhiy Storchaka. + +.. + +.. bpo: 15368 +.. date: 8967 +.. nonce: iAaiat +.. section: Core and Builtins + +An issue that caused bytecode generation to be non-deterministic when using +randomized hashing (-R) has been fixed. + +.. + +.. bpo: 15897 +.. date: 8966 +.. nonce: GQpoBE +.. section: Core and Builtins + +zipimport.c doesn't check return value of fseek(). Patch by Felipe Cruz. + +.. + +.. bpo: 16369 +.. date: 8965 +.. nonce: GtRTux +.. section: Core and Builtins + +Global PyTypeObjects not initialized with PyType_Ready(...). + +.. + +.. bpo: 15033 +.. date: 8964 +.. nonce: gKl1Eg +.. section: Core and Builtins + +Fix the exit status bug when modules invoked using -m switch, return the +proper failure return value (1). Patch contributed by Jeff Knupp. + +.. + +.. bpo: 12268 +.. date: 8963 +.. nonce: 6mnsQI +.. section: Core and Builtins + +File readline, readlines and read() methods no longer lose data when an +underlying read system call is interrupted. IOError is no longer raised due +to a read system call returning EINTR from within these methods. + +.. + +.. bpo: 13512 +.. date: 8962 +.. nonce: KW8Du9 +.. section: Core and Builtins + +Create ~/.pypirc securely (CVE-2011-4944). Initial patch by Philip Jenvey, +tested by Mageia and Debian. + +.. + +.. bpo: 7719 +.. date: 8961 +.. nonce: O-kdp6 +.. section: Core and Builtins + +Make distutils ignore ``.nfs*`` files instead of choking later on. Initial +patch by SilentGhost and Jeff Ramnani. + +.. + +.. bpo: 10053 +.. date: 8960 +.. nonce: rOxp0i +.. section: Core and Builtins + +Don't close FDs when FileIO.__init__ fails. Loosely based on the work by +Hirokazu Yamamoto. + +.. + +.. bpo: 14775 +.. date: 8959 +.. nonce: AHE3Lc +.. section: Core and Builtins + +Fix a potential quadratic dict build-up due to the garbage collector +repeatedly trying to untrack dicts. + +.. + +.. bpo: 14494 +.. date: 8958 +.. nonce: OjJqfu +.. section: Core and Builtins + +Fix __future__.py and its documentation to note that absolute imports are +the default behavior in 3.0 instead of 2.7. Patch by Sven Marnach. + +.. + +.. bpo: 14761 +.. date: 8957 +.. nonce: A8TEE6 +.. section: Core and Builtins + +Fix potential leak on an error case in the import machinery. + +.. + +.. bpo: 14699 +.. date: 8956 +.. nonce: AuoeMs +.. section: Core and Builtins + +Fix calling the classmethod descriptor directly. + +.. + +.. bpo: 11603 +.. date: 8955 +.. nonce: aGsFsn +.. section: Core and Builtins + +Setting __repr__ to __str__ now raises a RuntimeError when repr() or str() +is called on such an object. + +.. + +.. bpo: 14658 +.. date: 8954 +.. nonce: jeSkqL +.. section: Core and Builtins + +Fix binding a special method to a builtin implementation of a special method +with a different name. + +.. + +.. bpo: 14612 +.. date: 8953 +.. nonce: uTBlpg +.. section: Core and Builtins + +Fix jumping around with blocks by setting f_lineno. + +.. + +.. bpo: 13889 +.. date: 8952 +.. nonce: 5jUbDL +.. section: Core and Builtins + +Check and (if necessary) set FPU control word before calling any of the +dtoa.c string <-> float conversion functions, on MSVC builds of Python. +This fixes issues when embedding Python in a Delphi app. + +.. + +.. bpo: 14505 +.. date: 8951 +.. nonce: oeGD4J +.. section: Core and Builtins + +Fix file descriptor leak when deallocating file objects created with +PyFile_FromString(). + +.. + +.. bpo: 14474 +.. date: 8950 +.. nonce: 8TuKNN +.. section: Core and Builtins + +Save and restore exception state in thread.start_new_thread() while writing +error message if the thread leaves an unhandled exception. + +.. + +.. bpo: 13019 +.. date: 8949 +.. nonce: LYHgJO +.. section: Core and Builtins + +Fix potential reference leaks in bytearray.extend(). Patch by Suman Saha. + +.. + +.. bpo: 14378 +.. date: 8948 +.. nonce: SYESoz +.. section: Core and Builtins + +Fix compiling ast.ImportFrom nodes with a "__future__" string as the module +name that was not interned. + +.. + +.. bpo: 14331 +.. date: 8947 +.. nonce: xcTH6m +.. section: Core and Builtins + +Use significantly less stack space when importing modules by allocating path +buffers on the heap instead of the stack. + +.. + +.. bpo: 14334 +.. date: 8946 +.. nonce: l8YQhg +.. section: Core and Builtins + +Prevent in a segfault in type.__getattribute__ when it was not passed +strings. Also fix segfaults in the __getattribute__ and __setattr__ methods +of old-style classes. + +.. + +.. bpo: 14161 +.. date: 8945 +.. nonce: VorA5N +.. section: Core and Builtins + +fix the __repr__ of file objects to escape the file name. + +.. + +.. bpo: 1469629 +.. date: 8944 +.. nonce: ej86Z- +.. section: Core and Builtins + +Allow cycles through an object's __dict__ slot to be collected. (For example +if ``x.__dict__ is x``). + +.. + +.. bpo: 13521 +.. date: 8943 +.. nonce: L_inbK +.. section: Core and Builtins + +dict.setdefault() now does only one lookup for the given key, making it +"atomic" for many purposes. Patch by Filip Gruszczy?ski. + +.. + +.. bpo: 1602133 +.. date: 8942 +.. nonce: lYqpUo +.. section: Core and Builtins + +on Mac OS X a shared library build (``--enable-shared``) now fills the +``os.environ`` variable correctly. + +.. + +.. bpo: 10538 +.. date: 8941 +.. nonce: F7Gerr +.. section: Core and Builtins + +When using the "s*" code with PyArg_ParseTuple() to fill a Py_buffer +structure with data from an object supporting only the old PyBuffer +interface, a reference to the source objects is now properly added to the +Py_buffer.obj member. + +.. + +.. bpo: 12718 +.. date: 8940 +.. nonce: lrGueo +.. section: Library + +Fix interaction with winpdb overriding __import__ by setting importer +attribute on BaseConfigurator instance. + +.. + +.. bpo: 17521 +.. date: 8939 +.. nonce: rDGKe7 +.. section: Library + +Corrected non-enabling of logger following two calls to fileConfig(). + +.. + +.. bpo: 17508 +.. date: 8938 +.. nonce: sO6qmY +.. section: Library + +Corrected MemoryHandler configuration in dictConfig() where the target +handler wasn't configured first. + +.. + +.. bpo: 10212 +.. date: 8937 +.. nonce: XGXAQQ +.. section: Library + +cStringIO and struct.unpack support new buffer objects. + +.. + +.. bpo: 12098 +.. date: 8936 +.. nonce: kcQpDY +.. section: Library + +multiprocessing on Windows now starts child processes using the same +sys.flags as the current process. Initial patch by Sergey Mezentsev. + +.. + +.. bpo: 8862 +.. date: 8935 +.. nonce: WpBti_ +.. section: Library + +Fixed curses cleanup when getkey is interrupted by a signal. + +.. + +.. bpo: 9090 +.. date: 8934 +.. nonce: FUyySi +.. section: Library + +When a socket with a timeout fails with EWOULDBLOCK or EAGAIN, retry the +select() loop instead of bailing out. This is because select() can +incorrectly report a socket as ready for reading (for example, if it +received some data with an invalid checksum). + +.. + +.. bpo: 1285086 +.. date: 8933 +.. nonce: U7ONBL +.. section: Library + +Get rid of the refcounting hack and speed up urllib.unquote(). + +.. + +.. bpo: 17368 +.. date: 8932 +.. nonce: y8QiJd +.. section: Library + +Fix an off-by-one error in the Python JSON decoder that caused a failure +while decoding empty object literals when object_pairs_hook was specified. + +.. + +.. bpo: 17278 +.. date: 8931 +.. nonce: pOF4An +.. section: Library + +Fix a crash in heapq.heappush() and heapq.heappop() when the list is being +resized concurrently. + +.. + +.. bpo: 17018 +.. date: 8930 +.. nonce: l8_sa8 +.. section: Library + +Make Process.join() retry if os.waitpid() fails with EINTR. + +.. + +.. bpo: 14720 +.. date: 8929 +.. nonce: rjT0OJ +.. section: Library + +sqlite3: Convert datetime microseconds correctly. Patch by Lowe Thiderman. + +.. + +.. bpo: 17225 +.. date: 8928 +.. nonce: Z396fN +.. section: Library + +JSON decoder now counts columns in the first line starting with 1, as in +other lines. + +.. + +.. bpo: 7842 +.. date: 8927 +.. nonce: p2kMAC +.. section: Library + +backported fix for py_compile.compile() syntax error handling. + +.. + +.. bpo: 13153 +.. date: 8926 +.. nonce: IN7Ddm +.. section: Library + +Tkinter functions now raise TclError instead of ValueError when a unicode +argument contains non-BMP character. + +.. + +.. bpo: 9669 +.. date: 8925 +.. nonce: Td9alB +.. section: Library + +Protect re against infinite loops on zero-width matching in non-greedy +repeat. Patch by Matthew Barnett. + +.. + +.. bpo: 13169 +.. date: 8924 +.. nonce: txDMgH +.. section: Library + +The maximal repetition number in a regular expression has been increased +from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on 64-bit). + +.. + +.. bpo: 16743 +.. date: 8923 +.. nonce: 7vwfDN +.. section: Library + +Fix mmap overflow check on 32 bit Windows. + +.. + +.. bpo: 11311 +.. date: 8922 +.. nonce: NvgObQ +.. section: Library + +StringIO.readline(0) now returns an empty string as all other file-like +objects. + +.. + +.. bpo: 16800 +.. date: 8921 +.. nonce: HxSo58 +.. section: Library + +tempfile.gettempdir() no longer left temporary files when the disk is full. +Original patch by Amir Szekely. + +.. + +.. bpo: 13555 +.. date: 8920 +.. nonce: bXG1a4 +.. section: Library + +cPickle now supports files larger than 2 GiB. + +.. + +.. bpo: 17052 +.. date: 8919 +.. nonce: TEWdzQ +.. section: Library + +unittest discovery should use self.testLoader. + +.. + +.. bpo: 4591 +.. date: 8918 +.. nonce: 9wJlD8 +.. section: Library + +Uid and gid values larger than 2**31 are supported now. + +.. + +.. bpo: 17141 +.. date: 8917 +.. nonce: pXFICp +.. section: Library + +random.vonmisesvariate() no more hangs for large kappas. + +.. + +.. bpo: 17149 +.. date: 8916 +.. nonce: ONtJnJ +.. section: Library + +Fix random.vonmisesvariate to always return results in the range [0, +2*math.pi]. + +.. + +.. bpo: 1470548 +.. date: 8915 +.. nonce: xr_CsJ +.. section: Library + +XMLGenerator now works with UTF-16 and UTF-32 encodings. + +.. + +.. bpo: 6975 +.. date: 8914 +.. nonce: 4GoPXW +.. section: Library + +os.path.realpath() now correctly resolves multiple nested symlinks on POSIX +platforms. + +.. + +.. bpo: 7358 +.. date: 8913 +.. nonce: -jPlTz +.. section: Library + +cStringIO.StringIO now supports writing to and reading from a stream larger +than 2 GiB on 64-bit systems. + +.. + +.. bpo: 10355 +.. date: 8912 +.. nonce: lkhqo9 +.. section: Library + +In SpooledTemporaryFile class mode and name properties and xreadlines method +now work for unrolled files. encoding and newlines properties now removed +as they have no sense and always produced AttributeError. + +.. + +.. bpo: 16686 +.. date: 8911 +.. nonce: zT_bpe +.. section: Library + +Fixed a lot of bugs in audioop module. Fixed crashes in avgpp(), maxpp() +and ratecv(). Fixed an integer overflow in add(), bias(), and ratecv(). +reverse(), lin2lin() and ratecv() no more lose precision for 32-bit samples. +max() and rms() no more returns a negative result and various other +functions now work correctly with 32-bit sample -0x80000000. + +.. + +.. bpo: 17073 +.. date: 8910 +.. nonce: wlCar1 +.. section: Library + +Fix some integer overflows in sqlite3 module. + +.. + +.. bpo: 6083 +.. date: 8909 +.. nonce: MVAIwI +.. section: Library + +Fix multiple segmentation faults occurred when PyArg_ParseTuple parses +nested mutating sequence. + +.. + +.. bpo: 5289 +.. date: 8908 +.. nonce: 4azz2m +.. section: Library + +Fix ctypes.util.find_library on Solaris. + +.. + +.. bpo: 17106 +.. date: 8907 +.. nonce: -2_cbV +.. section: Library + +Fix a segmentation fault in io.TextIOWrapper when an underlying stream or a +decoder produces data of an unexpected type (i.e. when io.TextIOWrapper +initialized with text stream or use bytes-to-bytes codec). + +.. + +.. bpo: 13994 +.. date: 8906 +.. nonce: Y89GZB +.. section: Library + +Add compatibility alias in distutils.ccompiler for +distutils.sysconfig.customize_compiler. + +.. + +.. bpo: 15633 +.. date: 8905 +.. nonce: t407yZ +.. section: Library + +httplib.HTTPResponse is now mark closed when the server sends less than the +advertised Content-Length. + +.. + +.. bpo: 15881 +.. date: 8904 +.. nonce: UfzKmP +.. section: Library + +Fixed atexit hook in multiprocessing. + +.. + +.. bpo: 14340 +.. date: 8903 +.. nonce: 6XMfoZ +.. section: Library + +Upgrade the embedded expat library to version 2.1.0. + +.. + +.. bpo: 11159 +.. date: 8902 +.. nonce: P-3Mf3 +.. section: Library + +SAX parser now supports unicode file names. + +.. + +.. bpo: 6972 +.. date: 8901 +.. nonce: e2Lq4T +.. section: Library + +The zipfile module no longer overwrites files outside of its destination +path when extracting malicious zip files. + +.. + +.. bpo: 17049 +.. date: 8900 +.. nonce: CoOx8W +.. section: Library + +Localized calendar methods now return unicode if a locale includes an +encoding and the result string contains month or weekday (was regression +from Python 2.6). + +.. + +.. bpo: 4844 +.. date: 8899 +.. nonce: jvXWfL +.. section: Library + +ZipFile now raises BadZipfile when opens a ZIP file with an incomplete "End +of Central Directory" record. Original patch by Guilherme Polo and Alan +McIntyre. + +.. + +.. bpo: 15505 +.. date: 8898 +.. nonce: -pH9Mh +.. section: Library + +`unittest.installHandler` no longer assumes SIGINT handler is set to a +callable object. + +.. + +.. bpo: 17051 +.. date: 8897 +.. nonce: erKg1U +.. section: Library + +Fix a memory leak in os.path.isdir() on Windows. Patch by Robert Xiao. + +.. + +.. bpo: 13454 +.. date: 8896 +.. nonce: 81rUI- +.. section: Library + +Fix a crash when deleting an iterator created by itertools.tee() if all +other iterators were very advanced before. + +.. + +.. bpo: 16992 +.. date: 8895 +.. nonce: s_RXIM +.. section: Library + +On Windows in signal.set_wakeup_fd, validate the file descriptor argument. + +.. + +.. bpo: 15861 +.. date: 8894 +.. nonce: gGkxCM +.. section: Library + +tkinter now correctly works with lists and tuples containing strings with +whitespaces, backslashes or unbalanced braces. + +.. + +.. bpo: 10527 +.. date: 8893 +.. nonce: EuNKip +.. section: Library + +Use poll() instead of select() for multiprocessing pipes. + +.. + +.. bpo: 9720 +.. date: 8892 +.. nonce: XPXDks +.. section: Library + +zipfile now writes correct local headers for files larger than 4 GiB. + +.. + +.. bpo: 13899 +.. date: 8891 +.. nonce: yz3hXA +.. section: Library + +\A, \Z, and \B now correctly match the A, Z, and B literals when used inside +character classes (e.g. '[\A]'). Patch by Matthew Barnett. + +.. + +.. bpo: 16398 +.. date: 8890 +.. nonce: JU7cL4 +.. section: Library + +Optimize deque.rotate() so that it only moves pointers and doesn't touch the +underlying data with increfs and decrefs. + +.. + +.. bpo: 15109 +.. date: 8889 +.. nonce: Qk6XVt +.. section: Library + +Fix regression in sqlite3's iterdump method where it would die with an +encoding error if the database contained string values containing non-ASCII. +(Regression was introduced by fix for 9750). + +.. + +.. bpo: 15545 +.. date: 8888 +.. nonce: FCBNNV +.. section: Library + +Fix regression in sqlite3's iterdump method where it was failing if the +connection used a row factory (such as sqlite3.Row) that produced unsortable +objects. (Regression was introduced by fix for 9750). + +.. + +.. bpo: 16828 +.. date: 8887 +.. nonce: KB886T +.. section: Library + +Fix error incorrectly raised by bz2.compress(''). Patch by Martin Packman. + +.. + +.. bpo: 9586 +.. date: 8886 +.. nonce: 9tuKgR +.. section: Library + +Redefine SEM_FAILED on MacOSX to keep compiler happy. + +.. + +.. bpo: 10527 +.. date: 8885 +.. nonce: 7btVvN +.. section: Library + +make multiprocessing use poll() instead of select() if available. + +.. + +.. bpo: 16485 +.. date: 8884 +.. nonce: aUJyTZ +.. section: Library + +Now file descriptors are closed if file header patching failed on closing an +aifc file. + +.. + +.. bpo: 12065 +.. date: 8883 +.. nonce: FBZpyD +.. section: Library + +connect_ex() on an SSL socket now returns the original errno when the +socket's timeout expires (it used to return None). + +.. + +.. bpo: 16713 +.. date: 8882 +.. nonce: YX5wyQ +.. section: Library + +Fix the parsing of tel url with params using urlparse module. + +.. + +.. bpo: 16443 +.. date: 8881 +.. nonce: SnGosi +.. section: Library + +Add docstrings to regular expression match objects. Patch by Anton Kasyanov. + +.. + +.. bpo: 8853 +.. date: 8880 +.. nonce: vSQPAG +.. section: Library + +Allow port to be of type long for socket.getaddrinfo(). + +.. + +.. bpo: 16597 +.. date: 8879 +.. nonce: z8uMEN +.. section: Library + +In buffered and text IO, call close() on the underlying stream if invoking +flush() fails. + +.. + +.. bpo: 15701 +.. date: 8878 +.. nonce: rAh1Sy +.. section: Library + +Fix HTTPError info method call to return the headers information. + +.. + +.. bpo: 16646 +.. date: 8877 +.. nonce: Tc3vsq +.. section: Library + +ftplib.FTP.makeport() might lose socket error details. (patch by Serhiy +Storchaka) + +.. + +.. bpo: 16626 +.. date: 8876 +.. nonce: P9xKcu +.. section: Library + +Fix infinite recursion in glob.glob() on Windows when the pattern contains a +wildcard in the drive or UNC path. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16298 +.. date: 8875 +.. nonce: kN3o52 +.. section: Library + +In HTTPResponse.read(), close the socket when there is no Content-Length and +the incoming stream is finished. Patch by Eran Rundstein. + +.. + +.. bpo: 16248 +.. date: 8874 +.. nonce: yOopnt +.. section: Library + +Disable code execution from the user's home directory by tkinter when the -E +flag is passed to Python. Patch by Zachary Ware. + +.. + +.. bpo: 16628 +.. date: 8873 +.. nonce: qnWML3 +.. section: Library + +Fix a memory leak in ctypes.resize(). + +.. + +.. bpo: 13614 +.. date: 8872 +.. nonce: buqA2j +.. section: Library + +Fix setup.py register failure with invalid rst in description. Patch by +Julien Courteau and Pierre Paul Lefebvre. + +.. + +.. bpo: 10182 +.. date: 8871 +.. nonce: 0nH79H +.. section: Library + +The re module doesn't truncate indices to 32 bits anymore. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 16573 +.. date: 8870 +.. nonce: kKjx72 +.. section: Library + +In 2to3, treat enumerate() like a consuming call, so superfluous list() +calls aren't added to filter(), map(), and zip() which are directly passed +enumerate(). + +.. + +.. bpo: 1160 +.. date: 8869 +.. nonce: n79fOA +.. section: Library + +Fix compiling large regular expressions on UCS2 builds. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 14313 +.. date: 8868 +.. nonce: WpDB93 +.. section: Library + +zipfile now raises NotImplementedError when the compression type is unknown. + +.. + +.. bpo: 16408 +.. date: 8867 +.. nonce: iqzks4 +.. section: Library + +Fix file descriptors not being closed in error conditions in the zipfile +module. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16327 +.. date: 8866 +.. nonce: uVAHv3 +.. section: Library + +The subprocess module no longer leaks file descriptors used for +stdin/stdout/stderr pipes to the child when fork() fails. + +.. + +.. bpo: 14396 +.. date: 8865 +.. nonce: aUgPuV +.. section: Library + +Handle the odd rare case of waitpid returning 0 when not expected in +subprocess.Popen.wait(). + +.. + +.. bpo: 16411 +.. date: 8864 +.. nonce: 9Mn07O +.. section: Library + +Fix a bug where zlib.decompressobj().flush() might try to access previously- +freed memory. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16350 +.. date: 8863 +.. nonce: b77tF6 +.. section: Library + +zlib.decompressobj().decompress() now accumulates data from successive calls +after EOF in unused_data, instead of only saving the argument to the last +call. decompressobj().flush() now correctly sets unused_data and +unconsumed_tail. A bug in the handling of MemoryError when setting the +unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. + +.. + +.. bpo: 12759 +.. date: 8862 +.. nonce: c7p8aw +.. section: Library + +sre_parse now raises a proper error when the name of the group is missing. +Initial patch by Serhiy Storchaka. + +.. + +.. bpo: 16152 +.. date: 8861 +.. nonce: Lypvsp +.. section: Library + +fix tokenize to ignore whitespace at the end of the code when no newline is +found. Patch by Ned Batchelder. + +.. + +.. bpo: 16230 +.. date: 8860 +.. nonce: Y7XU0- +.. section: Library + +Fix a crash in select.select() when one of the lists changes size while +iterated on. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16228 +.. date: 8859 +.. nonce: zsna-8 +.. section: Library + +Fix a crash in the json module where a list changes size while it is being +encoded. Patch by Serhiy Storchaka. + +.. + +.. bpo: 14897 +.. date: 8858 +.. nonce: OGbALj +.. section: Library + +Enhance error messages of struct.pack and struct.pack_into. Patch by Matti +M?ki. + +.. + +.. bpo: 12890 +.. date: 8857 +.. nonce: kDaDxa +.. section: Library + +cgitb no longer prints spurious

tags in text mode when the logdir option +is specified. + +.. + +.. bpo: 14398 +.. date: 8856 +.. nonce: jPT4ME +.. section: Library + +Fix size truncation and overflow bugs in the bz2 module. + +.. + +.. bpo: 5148 +.. date: 8855 +.. nonce: VHoO2C +.. section: Library + +Ignore 'U' in mode given to gzip.open() and gzip.GzipFile(). + +.. + +.. bpo: 16220 +.. date: 8854 +.. nonce: KAtvbg +.. section: Library + +wsgiref now always calls close() on an iterable response. Patch by Brent +Tubbs. + +.. + +.. bpo: 16461 +.. date: 8853 +.. nonce: 4XLB7L +.. section: Library + +Wave library should be able to deal with 4GB wav files, and sample rate of +44100 Hz. + +.. + +.. bpo: 16176 +.. date: 8852 +.. nonce: iZz-x5 +.. section: Library + +Properly identify Windows 8 via platform.platform() + +.. + +.. bpo: 15756 +.. date: 8851 +.. nonce: cV4TEW +.. section: Library + +subprocess.poll() now properly handles errno.ECHILD to return a returncode +of 0 when the child has already exited or cannot be waited on. + +.. + +.. bpo: 12376 +.. date: 8850 +.. nonce: mkpQwv +.. section: Library + +Pass on parameters in TextTestResult.__init__ super call + +.. + +.. bpo: 15222 +.. date: 8849 +.. nonce: lOnn6t +.. section: Library + +Insert blank line after each message in mbox mailboxes + +.. + +.. bpo: 16013 +.. date: 8848 +.. nonce: lJImKp +.. section: Library + +Fix CSV Reader parsing issue with ending quote characters. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 15421 +.. date: 8847 +.. nonce: SUEEPv +.. section: Library + +fix an OverflowError in Calendar.itermonthdates() after datetime.MAXYEAR. +Patch by C?dric Krier. + +.. + +.. bpo: 15970 +.. date: 8846 +.. nonce: 8deo2K +.. section: Library + +xml.etree.ElementTree now serializes correctly the empty HTML elements +'meta' and 'param'. + +.. + +.. bpo: 15676 +.. date: 8845 +.. nonce: V_auQh +.. section: Library + +Now "mmap" check for empty files before doing the offset check. Patch by +Steven Willis. + +.. + +.. bpo: 15340 +.. date: 8844 +.. nonce: Aqn0c1 +.. section: Library + +Fix importing the random module when /dev/urandom cannot be opened. This +was a regression caused by the hash randomization patch. + +.. + +.. bpo: 15841 +.. date: 8843 +.. nonce: M11nwa +.. section: Library + +The readable(), writable() and seekable() methods of io.BytesIO and +io.StringIO objects now raise ValueError when the object has been closed. +Patch by Alessandro Moura. + +.. + +.. bpo: 16112 +.. date: 8842 +.. nonce: 7UQthq +.. section: Library + +platform.architecture does not correctly escape argument to /usr/bin/file. +Patch by David Benjamin. + +.. + +.. bpo: 12776 +.. date: 8841 +.. nonce: MzM-xL +.. section: Library + +call argparse type function (specified by add_argument) only once. Before, +the type function was called twice in the case where the default was +specified and the argument was given as well. This was especially +problematic for the FileType type, as a default file would always be opened, +even if a file argument was specified on the command line. (See also: +bpo-11839) + +.. + +.. bpo: 15906 +.. date: 8840 +.. nonce: sY-Tgu +.. section: Library + +Fix a regression in argparse caused by the preceding change, when +action='append', type='str' and default=[]. + +.. + +.. bpo: 13370 +.. date: 8839 +.. nonce: E9RveK +.. section: Library + +Ensure that ctypes works on Mac OS X when Python is compiled using the clang +compiler + +.. + +.. bpo: 15544 +.. date: 8838 +.. nonce: 3QjWdU +.. section: Library + +Fix Decimal.__float__ to work with payload-carrying NaNs. + +.. + +.. bpo: 15199 +.. date: 8837 +.. nonce: iOOV1X +.. section: Library + +Fix JavaScript's default MIME type to application/javascript. Patch by +Bohuslav Kabrda. + +.. + +.. bpo: 15477 +.. date: 8836 +.. nonce: 9gGqPw +.. section: Library + +In cmath and math modules, add workaround for platforms whose system- +supplied log1p function doesn't respect signs of zeros. + +.. + +.. bpo: 11062 +.. date: 8835 +.. nonce: ZhTF21 +.. section: Library + +Fix adding a message from file to Babyl mailbox. + +.. + +.. bpo: 15646 +.. date: 8834 +.. nonce: VbhKq4 +.. section: Library + +Prevent equivalent of a fork bomb when using multiprocessing on Windows +without the "if __name__ == '__main__'" idiom. + +.. + +.. bpo: 15567 +.. date: 8833 +.. nonce: MGuZ8N +.. section: Library + +Fix NameError when running threading._test + +.. + +.. bpo: 15424 +.. date: 8832 +.. nonce: 6ZaCfJ +.. section: Library + +Add a __sizeof__ implementation for array objects. Patch by Ludwig H?hne. + +.. + +.. bpo: 15538 +.. date: 8831 +.. nonce: CJHtAs +.. section: Library + +Fix compilation of the getnameinfo() / getaddrinfo() emulation code. Patch +by Philipp Hagemeister. + +.. + +.. bpo: 12288 +.. date: 8830 +.. nonce: EeBUVC +.. section: Library + +Consider '0' and '0.0' as valid initialvalue for tkinter SimpleDialog. + +.. + +.. bpo: 15489 +.. date: 8829 +.. nonce: P9-vH9 +.. section: Library + +Add a __sizeof__ implementation for BytesIO objects. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 15469 +.. date: 8828 +.. nonce: eFsJXX +.. section: Library + +Add a __sizeof__ implementation for deque objects. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 15487 +.. date: 8827 +.. nonce: vtEBtw +.. section: Library + +Add a __sizeof__ implementation for buffered I/O objects. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 15512 +.. date: 8826 +.. nonce: JO3bbV +.. section: Library + +Add a __sizeof__ implementation for parser. Patch by Serhiy Storchaka. + +.. + +.. bpo: 15402 +.. date: 8825 +.. nonce: MWs0d1 +.. section: Library + +An issue in the struct module that caused sys.getsizeof to return incorrect +results for struct.Struct instances has been fixed. Initial patch by Serhiy +Storchaka. + +.. + +.. bpo: 15232 +.. date: 8824 +.. nonce: R723JW +.. section: Library + +when mangle_from is True, email.Generator now correctly mangles lines that +start with 'From ' that occur in a MIME preamble or epilog. + +.. + +.. bpo: 13922 +.. date: 8823 +.. nonce: mg0ypz +.. section: Library + +argparse no longer incorrectly strips '--'s that appear after the first one. + +.. + +.. bpo: 12353 +.. date: 8822 +.. nonce: S3NUQb +.. section: Library + +argparse now correctly handles null argument values. + +.. + +.. bpo: 6493 +.. date: 8821 +.. nonce: onAuOo +.. section: Library + +An issue in ctypes on Windows that caused structure bitfields of type +ctypes.c_uint32 and width 32 to incorrectly be set has been fixed. + +.. + +.. bpo: 14635 +.. date: 8820 +.. nonce: R89rsl +.. section: Library + +telnetlib will use poll() rather than select() when possible to avoid +failing due to the select() file descriptor limit. + +.. + +.. bpo: 15247 +.. date: 8819 +.. nonce: XQlOgY +.. section: Library + +FileIO now raises an error when given a file descriptor pointing to a +directory. + +.. + +.. bpo: 14591 +.. date: 8818 +.. nonce: WiL398 +.. section: Library + +Fix bug in Random.jumpahead that could produce an invalid Mersenne Twister +state on 64-bit machines. + +.. + +.. bpo: 5346 +.. date: 8817 +.. nonce: KazqNd +.. section: Library + +Preserve permissions of mbox, MMDF and Babyl mailbox files on flush(). + +.. + +.. bpo: 15219 +.. date: 8816 +.. nonce: q8ah8W +.. section: Library + +Fix a reference leak when hashlib.new() is called with invalid parameters. + +.. + +.. bpo: 9559 +.. date: 8815 +.. nonce: HNrpSz +.. section: Library + +If messages were only added, a new file is no longer created and renamed +over the old file when flush() is called on an mbox, MMDF or Babyl mailbox. + +.. + +.. bpo: 14653 +.. date: 8814 +.. nonce: wxr1Hp +.. section: Library + +email.utils.mktime_tz() no longer relies on system mktime() when timezone +offest is supplied. + +.. + +.. bpo: 6056 +.. date: 8813 +.. nonce: QB7JkF +.. section: Library + +Make multiprocessing use setblocking(True) on the sockets it uses. Original +patch by J Derek Wilson. + +.. + +.. bpo: 15101 +.. date: 8812 +.. nonce: IWvk9X +.. section: Library + +Make pool finalizer avoid joining current thread. + +.. + +.. bpo: 15054 +.. date: 8811 +.. nonce: tE72L_ +.. section: Library + +A bug in tokenize.tokenize that caused string literals with 'b' and 'br' +prefixes to be incorrectly tokenized has been fixed. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 15036 +.. date: 8810 +.. nonce: Mhm512 +.. section: Library + +Mailbox no longer throws an error if a flush is done between operations when +removing or changing multiple items in mbox, MMDF, or Babyl mailboxes. + +.. + +.. bpo: 10133 +.. date: 8809 +.. nonce: RredST +.. section: Library + +Make multiprocessing deallocate buffer if socket read fails. Patch by +Hallvard B Furuseth. + +.. + +.. bpo: 13854 +.. date: 8808 +.. nonce: ms8PU3 +.. section: Library + +Make multiprocessing properly handle non-integer non-string argument to +SystemExit. + +.. + +.. bpo: 12157 +.. date: 8807 +.. nonce: awxWQJ +.. section: Library + +Make pool.map() empty iterables correctly. Initial patch by mouad. + +.. + +.. bpo: 14036 +.. date: 8806 +.. nonce: wfrN3N +.. section: Library + +Add an additional check to validate that port in urlparse does not go in +illegal range and returns None. + +.. + +.. bpo: 14888 +.. date: 8805 +.. nonce: 8d3GPF +.. section: Library + +Fix misbehaviour of the _md5 module when called on data larger than 2**32 +bytes. + +.. + +.. bpo: 15908 +.. date: 8804 +.. nonce: xfD3R4 +.. section: Library + +Fix misbehaviour of the sha1 module when called on data larger than 2**32 +bytes. + +.. + +.. bpo: 15910 +.. date: 8803 +.. nonce: Xik0eY +.. section: Library + +Fix misbehaviour of _md5 and sha1 modules when "updating" on data larger +than 2**32 bytes. + +.. + +.. bpo: 14875 +.. date: 8802 +.. nonce: pGNN-W +.. section: Library + +Use float('inf') instead of float('1e66666') in the json module. + +.. + +.. bpo: 14572 +.. date: 8801 +.. nonce: FxInwF +.. section: Library + +Prevent build failures with pre-3.5.0 versions of sqlite3, such as was +shipped with Centos 5 and Mac OS X 10.4. + +.. + +.. bpo: 14426 +.. date: 8800 +.. nonce: GSay45 +.. section: Library + +Correct the Date format in Expires attribute of Set-Cookie Header in +Cookie.py. + +.. + +.. bpo: 14721 +.. date: 8799 +.. nonce: 3gDakm +.. section: Library + +Send proper header, Content-length: 0 when the body is an empty string ''. +Initial Patch contributed by Arve Knudsen. + +.. + +.. bpo: 14072 +.. date: 8798 +.. nonce: 4bVZye +.. section: Library + +Fix parsing of 'tel' URIs in urlparse by making the check for ports +stricter. + +.. + +.. bpo: 9374 +.. date: 8797 +.. nonce: 73g_V_ +.. section: Library + +Generic parsing of query and fragment portions of url for any scheme. +Supported both by RFC3986 and RFC2396. + +.. + +.. bpo: 14798 +.. date: 8796 +.. nonce: uw_PT- +.. section: Library + +Fix the functions in pyclbr to raise an ImportError when the first part of a +dotted name is not a package. Patch by Xavier de Gaye. + +.. + +.. bpo: 14832 +.. date: 8795 +.. nonce: ZyLvfY +.. section: Library + +fixed the order of the argument references in the error message produced by +unittest's assertItemsEqual. + +.. + +.. bpo: 14829 +.. date: 8794 +.. nonce: yWZKyP +.. section: Library + +Fix bisect issues under 64-bit Windows. + +.. + +.. bpo: 14777 +.. date: 8793 +.. nonce: SS0XEf +.. section: Library + +tkinter may return undecoded UTF-8 bytes as a string when accessing the Tk +clipboard. Modify clipboard_get() to first request type UTF8_STRING when no +specific type is requested in an X11 windowing environment, falling back to +the current default type STRING if that fails. Original patch by Thomas +Kluyver. + +.. + +.. bpo: 12541 +.. date: 8792 +.. nonce: srvUYa +.. section: Library + +Be lenient with quotes around Realm field with HTTP Basic Authentation in +urllib2. + +.. + +.. bpo: 14662 +.. date: 8791 +.. nonce: kBgGen +.. section: Library + +Prevent shutil failures on OS X when destination does not support chflag +operations. Patch by Hynek Schlawack. + +.. + +.. bpo: 14157 +.. date: 8790 +.. nonce: QVP6vO +.. section: Library + +Fix time.strptime failing without a year on February 29th. Patch by Hynek +Schlawack. + +.. + +.. bpo: 14768 +.. date: 8789 +.. nonce: UFzrQa +.. section: Library + +os.path.expanduser('~/a') doesn't work correctly when HOME is '/'. + +.. + +.. bpo: 13183 +.. date: 8788 +.. nonce: WXohoU +.. section: Library + +Fix pdb skipping frames after hitting a breakpoint and running step. Patch +by Xavier de Gaye. + +.. + +.. bpo: 14664 +.. date: 8787 +.. nonce: pdyfQE +.. section: Library + +It is now possible to use @unittest.skip{If,Unless} on a test class that +doesn't inherit from TestCase (i.e. a mixin). + +.. + +.. bpo: 14160 +.. date: 8786 +.. nonce: eP9a5e +.. section: Library + +TarFile.extractfile() failed to resolve symbolic links when the links were +not located in an archive subdirectory. + +.. + +.. bpo: 14638 +.. date: 8785 +.. nonce: cfMimX +.. section: Library + +pydoc now treats non-string __name__ values as if they were missing, instead +of raising an error. + +.. + +.. bpo: 13684 +.. date: 8784 +.. nonce: GMakQh +.. section: Library + +Fix httplib tunnel issue of infinite loops for certain sites which send EOF +without trailing \r\n. + +.. + +.. bpo: 14308 +.. date: 8783 +.. nonce: VI_YtW +.. section: Library + +Fix an exception when a "dummy" thread is in the threading module's active +list after a fork(). + +.. + +.. bpo: 14538 +.. date: 8782 +.. nonce: l61eIV +.. section: Library + +HTMLParser can now parse correctly start tags that contain a bare '/'. + +.. + +.. bpo: 14452 +.. date: 8781 +.. nonce: TPNgz8 +.. section: Library + +SysLogHandler no longer inserts a UTF-8 BOM into the message. + +.. + +.. bpo: 13496 +.. date: 8780 +.. nonce: ZTq6yk +.. section: Library + +Fix potential overflow in bisect.bisect algorithm when applied to a +collection of size > sys.maxsize / 2. + +.. + +.. bpo: 14399 +.. date: 8779 +.. nonce: ucnoq5 +.. section: Library + +zipfile now recognizes that the archive has been modified even if only the +comment is changed. As a consequence of this fix, ZipFile is now a new +style class. + +.. + +.. bpo: 7978 +.. date: 8778 +.. nonce: DdYwzu +.. section: Library + +SocketServer now restarts the select() call when EINTR is returned. This +avoids crashing the server loop when a signal is received. Patch by Jerzy +Kozera. + +.. + +.. bpo: 10340 +.. date: 8777 +.. nonce: QZDDK- +.. section: Library + +asyncore - properly handle EINVAL in dispatcher constructor on OSX; avoid to +call handle_connect in case of a disconnected socket which was not meant to +connect. + +.. + +.. bpo: 12757 +.. date: 8776 +.. nonce: lfCCKo +.. section: Library + +Fix the skipping of doctests when python is run with -OO so that it works in +unittest's verbose mode as well as non-verbose mode. + +.. + +.. bpo: 13694 +.. date: 8775 +.. nonce: qresWC +.. section: Library + +asynchronous connect in asyncore.dispatcher does not set addr attribute. + +.. + +.. bpo: 10484 +.. date: 8774 +.. nonce: NgDSdJ +.. section: Library + +Fix the CGIHTTPServer's PATH_INFO handling problem. + +.. + +.. bpo: 11199 +.. date: 8773 +.. nonce: UMivCa +.. section: Library + +Fix the with urllib which hangs on particular ftp urls. + +.. + +.. bpo: 14252 +.. date: 8772 +.. nonce: -5zjL9 +.. section: Library + +Fix subprocess.Popen.terminate() to not raise an error under Windows when +the child process has already exited. + +.. + +.. bpo: 14195 +.. date: 8771 +.. nonce: XpCJYQ +.. section: Library + +An issue that caused weakref.WeakSet instances to incorrectly return True +for a WeakSet instance 'a' in both 'a < a' and 'a > a' has been fixed. + +.. + +.. bpo: 14159 +.. date: 8770 +.. nonce: -rJiOd +.. section: Library + +Fix the len() of weak sets to return a better approximation when some +objects are dead or dying. Moreover, the implementation is now O(1) rather +than O(n). + +.. + +.. bpo: 2945 +.. date: 8769 +.. nonce: QZCfeH +.. section: Library + +Make the distutils upload command aware of bdist_rpm products. + +.. + +.. bpo: 6884 +.. date: 8768 +.. nonce: w-DWFF +.. section: Library + +Fix long-standing bugs with MANIFEST.in parsing in distutils on Windows. + +.. + +.. bpo: 16441 +.. date: 8767 +.. nonce: zm1gad +.. section: Library + +Avoid excessive memory usage working with large gzip files using the gzip +module. + +.. + +.. bpo: 15782 +.. date: 8766 +.. nonce: c-rtHz +.. section: Library + +Prevent compile errors of OS X Carbon modules _Fm, _Qd, and _Qdoffs when +compiling with an SDK of 10.7 or later. The OS X APIs they wrap have long +been deprecated and have now been removed with 10.7. These modules were +already empty for 64-bit builds and have been removed in Python 3. + +.. + +.. bpo: 17477 +.. date: 8765 +.. nonce: mkozKG +.. section: Library + +Update the bsddb module to pybsddb 5.3.0, supporting db-5.x, and dropping +support for db-4.1 and db-4.2. + +.. + +.. bpo: 17192 +.. date: 8764 +.. nonce: U0oKFo +.. section: Library + +Update the ctypes module's libffi to v3.0.13. This specifically addresses a +stack misalignment issue on x86 and issues on some more recent platforms. + +.. + +.. bpo: 12268 +.. date: 8763 +.. nonce: cWvcGA +.. section: Library + +The io module file object write methods no longer abort early when a write +system calls is interrupted (EINTR). + +.. + +.. bpo: 0 +.. date: 8762 +.. nonce: R41GNw +.. section: Library + +Fix the leak of a dict in the time module when used in an embedded +interpreter that is repeatedly initialized and shutdown and reinitialized. + +.. + +.. bpo: 12268 +.. date: 8761 +.. nonce: _DnsP2 +.. section: Library + +File readline, readlines and read or readall methods no longer lose data +when an underlying read system call is interrupted within an io module +object. IOError is no longer raised due to a read system call returning +EINTR from within these methods. + +.. + +.. bpo: 16012 +.. date: 8760 +.. nonce: O3e6G- +.. section: Library + +Fix a regression in pyexpat. The parser's UseForeignDTD() method doesn't +require an argument again. + +.. + +.. bpo: 13590 +.. date: 8759 +.. nonce: 1aEwh4 +.. section: Library + +OS X Xcode 4 - improve support for universal extension modules In +particular, fix extension module build failures when trying to use 32-bit- +only installer Pythons on systems with Xcode 4 (currently OS X 10.8, 10.7, +and optionally 10.6). * Backport 3.3.0 fixes to 2.7 branch (for release in +2.7.4) * Since Xcode 4 removes ppc support, extension module builds now +check for ppc compiler support and by default remove ppc and ppc64 archs +when they are not available. * Extension module builds now revert to using +system installed headers and libs (/usr and /System/Library) if the SDK +used to build the interpreter is not installed or has moved. * Try to +avoid building extension modules with deprecated and problematic Apple +llvm-gcc compiler. If original compiler is not available, use clang +instead by default. + +.. + +.. bpo: 0 +.. date: 8758 +.. nonce: hHxr-m +.. section: IDLE + +IDLE was displaying spurious SystemExit tracebacks when running scripts that +terminated by raising SystemExit (i.e. unittest and turtledemo). + +.. + +.. bpo: 9290 +.. date: 8757 +.. nonce: Msbacw +.. section: IDLE + +In IDLE the sys.std* streams now implement io.TextIOBase interface and +support all mandatory methods and properties. + +.. + +.. bpo: 16829 +.. date: 8756 +.. nonce: u44Uel +.. section: IDLE + +IDLE printing no longer fails if there are spaces or other special +characters in the file path. + +.. + +.. bpo: 16819 +.. date: 8755 +.. nonce: rcJDrk +.. section: IDLE + +IDLE method completion now correctly works for unicode literals. + +.. + +.. bpo: 16504 +.. date: 8754 +.. nonce: othtN_ +.. section: IDLE + +IDLE now catches SyntaxErrors raised by tokenizer. Patch by Roger Serwy. + +.. + +.. bpo: 1207589 +.. date: 8753 +.. nonce: 0bmiue +.. section: IDLE + +Add Cut/Copy/Paste items to IDLE right click Context Menu. Patch by Todd +Rovito. + +.. + +.. bpo: 13052 +.. date: 8752 +.. nonce: ulRmqo +.. section: IDLE + +Fix IDLE crashing when replace string in Search/Replace dialog ended with +'\'. Patch by Roger Serwy. + +.. + +.. bpo: 9803 +.. date: 8751 +.. nonce: lJhnei +.. section: IDLE + +Don't close IDLE on saving if breakpoint is open. Patch by Roger Serwy. + +.. + +.. bpo: 14958 +.. date: 8750 +.. nonce: fWA3Eh +.. section: IDLE + +Change IDLE systax highlighting to recognize all string and byte literals +currently supported in Python 2.7. + +.. + +.. bpo: 14962 +.. date: 8749 +.. nonce: W_t8Sw +.. section: IDLE + +Update text coloring in IDLE shell window after changing options. Patch by +Roger Serwy. + +.. + +.. bpo: 10997 +.. date: 8748 +.. nonce: D59Zo_ +.. section: IDLE + +Prevent a duplicate entry in IDLE's "Recent Files" menu. + +.. + +.. bpo: 12510 +.. date: 8747 +.. nonce: 5hlN77 +.. section: IDLE + +Attempting to get invalid tooltip no longer closes IDLE. Original patch by +Roger Serwy. + +.. + +.. bpo: 10365 +.. date: 8746 +.. nonce: DI-DrH +.. section: IDLE + +File open dialog now works instead of crashing even when parent window is +closed. Patch by Roger Serwy. + +.. + +.. bpo: 14876 +.. date: 8745 +.. nonce: 73XqgG +.. section: IDLE + +Use user-selected font for highlight configuration. Patch by Roger Serwy. + +.. + +.. bpo: 14409 +.. date: 8744 +.. nonce: 8SNyRR +.. section: IDLE + +IDLE now properly executes commands in the Shell window when it cannot read +the normal config files on startup and has to use the built-in default key +bindings. There was previously a bug in one of the defaults. + +.. + +.. bpo: 3573 +.. date: 8743 +.. nonce: FIbWrY +.. section: IDLE + +IDLE hangs when passing invalid command line args (directory(ies) instead of +file(s)) (Patch by Guilherme Polo) + +.. + +.. bpo: 5219 +.. date: 8742 +.. nonce: We72rp +.. section: IDLE + +Prevent event handler cascade in IDLE. + +.. + +.. bpo: 15318 +.. date: 8741 +.. nonce: H1-iES +.. section: IDLE + +Prevent writing to sys.stdin. + +.. + +.. bpo: 13532 +.. date: 8740 +.. nonce: csNEK_ +.. section: IDLE + +Check that arguments to sys.stdout.write are strings. (See also: bpo-15319) + +.. + +.. bpo: 10365 +.. date: 8739 +.. nonce: MInibr +.. section: IDLE + +File open dialog now works instead of crashing even when parent window is +closed while dialog is open. + +.. + +.. bpo: 14018 +.. date: 8738 +.. nonce: HjN-7b +.. section: IDLE + +Update checks for unstable system Tcl/Tk versions on OS X to include +versions shipped with OS X 10.7 and 10.8 in addition to 10.6. + +.. + +.. bpo: 15853 +.. date: 8737 +.. nonce: Re1tK- +.. section: IDLE + +Prevent IDLE crash on OS X when opening Preferences menu with certain +versions of Tk 8.5. Initial patch by Kevin Walzer. + +.. + +.. bpo: 16702 +.. date: 8736 +.. nonce: 3Xf_t- +.. section: Tests + +test_urllib2_localnet tests now correctly ignores proxies for localhost +tests. + +.. + +.. bpo: 13447 +.. date: 8735 +.. nonce: _wys-6 +.. section: Tests + +Add a test file to host regression tests for bugs in the scripts found in +the Tools directory. + +.. + +.. bpo: 11420 +.. date: 8734 +.. nonce: J5oaxT +.. section: Tests + +make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas +Wouters. + +.. + +.. bpo: 17299 +.. date: 8733 +.. nonce: N_JA1r +.. section: Tests + +Add test coverage for cPickle with file objects and general IO objects. +Original patch by Aman Shah. + +.. + +.. bpo: 11963 +.. date: 8732 +.. nonce: _g8d_g +.. section: Tests + +remove human verification from test_parser and test_subprocess. + +.. + +.. bpo: 17249 +.. date: 8731 +.. nonce: wGvw7G +.. section: Tests + +convert a test in test_capi to use unittest and reap threads. + +.. + +.. bpo: 0 +.. date: 8730 +.. nonce: eaH1rt +.. section: Tests + +We now run both test_email.py and test_email_renamed.py when running the +test_email regression test. test_email_renamed contains some tests that +test_email does not. + +.. + +.. bpo: 17041 +.. date: 8729 +.. nonce: 57V5iD +.. section: Tests + +Fix testing when Python is configured with the --without-doc-strings option. + +.. + +.. bpo: 15539 +.. date: 8728 +.. nonce: a1_G0Q +.. section: Tests + +Added regression tests for Tools/scripts/pindent.py. + +.. + +.. bpo: 15324 +.. date: 8727 +.. nonce: VlPGUN +.. section: Tests + +Fix regrtest parsing of --fromfile and --randomize options. + +.. + +.. bpo: 16618 +.. date: 8726 +.. nonce: a2Xoyn +.. section: Tests + +Add more regression tests for glob. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16664 +.. date: 8725 +.. nonce: CxbZwX +.. section: Tests + +Add regression tests for glob's behaviour concerning entries starting with a +".". Patch by Sebastian Kreft. + +.. + +.. bpo: 15747 +.. date: 8724 +.. nonce: TE3rVk +.. section: Tests + +ZFS always returns EOPNOTSUPP when attempting to set the UF_IMMUTABLE flag +(via either chflags or lchflags); refactor affected tests in test_posix.py +to account for this. + +.. + +.. bpo: 16549 +.. date: 8723 +.. nonce: 9ENPOM +.. section: Tests + +Add tests for json.tools. Initial patch by Berker Peksag and Serhiy +Storchaka. + +.. + +.. bpo: 16559 +.. date: 8722 +.. nonce: JvxWbq +.. section: Tests + +Add more tests for the json module, including some from the official test +suite at json.org. Patch by Serhiy Storchaka. + +.. + +.. bpo: 16274 +.. date: 8721 +.. nonce: 9-uVb_ +.. section: Tests + +Fix test_asyncore on Solaris. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 15040 +.. date: 8720 +.. nonce: F30TYe +.. section: Tests + +Close files in mailbox tests for PyPy compatibility. Original patch by Matti +Picus. + +.. + +.. bpo: 15802 +.. date: 8719 +.. nonce: Ow-zrD +.. section: Tests + +Fix test logic in TestMaildir.test_create_tmp. Patch by Serhiy Storchaka. + +.. + +.. bpo: 15765 +.. date: 8718 +.. nonce: rH6KB2 +.. section: Tests + +Extend a previous fix to Solaris and OpenBSD for quirky getcwd() behaviour +(issue #9185) to NetBSD as well. + +.. + +.. bpo: 15615 +.. date: 8717 +.. nonce: C9YuEt +.. section: Tests + +Add some tests for the json module's handling of invalid input data. Patch +by Kushal Das. + +.. + +.. bpo: 15496 +.. date: 8716 +.. nonce: tm76dD +.. section: Tests + +Add directory removal helpers for tests on Windows. Patch by Jeremy Kloth. + +.. + +.. bpo: 15043 +.. date: 8715 +.. nonce: R2j8Hb +.. section: Tests + +test_gdb is now skipped entirely if gdb security settings block loading of +the gdb hooks + +.. + +.. bpo: 14589 +.. date: 8714 +.. nonce: 9aNtuR +.. section: Tests + +Update certificate chain for sha256.tbs-internet.com, fixing a test failure +in test_ssl. + +.. + +.. bpo: 16698 +.. date: 8713 +.. nonce: RgmYjY +.. section: Tests + +Skip posix test_getgroups when built with OS X deployment target prior to +10.6. + +.. + +.. bpo: 17111 +.. date: 8712 +.. nonce: ypc66r +.. section: Tests + +Prevent test_surrogates (test_fileio) failure on OS X 10.4. + +.. + +.. bpo: 17425 +.. date: 8711 +.. nonce: wTCSht +.. section: Build + +Build against openssl 0.9.8y on Windows. + +.. + +.. bpo: 16004 +.. date: 8710 +.. nonce: 5o_DZo +.. section: Build + +Add `make touch`. + +.. + +.. bpo: 5033 +.. date: 8709 +.. nonce: HKAgDA +.. section: Build + +Fix building of the sqlite3 extension module when the SQLite library version +has "beta" in it. Patch by Andreas Pelme. + +.. + +.. bpo: 17228 +.. date: 8708 +.. nonce: CCkAM0 +.. section: Build + +Fix building without pymalloc. + +.. + +.. bpo: 17086 +.. date: 8707 +.. nonce: iNoopm +.. section: Build + +Backport the patches from the 3.3 branch to cross-build the package. + +.. + +.. bpo: 3754 +.. date: 8706 +.. nonce: sUdOUp +.. section: Build + +fix typo in pthread AC_CACHE_VAL. + +.. + +.. bpo: 17029 +.. date: 8705 +.. nonce: dUd1NT +.. section: Build + +Let h2py search the multiarch system include directory. + +.. + +.. bpo: 16953 +.. date: 8704 +.. nonce: tW1KVY +.. section: Build + +Fix socket module compilation on platforms with HAVE_BROKEN_POLL. Patch by +Jeffrey Armstrong. + +.. + +.. bpo: 16836 +.. date: 8703 +.. nonce: JZ-zO7 +.. section: Build + +Enable IPv6 support even if IPv6 is disabled on the build host. + +.. + +.. bpo: 15923 +.. date: 8702 +.. nonce: PIv70V +.. section: Build + +fix a mistake in asdl_c.py that resulted in a TypeError after 2801bf875a24 +(see #15801). + +.. + +.. bpo: 11715 +.. date: 8701 +.. nonce: M3MapP +.. section: Build + +Fix multiarch detection without having Debian development tools (dpkg-dev) +installed. + +.. + +.. bpo: 15819 +.. date: 8700 +.. nonce: 09XLHb +.. section: Build + +Make sure we can build Python out-of-tree from a readonly source directory. +(Somewhat related to Issue #9860.) + +.. + +.. bpo: 15822 +.. date: 8699 +.. nonce: aLjenQ +.. section: Build + +Ensure 2to3 grammar pickles are properly installed. + +.. + +.. bpo: 15560 +.. date: 8698 +.. nonce: I8yMU0 +.. section: Build + +Fix building _sqlite3 extension on OS X with an SDK. + +.. + +.. bpo: 8847 +.. date: 8697 +.. nonce: lqI_r8 +.. section: Build + +Disable COMDAT folding in Windows PGO builds. + +.. + +.. bpo: 14018 +.. date: 8696 +.. nonce: RHawO_ +.. section: Build + +Fix OS X Tcl/Tk framework checking when using OS X SDKs. + +.. + +.. bpo: 16256 +.. date: 8695 +.. nonce: vrx66r +.. section: Build + +OS X installer now sets correct permissions for doc directory. + +.. + +.. bpo: 8767 +.. date: 8694 +.. nonce: swHbgQ +.. section: Build + +Restore building with --disable-unicode. Patch by Stefano Taschini. + +.. + +.. bpo: 0 +.. date: 8693 +.. nonce: wZLzuy +.. section: Build + +Build against bzip2 1.0.6 and openssl 0.9.8x on Windows. + +.. + +.. bpo: 14557 +.. date: 8692 +.. nonce: UCbIq7 +.. section: Build + +Fix extensions build on HP-UX. Patch by Adi Roiban. + +.. + +.. bpo: 14437 +.. date: 8691 +.. nonce: 61tmQt +.. section: Build + +Fix building the _io module under Cygwin. + +.. + +.. bpo: 15587 +.. date: 8690 +.. nonce: gR7vei +.. section: Build + +Enable Tk high-resolution text rendering on Macs with Retina displays. +Applies to Tkinter apps, such as IDLE, on OS X framework builds linked with +Cocoa Tk 8.5. + +.. + +.. bpo: 17161 +.. date: 8689 +.. nonce: 8Qr4fl +.. section: Build + +make install now also installs a python2 and python man page. + +.. + +.. bpo: 16848 +.. date: 8688 +.. nonce: CtyvVC +.. section: Build + +python-config now returns proper --ldflags values for OS X framework builds. + +.. + +.. bpo: 17156 +.. date: 8687 +.. nonce: iaFJiz +.. section: Tools/Demos + +pygettext.py now correctly escapes non-ascii characters. + +.. + +.. bpo: 15539 +.. date: 8686 +.. nonce: 6bqqV- +.. section: Tools/Demos + +Fix a number of bugs in Tools/scripts/pindent.py. Now pindent.py works with +a "with" statement. pindent.py no longer produces improper indentation. +pindent.py now works with continued lines broken after "class" or "def" +keywords and with continuations at the start of line. + +.. + +.. bpo: 16476 +.. date: 8685 +.. nonce: xAomrd +.. section: Tools/Demos + +Fix json.tool to avoid including trailing whitespace. + +.. + +.. bpo: 13301 +.. date: 8684 +.. nonce: A4WOk5 +.. section: Tools/Demos + +use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by +Serhiy Storchaka. + +.. + +.. bpo: 15041 +.. date: 8683 +.. nonce: nMyhwF +.. section: Documentation + +Update "see also" list in tkinter documentation. + +.. + +.. bpo: 17412 +.. date: 8682 +.. nonce: 9xIwEh +.. section: Documentation + +update 2.7 Doc/make.bat to also use sphinx-1.0.7. + +.. + +.. bpo: 17047 +.. date: 8681 +.. nonce: sVzpby +.. section: Documentation + +remove doubled words in docs and docstrings reported by Serhiy Storchaka and +Matthew Barnett. + +.. + +.. bpo: 16406 +.. date: 8680 +.. nonce: _Z8alE +.. section: Documentation + +combine the pages for uploading and registering to PyPI. + +.. + +.. bpo: 16403 +.. date: 8679 +.. nonce: wPuYgA +.. section: Documentation + +Document how distutils uses the maintainer field in PKG-INFO. Patch by Jyrki +Pulliainen. + +.. + +.. bpo: 16695 +.. date: 8678 +.. nonce: O3-q4k +.. section: Documentation + +Document how glob handles filenames starting with a dot. Initial patch by +Jyrki Pulliainen. + +.. + +.. bpo: 8890 +.. date: 8677 +.. nonce: ldKgWT +.. section: Documentation + +Stop advertising an insecure practice by replacing uses of the /tmp +directory with better alternatives in the documentation. Patch by Geoff +Wilson. + +.. + +.. bpo: 17203 +.. date: 8676 +.. nonce: b42JWx +.. section: Documentation + +add long option names to unittest discovery docs. + +.. + +.. bpo: 13094 +.. date: 8675 +.. nonce: ujdNxz +.. section: Documentation + +add "Why do lambdas defined in a loop with different values all return the +same result?" programming FAQ. + +.. + +.. bpo: 14901 +.. date: 8674 +.. nonce: o_thZo +.. section: Documentation + +Update portions of the Windows FAQ. Patch by Ashish Nitin Patil. + +.. + +.. bpo: 15990 +.. date: 8673 +.. nonce: 41C5_M +.. section: Documentation + +Improve argument/parameter documentation. + +.. + +.. bpo: 16400 +.. date: 8672 +.. nonce: kDLZRV +.. section: Documentation + +Update the description of which versions of a given package PyPI displays. + +.. + +.. bpo: 15677 +.. date: 8671 +.. nonce: _0vY-h +.. section: Documentation + +Document that zlib and gzip accept a compression level of 0 to mean 'no +compression'. Patch by Brian Brazil. + +.. + +.. bpo: 8040 +.. date: 8670 +.. nonce: R8VAys +.. section: Documentation + +added a version switcher to the documentation. Patch by Yury Selivanov. + +.. + +.. bpo: 16115 +.. date: 8669 +.. nonce: Ba1MH_ +.. section: Documentation + +Improve subprocess.Popen() documentation around args, shell, and executable +arguments. + +.. + +.. bpo: 15979 +.. date: 8668 +.. nonce: UATtRZ +.. section: Documentation + +Improve timeit documentation. + +.. + +.. bpo: 16036 +.. date: 8667 +.. nonce: AGR4Am +.. section: Documentation + +Improve documentation of built-in int()'s signature and arguments. + +.. + +.. bpo: 15935 +.. date: 8666 +.. nonce: Ik7Y0z +.. section: Documentation + +Clarification of argparse docs, re: add_argument() type and default +arguments. Patch contributed by Chris Jerdonek. + +.. + +.. bpo: 13769 +.. date: 8665 +.. nonce: TfRtQT +.. section: Documentation + +Document the effect of ensure_ascii to the return type of JSON decoding +functions. + +.. + +.. bpo: 14880 +.. date: 8664 +.. nonce: bfazFx +.. section: Documentation + +Fix kwargs notation in csv.reader, .writer & .register_dialect. Patch by +Chris Rebert. + +.. + +.. bpo: 14674 +.. date: 8663 +.. nonce: AMOJT_ +.. section: Documentation + +Add a discussion of the json module's standard compliance. Patch by Chris +Rebert. + +.. + +.. bpo: 15630 +.. date: 8662 +.. nonce: ijhqyT +.. section: Documentation + +Add an example for "continue" stmt in the tutorial. Patch by Daniel Ellis. + +.. + +.. bpo: 13557 +.. date: 8661 +.. nonce: IHzHRn +.. section: Documentation + +Clarify effect of giving two different namespaces to exec or execfile(). + +.. + +.. bpo: 14034 +.. date: 8660 +.. nonce: 34GDTv +.. section: Documentation + +added the argparse tutorial. + +.. + +.. bpo: 15250 +.. date: 8659 +.. nonce: vLLPGK +.. section: Documentation + +Document that filecmp.dircmp compares files shallowly. Patch contributed by +Chris Jerdonek. + +.. + +.. bpo: 15116 +.. date: 8658 +.. nonce: uDQI_8 +.. section: Documentation + +Remove references to appscript as it is no longer being supported. diff --git a/Misc/NEWS.d/2.7.5.rst b/Misc/NEWS.d/2.7.5.rst new file mode 100644 index 00000000000..f2093128ba9 --- /dev/null +++ b/Misc/NEWS.d/2.7.5.rst @@ -0,0 +1,510 @@ +.. bpo: 15535 +.. date: 9067 +.. nonce: UcBEvl +.. release date: 2013-05-12 +.. section: Core and Builtins + +Fixed regression in the pickling of named tuples by removing the __dict__ +property introduced in 2.7.4. + +.. + +.. bpo: 17857 +.. date: 9066 +.. nonce: 7cCKDk +.. section: Core and Builtins + +Prevent build failures with pre-3.5.0 versions of sqlite3, such as was +shipped with Centos 5 and Mac OS X 10.4. + +.. + +.. bpo: 17703 +.. date: 9065 +.. nonce: eLf2tu +.. section: Core and Builtins + +Fix a regression where an illegal use of Py_DECREF() after interpreter +finalization can cause a crash. + +.. + +.. bpo: 16447 +.. date: 9064 +.. nonce: Nqypja +.. section: Core and Builtins + +Fixed potential segmentation fault when setting __name__ on a class. + +.. + +.. bpo: 17610 +.. date: 9063 +.. nonce: QpIzEB +.. section: Core and Builtins + +Don't rely on non-standard behavior of the C qsort() function. + +.. + +.. bpo: 17979 +.. date: 9062 +.. nonce: l6BtNx +.. section: Library + +Fixed the re module in build with --disable-unicode. + +.. + +.. bpo: 17606 +.. date: 9061 +.. nonce: yNd47F +.. section: Library + +Fixed support of encoded byte strings in the XMLGenerator .characters() and +ignorableWhitespace() methods. Original patch by Sebastian Ortiz Vasquez. + +.. + +.. bpo: 16601 +.. date: 9060 +.. nonce: _FiBrB +.. section: Library + +Restarting iteration over tarfile no more continues from where it left off. +Patch by Michael Birtwell. + +.. + +.. bpo: 16584 +.. date: 9059 +.. nonce: 6yyCuX +.. section: Library + +in filecomp._cmp, catch IOError as well as os.error. Patch by Till Maas. + +.. + +.. bpo: 17926 +.. date: 9058 +.. nonce: nv5fLf +.. section: Library + +Fix dbm.__contains__ on 64-bit big-endian machines. + +.. + +.. bpo: 19267 +.. date: 9057 +.. nonce: SXv-Bh +.. section: Library + +Fix support of multibyte encoding (ex: UTF-16) in the logging module. + +.. + +.. bpo: 17918 +.. date: 9056 +.. nonce: qtEN-L +.. section: Library + +When using SSLSocket.accept(), if the SSL handshake failed on the new +socket, the socket would linger indefinitely. Thanks to Peter Saveliev for +reporting. + +.. + +.. bpo: 17289 +.. date: 9055 +.. nonce: NPHOks +.. section: Library + +The readline module now plays nicer with external modules or applications +changing the rl_completer_word_break_characters global variable. Initial +patch by Bradley Froehle. + +.. + +.. bpo: 12181 +.. date: 9054 +.. nonce: Dq2moC +.. section: Library + +select module: Fix struct kevent definition on OpenBSD 64-bit platforms. +Patch by Federico Schwindt. + +.. + +.. bpo: 14173 +.. date: 9053 +.. nonce: mZM9Pr +.. section: Library + +Avoid crashing when reading a signal handler during interpreter shutdown. + +.. + +.. bpo: 16316 +.. date: 9052 +.. nonce: AOkxPd +.. section: Library + +mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. + +.. + +.. bpo: 17192 +.. date: 9051 +.. nonce: F-vIFl +.. section: Library + +Restore the patch for Issue #10309 which was ommitted in 2.7.4 when updating +the bundled version of libffi used by ctypes. + +.. + +.. bpo: 17843 +.. date: 9050 +.. nonce: 9IBe9A +.. section: Library + +Removed test data file that was triggering false-positive virus warnings +with certain antivirus software. + +.. + +.. bpo: 17353 +.. date: 9049 +.. nonce: 6Wiqfl +.. section: Library + +Plistlib emitted empty data tags with deeply nested datastructures + +.. + +.. bpo: 11714 +.. date: 9048 +.. nonce: EZxzYl +.. section: Library + +Use 'with' statements to assure a Semaphore releases a condition variable. +Original patch by Thomas Rachel. + +.. + +.. bpo: 17795 +.. date: 9047 +.. nonce: IgVwMv +.. section: Library + +Reverted backwards-incompatible change in SysLogHandler with Unix domain +sockets. + +.. + +.. bpo: 17555 +.. date: 9046 +.. nonce: 9klJCB +.. section: Library + +Fix ForkAwareThreadLock so that size of after fork registry does not grow +exponentially with generation of process. + +.. + +.. bpo: 17710 +.. date: 9045 +.. nonce: p-amHh +.. section: Library + +Fix cPickle raising a SystemError on bogus input. + +.. + +.. bpo: 17341 +.. date: 9044 +.. nonce: DI-1AO +.. section: Library + +Include the invalid name in the error messages from re about invalid group +names. + +.. + +.. bpo: 17016 +.. date: 9043 +.. nonce: lQnMI8 +.. section: Library + +Get rid of possible pointer wraparounds and integer overflows in the re +module. Patch by Nickolai Zeldovich. + +.. + +.. bpo: 17536 +.. date: 9042 +.. nonce: E6rcrn +.. section: Library + +Add to webbrowser's browser list: xdg-open, gvfs-open, www-browser, x-www- +browser, chromium browsers, iceweasel, iceape. + +.. + +.. bpo: 17656 +.. date: 9041 +.. nonce: wtQq2x +.. section: Library + +Fix extraction of zip files with unicode member paths. + +.. + +.. bpo: 17666 +.. date: 9040 +.. nonce: L8Gq8u +.. section: Library + +Fix reading gzip files with an extra field. + +.. + +.. bpo: 13150 +.. date: 9039 +.. nonce: fW-wYi +.. section: Library + +sysconfig no longer parses the Makefile and config.h files when imported, +instead doing it at build time. This makes importing sysconfig faster and +reduces Python startup time by 20%. (See also: bpo-17512) + +.. + +.. bpo: 13163 +.. date: 9038 +.. nonce: oHSKa5 +.. section: Library + +Rename operands in smtplib.SMTP._get_socket to correct names; fixes +otherwise misleading output in tracebacks and when when debug is on. + +.. + +.. bpo: 17526 +.. date: 9037 +.. nonce: wiYvlk +.. section: Library + +fix an IndexError raised while passing code without filename to +inspect.findsource(). Initial patch by Tyler Doyle. + +.. + +.. bpo: 17547 +.. date: 9036 +.. nonce: yVllRd +.. section: Build + +In configure, explicitly pass -Wformat for the benefit for GCC 4.8. + +.. + +.. bpo: 17682 +.. date: 9035 +.. nonce: UJyp1a +.. section: Build + +Add the _io module to Modules/Setup.dist (commented out). + +.. + +.. bpo: 17086 +.. date: 9034 +.. nonce: PPxAFs +.. section: Build + +Search the include and library directories provided by the compiler. + +.. + +.. bpo: 17928 +.. date: 9033 +.. nonce: y6tiT2 +.. section: Tests + +Fix test_structmembers on 64-bit big-endian machines. + +.. + +.. bpo: 17883 +.. date: 9032 +.. nonce: SrO_uE +.. section: Tests + +Fix buildbot testing of Tkinter on Windows. Patch by Zachary Ware. + +.. + +.. bpo: 7855 +.. date: 9031 +.. nonce: ZbX91d +.. section: Tests + +Add tests for ctypes/winreg for issues found in IronPython. Initial patch by +Dino Viehland. + +.. + +.. bpo: 17712 +.. date: 9030 +.. nonce: RqkHUB +.. section: Tests + +Fix test_gdb failures on Ubuntu 13.04. + +.. + +.. bpo: 17065 +.. date: 9029 +.. nonce: rql8lF +.. section: Tests + +Use process-unique key for winreg tests to avoid failures if test is run +multiple times in parallel (eg: on a buildbot host). + +.. + +.. bpo: 17838 +.. date: 9028 +.. nonce: -DDdhT +.. section: IDLE + +Allow sys.stdin to be reassigned. + +.. + +.. bpo: 14735 +.. date: 9027 +.. nonce: lbbw49 +.. section: IDLE + +Update IDLE docs to omit "Control-z on Windows". + +.. + +.. bpo: 17585 +.. date: 9026 +.. nonce: oXlcVX +.. section: IDLE + +Fixed IDLE regression. Now closes when using exit() or quit(). + +.. + +.. bpo: 17657 +.. date: 9025 +.. nonce: rGfxNo +.. section: IDLE + +Show full Tk version in IDLE's about dialog. Patch by Todd Rovito. + +.. + +.. bpo: 17613 +.. date: 9024 +.. nonce: MfAJ31 +.. section: IDLE + +Prevent traceback when removing syntax colorizer in IDLE. + +.. + +.. bpo: 1207589 +.. date: 9023 +.. nonce: wqzkjh +.. section: IDLE + +Backwards-compatibility patch for right-click menu in IDLE. + +.. + +.. bpo: 16887 +.. date: 9022 +.. nonce: -tb-0g +.. section: IDLE + +IDLE now accepts Cancel in tabify/untabify dialog box. + +.. + +.. bpo: 14254 +.. date: 9021 +.. nonce: heeMG- +.. section: IDLE + +IDLE now handles readline correctly across shell restarts. + +.. + +.. bpo: 17614 +.. date: 9020 +.. nonce: 9pmpYW +.. section: IDLE + +IDLE no longer raises exception when quickly closing a file. + +.. + +.. bpo: 6698 +.. date: 9019 +.. nonce: fXoiv2 +.. section: IDLE + +IDLE now opens just an editor window when configured to do so. + +.. + +.. bpo: 8900 +.. date: 9018 +.. nonce: jkW99r +.. section: IDLE + +Using keyboard shortcuts in IDLE to open a file no longer raises an +exception. + +.. + +.. bpo: 6649 +.. date: 9017 +.. nonce: uwGice +.. section: IDLE + +Fixed missing exit status in IDLE. Patch by Guilherme Polo. + +.. + +.. bpo: 17390 +.. date: 9016 +.. nonce: o3w4vc +.. section: IDLE + +Display Python version on Idle title bar. Initial patch by Edmond Burnett. + +.. + +.. bpo: 15940 +.. date: 9015 +.. nonce: XL62xu +.. section: Documentation + +Specify effect of locale on time functions. + +.. + +.. bpo: 6696 +.. date: 9014 +.. nonce: -aRVrf +.. section: Documentation + +add documentation for the Profile objects, and improve profile/cProfile +docs. Patch by Tom Pinckney. diff --git a/Misc/NEWS.d/2.7.6.rst b/Misc/NEWS.d/2.7.6.rst new file mode 100644 index 00000000000..51ab9bcb9be --- /dev/null +++ b/Misc/NEWS.d/2.7.6.rst @@ -0,0 +1,37 @@ +.. bpo: 19435 +.. date: 9186 +.. nonce: kXqMz3 +.. release date: 2013-11-10 +.. section: Library + +Fix directory traversal attack on CGIHttpRequestHandler. + +.. + +.. bpo: 19426 +.. date: 9185 +.. nonce: PwatP7 +.. section: IDLE + +Fixed the opening of Python source file with specified encoding. + +.. + +.. bpo: 19457 +.. date: 9184 +.. nonce: HGwEFx +.. section: Tests + +Fixed xmlcharrefreplace tests on wide build when tests are loaded from +.py[co] files. + +.. + +.. bpo: 15663 +.. date: 9183 +.. nonce: p-vVTG +.. section: Build + +Revert OS X installer built-in Tcl/Tk support for 2.7.6. Some third-party +projects, such as Matplotlib and PIL/Pillow, depended on being able to build +with Tcl and Tk frameworks in /Library/Frameworks. diff --git a/Misc/NEWS.d/2.7.6rc1.rst b/Misc/NEWS.d/2.7.6rc1.rst new file mode 100644 index 00000000000..32ee2e61ca2 --- /dev/null +++ b/Misc/NEWS.d/2.7.6rc1.rst @@ -0,0 +1,1130 @@ +.. bpo: 18603 +.. date: 9182 +.. nonce: 7SMyAQ +.. release date: 2013-10-26 +.. section: Core and Builtins + +Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the Python executable +and not removed by the linker's optimizer. + +.. + +.. bpo: 19279 +.. date: 9181 +.. nonce: bXi_a1 +.. section: Core and Builtins + +UTF-7 decoder no more produces illegal unicode strings. + +.. + +.. bpo: 18739 +.. date: 9180 +.. nonce: ZUuspY +.. section: Core and Builtins + +Fix an inconsistency between math.log(n) and math.log(long(n)); the results +could be off from one another by a ulp or two. + +.. + +.. bpo: 13461 +.. date: 9179 +.. nonce: ExV3tX +.. section: Core and Builtins + +Fix a crash in the "replace" error handler on 64-bit platforms. Patch by +Yogesh Chaudhari. + +.. + +.. bpo: 15866 +.. date: 9178 +.. nonce: meZHE- +.. section: Core and Builtins + +The xmlcharrefreplace error handler no more produces two XML entities for a +non-BMP character on narrow build. + +.. + +.. bpo: 18184 +.. date: 9177 +.. nonce: xLNVG3 +.. section: Core and Builtins + +PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise OverflowError +when an argument of %c format is out of range. + +.. + +.. bpo: 18137 +.. date: 9176 +.. nonce: a_Vsor +.. section: Core and Builtins + +Detect integer overflow on precision in float.__format__() and +complex.__format__(). + +.. + +.. bpo: 18038 +.. date: 9175 +.. nonce: Q8prhd +.. section: Core and Builtins + +SyntaxError raised during compilation sources with illegal encoding now +always contains an encoding name. + +.. + +.. bpo: 18019 +.. date: 9174 +.. nonce: HdAInl +.. section: Core and Builtins + +Fix crash in the repr of dictionaries containing their own views. + +.. + +.. bpo: 18427 +.. date: 9173 +.. nonce: XEBN6L +.. section: Core and Builtins + +str.replace could crash the interpreter with huge strings. + +.. + +.. bpo: 19393 +.. date: 9172 +.. nonce: ytbAwl +.. section: Library + +Fix symtable.symtable function to not be confused when there are functions +or classes named "top". + +.. + +.. bpo: 19327 +.. date: 9171 +.. nonce: S7Xvxs +.. section: Library + +Fixed the working of regular expressions with too big charset. + +.. + +.. bpo: 19350 +.. date: 9170 +.. nonce: MCCKjK +.. section: Library + +Increasing the test coverage of macurl2path. Patch by Colin Williams. + +.. + +.. bpo: 19352 +.. date: 9169 +.. nonce: 3TfAkY +.. section: Library + +Fix unittest discovery when a module can be reached through several paths +(e.g. under Debian/Ubuntu with virtualenv). + +.. + +.. bpo: 15207 +.. date: 9168 +.. nonce: piOBBi +.. section: Library + +Fix mimetypes to read from correct part of Windows registry Original patch +by Dave Chambers + +.. + +.. bpo: 8964 +.. date: 9167 +.. nonce: dzU2FB +.. section: Library + +fix platform._sys_version to handle IronPython 2.6+. Patch by Martin +Matusiak. + +.. + +.. bpo: 16038 +.. date: 9166 +.. nonce: TZGbSo +.. section: Library + +CVE-2013-1752: ftplib: Limit amount of data read by limiting the call to +readline(). Original patch by Micha? Jastrz?bski and Giampaolo Rodola. + +.. + +.. bpo: 19276 +.. date: 9165 +.. nonce: Y69Qmv +.. section: Library + +Fixed the wave module on 64-bit big-endian platforms. + +.. + +.. bpo: 18458 +.. date: 9164 +.. nonce: 6Bs0gr +.. section: Library + +Prevent crashes with newer versions of libedit. Its readline emulation has +changed from 0-based indexing to 1-based like gnu readline. Original patch +by Ronald Oussoren. + +.. + +.. bpo: 18919 +.. date: 9163 +.. nonce: rIO3MQ +.. section: Library + +If the close() method of a writer in the sunau or wave module failed, second +invocation of close() and destructor no more raise an exception. Second +invocation of close() on sunau writer now has no effects. The aifc module +now accepts lower case of names of the 'ulaw' and 'alaw' codecs. + +.. + +.. bpo: 19131 +.. date: 9162 +.. nonce: eZXzpr +.. section: Library + +The aifc module now correctly reads and writes sampwidth of compressed +streams. + +.. + +.. bpo: 19158 +.. date: 9161 +.. nonce: GvkZuU +.. section: Library + +A rare race in BoundedSemaphore could allow .release() too often. + +.. + +.. bpo: 18037 +.. date: 9160 +.. nonce: pmZRS7 +.. section: Library + +2to3 now escapes '\u' and '\U' in native strings. + +.. + +.. bpo: 19137 +.. date: 9159 +.. nonce: kdJchn +.. section: Library + +The pprint module now correctly formats empty set and frozenset and +instances of set and frozenset subclasses. + +.. + +.. bpo: 16040 +.. date: 9158 +.. nonce: xg3xlX +.. section: Library + +CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to prevent +readline() calls from consuming too much memory. Patch by Jyrki Pulliainen. + +.. + +.. bpo: 12641 +.. date: 9157 +.. nonce: r9sIyX +.. section: Library + +Avoid passing "-mno-cygwin" to the mingw32 compiler, except when necessary. +Patch by Oscar Benjamin. + +.. + +.. bpo: 0 +.. date: 9156 +.. nonce: 08TsG5 +.. section: Library + +Properly initialize all fields of a SSL object after allocation. + +.. + +.. bpo: 4366 +.. date: 9155 +.. nonce: lDEdfK +.. section: Library + +Fix building extensions on all platforms when --enable-shared is used. + +.. + +.. bpo: 18950 +.. date: 9154 +.. nonce: AoZ5GZ +.. section: Library + +Fix miscellaneous bugs in the sunau module. Au_read.readframes() now updates +current file position and reads correct number of frames from multichannel +stream. Au_write.writeframesraw() now correctly updates current file +position. Au_read and Au_write now correctly work with file object if start +file position is not a zero. + +.. + +.. bpo: 18050 +.. date: 9153 +.. nonce: LUKrBT +.. section: Library + +Fixed an incompatibility of the re module with Python 2.7.3 and older +binaries. + +.. + +.. bpo: 19037 +.. date: 9152 +.. nonce: OfBhoU +.. section: Library + +The mailbox module now makes all changes to maildir files before moving them +into place, to avoid race conditions with other programs that may be +accessing the maildir directory. + +.. + +.. bpo: 14984 +.. date: 9151 +.. nonce: iRbFp4 +.. section: Library + +On POSIX systems, when netrc is called without a filename argument (and +therefore is reading the user's $HOME/.netrc file), it now enforces the same +security rules as typical ftp clients: the .netrc file must be owned by the +user that owns the process and must not be readable by any other user. + +.. + +.. bpo: 17324 +.. date: 9150 +.. nonce: 0PkOTi +.. section: Library + +Fix http.server's request handling case on trailing '/'. Patch contributed +by Vajrasky Kok. + +.. + +.. bpo: 19018 +.. date: 9149 +.. nonce: mntKOW +.. section: Library + +The heapq.merge() function no longer suppresses IndexError in the underlying +iterables. + +.. + +.. bpo: 18784 +.. date: 9148 +.. nonce: ocU3GG +.. section: Library + +The uuid module no more attempts to load libc via ctypes.CDLL, if all +necessary functions are already found in libuuid. Patch by Evgeny Sologubov. + +.. + +.. bpo: 14971 +.. date: 9147 +.. nonce: cc8xNA +.. section: Library + +unittest test discovery no longer gets confused when a function has a +different __name__ than its name in the TestCase class dictionary. + +.. + +.. bpo: 18672 +.. date: 9146 +.. nonce: CIblDh +.. section: Library + +Fixed format specifiers for Py_ssize_t in debugging output in the _sre +module. + +.. + +.. bpo: 18830 +.. date: 9145 +.. nonce: Uzi-Y4 +.. section: Library + +inspect.getclasstree() no more produces duplicated entries even when input +list contains duplicates. + +.. + +.. bpo: 18909 +.. date: 9144 +.. nonce: XSu98N +.. section: Library + +Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast 64-bit pointer +to long (32 bits). + +.. + +.. bpo: 18876 +.. date: 9143 +.. nonce: 30Ist9 +.. section: Library + +The FileIO.mode attribute now better reflects the actual mode under which +the file was opened. Patch by Erik Bray. + +.. + +.. bpo: 18851 +.. date: 9142 +.. nonce: -YsF6X +.. section: Library + +Avoid a double close of subprocess pipes when the child process fails +starting. + +.. + +.. bpo: 18418 +.. date: 9141 +.. nonce: _SFG8w +.. section: Library + +After fork(), reinit all threads states, not only active ones. Patch by A. +Jesse Jiryu Davis. + +.. + +.. bpo: 11973 +.. date: 9140 +.. nonce: uPtBvG +.. section: Library + +Fix a problem in kevent. The flags and fflags fields are now properly +handled as unsigned. + +.. + +.. bpo: 16809 +.. date: 9139 +.. nonce: TF5mD7 +.. section: Library + +Fixed some tkinter incompatibilities with Tcl/Tk 8.6. + +.. + +.. bpo: 16809 +.. date: 9138 +.. nonce: WqSHdP +.. section: Library + +Tkinter's splitlist() and split() methods now accept Tcl_Obj argument. + +.. + +.. bpo: 17119 +.. date: 9137 +.. nonce: sfp47f +.. section: Library + +Fixed integer overflows when processing large Unicode strings and tuples in +the tkinter module. + +.. + +.. bpo: 15233 +.. date: 9136 +.. nonce: 8YQW0- +.. section: Library + +Python now guarantees that callables registered with the atexit module will +be called in a deterministic order. + +.. + +.. bpo: 18747 +.. date: 9135 +.. nonce: tPZkbG +.. section: Library + +Re-seed OpenSSL's pseudo-random number generator after fork. A +pthread_atfork() parent handler is used to seed the PRNG with pid, time and +some stack data. + +.. + +.. bpo: 8865 +.. date: 9134 +.. nonce: cKBSJh +.. section: Library + +Concurrent invocation of select.poll.poll() now raises a RuntimeError +exception. Patch by Christian Schubert. + +.. + +.. bpo: 13461 +.. date: 9133 +.. nonce: nLeS2R +.. section: Library + +Fix a crash in the TextIOWrapper.tell method on 64-bit platforms. Patch by +Yogesh Chaudhari. + +.. + +.. bpo: 18777 +.. date: 9132 +.. nonce: VLsjOw +.. section: Library + +The ssl module now uses the new CRYPTO_THREADID API of OpenSSL 1.0.0+ +instead of the deprecated CRYPTO id callback function. + +.. + +.. bpo: 18768 +.. date: 9131 +.. nonce: r3TSCo +.. section: Library + +Correct doc string of RAND_edg(). Patch by Vajrasky Kok. + +.. + +.. bpo: 18178 +.. date: 9130 +.. nonce: i4hnf- +.. section: Library + +Fix ctypes on BSD. dlmalloc.c was compiled twice which broke malloc weak +symbols. + +.. + +.. bpo: 18709 +.. date: 9129 +.. nonce: DWzpRe +.. section: Library + +Fix CVE-2013-4238. The SSL module now handles NULL bytes inside +subjectAltName correctly. Formerly the module has used OpenSSL's +GENERAL_NAME_print() function to get the string representation of ASN.1 +strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and +``uniformResourceIdentifier`` (URI). + +.. + +.. bpo: 18756 +.. date: 9128 +.. nonce: moRUfX +.. section: Library + +Improve error reporting in os.urandom() when the failure is due to something +else than /dev/urandom not existing (for example, exhausting the file +descriptor limit). + +.. + +.. bpo: 0 +.. date: 9127 +.. nonce: b9GShY +.. section: Library + +Fix tkinter regression introduced by the security fix in issue #16248. + +.. + +.. bpo: 18676 +.. date: 9126 +.. nonce: WAq1iB +.. section: Library + +Change 'positive' to 'non-negative' in queue.py put and get docstrings and +ValueError messages. Patch by Zhongyue Luo + +.. + +.. bpo: 17998 +.. date: 9125 +.. nonce: hIbru5 +.. section: Library + +Fix an internal error in regular expression engine. + +.. + +.. bpo: 17557 +.. date: 9124 +.. nonce: s6BEMI +.. section: Library + +Fix os.getgroups() to work with the modified behavior of getgroups(2) on OS +X 10.8. Original patch by Mateusz Lenik. + +.. + +.. bpo: 18455 +.. date: 9123 +.. nonce: t1b0R_ +.. section: Library + +multiprocessing should not retry connect() with same socket. + +.. + +.. bpo: 18513 +.. date: 9122 +.. nonce: 12JUZi +.. section: Library + +Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + gcc. + +.. + +.. bpo: 18101 +.. date: 9121 +.. nonce: hWfUNM +.. section: Library + +Tcl.split() now process Unicode strings nested in a tuple as it do with byte +strings. + +.. + +.. bpo: 18347 +.. date: 9120 +.. nonce: r98Yh- +.. section: Library + +ElementTree's html serializer now preserves the case of closing tags. + +.. + +.. bpo: 17261 +.. date: 9119 +.. nonce: FBzLVh +.. section: Library + +Ensure multiprocessing's proxies use proper address. + +.. + +.. bpo: 17097 +.. date: 9118 +.. nonce: npje1S +.. section: Library + +Make multiprocessing ignore EINTR. + +.. + +.. bpo: 18155 +.. date: 9117 +.. nonce: P-O3wv +.. section: Library + +The csv module now correctly handles csv files that use a delimiter +character that has a special meaning in regexes, instead of throwing an +exception. + +.. + +.. bpo: 18135 +.. date: 9116 +.. nonce: AYPE8L +.. section: Library + +ssl.SSLSocket.write() now raises an OverflowError if the input string in +longer than 2 gigabytes. The ssl module does not support partial write. + +.. + +.. bpo: 18167 +.. date: 9115 +.. nonce: CE6ZMO +.. section: Library + +cgi.FieldStorage no longer fails to handle multipart/form-data when \r\n +appears at end of 65535 bytes without other newlines. + +.. + +.. bpo: 17403 +.. date: 9114 +.. nonce: gtIhUd +.. section: Library + +urllib.parse.robotparser normalizes the urls before adding to ruleline. This +helps in handling certain types invalid urls in a conservative manner. Patch +contributed by Mher Movsisyan. + +.. + +.. bpo: 0 +.. date: 9113 +.. nonce: jM5EPF +.. section: Library + +Implement inequality on weakref.WeakSet. + +.. + +.. bpo: 17981 +.. date: 9112 +.. nonce: kIczv7 +.. section: Library + +Closed socket on error in SysLogHandler. + +.. + +.. bpo: 18015 +.. date: 9111 +.. nonce: 85_YuN +.. section: Library + +Fix unpickling of 2.7.3 and 2.7.4 namedtuples. + +.. + +.. bpo: 17754 +.. date: 9110 +.. nonce: xa6Bc3 +.. section: Library + +Make ctypes.util.find_library() independent of the locale. + +.. + +.. bpo: 0 +.. date: 9109 +.. nonce: 9OGCJH +.. section: Library + +Fix typos in the multiprocessing module. + +.. + +.. bpo: 17269 +.. date: 9108 +.. nonce: 7LxyKz +.. section: Library + +Workaround for socket.getaddrinfo crash on MacOS X with port None or "0" and +flags AI_NUMERICSERV. + +.. + +.. bpo: 18080 +.. date: 9107 +.. nonce: 8bMdE3 +.. section: Library + +When building a C extension module on OS X, if the compiler is overridden +with the CC environment variable, use the new compiler as the default for +linking if LDSHARED is not also overridden. This restores Distutils +behavior introduced in 2.7.3 and inadvertently dropped in 2.7.4. + +.. + +.. bpo: 18071 +.. date: 9106 +.. nonce: 2FwU0S +.. section: Library + +C extension module builds on OS X could fail with TypeError if the Xcode +command line tools were not installed. + +.. + +.. bpo: 18113 +.. date: 9105 +.. nonce: 7w81KJ +.. section: Library + +Fixed a refcount leak in the curses.panel module's set_userptr() method. +Reported by Atsuo Ishimoto. + +.. + +.. bpo: 18849 +.. date: 9104 +.. nonce: Q0kF0R +.. section: Library + +Fixed a Windows-specific tempfile bug where collision with an existing +directory caused mkstemp and related APIs to fail instead of retrying. +Report and fix by Vlad Shcherbina. + +.. + +.. bpo: 19400 +.. date: 9103 +.. nonce: QAqpk5 +.. section: Library + +Prevent extension module build failures with Xcode 5 on OS X 10.8+ when +using a universal Python that included a PPC architecture, such as with a +python.org 32-bit-only binary installer. + +.. + +.. bpo: 18873 +.. date: 9102 +.. nonce: i_1Tf_ +.. section: Tools/Demos + +2to3 and the findnocoding.py script now detect Python source code encoding +only in comment lines. + +.. + +.. bpo: 18817 +.. date: 9101 +.. nonce: yma3Gh +.. section: Tools/Demos + +Fix a resource warning in Lib/aifc.py demo. + +.. + +.. bpo: 18439 +.. date: 9100 +.. nonce: W9DxeL +.. section: Tools/Demos + +Make patchcheck work on Windows for ACKS, NEWS. + +.. + +.. bpo: 18448 +.. date: 9099 +.. nonce: gMA5pg +.. section: Tools/Demos + +Fix a typo in Demo/newmetaclasses/Eiffel.py. + +.. + +.. bpo: 12990 +.. date: 9098 +.. nonce: E1geL- +.. section: Tools/Demos + +The "Python Launcher" on OSX could not launch python scripts that have paths +that include wide characters. + +.. + +.. bpo: 16067 +.. date: 9097 +.. nonce: xeYOfj +.. section: Build + +Add description into MSI file to replace installer's temporary name. + +.. + +.. bpo: 18256 +.. date: 9096 +.. nonce: PiEkYT +.. section: Build + +Compilation fix for recent AIX releases. Patch by David Edelsohn. + +.. + +.. bpo: 18098 +.. date: 9095 +.. nonce: KZmfoE +.. section: Build + +The deprecated OS X Build Applet.app fails to build on OS X 10.8 systems +because the Apple-deprecated QuickDraw headers have been removed from Xcode +4. Skip building it in this case. + +.. + +.. bpo: 1584 +.. date: 9094 +.. nonce: qjDxpR +.. section: Build + +Provide options to override default search paths for Tcl and Tk when +building _tkinter. + +.. + +.. bpo: 15663 +.. date: 9093 +.. nonce: 9Da_Rj +.. section: Build + +Tcl/Tk 8.5.15 is now included with the OS X 10.6+ 64-bit/32-bit installer +for 10.6+. It is no longer necessary to install a third-party version of +Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 +shipped in OS X 10.6 and later releases. + +.. + +.. bpo: 19019 +.. date: 9092 +.. nonce: 5W7lw_ +.. section: Build + +Change the OS X installer build script to use CFLAGS instead of OPT for +special build options. By setting OPT, some compiler-specific options like +-fwrapv were overridden and thus not used, which could result in broken +interpreters when building with clang. + +.. + +.. bpo: 18873 +.. date: 9091 +.. nonce: dyLPY9 +.. section: IDLE + +IDLE now detects Python source code encoding only in comment lines. + +.. + +.. bpo: 18988 +.. date: 9090 +.. nonce: 6CpesW +.. section: IDLE + +The "Tab" key now works when a word is already autocompleted. + +.. + +.. bpo: 18489 +.. date: 9089 +.. nonce: nOvxOH +.. section: IDLE + +Add tests for SearchEngine. Original patch by Phil Webster. + +.. + +.. bpo: 18429 +.. date: 9088 +.. nonce: F1lTq1 +.. section: IDLE + +Format / Format Paragraph, now works when comment blocks are selected. As +with text blocks, this works best when the selection only includes complete +lines. + +.. + +.. bpo: 18226 +.. date: 9087 +.. nonce: 5HtrW1 +.. section: IDLE + +Add docstrings and unittests for FormatParagraph.py. Original patches by +Todd Rovito and Phil Webster. + +.. + +.. bpo: 18279 +.. date: 9086 +.. nonce: UoF-oR +.. section: IDLE + +Format - Strip trailing whitespace no longer marks a file as changed when it +has not been changed. This fix followed the addition of a test file +originally written by Phil Webster (the issue's main goal). + +.. + +.. bpo: 18539 +.. date: 9085 +.. nonce: _ddWOv +.. section: IDLE + +Calltips now work for float default arguments. + +.. + +.. bpo: 7136 +.. date: 9084 +.. nonce: 7horQf +.. section: IDLE + +In the Idle File menu, "New Window" is renamed "New File". Patch by Tal +Einat, Roget Serwy, and Todd Rovito. + +.. + +.. bpo: 8515 +.. date: 9083 +.. nonce: wY13t0 +.. section: IDLE + +Set __file__ when run file in IDLE. Initial patch by Bruce Frederiksen. + +.. + +.. bpo: 5492 +.. date: 9082 +.. nonce: LCx7lq +.. section: IDLE + +Avoid traceback when exiting IDLE caused by a race condition. + +.. + +.. bpo: 17511 +.. date: 9081 +.. nonce: 6XqdTH +.. section: IDLE + +Keep IDLE find dialog open after clicking "Find Next". Original patch by +Sarah K. + +.. + +.. bpo: 15392 +.. date: 9080 +.. nonce: rB5VoV +.. section: IDLE + +Create a unittest framework for IDLE. Preliminary patch by Rajagopalasarma +Jayakrishnan See Lib/idlelib/idle_test/README.txt for how to run Idle tests. + +.. + +.. bpo: 14146 +.. date: 9079 +.. nonce: -n5gzd +.. section: IDLE + +Highlight source line while debugging on Windows. + +.. + +.. bpo: 17532 +.. date: 9078 +.. nonce: wgA70Z +.. section: IDLE + +Always include Options menu for IDLE on OS X. Patch by Guilherme Sim?es. + +.. + +.. bpo: 18919 +.. date: 9077 +.. nonce: BOq1BY +.. section: Tests + +Added tests for the sunau module. Unified and extended tests for audio +modules: aifc, sunau and wave. + +.. + +.. bpo: 18792 +.. date: 9076 +.. nonce: 5RkYdK +.. section: Tests + +Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since +"localhost" goes through a DNS lookup under recent Windows versions. + +.. + +.. bpo: 18357 +.. date: 9075 +.. nonce: jRiyQA +.. section: Tests + +add tests for dictview set difference. Patch by Fraser Tweedale. + +.. + +.. bpo: 11185 +.. date: 9074 +.. nonce: McIHeT +.. section: Tests + +Fix test_wait4 under AIX. Patch by S?bastien Sabl?. + +.. + +.. bpo: 18094 +.. date: 9073 +.. nonce: VeMh1H +.. section: Tests + +test_uuid no more reports skipped tests as passed. + +.. + +.. bpo: 11995 +.. date: 9072 +.. nonce: varfN1 +.. section: Tests + +test_pydoc doesn't import all sys.path modules anymore. + +.. + +.. bpo: 18758 +.. date: 9071 +.. nonce: hMCi7Z +.. section: Documentation + +Fixed and improved cross-references. + +.. + +.. bpo: 18718 +.. date: 9070 +.. nonce: CtpK5H +.. section: Documentation + +datetime documentation contradictory on leap second support. + +.. + +.. bpo: 17701 +.. date: 9069 +.. nonce: FtTZ66 +.. section: Documentation + +Improving strftime documentation. + +.. + +.. bpo: 17844 +.. date: 9068 +.. nonce: R4Gssa +.. section: Documentation + +Refactor a documentation of Python specific encodings. Add links to encoders +and decoders for binary-to-binary codecs. diff --git a/Misc/NEWS.d/2.7.7.rst b/Misc/NEWS.d/2.7.7.rst new file mode 100644 index 00000000000..fbad9ad3b87 --- /dev/null +++ b/Misc/NEWS.d/2.7.7.rst @@ -0,0 +1,16 @@ +.. bpo: 21462 +.. date: 9328 +.. nonce: Ee4oKH +.. release date: 2014-05-31 +.. section: Build + +Build the Windows installers with OpenSSL 1.0.1g. + +.. + +.. bpo: 19866 +.. date: 9327 +.. nonce: 15D08i +.. section: Build + +Include some test data in the Windows installers, so tests don't fail. diff --git a/Misc/NEWS.d/2.7.7rc1.rst b/Misc/NEWS.d/2.7.7rc1.rst new file mode 100644 index 00000000000..93ef5695c62 --- /dev/null +++ b/Misc/NEWS.d/2.7.7rc1.rst @@ -0,0 +1,1376 @@ +.. bpo: 21350 +.. date: 9326 +.. nonce: jnq6gO +.. release date: 2014-05-17 +.. section: Core and Builtins + +Fix file.writelines() to accept arbitrary buffer objects, as advertised. +Patch by Brian Kearns. + +.. + +.. bpo: 20437 +.. date: 9325 +.. nonce: 9Rsiua +.. section: Core and Builtins + +Fixed 43 potential bugs when deleting object references. + +.. + +.. bpo: 21134 +.. date: 9324 +.. nonce: ZL4SKo +.. section: Core and Builtins + +Fix segfault when str is called on an uninitialized UnicodeEncodeError, +UnicodeDecodeError, or UnicodeTranslateError object. + +.. + +.. bpo: 20494 +.. date: 9323 +.. nonce: uGIFPX +.. section: Core and Builtins + +Ensure that free()d memory arenas are really released on POSIX systems +supporting anonymous memory mappings. Patch by Charles-Fran?ois Natali. + +.. + +.. bpo: 17825 +.. date: 9322 +.. nonce: toRoZf +.. section: Core and Builtins + +Cursor "^" is correctly positioned for SyntaxError and IndentationError. + +.. + +.. bpo: 0 +.. date: 9321 +.. nonce: nfw3S8 +.. section: Core and Builtins + +Raise a better error when non-unicode codecs are used for a file's coding +cookie. + +.. + +.. bpo: 17976 +.. date: 9320 +.. nonce: w402Bf +.. section: Core and Builtins + +Fixed potential problem with file.write() not detecting IO error by +inspecting the return value of fwrite(). Based on patches by Jaakko Moisio +and Victor Stinner. + +.. + +.. bpo: 14432 +.. date: 9319 +.. nonce: kZ1mYr +.. section: Core and Builtins + +Generator now clears the borrowed reference to the thread state. Fix a crash +when a generator is created in a C thread that is destroyed while the +generator is still used. The issue was that a generator contains a frame, +and the frame kept a reference to the Python state of the destroyed C +thread. The crash occurs when a trace function is setup. + +.. + +.. bpo: 19932 +.. date: 9318 +.. nonce: ZU_tXW +.. section: Core and Builtins + +Fix typo in import.h, missing whitespaces in function prototypes. + +.. + +.. bpo: 19638 +.. date: 9317 +.. nonce: lh5Awt +.. section: Core and Builtins + +Fix possible crash / undefined behaviour from huge (more than 2 billion +characters) input strings in _Py_dg_strtod. + +.. + +.. bpo: 12546 +.. date: 9316 +.. nonce: kDqF_s +.. section: Core and Builtins + +Allow \x00 to be used as a fill character when using str, int, float, and +complex __format__ methods. + +.. + +.. bpo: 10744 +.. date: 9315 +.. nonce: kfV0wm +.. section: Library + +Fix PEP 3118 format strings on ctypes objects with a nontrivial shape. + +.. + +.. bpo: 7776 +.. date: 9314 +.. nonce: DFUgrv +.. section: Library + +Backport Fix ``Host:'' header and reconnection when using +http.client.HTTPConnection.set_tunnel() from Python 3. Patch by Nikolaus +Rath. + +.. + +.. bpo: 21306 +.. date: 9313 +.. nonce: 8ABvGX +.. section: Library + +Backport hmac.compare_digest from Python 3. This is part of PEP 466. + +.. + +.. bpo: 21470 +.. date: 9312 +.. nonce: uH-yCD +.. section: Library + +Do a better job seeding the random number generator by using enough bytes to +span the full state space of the Mersenne Twister. + +.. + +.. bpo: 21469 +.. date: 9311 +.. nonce: _fFGuq +.. section: Library + +Reduced the risk of false positives in robotparser by checking to make sure +that robots.txt has been read or does not exist prior to returning True in +can_fetch(). + +.. + +.. bpo: 21321 +.. date: 9310 +.. nonce: wUkTON +.. section: Library + +itertools.islice() now releases the reference to the source iterator when +the slice is exhausted. Patch by Anton Afanasyev. + +.. + +.. bpo: 9291 +.. date: 9309 +.. nonce: QlHuPo +.. section: Library + +Do not attempt to re-encode mimetype data read from registry in ANSI mode. +Initial patches by Dmitry Jemerov & Vladimir Iofik. + +.. + +.. bpo: 21349 +.. date: 9308 +.. nonce: G6dnGO +.. section: Library + +Passing a memoryview to _winreg.SetValueEx now correctly raises a TypeError +where it previously crashed the interpreter. Patch by Brian Kearns + +.. + +.. bpo: 21529 +.. date: 9307 +.. nonce: 57R_Fc +.. section: Library + +Fix arbitrary memory access in JSONDecoder.raw_decode with a negative second +parameter. Bug reported by Guido Vranken. (See also: CVE-2014-4616) + +.. + +.. bpo: 21172 +.. date: 9306 +.. nonce: dQ7yY7 +.. section: Library + +isinstance check relaxed from dict to collections.Mapping. + +.. + +.. bpo: 21191 +.. date: 9305 +.. nonce: T8gLBH +.. section: Library + +In os.fdopen, never close the file descriptor when an exception happens. + +.. + +.. bpo: 21149 +.. date: 9304 +.. nonce: cnjwMR +.. section: Library + +Improved thread-safety in logging cleanup during interpreter shutdown. +Thanks to Devin Jeanpierre for the patch. + +.. + +.. bpo: 0 +.. date: 9303 +.. nonce: WKcVnZ +.. section: Library + +Fix possible overflow bug in strop.expandtabs. You shouldn't be using this +module! + +.. + +.. bpo: 20145 +.. date: 9302 +.. nonce: JeZoJn +.. section: Library + +`assertRaisesRegex` now raises a TypeError if the second argument is not a +string or compiled regex. + +.. + +.. bpo: 21058 +.. date: 9301 +.. nonce: SqznP1 +.. section: Library + +Fix a leak of file descriptor in tempfile.NamedTemporaryFile(), close the +file descriptor if os.fdopen() fails + +.. + +.. bpo: 20283 +.. date: 9300 +.. nonce: v0Vs9V +.. section: Library + +RE pattern methods now accept the string keyword parameters as documented. +The pattern and source keyword parameters are left as deprecated aliases. + +.. + +.. bpo: 11599 +.. date: 9299 +.. nonce: 9QOXf4 +.. section: Library + +When an external command (e.g. compiler) fails, distutils now prints out the +whole command line (instead of just the command name) if the environment +variable DISTUTILS_DEBUG is set. + +.. + +.. bpo: 4931 +.. date: 9298 +.. nonce: uF10hr +.. section: Library + +distutils should not produce unhelpful "error: None" messages anymore. +distutils.util.grok_environment_error is kept but doc-deprecated. + +.. + +.. bpo: 0 +.. date: 9297 +.. nonce: mdcWGA +.. section: Library + +Improve the random module's default seeding to use 256 bits of entropy from +os.urandom(). This was already done for Python 3, mildly improving security +with a bigger seed space. + +.. + +.. bpo: 15618 +.. date: 9296 +.. nonce: r5_ACR +.. section: Library + +Make turtle.py compatible with 'from __future__ import unicode_literals'. +Initial patch by Juancarlo A?ez. + +.. + +.. bpo: 20501 +.. date: 9295 +.. nonce: Jwfgph +.. section: Library + +fileinput module no longer reads whole file into memory when using +fileinput.hook_encoded. + +.. + +.. bpo: 6815 +.. date: 9294 +.. nonce: poU-vm +.. section: Library + +os.path.expandvars() now supports non-ASCII Unicode environment variables +names and values. + +.. + +.. bpo: 20635 +.. date: 9293 +.. nonce: ZKwOpn +.. section: Library + +Fixed grid_columnconfigure() and grid_rowconfigure() methods of Tkinter +widgets to work in wantobjects=True mode. + +.. + +.. bpo: 17671 +.. date: 9292 +.. nonce: 8tHRKJ +.. section: Library + +Fixed a crash when use non-initialized io.BufferedRWPair. Based on patch by +Stephen Tu. + +.. + +.. bpo: 8478 +.. date: 9291 +.. nonce: OS7q1h +.. section: Library + +Untokenizer.compat processes first token from iterator input. Patch based on +lines from Georg Brandl, Eric Snow, and Gareth Rees. + +.. + +.. bpo: 20594 +.. date: 9290 +.. nonce: BVHxPd +.. section: Library + +Avoid name clash with the libc function posix_close. + +.. + +.. bpo: 19856 +.. date: 9289 +.. nonce: jFhYW_ +.. section: Library + +shutil.move() failed to move a directory to other directory on Windows if +source name ends with os.altsep. + +.. + +.. bpo: 14983 +.. date: 9288 +.. nonce: H_gs8w +.. section: Library + +email.generator now always adds a line end after each MIME boundary marker, +instead of doing so only when there is an epilogue. This fixes an RFC +compliance bug and solves an issue with signed MIME parts. + +.. + +.. bpo: 20013 +.. date: 9287 +.. nonce: erNy8V +.. section: Library + +Some imap servers disconnect if the current mailbox is deleted, and imaplib +did not handle that case gracefully. Now it handles the 'bye' correctly. + +.. + +.. bpo: 20426 +.. date: 9286 +.. nonce: f0ozAP +.. section: Library + +When passing the re.DEBUG flag, re.compile() displays the debug output every +time it is called, regardless of the compilation cache. + +.. + +.. bpo: 20368 +.. date: 9285 +.. nonce: BlXEFo +.. section: Library + +The null character now correctly passed from Tcl to Python (in unicode +strings only). Improved error handling in variables-related commands. + +.. + +.. bpo: 20435 +.. date: 9284 +.. nonce: _UNhlH +.. section: Library + +Fix _pyio.StringIO.getvalue() to take into account newline translation +settings. + +.. + +.. bpo: 20288 +.. date: 9283 +.. nonce: 6zUZe3 +.. section: Library + +fix handling of invalid numeric charrefs in HTMLParser. + +.. + +.. bpo: 19456 +.. date: 9282 +.. nonce: 6HhsFx +.. section: Library + +ntpath.join() now joins relative paths correctly when a drive is present. + +.. + +.. bpo: 8260 +.. date: 9281 +.. nonce: nf7gg9 +.. section: Library + +The read(), readline() and readlines() methods of codecs.StreamReader +returned incomplete data when were called after readline() or read(size). +Based on patch by Amaury Forgeot d'Arc. + +.. + +.. bpo: 20374 +.. date: 9280 +.. nonce: EWofHb +.. section: Library + +Fix build with GNU readline >= 6.3. + +.. + +.. bpo: 14548 +.. date: 9279 +.. nonce: ClAkmE +.. section: Library + +Make multiprocessing finalizers check pid before running to cope with +possibility of gc running just after fork. (Backport from 3.x.) + +.. + +.. bpo: 20262 +.. date: 9278 +.. nonce: co0t1R +.. section: Library + +Warnings are raised now when duplicate names are added in the ZIP file or +too long ZIP file comment is truncated. + +.. + +.. bpo: 20270 +.. date: 9277 +.. nonce: hDccjr +.. section: Library + +urllib and urlparse now support empty ports. + +.. + +.. bpo: 20243 +.. date: 9276 +.. nonce: nApKCK +.. section: Library + +TarFile no longer raise ReadError when opened in write mode. + +.. + +.. bpo: 20245 +.. date: 9275 +.. nonce: 93kf_h +.. section: Library + +The open functions in the tarfile module now correctly handle empty mode. + +.. + +.. bpo: 20086 +.. date: 9274 +.. nonce: RV3SGi +.. section: Library + +Restored the use of locale-independent mapping instead of locale-dependent +str.lower() in locale.normalize(). + +.. + +.. bpo: 20246 +.. date: 9273 +.. nonce: CC8uTq +.. section: Library + +Fix buffer overflow in socket.recvfrom_into. + +.. + +.. bpo: 19082 +.. date: 9272 +.. nonce: Qv6W7t +.. section: Library + +Working SimpleXMLRPCServer and xmlrpclib examples, both in modules and +documentation. + +.. + +.. bpo: 13107 +.. date: 9271 +.. nonce: YgEEME +.. section: Library + +argparse and optparse no longer raises an exception when output a help on +environment with too small COLUMNS. Based on patch by Elazar Gershuni. + +.. + +.. bpo: 20207 +.. date: 9270 +.. nonce: ziIyF1 +.. section: Library + +Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly asked for. + +.. + +.. bpo: 20072 +.. date: 9269 +.. nonce: FzVG15 +.. section: Library + +Fixed multiple errors in tkinter with wantobjects is False. + +.. + +.. bpo: 1065986 +.. date: 9268 +.. nonce: pSaw56 +.. section: Library + +pydoc can now handle unicode strings. + +.. + +.. bpo: 16039 +.. date: 9267 +.. nonce: Cy3_BL +.. section: Library + +CVE-2013-1752: Change use of readline in imaplib module to limit line +length. Patch by Emil Lind. + +.. + +.. bpo: 19422 +.. date: 9266 +.. nonce: 1dRaPS +.. section: Library + +Explicitly disallow non-SOCK_STREAM sockets in the ssl module, rather than +silently let them emit clear text data. + +.. + +.. bpo: 20027 +.. date: 9265 +.. nonce: dtB7OG +.. section: Library + +Fixed locale aliases for devanagari locales. + +.. + +.. bpo: 20067 +.. date: 9264 +.. nonce: MlnlYd +.. section: Library + +Tkinter variables now work when wantobjects is false. + +.. + +.. bpo: 19020 +.. date: 9263 +.. nonce: _16K__ +.. section: Library + +Tkinter now uses splitlist() instead of split() in configure methods. + +.. + +.. bpo: 12226 +.. date: 9262 +.. nonce: -vXCBM +.. section: Library + +HTTPS is now used by default when connecting to PyPI. + +.. + +.. bpo: 20048 +.. date: 9261 +.. nonce: YvvUoW +.. section: Library + +Fixed ZipExtFile.peek() when it is called on the boundary of the uncompress +buffer and read() goes through more than one readbuffer. + +.. + +.. bpo: 20034 +.. date: 9260 +.. nonce: GlYpNX +.. section: Library + +Updated alias mapping to most recent locale.alias file from X.org +distribution using makelocalealias.py. + +.. + +.. bpo: 5815 +.. date: 9259 +.. nonce: FxSb0P +.. section: Library + +Fixed support for locales with modifiers. Fixed support for locale +encodings with hyphens. + +.. + +.. bpo: 20026 +.. date: 9258 +.. nonce: KO1jB6 +.. section: Library + +Fix the sqlite module to handle correctly invalid isolation level (wrong +type). + +.. + +.. bpo: 18829 +.. date: 9257 +.. nonce: QPwJFn +.. section: Library + +csv.Dialect() now checks type for delimiter, escapechar and quotechar +fields. Original patch by Vajrasky Kok. + +.. + +.. bpo: 19855 +.. date: 9256 +.. nonce: TtBUO6 +.. section: Library + +uuid.getnode() on Unix now looks on the PATH for the executables used to +find the mac address, with /sbin and /usr/sbin as fallbacks. + +.. + +.. bpo: 20007 +.. date: 9255 +.. nonce: IaSnPo +.. section: Library + +HTTPResponse.read(0) no more prematurely closes connection. Original patch +by Simon Sapin. + +.. + +.. bpo: 19912 +.. date: 9254 +.. nonce: TviIPi +.. section: Library + +Fixed numerous bugs in ntpath.splitunc(). + +.. + +.. bpo: 19623 +.. date: 9253 +.. nonce: cPL8XH +.. section: Library + +Fixed writing to unseekable files in the aifc module. Fixed writing 'ulaw' +(lower case) compressed AIFC files. + +.. + +.. bpo: 17919 +.. date: 9252 +.. nonce: H5iGXv +.. section: Library + +select.poll.register() again works with poll.POLLNVAL on AIX. Fixed integer +overflow in the eventmask parameter. + +.. + +.. bpo: 17200 +.. date: 9251 +.. nonce: y1euZh +.. section: Library + +telnetlib's read_until and expect timeout was broken by the fix to Issue +#14635 in Python 2.7.4 to be interpreted as milliseconds instead of seconds +when the platform supports select.poll (ie: everywhere). It is now treated +as seconds once again. + +.. + +.. bpo: 19099 +.. date: 9250 +.. nonce: U4CHJk +.. section: Library + +The struct module now supports Unicode format strings. + +.. + +.. bpo: 19878 +.. date: 9249 +.. nonce: 7oVPCy +.. section: Library + +Fix segfault in bz2 module after calling __init__ twice with non-existent +filename. Initial patch by Vajrasky Kok. + +.. + +.. bpo: 16373 +.. date: 9248 +.. nonce: 9drXFZ +.. section: Library + +Prevent infinite recursion for ABC Set class comparisons. + +.. + +.. bpo: 19138 +.. date: 9247 +.. nonce: xwKrX_ +.. section: Library + +doctest's IGNORE_EXCEPTION_DETAIL now allows a match when no exception +detail exists (no colon following the exception's name, or a colon does +follow but no text follows the colon). + +.. + +.. bpo: 16231 +.. date: 9246 +.. nonce: BospTf +.. section: Library + +Fixed pickle.Pickler to only fallback to its default pickling behaviour when +Pickler.persistent_id returns None, but not for any other false values. +This allows false values other than None to be used as persistent IDs. This +behaviour is consistent with cPickle. + +.. + +.. bpo: 11508 +.. date: 9245 +.. nonce: fx7Abs +.. section: Library + +Fixed uuid.getnode() and uuid.uuid1() on environment with virtual interface. +Original patch by Kent Frazier. + +.. + +.. bpo: 11489 +.. date: 9244 +.. nonce: 3ZQHi8 +.. section: Library + +JSON decoder now accepts lone surrogates. + +.. + +.. bpo: 0 +.. date: 9243 +.. nonce: mrzJif +.. section: Library + +Fix test.test_support.bind_port() to not cause an error when Python was +compiled on a system with SO_REUSEPORT defined in the headers but run on a +system with an OS kernel that does not support that new socket option. + +.. + +.. bpo: 19633 +.. date: 9242 +.. nonce: XJNQit +.. section: Library + +Fixed writing not compressed 16- and 32-bit wave files on big-endian +platforms. + +.. + +.. bpo: 19449 +.. date: 9241 +.. nonce: F2TbC_ +.. section: Library + +in csv's writerow, handle non-string keys when generating the error message +that certain keys are not in the 'fieldnames' list. + +.. + +.. bpo: 12853 +.. date: 9240 +.. nonce: Hf7EYH +.. section: Library + +Fix NameError in distutils.command.upload. + +.. + +.. bpo: 19523 +.. date: 9239 +.. nonce: tNiY9i +.. section: Library + +Closed FileHandler leak which occurred when delay was set. + +.. + +.. bpo: 1575020 +.. date: 9238 +.. nonce: skWyvl +.. section: Library + +Fixed support of 24-bit wave files on big-endian platforms. + +.. + +.. bpo: 19480 +.. date: 9237 +.. nonce: MY3dmW +.. section: Library + +HTMLParser now accepts all valid start-tag names as defined by the HTML5 +standard. + +.. + +.. bpo: 17827 +.. date: 9236 +.. nonce: HJGFDL +.. section: Library + +Add the missing documentation for ``codecs.encode`` and ``codecs.decode``. + +.. + +.. bpo: 6157 +.. date: 9235 +.. nonce: ZW67ae +.. section: Library + +Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo. + +.. + +.. bpo: 6160 +.. date: 9234 +.. nonce: Mr5UuA +.. section: Library + +The bbox() method of tkinter.Spinbox now returns a tuple of integers instead +of a string. Based on patch by Guilherme Polo. + +.. + +.. bpo: 19286 +.. date: 9233 +.. nonce: TUZetF +.. section: Library + +Directories in ``package_data`` are no longer added to the filelist, +preventing failure outlined in the ticket. + +.. + +.. bpo: 6676 +.. date: 9232 +.. nonce: CJu5On +.. section: Library + +Ensure a meaningful exception is raised when attempting to parse more than +one XML document per pyexpat xmlparser instance. (Original patches by +Hirokazu Yamamoto and Amaury Forgeot d'Arc, with suggested wording by David +Gutteridge) + +.. + +.. bpo: 21311 +.. date: 9231 +.. nonce: JsDF8H +.. section: Library + +Avoid exception in _osx_support with non-standard compiler configurations. +Patch by John Szakmeister. + +.. + +.. bpo: 3561 +.. date: 9230 +.. nonce: DuNr6C +.. section: Tools/Demos + +The Windows installer now has an option, off by default, for placing the +Python installation into the system "Path" environment variable. This was +backported from Python 3.3. + +.. + +.. bpo: 0 +.. date: 9229 +.. nonce: _-ge-g +.. section: Tools/Demos + +Add support for ``yield from`` to 2to3. + +.. + +.. bpo: 0 +.. date: 9228 +.. nonce: dpFbyZ +.. section: Tools/Demos + +Add support for the PEP 465 matrix multiplication operator to 2to3. + +.. + +.. bpo: 19936 +.. date: 9227 +.. nonce: moet1K +.. section: Tools/Demos + +Added executable bits or shebang lines to Python scripts which requires +them. Disable executable bits and shebang lines in test and benchmark files +in order to prevent using a random system python, and in source files of +modules which don't provide command line interface. + +.. + +.. bpo: 18104 +.. date: 9226 +.. nonce: 8Fj9Pf +.. section: IDLE + +Add idlelib/idle_test/htest.py with a few sample tests to begin +consolidating and improving human-validated tests of Idle. Change other +files as needed to work with htest. Running the module as __main__ runs all +tests. + +.. + +.. bpo: 21139 +.. date: 9225 +.. nonce: kqetng +.. section: IDLE + +Change default paragraph width to 72, the PEP 8 recommendation. + +.. + +.. bpo: 21284 +.. date: 9224 +.. nonce: KKJfmv +.. section: IDLE + +Paragraph reformat test passes after user changes reformat width. + +.. + +.. bpo: 20406 +.. date: 9223 +.. nonce: AgBe_5 +.. section: IDLE + +Use Python application icons for Idle window title bars. Patch mostly by +Serhiy Storchaka. + +.. + +.. bpo: 21029 +.. date: 9222 +.. nonce: JnlAAt +.. section: IDLE + +Occurrences of "print" are now consistently colored as being a keyword (the +colorizer doesn't know if print functions are enabled in the source). + +.. + +.. bpo: 17721 +.. date: 9221 +.. nonce: 8Jh8C1 +.. section: IDLE + +Remove non-functional configuration dialog help button until we make it +actually gives some help when clicked. Patch by Guilherme Sim?es. + +.. + +.. bpo: 17390 +.. date: 9220 +.. nonce: 9m6ZhV +.. section: IDLE + +Add Python version to Idle editor window title bar. Original patches by +Edmond Burnett and Kent Johnson. + +.. + +.. bpo: 20058 +.. date: 9219 +.. nonce: KnDlhH +.. section: IDLE + +sys.stdin.readline() in IDLE now always returns only one line. + +.. + +.. bpo: 19481 +.. date: 9218 +.. nonce: b5EHmn +.. section: IDLE + +print() of unicode, str or bytearray subclass instance in IDLE no more +hangs. + +.. + +.. bpo: 18270 +.. date: 9217 +.. nonce: lu6dRW +.. section: IDLE + +Prevent possible IDLE AttributeError on OS X when no initial shell window is +present. + +.. + +.. bpo: 17654 +.. date: 9216 +.. nonce: NbzhNS +.. section: IDLE + +Ensure IDLE menus are customized properly on OS X for non-framework builds +and for all variants of Tk. + +.. + +.. bpo: 17752 +.. date: 9215 +.. nonce: P8iG44 +.. section: Tests + +Fix distutils tests when run from the installed location. + +.. + +.. bpo: 18604 +.. date: 9214 +.. nonce: Q00Xrj +.. section: Tests + +Consolidated checks for GUI availability. All platforms now at least check +whether Tk can be instantiated when the GUI resource is requested. + +.. + +.. bpo: 20946 +.. date: 9213 +.. nonce: iI4MlK +.. section: Tests + +Correct alignment assumptions of some ctypes tests. + +.. + +.. bpo: 20743 +.. date: 9212 +.. nonce: hxZQUf +.. section: Tests + +Fix a reference leak in test_tcl. + +.. + +.. bpo: 20510 +.. date: 9211 +.. nonce: X9p_K2 +.. section: Tests + +Rewrote test_exit in test_sys to match existing comments, use modern +unittest features, and use helpers from test.script_helper instead of using +subprocess directly. Initial patch by Gareth Rees. + +.. + +.. bpo: 20532 +.. date: 9210 +.. nonce: qsOt4d +.. section: Tests + +Tests which use _testcapi now are marked as CPython only. + +.. + +.. bpo: 19920 +.. date: 9209 +.. nonce: suOIC7 +.. section: Tests + +Added tests for TarFile.list(). Based on patch by Vajrasky Kok. + +.. + +.. bpo: 19990 +.. date: 9208 +.. nonce: Lp1MVj +.. section: Tests + +Added tests for the imghdr module. Based on patch by Claudiu Popa. + +.. + +.. bpo: 19804 +.. date: 9207 +.. nonce: xIHIl7 +.. section: Tests + +The test_find_mac test in test_uuid is now skipped if the ifconfig +executable is not available. + +.. + +.. bpo: 19886 +.. date: 9206 +.. nonce: nqDFRC +.. section: Tests + +Use better estimated memory requirements for bigmem tests. + +.. + +.. bpo: 0 +.. date: 9205 +.. nonce: 6LQ8qX +.. section: Tests + +Backported tests for Tkinter variables. + +.. + +.. bpo: 19320 +.. date: 9204 +.. nonce: 9x_cw5 +.. section: Tests + +test_tcl no longer fails when wantobjects is false. + +.. + +.. bpo: 19683 +.. date: 9203 +.. nonce: iD76Cq +.. section: Tests + +Removed empty tests from test_minidom. Initial patch by Ajitesh Gupta. + +.. + +.. bpo: 19928 +.. date: 9202 +.. nonce: dwOQ95 +.. section: Tests + +Implemented a test for repr() of cell objects. + +.. + +.. bpo: 19595 +.. date: 9201 +.. nonce: q5oNE_ +.. section: Tests + +Re-enabled a long-disabled test in test_winsound. (See also: bpo-19987) + +.. + +.. bpo: 19588 +.. date: 9200 +.. nonce: EXKxpC +.. section: Tests + +Fixed tests in test_random that were silently skipped most of the time. +Patch by Julian Gindi. + +.. + +.. bpo: 17883 +.. date: 9199 +.. nonce: rQfRpP +.. section: Tests + +Tweak test_tcl testLoadWithUNC to skip the test in the event of a permission +error on Windows and to properly report other skip conditions. + +.. + +.. bpo: 17883 +.. date: 9198 +.. nonce: 12qN1i +.. section: Tests + +Backported _is_gui_available() in test.test_support to avoid hanging Windows +buildbots on test_ttk_guionly. + +.. + +.. bpo: 18702 +.. date: 9197 +.. nonce: a2jP-V +.. section: Tests + +All skipped tests now reported as skipped. (See also: bpo-19572) + +.. + +.. bpo: 19085 +.. date: 9196 +.. nonce: Gcl9XX +.. section: Tests + +Added basic tests for all tkinter widget options. + +.. + +.. bpo: 20605 +.. date: 9195 +.. nonce: uef5pT +.. section: Tests + +Make test_socket getaddrinfo OS X segfault test more robust. + +.. + +.. bpo: 20939 +.. date: 9194 +.. nonce: x3KQ35 +.. section: Tests + +Avoid various network test failures due to new redirect of +http://www.python.org/ to https://www.python.org: use http://www.example.com +instead. + +.. + +.. bpo: 21093 +.. date: 9193 +.. nonce: CcpRim +.. section: Tests + +Prevent failures of ctypes test_macholib on OS X if a copy of libz exists in +$HOME/lib or /usr/local/lib. + +.. + +.. bpo: 21285 +.. date: 9192 +.. nonce: cU9p2E +.. section: Build + +Refactor and fix curses configure check to always search in a ncursesw +directory. + +.. + +.. bpo: 20255 +.. date: 9191 +.. nonce: P9HfTR +.. section: Documentation + +Update the about and bugs pages. + +.. + +.. bpo: 18840 +.. date: 9190 +.. nonce: _2UItV +.. section: Documentation + +Introduce the json module in the tutorial, and de-emphasize the pickle +module. + +.. + +.. bpo: 19795 +.. date: 9189 +.. nonce: z5sbe1 +.. section: Documentation + +Improved markup of True/False constants. + +.. + +.. bpo: 21303 +.. date: 9188 +.. nonce: AHY5As +.. section: Windows + +Updated the version of Tcl/Tk included in the installer from 8.5.2 to +8.5.15. (See also: bpo-20565) + +.. + +.. bpo: 0 +.. date: 9187 +.. nonce: FhpkVS +.. section: macOS + +As of 2.7.8, the 32-bit-only installer will support OS X 10.5 and later +systems as is currently done for Python 3.x installers. For 2.7.7 only, we +will provide three installers: the legacy deprecated 10.3+ 32-bit-only +format; the newer 10.5+ 32-bit-only format; and the unchanged 10.6+ +64-/32-bit format. Although binary installers will no longer be available +from python.org as of 2.7.8, it will still be possible to build from source +on 10.3.9 and 10.4 systems if necessary. See Mac/BuildScript/README.txt for +more information. diff --git a/Misc/NEWS.d/2.7.8.rst b/Misc/NEWS.d/2.7.8.rst new file mode 100644 index 00000000000..bd4462c1bd2 --- /dev/null +++ b/Misc/NEWS.d/2.7.8.rst @@ -0,0 +1,433 @@ +.. bpo: 4346 +.. date: 9373 +.. nonce: UASH7u +.. release date: 2014-06-29 +.. section: Core and Builtins + +In PyObject_CallMethod and PyObject_CallMethodObjArgs, don't overwrite the +error set in PyObject_GetAttr. + +.. + +.. bpo: 21831 +.. date: 9372 +.. nonce: LMoAu3 +.. section: Core and Builtins + +Avoid integer overflow when large sizes and offsets are given to the buffer +type. CVE-2014-7185. + +.. + +.. bpo: 19656 +.. date: 9371 +.. nonce: H_jvEi +.. section: Core and Builtins + +Running Python with the -3 option now also warns about non-ascii bytes +literals. + +.. + +.. bpo: 21642 +.. date: 9370 +.. nonce: CjIqaU +.. section: Core and Builtins + +If the conditional if-else expression, allow an integer written with no +space between itself and the ``else`` keyword (e.g. ``True if 42else +False``) to be valid syntax. + +.. + +.. bpo: 21523 +.. date: 9369 +.. nonce: f_PPYO +.. section: Core and Builtins + +Fix over-pessimistic computation of the stack effect of some opcodes in the +compiler. This also fixes a quadratic compilation time issue noticeable +when compiling code with a large number of "and" and "or" operators. + +.. + +.. bpo: 21652 +.. date: 9368 +.. nonce: kCNkbE +.. section: Library + +Prevent mimetypes.type_map from containing unicode keys on Windows. + +.. + +.. bpo: 21729 +.. date: 9367 +.. nonce: oa2kD6 +.. section: Library + +Used the "with" statement in the dbm.dumb module to ensure files closing. + +.. + +.. bpo: 21672 +.. date: 9366 +.. nonce: iMRNWM +.. section: Library + +Fix the behavior of ntpath.join on UNC-style paths. + +.. + +.. bpo: 19145 +.. date: 9365 +.. nonce: cRrKpW +.. section: Library + +The times argument for itertools.repeat now handles negative values the same +way for keyword arguments as it does for positional arguments. + +.. + +.. bpo: 21832 +.. date: 9364 +.. nonce: PBA0Uu +.. section: Library + +Require named tuple inputs to be exact strings. + +.. + +.. bpo: 8343 +.. date: 9363 +.. nonce: 2KNnCH +.. section: Library + +Named group error messages in the re module did not show the name of the +erroneous group. + +.. + +.. bpo: 21491 +.. date: 9362 +.. nonce: suNKZf +.. section: Library + +SocketServer: Fix a race condition in child processes reaping. + +.. + +.. bpo: 21635 +.. date: 9361 +.. nonce: ET3OJZ +.. section: Library + +The difflib SequenceMatcher.get_matching_blocks() method cache didn't match +the actual result. The former was a list of tuples and the latter was a +list of named tuples. + +.. + +.. bpo: 21722 +.. date: 9360 +.. nonce: WTHuRy +.. section: Library + +The distutils "upload" command now exits with a non-zero return code when +uploading fails. Patch by Martin Dengler. + +.. + +.. bpo: 21766 +.. date: 9359 +.. nonce: 0xk_xC +.. section: Library + +Prevent a security hole in CGIHTTPServer by URL unquoting paths before +checking for a CGI script at that path. + +.. + +.. bpo: 21310 +.. date: 9358 +.. nonce: 2mjByJ +.. section: Library + +Fixed possible resource leak in failed open(). + +.. + +.. bpo: 21304 +.. date: 9357 +.. nonce: xXyySz +.. section: Library + +Backport the key derivation function hashlib.pbkdf2_hmac from Python 3 per +PEP 466. + +.. + +.. bpo: 11709 +.. date: 9356 +.. nonce: JdObvL +.. section: Library + +Fix the pydoc.help function to not fail when sys.stdin is not a valid file. + +.. + +.. bpo: 13223 +.. date: 9355 +.. nonce: 9AzEbN +.. section: Library + +Fix pydoc.writedoc so that the HTML documentation for methods that use +'self' in the example code is generated correctly. + +.. + +.. bpo: 21552 +.. date: 9354 +.. nonce: uVy4tM +.. section: Library + +Fixed possible integer overflow of too long string lengths in the tkinter +module on 64-bit platforms. + +.. + +.. bpo: 14315 +.. date: 9353 +.. nonce: YzZzS8 +.. section: Library + +The zipfile module now ignores extra fields in the central directory that +are too short to be parsed instead of letting a struct.unpack error bubble +up as this "bad data" appears in many real world zip files in the wild and +is ignored by other zip tools. + +.. + +.. bpo: 21402 +.. date: 9352 +.. nonce: GuVy1L +.. section: Library + +Tkinter.ttk now works when default root window is not set. + +.. + +.. bpo: 10203 +.. date: 9351 +.. nonce: gERvVk +.. section: Library + +sqlite3.Row now truly supports sequence protocol. In particulr it supports +reverse() and negative indices. Original patch by Claudiu Popa. + +.. + +.. bpo: 8743 +.. date: 9350 +.. nonce: I6_2r3 +.. section: Library + +Fix interoperability between set objects and the collections.Set() abstract +base class. + +.. + +.. bpo: 21481 +.. date: 9349 +.. nonce: YDrlf7 +.. section: Library + +Argparse equality and inequality tests now return NotImplemented when +comparing to an unknown type. + +.. + +.. bpo: 21940 +.. date: 9348 +.. nonce: VlIRz7 +.. section: IDLE + +Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar. + +.. + +.. bpo: 18592 +.. date: 9347 +.. nonce: sMG-SZ +.. section: IDLE + +Add unittest for SearchDialogBase. Patch by Phil Webster. + +.. + +.. bpo: 21694 +.. date: 9346 +.. nonce: 1oLmRo +.. section: IDLE + +Add unittest for ParenMatch. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 21686 +.. date: 9345 +.. nonce: TAkFB0 +.. section: IDLE + +add unittest for HyperParser. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 12387 +.. date: 9344 +.. nonce: XO7Ozk +.. section: IDLE + +Add missing upper(lower)case versions of default Windows key bindings for +Idle so Caps Lock does not disable them. Patch by Roger Serwy. + +.. + +.. bpo: 21695 +.. date: 9343 +.. nonce: g-t0Tm +.. section: IDLE + +Closing a Find-in-files output window while the search is still in progress +no longer closes Idle. + +.. + +.. bpo: 18910 +.. date: 9342 +.. nonce: ke8lMK +.. section: IDLE + +Add unittest for textView. Patch by Phil Webster. + +.. + +.. bpo: 18292 +.. date: 9341 +.. nonce: ks_3wm +.. section: IDLE + +Add unittest for AutoExpand. Patch by Saihadhav Heblikar. + +.. + +.. bpo: 18409 +.. date: 9340 +.. nonce: 7fe-aK +.. section: IDLE + +Add unittest for AutoComplete. Patch by Phil Webster. + +.. + +.. bpo: 20155 +.. date: 9339 +.. nonce: nphzS3 +.. section: Tests + +Changed HTTP method names in failing tests in test_httpservers so that +packet filtering software (specifically Windows Base Filtering Engine) does +not interfere with the transaction semantics expected by the tests. + +.. + +.. bpo: 19493 +.. date: 9338 +.. nonce: SwbzLQ +.. section: Tests + +Refactored the ctypes test package to skip tests explicitly rather than +silently. + +.. + +.. bpo: 18492 +.. date: 9337 +.. nonce: ylPRU7 +.. section: Tests + +All resources are now allowed when tests are not run by regrtest.py. + +.. + +.. bpo: 21605 +.. date: 9336 +.. nonce: qsLV8d +.. section: Tests + +Added tests for Tkinter images. + +.. + +.. bpo: 21493 +.. date: 9335 +.. nonce: NqhRsy +.. section: Tests + +Added test for ntpath.expanduser(). Original patch by Claudiu Popa. + +.. + +.. bpo: 19925 +.. date: 9334 +.. nonce: dhMx08 +.. section: Tests + +Added tests for the spwd module. Original patch by Vajrasky Kok. + +.. + +.. bpo: 13355 +.. date: 9333 +.. nonce: gCByXK +.. section: Tests + +random.triangular() no longer fails with a ZeroDivisionError when low equals +high. + +.. + +.. bpo: 21522 +.. date: 9332 +.. nonce: b-VwFW +.. section: Tests + +Added Tkinter tests for Listbox.itemconfigure(), +PanedWindow.paneconfigure(), and Menu.entryconfigure(). + +.. + +.. bpo: 20635 +.. date: 9331 +.. nonce: mzWmoS +.. section: Tests + +Added tests for Tk geometry managers. + +.. + +.. bpo: 21811 +.. date: 9330 +.. nonce: 3_Xyr- +.. section: Build + +Anticipated fixes to support OS X versions > 10.9. + +.. + +.. bpo: 21671 +.. date: 9329 +.. nonce: sm-hhO +.. section: Windows + +The bundled version of OpenSSL has been updated to 1.0.1h. (See also: +CVE-2014-0224) diff --git a/Misc/NEWS.d/2.7.9.rst b/Misc/NEWS.d/2.7.9.rst new file mode 100644 index 00000000000..15cbfe98cb0 --- /dev/null +++ b/Misc/NEWS.d/2.7.9.rst @@ -0,0 +1,65 @@ +.. bpo: 22959 +.. date: 9494 +.. nonce: FioVGu +.. release date: 2014-12-10 +.. section: Library + +Remove the *check_hostname* parameter of httplib.HTTPSConnection. The +*context* parameter should be used instead. + +.. + +.. bpo: 16043 +.. date: 9493 +.. nonce: TGIC7t +.. section: Library + +Add a default limit for the amount of data xmlrpclib.gzip_decode will +return. This resolves CVE-2013-1753. + +.. + +.. bpo: 16042 +.. date: 9492 +.. nonce: 7I3FPy +.. section: Library + +CVE-2013-1752: smtplib: Limit amount of data read by limiting the call to +readline(). Original patch by Christian Heimes. + +.. + +.. bpo: 16041 +.. date: 9491 +.. nonce: TyhfVi +.. section: Library + +In poplib, limit maximum line length read from the server to prevent +CVE-2013-1752. + +.. + +.. bpo: 22960 +.. date: 9490 +.. nonce: J-KiZ3 +.. section: Library + +Add a context argument to xmlrpclib.ServerProxy. + +.. + +.. bpo: 22935 +.. date: 9489 +.. nonce: -vY3lc +.. section: Build + +Allow the ssl module to be compiled if openssl doesn't support SSL 3. + +.. + +.. bpo: 17128 +.. date: 9488 +.. nonce: JMdOBP +.. section: Build + +Use private version of OpenSSL for 2.7.9 OS X 10.5+ installer. diff --git a/Misc/NEWS.d/2.7.9rc1.rst b/Misc/NEWS.d/2.7.9rc1.rst new file mode 100644 index 00000000000..45782bd9e57 --- /dev/null +++ b/Misc/NEWS.d/2.7.9rc1.rst @@ -0,0 +1,1124 @@ +.. bpo: 21963 +.. date: 9487 +.. nonce: eUwKx1 +.. release date: 2014-11-25 +.. section: Core and Builtins + +backout issue #1856 patch (avoid crashes and lockups when daemon threads run +while the interpreter is shutting down; instead, these threads are now +killed when they try to take the GIL), as it seems to break some existing +code. + +.. + +.. bpo: 22604 +.. date: 9486 +.. nonce: yii-It +.. section: Core and Builtins + +Fix assertion error in debug mode when dividing a complex number by +(nan+0j). + +.. + +.. bpo: 22470 +.. date: 9485 +.. nonce: Lc7ZPK +.. section: Core and Builtins + +Fixed integer overflow issues in "backslashreplace" and "xmlcharrefreplace" +error handlers. + +.. + +.. bpo: 22526 +.. date: 9484 +.. nonce: Oc9lar +.. section: Core and Builtins + +Fix iterating through files with lines longer than 2^31 bytes. + +.. + +.. bpo: 22519 +.. date: 9483 +.. nonce: zTlQLy +.. section: Core and Builtins + +Fix overflow checking in PyString_Repr. + +.. + +.. bpo: 22518 +.. date: 9482 +.. nonce: C9T6ed +.. section: Core and Builtins + +Fix integer overflow issues in latin-1 encoding. + +.. + +.. bpo: 22379 +.. date: 9481 +.. nonce: 4_3Ge- +.. section: Core and Builtins + +Fix empty exception message in a TypeError raised in ``str.join``. + +.. + +.. bpo: 22221 +.. date: 9480 +.. nonce: t0BE8h +.. section: Core and Builtins + +Now the source encoding declaration on the second line isn't effective if +the first line contains anything except a comment. + +.. + +.. bpo: 22023 +.. date: 9479 +.. nonce: id5Xei +.. section: Core and Builtins + +Fix ``%S``, ``%R`` and ``%V`` formats of :c:func:`PyUnicode_FromFormat`. + +.. + +.. bpo: 21591 +.. date: 9478 +.. nonce: hJVYlf +.. section: Core and Builtins + +Correctly handle qualified exec statements in tuple form by moving +compatibility layer from run-time to AST transformation. + +.. + +.. bpo: 22417 +.. date: 9477 +.. nonce: To4b7U +.. section: Library + +Verify certificates by default in httplib (PEP 476). + +.. + +.. bpo: 22927 +.. date: 9476 +.. nonce: TKaKOP +.. section: Library + +Allow urllib.urlopen to take a *context* parameter to control SSL settings +for HTTPS connections. + +.. + +.. bpo: 22921 +.. date: 9475 +.. nonce: a4wx1C +.. section: Library + +Allow SSLContext to take the *hostname* parameter even if OpenSSL doesn't +support SNI. + +.. + +.. bpo: 9003 +.. date: 9474 +.. nonce: VCncsy +.. section: Library + +httplib.HTTPSConnection, urllib2.HTTPSHandler and urllib2.urlopen now take +optional arguments to allow for server certificate checking, as recommended +in public uses of HTTPS. This backport is part of PEP 467. (See also: +bpo-22366) + +.. + +.. bpo: 12728 +.. date: 9473 +.. nonce: rHZmXO +.. section: Library + +Different Unicode characters having the same uppercase but different +lowercase are now matched in case-insensitive regular expressions. + +.. + +.. bpo: 22821 +.. date: 9472 +.. nonce: 30cQ-U +.. section: Library + +Fixed fcntl() with integer argument on 64-bit big-endian platforms. + +.. + +.. bpo: 17293 +.. date: 9471 +.. nonce: Hk06bO +.. section: Library + +uuid.getnode() now determines MAC address on AIX using netstat. Based on +patch by Aivars Kalv?ns. + +.. + +.. bpo: 22769 +.. date: 9470 +.. nonce: PunnvQ +.. section: Library + +Fixed ttk.Treeview.tag_has() when called without arguments. + +.. + +.. bpo: 22787 +.. date: 9469 +.. nonce: QIzbnh +.. section: Library + +Allow the keyfile argument of SSLContext.load_cert_chain to be None. + +.. + +.. bpo: 22775 +.. date: 9468 +.. nonce: 9X-KKA +.. section: Library + +Fixed unpickling of Cookie.SimpleCookie with protocol 2. Patch by Tim +Graham. + +.. + +.. bpo: 22776 +.. date: 9467 +.. nonce: xNcRse +.. section: Library + +Brought excluded code into the scope of a try block in SysLogHandler.emit(). + +.. + +.. bpo: 17381 +.. date: 9466 +.. nonce: IrcC9I +.. section: Library + +Fixed ranges handling in case-insensitive regular expressions. + +.. + +.. bpo: 19329 +.. date: 9465 +.. nonce: f3o3tr +.. section: Library + +Optimized compiling charsets in regular expressions. + +.. + +.. bpo: 22410 +.. date: 9464 +.. nonce: 99YFdd +.. section: Library + +Module level functions in the re module now cache compiled locale-dependent +regular expressions taking into account the locale. + +.. + +.. bpo: 8876 +.. date: 9463 +.. nonce: A83Av4 +.. section: Library + +distutils now falls back to copying files when hard linking doesn't work. +This allows use with special filesystems such as VirtualBox shared folders. + +.. + +.. bpo: 9351 +.. date: 9462 +.. nonce: u5UI-6 +.. section: Library + +Defaults set with set_defaults on an argparse subparser are no longer +ignored when also set on the parent parser. + +.. + +.. bpo: 20421 +.. date: 9461 +.. nonce: iR0S1s +.. section: Library + +Add a .version() method to SSL sockets exposing the actual protocol version +in use. + +.. + +.. bpo: 22435 +.. date: 9460 +.. nonce: Mrmeio +.. section: Library + +Fix a file descriptor leak when SocketServer bind fails. + +.. + +.. bpo: 13664 +.. date: 9459 +.. nonce: tjVs9o +.. section: Library + +GzipFile now supports non-ascii Unicode filenames. + +.. + +.. bpo: 13096 +.. date: 9458 +.. nonce: rsailB +.. section: Library + +Fixed segfault in CTypes POINTER handling of large values. + +.. + +.. bpo: 11694 +.. date: 9457 +.. nonce: JuDrch +.. section: Library + +Raise ConversionError in xdrlib as documented. Patch by Filip Gruszczy?ski +and Claudiu Popa. + +.. + +.. bpo: 1686 +.. date: 9456 +.. nonce: -w9zEU +.. section: Library + +Fix string.Template when overriding the pattern attribute. + +.. + +.. bpo: 11866 +.. date: 9455 +.. nonce: xrvbIC +.. section: Library + +Eliminated race condition in the computation of names for new threads. + +.. + +.. bpo: 22219 +.. date: 9454 +.. nonce: l9Enh9 +.. section: Library + +The zipfile module CLI now adds entries for directories (including empty +directories) in ZIP file. + +.. + +.. bpo: 22449 +.. date: 9453 +.. nonce: nFW_Fl +.. section: Library + +In the ssl.SSLContext.load_default_certs, consult the environmental +variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. + +.. + +.. bpo: 8473 +.. date: 9452 +.. nonce: QcfDba +.. section: Library + +doctest.testfile now uses universal newline mode to read the test file. + +.. + +.. bpo: 20076 +.. date: 9451 +.. nonce: -7OIVB +.. section: Library + +Added non derived UTF-8 aliases to locale aliases table. + +.. + +.. bpo: 20079 +.. date: 9450 +.. nonce: qM949O +.. section: Library + +Added locales supported in glibc 2.18 to locale alias table. + +.. + +.. bpo: 22530 +.. date: 9449 +.. nonce: 4EcK4x +.. section: Library + +Allow the ``group()`` method of regular expression match objects to take a +``long`` as an index. + +.. + +.. bpo: 22517 +.. date: 9448 +.. nonce: qT6-aB +.. section: Library + +When an io.BufferedRWPair object is deallocated, clear its weakrefs. + +.. + +.. bpo: 10510 +.. date: 9447 +.. nonce: N-ntcD +.. section: Library + +distutils register and upload methods now use HTML standards compliant CRLF +line endings. + +.. + +.. bpo: 9850 +.. date: 9446 +.. nonce: D-UnVi +.. section: Library + +Fixed macpath.join() for empty first component. Patch by Oleg Oshmyan. + +.. + +.. bpo: 20912 +.. date: 9445 +.. nonce: cAq3mZ +.. section: Library + +Now directories added to ZIP file have correct Unix and MS-DOS directory +attributes. + +.. + +.. bpo: 21866 +.. date: 9444 +.. nonce: hSc4wM +.. section: Library + +ZipFile.close() no longer writes ZIP64 central directory records if +allowZip64 is false. + +.. + +.. bpo: 22415 +.. date: 9443 +.. nonce: VKFghV +.. section: Library + +Fixed debugging output of the GROUPREF_EXISTS opcode in the re module. + +.. + +.. bpo: 22423 +.. date: 9442 +.. nonce: Rtb4oT +.. section: Library + +Unhandled exception in thread no longer causes unhandled AttributeError when +sys.stderr is None. + +.. + +.. bpo: 22419 +.. date: 9441 +.. nonce: FqH4aC +.. section: Library + +Limit the length of incoming HTTP request in wsgiref server to 65536 bytes +and send a 414 error code for higher lengths. Patch contributed by Devin +Cook. + +.. + +.. bpo: 0 +.. date: 9440 +.. nonce: y7r3O2 +.. section: Library + +Lax cookie parsing in http.cookies could be a security issue when combined +with non-standard cookie handling in some Web browsers. Reported by Sergey +Bobrov. + +.. + +.. bpo: 21147 +.. date: 9439 +.. nonce: w9DE17 +.. section: Library + +sqlite3 now raises an exception if the request contains a null character +instead of truncating it. Based on patch by Victor Stinner. + +.. + +.. bpo: 21951 +.. date: 9438 +.. nonce: 3vS4LK +.. section: Library + +Fixed a crash in Tkinter on AIX when called Tcl command with empty string or +tuple argument. + +.. + +.. bpo: 21951 +.. date: 9437 +.. nonce: _CCC4v +.. section: Library + +Tkinter now most likely raises MemoryError instead of crash if the memory +allocation fails. + +.. + +.. bpo: 22226 +.. date: 9436 +.. nonce: T1ZMPY +.. section: Library + +First letter no longer is stripped from the "status" key in the result of +Treeview.heading(). + +.. + +.. bpo: 22051 +.. date: 9435 +.. nonce: cUjFqL +.. section: Library + +turtledemo no longer reloads examples to re-run them. Initialization of +variables and gui setup should be done in main(), which is called each time +a demo is run, but not on import. + +.. + +.. bpo: 21597 +.. date: 9434 +.. nonce: aPTCWJ +.. section: Library + +The separator between the turtledemo text pane and the drawing canvas can +now be grabbed and dragged with a mouse. The code text pane can be widened +to easily view or copy the full width of the text. The canvas can be +widened on small screens. Original patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 18132 +.. date: 9433 +.. nonce: 2R2nwM +.. section: Library + +Turtledemo buttons no longer disappear when the window is shrunk. Original +patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 22312 +.. date: 9432 +.. nonce: WP13o8 +.. section: Library + +Fix ntpath.splitdrive IndexError. + +.. + +.. bpo: 22216 +.. date: 9431 +.. nonce: Cmalu6 +.. section: Library + +smtplib now resets its state more completely after a quit. The most obvious +consequence of the previous behavior was a STARTTLS failure during a +connect/starttls/quit/connect/starttls sequence. + +.. + +.. bpo: 21305 +.. date: 9430 +.. nonce: Fl8I5B +.. section: Library + +os.urandom now caches a fd to /dev/urandom. This is a PEP 466 backport from +Python 3. + +.. + +.. bpo: 21307 +.. date: 9429 +.. nonce: U7iiqX +.. section: Library + +As part of PEP 466, backport hashlib.algorithms_guaranteed and +hashlib.algorithms_available. + +.. + +.. bpo: 22259 +.. date: 9428 +.. nonce: 6v9wLm +.. section: Library + +Fix segfault when attempting to fopen a file descriptor corresponding to a +directory. + +.. + +.. bpo: 22236 +.. date: 9427 +.. nonce: 1utXkg +.. section: Library + +Fixed Tkinter images copying operations in NoDefaultRoot mode. + +.. + +.. bpo: 22191 +.. date: 9426 +.. nonce: 1K-CmD +.. section: Library + +Fixed warnings.__all__. + +.. + +.. bpo: 21308 +.. date: 9425 +.. nonce: _z9b8i +.. section: Library + +Backport numerous features from Python's ssl module. This is part of PEP +466. + +.. + +.. bpo: 15696 +.. date: 9424 +.. nonce: PTwXYJ +.. section: Library + +Add a __sizeof__ implementation for mmap objects on Windows. + +.. + +.. bpo: 8797 +.. date: 9423 +.. nonce: aJcIPu +.. section: Library + +Raise HTTPError on failed Basic Authentication immediately. Initial patch by +Sam Bull. + +.. + +.. bpo: 22068 +.. date: 9422 +.. nonce: wCdaW0 +.. section: Library + +Avoided reference loops with Variables and Fonts in Tkinter. + +.. + +.. bpo: 21448 +.. date: 9421 +.. nonce: THJSYB +.. section: Library + +Changed FeedParser feed() to avoid O(N**2) behavior when parsing long line. +Original patch by Raymond Hettinger. + +.. + +.. bpo: 17923 +.. date: 9420 +.. nonce: YI_QjG +.. section: Library + +glob() patterns ending with a slash no longer match non-dirs on AIX. Based +on patch by Delhallt. + +.. + +.. bpo: 21975 +.. date: 9419 +.. nonce: MI8ntO +.. section: Library + +Fixed crash when using uninitialized sqlite3.Row (in particular when +unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the +__new__() method. + +.. + +.. bpo: 16037 +.. date: 9418 +.. nonce: q6A9-W +.. section: Library + +HTTPMessage.readheaders() raises an HTTPException when more than 100 headers +are read. Patch by Jyrki Pulliainen and Daniel Eriksson. + +.. + +.. bpo: 21580 +.. date: 9417 +.. nonce: BUIf7o +.. section: Library + +Now Tkinter correctly handles binary "data" and "maskdata" configure options +of tkinter.PhotoImage. + +.. + +.. bpo: 19612 +.. date: 9416 +.. nonce: xvU6AH +.. section: Library + +subprocess.communicate() now also ignores EINVAL when using at least two +pipes. + +.. + +.. bpo: 0 +.. date: 9415 +.. nonce: aDlT3j +.. section: Library + +Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError on +closed socket. + +.. + +.. bpo: 16133 +.. date: 9414 +.. nonce: 6cKWd2 +.. section: Library + +The asynchat.async_chat.handle_read() method now ignores socket.error() +exceptions with blocking I/O errors: EAGAIN, EALREADY, EINPROGRESS, or +EWOULDBLOCK. + +.. + +.. bpo: 21990 +.. date: 9413 +.. nonce: _lujpf +.. section: Library + +Clean-up unnecessary and slow inner class definition in saxutils +(Contributed by Alex Gaynor). + +.. + +.. bpo: 1730136 +.. date: 9412 +.. nonce: sqWp2M +.. section: Library + +Fix the comparison between a tkFont.Font and an object of another kind. + +.. + +.. bpo: 19884 +.. date: 9411 +.. nonce: 6cbo0V +.. section: Library + +readline: Disable the meta modifier key if stdout is not a terminal to not +write the ANSI sequence "\033[1034h" into stdout. This sequence is used on +some terminal (ex: TERM=xterm-256color") to enable support of 8 bit +characters. + +.. + +.. bpo: 22017 +.. date: 9410 +.. nonce: BojGgr +.. section: Library + +Correct reference counting error in the initialization of the _warnings +module. + +.. + +.. bpo: 21868 +.. date: 9409 +.. nonce: q_ZIvF +.. section: Library + +Prevent turtle crash when undo buffer set to a value less than one. + +.. + +.. bpo: 21151 +.. date: 9408 +.. nonce: T7tb9Q +.. section: Library + +Fixed a segfault in the _winreg module when ``None`` is passed as a +``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. + +.. + +.. bpo: 21090 +.. date: 9407 +.. nonce: 20Ooif +.. section: Library + +io.FileIO.readall() does not ignore I/O errors anymore. Before, it ignored +I/O errors if at least the first C call read() succeed. + +.. + +.. bpo: 19870 +.. date: 9406 +.. nonce: 3QBvmj +.. section: Library + +BaseCookie now parses 'secure' and 'httponly' flags. Backport of issue +#16611. + +.. + +.. bpo: 21923 +.. date: 9405 +.. nonce: hXnoZa +.. section: Library + +Prevent AttributeError in distutils.sysconfig.customize_compiler due to +possible uninitialized _config_vars. + +.. + +.. bpo: 21323 +.. date: 9404 +.. nonce: yRf1v6 +.. section: Library + +Fix CGIHTTPServer to again handle scripts in CGI subdirectories, broken by +the fix for security issue #19435. Patch by Zach Byrne. + +.. + +.. bpo: 22199 +.. date: 9403 +.. nonce: SIwKds +.. section: Library + +Make get_makefile_filename() available in Lib/sysconfig.py for 2.7 to match +other versions of sysconfig. + +.. + +.. bpo: 3068 +.. date: 9402 +.. nonce: TYjXTA +.. section: IDLE + +Add Idle extension configuration dialog to Options menu. Changes are written +to HOME/.idlerc/config-extensions.cfg. Original patch by Tal Einat. + +.. + +.. bpo: 16233 +.. date: 9401 +.. nonce: sOadNo +.. section: IDLE + +A module browser (File : Class Browser, Alt+C) requires an editor window +with a filename. When Class Browser is requested otherwise, from a shell, +output window, or 'Untitled' editor, Idle no longer displays an error box. +It now pops up an Open Module box (Alt+M). If a valid name is entered and a +module is opened, a corresponding browser is also opened. + +.. + +.. bpo: 4832 +.. date: 9400 +.. nonce: GRKi9M +.. section: IDLE + +Save As to type Python files automatically adds .py to the name you enter +(even if your system does not display it). Some systems automatically add +.txt when type is Text files. + +.. + +.. bpo: 21986 +.. date: 9399 +.. nonce: 04GUv2 +.. section: IDLE + +Code objects are not normally pickled by the pickle module. To match this, +they are no longer pickled when running under Idle. + +.. + +.. bpo: 22221 +.. date: 9398 +.. nonce: d87SuA +.. section: IDLE + +IDLE now ignores the source encoding declaration on the second line if the +first line contains anything except a comment. + +.. + +.. bpo: 17390 +.. date: 9397 +.. nonce: I4vHFh +.. section: IDLE + +Adjust Editor window title; remove 'Python', move version to end. + +.. + +.. bpo: 14105 +.. date: 9396 +.. nonce: -FZwYH +.. section: IDLE + +Idle debugger breakpoints no longer disappear when inserting or deleting +lines. + +.. + +.. bpo: 22381 +.. date: 9395 +.. nonce: 6ngdZW +.. section: Library + +Update zlib to 1.2.8. + +.. + +.. bpo: 22176 +.. date: 9394 +.. nonce: rgbRyg +.. section: Library + +Update the ctypes module's libffi to v3.1. This release adds support for +the Linux AArch64 and POWERPC ELF ABIv2 little endian architectures. + +.. + +.. bpo: 10712 +.. date: 9393 +.. nonce: rnd0oc +.. section: Tools/Demos + +2to3 has a new "asserts" fixer that replaces deprecated names of unittest +methods (e.g. failUnlessEqual -> assertEqual). + +.. + +.. bpo: 22221 +.. date: 9392 +.. nonce: vONLqA +.. section: Tools/Demos + +2to3 and the findnocoding.py script now ignore the source encoding +declaration on the second line if the first line contains anything except a +comment. + +.. + +.. bpo: 22201 +.. date: 9391 +.. nonce: k1Awbh +.. section: Tools/Demos + +Command-line interface of the zipfile module now correctly extracts ZIP +files with directory entries. Patch by Ryan Wilson. + +.. + +.. bpo: 22236 +.. date: 9390 +.. nonce: ginJSI +.. section: Tests + +Tkinter tests now don't reuse default root window. New root window is +created for every test class. + +.. + +.. bpo: 18004 +.. date: 9389 +.. nonce: jPXten +.. section: Tests + +test_overflow in test_list by mistake consumed 40 GiB of memory on 64-bit +systems. + +.. + +.. bpo: 21976 +.. date: 9388 +.. nonce: Slq6se +.. section: Tests + +Fix test_ssl to accept LibreSSL version strings. Thanks to William Orr. + +.. + +.. bpo: 22770 +.. date: 9387 +.. nonce: FxAh91 +.. section: Tests + +Prevent some Tk segfaults on OS X when running gui tests. + +.. + +.. bpo: 20221 +.. date: 9386 +.. nonce: _yAetK +.. section: Build + +Removed conflicting (or circular) hypot definition when compiled with VS +2010 or above. Initial patch by Tabrez Mohammed. + +.. + +.. bpo: 16537 +.. date: 9385 +.. nonce: llFo71 +.. section: Build + +Check whether self.extensions is empty in setup.py. Patch by Jonathan +Hosmer. + +.. + +.. bpo: 0 +.. date: 9384 +.. nonce: YZUllw +.. section: Build + +The documentation Makefile no longer automatically downloads Sphinx. Users +are now required to have Sphinx already installed to build the +documentation. + +.. + +.. bpo: 21958 +.. date: 9383 +.. nonce: 3rq4qR +.. section: Build + +Define HAVE_ROUND when building with Visual Studio 2013 and above. Patch by +Zachary Turner. + +.. + +.. bpo: 15759 +.. date: 9382 +.. nonce: iGLR6O +.. section: Build + +"make suspicious", "make linkcheck" and "make doctest" in Doc/ now display +special message when and only when there are failures. + +.. + +.. bpo: 21166 +.. date: 9381 +.. nonce: KAl7aO +.. section: Build + +Prevent possible segfaults and other random failures of python --generate- +posix-vars in pybuilddir.txt build target. + +.. + +.. bpo: 18096 +.. date: 9380 +.. nonce: ELyAUJ +.. section: Build + +Fix library order returned by python-config. + +.. + +.. bpo: 17219 +.. date: 9379 +.. nonce: q8ueQ0 +.. section: Build + +Add library build dir for Python extension cross-builds. + +.. + +.. bpo: 22877 +.. date: 9378 +.. nonce: nq_snR +.. section: Build + +PEP 477 - OS X installer now installs pip. + +.. + +.. bpo: 22878 +.. date: 9377 +.. nonce: y4UnOy +.. section: Build + +PEP 477 - "make install" and "make altinstall" can now install or upgrade +pip, using the bundled pip provided by the backported ensurepip module. A +configure option, --with-ensurepip[=upgrade|install|no], is available to set +the option for subsequent installs; the default for Python 2 in "no" (do not +install or upgrade pip). The option can also be set with "make [alt]install +ENSUREPIP=[upgrade|install|no]". + +.. + +.. bpo: 17896 +.. date: 9376 +.. nonce: o79rHM +.. section: Windows + +The Windows build scripts now expect external library sources to be in +``PCbuild\..\externals`` rather than ``PCbuild\..\..``. + +.. + +.. bpo: 17717 +.. date: 9375 +.. nonce: y1zoye +.. section: Windows + +The Windows build scripts now use a copy of NASM pulled from svn.python.org +to build OpenSSL. + +.. + +.. bpo: 22644 +.. date: 9374 +.. nonce: gosBki +.. section: Windows + +The bundled version of OpenSSL has been updated to 1.0.1j. diff --git a/Misc/NEWS.d/2.7.rst b/Misc/NEWS.d/2.7.rst new file mode 100644 index 00000000000..fad05370ac2 --- /dev/null +++ b/Misc/NEWS.d/2.7.rst @@ -0,0 +1,46 @@ +.. bpo: 0 +.. date: 8096 +.. nonce: HgSXMh +.. release date: 2010-07-03 +.. section: Core and Builtins + +Prevent assignment to set literals. + +.. + +.. bpo: 1868 +.. date: 8095 +.. nonce: 8rTkvC +.. section: Library + +Eliminate subtle timing issues in thread-local objects by getting rid of the +cached copy of thread-local attribute dictionary. + +.. + +.. bpo: 9125 +.. date: 8094 +.. nonce: bm97Ws +.. section: Library + +Add recognition of 'except ... as ...' syntax to parser module. + +.. + +.. bpo: 7673 +.. date: 8093 +.. nonce: cDxsD2 +.. section: Library + +Fix security vulnerability (CVE-2010-2089) in the audioop module, ensure +that the input string length is a multiple of the frame size. + +.. + +.. bpo: 9075 +.. date: 8092 +.. nonce: kvxac2 +.. section: Library + +In the ssl module, remove the setting of a ``debug`` flag on an OpenSSL +structure. diff --git a/Misc/NEWS.d/2.7a1.rst b/Misc/NEWS.d/2.7a1.rst new file mode 100644 index 00000000000..5d0f99c623a --- /dev/null +++ b/Misc/NEWS.d/2.7a1.rst @@ -0,0 +1,5751 @@ +.. bpo: 7419 +.. date: 7759 +.. nonce: k1cFGq +.. release date: 2009-12-05 +.. section: Core and Builtins + +``locale.setlocale()`` could crash the interpreter on Windows when called +with invalid values. + +.. + +.. bpo: 3382 +.. date: 7758 +.. nonce: gtmT4T +.. section: Core and Builtins + +'F' formatting for float and complex now convert the result to upper case. +This only affects 'inf' and 'nan', since 'f' no longer converts to 'g' for +large values. + +.. + +.. bpo: 0 +.. date: 7757 +.. nonce: fw7KHO +.. section: Core and Builtins + +Remove switch from "%f" formatting to "%g" formatting for floats larger than +1e50 in absolute value. + +.. + +.. bpo: 0 +.. date: 7756 +.. nonce: npJH0D +.. section: Core and Builtins + +Remove restrictions on precision when formatting floats. E.g., "%.120g" % +1e-100 used to raise OverflowError, but now gives the requested 120 +significant digits instead. + +.. + +.. bpo: 0 +.. date: 7755 +.. nonce: Z3-djS +.. section: Core and Builtins + +Add Py3k warnings for parameter names in parentheses. + +.. + +.. bpo: 7362 +.. date: 7754 +.. nonce: wy5JgV +.. section: Core and Builtins + +Give a proper error message for ``def f((x)=3): pass``. + +.. + +.. bpo: 7085 +.. date: 7753 +.. nonce: 1mo7hs +.. section: Core and Builtins + +Fix crash when importing some extensions in a thread on MacOSX 10.6. + +.. + +.. bpo: 7117 +.. date: 7752 +.. nonce: 3_1LKC +.. section: Core and Builtins + +``repr(x)`` for a float x returns a result based on the shortest decimal +string that's guaranteed to round back to x under correct rounding (with +round-half-to-even rounding mode). Previously it gave a string based on +rounding x to 17 decimal digits. repr(x) for a complex number behaves +similarly. On platforms where the correctly-rounded strtod and dtoa code is +not supported (see below), repr is unchanged. + +.. + +.. bpo: 7117 +.. date: 7751 +.. nonce: 6am3Rw +.. section: Core and Builtins + +On almost all platforms: float-to-string and string-to-float conversions +within Python are now correctly rounded. Places these conversions occur +include: str for floats and complex numbers; the float and complex +constructors; old-style and new-style numeric formatting; serialization and +deserialization of floats and complex numbers using marshal, pickle and +json; parsing of float and imaginary literals in Python code; Decimal-to- +float conversion. + +The conversions use a Python-adapted version of David Gay's well-known +dtoa.c, providing correctly-rounded strtod and dtoa C functions. This code +is supported on Windows, and on Unix-like platforms using gcc, icc or suncc +as the C compiler. There may be a small number of platforms on which +correct operation of this code cannot be guaranteed, so the code is not +used: notably, this applies to platforms where the C double format is not +IEEE 754 binary64, and to platforms on x86 hardware where the x87 FPU is set +to 64-bit precision and Python's configure script is unable to determine how +to change the FPU precision. On these platforms conversions use the +platform strtod and dtoa, as before. + +.. + +.. bpo: 7117 +.. date: 7750 +.. nonce: 2KoEdA +.. section: Core and Builtins + +Backport round implementation from Python 3.x. ``round()`` now uses the +correctly-rounded string <-> float conversions described above (when +available), and so produces correctly rounded results that will display +nicely under the float repr. There are two related small changes: (1) round +now accepts any class with an ``__index__()`` method for its second argument +(but no longer accepts floats for the second argument), and (2) an +excessively large second integer argument (e.g., ``round(1.234, 10**100)``) +no longer raises an exception. + +.. + +.. bpo: 1757126 +.. date: 7749 +.. nonce: W4QhUw +.. section: Core and Builtins + +Fix the cyrillic-asian alias for the ptcp154 encoding. + +.. + +.. bpo: 0 +.. date: 7748 +.. nonce: mZpsla +.. section: Core and Builtins + +Fix several issues with ``compile()``. The input can now contain Windows +and Mac newlines and is no longer required to end in a newline. + +.. + +.. bpo: 0 +.. date: 7747 +.. nonce: sUbwH3 +.. section: Core and Builtins + +Remove length limitation when constructing a complex number from a unicode +string. + +.. + +.. bpo: 7244 +.. date: 7746 +.. nonce: qAVavO +.. section: Core and Builtins + +``itertools.izip_longest()`` no longer ignores exceptions raised during the +formation of an output tuple. + +.. + +.. bpo: 1087418 +.. date: 7745 +.. nonce: dyFZpg +.. section: Core and Builtins + +Boost performance of bitwise operations for longs. + +.. + +.. bpo: 1722344 +.. date: 7744 +.. nonce: QqabuR +.. section: Core and Builtins + +``threading._shutdown()`` is now called in ``Py_Finalize()``, which fixes +the problem of some exceptions being thrown at shutdown when the interpreter +is killed. Patch by Adam Olsen. + +.. + +.. bpo: 7168 +.. date: 7743 +.. nonce: pYjKia +.. section: Core and Builtins + +Document ``PyFloat_AsString()`` and ``PyFloat_AsReprString()``, and note +that they are unsafe and deprecated. + +.. + +.. bpo: 7120 +.. date: 7742 +.. nonce: Ft2RxW +.. section: Core and Builtins + +logging: Remove import of multiprocessing which is causing crash in GAE. + +.. + +.. bpo: 7140 +.. date: 7741 +.. nonce: KNTZLI +.. section: Core and Builtins + +The ``__dict__`` of a module should not be cleared unless the module is the +only object holding a reference to it. + +.. + +.. bpo: 1754094 +.. date: 7740 +.. nonce: I0gQmd +.. section: Core and Builtins + +Improve the stack depth calculation in the compiler. There should be no +other effect than a small decrease in memory use. Patch by Christopher Tur +Lesniewski-Laas. + +.. + +.. bpo: 7084 +.. date: 7739 +.. nonce: kUk5-B +.. section: Core and Builtins + +Fix a (very unlikely) crash when printing a list from one thread, and +mutating it from another one. Patch by Scott Dial. + +.. + +.. bpo: 1571184 +.. date: 7738 +.. nonce: EqTH98 +.. section: Core and Builtins + +The Unicode database contains properties for more characters. The tables for +code points representing numeric values, white spaces or line breaks are now +generated from the official Unicode Character Database files, and include +information from the Unihan.txt file. + +.. + +.. bpo: 7050 +.. date: 7737 +.. nonce: DM5jYL +.. section: Core and Builtins + +Fix a SystemError when trying to use unpacking and augmented assignment. + +.. + +.. bpo: 5329 +.. date: 7736 +.. nonce: bkqqa- +.. section: Core and Builtins + +Fix ``os.popen*`` regression from 2.5 with commands as a sequence running +through the shell. Patch by Jean-Paul Calderone and Jani Hakala. + +.. + +.. bpo: 7019 +.. date: 7735 +.. nonce: sCk9wW +.. section: Core and Builtins + +Raise ValueError when unmarshalling bad long data, instead of producing +internally inconsistent Python longs. + +.. + +.. bpo: 6990 +.. date: 7734 +.. nonce: 19LcUf +.. section: Core and Builtins + +Fix ``threading.local`` subclasses leaving old state around after a +reference cycle GC which could be recycled by new locals. + +.. + +.. bpo: 6300 +.. date: 7733 +.. nonce: 6gPIDy +.. section: Core and Builtins + +unicode.encode, unicode.decode, str.decode, and str.encode now take keyword +arguments. + +.. + +.. bpo: 6922 +.. date: 7732 +.. nonce: _MuLB9 +.. section: Core and Builtins + +Fix an infinite loop when trying to decode an invalid UTF-32 stream with a +non-raising error handler like "replace" or "ignore". + +.. + +.. bpo: 6713 +.. date: 7731 +.. nonce: 89EnqN +.. section: Core and Builtins + +Improve performance of base 10 int -> string and long -> string conversions. + +.. + +.. bpo: 1590864 +.. date: 7730 +.. nonce: 8aex1L +.. section: Core and Builtins + +Fix potential deadlock when mixing threads and fork(). + +.. + +.. bpo: 6844 +.. date: 7729 +.. nonce: oWxRbN +.. section: Core and Builtins + +Do not emit DeprecationWarnings when accessing a "message" attribute on +exceptions that was set explicitly. + +.. + +.. bpo: 6846 +.. date: 7728 +.. nonce: q7b-Oy +.. section: Core and Builtins + +Fix bug where bytearray.pop() returns negative integers. + +.. + +.. bpo: 0 +.. date: 7727 +.. nonce: GQUdwf +.. section: Core and Builtins + +``classmethod()`` no longer checks if its argument is callable. + +.. + +.. bpo: 6750 +.. date: 7726 +.. nonce: _Pln31 +.. section: Core and Builtins + +A text file opened with ``io.open()`` could duplicate its output when +writing from multiple threads at the same time. + +.. + +.. bpo: 6704 +.. date: 7725 +.. nonce: OpSyKo +.. section: Core and Builtins + +Improve the col_offset in AST for "for" statements with a target of tuple +unpacking. + +.. + +.. bpo: 6707 +.. date: 7724 +.. nonce: DXTwpb +.. section: Core and Builtins + +``dir()`` on an uninitialized module caused a crash. + +.. + +.. bpo: 6540 +.. date: 7723 +.. nonce: NsoPR8 +.. section: Core and Builtins + +Fixed crash for ``bytearray.translate()`` with invalid parameters. + +.. + +.. bpo: 6573 +.. date: 7722 +.. nonce: VBwjtf +.. section: Core and Builtins + +``set.union()`` stopped processing inputs if an instance of self occurred in +the argument chain. + +.. + +.. bpo: 1616979 +.. date: 7721 +.. nonce: YHyBWF +.. section: Core and Builtins + +Added the cp720 (Arabic DOS) encoding. + +.. + +.. bpo: 6070 +.. date: 7720 +.. nonce: -wC7vb +.. section: Core and Builtins + +On posix platforms import no longer copies the execute bit from the .py file +to the .pyc file if it is set. Patch by Marco N. + +.. + +.. bpo: 4618 +.. date: 7719 +.. nonce: B-bSRk +.. section: Core and Builtins + +When unicode arguments are passed to ``print()``, the default separator and +end should be unicode also. + +.. + +.. bpo: 6119 +.. date: 7718 +.. nonce: 94FrLZ +.. section: Core and Builtins + +Fixed an incorrect Py3k warning about order comparisons of built-in +functions and methods. + +.. + +.. bpo: 6347 +.. date: 7717 +.. nonce: VBKK7h +.. section: Core and Builtins + +Include inttypes.h as well as stdint.h in pyport.h. This fixes a build +failure on HP-UX: int32_t and uint32_t are defined in inttypes.h instead of +stdint.h on that platform. + +.. + +.. bpo: 4856 +.. date: 7716 +.. nonce: RhxQ0Y +.. section: Core and Builtins + +Remove checks for win NT. + +.. + +.. bpo: 2016 +.. date: 7715 +.. nonce: ZTf6oS +.. section: Core and Builtins + +Fixed a crash in a corner case where the dictionary of keyword arguments +could be modified during the function call setup. + +.. + +.. bpo: 0 +.. date: 7714 +.. nonce: uhA2zk +.. section: Core and Builtins + +Removed the ipaddr module. + +.. + +.. bpo: 6329 +.. date: 7713 +.. nonce: j7fwCJ +.. section: Core and Builtins + +Fixed iteration for memoryview objects (it was being blocked because it +wasn't recognized as a sequence). + +.. + +.. bpo: 6289 +.. date: 7712 +.. nonce: zQqm8L +.. section: Core and Builtins + +Encoding errors from ``compile()`` were being masked. + +.. + +.. bpo: 0 +.. date: 7711 +.. nonce: s6jnqm +.. section: Core and Builtins + +When no module is given in a relative import, the module field of the +ImportFrom AST node is now None instead of an empty string. + +.. + +.. bpo: 0 +.. date: 7710 +.. nonce: dFzVxY +.. section: Core and Builtins + +Assignment to None using import statements now raises a SyntaxError. + +.. + +.. bpo: 4547 +.. date: 7709 +.. nonce: 4fI3tX +.. section: Core and Builtins + +When debugging a very large function, it was not always possible to update +the lineno attribute of the current frame. + +.. + +.. bpo: 5330 +.. date: 7708 +.. nonce: HPvn6G +.. section: Core and Builtins + +C functions called with keyword arguments were not reported by the various +profiling modules (profile, cProfile). Patch by Hagen F?rstenau. + +.. + +.. bpo: 5982 +.. date: 7707 +.. nonce: c_mt6_ +.. section: Core and Builtins + +staticmethod and classmethod now expose the wrapped function with +``__func__``. + +.. + +.. bpo: 0 +.. date: 7706 +.. nonce: w77qV4 +.. section: Core and Builtins + +Added support for multiple context managers in the same with-statement. +Deprecated ``contextlib.nested()`` which is no longer needed. + +.. + +.. bpo: 6101 +.. date: 7705 +.. nonce: 4tQTZX +.. section: Core and Builtins + +A new opcode, SETUP_WITH, has been added to speed up the with statement and +correctly lookup the __enter__ and __exit__ special methods. + +.. + +.. bpo: 5829 +.. date: 7704 +.. nonce: Zt7a5o +.. section: Core and Builtins + +complex("1e500") no longer raises OverflowError. This makes it consistent +with float("1e500") and interpretation of real and imaginary literals. + +.. + +.. bpo: 3527 +.. date: 7703 +.. nonce: Eyqquq +.. section: Core and Builtins + +Removed Py_WIN_WIDE_FILENAMES which is not used any more. + +.. + +.. bpo: 0 +.. date: 7702 +.. nonce: 2yrH_o +.. section: Core and Builtins + +``__instancecheck__()`` and ``__subclasscheck__()`` are now completely +ignored on classic classes and instances. + +.. + +.. bpo: 5994 +.. date: 7701 +.. nonce: woNvhx +.. section: Core and Builtins + +The marshal module now has docstrings. + +.. + +.. bpo: 5981 +.. date: 7700 +.. nonce: LkapH9 +.. section: Core and Builtins + +Fix three minor inf/nan issues in float.fromhex: + +(1) inf and nan strings with trailing whitespace were incorrectly rejected; +(2) parsing of strings representing infinities and nans was locale aware; +and (3) the interpretation of fromhex('-nan') didn't match that of +float('-nan'). + +.. + +.. bpo: 5920 +.. date: 7699 +.. nonce: ZoI1xB +.. section: Core and Builtins + +For ``float.__format__()``, change the behavior with the empty presentation +type (that is, not one of 'e', 'f', 'g', or 'n') to be like 'g' but with at +least one decimal point and with a default precision of 12. Previously, the +behavior the same but with a default precision of 6. This more closely +matches ``str()``, and reduces surprises when adding alignment flags to the +empty presentation type. This also affects the new complex.__format__ in the +same way. + +.. + +.. bpo: 5890 +.. date: 7698 +.. nonce: sbCAtW +.. section: Core and Builtins + +In subclasses of 'property' the __doc__ attribute was shadowed by +classtype's, even if it was None. property now inserts the __doc__ into the +subclass instance __dict__. + +.. + +.. bpo: 4426 +.. date: 7697 +.. nonce: Ny5_Rg +.. section: Core and Builtins + +The UTF-7 decoder was too strict and didn't accept some legal sequences. +Patch by Nick Barnes and Victor Stinner. + +.. + +.. bpo: 1588 +.. date: 7696 +.. nonce: 8-XCeQ +.. section: Core and Builtins + +Add complex.__format__. For example, ``format(complex(1, 2./3), '.5')`` now +produces a sensible result. + +.. + +.. bpo: 5864 +.. date: 7695 +.. nonce: UElc0c +.. section: Core and Builtins + +Fix empty format code formatting for floats so that it never gives more than +the requested number of significant digits. + +.. + +.. bpo: 5793 +.. date: 7694 +.. nonce: 0DjdQj +.. section: Core and Builtins + +Rationalize isdigit / isalpha / tolower, etc. Includes new Py_ISDIGIT / +Py_ISALPHA / Py_TOLOWER, etc. in pctypes.h. + +.. + +.. bpo: 4971 +.. date: 7693 +.. nonce: G5AyFS +.. section: Core and Builtins + +Fix titlecase for characters that are their own titlecase, but not their own +uppercase. + +.. + +.. bpo: 5835 +.. date: 7692 +.. nonce: SBkH58 +.. section: Core and Builtins + +Deprecate PyOS_ascii_formatd and replace it with _PyOS_double_to_string or +PyOS_double_to_string. + +.. + +.. bpo: 5283 +.. date: 7691 +.. nonce: p_vsQP +.. section: Core and Builtins + +Setting __class__ in __del__ caused a segfault. + +.. + +.. bpo: 5816 +.. date: 7690 +.. nonce: 5WDdX0 +.. section: Core and Builtins + +``complex(repr(z))`` now recovers z exactly, even when z involves nans, infs +or negative zeros. + +.. + +.. bpo: 0 +.. date: 7689 +.. nonce: ld0JdT +.. section: Core and Builtins + +Implement PEP 378, Format Specifier for Thousands Separator, for floats, +ints, and longs. + +.. + +.. bpo: 5515 +.. date: 7688 +.. nonce: H1aLcI +.. section: Core and Builtins + +'n' formatting for ints, longs, and floats handles leading zero formatting +poorly. + +.. + +.. bpo: 5772 +.. date: 7687 +.. nonce: tXqVft +.. section: Core and Builtins + +For float.__format__, don't add a trailing ".0" if we're using no type code +and we have an exponent. + +.. + +.. bpo: 3166 +.. date: 7686 +.. nonce: oL_y0x +.. section: Core and Builtins + +Make long -> float (and int -> float) conversions correctly rounded. + +.. + +.. bpo: 5787 +.. date: 7685 +.. nonce: iV1WRE +.. section: Core and Builtins + +``object.__getattribute__(some_type, "__bases__")`` segfaulted on some +built-in types. + +.. + +.. bpo: 1869 +.. date: 7684 +.. nonce: cQ4HTO +.. section: Core and Builtins + +Fix a couple of minor round() issues. ``round(5e15+1)`` was giving 5e15+2; +``round(-0.0)`` was losing the sign of the zero. + +.. + +.. bpo: 5759 +.. date: 7683 +.. nonce: j3dL9W +.. section: Core and Builtins + +float() didn't call __float__ on str subclasses. + +.. + +.. bpo: 5704 +.. date: 7682 +.. nonce: TDk8Ck +.. section: Core and Builtins + +The "-3" command-line option now implies "-t". + +.. + +.. bpo: 2170 +.. date: 7681 +.. nonce: 35irN6 +.. section: Core and Builtins + +Refactored ``xml.dom.minidom.normalize``, increasing both its clarity and +its speed. + +.. + +.. bpo: 2396 +.. date: 7680 +.. nonce: v-oJ0Q +.. section: Core and Builtins + +The memoryview object was backported from Python 3.1. + +.. + +.. bpo: 0 +.. date: 7679 +.. nonce: wxbCGj +.. section: Core and Builtins + +Fix a problem in PyErr_NormalizeException that leads to "undetected errors" +when hitting the recursion limit under certain circumstances. + +.. + +.. bpo: 1665206 +.. date: 7678 +.. nonce: D9xyVJ +.. section: Core and Builtins + +Remove the last eager import in _warnings.c and make it lazy. + +.. + +.. bpo: 4865 +.. date: 7677 +.. nonce: 9T7IVK +.. section: Core and Builtins + +On MacOSX /Library/Python/2.7/site-packages is added to the end sys.path, +for compatibility with the system install of Python. + +.. + +.. bpo: 4688 +.. date: 7676 +.. nonce: k7jSS9 +.. section: Core and Builtins + +Add a heuristic so that tuples and dicts containing only untrackable objects +are not tracked by the garbage collector. This can reduce the size of +collections and therefore the garbage collection overhead on long-running +programs, depending on their particular use of datatypes. + +.. + +.. bpo: 5512 +.. date: 7675 +.. nonce: 0akWHy +.. section: Core and Builtins + +Rewrite PyLong long division algorithm (x_divrem) to improve its +performance. Long divisions and remainder operations are now between 50% +and 150% faster. + +.. + +.. bpo: 4258 +.. date: 7674 +.. nonce: VzQaoh +.. section: Core and Builtins + +Make it possible to use base 2**30 instead of base 2**15 for the internal +representation of integers, for performance reasons. Base 2**30 is enabled +by default on 64-bit machines. Add --enable-big-digits option to configure, +which overrides the default. Add sys.long_info structseq to provide +information about the internal format. + +.. + +.. bpo: 4034 +.. date: 7673 +.. nonce: WdZVvE +.. section: Core and Builtins + +Fix weird attribute error messages of the traceback object. (As a result +traceback.__members__ no longer exists.) + +.. + +.. bpo: 4474 +.. date: 7672 +.. nonce: d-gOFs +.. section: Core and Builtins + +PyUnicode_FromWideChar now converts characters outside the BMP to surrogate +pairs, on systems with sizeof(wchar_t) == 4 and sizeof(Py_UNICODE) == 2. + +.. + +.. bpo: 5237 +.. date: 7671 +.. nonce: TC5vHj +.. section: Core and Builtins + +Allow auto-numbered fields in str.format(). For example: ``'{} {}'.format(1, +2) == '1 2'``. + +.. + +.. bpo: 3652 +.. date: 7670 +.. nonce: LS7lbT +.. section: Core and Builtins + +Make the 'line' argument for ``warnings.showwarning()`` a requirement. +Means the DeprecationWarning from Python 2.6 can go away. + +.. + +.. bpo: 5247 +.. date: 7669 +.. nonce: FherHz +.. section: Core and Builtins + +Improve error message when unknown format codes are used when using +``str.format()`` with str, unicode, long, int, and float arguments. + +.. + +.. bpo: 0 +.. date: 7668 +.. nonce: UMEr-l +.. section: Core and Builtins + +Running Python with the -3 option now also warns about classic division for +ints and longs. + +.. + +.. bpo: 5260 +.. date: 7667 +.. nonce: Em88-S +.. section: Core and Builtins + +Long integers now consume less memory: average saving is 2 bytes per long on +a 32-bit system and 6 bytes per long on a 64-bit system. + +.. + +.. bpo: 5186 +.. date: 7666 +.. nonce: j1is78 +.. section: Core and Builtins + +Reduce hash collisions for objects with no __hash__ method by rotating the +object pointer by 4 bits to the right. + +.. + +.. bpo: 4575 +.. date: 7665 +.. nonce: kbytK5 +.. section: Core and Builtins + +Fix Py_IS_INFINITY macro to work correctly on x87 FPUs: it now forces its +argument to double before testing for infinity. + +.. + +.. bpo: 4978 +.. date: 7664 +.. nonce: 1CHApa +.. section: Core and Builtins + +Passing keyword arguments as unicode strings is now allowed. + +.. + +.. bpo: 1242657 +.. date: 7663 +.. nonce: XDCnZa +.. section: Core and Builtins + +the __len__() and __length_hint__() calls in several tools were suppressing +all exceptions. These include list(), filter(), map(), zip(), and +bytearray(). + +.. + +.. bpo: 0 +.. date: 7662 +.. nonce: cFart9 +.. section: Core and Builtins + +os.ftruncate raises OSErrors instead of IOErrors for consistency with other +os functions. + +.. + +.. bpo: 4991 +.. date: 7661 +.. nonce: ALUxl0 +.. section: Core and Builtins + +Passing invalid file descriptors to io.FileIO now raises an OSError. + +.. + +.. bpo: 4807 +.. date: 7660 +.. nonce: zBKF-Y +.. section: Core and Builtins + +Port the _winreg module to Windows CE. + +.. + +.. bpo: 4935 +.. date: 7659 +.. nonce: FCRsi7 +.. section: Core and Builtins + +The overflow checking code in the expandtabs() method common to str, bytes +and bytearray could be optimized away by the compiler, letting the +interpreter segfault instead of raising an error. + +.. + +.. bpo: 3720 +.. date: 7658 +.. nonce: AhqraF +.. section: Core and Builtins + +Fix a crash when an iterator modifies its class and removes its __next__ +method. + +.. + +.. bpo: 4893 +.. date: 7657 +.. nonce: 6cqBTr +.. section: Core and Builtins + +Use NT threading on CE. + +.. + +.. bpo: 4915 +.. date: 7656 +.. nonce: 687QYF +.. section: Core and Builtins + +Port sysmodule to Windows CE. + +.. + +.. bpo: 4074 +.. date: 7655 +.. nonce: P6W6AU +.. section: Core and Builtins + +Change the criteria for doing a full garbage collection (i.e. collecting the +oldest generation) so that allocating lots of objects without destroying +them does not show quadratic performance. Based on a proposal by Martin von +L?wis at http://mail.python.org/pipermail/python-dev/2008-June/080579.html. + +.. + +.. bpo: 4850 +.. date: 7654 +.. nonce: I2rQxz +.. section: Core and Builtins + +Change COUNT_ALLOCS variables to Py_ssize_t. + +.. + +.. bpo: 1180193 +.. date: 7653 +.. nonce: pCkOCz +.. section: Core and Builtins + +When importing a module from a .pyc (or .pyo) file with an existing .py +counterpart, override the co_filename attributes of all code objects if the +original filename is obsolete (which can happen if the file has been +renamed, moved, or if it is accessed through different paths). Patch by +Ziga Seilnacht and Jean-Paul Calderone. + +.. + +.. bpo: 4075 +.. date: 7652 +.. nonce: Ccn4nr +.. section: Core and Builtins + +Use ``OutputDebugStringW()`` in Py_FatalError. + +.. + +.. bpo: 4797 +.. date: 7651 +.. nonce: X8BGMK +.. section: Core and Builtins + +IOError.filename was not set when _fileio.FileIO failed to open file with +`str' filename on Windows. + +.. + +.. bpo: 3680 +.. date: 7650 +.. nonce: sDYVgF +.. section: Core and Builtins + +Reference cycles created through a dict, set or deque iterator did not get +collected. + +.. + +.. bpo: 4701 +.. date: 7649 +.. nonce: KCWdVt +.. section: Core and Builtins + +PyObject_Hash now implicitly calls PyType_Ready on types where the tp_hash +and tp_dict slots are both NULL. + +.. + +.. bpo: 4764 +.. date: 7648 +.. nonce: 9uJcCX +.. section: Core and Builtins + +With io.open, IOError.filename is set when trying to open a directory on +POSIX systems. + +.. + +.. bpo: 4764 +.. date: 7647 +.. nonce: m87cQp +.. section: Core and Builtins + +IOError.filename is set when trying to open a directory on POSIX systems. + +.. + +.. bpo: 4759 +.. date: 7646 +.. nonce: jS_IUc +.. section: Core and Builtins + +None is now allowed as the first argument of ``bytearray.translate()``. It +was always allowed for ``bytes.translate()``. + +.. + +.. bpo: 0 +.. date: 7645 +.. nonce: NJHPw5 +.. section: Core and Builtins + +Added test case to ensure attempts to read from a file opened for writing +fail. + +.. + +.. bpo: 2467 +.. date: 7644 +.. nonce: hTdCDO +.. section: Core and Builtins + +gc.DEBUG_STATS reported invalid elapsed times. Also, always print elapsed +times, not only when some objects are uncollectable/unreachable. Original +patch by Neil Schemenauer. + +.. + +.. bpo: 3439 +.. date: 7643 +.. nonce: FDqFob +.. section: Core and Builtins + +Add a bit_length method to int and long. + +.. + +.. bpo: 2183 +.. date: 7642 +.. nonce: N4TSpS +.. section: Core and Builtins + +Simplify and optimize bytecode for list comprehensions. Original patch by +Neal Norwitz. + +.. + +.. bpo: 4597 +.. date: 7641 +.. nonce: tAXQWn +.. section: Core and Builtins + +Fixed exception handling when the __exit__ function of a context manager +returns a value that cannot be converted to a bool. + +.. + +.. bpo: 4597 +.. date: 7640 +.. nonce: nQOPGV +.. section: Core and Builtins + +Fixed several opcodes that weren't always propagating exceptions. + +.. + +.. bpo: 4445 +.. date: 7639 +.. nonce: irvsqZ +.. section: Core and Builtins + +Replace ``sizeof(PyStringObject)`` with ``offsetof(PyStringObject, ob_sval) ++ 1`` when allocating memory for str instances. On a typical machine this +saves 3 bytes of memory (on average) per string allocation. + +.. + +.. bpo: 3996 +.. date: 7638 +.. nonce: MarU4T +.. section: Core and Builtins + +On Windows, the PyOS_CheckStack function would cause the interpreter to +abort ("Fatal Python error: Could not reset the stack!") instead of throwing +a MemoryError. + +.. + +.. bpo: 3689 +.. date: 7637 +.. nonce: CNYxlz +.. section: Core and Builtins + +The list reversed iterator now supports __length_hint__ instead of __len__. +Behavior now matches other reversed iterators. + +.. + +.. bpo: 4367 +.. date: 7636 +.. nonce: fmKFqn +.. section: Core and Builtins + +Python would segfault during compiling when the unicodedata module couldn't +be imported and \N escapes were present. + +.. + +.. bpo: 4233 +.. date: 7635 +.. nonce: iQj976 +.. section: Core and Builtins + +Changed semantic of ``_fileio.FileIO``'s ``close()`` method on file objects +with closefd=False. The file descriptor is still kept open but the file +object behaves like a closed file. The ``FileIO`` object also got a new +readonly attribute ``closefd``. + +.. + +.. bpo: 4348 +.. date: 7634 +.. nonce: 8mh_bw +.. section: Core and Builtins + +Some bytearray methods returned that didn't cause any change to the +bytearray, returned the same bytearray instead of a copy. + +.. + +.. bpo: 4317 +.. date: 7633 +.. nonce: GGUHMc +.. section: Core and Builtins + +Fixed a crash in the ``imageop.rgb2rgb8()`` function. + +.. + +.. bpo: 4230 +.. date: 7632 +.. nonce: Ndmrfx +.. section: Core and Builtins + +If ``__getattr__`` is a descriptor, it now functions correctly. + +.. + +.. bpo: 4048 +.. date: 7631 +.. nonce: KmD4Fy +.. section: Core and Builtins + +The parser module now correctly validates relative imports. + +.. + +.. bpo: 4225 +.. date: 7630 +.. nonce: 7zU-HH +.. section: Core and Builtins + +``from __future__ import unicode_literals`` didn't work in an exec +statement. + +.. + +.. bpo: 4176 +.. date: 7629 +.. nonce: qhcxIs +.. section: Core and Builtins + +Fixed a crash when pickling an object which ``__reduce__`` method does not +return iterators for the 4th and 5th items. + +.. + +.. bpo: 4209 +.. date: 7628 +.. nonce: iE6R1Z +.. section: Core and Builtins + +Enabling unicode_literals and the print_function in the same __future__ +import didn't work. + +.. + +.. bpo: 0 +.. date: 7627 +.. nonce: EZzjhE +.. section: Core and Builtins + +Using ``nonlocal`` as a variable name will now raise a Py3k SyntaxWarning +because it is a reserved word in 3.x. + +.. + +.. bpo: 0 +.. date: 7626 +.. nonce: 6ugG-L +.. section: Core and Builtins + +On windows, ``os.chdir()`` given unicode was not working if +GetCurrentDirectoryW returned a path longer than MAX_PATH. (But It's +doubtful this code path is really executed because I cannot move to such +directory on win2k) + +.. + +.. bpo: 4069 +.. date: 7625 +.. nonce: KZVhcT +.. section: Core and Builtins + +When ``set.remove(element)`` is used with a set element, the element is +temporarily replaced with an equivalent frozenset. But the eventual +KeyError would always report the empty ``frozenset()`` as the missing key. +Now it correctly refers to the initial element. + +.. + +.. bpo: 4509 +.. date: 7624 +.. nonce: s_M7sU +.. section: Core and Builtins + +Various issues surrounding resize of bytearray objects to which there are +buffer exports. + +.. + +.. bpo: 4748 +.. date: 7623 +.. nonce: VdAMxK +.. section: Core and Builtins + +Lambda generators no longer return a value. + +.. + +.. bpo: 3582 +.. date: 7622 +.. nonce: lPZMhV +.. section: Core and Builtins + +Use native TLS functions on Windows + +.. + +.. bpo: 0 +.. date: 7621 +.. nonce: -7Es2G +.. section: Core and Builtins + +The re.sub(), re.subn() and re.split() functions now accept a flags +parameter. + +.. + +.. bpo: 3845 +.. date: 7620 +.. nonce: 1zs3tX +.. section: Core and Builtins + +In PyRun_SimpleFileExFlags avoid invalid memory access with short file +names. + +.. + +.. bpo: 1113244 +.. date: 7619 +.. nonce: 0youo- +.. section: Core and Builtins + +Py_XINCREF, Py_DECREF, Py_XDECREF: Add `do { ... } while (0)' to avoid +compiler warnings. + +.. + +.. bpo: 5705 +.. date: 7618 +.. nonce: sV9axH +.. section: Core and Builtins + +os.setuid() would not accept values > 2**31-1 but pwd.getpwnam() returned +them on 64bit platforms. + +.. + +.. bpo: 5108 +.. date: 7617 +.. nonce: dAFFuh +.. section: Core and Builtins + +Handle %s like %S and %R in PyUnicode_FromFormatV(): Call +PyUnicode_DecodeUTF8() once, remember the result and output it in a second +step. This avoids problems with counting UTF-8 bytes that ignores the effect +of using the replace error handler in PyUnicode_DecodeUTF8(). + +.. + +.. bpo: 3739 +.. date: 7616 +.. nonce: M2kAQq +.. section: Core and Builtins + +The unicode-internal encoder now reports the number of characters consumed +like any other encoder (instead of the number of bytes). + +.. + +.. bpo: 2422 +.. date: 7615 +.. nonce: wzigzB +.. section: Core and Builtins + +When compiled with the ``--with-valgrind`` option, the pymalloc allocator +will be automatically disabled when running under Valgrind. This gives +improved memory leak detection when running under Valgrind, while taking +advantage of pymalloc at other times. + +.. + +.. bpo: 0 +.. date: 7614 +.. nonce: hEj501 +.. section: Library + +Add count() and reverse() methods to collections.deque(). + +.. + +.. bpo: 0 +.. date: 7613 +.. nonce: uRsKsO +.. section: Library + +Fix variations of extending deques: d.extend(d) d.extendleft(d) d+=d + +.. + +.. bpo: 6986 +.. date: 7612 +.. nonce: SdGPr9 +.. section: Library + +Fix crash in the JSON C accelerator when called with the wrong parameter +types. Patch by Victor Stinner. + +.. + +.. bpo: 0 +.. date: 7611 +.. nonce: NFsq2E +.. section: Library + +logging: Added optional "secure" parameter to SMTPHandler, to enable use of +TLS with authentication credentials. + +.. + +.. bpo: 1923 +.. date: 7610 +.. nonce: knrn4i +.. section: Library + +Fixed the removal of meaningful spaces when PKG-INFO is generated in +Distutils. Patch by Stephen Emslie. + +.. + +.. bpo: 4120 +.. date: 7609 +.. nonce: 3cH4Sr +.. section: Library + +Drop reference to CRT from manifest when building extensions with +msvc9compiler. + +.. + +.. bpo: 7333 +.. date: 7608 +.. nonce: 2fKr4C +.. section: Library + +The ``posix`` module gains an ``initgroups()`` function providing access to +the initgroups(3) C library call on Unix systems which implement it. Patch +by Jean-Paul Calderone. + +.. + +.. bpo: 7408 +.. date: 7607 +.. nonce: rgPHXu +.. section: Library + +Fixed distutils.tests.sdist so it doesn't check for group ownership when the +group is not forced, because the group may be different from the user's +group and inherit from its container when the test is run. + +.. + +.. bpo: 1515 +.. date: 7606 +.. nonce: xkpoux +.. section: Library + +Enable use of deepcopy() with instance methods. Patch by Robert Collins. + +.. + +.. bpo: 7403 +.. date: 7605 +.. nonce: FwNMdd +.. section: Library + +logging: Fixed possible race condition in lock creation. + +.. + +.. bpo: 6845 +.. date: 7604 +.. nonce: TrdLOB +.. section: Library + +Add restart support for binary upload in ftplib. The ``storbinary()`` +method of FTP and FTP_TLS objects gains an optional "rest" argument. Patch +by Pablo Mouzo. + +.. + +.. bpo: 5788 +.. date: 7603 +.. nonce: eXZYrC +.. section: Library + +``datetime.timedelta`` objects get a new ``total_seconds()`` method +returning the total number of seconds in the duration. Patch by Brian +Quinlan. + +.. + +.. bpo: 6615 +.. date: 7602 +.. nonce: L1bwX7 +.. section: Library + +logging: Used weakrefs in internal handler list. + +.. + +.. bpo: 1488943 +.. date: 7601 +.. nonce: bGsZyB +.. section: Library + +``difflib.Differ`` doesn't always add hints for tab characters. + +.. + +.. bpo: 6123 +.. date: 7600 +.. nonce: 7jPAMR +.. section: Library + +tarfile now opens empty archives correctly and consistently raises ReadError +on empty files. + +.. + +.. bpo: 7354 +.. date: 7599 +.. nonce: JiC3ff +.. section: Library + +distutils.tests.test_msvc9compiler - dragfullwindows can be 2. + +.. + +.. bpo: 5037 +.. date: 7598 +.. nonce: OuRtI7 +.. section: Library + +Proxy the __unicode__ special method to __unicode__ instead of __str__. + +.. + +.. bpo: 7341 +.. date: 7597 +.. nonce: ePPgs_ +.. section: Library + +Close the internal file object in the TarFile constructor in case of an +error. + +.. + +.. bpo: 7293 +.. date: 7596 +.. nonce: O5Dcu2 +.. section: Library + +``distutils.test_msvc9compiler`` is fixed to work on any fresh Windows box. +Help provided by David Bolen. + +.. + +.. bpo: 7328 +.. date: 7595 +.. nonce: I7W1pc +.. section: Library + +pydoc no longer corrupts sys.path when run with the '-m' switch. + +.. + +.. bpo: 2054 +.. date: 7594 +.. nonce: CqsOHR +.. section: Library + +ftplib now provides an FTP_TLS class to do secure FTP using TLS or SSL. +Patch by Giampaolo Rodola'. + +.. + +.. bpo: 4969 +.. date: 7593 +.. nonce: etEJDg +.. section: Library + +The mimetypes module now reads the MIME database from the registry under +Windows. Patch by Gabriel Genellina. + +.. + +.. bpo: 6816 +.. date: 7592 +.. nonce: FkQHgU +.. section: Library + +runpy now provides a run_path function that allows Python code to execute +file paths that refer to source or compiled Python files as well as +zipfiles, directories and other valid sys.path entries that contain a +__main__.py file. This allows applications that run other Python scripts to +support the same flexibility as the CPython command line itself. + +.. + +.. bpo: 7318 +.. date: 7591 +.. nonce: 5Q1hkQ +.. section: Library + +multiprocessing now uses a timeout when it fails to establish a connection +with another process, rather than looping endlessly. The default timeout is +20 seconds, which should be amply sufficient for local connections. + +.. + +.. bpo: 7197 +.. date: 7590 +.. nonce: 0cm1Qm +.. section: Library + +Allow unittest.TextTestRunner objects to be pickled and unpickled. This +fixes crashes under Windows when trying to run test_multiprocessing in +verbose mode. + +.. + +.. bpo: 7282 +.. date: 7589 +.. nonce: PGSXX5 +.. section: Library + +Fix a memory leak when an RLock was used in a thread other than those +started through ``threading.Thread`` (for example, using +``thread.start_new_thread()``. + +.. + +.. bpo: 7264 +.. date: 7588 +.. nonce: gXNBWt +.. section: Library + +Fix a possible deadlock when deallocating thread-local objects which are +part of a reference cycle. + +.. + +.. bpo: 7211 +.. date: 7587 +.. nonce: wuvMbi +.. section: Library + +Allow 64-bit values for the ``ident`` and ``data`` fields of kevent objects +on 64-bit systems. Patch by Michael Broghton. + +.. + +.. bpo: 6896 +.. date: 7586 +.. nonce: rXqOUx +.. section: Library + +``mailbox.Maildir`` now invalidates its internal cache each time a +modification is done through it. This fixes inconsistencies and test +failures on systems with slightly bogus mtime behaviour. + +.. + +.. bpo: 7246 +.. date: 7585 +.. nonce: vVWoc1 +.. section: Library + +getpass now properly flushes input before reading from stdin so that +existing input does not confuse it and lead to incorrect entry or an +IOError. It also properly flushes it afterwards to avoid the terminal +echoing the input afterwards on OSes such as Solaris. (See also: bpo-7208) + +.. + +.. bpo: 7233 +.. date: 7584 +.. nonce: Bfx5J4 +.. section: Library + +Fix a number of two-argument Decimal methods to make sure that they accept +an int or long as the second argument. Also fix buggy handling of large +arguments (those with coefficient longer than the current precision) in +shift and rotate. + +.. + +.. bpo: 4750 +.. date: 7583 +.. nonce: qsUXdQ +.. section: Library + +Store the basename of the original filename in the gzip FNAME header as +required by RFC 1952. + +.. + +.. bpo: 1180 +.. date: 7582 +.. nonce: ajrI93 +.. section: Library + +Added a new global option to ignore ~/.pydistutils.cfg in Distutils. + +.. + +.. bpo: 7218 +.. date: 7581 +.. nonce: _fm9R5 +.. section: Library + +Fix test_site for win32, the directory comparison was done with an +uppercase. + +.. + +.. bpo: 7205 +.. date: 7580 +.. nonce: QiP1X- +.. section: Library + +Fix a possible deadlock when using a BZ2File object from several threads at +once. + +.. + +.. bpo: 7071 +.. date: 7579 +.. nonce: QFsV-G +.. section: Library + +byte-compilation in Distutils is now done with respect to +sys.dont_write_bytecode. + +.. + +.. bpo: 7066 +.. date: 7578 +.. nonce: FQTn5e +.. section: Library + +archive_util.make_archive now restores the cwd if an error is raised. +Initial patch by Ezio Melotti. + +.. + +.. bpo: 6218 +.. date: 7577 +.. nonce: GFU36I +.. section: Library + +io.StringIO and io.BytesIO instances are now picklable with protocol 2. + +.. + +.. bpo: 7077 +.. date: 7576 +.. nonce: NfTfRo +.. section: Library + +logging: SysLogHandler now treats Unicode as per RFC 5424. + +.. + +.. bpo: 7099 +.. date: 7575 +.. nonce: fxh-zw +.. section: Library + +Decimal.is_normal now returns True for numbers with exponent larger than +emax. + +.. + +.. bpo: 5833 +.. date: 7574 +.. nonce: bCmU3a +.. section: Library + +Fix extra space character in readline completion with the GNU readline +library version 6.0. + +.. + +.. bpo: 7133 +.. date: 7573 +.. nonce: m6rxoT +.. section: Library + +SSL objects now support the new buffer API. + +.. + +.. bpo: 7149 +.. date: 7572 +.. nonce: J_eq7B +.. section: Library + +urllib fails on OSX in the proxy detection code. + +.. + +.. bpo: 7069 +.. date: 7571 +.. nonce: v9P7a0 +.. section: Library + +Make inspect.isabstract() return a boolean. + +.. + +.. bpo: 0 +.. date: 7570 +.. nonce: mxZpdI +.. section: Library + +Add support to the ``ihooks`` module for relative imports. + +.. + +.. bpo: 6894 +.. date: 7569 +.. nonce: 1peOts +.. section: Library + +Fixed the issue urllib2 doesn't respect "no_proxy" environment. + +.. + +.. bpo: 7086 +.. date: 7568 +.. nonce: mZidvN +.. section: Library + +Added TCP support to SysLogHandler, and tidied up some anachronisms in the +code which were a relic of 1.5.2 compatibility. + +.. + +.. bpo: 7082 +.. date: 7567 +.. nonce: 0CSJXy +.. section: Library + +When falling back to the MIME 'name' parameter, the correct place to look +for it is the Content-Type header. + +.. + +.. bpo: 7048 +.. date: 7566 +.. nonce: TXR5Xr +.. section: Library + +Force Decimal.logb to round its result when that result is too large to fit +in the current precision. + +.. + +.. bpo: 6516 +.. date: 7565 +.. nonce: omgsNx +.. section: Library + +Added owner/group support when creating tar archives in Distutils. + +.. + +.. bpo: 7031 +.. date: 7564 +.. nonce: n09dXD +.. section: Library + +Add ``TestCase.assert(Not)IsInstance()`` methods. + +.. + +.. bpo: 6790 +.. date: 7563 +.. nonce: Z8U9rk +.. section: Library + +Make it possible again to pass an ``array.array`` to +``httplib.HTTPConnection.send``. Patch by Kirk McDonald. + +.. + +.. bpo: 6236 +.. date: 7562 +.. nonce: cfUWek +.. section: Library + +Fix various failures in the `io` module under AIX and other platforms, when +using a non-gcc compiler. Patch by egreen. (See also: bpo-6348) + +.. + +.. bpo: 6954 +.. date: 7561 +.. nonce: Xr-JVf +.. section: Library + +Fixed crash when using DISTUTILS_DEBUG flag in Distutils. + +.. + +.. bpo: 6851 +.. date: 7560 +.. nonce: Hvzfi2 +.. section: Library + +Fix urllib.urlopen crash on secondairy threads on OSX 10.6 + +.. + +.. bpo: 4606 +.. date: 7559 +.. nonce: mPxDNW +.. section: Library + +Passing 'None' if ctypes argtype is set to POINTER(...) does now always +result in NULL. + +.. + +.. bpo: 5042 +.. date: 7558 +.. nonce: eHTDqZ +.. section: Library + +ctypes Structure sub-subclass does now initialize correctly with base class +positional arguments. + +.. + +.. bpo: 6938 +.. date: 7557 +.. nonce: qq4x0H +.. section: Library + +Fix a TypeError in string formatting of a multiprocessing debug message. + +.. + +.. bpo: 6635 +.. date: 7556 +.. nonce: hMzo5g +.. section: Library + +Fix profiler printing usage message. + +.. + +.. bpo: 6856 +.. date: 7555 +.. nonce: pxRVCd +.. section: Library + +Add a filter keyword argument to TarFile.add(). + +.. + +.. bpo: 6163 +.. date: 7554 +.. nonce: RIBPzi +.. section: Library + +Fixed HP-UX runtime library dir options in distutils.unixcompiler. Initial +patch by Sridhar Ratnakumar and Michael Haubenwallner. + +.. + +.. bpo: 6857 +.. date: 7553 +.. nonce: HdfUqZ +.. section: Library + +Default format() alignment should be '>' for Decimal instances. + +.. + +.. bpo: 6795 +.. date: 7552 +.. nonce: q74KXT +.. section: Library + +int(Decimal('nan')) now raises ValueError instead of returning NaN or +raising InvalidContext. Also, fix infinite recursion in +long(Decimal('nan')). + +.. + +.. bpo: 6850 +.. date: 7551 +.. nonce: qs_7UF +.. section: Library + +Fix bug in Decimal._parse_format_specifier for formats with no type +specifier. + +.. + +.. bpo: 4937 +.. date: 7550 +.. nonce: q3smbI +.. section: Library + +plat-mac/bundlebuilder refers to non-existing version.plist. + +.. + +.. bpo: 6838 +.. date: 7549 +.. nonce: OOrAC0 +.. section: Library + +Use a list to accumulate the value instead of repeatedly concatenating +strings in httplib's HTTPResponse._read_chunked providing a significant +speed increase when downloading large files servend with a Transfer-Encoding +of 'chunked'. + +.. + +.. bpo: 5275 +.. date: 7548 +.. nonce: -iW5eK +.. section: Library + +In Cookie's Cookie.load(), properly handle non-string arguments as +documented. + +.. + +.. bpo: 2666 +.. date: 7547 +.. nonce: XO1rSx +.. section: Library + +Handle BROWSER environment variable properly for unknown browser names in +the webbrowser module. + +.. + +.. bpo: 6054 +.. date: 7546 +.. nonce: 593-Mx +.. section: Library + +Do not normalize stored pathnames in tarfile. + +.. + +.. bpo: 6794 +.. date: 7545 +.. nonce: k5-rmk +.. section: Library + +Fix Decimal.compare_total and Decimal.compare_total_mag: NaN payloads are +now ordered by integer value rather than lexicographically. + +.. + +.. bpo: 6693 +.. date: 7544 +.. nonce: _dWH_f +.. section: Library + +New functions in site.py to get user/global site packages paths. + +.. + +.. bpo: 0 +.. date: 7543 +.. nonce: tZF7Ai +.. section: Library + +The thread.lock type now supports weak references. + +.. + +.. bpo: 1356969 +.. date: 7542 +.. nonce: fTwnvR +.. section: Library + +Add missing info methods in Tix.HList. + +.. + +.. bpo: 1522587 +.. date: 7541 +.. nonce: z2n84F +.. section: Library + +New constants and methods for the Tix.Grid widget. + +.. + +.. bpo: 1250469 +.. date: 7540 +.. nonce: Mbak0x +.. section: Library + +Fix the return value of Tix.PanedWindow.panes. + +.. + +.. bpo: 1119673 +.. date: 7539 +.. nonce: rSCSoq +.. section: Library + +Do not override Tkinter.Text methods when creating a ScrolledText. + +.. + +.. bpo: 6665 +.. date: 7538 +.. nonce: 4ep0tD +.. section: Library + +Fix fnmatch to properly match filenames with newlines in them. + +.. + +.. bpo: 1135 +.. date: 7537 +.. nonce: 3A5Z-R +.. section: Library + +Add the XView and YView mix-ins to avoid duplicating the xview* and yview* +methods. + +.. + +.. bpo: 6629 +.. date: 7536 +.. nonce: 095djT +.. section: Library + +Fix a data corruption issue in the new `io` package, which could occur when +writing to a BufferedRandom object (e.g. a file opened in "rb+" or "wb+" +mode) after having buffered a certain amount of data for reading. This bug +was not present in the pure Python implementation. + +.. + +.. bpo: 4660 +.. date: 7535 +.. nonce: xyTC5J +.. section: Library + +If a multiprocessing.JoinableQueue.put() was preempted, it was possible to +get a spurious 'task_done() called too many times' error. + +.. + +.. bpo: 1628205 +.. date: 7534 +.. nonce: Bkm9lB +.. section: Library + +Socket file objects returned by socket.socket.makefile() now properly +handles EINTR within the read, readline, write & flush methods. The +socket.sendall() method now properly handles interrupted system calls. + +.. + +.. bpo: 6595 +.. date: 7533 +.. nonce: 5kBbXa +.. section: Library + +The Decimal constructor now allows arbitrary Unicode decimal digits in +input, as recommended by the standard. Previously it was restricted to +accepting [0-9]. + +.. + +.. bpo: 6511 +.. date: 7532 +.. nonce: Qzfkov +.. section: Library + +ZipFile now raises BadZipfile (instead of an IOError) when opening an empty +or very small file. + +.. + +.. bpo: 6553 +.. date: 7531 +.. nonce: Tr4HDD +.. section: Library + +Fixed a crash in cPickle.load(), when given a file-like object containing +incomplete data. + +.. + +.. bpo: 6545 +.. date: 7530 +.. nonce: q91_KL +.. section: Library + +Removed assert statements in distutils.Extension, so the behavior is similar +when used with -O. + +.. + +.. bpo: 0 +.. date: 7529 +.. nonce: QiwXfr +.. section: Library + +unittest has been split up into a package. All old names should still work. + +.. + +.. bpo: 6431 +.. date: 7528 +.. nonce: tKBkPb +.. section: Library + +Make Fraction type return NotImplemented when it doesn't know how to handle +a comparison without loss of precision. Also add correct handling of +infinities and nans for comparisons with float. + +.. + +.. bpo: 6415 +.. date: 7527 +.. nonce: QOMg1q +.. section: Library + +Fixed warnings.warn segfault on bad formatted string. + +.. + +.. bpo: 6466 +.. date: 7526 +.. nonce: j5IKKm +.. section: Library + +Now distutils.cygwinccompiler and distutils.emxccompiler uses the same +refactored function to get gcc/ld/dllwrap versions numbers. It's +``distutils.util.get_compiler_versions()``. Added deprecation warnings for +the obsolete get_versions() functions. + +.. + +.. bpo: 6433 +.. date: 7525 +.. nonce: FJUeBp +.. section: Library + +Fixed issues with multiprocessing.pool.map hanging on empty list. + +.. + +.. bpo: 6314 +.. date: 7524 +.. nonce: oq2Uzy +.. section: Library + +logging: Extra checks on the "level" argument in more places. + +.. + +.. bpo: 2622 +.. date: 7523 +.. nonce: khlgNf +.. section: Library + +Fixed an ImportError when importing email.messsage from a standalone +application built with py2exe or py2app. + +.. + +.. bpo: 6455 +.. date: 7522 +.. nonce: xHz4mF +.. section: Library + +Fixed test_build_ext under win32. + +.. + +.. bpo: 6377 +.. date: 7521 +.. nonce: Or-Jam +.. section: Library + +Enabled the compiler option, and deprecate its usage as an attribute. + +.. + +.. bpo: 6413 +.. date: 7520 +.. nonce: dVuHyQ +.. section: Library + +Fixed the log level in distutils.dist for announce. + +.. + +.. bpo: 3392 +.. date: 7519 +.. nonce: M_DdFb +.. section: Library + +The subprocess communicate() method no longer fails in select() when file +descriptors are large; communicate() now uses poll() when possible. + +.. + +.. bpo: 6403 +.. date: 7518 +.. nonce: kDwSzy +.. section: Library + +Fixed package path usage in build_ext. + +.. + +.. bpo: 5155 +.. date: 7517 +.. nonce: G_HFri +.. section: Library + +multiprocessing.Process._bootstrap was unconditionally calling +"os.close(sys.stdin.fileno())" resulting in file descriptor errors. (See +also: bpo-5313, bpo-5331) + +.. + +.. bpo: 6365 +.. date: 7516 +.. nonce: eWJ_Cl +.. section: Library + +Distutils build_ext inplace mode was copying the compiled extension in a +subdirectory if the extension name had dots. + +.. + +.. bpo: 6344 +.. date: 7515 +.. nonce: l35xXH +.. section: Library + +Fixed a crash of mmap.read() when passed a negative argument. + +.. + +.. bpo: 5230 +.. date: 7514 +.. nonce: EhUbpW +.. section: Library + +pydoc would report no documentation found if a module generated a 'not +found' import error when loaded; it now reports the import errors. Thanks to +Lucas Prado Melo for initial fix and collaboration on the tests. + +.. + +.. bpo: 6314 +.. date: 7513 +.. nonce: g55uyy +.. section: Library + +``logging.basicConfig()`` performs extra checks on the "level" argument. + +.. + +.. bpo: 6164 +.. date: 7512 +.. nonce: 6QByEi +.. section: Library + +Added an AIX specific linker argument in Distutils unixcompiler. Original +patch by Sridhar Ratnakumar. + +.. + +.. bpo: 6274 +.. date: 7511 +.. nonce: eQoMPr +.. section: Library + +Fixed possible file descriptors leak in subprocess.py. + +.. + +.. bpo: 6189 +.. date: 7510 +.. nonce: aY-0-v +.. section: Library + +Restored compatibility of subprocess.py with Python 2.2. + +.. + +.. bpo: 6287 +.. date: 7509 +.. nonce: i5loQG +.. section: Library + +Added the license field in Distutils documentation. + +.. + +.. bpo: 6286 +.. date: 7508 +.. nonce: j2u4Wn +.. section: Library + +Now Distutils upload command is based on urllib2 instead of httplib, +allowing the usage of http_proxy. + +.. + +.. bpo: 6271 +.. date: 7507 +.. nonce: nMZxcE +.. section: Library + +mmap tried to close invalid file handle (-1) for anonymous maps on Unix. + +.. + +.. bpo: 6215 +.. date: 7506 +.. nonce: e-D-t7 +.. section: Library + +All bug fixes and enhancements from the Python 3.1 io library (including the +fast C implementation) have been backported to the standard ``io`` module. + +.. + +.. bpo: 6258 +.. date: 7505 +.. nonce: dwBSws +.. section: Library + +Support AMD64 in bdist_msi. + +.. + +.. bpo: 6252 +.. date: 7504 +.. nonce: sYTPyU +.. section: Library + +Fixed bug in next rollover time computation in TimedRotatingFileHandler. + +.. + +.. bpo: 6263 +.. date: 7503 +.. nonce: 5RhZzP +.. section: Library + +Fixed syntax error in distutils.cygwincompiler. + +.. + +.. bpo: 5201 +.. date: 7502 +.. nonce: Wt3Orj +.. section: Library + +distutils.sysconfig.parse_makefile() now understands ``$$`` in Makefiles. +This prevents compile errors when using syntax like: +``LDFLAGS='-rpath=\$$LIB:/some/other/path'``. Patch by Floris Bruynooghe. + +.. + +.. bpo: 5767 +.. date: 7501 +.. nonce: N_vQVh +.. section: Library + +Removed sgmlop support from xmlrpclib. + +.. + +.. bpo: 6131 +.. date: 7500 +.. nonce: yV_s9j +.. section: Library + +test_modulefinder leaked when run after test_distutils. Patch by Hirokazu +Yamamoto. + +.. + +.. bpo: 6048 +.. date: 7499 +.. nonce: 8c4ttr +.. section: Library + +Now Distutils uses the tarfile module in archive_util. + +.. + +.. bpo: 6121 +.. date: 7498 +.. nonce: u-IDuG +.. section: Library + +pydoc now ignores leading and trailing spaces in the argument to the 'help' +function. + +.. + +.. bpo: 0 +.. date: 7497 +.. nonce: zlEDRS +.. section: Library + +In unittest, using a skipping decorator on a class is now equivalent to +skipping every test on the class. The ClassTestSuite class has been +removed. + +.. + +.. bpo: 6050 +.. date: 7496 +.. nonce: tl_8xc +.. section: Library + +Don't fail extracting a directory from a zipfile if the directory already +exists. + +.. + +.. bpo: 5311 +.. date: 7495 +.. nonce: 0oOK6H +.. section: Library + +bdist_msi can now build packages that do not depend on a specific Python +version. + +.. + +.. bpo: 1309352 +.. date: 7494 +.. nonce: WM3egI +.. section: Library + +fcntl now converts its third arguments to a C `long` rather than an int, +which makes some operations possible under 64-bit Linux (e.g. DN_MULTISHOT +with F_NOTIFY). + +.. + +.. bpo: 1424152 +.. date: 7493 +.. nonce: ajujge +.. section: Library + +Fix for httplib, urllib2 to support SSL while working through proxy. +Original patch by Christopher Li, changes made by Senthil Kumaran. + +.. + +.. bpo: 1983 +.. date: 7492 +.. nonce: 4NQtSC +.. section: Library + +Fix functions taking or returning a process identifier to use the dedicated +C type ``pid_t`` instead of a C ``int``. Some platforms have a process +identifier type wider than the standard C integer type. + +.. + +.. bpo: 4066 +.. date: 7491 +.. nonce: 2iOjZ9 +.. section: Library + +smtplib.SMTP_SSL._get_socket now correctly returns the socket. Patch by +Farhan Ahmad, test by Marcin Bachry. + +.. + +.. bpo: 6062 +.. date: 7490 +.. nonce: 9WLZ5z +.. section: Library + +In distutils, fixed the package option of build_ext. Feedback and tests on +pywin32 by Tim Golden. + +.. + +.. bpo: 6053 +.. date: 7489 +.. nonce: WvTL0w +.. section: Library + +Fixed distutils tests on win32. Patch by Hirokazu Yamamoto. + +.. + +.. bpo: 6046 +.. date: 7488 +.. nonce: cMZ2Tc +.. section: Library + +Fixed the library extension when distutils build_ext is used in place. +Initial patch by Roumen Petrov. + +.. + +.. bpo: 6041 +.. date: 7487 +.. nonce: sw57bD +.. section: Library + +Now distutils `sdist` and `register` commands use `check` as a subcommand. + +.. + +.. bpo: 2116 +.. date: 7486 +.. nonce: 8p8xN6 +.. section: Library + +Weak references and weak dictionaries now support copy()ing and +deepcopy()ing. + +.. + +.. bpo: 1655 +.. date: 7485 +.. nonce: M-5sGT +.. section: Library + +Make imaplib IPv6-capable. Patch by Derek Morr. + +.. + +.. bpo: 5918 +.. date: 7484 +.. nonce: x-8Oxl +.. section: Library + +Fix a crash in the parser module. + +.. + +.. bpo: 1664 +.. date: 7483 +.. nonce: sRl46y +.. section: Library + +Make nntplib IPv6-capable. Patch by Derek Morr. + +.. + +.. bpo: 6022 +.. date: 7482 +.. nonce: Y3dUhe +.. section: Library + +A test file was created in the current working directory by test_get_outputs +in Distutils. + +.. + +.. bpo: 4050 +.. date: 7481 +.. nonce: mjHlfF +.. section: Library + +inspect.findsource/getsource now raise an IOError if the 'source' file is a +binary. Patch by Brodie Rao, tests by Daniel Diniz. + +.. + +.. bpo: 5977 +.. date: 7480 +.. nonce: xcP2Su +.. section: Library + +distutils build_ext.get_outputs was not taking into account the inplace +option. Initial patch by kxroberto. + +.. + +.. bpo: 5984 +.. date: 7479 +.. nonce: evqxbf +.. section: Library + +distutils.command.build_ext.check_extensions_list checks were broken for +old-style extensions. + +.. + +.. bpo: 5971 +.. date: 7478 +.. nonce: IQW2NO +.. section: Library + +StreamHandler.handleError now swallows IOErrors which occur when trying to +print a traceback. + +.. + +.. bpo: 5976 +.. date: 7477 +.. nonce: 01_dSR +.. section: Library + +Fixed Distutils test_check_environ. + +.. + +.. bpo: 5900 +.. date: 7476 +.. nonce: uMqjsO +.. section: Library + +Ensure RUNPATH is added to extension modules with RPATH if GNU ld is used. +Original patch by Floris Bruynooghe. + +.. + +.. bpo: 5941 +.. date: 7475 +.. nonce: Xdk_6Y +.. section: Library + +Distutils build_clib command was not working anymore because of an +incomplete customization of the archiver command. Added ARFLAGS in the +Makefile besides AR and make Distutils use it. Original patch by David +Cournapeau. + +.. + +.. bpo: 5955 +.. date: 7474 +.. nonce: rZM3XY +.. section: Library + +aifc's close method did not close the file it wrapped, now it does. This +also means getfp method now returns the real fp. + +.. + +.. bpo: 4875 +.. date: 7473 +.. nonce: lozHFb +.. section: Library + +On win32, ctypes.util.find_library does no longer return directories. + +.. + +.. bpo: 5142 +.. date: 7472 +.. nonce: XGXII1 +.. section: Library + +Add the ability to skip modules while stepping to pdb. + +.. + +.. bpo: 1309567 +.. date: 7471 +.. nonce: wcqooN +.. section: Library + +Fix linecache behavior of stripping subdirectories when looking for files +given by a relative filename. + +.. + +.. bpo: 5692 +.. date: 7470 +.. nonce: XbbGod +.. section: Library + +In ``zipfile.Zipfile``, fix wrong path calculation when extracting a file to +the root directory. + +.. + +.. bpo: 5913 +.. date: 7469 +.. nonce: Gg7oAA +.. section: Library + +``os.listdir()`` should fail for empty path on windows. + +.. + +.. bpo: 5084 +.. date: 7468 +.. nonce: 28LIEg +.. section: Library + +Unpickling now interns the attribute names of pickled objects, saving memory +and avoiding growth in size of subsequent pickles. Proposal and original +patch by Jake McGuire. + +.. + +.. bpo: 3002 +.. date: 7467 +.. nonce: Q2Bwlw +.. section: Library + +``shutil.copyfile()`` and ``shutil.copytree()`` now raise an error when a +named pipe is encountered, rather than blocking infinitely. + +.. + +.. bpo: 3959 +.. date: 7466 +.. nonce: JOcNpv +.. section: Library + +The ipaddr module has been added to the standard library. Contributed by +Google. + +.. + +.. bpo: 2245 +.. date: 7465 +.. nonce: wM6yIG +.. section: Library + +aifc now skips chunk types it doesn't recognize, per spec. + +.. + +.. bpo: 5874 +.. date: 7464 +.. nonce: Wrh4pp +.. section: Library + +distutils.tests.test_config_cmd is not locale-sensitive anymore. + +.. + +.. bpo: 4305 +.. date: 7463 +.. nonce: yHp6W2 +.. section: Library + +ctypes should now build again on mipsel-linux-gnu + +.. + +.. bpo: 1734234 +.. date: 7462 +.. nonce: I3S_a6 +.. section: Library + +Massively speedup ``unicodedata.normalize()`` when the string is already in +normalized form, by performing a quick check beforehand. Original patch by +Rauli Ruohonen. + +.. + +.. bpo: 5853 +.. date: 7461 +.. nonce: oKokIP +.. section: Library + +Calling a function of the mimetypes module from several threads at once +could hit the recursion limit if the mimetypes database hadn't been +initialized before. + +.. + +.. bpo: 5854 +.. date: 7460 +.. nonce: 8o0llM +.. section: Library + +Updated __all__ to include some missing names and remove some names which +should not be exported. + +.. + +.. bpo: 5810 +.. date: 7459 +.. nonce: LFr2OK +.. section: Library + +Fixed Distutils test_build_scripts so it uses +``sysconfig.get_config_vars()``. + +.. + +.. bpo: 4951 +.. date: 7458 +.. nonce: 9eKc7j +.. section: Library + +Fixed failure in test_httpservers. + +.. + +.. bpo: 3102 +.. date: 7457 +.. nonce: LDgk6Z +.. section: Library + +All global symbols that the _ctypes extension defines are now prefixed with +'Py' or '_ctypes'. + +.. + +.. bpo: 5041 +.. date: 7456 +.. nonce: 8SM2Q6 +.. section: Library + +ctypes does now allow pickling wide character. + +.. + +.. bpo: 5812 +.. date: 7455 +.. nonce: DG4u35 +.. section: Library + +For the two-argument form of the Fraction constructor, ``Fraction(m, n)``, m +and n are permitted to be arbitrary Rational instances. + +.. + +.. bpo: 5812 +.. date: 7454 +.. nonce: bdeIy6 +.. section: Library + +Fraction('1e6') is valid: more generally, any string that's valid for +float() is now valid for Fraction(), with the exception of strings +representing NaNs and infinities. + +.. + +.. bpo: 5795 +.. date: 7453 +.. nonce: _5SXcu +.. section: Library + +Fixed test_distutils failure on Debian ppc. + +.. + +.. bpo: 5768 +.. date: 7452 +.. nonce: Lx3FBy +.. section: Library + +Fixed bug in Unicode output logic and test case for same. + +.. + +.. bpo: 1161031 +.. date: 7451 +.. nonce: vIHCeg +.. section: Library + +Fix readwrite select flag handling: POLLPRI now results in a +handle_expt_event call, not handle_read_event, and POLLERR and POLLNVAL now +call handle_close, not handle_expt_event. Also, dispatcher now has an +'ignore_log_types' attribute for suppressing log messages, which is set to +'warning' by default. + +.. + +.. bpo: 5607 +.. date: 7450 +.. nonce: GlYpK6 +.. section: Library + +Fixed Distutils test_get_platform for Mac OS X fat binaries. + +.. + +.. bpo: 5741 +.. date: 7449 +.. nonce: sKDQuN +.. section: Library + +Don't disallow "%%" (which is an escape for "%") when setting a value in +SafeConfigParser. + +.. + +.. bpo: 5732 +.. date: 7448 +.. nonce: BxEaO_ +.. section: Library + +Added a new command in Distutils: check. + +.. + +.. bpo: 5731 +.. date: 7447 +.. nonce: tCA4Qq +.. section: Library + +Distutils bdist_wininst no longer worked on non-Windows platforms. Initial +patch by Paul Moore. + +.. + +.. bpo: 2254 +.. date: 7446 +.. nonce: XwszLk +.. section: Library + +Fix CGIHTTPServer information disclosure. Relative paths are now collapsed +within the url properly before looking in cgi_directories. + +.. + +.. bpo: 5095 +.. date: 7445 +.. nonce: xiSRDz +.. section: Library + +Added bdist_msi to the list of bdist supported formats. Initial fix by +Steven Bethard. + +.. + +.. bpo: 1491431 +.. date: 7444 +.. nonce: aNp23F +.. section: Library + +Fixed distutils.filelist.glob_to_re for edge cases. Initial fix by Wayne +Davison. + +.. + +.. bpo: 5693 +.. date: 7443 +.. nonce: M0PEHJ +.. section: Library + +TestSuite.__iter__ can now be consistently overridden in subclasses. + +.. + +.. bpo: 5694 +.. date: 7442 +.. nonce: ZvKxFR +.. section: Library + +Removed spurious test output in Distutils (test_clean). + +.. + +.. bpo: 5471 +.. date: 7441 +.. nonce: BKf7Q4 +.. section: Library + +Fix os.path.expanduser() for $HOME set to '/'. + +.. + +.. bpo: 1326077 +.. date: 7440 +.. nonce: if0OW2 +.. section: Library + +Fix the formatting of SyntaxErrors by the traceback module. + +.. + +.. bpo: 1726172 +.. date: 7439 +.. nonce: e2vy9u +.. section: Library + +Fix IndexError in the case of and empty response in ftplib. + +.. + +.. bpo: 2625 +.. date: 7438 +.. nonce: _XRRkk +.. section: Library + +Added missing iteritems() call to the for loop in mailbox.MH.get_message(). + +.. + +.. bpo: 5585 +.. date: 7437 +.. nonce: YAZXyy +.. section: Library + +Add the ability to call an initializer to multiprocessing.manager so that +users can install custom handlers/etc. + +.. + +.. bpo: 3551 +.. date: 7436 +.. nonce: Cu6Cul +.. section: Library + +Patch multiprocessing to raise a proper exception if the size of the object +when writefile is called causes an ERROR_NO_SYSTEM_RESOURCES. Added docs to +note the limitation. + +.. + +.. bpo: 0 +.. date: 7435 +.. nonce: xAXTK2 +.. section: Library + +unittest.assertNotEqual() now uses the inequality operator (!=) instead of +the equality operator. + +.. + +.. bpo: 6001 +.. date: 7434 +.. nonce: oWiMFG +.. section: Library + +Test discovery for unittest. Implemented in unittest.TestLoader.discover and +from the command line. + +.. + +.. bpo: 5679 +.. date: 7433 +.. nonce: GDbJ3F +.. section: Library + +The methods unittest.TestCase.addCleanup and doCleanups were added. +addCleanup allows you to add cleanup functions that will be called +unconditionally (after setUp if setUp fails, otherwise after tearDown). This +allows for much simpler resource allocation and deallocation during tests. + +.. + +.. bpo: 3379 +.. date: 7432 +.. nonce: yfUkbC +.. section: Library + +unittest.main now takes an optional exit argument. If False main doesn't +call sys.exit allowing it to be used from the interactive interpreter. + +.. + +.. bpo: 5995 +.. date: 7431 +.. nonce: S0agLh +.. section: Library + +unittest.main now takes an optional verbosity argument allowing test modules +to be run with a higher than default verbosity. + +.. + +.. bpo: 5995 +.. date: 7430 +.. nonce: zjk0GI +.. section: Library + +A fix to allow you to run "python -m unittest test_module" or "python -m +unittest test_module.TestClass" from the command line. + +.. + +.. bpo: 5728 +.. date: 7429 +.. nonce: wPx88T +.. section: Library + +unittest.TestResult has new startTestRun and stopTestRun methods; called +immediately before and after a test run. + +.. + +.. bpo: 5663 +.. date: 7428 +.. nonce: FdiDuS +.. section: Library + +Better failure messages for unittest asserts. Default assertTrue and +assertFalse messages are now useful. TestCase has a longMessage attribute. +This defaults to False, but if set to True useful error messages are shown +in addition to explicit messages passed to assert methods. + +.. + +.. bpo: 3110 +.. date: 7427 +.. nonce: ybmLDs +.. section: Library + +Add additional protect around SEM_VALUE_MAX for multiprocessing. + +.. + +.. bpo: 0 +.. date: 7426 +.. nonce: PTlc4y +.. section: Library + +In Pdb, prevent the reassignment of __builtin__._ by sys.displayhook on +printing out values. + +.. + +.. bpo: 4572 +.. date: 7425 +.. nonce: yh5ziP +.. section: Library + +Added SEEK_* symbolic constants to io module. + +.. + +.. bpo: 1665206 +.. date: 7424 +.. nonce: 8AhGz1 +.. section: Library + +Move imports in cgitb to the top of the module instead of performing them in +functions. Helps prevent import deadlocking in threads. + +.. + +.. bpo: 5647 +.. date: 7423 +.. nonce: KPmSmW +.. section: Library + +MutableSet.__iand__() no longer mutates self during iteration. + +.. + +.. bpo: 0 +.. date: 7422 +.. nonce: t0Sm7D +.. section: Library + +Actually make the SimpleXMLRPCServer CGI handler work. + +.. + +.. bpo: 2522 +.. date: 7421 +.. nonce: TTa0fi +.. section: Library + +locale.format() now checks its first argument to ensure it has been passed +only one pattern, avoiding mysterious errors where it appeared that it was +failing to do localization. + +.. + +.. bpo: 5583 +.. date: 7420 +.. nonce: GNjR3y +.. section: Library + +Added optional extensions in Distutils. Initial patch by Georg Brandl. + +.. + +.. bpo: 5619 +.. date: 7419 +.. nonce: IkF1og +.. section: Library + +Multiprocessing children disobey the debug flag and causes popups on windows +buildbots. Patch applied to work around this issue. + +.. + +.. bpo: 5632 +.. date: 7418 +.. nonce: OcociP +.. section: Library + +Thread.ident was None for the main thread and threads not created with the +threading module. + +.. + +.. bpo: 5400 +.. date: 7417 +.. nonce: zmbm0t +.. section: Library + +Added patch for multiprocessing on netbsd compilation/support. + +.. + +.. bpo: 5387 +.. date: 7416 +.. nonce: uvZ11E +.. section: Library + +Fixed mmap.move crash by integer overflow. + +.. + +.. bpo: 5261 +.. date: 7415 +.. nonce: py6jc9 +.. section: Library + +Patch multiprocessing's semaphore.c to support context manager use: "with +multiprocessing.Lock()" works now. + +.. + +.. bpo: 5177 +.. date: 7414 +.. nonce: eRUMiM +.. section: Library + +Multiprocessing's SocketListener class now uses socket.SO_REUSEADDR on all +connections so that the user no longer needs to wait 120 seconds for the +socket to expire. + +.. + +.. bpo: 0 +.. date: 7413 +.. nonce: pFfCqO +.. section: Library + +Adjusted _tkinter to compile without warnings when WITH_THREAD is not +defined (part of issue #5035). + +.. + +.. bpo: 5561 +.. date: 7412 +.. nonce: 11jxV4 +.. section: Library + +Removed the sys.version_info shortcuts from platform's python_version() and +python_version_tuple() since they produced different output compared to +previous Python versions. + +.. + +.. bpo: 1034053 +.. date: 7411 +.. nonce: kAn84D +.. section: Library + +unittest now supports skipping tests and expected failures. + +.. + +.. bpo: 0 +.. date: 7410 +.. nonce: GHZyr1 +.. section: Library + +The unittest.TestCase.assertRaises() method now returns a context manager +when not given a callable so that code to be tested can be written inline +using a with statement. + +.. + +.. bpo: 2578 +.. date: 7409 +.. nonce: JvL31E +.. section: Library + +The unittest.TestCase.assertEqual() now displays the differences in lists, +tuples, dicts and sets on failure. Many new handy type and comparison +specific assert* methods have been added that fail with error messages +actually useful for debugging. Contributed in part by Google. + +.. + +.. bpo: 5068 +.. date: 7408 +.. nonce: MXgCgm +.. section: Library + +Fixed the tarfile._BZ2Proxy.read() method that would loop forever on +incomplete input. That caused tarfile.open() to hang when used with mode +'r' or 'r:bz2' and a fileobj argument that contained no data or partial +bzip2 compressed data. + +.. + +.. bpo: 5536 +.. date: 7407 +.. nonce: 9f--jv +.. section: Library + +urllib.urlretrieve makes sure to close the file it's writing to even if an +exception occurs. + +.. + +.. bpo: 5381 +.. date: 7406 +.. nonce: qzMSVP +.. section: Library + +Added object_pairs_hook to the json module. This allows OrderedDicts to be +built by the decoder. + +.. + +.. bpo: 2110 +.. date: 7405 +.. nonce: VVQTv0 +.. section: Library + +Add support for thousands separator and 'n' type specifier to +``Decimal.__format__()``. + +.. + +.. bpo: 0 +.. date: 7404 +.. nonce: E4kk25 +.. section: Library + +Fix Decimal.__format__ bug that swapped the meanings of the '<' and '>' +alignment characters. + +.. + +.. bpo: 1222 +.. date: 7403 +.. nonce: o6ET8T +.. section: Library + +``locale.format()`` bug when the thousands separator is a space character. + +.. + +.. bpo: 5472 +.. date: 7402 +.. nonce: y52FYs +.. section: Library + +Fixed distutils.test_util tear down. Original patch by Tim Golden. + +.. + +.. bpo: 0 +.. date: 7401 +.. nonce: 353Xjd +.. section: Library + +collections.deque objects now have a read-only attribute called maxlen. + +.. + +.. bpo: 2638 +.. date: 7400 +.. nonce: NX9HHb +.. section: Library + +Show a window constructed with tkSimpleDialog.Dialog only after it is has +been populated and properly configured in order to prevent window flashing. + +.. + +.. bpo: 4792 +.. date: 7399 +.. nonce: jK4Q6l +.. section: Library + +Prevent a segfault in _tkinter by using the guaranteed to be safe interp +argument given to the PythonCmd in place of the Tcl interpreter taken from a +PythonCmd_ClientData. + +.. + +.. bpo: 5193 +.. date: 7398 +.. nonce: cT2tgG +.. section: Library + +Guarantee that Tkinter.Text.search returns a string. + +.. + +.. bpo: 5394 +.. date: 7397 +.. nonce: i2Ffk- +.. section: Library + +Removed > 2.3 syntax from distutils.msvc9compiler. Original patch by Akira +Kitada. + +.. + +.. bpo: 5385 +.. date: 7396 +.. nonce: I6RMU3 +.. section: Library + +Fixed mmap crash after resize failure on windows. + +.. + +.. bpo: 5179 +.. date: 7395 +.. nonce: J-DtY4 +.. section: Library + +Fixed subprocess handle leak on failure on windows. + +.. + +.. bpo: 0 +.. date: 7394 +.. nonce: 7zHVyM +.. section: Library + +PEP 372: Added collections.OrderedDict(). + +.. + +.. bpo: 0 +.. date: 7393 +.. nonce: 7DzM2Y +.. section: Library + +The _asdict() for method for namedtuples now returns an OrderedDict(). + +.. + +.. bpo: 0 +.. date: 7392 +.. nonce: 4id7jq +.. section: Library + +The configparser module now defaults to using an ordered dictionary. + +.. + +.. bpo: 4308 +.. date: 7391 +.. nonce: 7O6QSe +.. section: Library + +httplib.IncompleteRead's repr doesn't include all of the data all ready +received. + +.. + +.. bpo: 5401 +.. date: 7390 +.. nonce: L67vEY +.. section: Library + +Fixed a performance problem in mimetypes when ``from mimetypes import +guess_extension`` was used. + +.. + +.. bpo: 1733986 +.. date: 7389 +.. nonce: v6ClaV +.. section: Library + +Fixed mmap crash on Windows in accessing elements of second map object with +same tagname but larger size than first map. + +.. + +.. bpo: 5386 +.. date: 7388 +.. nonce: Mfoc4E +.. section: Library + +mmap.write_byte didn't check map size, so it could cause buffer overrun. + +.. + +.. bpo: 1533164 +.. date: 7387 +.. nonce: oSDeo2 +.. section: Library + +Installed but not listed *.pyo was breaking Distutils bdist_rpm command. + +.. + +.. bpo: 5378 +.. date: 7386 +.. nonce: Nu7yhK +.. section: Library + +Added --quiet option to Distutils bdist_rpm command. + +.. + +.. bpo: 5052 +.. date: 7385 +.. nonce: tuRmM7 +.. section: Library + +Make Distutils compatible with 2.3 again. + +.. + +.. bpo: 0 +.. date: 7384 +.. nonce: i4QWFU +.. section: Library + +Deprecated methods of symtable.Symbol have been removed: is_keywordarg(), +is_vararg(), and is_in_tuple(). + +.. + +.. bpo: 5316 +.. date: 7383 +.. nonce: gdWjbL +.. section: Library + +Fixed buildbot failures introduced by multiple inheritance in Distutils +tests. + +.. + +.. bpo: 5287 +.. date: 7382 +.. nonce: m3xQet +.. section: Library + +Add exception handling around findCaller() call to help out IronPython. + +.. + +.. bpo: 5282 +.. date: 7381 +.. nonce: oc64yd +.. section: Library + +Fixed mmap resize on 32bit Windows and Unix. When ``offset > 0``, the file +was resized to wrong size. + +.. + +.. bpo: 5292 +.. date: 7380 +.. nonce: K-iKkZ +.. section: Library + +Fixed mmap crash on its boundary access m[len(m)]. + +.. + +.. bpo: 2279 +.. date: 7379 +.. nonce: T7t8d0 +.. section: Library + +distutils.sdist.add_defaults now add files from the package_data and the +data_files metadata. + +.. + +.. bpo: 5257 +.. date: 7378 +.. nonce: asNrGx +.. section: Library + +Refactored all tests in distutils, so they use support.TempdirManager, to +avoid writing in the tests directory. + +.. + +.. bpo: 4524 +.. date: 7377 +.. nonce: Y3L_fh +.. section: Library + +distutils build_script command failed with --with-suffix=3. Initial patch by +Amaury Forgeot d'Arc. + +.. + +.. bpo: 2461 +.. date: 7376 +.. nonce: RD653P +.. section: Library + +Added tests for distutils.util. + +.. + +.. bpo: 1008086 +.. date: 7375 +.. nonce: BbViq- +.. section: Library + +Fixed socket.inet_aton() to always return 4 bytes even on LP64 platforms +(most 64-bit Linux, bsd, unix systems). + +.. + +.. bpo: 5203 +.. date: 7374 +.. nonce: _dsCYh +.. section: Library + +Fixed ctypes segfaults when passing a unicode string to a function without +argtypes (only occurs if HAVE_USABLE_WCHAR_T is false). + +.. + +.. bpo: 3386 +.. date: 7373 +.. nonce: KG-Ru5 +.. section: Library + +distutils.sysconfig.get_python_lib prefix argument was ignored under NT and +OS2. Patch by Philip Jenvey. + +.. + +.. bpo: 5128 +.. date: 7372 +.. nonce: RLP-Ij +.. section: Library + +Make compileall properly inspect bytecode to determine if needs to be +recreated. This avoids a timing hole thanks to the old reliance on the +ctime of the files involved. + +.. + +.. bpo: 5122 +.. date: 7371 +.. nonce: 45BIdZ +.. section: Library + +Synchronize tk load failure check to prevent a potential deadlock. + +.. + +.. bpo: 1818 +.. date: 7370 +.. nonce: _i2lg8 +.. section: Library + +collections.namedtuple() now supports a keyword argument 'rename' which lets +invalid fieldnames be automatically converted to positional names in the +form, _1, _2, ... + +.. + +.. bpo: 4890 +.. date: 7369 +.. nonce: frM5Ou +.. section: Library + +Handle empty text search pattern in Tkinter.Text.search. + +.. + +.. bpo: 5170 +.. date: 7368 +.. nonce: qiqrbO +.. section: Library + +Fixed Unicode output bug in logging and added test case. This is a +regression which did not occur in 2.5. + +.. + +.. bpo: 4512 +.. date: 7367 +.. nonce: WCcn7w +.. section: Library + +Promote ``ZipImporter._get_filename()`` to be a public documented method +``ZipImporter.get_filename()``. + +.. + +.. bpo: 4195 +.. date: 7366 +.. nonce: 462RKE +.. section: Library + +The ``runpy`` module (and the ``-m`` switch) now support the execution of +packages by looking for and executing a ``__main__`` submodule when a +package name is supplied. Initial patch by Andi Vajda. + +.. + +.. bpo: 1731706 +.. date: 7365 +.. nonce: WZ5WX5 +.. section: Library + +Call Tcl_ConditionFinalize for Tcl_Conditions that will not be used again +(this requires Tcl/Tk 8.3.1), also fix a memory leak in Tkapp_Call when +calling from a thread different than the one that created the Tcl +interpreter. Patch by Robert Hancock. + +.. + +.. bpo: 1520877 +.. date: 7364 +.. nonce: 8L5pMp +.. section: Library + +Now distutils.sysconfig reads $AR from the environment/Makefile. Patch by +Douglas Greiman. + +.. + +.. bpo: 4285 +.. date: 7363 +.. nonce: 3vlvS6 +.. section: Library + +Change sys.version_info to be a named tuple. Patch by Ross Light. + +.. + +.. bpo: 1276768 +.. date: 7362 +.. nonce: xGRlK_ +.. section: Library + +The verbose option was not used in the code of distutils.file_util and +distutils.dir_util. + +.. + +.. bpo: 5132 +.. date: 7361 +.. nonce: lYsgxj +.. section: Library + +Fixed trouble building extensions under Solaris with --enabled-shared +activated. Initial patch by Dave Peterson. + +.. + +.. bpo: 1581476 +.. date: 7360 +.. nonce: 8PPtxr +.. section: Library + +Always use the Tcl global namespace when calling into Tcl. + +.. + +.. bpo: 2047 +.. date: 7359 +.. nonce: W29q2y +.. section: Library + +shutil.move() could believe that its destination path was inside its source +path if it began with the same letters (e.g. "src" vs. "src.new"). + +.. + +.. bpo: 4920 +.. date: 7358 +.. nonce: 4C6Tka +.. section: Library + +Fixed .next() vs .__next__() issues in the ABCs for Iterator and MutableSet. + +.. + +.. bpo: 0 +.. date: 7357 +.. nonce: St1AK1 +.. section: Library + +Added the ttk module. See issue #2983: Ttk support for Tkinter. + +.. + +.. bpo: 5021 +.. date: 7356 +.. nonce: w66Gt4 +.. section: Library + +doctest.testfile() did not create __name__ and collections.namedtuple() +relied on __name__ being defined. + +.. + +.. bpo: 0 +.. date: 7355 +.. nonce: iqhL-t +.. section: Library + +Backport importlib from Python 3.1. Only the import_module() function has +been backported to help facilitate transitions from 2.7 to 3.1. + +.. + +.. bpo: 1885 +.. date: 7354 +.. nonce: PtaVKd +.. section: Library + +distutils: When running sdist with --formats=tar,gztar the tar file was +overridden by the gztar one. + +.. + +.. bpo: 4863 +.. date: 7353 +.. nonce: WAd1yO +.. section: Library + +distutils.mwerkscompiler has been removed. + +.. + +.. bpo: 0 +.. date: 7352 +.. nonce: N87zoU +.. section: Library + +Added new itertools functions: combinations_with_replacement() and +compress(). + +.. + +.. bpo: 5032 +.. date: 7351 +.. nonce: Hc_HF9 +.. section: Library + +Added a step argument to itertools.count() and allowed non-integer +arguments. + +.. + +.. bpo: 0 +.. date: 7350 +.. nonce: htGT5q +.. section: Library + +Fix and properly document the multiprocessing module's logging support, +expose the internal levels and provide proper usage examples. + +.. + +.. bpo: 1672332 +.. date: 7349 +.. nonce: PilXzF +.. section: Library + +Fix unpickling of subnormal floats, which was producing a ValueError on some +platforms. + +.. + +.. bpo: 3881 +.. date: 7348 +.. nonce: bIWN64 +.. section: Library + +Help Tcl to load even when started through the unreadable local symlink to +"Program Files" on Vista. + +.. + +.. bpo: 4710 +.. date: 7347 +.. nonce: ZjbAFp +.. section: Library + +Extract directories properly in the zipfile module; allow adding directories +to a zipfile. + +.. + +.. bpo: 3807 +.. date: 7346 +.. nonce: E4I458 +.. section: Library + +_multiprocessing build fails when configure is passed --without-threads +argument. When this occurs, _multiprocessing will be disabled, and not +compiled. + +.. + +.. bpo: 5008 +.. date: 7345 +.. nonce: n1uR4V +.. section: Library + +When a file is opened in append mode with the new IO library, do an explicit +seek to the end of file (so that e.g. tell() returns the file size rather +than 0). This is consistent with the behaviour of the traditional 2.x file +object. + +.. + +.. bpo: 5013 +.. date: 7344 +.. nonce: AZ9WNo +.. section: Library + +Fixed a bug in FileHandler which occurred when the delay parameter was set. + +.. + +.. bpo: 4998 +.. date: 7343 +.. nonce: AomdSw +.. section: Library + +The memory saving effect of __slots__ had been lost on Fractions which +inherited from numbers.py which did not have __slots__ defined. The numbers +hierarchy now has its own __slots__ declarations. + +.. + +.. bpo: 3321 +.. date: 7342 +.. nonce: 4gfMOk +.. section: Library + +_multiprocessing.Connection() doesn't check handle; added checks for *nix +machines for negative handles and large int handles. Without this check it +is possible to segfault the interpreter. + +.. + +.. bpo: 4449 +.. date: 7341 +.. nonce: O4I8D7 +.. section: Library + +AssertionError in mp_benchmarks.py, caused by an underlying issue in +sharedctypes.py. + +.. + +.. bpo: 1225107 +.. date: 7340 +.. nonce: p6wro7 +.. section: Library + +inspect.isclass() returned True for instances with a custom __getattr__. + +.. + +.. bpo: 3997 +.. date: 7339 +.. nonce: kDqtnQ +.. section: Library + +Zipfiles generated with more than 65536 files could not be opened with other +applications. + +.. + +.. bpo: 1162154 +.. date: 7338 +.. nonce: QHeSnh +.. section: Library + +``inspect.getmembers()`` now skips attributes that raise AttributeError, +e.g. a __slots__ attribute which has not been set. + +.. + +.. bpo: 1696199 +.. date: 7337 +.. nonce: cR113m +.. section: Library + +Add collections.Counter() for rapid and convenient counting. + +.. + +.. bpo: 3860 +.. date: 7336 +.. nonce: f8AZsh +.. section: Library + +GzipFile and BZ2File now support the context management protocol. + +.. + +.. bpo: 4272 +.. date: 7335 +.. nonce: auf_M0 +.. section: Library + +Add an optional argument to the GzipFile constructor to override the +timestamp in the gzip stream. The default value remains the current time. +The information can be used by e.g. gunzip when decompressing. Patch by +Jacques Frechet. + +.. + +.. bpo: 0 +.. date: 7334 +.. nonce: 7sDs9W +.. section: Library + +Restore Python 2.3 compatibility for decimal.py. + +.. + +.. bpo: 1702551 +.. date: 7333 +.. nonce: If0hpw +.. section: Library + +distutils sdist was not excluding VCS directories under Windows. Initial +solution by Guy Dalberto. + +.. + +.. bpo: 0 +.. date: 7332 +.. nonce: exKvPN +.. section: Library + +The _tkinter module functions "createfilehandler", "deletefilehandler", +"createtimerhandler", "mainloop", "dooneevent" and "quit" have been +deprecated for removal in 3.x + +.. + +.. bpo: 4796 +.. date: 7331 +.. nonce: UBKEyz +.. section: Library + +Added Decimal.from_float() and Context.create_decimal_from_float() to the +decimal module. + +.. + +.. bpo: 4812 +.. date: 7330 +.. nonce: 2hPczw +.. section: Library + +Add missing underscore prefix to some internal-use-only constants in the +decimal module. (Dec_0 becomes _Dec_0, etc.) + +.. + +.. bpo: 4795 +.. date: 7329 +.. nonce: _vA-Zf +.. section: Library + +inspect.isgeneratorfunction() returns False instead of None when the +function is not a generator. + +.. + +.. bpo: 4702 +.. date: 7328 +.. nonce: ybmQBP +.. section: Library + +Throwing a DistutilsPlatformError instead of IOError in case no MSVC +compiler is found under Windows. Original patch by Philip Jenvey. + +.. + +.. bpo: 4646 +.. date: 7327 +.. nonce: 7wQSEv +.. section: Library + +distutils was choking on empty options arg in the setup function. Original +patch by Thomas Heller. + +.. + +.. bpo: 0 +.. date: 7326 +.. nonce: cAjOp1 +.. section: Library + +Fractions.from_float() no longer loses precision for integers too big to +cast as floats. + +.. + +.. bpo: 4790 +.. date: 7325 +.. nonce: aKNjhn +.. section: Library + +The nsmallest() and nlargest() functions in the heapq module did unnecessary +work in the common case where no key function was specified. + +.. + +.. bpo: 3767 +.. date: 7324 +.. nonce: sY2Wyh +.. section: Library + +Convert Tk object to string in tkColorChooser. + +.. + +.. bpo: 3248 +.. date: 7323 +.. nonce: 6UId_r +.. section: Library + +Allow placing ScrolledText in a PanedWindow. + +.. + +.. bpo: 4444 +.. date: 7322 +.. nonce: oBxx2k +.. section: Library + +Allow assertRaises() to be used as a context handler, so that the code under +test can be written inline if more practical. + +.. + +.. bpo: 4739 +.. date: 7321 +.. nonce: VoYRrw +.. section: Library + +Add pydoc help topics for symbols, so that e.g. help('@') works as expected +in the interactive environment. + +.. + +.. bpo: 4756 +.. date: 7320 +.. nonce: pscfIt +.. section: Library + +zipfile.is_zipfile() now supports file-like objects. Patch by Gabriel +Genellina. + +.. + +.. bpo: 4400 +.. date: 7319 +.. nonce: CSFvcN +.. section: Library + +.pypirc default generated file was broken in distutils. + +.. + +.. bpo: 4736 +.. date: 7318 +.. nonce: qftNAR +.. section: Library + +io.BufferedRWPair's closed property now functions properly. + +.. + +.. bpo: 3954 +.. date: 7317 +.. nonce: vPsfgT +.. section: Library + +Fix a potential SystemError in _hotshot.logreader error handling. + +.. + +.. bpo: 4574 +.. date: 7316 +.. nonce: CXYnzF +.. section: Library + +Fix a crash in io.IncrementalNewlineDecoder when a carriage return encodes +to more than one byte in the source encoding (e.g. UTF-16) and gets split on +a chunk boundary. + +.. + +.. bpo: 4223 +.. date: 7315 +.. nonce: UCATW5 +.. section: Library + +inspect.getsource() will now correctly display source code for packages +loaded via zipimport (or any other conformant PEP 302 loader). Original +patch by Alexander Belopolsky. + +.. + +.. bpo: 4201 +.. date: 7314 +.. nonce: hdQbIQ +.. section: Library + +pdb can now access and display source code loaded via zipimport (or any +other conformant PEP 302 loader). Original patch by Alexander Belopolsky. + +.. + +.. bpo: 4197 +.. date: 7313 +.. nonce: IA6tPh +.. section: Library + +Doctests in modules loaded via zipimport (or any other PEP 302 conformant +loader) will now work correctly in most cases (they are still subject to the +constraints that exist for all code running from inside a module loaded via +a PEP 302 loader and attempting to perform IO operations based on __file__). +Original patch by Alexander Belopolsky. + +.. + +.. bpo: 4082 +.. date: 7312 +.. nonce: jpnXzi +.. section: Library + +Add runpy support to zipimport in a manner that allows backporting to +maintenance branches. Original patch by Alexander Belopolsky. (See also: +bpo-4512) + +.. + +.. bpo: 4163 +.. date: 7311 +.. nonce: r4afWs +.. section: Library + +Use unicode-friendly word splitting in the textwrap functions when given a +Unicode string. + +.. + +.. bpo: 4616 +.. date: 7310 +.. nonce: EfehU4 +.. section: Library + +TarFile.utime(): Restore directory times on Windows. + +.. + +.. bpo: 4084 +.. date: 7309 +.. nonce: CgsU1v +.. section: Library + +Fix max, min, max_mag and min_mag Decimal methods to give correct results in +the case where one argument is a quiet NaN and the other is a finite number +that requires rounding. + +.. + +.. bpo: 1030250 +.. date: 7308 +.. nonce: s-KbFX +.. section: Library + +Distutils created directories even when run with the --dry-run option. + +.. + +.. bpo: 4483 +.. date: 7307 +.. nonce: H2pFWf +.. section: Library + +_dbm module now builds on systems with gdbm & gdbm_compat libs. + +.. + +.. bpo: 4529 +.. date: 7306 +.. nonce: J-M1ot +.. section: Library + +Fix the parser module's validation of try-except-finally statements. + +.. + +.. bpo: 4458 +.. date: 7305 +.. nonce: d68Oc- +.. section: Library + +getopt.gnu_getopt() now recognizes a single "-" as an argument, not a +malformed option. + +.. + +.. bpo: 0 +.. date: 7304 +.. nonce: JcSDah +.. section: Library + +Added the subprocess.check_output() convenience function to get output from +a subprocess on success or raise an exception on error. + +.. + +.. bpo: 1055234 +.. date: 7303 +.. nonce: PJDWMZ +.. section: Library + +cgi.parse_header(): Fixed parsing of header parameters to support unusual +filenames (such as those containing semi-colons) in Content-Disposition +headers. + +.. + +.. bpo: 4384 +.. date: 7302 +.. nonce: 5W6yrD +.. section: Library + +Added logging integration with warnings module using captureWarnings(). +This change includes a NullHandler which does nothing; it will be of use to +library developers who want to avoid the "No handlers could be found for +logger XXX" message which can appear if the library user doesn't configure +logging. + +.. + +.. bpo: 3741 +.. date: 7301 +.. nonce: ugW7ZS +.. section: Library + +DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception. + +.. + +.. bpo: 4363 +.. date: 7300 +.. nonce: zbP2s9 +.. section: Library + +The uuid.uuid1() and uuid.uuid4() functions now work even if the ctypes +module is not present. + +.. + +.. bpo: 0 +.. date: 7299 +.. nonce: 9ohu2f +.. section: Library + +FileIO's mode attribute now always includes ``"b"``. + +.. + +.. bpo: 4116 +.. date: 7298 +.. nonce: CD_MP7 +.. section: Library + +Resolve member name conflict in ScrolledCanvas.__init__. + +.. + +.. bpo: 0 +.. date: 7297 +.. nonce: QmONdW +.. section: Library + +httplib.HTTPConnection.putheader() now accepts an arbitrary number of values +for any header, matching what the documentation has claimed for a while. + +.. + +.. bpo: 3774 +.. date: 7296 +.. nonce: qhBNNQ +.. section: Library + +Fixed an error when create a Tkinter menu item without command and then +remove it. + +.. + +.. bpo: 0 +.. date: 7295 +.. nonce: NbETIR +.. section: Library + +Fixed a modulefinder crash on certain relative imports. + +.. + +.. bpo: 4150 +.. date: 7294 +.. nonce: Q8jnkP +.. section: Library + +Pdb's "up" command now works for generator frames in post-mortem debugging. + +.. + +.. bpo: 4092 +.. date: 7293 +.. nonce: cgu8U7 +.. section: Library + +Return ArgInfo as promised in the documentation from inspect.getargvalues. + +.. + +.. bpo: 3935 +.. date: 7292 +.. nonce: xo6LXH +.. section: Library + +Properly support list subclasses in bisect's C implementation. + +.. + +.. bpo: 4014 +.. date: 7291 +.. nonce: VPepZh +.. section: Library + +Don't claim that Python has an Alpha release status, in addition to claiming +it is Mature. + +.. + +.. bpo: 4730 +.. date: 7290 +.. nonce: Gb-t2A +.. section: Library + +Fixed the cPickle module to handle correctly astral characters when protocol +0 is used. + +.. + +.. bpo: 1594 +.. date: 7289 +.. nonce: HEsHsF +.. section: Library + +MacOS.GetCreatorAndType now always returns a big-endian result, to be +consistent with Apple tools. + +.. + +.. bpo: 900949 +.. date: 7288 +.. nonce: WLxHoH +.. section: Library + +plat-mac/videoreader.py no longer relies on a non-existing module. + +.. + +.. bpo: 16278952 +.. date: 7287 +.. nonce: lzPQW7 +.. section: Library + +plat-mac/videoreader.py now correctly imports MediaDescr + +.. + +.. bpo: 1737832 +.. date: 7286 +.. nonce: cQdLju +.. section: Library + +plat-mac/EasyDialog.py no longer uses the broken aepack module. + +.. + +.. bpo: 1149804 +.. date: 7285 +.. nonce: -5eLwa +.. section: Library + +macostools.mkdirs now even works when another process creates one of the +needed subdirectories. + +.. + +.. bpo: 900506 +.. date: 7284 +.. nonce: kVZAZL +.. section: Library + +added --no-zipimport flag to the bundlebuilder script. + +.. + +.. bpo: 841800 +.. date: 7283 +.. nonce: XCnSdr +.. section: Library + +bundlebuilder now works with 'python -O'. + +.. + +.. bpo: 4861 +.. date: 7282 +.. nonce: sIt_9h +.. section: Library + +ctypes.util.find_library(): Robustify. Fix library detection on biarch +systems. Try to rely on ldconfig only, without using objdump and gcc. + +.. + +.. bpo: 5104 +.. date: 7281 +.. nonce: YzzKtZ +.. section: Library + +The socket module now raises OverflowError when 16-bit port and protocol +numbers are supplied outside the allowed 0-65536 range on bind() and +getservbyport(). + +.. + +.. bpo: 999042 +.. date: 7280 +.. nonce: cVohJD +.. section: Library + +The Python compiler now handles explict global statements correctly (should +be assigned using STORE_GLOBAL opcode). + +.. + +.. bpo: 2703 +.. date: 7279 +.. nonce: nHzm3m +.. section: Library + +SimpleXMLRPCDispatcher.__init__: Provide default values for new arguments +introduced in 2.5. + +.. + +.. bpo: 5828 +.. date: 7278 +.. nonce: vKsQ82 +.. section: Library + +Fixed bogus logic in makeunicodedata.py and regenerated the Unicode database +(This fixes u'\u1d79'.lower() == '\x00'). + +.. + +.. bpo: 0 +.. date: 7277 +.. nonce: aOxIb2 +.. section: Library + +Windows locale mapping updated to Vista. + +.. + +.. bpo: 5150 +.. date: 7276 +.. nonce: ROvOEC +.. section: IDLE + +IDLE's format menu now has an option to strip trailing whitespace. + +.. + +.. bpo: 5847 +.. date: 7275 +.. nonce: XwEpMA +.. section: IDLE + +Remove -n switch on "Edit with IDLE" menu item. + +.. + +.. bpo: 0 +.. date: 7274 +.. nonce: 0fQMGL +.. section: IDLE + +idle.py modified and simplified to better support developing experimental +versions of IDLE which are not installed in the standard location. + +.. + +.. bpo: 5559 +.. date: 7273 +.. nonce: GKhgt1 +.. section: IDLE + +OutputWindow/PyShell right click menu "Go to file/line" wasn't working with +file paths containing spaces. + +.. + +.. bpo: 5783 +.. date: 7272 +.. nonce: oZFpQE +.. section: IDLE + +Windows: Version string for the .chm help file changed, file not being +accessed. Patch by Guilherme Polo/ + +.. + +.. bpo: 1529142 +.. date: 7271 +.. nonce: _7kvP5 +.. section: IDLE + +Allow multiple IDLE GUI/subprocess pairs to exist simultaneously. Thanks to +David Scherer for suggesting the use of an ephemeral port for the GUI. +Patch by Weeble. + +.. + +.. bpo: 0 +.. date: 7270 +.. nonce: D4DReJ +.. section: IDLE + +Remove port spec from run.py and fix bug where subprocess fails to extract +port from command line when warnings are present. + +.. + +.. bpo: 5129 +.. date: 7269 +.. nonce: eVAJqn +.. section: IDLE + +Tk 8.5 Text widget requires 'wordprocessor' tabstyle attr to handle mixed +space/tab properly. Patch by Guilherme Polo. + +.. + +.. bpo: 3549 +.. date: 7268 +.. nonce: nZ7He6 +.. section: IDLE + +On MacOS the preferences menu was not present + +.. + +.. bpo: 0 +.. date: 7267 +.. nonce: fyANj_ +.. section: Tools/Demos + +Ttk demos added in Demo/tkinter/ttk/. + +.. + +.. bpo: 4677 +.. date: 7266 +.. nonce: 4BCeec +.. section: Tools/Demos + +Add two list comprehension tests to pybench. + +.. + +.. bpo: 6603 +.. date: 7265 +.. nonce: I-Evb7 +.. section: Build + +Change READ_TIMESTAMP macro in ceval.c so that it compiles correctly under +gcc on x86-64. This fixes a reported problem with the --with-tsc build on +x86-64. + +.. + +.. bpo: 0 +.. date: 7264 +.. nonce: fOuNOF +.. section: Build + +Add 2 new options to ``--with-universal-archs`` on MacOSX: ``intel`` builds +a distribution with ``i386`` and ``x86_64`` architectures, while ``3-way`` +builds a distribution with the ``ppc``, ``i386`` and ``x86_64`` +architectures. + +.. + +.. bpo: 6802 +.. date: 7263 +.. nonce: I0PGjW +.. section: Build + +Fix build issues on MacOSX 10.6. + +.. + +.. bpo: 6244 +.. date: 7262 +.. nonce: hQGLlr +.. section: Build + +Allow detect_tkinter to look for Tcl/Tk 8.6. + +.. + +.. bpo: 5390 +.. date: 7261 +.. nonce: ZnkJkB +.. section: Build + +Add uninstall icon independent of whether file extensions are installed. + +.. + +.. bpo: 5809 +.. date: 7260 +.. nonce: WMK90h +.. section: Build + +Specifying both --enable-framework and --enable-shared is an error. +Configure now explicitly tells you about this. + +.. + +.. bpo: 3585 +.. date: 7259 +.. nonce: eB4RFU +.. section: Build + +Add pkg-config support. It creates a python-2.7.pc file and a python.pc +symlink in the $(LIBDIR)/pkgconfig directory. Patch by Clinton Roy. + +.. + +.. bpo: 6094 +.. date: 7258 +.. nonce: shJUAU +.. section: Build + +Build correctly with Subversion 1.7. + +.. + +.. bpo: 5726 +.. date: 7257 +.. nonce: nHrlsd +.. section: Build + +Make Modules/ld_so_aix return the actual exit code of the linker, rather +than always exit successfully. Patch by Floris Bruynooghe. + +.. + +.. bpo: 4587 +.. date: 7256 +.. nonce: nnNweB +.. section: Build + +Add configure option --with-dbmliborder=db1:db2:... to specify the order +that backends for the dbm extension are checked. + +.. + +.. bpo: 0 +.. date: 7255 +.. nonce: 9K_NPs +.. section: Build + +Link the shared python library with $(MODLIBS). + +.. + +.. bpo: 5134 +.. date: 7254 +.. nonce: JmNLWO +.. section: Build + +Silence compiler warnings when compiling sqlite with VC++. + +.. + +.. bpo: 4494 +.. date: 7253 +.. nonce: IGajo- +.. section: Build + +Fix build with Py_NO_ENABLE_SHARED on Windows. + +.. + +.. bpo: 4895 +.. date: 7252 +.. nonce: S-3ytm +.. section: Build + +Use _strdup on Windows CE. + +.. + +.. bpo: 4472 +.. date: 7251 +.. nonce: UbvbZD +.. section: Build + +``configure --enable-shared`` now works on OSX. + +.. + +.. bpo: 4728 +.. date: 7250 +.. nonce: FPe7Wi +.. section: Build + +WORDS_BIGEDIAN is now correct in Universal builds. (See also: bpo-4060) + +.. + +.. bpo: 4389 +.. date: 7249 +.. nonce: UrR3rH +.. section: Build + +Add icon to the uninstall entry in "add-and-remove-programs". + +.. + +.. bpo: 4289 +.. date: 7248 +.. nonce: xDo3LW +.. section: Build + +Remove Cancel button from AdvancedDlg. + +.. + +.. bpo: 1656675 +.. date: 7247 +.. nonce: yhrY5M +.. section: Build + +Register a drop handler for .py* files on Windows. + +.. + +.. bpo: 4120 +.. date: 7246 +.. nonce: AJJ_Yg +.. section: Build + +Exclude manifest from extension modules in VS2008. + +.. + +.. bpo: 4091 +.. date: 7245 +.. nonce: j3E4hq +.. section: Build + +Install pythonxy.dll in system32 again. + +.. + +.. bpo: 4018 +.. date: 7244 +.. nonce: UVtBMQ +.. section: Build + +Disable "for me" installations on Vista. + +.. + +.. bpo: 3758 +.. date: 7243 +.. nonce: cBcoI8 +.. section: Build + +Add ``patchcheck`` build target to ``.PHONY``. + +.. + +.. bpo: 4204 +.. date: 7242 +.. nonce: NQswDc +.. section: Build + +Fixed module build errors on FreeBSD 4. + +.. + +.. bpo: 6556 +.. date: 7241 +.. nonce: Qn6fFV +.. section: Documentation + +Fixed the Distutils configuration files location explanation for Windows. + +.. + +.. bpo: 6801 +.. date: 7240 +.. nonce: yMIrow +.. section: Documentation + +symmetric_difference_update also accepts ``|``. Thanks to Carl Chenet. + +.. + +.. bpo: 7528 +.. date: 7239 +.. nonce: CxgEcB +.. section: C API + +Add PyLong_AsLongAndOverflow (backported from py3k). + +.. + +.. bpo: 7228 +.. date: 7238 +.. nonce: Kj3IXX +.. section: C API + +Add '%lld' and '%llu' support to PyString_FromFormat(V) and PyErr_Format, on +machines with HAVE_LONG_LONG defined. + +.. + +.. bpo: 0 +.. date: 7237 +.. nonce: XqzKYC +.. section: C API + +Add new C-API function PyOS_string_to_double, and deprecated PyOS_ascii_atof +and PyOS_ascii_strtod. + +.. + +.. bpo: 0 +.. date: 7236 +.. nonce: EzTAcl +.. section: C API + +Removed _PyOS_double_to_string. Use PyOS_double_to_string instead. This is +in preparation for (but not strictly related to) issue #7117, short float +repr. + +.. + +.. bpo: 6624 +.. date: 7235 +.. nonce: qPXO6F +.. section: C API + +PyArg_ParseTuple with "s" format when parsing argument with NULL: Bogus +TypeError detail string. + +.. + +.. bpo: 5954 +.. date: 7234 +.. nonce: bl2-P2 +.. section: C API + +Add a PyFrame_GetLineNumber() function to replace most uses of +PyCode_Addr2Line(). + +.. + +.. bpo: 5959 +.. date: 7233 +.. nonce: wmWB5t +.. section: C API + +Add a PyCode_NewEmpty() function to create a new empty code object at a +specified file, function, and line number. + +.. + +.. bpo: 1419652 +.. date: 7232 +.. nonce: Q6BERX +.. section: C API + +Change the first argument to PyImport_AppendInittab() to ``const char *`` as +the string is stored beyond the call. + +.. + +.. bpo: 0 +.. date: 7231 +.. nonce: hva90Q +.. section: C API + +Some PyBytes_* aliases have been removed because they don't exist in 3.x. + +.. + +.. bpo: 5175 +.. date: 7230 +.. nonce: r1a8Ms +.. section: C API + +PyLong_AsUnsignedLongLong now raises OverflowError for negative arguments. +Previously, it raised TypeError. + +.. + +.. bpo: 4720 +.. date: 7229 +.. nonce: Mb6W01 +.. section: C API + +The format for PyArg_ParseTupleAndKeywords can begin with '|'. + +.. + +.. bpo: 3632 +.. date: 7228 +.. nonce: upPC86 +.. section: C API + +From the gdb debugger, the 'pyo' macro can now be called when the GIL is +released, or owned by another thread. + +.. + +.. bpo: 4122 +.. date: 7227 +.. nonce: fhMq7A +.. section: C API + +On Windows, fix a compilation error when using the Py_UNICODE_ISSPACE macro +in an extension module. + +.. + +.. bpo: 4293 +.. date: 7226 +.. nonce: QdarHx +.. section: C API + +Py_AddPendingCall() is now thread safe and can be used for asynchronous +notifications to python from any thread. Documentation added. + +.. + +.. bpo: 6508 +.. date: 7225 +.. nonce: R3EvXY +.. section: Library + +Add posix.{getresuid,getresgid,setresuid,setresgid}. + +.. + +.. bpo: 7078 +.. date: 7224 +.. nonce: 90Z604 +.. section: Library + +Set struct.__doc__ from _struct.__doc__. + +.. + +.. bpo: 3366 +.. date: 7223 +.. nonce: U1DfAJ +.. section: Library + +Add erf, erfc, expm1, gamma, lgamma functions to math module. + +.. + +.. bpo: 6823 +.. date: 7222 +.. nonce: m4cwqj +.. section: Library + +Allow time.strftime() to accept a tuple with a isdst field outside of the +range of [-1, 1] by normalizing the value to within that range. + +.. + +.. bpo: 6877 +.. date: 7221 +.. nonce: CMXt7p +.. section: Library + +Make it possible to link the readline extension to libedit on OSX. + +.. + +.. bpo: 6944 +.. date: 7220 +.. nonce: A9aMl7 +.. section: Library + +Fix a SystemError when socket.getnameinfo() was called with something other +than a tuple as first argument. + +.. + +.. bpo: 6865 +.. date: 7219 +.. nonce: 8EKGt5 +.. section: Library + +Fix reference counting issue in the initialization of the pwd module. + +.. + +.. bpo: 6848 +.. date: 7218 +.. nonce: yoWK1A +.. section: Library + +Fix curses module build failure on OS X 10.6. + +.. + +.. bpo: 0 +.. date: 7217 +.. nonce: k2iXEM +.. section: Library + +Fix a segfault in expat when given a specially crafted input lead to the +tokenizer not stopping. CVE-2009-3720. + +.. + +.. bpo: 6561 +.. date: 7216 +.. nonce: tJwGr- +.. section: Library + +'\d' in a regex now matches only characters with Unicode category 'Nd' +(Number, Decimal Digit). Previously it also matched characters with +category 'No'. + +.. + +.. bpo: 1523 +.. date: 7215 +.. nonce: GYRz49 +.. section: Library + +Remove deprecated overflow wrapping for struct.pack with an integer format +code ('bBhHiIlLqQ'). Packing an out-of-range integer now consistently +raises struct.error. + +.. + +.. bpo: 1530559 +.. date: 7214 +.. nonce: 0TjrtL +.. section: Library + +Fix various struct.pack inconsistencies for the integer formats +('bBhHiIlLqQ'). In the following, '*' represents any of '=', '<', '>'. + +- Packing a float now always gives a Deprecation Warning. Previously it +only warned for 'I', 'L', '*B', '*H', '*I', '*L'. + +- If x is not an int, long or float, then packing x will always result in +struct.error. Previously an x with an __int__ method could be packed by +'b', 'B', 'h', 'H', 'i', 'l', '*b', '*h' ,'*i', '*l', and an x with a +__long__ method could be packed by 'q', 'Q', '*q', '*Q'; for x with +neither __int__ nor __long__, TypeError used to be raised (with a +confusing error message) for 'I', 'L', '*B', '*H', '*I', '*L', and +struct.error in other cases. + +Note: as of Python 2.7 beta 1, the above is out of date. In 2.7 beta 1, any +argument with an __int__ method can be packed, but use of this feature +triggers a DeprecationWarning. (See also: bpo-1741130) + +.. + +.. bpo: 4873 +.. date: 7213 +.. nonce: X6xp5Z +.. section: Library + +Fix resource leaks in error cases of pwd and grp. + +.. + +.. bpo: 4751 +.. date: 7212 +.. nonce: 6sPqcu +.. section: Library + +For hashlib algorithms provided by OpenSSL, the Python GIL is now released +during computation on data lengths >= 2048 bytes. + +.. + +.. bpo: 3745 +.. date: 7211 +.. nonce: UWvSDY +.. section: Library + +Fix hashlib to always reject unicode and non buffer-api supporting objects +as input no matter how it was compiled (built in implementations or external +openssl library). NOTE: Undone in 2.7a2. + +.. + +.. bpo: 4397 +.. date: 7210 +.. nonce: v3SDSI +.. section: Library + +Fix occasional test_socket failure on OS X. + +.. + +.. bpo: 4279 +.. date: 7209 +.. nonce: 4RY6FX +.. section: Library + +Fix build of parsermodule under Cygwin. + +.. + +.. bpo: 4051 +.. date: 7208 +.. nonce: CWy5So +.. section: Library + +Prevent conflict of UNICODE macros in cPickle. + +.. + +.. bpo: 4228 +.. date: 7207 +.. nonce: 6AP3nQ +.. section: Library + +Pack negative values the same way as 2.4 in struct's L format. + +.. + +.. bpo: 1040026 +.. date: 7206 +.. nonce: f_lNlD +.. section: Library + +Fix os.times result on systems where HZ is incorrect. + +.. + +.. bpo: 3167 +.. date: 7205 +.. nonce: Wq3nLl +.. section: Library + +Fix test_math failures for log, log10 on Solaris, OpenBSD. (See also: +bpo-3682) + +.. + +.. bpo: 4365 +.. date: 7204 +.. nonce: 1v_32N +.. section: Library + +Add crtassem.h constants to the msvcrt module. + +.. + +.. bpo: 4396 +.. date: 7203 +.. nonce: 3vmXT4 +.. section: Library + +The parser module now correctly validates the with statement. + +.. + +.. bpo: 5228 +.. date: 7202 +.. nonce: lDpzrP +.. section: Library + +Make functools.partial objects can now be pickled. + +.. + +.. bpo: 7431 +.. date: 7201 +.. nonce: gQvWFz +.. section: Tests + +Use TESTFN in test_linecache instead of trying to create a file in the +Lib/test directory, which might be read-only for the user running the tests. + +.. + +.. bpo: 7324 +.. date: 7200 +.. nonce: qx7wYQ +.. section: Tests + +Add a sanity check to regrtest argument parsing to catch the case of an +option with no handler. + +.. + +.. bpo: 7312 +.. date: 7199 +.. nonce: owJk3R +.. section: Tests + +Add a -F flag to run the selected tests in a loop until a test fails. Can +be combined with -j. + +.. + +.. bpo: 7295 +.. date: 7198 +.. nonce: ukZhHi +.. section: Tests + +Do not use a hardcoded file name in test_tarfile. + +.. + +.. bpo: 7270 +.. date: 7197 +.. nonce: am_b1S +.. section: Tests + +Add some dedicated unit tests for multi-thread synchronization primitives +such as Lock, RLock, Condition, Event and Semaphore. + +.. + +.. bpo: 7222 +.. date: 7196 +.. nonce: iKJspN +.. section: Tests + +Make thread "reaping" more reliable so that reference leak-chasing test runs +give sensible results. The previous method of reaping threads could return +successfully while some Thread objects were still referenced. This also +introduces a new private function: ``thread._count()``. + +.. + +.. bpo: 7151 +.. date: 7195 +.. nonce: U07hpR +.. section: Tests + +Fixed regrtest -j so that output to stderr from a test no longer runs the +risk of causing the worker thread to fail. + +.. + +.. bpo: 7055 +.. date: 7194 +.. nonce: 3okJ5l +.. section: Tests + +test___all__ now greedily detects all modules which have an __all__ +attribute, rather than using a hardcoded and incomplete list. + +.. + +.. bpo: 7058 +.. date: 7193 +.. nonce: 3DkUXi +.. section: Tests + +Added save/restore for things like sys.argv and cwd to runtest_inner in +regrtest, with warnings if the called test modifies them, and a new section +in the summary report at the end. + +.. + +.. bpo: 7042 +.. date: 7192 +.. nonce: b8v3FJ +.. section: Tests + +Fix test_signal (test_itimer_virtual) failure on OS X 10.6. + +.. + +.. bpo: 6806 +.. date: 7191 +.. nonce: hS_Ys4 +.. section: Tests + +test_platform failed under OS X 10.6.0 because ``sw_ver`` leaves off the +trailing 0 in the version number. + +.. + +.. bpo: 5450 +.. date: 7190 +.. nonce: c2vdqn +.. section: Tests + +Moved tests involving loading tk from Lib/test/test_tcl to Lib/lib- +tk/test/test_tkinter/test_loadtk. With this, these tests demonstrate the +same behaviour as test_ttkguionly (and now also test_tk) which is to skip +the tests if DISPLAY is defined but can't be used. + +.. + +.. bpo: 6152 +.. date: 7189 +.. nonce: EkeKpL +.. section: Tests + +New option '-j'/'--multiprocess' for regrtest allows running regression +tests in parallel, shortening the total runtime. + +.. + +.. bpo: 5354 +.. date: 7188 +.. nonce: vIbbLT +.. section: Tests + +New test support function import_fresh_module() makes it easy to import both +normal and optimised versions of modules. test_heapq and test_warnings have +been adjusted to use it, tests for other modules with both C and Python +implementations in the stdlib can be adjusted to use it over time. + +.. + +.. bpo: 0 +.. date: 7187 +.. nonce: bTuQvV +.. section: Tests + +Fix test_warnings to no longer reset the warnings filter. + +.. + +.. bpo: 0 +.. date: 7186 +.. nonce: Mmlolu +.. section: Tests + +Fix test_logging to no longer reset the warnings filter. + +.. + +.. bpo: 5635 +.. date: 7185 +.. nonce: 8Yq1dn +.. section: Tests + +Fix running test_sys with tracing enabled. + +.. + +.. bpo: 0 +.. date: 7184 +.. nonce: t8Gnx4 +.. section: Tests + +regrtest no longer treats ImportError as equivalent to SkipTest. Imports +that should cause a test to be skipped are now done using import_module from +test support, which does the conversion. + +.. + +.. bpo: 5083 +.. date: 7183 +.. nonce: imHnrP +.. section: Tests + +New 'gui' resource for regrtest. + +.. + +.. bpo: 5837 +.. date: 7182 +.. nonce: s1idZB +.. section: Tests + +Certain sequences of calls to set() and unset() for +support.EnvironmentVarGuard objects restored the environment variables +incorrectly on __exit__. + +.. + +.. bpo: 2389 +.. date: 7181 +.. nonce: w0L9Yb +.. section: Tests + +Array objects are now pickled in a portable manner. + +.. + +.. bpo: 5611 +.. date: 7180 +.. nonce: UOPr-Q +.. section: Windows + +Auto-detect whether a C file uses tabs or spaces in Vim. diff --git a/Misc/NEWS.d/2.7a2.rst b/Misc/NEWS.d/2.7a2.rst new file mode 100644 index 00000000000..fa130811686 --- /dev/null +++ b/Misc/NEWS.d/2.7a2.rst @@ -0,0 +1,457 @@ +.. bpo: 0 +.. date: 7804 +.. nonce: jherxT +.. release date: 2010-01-09 +.. section: Core and Builtins + +The ``__complex__()`` method is now looked up on the class of instances to +make it consistent with other special methods. + +.. + +.. bpo: 7462 +.. date: 7803 +.. nonce: E1r1bi +.. section: Core and Builtins + +Implement the stringlib fast search algorithm for the `rfind`, `rindex`, +`rsplit` and `rpartition` methods. Patch by Florent Xicluna. + +.. + +.. bpo: 5080 +.. date: 7802 +.. nonce: Wb4q9j +.. section: Core and Builtins + +A number of functions and methods previously produced a DeprecationWarning +when passed a float argument where an integer was expected. These functions +and methods now raise TypeError instead. The majority of the effects of +this change are in the extension modules, but some core functions and +methods are affected: notably the 'chr', 'range' and 'xrange' builtins, and +many unicode/str methods. + +.. + +.. bpo: 7604 +.. date: 7801 +.. nonce: tTzdbD +.. section: Core and Builtins + +Deleting an unset slotted attribute did not raise an AttributeError. + +.. + +.. bpo: 7534 +.. date: 7800 +.. nonce: UJiEZi +.. section: Core and Builtins + +Fix handling of IEEE specials (infinities, nans, negative zero) in ** +operator. The behaviour now conforms to that described in C99 Annex F. + +.. + +.. bpo: 7579 +.. date: 7799 +.. nonce: cmOrYb +.. section: Core and Builtins + +The msvcrt module now has docstrings for all its functions. + +.. + +.. bpo: 7413 +.. date: 7798 +.. nonce: g6Euap +.. section: Core and Builtins + +Passing '\0' as the separator to datetime.datetime.isoformat() used to drop +the time part of the result. + +.. + +.. bpo: 1811 +.. date: 7797 +.. nonce: e1nd7g +.. section: Core and Builtins + +Improve accuracy and cross-platform consistency for true division of +integers: the result of a/b is now correctly rounded for ints a and b (at +least on IEEE 754 platforms), and in particular does not depend on the +internal representation of a long. + +.. + +.. bpo: 6108 +.. date: 7796 +.. nonce: j3A6pp +.. section: Core and Builtins + +``unicode(exception)`` and ``str(exception)`` should return the same message +when only ``__str__()`` (and not ``__unicode__()``) is overridden in the +subclass. + +.. + +.. bpo: 6834 +.. date: 7795 +.. nonce: iPCAPI +.. section: Core and Builtins + +Replace the implementation for the 'python' and 'pythonw' executables on +OSX. + +These executables now work properly with the arch(1) command: ``arch -ppc +python`` will start a universal binary version of python in PPC mode (unlike +previous releases). + +.. + +.. bpo: 1680159 +.. date: 7794 +.. nonce: zCoubo +.. section: Core and Builtins + +Unicode coercion during an 'in' operation no longer masks the underlying +error when the coercion fails for the left hand operand. + +.. + +.. bpo: 7491 +.. date: 7793 +.. nonce: bGallI +.. section: Core and Builtins + +Metaclass's __cmp__ method was ignored. + +.. + +.. bpo: 7466 +.. date: 7792 +.. nonce: zrhYS4 +.. section: Core and Builtins + +Segmentation fault when the garbage collector is called in the middle of +populating a tuple. Patch by Florent Xicluna. + +.. + +.. bpo: 6963 +.. date: 7791 +.. nonce: TJvFT0 +.. section: Library + +Added "maxtasksperchild" argument to ``multiprocessing.Pool``, allowing for +a maximum number of tasks within the pool to be completed by the worker +before that worker is terminated, and a new one created to replace it. + +.. + +.. bpo: 7617 +.. date: 7790 +.. nonce: duSdpP +.. section: Library + +Make sure distutils.unixccompiler.UnixCCompiler recognizes gcc when it has a +fully qualified configuration prefix. Initial patch by Arfrever. + +.. + +.. bpo: 7092 +.. date: 7789 +.. nonce: 8Bxjpz +.. section: Library + +Remove py3k warning when importing cPickle. 2to3 handles renaming of +`cPickle` to `pickle`. The warning was annoying since there's no +alternative to cPickle if you care about performance. Patch by Florent +Xicluna. + +.. + +.. bpo: 7455 +.. date: 7788 +.. nonce: 4QZ2RC +.. section: Library + +Fix possible crash in cPickle on invalid input. Patch by Victor Stinner. + +.. + +.. bpo: 7092 +.. date: 7787 +.. nonce: z80fv1 +.. section: Library + +Fix the DeprecationWarnings emitted by the standard library when using the +-3 flag. Patch by Florent Xicluna. + +.. + +.. bpo: 7471 +.. date: 7786 +.. nonce: Flh7OS +.. section: Library + +Improve the performance of GzipFile's buffering mechanism, and make it +implement the ``io.BufferedIOBase`` ABC to allow for further speedups by +wrapping it in an ``io.BufferedReader``. Patch by Nir Aides. + +.. + +.. bpo: 3972 +.. date: 7785 +.. nonce: T0AsF9 +.. section: Library + +``httplib.HTTPConnection`` now accepts an optional source_address parameter +to allow specifying where your connections come from. + +.. + +.. bpo: 0 +.. date: 7784 +.. nonce: VuT7xt +.. section: Library + +``socket.create_connection()`` now accepts an optional source_address +parameter. + +.. + +.. bpo: 5511 +.. date: 7783 +.. nonce: qXXb66 +.. section: Library + +``zipfile.ZipFile`` can now be used as a context manager. Initial patch by +Brian Curtin. + +.. + +.. bpo: 0 +.. date: 7782 +.. nonce: jVBfGB +.. section: Library + +Distutils now correctly identifies the build architecture as "x86_64" when +building on OSX 10.6 without "-arch" flags. + +.. + +.. bpo: 7556 +.. date: 7781 +.. nonce: 9TArd4 +.. section: Library + +Distutils' msvc9compiler now opens the MSVC Manifest file in text mode. + +.. + +.. bpo: 7552 +.. date: 7780 +.. nonce: cuagLV +.. section: Library + +Removed line feed in the base64 Authorization header in the Distutils upload +command to avoid an error when PyPI reads it. This occurs on long +passwords. Initial patch by JP St. Pierre. + +.. + +.. bpo: 7231 +.. date: 7779 +.. nonce: PtW-pZ +.. section: Library + +urllib2 cannot handle https with proxy requiring auth. Patch by Tatsuhiro +Tsujikawa. + +.. + +.. bpo: 7349 +.. date: 7778 +.. nonce: qwbHfI +.. section: Library + +Make methods of file objects in the io module accept None as an argument +where file-like objects (ie StringIO and BytesIO) accept them to mean the +same as passing no argument. + +.. + +.. bpo: 7348 +.. date: 7777 +.. nonce: 47KswH +.. section: Library + +``StringIO.StringIO.readline(-1)`` now acts as if it got no argument like +other file objects. + +.. + +.. bpo: 7357 +.. date: 7776 +.. nonce: EteBpH +.. section: Library + +tarfile no longer suppresses fatal extraction errors by default. + +.. + +.. bpo: 7470 +.. date: 7775 +.. nonce: IW_7wI +.. section: Library + +logging: Fix bug in Unicode encoding fallback. + +.. + +.. bpo: 5949 +.. date: 7774 +.. nonce: oAWtv2 +.. section: Library + +Fixed IMAP4_SSL hang when the IMAP server response is missing proper end-of- +line termination. + +.. + +.. bpo: 7457 +.. date: 7773 +.. nonce: n8Bkqb +.. section: Library + +Added a read_pkg_file method to ``distutils.dist.DistributionMetadata``. + +.. + +.. bpo: 3745 +.. date: 7772 +.. nonce: 1on7AT +.. section: Library + +Undo the 2.7a1 change to have hashlib to reject unicode and non buffer API +supporting objects as input. That behavior is for 3.x only. + +.. + +.. bpo: 7767 +.. date: 7771 +.. nonce: XmNIZJ +.. section: C API + +New function ``PyLong_AsLongLongAndOverflow()`` added, analogous to +``PyLong_AsLongAndOverflow()``. + +.. + +.. bpo: 5080 +.. date: 7770 +.. nonce: bMlEGy +.. section: C API + +The argument parsing functions ``PyArg_ParseTuple()``, +``PyArg_ParseTupleAndKeywords()``, ``PyArg_VaParse()``, +``PyArg_VaParseTupleAndKeywords()`` and ``PyArg_Parse()`` no longer accept +float arguments for integer format codes (other than 'L'): previously an +attempt to pass a float resulted in a DeprecationWarning; now it gives a +TypeError. For the 'L' format code (which previously had no warning) there +is now a DeprecationWarning. + +.. + +.. bpo: 7033 +.. date: 7769 +.. nonce: koLSHo +.. section: C API + +Function ``PyErr_NewExceptionWithDoc()`` added. + +.. + +.. bpo: 6491 +.. date: 7768 +.. nonce: mDJ_mR +.. section: Build + +Allow --with-dbmliborder to specify that no dbms will be built. + +.. + +.. bpo: 6943 +.. date: 7767 +.. nonce: HhHPsy +.. section: Build + +Use pkg-config to find the libffi headers when the ``--with-system-ffi`` +flag is used. + +.. + +.. bpo: 7609 +.. date: 7766 +.. nonce: w1witS +.. section: Build + +Add a ``--with-system-expat`` option that causes the system's expat library +to be used for the pyexpat module instead of the one included with Python. + +.. + +.. bpo: 7589 +.. date: 7765 +.. nonce: uh9YyY +.. section: Build + +Only build the nis module when the correct header files are found. + +.. + +.. bpo: 0 +.. date: 7764 +.. nonce: 6WvEdi +.. section: Build + +Switch to OpenSSL 0.9.8l and sqlite 3.6.21 on Windows. + +.. + +.. bpo: 7541 +.. date: 7763 +.. nonce: V8g0W6 +.. section: Build + +when using ``python-config`` with a framework install the compiler might use +the wrong library. + +.. + +.. bpo: 7376 +.. date: 7762 +.. nonce: Y0Cani +.. section: Tests + +Instead of running a self-test (which was failing) when called with no +arguments, doctest.py now gives a usage message. + +.. + +.. bpo: 7396 +.. date: 7761 +.. nonce: WRRHMZ +.. section: Tests + +Fix regrtest -s, which was broken by the -j enhancement. + +.. + +.. bpo: 7498 +.. date: 7760 +.. nonce: Cpaz-t +.. section: Tests + +test_multiprocessing now uses test_support.find_unused_port instead of a +hardcoded port number in test_rapid_restart. diff --git a/Misc/NEWS.d/2.7a3.rst b/Misc/NEWS.d/2.7a3.rst new file mode 100644 index 00000000000..02c0778ce1a --- /dev/null +++ b/Misc/NEWS.d/2.7a3.rst @@ -0,0 +1,442 @@ +.. bpo: 5677 +.. date: 7847 +.. nonce: b0Qejz +.. release date: 2010-02-06 +.. section: Core and Builtins + +Explicitly forbid write operations on read-only file objects, and read +operations on write-only file objects. On Windows, the system C library +would return a bogus result; on Solaris, it was possible to crash the +interpreter. Patch by Stefan Krah. + +.. + +.. bpo: 7853 +.. date: 7846 +.. nonce: 7BnJKC +.. section: Core and Builtins + +Normalize exceptions before they are passed to a context manager's +``__exit__()`` method. + +.. + +.. bpo: 7385 +.. date: 7845 +.. nonce: OVCbWd +.. section: Core and Builtins + +Fix a crash in ``PyMemoryView_FromObject()`` when ``PyObject_GetBuffer()`` +fails. Patch by Florent Xicluna. + +.. + +.. bpo: 7819 +.. date: 7844 +.. nonce: tGsOrJ +.. section: Core and Builtins + +Check ``sys.call_tracing()`` arguments types. + +.. + +.. bpo: 7788 +.. date: 7843 +.. nonce: 4T4M13 +.. section: Core and Builtins + +Fix an interpreter crash produced by deleting a list slice with very large +step value. + +.. + +.. bpo: 7766 +.. date: 7842 +.. nonce: aejr9M +.. section: Core and Builtins + +Change ``sys.getwindowsversion()`` return value to a named tuple and add the +additional members returned in an OSVERSIONINFOEX structure. The new +members are service_pack_major, service_pack_minor, suite_mask, and +product_type. + +.. + +.. bpo: 7561 +.. date: 7841 +.. nonce: dYmand +.. section: Core and Builtins + +Operations on empty bytearrays (such as ``int(bytearray())``) could crash in +many places because of the ``PyByteArray_AS_STRING()`` macro returning NULL. +The macro now returns a statically allocated empty string instead. + +.. + +.. bpo: 7622 +.. date: 7840 +.. nonce: yL5cXb +.. section: Core and Builtins + +Improve the split(), rsplit(), splitlines() and replace() methods of bytes, +bytearray and unicode objects by using a common implementation based on +stringlib's fast search. Patch by Florent Xicluna. + +.. + +.. bpo: 7632 +.. date: 7839 +.. nonce: djAkIG +.. section: Core and Builtins + +Fix various str -> float conversion bugs present in 2.7 alpha 2, including: + +(1) a serious 'wrong output' bug that could occur for long (> 40 digit) +input strings, (2) a crash in dtoa.c that occurred in debug builds when +parsing certain long numeric strings corresponding to subnormal values, +(3) a memory leak for some values large enough to cause overflow, and (4) a +number of flaws that could lead to incorrectly rounded results. + +.. + +.. bpo: 7319 +.. date: 7838 +.. nonce: CIP64d +.. section: Core and Builtins + +Silence ``DeprecationWarning`` by default when the -3 option is not used. +(See also: bpo-7770) + +.. + +.. bpo: 2335 +.. date: 7837 +.. nonce: NB-Xpf +.. section: Core and Builtins + +Backport set literals syntax from Python 3.x. + +.. + +.. bpo: 2333 +.. date: 7836 +.. nonce: yWLBy3 +.. section: Core and Builtins + +Backport set and dict comprehensions syntax from Python 3.x. + +.. + +.. bpo: 1967 +.. date: 7835 +.. nonce: RryGx3 +.. section: Core and Builtins + +Backport dictionary views from Python 3.x. + +.. + +.. bpo: 9137 +.. date: 7834 +.. nonce: DgWODo +.. section: Library + +Fix issue in MutableMapping.update, which incorrectly treated keyword +arguments called 'self' or 'other' specially. + +.. + +.. bpo: 7835 +.. date: 7833 +.. nonce: jlbrK8 +.. section: Library + +shelve should no longer produce mysterious warnings during interpreter +shutdown. + +.. + +.. bpo: 2746 +.. date: 7832 +.. nonce: F6UqCX +.. section: Library + +Don't escape ampersands and angle brackets ("&", "<", ">") in XML processing +instructions and comments. These raw characters are allowed by the XML +specification, and are necessary when outputting e.g. PHP code in a +processing instruction. Patch by Neil Muller. + +.. + +.. bpo: 7869 +.. date: 7831 +.. nonce: 1QS851 +.. section: Library + +logging: Improved diagnostic for format-time errors. + +.. + +.. bpo: 7868 +.. date: 7830 +.. nonce: PXTr9t +.. section: Library + +logging: Added loggerClass attribute to Manager. + +.. + +.. bpo: 7851 +.. date: 7829 +.. nonce: 7OtUnx +.. section: Library + +logging: Clarification on logging configuration files. + +.. + +.. bpo: 4772 +.. date: 7828 +.. nonce: 9_Y3av +.. section: Library + +Raise a ValueError when an unknown Bluetooth protocol is specified, rather +than fall through to AF_PACKET (in the ``socket`` module). Also, raise +ValueError rather than TypeError when an unknown TIPC address type is +specified. Patch by Brian Curtin. + +.. + +.. bpo: 0 +.. date: 7827 +.. nonce: DG4Srd +.. section: Library + +logging: Implemented PEP 391. + +.. + +.. bpo: 6939 +.. date: 7826 +.. nonce: 8fBhhK +.. section: Library + +Fix file I/O objects in the `io` module to keep the original file position +when calling `truncate()`. It would previously change the file position to +the given argument, which goes against the tradition of ftruncate() and +other truncation APIs. Patch by Pascal Chambon. + +.. + +.. bpo: 7610 +.. date: 7825 +.. nonce: 2DXmYZ +.. section: Library + +Reworked implementation of the internal ``zipfile.ZipExtFile`` class used to +represent files stored inside an archive. The new implementation is +significantly faster and can be wrapped in an ``io.BufferedReader`` object +for more speedups. It also solves an issue where interleaved calls to +``read()`` and ``readline()`` give wrong results. Patch by Nir Aides. + +.. + +.. bpo: 7792 +.. date: 7824 +.. nonce: ncH8BS +.. section: Library + +Registering non-classes to ABCs raised an obscure error. + +.. + +.. bpo: 0 +.. date: 7823 +.. nonce: RpNACh +.. section: Library + +Removed the deprecated functions ``verify()`` and ``vereq()`` from +Lib/test/test_support.py. + +.. + +.. bpo: 7773 +.. date: 7822 +.. nonce: x2tWld +.. section: Library + +Fix an UnboundLocalError in ``platform.linux_distribution()`` when the +release file is empty. + +.. + +.. bpo: 7748 +.. date: 7821 +.. nonce: YlAgV- +.. section: Library + +Since unicode values are supported for some metadata options in Distutils, +the DistributionMetadata get_* methods will now return a utf-8 encoded +string for them. This ensures that the upload and register commands send +the correct values to PyPI without any error. + +.. + +.. bpo: 1670765 +.. date: 7820 +.. nonce: 9eCqJl +.. section: Library + +Prevent ``email.generator.Generator`` from re-wrapping headers in +multipart/signed MIME parts, which fixes one of the sources of invalid +modifications to such parts by Generator. + +.. + +.. bpo: 7701 +.. date: 7819 +.. nonce: e9a5VO +.. section: Library + +Fix crash in ``binascii.b2a_uu()`` in debug mode when given a 1-byte +argument. Patch by Victor Stinner. + +.. + +.. bpo: 3299 +.. date: 7818 +.. nonce: AzzK85 +.. section: Library + +Fix possible crash in the _sre module when given bad argument values in +debug mode. Patch by Victor Stinner. + +.. + +.. bpo: 7703 +.. date: 7817 +.. nonce: FNoqUO +.. section: Library + +Add support for the new buffer API to functions of the binascii module. +Backported from py3k by Florent Xicluna, with some additional tests. + +.. + +.. bpo: 2846 +.. date: 7816 +.. nonce: 1yXo1U +.. section: Library + +Add support for gzip.GzipFile reading zero-padded files. Patch by Brian +Curtin. + +.. + +.. bpo: 5827 +.. date: 7815 +.. nonce: HqdXuX +.. section: Library + +Make sure that normpath preserves unicode. Initial patch by Matt Giuca. + +.. + +.. bpo: 5372 +.. date: 7814 +.. nonce: t3pYj8 +.. section: Library + +Drop the reuse of .o files in Distutils' ccompiler (since Extension extra +options may change the output without changing the .c file). Initial patch +by Collin Winter. + +.. + +.. bpo: 0 +.. date: 7813 +.. nonce: nL49In +.. section: Library + +Expat: Fix DoS via XML document with malformed UTF-8 sequences +(CVE_2009_3560). + +.. + +.. bpo: 7632 +.. date: 7812 +.. nonce: AWDxJU +.. section: Build + +When Py_USING_MEMORY_DEBUGGER is defined, disable the private memory +allocation scheme in dtoa.c and use PyMem_Malloc and PyMem_Free instead. +Also disable caching of powers of 5. + +.. + +.. bpo: 7658 +.. date: 7811 +.. nonce: oUBbSZ +.. section: Build + +Ensure that the new pythonw executable works on OSX 10.4 + +.. + +.. bpo: 7714 +.. date: 7810 +.. nonce: 27wQ2M +.. section: Build + +Use ``gcc -dumpversion`` to detect the version of GCC on MacOSX. + +.. + +.. bpo: 7661 +.. date: 7809 +.. nonce: ggMDHr +.. section: Build + +Allow ctypes to be built from a non-ASCII directory path. Patch by Florent +Xicluna. + +.. + +.. bpo: 0 +.. date: 7808 +.. nonce: KgUrLn +.. section: Tools/Demos + +iobench (a file I/O benchmark) and ccbench (a concurrency benchmark) were +added to the ``Tools`` directory. They were previously living in the +sandbox. + +.. + +.. bpo: 7728 +.. date: 7807 +.. nonce: f9wo4c +.. section: Tests + +test_timeout was changed to use ``test_support.bind_port()`` instead of a +hard coded port. + +.. + +.. bpo: 0 +.. date: 7806 +.. nonce: Dx9g36 +.. section: Documentation + +Updated "Using Python" documentation to include description of CPython's -J, +-U and -X options. + +.. + +.. bpo: 0 +.. date: 7805 +.. nonce: vllYdR +.. section: Documentation + +Updated Python manual page (options -B, -O0, -s, environment variables +PYTHONDONTWRITEBYTECODE, PYTHONNOUSERSITE). diff --git a/Misc/NEWS.d/2.7a4.rst b/Misc/NEWS.d/2.7a4.rst new file mode 100644 index 00000000000..08a0518fd07 --- /dev/null +++ b/Misc/NEWS.d/2.7a4.rst @@ -0,0 +1,440 @@ +.. bpo: 7544 +.. date: 7892 +.. nonce: TTDd8s +.. release date: 2010-03-06 +.. section: Core and Builtins + +Preallocate thread memory before creating the thread to avoid a fatal error +in low memory condition. + +.. + +.. bpo: 7820 +.. date: 7891 +.. nonce: hEaQ9f +.. section: Core and Builtins + +The parser tokenizer restores all bytes in the right if the BOM check fails. + +.. + +.. bpo: 7309 +.. date: 7890 +.. nonce: pAF_KB +.. section: Core and Builtins + +Fix unchecked attribute access when converting UnicodeEncodeError, +UnicodeDecodeError, and UnicodeTranslateError to strings. + +.. + +.. bpo: 7649 +.. date: 7889 +.. nonce: KS0hoy +.. section: Core and Builtins + +"u'%c' % char" now behaves like "u'%s' % char" and raises a +UnicodeDecodeError if 'char' is a byte string that can't be decoded using +the default encoding. + +.. + +.. bpo: 6902 +.. date: 7888 +.. nonce: RDRX1R +.. section: Core and Builtins + +Fix problem with built-in types format incorrectly with 0 padding. + +.. + +.. bpo: 2560 +.. date: 7887 +.. nonce: kdK-75 +.. section: Core and Builtins + +Remove an unnecessary 'for' loop from ``my_fgets()`` in Parser/myreadline.c. + +.. + +.. bpo: 7988 +.. date: 7886 +.. nonce: 9h758B +.. section: Core and Builtins + +Fix default alignment to be right aligned for ``complex.__format__``. Now +it matches other numeric types. + +.. + +.. bpo: 5211 +.. date: 7885 +.. nonce: bktLaF +.. section: Core and Builtins + +The complex type no longer uses implicit coercion in mixed-type binary +arithmetic operations. + +.. + +.. bpo: 7904 +.. date: 7884 +.. nonce: fiQRfj +.. section: Library + +Changes to urllib.parse.urlsplit to handle schemes as defined by RFC3986. +Anything before :// is considered a scheme and is followed by an authority +(or netloc) and by '/' led path, which is optional. + +.. + +.. bpo: 1555570 +.. date: 7883 +.. nonce: ruR9CS +.. section: Library + +email no longer inserts extra blank lines when a \r\n combo crosses an 8192 +byte boundary. + +.. + +.. bpo: 6906 +.. date: 7882 +.. nonce: BJTdHl +.. section: Library + +Tk should not set Unicode environment variables on Windows. + +.. + +.. bpo: 1054943 +.. date: 7881 +.. nonce: uHWve2 +.. section: Library + +Fix ``unicodedata.normalize('NFC', text)`` for the Public Review Issue #29 +(http://unicode.org/review/pr-29.html). + +.. + +.. bpo: 7494 +.. date: 7880 +.. nonce: ZnUIo2 +.. section: Library + +Fix a crash in ``_lsprof`` (cProfile) after clearing the profiler, reset +also the pointer to the current pointer context. + +.. + +.. bpo: 7232 +.. date: 7879 +.. nonce: dD983K +.. section: Library + +Add support for the context management protocol to the ``tarfile.TarFile`` +class. + +.. + +.. bpo: 7250 +.. date: 7878 +.. nonce: SqXm2h +.. section: Library + +Fix info leak of os.environ across multi-run uses of +``wsgiref.handlers.CGIHandler``. + +.. + +.. bpo: 1729305 +.. date: 7877 +.. nonce: pRiKEW +.. section: Library + +Fix doctest to handle encode error with "backslashreplace". + +.. + +.. bpo: 691291 +.. date: 7876 +.. nonce: SkVfbl +.. section: Library + +``codecs.open()`` should not convert end of lines on reading and writing. + +.. + +.. bpo: 7975 +.. date: 7875 +.. nonce: lm8Hlp +.. section: Library + +Correct regression in dict methods supported by bsddb.dbshelve. + +.. + +.. bpo: 7959 +.. date: 7874 +.. nonce: 0Si0xg +.. section: Library + +ctypes callback functions are now registered correctly with the cycle +garbage collector. + +.. + +.. bpo: 7970 +.. date: 7873 +.. nonce: zsdvhZ +.. section: Library + +``email.Generator.flatten`` now correctly flattens message/rfc822 messages +parsed by ``email.Parser.HeaderParser``. + +.. + +.. bpo: 3426 +.. date: 7872 +.. nonce: bunX9f +.. section: Library + +``os.path.abspath`` now returns unicode when its arg is unicode. + +.. + +.. bpo: 7633 +.. date: 7871 +.. nonce: kpPZYL +.. section: Library + +In the decimal module, ``Context`` class methods (with the exception of +canonical and is_canonical) now accept instances of int and long wherever a +Decimal instance is accepted, and implicitly convert that argument to +Decimal. Previously only some arguments were converted. + +.. + +.. bpo: 6003 +.. date: 7870 +.. nonce: TAoZ-e +.. section: Library + +Add an argument to ``zipfile.Zipfile.writestr`` to specify the compression +type. + +.. + +.. bpo: 7893 +.. date: 7869 +.. nonce: IFB3BV +.. section: Library + +``unittest.TextTestResult`` is made public and a ``resultclass`` argument +added to the TextTestRunner constructor allowing a different result class to +be used without having to subclass. + +.. + +.. bpo: 7588 +.. date: 7868 +.. nonce: rOCPeT +.. section: Library + +``unittest.TextTestResult.getDescription`` now includes the test name in +failure reports even if the test has a docstring. + +.. + +.. bpo: 5801 +.. date: 7867 +.. nonce: eOropo +.. section: Library + +Remove spurious empty lines in wsgiref. + +.. + +.. bpo: 1537721 +.. date: 7866 +.. nonce: cM7u3p +.. section: Library + +Add a ``writeheader()`` method to ``csv.DictWriter``. + +.. + +.. bpo: 7427 +.. date: 7865 +.. nonce: c1z170 +.. section: Library + +Improve the representation of httplib.BadStatusLine exceptions. + +.. + +.. bpo: 7481 +.. date: 7864 +.. nonce: FOM-ZK +.. section: Library + +When a ``threading.Thread`` failed to start it would leave the instance +stuck in initial state and present in ``threading.enumerate()``. + +.. + +.. bpo: 1068268 +.. date: 7863 +.. nonce: GTy8EE +.. section: Library + +The subprocess module now handles EINTR in internal ``os.waitpid()`` and +``os.read()`` system calls where appropriate. + +.. + +.. bpo: 6729 +.. date: 7862 +.. nonce: WSzBED +.. section: Library + +Add ``ctypes.c_ssize_t`` to represent ssize_t. + +.. + +.. bpo: 6247 +.. date: 7861 +.. nonce: qqe0rR +.. section: Library + +The argparse module has been added to the standard library. + +.. + +.. bpo: 0 +.. date: 7860 +.. nonce: sY1Wyi +.. section: Library + +The sqlite3 module was updated to pysqlite 2.6.0. This fixes several +obscure bugs and allows loading SQLite extensions from shared libraries. + +.. + +.. bpo: 7808 +.. date: 7859 +.. nonce: Onia6y +.. section: Library + +Fix reference leaks in _bsddb and related tests. + +.. + +.. bpo: 6544 +.. date: 7858 +.. nonce: NLvwqS +.. section: Library + +Fix a reference leak in the kqueue implementation's error handling. + +.. + +.. bpo: 0 +.. date: 7857 +.. nonce: yVX0tF +.. section: Library + +Stop providing crtassem.h symbols when compiling with Visual Studio 2010, as +msvcr100.dll is not a platform assembly anymore. + +.. + +.. bpo: 7242 +.. date: 7856 +.. nonce: VzdbKI +.. section: Library + +On Solaris 9 and earlier calling ``os.fork()`` from within a thread could +raise an incorrect RuntimeError about not holding the import lock. The +import lock is now reinitialized after fork. + +.. + +.. bpo: 7999 +.. date: 7855 +.. nonce: -6kN7B +.. section: Library + +``os.setreuid()`` and ``os.setregid()`` would refuse to accept a -1 +parameter on some platforms such as OS X. + +.. + +.. bpo: 7849 +.. date: 7854 +.. nonce: XQLva6 +.. section: Tests + +The utility ``test.test_support.check_warnings()`` verifies if warnings are +effectively raised. A new utility ``check_py3k_warnings()`` is available. + +.. + +.. bpo: 0 +.. date: 7853 +.. nonce: iFGi5W +.. section: Tests + +The four path modules (genericpath, macpath, ntpath, posixpath) share a +common TestCase for some tests: test_genericpath.CommonTest. + +.. + +.. bpo: 0 +.. date: 7852 +.. nonce: xd6x8Q +.. section: Tests + +Print platform information when running the whole test suite, or using the +``--verbose`` flag. + +.. + +.. bpo: 767675 +.. date: 7851 +.. nonce: cR-mRY +.. section: Tests + +Enable test_pep277 on POSIX platforms with Unicode-friendly filesystem +encoding. + +.. + +.. bpo: 6292 +.. date: 7850 +.. nonce: RJOYAi +.. section: Tests + +For the moment at least, the test suite runs cleanly if python is run with +the -OO flag. Tests requiring docstrings are skipped. + +.. + +.. bpo: 7712 +.. date: 7849 +.. nonce: Co5Xm7 +.. section: Tests + +test_support gained a new ``temp_cwd`` context manager which is now also +used by regrtest to run all the tests in a temporary directory. The +original CWD is saved in ``test.test_support.SAVEDCWD``. Thanks to Florent +Xicluna who helped with the patch. + +.. + +.. bpo: 3920 +.. date: 7848 +.. nonce: 5cWPGY +.. section: Build + +Define _BSD_SOURCE on OpenBSD 4.4 through 4.9. (See also: bpo-7903) diff --git a/Misc/NEWS.d/2.7b1.rst b/Misc/NEWS.d/2.7b1.rst new file mode 100644 index 00000000000..cfa710ed8c5 --- /dev/null +++ b/Misc/NEWS.d/2.7b1.rst @@ -0,0 +1,802 @@ +.. bpo: 7301 +.. date: 7972 +.. nonce: dlecRg +.. release date: 2010-04-10 +.. section: Core and Builtins + +Add environment variable $PYTHONWARNINGS. + +.. + +.. bpo: 8329 +.. date: 7971 +.. nonce: ZUTObm +.. section: Core and Builtins + +Don't return the same lists from select.select when no fds are changed. + +.. + +.. bpo: 8259 +.. date: 7970 +.. nonce: NNoD66 +.. section: Core and Builtins + +``1L << (2**31)`` no longer produces an 'outrageous shift error' on 64-bit +machines. The shift count for either left or right shift is permitted to be +up to sys.maxsize. + +.. + +.. bpo: 0 +.. date: 7969 +.. nonce: iwBvru +.. section: Core and Builtins + +Ensure that tokenization of identifiers is not affected by locale. + +.. + +.. bpo: 1222585 +.. date: 7968 +.. nonce: emqFT3 +.. section: Core and Builtins + +Added LDCXXSHARED for C++ support. Patch by Arfrever. + +.. + +.. bpo: 0 +.. date: 7967 +.. nonce: jCkZ20 +.. section: Core and Builtins + +Raise a TypeError when trying to delete a T_STRING_INPLACE struct member. + +.. + +.. bpo: 7994 +.. date: 7966 +.. nonce: ZEBSAJ +.. section: Core and Builtins + +Issue a PendingDeprecationWarning if object.__format__ is called with a non- +empty format string. This is an effort to future-proof user code. If a +derived class does not currently implement __format__ but later adds its own +__format__, it would most likely break user code that had supplied a format +string. This will be changed to a DeprecationWarning in Python 3.3 and it +will be an error in Python 3.4. + +.. + +.. bpo: 8268 +.. date: 7965 +.. nonce: usS51U +.. section: Core and Builtins + +Old-style classes (not just instances) now support weak references. + +.. + +.. bpo: 8211 +.. date: 7964 +.. nonce: InhXpq +.. section: Core and Builtins + +Save/restore CFLAGS around AC_PROG_CC in configure.in, in case it is set. + +.. + +.. bpo: 1583863 +.. date: 7963 +.. nonce: tSkjxk +.. section: Core and Builtins + +A unicode subclass can now override the __unicode__ method + +.. + +.. bpo: 6474 +.. date: 7962 +.. nonce: yFxVuM +.. section: Core and Builtins + +Make error message from passing an inadequate number of keyword arguments to +a function correct. + +.. + +.. bpo: 8164 +.. date: 7961 +.. nonce: uRYEY5 +.. section: Core and Builtins + +Don't allow lambda functions to have a docstring. + +.. + +.. bpo: 3137 +.. date: 7960 +.. nonce: Em70dh +.. section: Core and Builtins + +Don't ignore errors at startup, especially a keyboard interrupt (SIGINT). +If an error occurs while importing the site module, the error is printed and +Python exits. Initialize the GIL before importing the site module. + +.. + +.. bpo: 0 +.. date: 7959 +.. nonce: kIQmnN +.. section: Core and Builtins + +Code objects now support weak references. + +.. + +.. bpo: 5277 +.. date: 7958 +.. nonce: CQ8CXN +.. section: Library + +Fix quote counting when parsing RFC 2231 encoded parameters. + +.. + +.. bpo: 8321 +.. date: 7957 +.. nonce: Tul_aA +.. section: Library + +Give access to OpenSSL version numbers from the `ssl` module, using the new +attributes `ssl.OPENSSL_VERSION`, `ssl.OPENSSL_VERSION_INFO` and +`ssl.OPENSSL_VERSION_NUMBER`. + +.. + +.. bpo: 8310 +.. date: 7956 +.. nonce: 6fu8uc +.. section: Library + +Allow dis to examine new style classes. + +.. + +.. bpo: 8257 +.. date: 7955 +.. nonce: PzabSZ +.. section: Library + +The Decimal construct now accepts a float instance directly, converting that +float to a Decimal of equal value: + +>>> Decimal(1.1) +Decimal('1.100000000000000088817841970012523233890533447265625') + +.. + +.. bpo: 0 +.. date: 7954 +.. nonce: 02C1gn +.. section: Library + +collections.Counter() now supports a subtract() method. + +.. + +.. bpo: 0 +.. date: 7953 +.. nonce: or8thG +.. section: Library + +The functools module now has a total_ordering() class decorator to simplify +the specification of rich comparisons. + +.. + +.. bpo: 0 +.. date: 7952 +.. nonce: nshtA2 +.. section: Library + +The functools module also adds cmp_to_key() as a tool to transition old- +style comparison functions to new-style key-functions. + +.. + +.. bpo: 8294 +.. date: 7951 +.. nonce: 42HIIC +.. section: Library + +The Fraction constructor now accepts Decimal and float instances directly. + +.. + +.. bpo: 7279 +.. date: 7950 +.. nonce: v1uyoh +.. section: Library + +Comparisons involving a Decimal signaling NaN now signal InvalidOperation +instead of returning False. (Comparisons involving a quiet NaN are +unchanged.) Also, Decimal quiet NaNs are now hashable; Decimal signaling +NaNs remain unhashable. + +.. + +.. bpo: 2531 +.. date: 7949 +.. nonce: ELCENf +.. section: Library + +Comparison operations between floats and Decimal instances now return a +result based on the numeric values of the operands; previously they returned +an arbitrary result based on the relative ordering of id(float) and +id(Decimal). + +.. + +.. bpo: 8233 +.. date: 7948 +.. nonce: xJkVL4 +.. section: Library + +When run as a script, py_compile.py optionally takes a single argument `-` +which tells it to read files to compile from stdin. Each line is read on +demand and the named file is compiled immediately. (Original patch by Piotr +O?arowski). + +.. + +.. bpo: 3135 +.. date: 7947 +.. nonce: 5u_w3h +.. section: Library + +Add ``inspect.getcallargs()``, which binds arguments to a function like a +normal call. + +.. + +.. bpo: 0 +.. date: 7946 +.. nonce: CTbVhT +.. section: Library + +Backwards incompatible change: Unicode codepoints line tabulation (0x0B) and +form feed (0x0C) are now considered linebreaks, as specified in Unicode +Standard Annex #14. See issue #7643. http://www.unicode.org/reports/tr14/ + +.. + +.. bpo: 0 +.. date: 7945 +.. nonce: Y0P_8n +.. section: Library + +Comparisons using one of <, <=, >, >= between a complex instance and a +Fractions instance now raise TypeError instead of returning True/False. +This makes Fraction <=> complex comparisons consistent with int <=> complex, +float <=> complex, and complex <=> complex comparisons. + +.. + +.. bpo: 0 +.. date: 7944 +.. nonce: POrUTx +.. section: Library + +Addition of ``WeakSet`` to the ``weakref`` module. + +.. + +.. bpo: 0 +.. date: 7943 +.. nonce: 6xyUXj +.. section: Library + +logging: Added LOG_FTP to SysLogHandler and updated documentation. + +.. + +.. bpo: 8205 +.. date: 7942 +.. nonce: GK6syz +.. section: Library + +Remove the "Modules" directory from sys.path when Python is running from the +build directory (POSIX only). + +.. + +.. bpo: 7667 +.. date: 7941 +.. nonce: 581UIL +.. section: Library + +Fix doctest failures with non-ASCII paths. + +.. + +.. bpo: 7512 +.. date: 7940 +.. nonce: 3tQWru +.. section: Library + +shutil.copystat() could raise an OSError when the filesystem didn't support +chflags() (for example ZFS under FreeBSD). The error is now silenced. + +.. + +.. bpo: 7703 +.. date: 7939 +.. nonce: _QnWbZ +.. section: Library + +ctypes supports both buffer() and memoryview(). The former is deprecated. + +.. + +.. bpo: 7860 +.. date: 7938 +.. nonce: DV2Y4E +.. section: Library + +platform.uname now reports the correct 'machine' type when Python is running +in WOW64 mode on 64 bit Windows. + +.. + +.. bpo: 0 +.. date: 7937 +.. nonce: ZMh4CS +.. section: Library + +logging: Added getChild utility method to Logger and added isEnabledFor +method to LoggerAdapter. + +.. + +.. bpo: 8201 +.. date: 7936 +.. nonce: Zsfq9o +.. section: Library + +logging: Handle situation of non-ASCII and Unicode logger names existing at +the same time, causing a Unicode error when configuration code attempted to +sort the existing loggers. + +.. + +.. bpo: 8200 +.. date: 7935 +.. nonce: QhAmka +.. section: Library + +logging: Handle errors when multiprocessing is not fully loaded when logging +occurs. + +.. + +.. bpo: 3890 +.. date: 7934 +.. nonce: LxiC0p +.. section: Library + +Fix recv() and recv_into() on non-blocking SSL sockets. Also, enable the +SSL_MODE_AUTO_RETRY flag on SSL sockets, so that blocking reads and writes +are always retried by OpenSSL itself. (See also: bpo-8222) + +.. + +.. bpo: 8179 +.. date: 7933 +.. nonce: 8H5ich +.. section: Library + +Fix macpath.realpath() on a non-existing path. + +.. + +.. bpo: 8024 +.. date: 7932 +.. nonce: OWylMQ +.. section: Library + +Update the Unicode database to 5.2. + +.. + +.. bpo: 8104 +.. date: 7931 +.. nonce: sE4WnG +.. section: Library + +socket.recv_into() and socket.recvfrom_into() now support writing into +objects supporting the new buffer API, for example bytearrays or +memoryviews. + +.. + +.. bpo: 4961 +.. date: 7930 +.. nonce: WDc-2x +.. section: Library + +Inconsistent/wrong result of askyesno function in tkMessageBox with +Tcl/Tk-8.5. + +.. + +.. bpo: 8140 +.. date: 7929 +.. nonce: GfkB7_ +.. section: Library + +Extend compileall to compile single files. Add -i option. + +.. + +.. bpo: 7774 +.. date: 7928 +.. nonce: BddO6b +.. section: Library + +Set sys.executable to an empty string if ``argv[0]`` has been set to a non +existent program name and Python is unable to retrieve the real program +name. + +.. + +.. bpo: 8117 +.. date: 7927 +.. nonce: CFgyRD +.. section: Library + +logging: Improved algorithm for computing initial rollover time for +``TimedRotatingFileHandler`` by using the modification time of an existing +log file to compute the next rollover time. If the log file does not exist, +the current time is used as the basis for the computation. + +.. + +.. bpo: 6472 +.. date: 7926 +.. nonce: c0VR0M +.. section: Library + +The ``xml.etree`` package is updated to ElementTree 1.3. The cElementTree +module is updated too. + +.. + +.. bpo: 7880 +.. date: 7925 +.. nonce: oSpS50 +.. section: Library + +Fix sysconfig when the python executable is a symbolic link. + +.. + +.. bpo: 7624 +.. date: 7924 +.. nonce: P9QTki +.. section: Library + +Fix ``isinstance(foo(), collections.Callable)`` for old-style classes. + +.. + +.. bpo: 7143 +.. date: 7923 +.. nonce: A30Qss +.. section: Library + +email: ``get_payload()`` used to strip any trailing newline from a base64 +transfer-encoded payload *after* decoding it; it no longer does. This is a +behavior change, so email's minor version number is now bumped, to version +4.0.2, for the 2.7 release. + +.. + +.. bpo: 8235 +.. date: 7922 +.. nonce: 7txk3- +.. section: Library + +_socket: Add the constant ``SO_SETFIB``. SO_SETFIB is a socket option +available on FreeBSD 7.1 and newer. + +.. + +.. bpo: 8038 +.. date: 7921 +.. nonce: GrZDC3 +.. section: Library + +unittest.TestCase.assertNotRegexpMatches + +.. + +.. bpo: 0 +.. date: 7920 +.. nonce: V2kHuO +.. section: Library + +Addition of -b command line option to unittest for buffering stdout / stderr +during test runs. + +.. + +.. bpo: 1220212 +.. date: 7919 +.. nonce: GqZ0L4 +.. section: Library + +Added os.kill support for Windows, including support for sending CTRL+C and +CTRL+BREAK events to console subprocesses. + +.. + +.. bpo: 8314 +.. date: 7918 +.. nonce: s45vVC +.. section: Library + +Fix unsigned long long bug in libffi on Sparc v8. + +.. + +.. bpo: 1039 +.. date: 7917 +.. nonce: BQUTJH +.. section: Library + +Fix os.execlp() crash with missing 2nd argument. (See also: bpo-8154) + +.. + +.. bpo: 8156 +.. date: 7916 +.. nonce: 5LG8uP +.. section: Library + +bsddb module updated to version 4.8.4. +http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.8.4. This update drops +support for Berkeley DB 4.0, and adds support for 4.8. + +.. + +.. bpo: 3928 +.. date: 7915 +.. nonce: kY8ENm +.. section: Library + +os.mknod() now available in Solaris, also. + +.. + +.. bpo: 8142 +.. date: 7914 +.. nonce: ArTkHw +.. section: Library + +Update libffi to the 3.0.9 release. + +.. + +.. bpo: 8300 +.. date: 7913 +.. nonce: fAkvVk +.. section: Library + +When passing a non-integer argument to struct.pack with any integer format +code, struct.pack first attempts to convert the non-integer using its +__index__ method. If that method is non-existent or raises TypeError it +goes on to try the __int__ method, as described below. + +.. + +.. bpo: 1530559 +.. date: 7912 +.. nonce: KXF5m2 +.. section: Library + +When passing a non-integer argument to struct.pack with *any* integer format +code (one of 'bBhHiIlLqQ'), struct.pack attempts to use the argument's +__int__ method to convert to an integer before packing. It also produces a +DeprecationWarning in this case. (In Python 2.6, the behaviour was +inconsistent: __int__ was used for some integer codes but not for others, +and the set of integer codes for which it was used differed between native +packing and standard packing.) + +.. + +.. bpo: 7347 +.. date: 7911 +.. nonce: RdqRiz +.. section: Library + +_winreg: Add CreateKeyEx and DeleteKeyEx, as well as fix a bug in the return +value of QueryReflectionKey. + +.. + +.. bpo: 7993 +.. date: 7910 +.. nonce: M7oNRJ +.. section: Tools/Demos + +Add a test of IO packet processing bandwidth to ccbench. It measures the +number of UDP packets processed per second depending on the number of +background CPU-bound Python threads. + +.. + +.. bpo: 0 +.. date: 7909 +.. nonce: KeNbfw +.. section: Tools/Demos + +python-config now supports multiple options on the same command line. + +.. + +.. bpo: 8032 +.. date: 7908 +.. nonce: gv-Du9 +.. section: Build + +For gdb7, a python-gdb.py file is added to the build, allowing to use +advanced gdb features when debugging Python. + +.. + +.. bpo: 1628484 +.. date: 7907 +.. nonce: wcrSr1 +.. section: Build + +The Makefile doesn't ignore the CFLAGS environment variable anymore. It +also forwards the LDFLAGS settings to the linker when building a shared +library. + +.. + +.. bpo: 6716 +.. date: 7906 +.. nonce: tQLBdR +.. section: Build + +Quote -x arguments of compileall in MSI installer. + +.. + +.. bpo: 7705 +.. date: 7905 +.. nonce: sw6ifg +.. section: Build + +Fix linking on FreeBSD. + +.. + +.. bpo: 0 +.. date: 7904 +.. nonce: Dm_ncE +.. section: Build + +Make sure that the FreeBSD build of the included libffi uses the proper +assembly file. + +.. + +.. bpo: 8276 +.. date: 7903 +.. nonce: 40pgLF +.. section: C API + +PyEval_CallObject() is now only available in macro form. The function +declaration, which was kept for backwards compatibility reasons, is now +removed (the macro was introduced in 1997!). + +.. + +.. bpo: 7992 +.. date: 7902 +.. nonce: 2eLlya +.. section: C API + +A replacement PyCObject API, PyCapsule, has been backported from Python 3.1. +All existing Python CObjects in the main distribution have been converted to +capsules. To address backwards-compatibility concerns, +PyCObject_AsVoidPtr() was changed to understand capsules. + +.. + +.. bpo: 3864 +.. date: 7901 +.. nonce: bkbNiO +.. section: Tests + +Skip three test_signal tests on freebsd6 because they fail if any thread was +previously started, most likely due to a platform bug. + +.. + +.. bpo: 8348 +.. date: 7900 +.. nonce: Nygf2t +.. section: Tests + +Fix test ftp url in test_urllib2net. + +.. + +.. bpo: 8204 +.. date: 7899 +.. nonce: iYMJ7_ +.. section: Tests + +Fix test_ttk notebook test by forcing focus. + +.. + +.. bpo: 8344 +.. date: 7898 +.. nonce: kt2Sq_ +.. section: Tests + +Fix test_ttk bug on FreeBSD. + +.. + +.. bpo: 8193 +.. date: 7897 +.. nonce: T8MbIc +.. section: Tests + +Fix test_zlib failure with zlib 1.2.4. + +.. + +.. bpo: 8248 +.. date: 7896 +.. nonce: pBx5bT +.. section: Tests + +Add some tests for the bool type. Patch by Gregory Nofi. + +.. + +.. bpo: 8263 +.. date: 7895 +.. nonce: zNUf-5 +.. section: Tests + +Now regrtest.py will report a failure if it receives a KeyboardInterrupt +(SIGINT). + +.. + +.. bpo: 8180 +.. date: 7894 +.. nonce: yyLvZY +.. section: Tests + +Fix test_pep277 on OS X and add more tests for special Unicode normalization +cases. (See also: bpo-8207) + +.. + +.. bpo: 7783 +.. date: 7893 +.. nonce: K20ttO +.. section: Tests + +test.test_support.open_urlresource invalidates the outdated files from the +local cache. diff --git a/Misc/NEWS.d/2.7b2.rst b/Misc/NEWS.d/2.7b2.rst new file mode 100644 index 00000000000..caa336b7427 --- /dev/null +++ b/Misc/NEWS.d/2.7b2.rst @@ -0,0 +1,666 @@ +.. bpo: 0 +.. date: 8039 +.. nonce: 8aqNKP +.. release date: 2010-05-08 +.. section: Core and Builtins + +Run Clang 2.7's static analyzer for ``Objects/`` and ``Python/``. + +.. + +.. bpo: 1533 +.. date: 8038 +.. nonce: 6FLjC9 +.. section: Core and Builtins + +Fix inconsistency in range function argument processing: any non-float non- +integer argument is now converted to an integer (if possible) using its +__int__ method. Previously, only small arguments were treated this way; +larger arguments (those whose __int__ was outside the range of a C long) +would produce a TypeError. + +.. + +.. bpo: 8202 +.. date: 8037 +.. nonce: UvqmQ2 +.. section: Core and Builtins + +``sys.argv[0]`` is now set to '-m' instead of '-c' when searching for the +module file to be executed with the -m command line option. + +.. + +.. bpo: 7319 +.. date: 8036 +.. nonce: Ry0QuX +.. section: Core and Builtins + +When -Q is used, do not silence DeprecationWarning. + +.. + +.. bpo: 7332 +.. date: 8035 +.. nonce: mCUzwz +.. section: Core and Builtins + +Remove the 16KB stack-based buffer in ``PyMarshal_ReadLastObjectFromFile``, +which doesn't bring any noticeable benefit compared to the dynamic memory +allocation fallback. Patch by Charles-Fran?ois Natali. + +.. + +.. bpo: 8417 +.. date: 8034 +.. nonce: qcRfh8 +.. section: Core and Builtins + +Raise an OverflowError when an integer larger than sys.maxsize is passed to +bytearray. + +.. + +.. bpo: 7072 +.. date: 8033 +.. nonce: YGHQG7 +.. section: Core and Builtins + +``isspace(0xa0)`` is true on Mac OS X. + +.. + +.. bpo: 8404 +.. date: 8032 +.. nonce: 0krGPF +.. section: Core and Builtins + +Fix set operations on dictionary views. + +.. + +.. bpo: 8084 +.. date: 8031 +.. nonce: uiAFoS +.. section: Core and Builtins + +PEP 370 now conforms to system conventions for framework builds on MacOS X. +That is, ``python setup.py install --user`` will install into +``~/Library/Python/2.7`` instead of ``~/.local``. + +.. + +.. bpo: 8681 +.. date: 8030 +.. nonce: bnD2Mi +.. section: Library + +Make the zlib module's error messages more informative when the zlib itself +doesn't give any detailed explanation. + +.. + +.. bpo: 8571 +.. date: 8029 +.. nonce: BGxcud +.. section: Library + +Fix an internal error when compressing or decompressing a chunk larger than +1GB with the zlib module's compressor and decompressor objects. + +.. + +.. bpo: 8573 +.. date: 8028 +.. nonce: PZTYKm +.. section: Library + +asyncore ``_strerror()`` function might throw ValueError. + +.. + +.. bpo: 8483 +.. date: 8027 +.. nonce: gWRwCr +.. section: Library + +asyncore.dispatcher's __getattr__ method produced confusing error messages +when accessing undefined class attributes because of the cheap inheritance +with the underlying socket object. The cheap inheritance has been +deprecated. + +.. + +.. bpo: 4265 +.. date: 8026 +.. nonce: gtcR-h +.. section: Library + +``shutil.copyfile()`` was leaking file descriptors when disk fills. Patch +by Tres Seaver. + +.. + +.. bpo: 7755 +.. date: 8025 +.. nonce: k5FaAX +.. section: Library + +Use an unencumbered audio file for tests. + +.. + +.. bpo: 8621 +.. date: 8024 +.. nonce: 64sJJn +.. section: Library + +``uuid.uuid4()`` returned the same sequence of values in the parent and any +children created using ``os.fork`` on Mac OS X 10.6. + +.. + +.. bpo: 8313 +.. date: 8023 +.. nonce: lE868K +.. section: Library + +``traceback.format_exception_only()`` encodes unicode message to ASCII with +backslashreplace error handler if ``str(value)`` failed. + +.. + +.. bpo: 8567 +.. date: 8022 +.. nonce: agGfsd +.. section: Library + +Fix precedence of signals in Decimal module: when a Decimal operation raises +multiple signals and more than one of those signals is trapped, the +specification determines the order in which the signals should be handled. +In many cases this order wasn't being followed, leading to the wrong Python +exception being raised. + +.. + +.. bpo: 7865 +.. date: 8021 +.. nonce: YF-RSw +.. section: Library + +The close() method of :mod:`io` objects should not swallow exceptions raised +by the implicit flush(). Also ensure that calling close() several times is +supported. Patch by Pascal Chambon. + +.. + +.. bpo: 8576 +.. date: 8020 +.. nonce: P-vn7s +.. section: Library + +logging updated to remove usage of find_unused_port(). + +.. + +.. bpo: 4687 +.. date: 8019 +.. nonce: WuWPAI +.. section: Library + +Fix accuracy of garbage collection runtimes displayed with gc.DEBUG_STATS. + +.. + +.. bpo: 8354 +.. date: 8018 +.. nonce: ihPpD8 +.. section: Library + +The siginterrupt setting is now preserved for all signals, not just SIGCHLD. + +.. + +.. bpo: 7192 +.. date: 8017 +.. nonce: crfmVq +.. section: Library + +``webbrowser.get("firefox")`` now works on Mac OS X, as does +``webbrowser.get("safari")``. + +.. + +.. bpo: 8577 +.. date: 8016 +.. nonce: aNmUf8 +.. section: Library + +``distutils.sysconfig.get_python_inc()`` now makes a difference between the +build dir and the source dir when looking for "python.h" or "Include". + +.. + +.. bpo: 8464 +.. date: 8015 +.. nonce: dckIPz +.. section: Library + +tarfile no longer creates files with execute permissions set when mode="w|" +is used. + +.. + +.. bpo: 7834 +.. date: 8014 +.. nonce: 6FWkzA +.. section: Library + +Fix connect() of Bluetooth L2CAP sockets with recent versions of the Linux +kernel. Patch by Yaniv Aknin. + +.. + +.. bpo: 6312 +.. date: 8013 +.. nonce: ZgHCwc +.. section: Library + +Fix http HEAD request when the transfer encoding is chunked. It should +correctly return an empty response now. + +.. + +.. bpo: 7490 +.. date: 8012 +.. nonce: hT8uzG +.. section: Library + +To facilitate sharing of doctests between 2.x and 3.x test suites, the +``IGNORE_EXCEPTION_DETAIL`` directive now also ignores the module location +of the raised exception. Based on initial patch by Lennart Regebro. + +.. + +.. bpo: 8086 +.. date: 8011 +.. nonce: Nn01DF +.. section: Library + +In :func:`ssl.DER_cert_to_PEM_cert()`, fix missing newline before the +certificate footer. Patch by Kyle VanderBeek. + +.. + +.. bpo: 8546 +.. date: 8010 +.. nonce: ZJV_Z2 +.. section: Library + +Reject None given as the buffering argument to ``_pyio.open()``. + +.. + +.. bpo: 8549 +.. date: 8009 +.. nonce: 9m7vbm +.. section: Library + +Fix compiling the _ssl extension under AIX. Patch by Sridhar Ratnakumar. + +.. + +.. bpo: 6656 +.. date: 8008 +.. nonce: oU6_NU +.. section: Library + +Fix locale.format_string to handle escaped percents and mappings. + +.. + +.. bpo: 2302 +.. date: 8007 +.. nonce: KqJUA8 +.. section: Library + +Fix a race condition in SocketServer.BaseServer.shutdown, where the method +could block indefinitely if called just before the event loop started +running. This also fixes the occasional freezes witnessed in +test_httpservers. + +.. + +.. bpo: 5103 +.. date: 8006 +.. nonce: mBe0-l +.. section: Library + +SSL handshake would ignore the socket timeout and block indefinitely if the +other end didn't respond. + +.. + +.. bpo: 0 +.. date: 8005 +.. nonce: XlQAbN +.. section: Library + +The do_handshake() method of SSL objects now adjusts the blocking mode of +the SSL structure if necessary (as other methods already do). + +.. + +.. bpo: 7507 +.. date: 8004 +.. nonce: PPZWiA +.. section: Library + +Quote "!" in pipes.quote(); it is special to some shells. + +.. + +.. bpo: 5238 +.. date: 8003 +.. nonce: HjIVqr +.. section: Library + +Calling makefile() on an SSL object would prevent the underlying socket from +being closed until all objects get truely destroyed. + +.. + +.. bpo: 7943 +.. date: 8002 +.. nonce: 0wcepT +.. section: Library + +Fix circular reference created when instantiating an SSL socket. Initial +patch by P?ter Szab?. + +.. + +.. bpo: 8451 +.. date: 8001 +.. nonce: vWZKfu +.. section: Library + +Syslog module now uses basename(sys.argv[0]) instead of the string "python" +as the *ident*. openlog() arguments are all optional and keywords. + +.. + +.. bpo: 8108 +.. date: 8000 +.. nonce: gw3ghC +.. section: Library + +Fix the unwrap() method of SSL objects when the socket has a non-infinite +timeout. Also make that method friendlier with applications wanting to +continue using the socket in clear-text mode, by disabling OpenSSL's +internal readahead. Thanks to Darryl Miles for guidance. + +.. + +.. bpo: 8484 +.. date: 7999 +.. nonce: b9zFsh +.. section: Library + +Load all ciphers and digest algorithms when initializing the _ssl extension, +such that verification of some SSL certificates doesn't fail because of an +"unknown algorithm". + +.. + +.. bpo: 8437 +.. date: 7998 +.. nonce: iGGyX3 +.. section: Library + +Fix test_gdb failures, patch written by Dave Malcolm + +.. + +.. bpo: 4814 +.. date: 7997 +.. nonce: kc5m59 +.. section: Library + +The timeout parameter is now applied also for connections resulting from +PORT/EPRT commands. + +.. + +.. bpo: 8463 +.. date: 7996 +.. nonce: slxxrW +.. section: Library + +Add missing reference to bztar in shutil's documentation. + +.. + +.. bpo: 8438 +.. date: 7995 +.. nonce: TUjaAU +.. section: Library + +Remove reference to the missing "surrogateescape" encoding error handler +from the new IO library. + +.. + +.. bpo: 3817 +.. date: 7994 +.. nonce: 6zjb85 +.. section: Library + +ftplib.FTP.abort() method now considers 225 a valid response code as stated +in RFC-959 at chapter 5.4. + +.. + +.. bpo: 8279 +.. date: 7993 +.. nonce: MubiOg +.. section: Library + +Fix test_gdb failures. + +.. + +.. bpo: 8322 +.. date: 7992 +.. nonce: XVocgc +.. section: Library + +Add a *ciphers* argument to SSL sockets, so as to change the available +cipher list. Helps fix test_ssl with OpenSSL 1.0.0. + +.. + +.. bpo: 2987 +.. date: 7991 +.. nonce: FbxT-M +.. section: Library + +RFC 2732 support for urlparse (IPv6 addresses). Patch by Tony Locke and +Hans Ulrich Niedermann. + +.. + +.. bpo: 7585 +.. date: 7990 +.. nonce: stGadz +.. section: Library + +difflib context and unified diffs now place a tab between filename and date, +conforming to the 'standards' they were originally designed to follow. This +improves compatibility with patch tools. + +.. + +.. bpo: 7472 +.. date: 7989 +.. nonce: IghBPp +.. section: Library + +Fixed typo in email.encoders module; messages using ISO-2022 character sets +will now consistently use a Content-Transfer-Encoding of 7bit rather than +sometimes being marked as 8bit. + +.. + +.. bpo: 8330 +.. date: 7988 +.. nonce: LPDqBG +.. section: Library + +Fix expected output in test_gdb. + +.. + +.. bpo: 8374 +.. date: 7987 +.. nonce: bWoGdD +.. section: Library + +Update the internal alias table in the :mod:`locale` module to cover recent +locale changes and additions. + +.. + +.. bpo: 8644 +.. date: 7986 +.. nonce: JWO_61 +.. section: Library + +Improved accuracy of ``timedelta.total_seconds()``. + +.. + +.. bpo: 0 +.. date: 7985 +.. nonce: LYHXVb +.. section: Library + +Use Clang 2.7's static analyzer to find places to clean up some code. + +.. + +.. bpo: 0 +.. date: 7984 +.. nonce: jbiDIM +.. section: Library + +Build the ossaudio extension on GNU/kFreeBSD. + +.. + +.. bpo: 0 +.. date: 7983 +.. nonce: NCKMWo +.. section: Library + +On Windows, ctypes no longer checks the stack before and after calling a +foreign function. This allows using the unmodified libffi library. + +.. + +.. bpo: 8672 +.. date: 7982 +.. nonce: hs9Ync +.. section: Tests + +Add a zlib test ensuring that an incomplete stream can be handled by a +decompressor object without errors (it returns incomplete uncompressed +data). + +.. + +.. bpo: 8490 +.. date: 7981 +.. nonce: yG1Xr0 +.. section: Tests + +asyncore now has a more solid test suite which actually tests its API. + +.. + +.. bpo: 8576 +.. date: 7980 +.. nonce: Up6MTB +.. section: Tests + +Remove use of find_unused_port() in test_smtplib and test_multiprocessing. +Patch by Paul Moore. + +.. + +.. bpo: 7449 +.. date: 7979 +.. nonce: as77J5 +.. section: Tests + +Fix many tests to support Python compiled without thread support. Patches +written by Jerry Seutter. + +.. + +.. bpo: 8108 +.. date: 7978 +.. nonce: -PlMAS +.. section: Tests + +test_ftplib's non-blocking SSL server now has proper handling of SSL +shutdowns. + +.. + +.. bpo: 8625 +.. date: 7977 +.. nonce: E4dSUW +.. section: Build + +Turn off optimization in ``--with-pydebug`` builds with gcc. (Optimization +was unintentionally turned on in gcc --with-pydebug builds in 2.7 beta1 as a +result of the issue #1628484 fix, combined with autoconf's strange choice of +default CFLAGS produced by AC_PROG_CC for gcc.) + +.. + +.. bpo: 8509 +.. date: 7976 +.. nonce: N8vHHZ +.. section: Build + +Fix quoting in help strings and code snippets in configure.in. + +.. + +.. bpo: 3646 +.. date: 7975 +.. nonce: UyNDbm +.. section: Build + +It is now easily possible to install a Python framework into your home +directory on Mac OS X, see Mac/README for more information. + +.. + +.. bpo: 8510 +.. date: 7974 +.. nonce: 8MiUfR +.. section: Build + +Update to autoconf 2.65. + +.. + +.. bpo: 0 +.. date: 7973 +.. nonce: 18HloG +.. section: Windows + +Update the Vim syntax highlight file. diff --git a/Misc/NEWS.d/2.7rc1.rst b/Misc/NEWS.d/2.7rc1.rst new file mode 100644 index 00000000000..1984c09a6e8 --- /dev/null +++ b/Misc/NEWS.d/2.7rc1.rst @@ -0,0 +1,395 @@ +.. bpo: 8271 +.. date: 8078 +.. nonce: HKwc-i +.. release date: 2010-06-05 +.. section: Core and Builtins + +during the decoding of an invalid UTF-8 byte sequence, only the start byte +and the continuation byte(s) are now considered invalid, instead of the +number of bytes specified by the start byte. E.g.: +'\xf1\x80AB'.decode('utf-8', 'replace') now returns u'\ufffdAB' and replaces +with U+FFFD only the start byte ('\xf1') and the continuation byte ('\x80') +even if '\xf1' is the start byte of a 4-bytes sequence. Previous versions +returned a single u'\ufffd'. + +.. + +.. bpo: 8627 +.. date: 8077 +.. nonce: l2l6Zs +.. section: Core and Builtins + +Remove bogus "Overriding __cmp__ blocks inheritance of __hash__ in 3.x" +warning. Also fix "XXX undetected error" that arises from the "Overriding +__eq__ blocks inheritance ..." warning when turned into an exception: in +this case the exception simply gets ignored. + +.. + +.. bpo: 8748 +.. date: 8076 +.. nonce: bKymOB +.. section: Core and Builtins + +Fix two issues with comparisons between complex and integer objects. (1) +The comparison could incorrectly return True in some cases (2**53+1 == +complex(2**53) == 2**53), breaking transivity of equality. (2) The +comparison raised an OverflowError for large integers, leading to +unpredictable exceptions when combining integers and complex objects in sets +or dicts. + +.. + +.. bpo: 5211 +.. date: 8075 +.. nonce: BNwm54 +.. section: Core and Builtins + +Implicit coercion for the complex type is now completely removed. (Coercion +for arithmetic operations was already removed in 2.7 alpha 4, but coercion +for rich comparisons was accidentally left in.) + +.. + +.. bpo: 3798 +.. date: 8074 +.. nonce: L9n27k +.. section: Core and Builtins + +Write sys.exit() message to sys.stderr to use stderr encoding and error +handler, instead of writing to the C stderr file in utf-8 + +.. + +.. bpo: 7902 +.. date: 8073 +.. nonce: K75Ezw +.. section: Core and Builtins + +When using explicit relative import syntax, don't try implicit relative +import semantics. + +.. + +.. bpo: 7079 +.. date: 8072 +.. nonce: wEGBdB +.. section: Core and Builtins + +Fix a possible crash when closing a file object while using it from another +thread. Patch by Daniel Stutzbach. + +.. + +.. bpo: 8868 +.. date: 8071 +.. nonce: rg3J-W +.. section: Core and Builtins + +Fix that ensures that python scripts have access to the Window Server again +in a framework build on MacOSX 10.5 or earlier. + +.. + +.. bpo: 5753 +.. date: 8070 +.. nonce: 205374 +.. section: C API + +A new C API function, :cfunc:`PySys_SetArgvEx`, allows embedders of the +interpreter to set sys.argv without also modifying sys.path. This helps fix +`CVE-2008-5983 `_. + +.. + +.. bpo: 8302 +.. date: 8069 +.. nonce: U5tZ_l +.. section: Library + +SkipTest in unittest.TestCase.setUpClass or setUpModule is now reported as a +skip rather than an error. + +.. + +.. bpo: 8351 +.. date: 8068 +.. nonce: 8I5oO- +.. section: Library + +Excessively large diffs due to unittest.TestCase.assertSequenceEqual are no +longer included in failure reports. + +.. + +.. bpo: 8899 +.. date: 8067 +.. nonce: Q6oIpy +.. section: Library + +time.struct_time now has class and attribute docstrings. + +.. + +.. bpo: 4487 +.. date: 8066 +.. nonce: WdV86e +.. section: Library + +email now accepts as charset aliases all codec aliases accepted by the +codecs module. + +.. + +.. bpo: 6470 +.. date: 8065 +.. nonce: eVTlgU +.. section: Library + +Drop UNC prefix in FixTk. + +.. + +.. bpo: 5610 +.. date: 8064 +.. nonce: 3x0O2c +.. section: Library + +feedparser no longer eats extra characters at the end of a body part if the +body part ends with a \r\n. + +.. + +.. bpo: 8833 +.. date: 8063 +.. nonce: R9JBZA +.. section: Library + +tarfile created hard link entries with a size field != 0 by mistake. + +.. + +.. bpo: 1368247 +.. date: 8062 +.. nonce: OVD5zb +.. section: Library + +set_charset (and therefore MIMEText) now automatically encodes a unicode +_payload to the output_charset. + +.. + +.. bpo: 7150 +.. date: 8061 +.. nonce: kBTznJ +.. section: Library + +Raise OverflowError if the result of adding or subtracting timedelta from +date or datetime falls outside of the MINYEAR:MAXYEAR range. + +.. + +.. bpo: 6662 +.. date: 8060 +.. nonce: jpO1QX +.. section: Library + +Fix parsing of malformatted charref (&#bad;), patch written by Fredrik H??rd + +.. + +.. bpo: 8016 +.. date: 8059 +.. nonce: vAmdrz +.. section: Library + +Add the CP858 codec. + +.. + +.. bpo: 3924 +.. date: 8058 +.. nonce: -W1f1B +.. section: Library + +Ignore cookies with invalid "version" field in cookielib. + +.. + +.. bpo: 6268 +.. date: 8057 +.. nonce: fQgJxL +.. section: Library + +Fix seek() method of codecs.open(), don't read or write the BOM twice after +seek(0). Fix also reset() method of codecs, UTF-16, UTF-32 and StreamWriter +classes. + +.. + +.. bpo: 5640 +.. date: 8056 +.. nonce: dpc6TZ +.. section: Library + +Fix Shift-JIS incremental encoder for error handlers different than +'strict'. + +.. + +.. bpo: 8782 +.. date: 8055 +.. nonce: asLuOV +.. section: Library + +Add a trailing newline in linecache.updatecache to the last line of files +without one. + +.. + +.. bpo: 8729 +.. date: 8054 +.. nonce: Nq_Uhf +.. section: Library + +Return NotImplemented from ``collections.Mapping.__eq__()`` when comparing +to a non-mapping. + +.. + +.. bpo: 8759 +.. date: 8053 +.. nonce: 0yDlu7 +.. section: Library + +Fix user paths in sysconfig for posix and os2 schemes. + +.. + +.. bpo: 1285086 +.. date: 8052 +.. nonce: U8BtXR +.. section: Library + +Speed up ``urllib.quote()`` and urllib.unquote for simple cases. + +.. + +.. bpo: 8688 +.. date: 8051 +.. nonce: gUJqmI +.. section: Library + +Distutils now recalculates MANIFEST every time. + +.. + +.. bpo: 5099 +.. date: 8050 +.. nonce: kmjFaU +.. section: Library + +The ``__del__()`` method of ``subprocess.Popen`` (and the methods it calls) +referenced global objects, causing errors to pop up during interpreter +shutdown. + +.. + +.. bpo: 7384 +.. date: 8049 +.. nonce: E16zrc +.. section: Library + +If the system readline library is linked against ncurses, the curses module +must be linked against ncurses as well. Otherwise it is not safe to load +both the readline and curses modules in an application. + +.. + +.. bpo: 2810 +.. date: 8048 +.. nonce: FSt0Y0 +.. section: Library + +Fix cases where the Windows registry API returns ERROR_MORE_DATA, requiring +a re-try in order to get the complete result. + +.. + +.. bpo: 8674 +.. date: 8047 +.. nonce: Q2kfWX +.. section: Library + +Fixed a number of incorrect or undefined-behaviour-inducing overflow checks +in the ``audioop`` module. + +.. + +.. bpo: 8889 +.. date: 8046 +.. nonce: 9IoVzA +.. section: Tests + +test_support.transient_internet rewritten so that the new checks also work +on FreeBSD, which lacks EAI_NODATA. + +.. + +.. bpo: 8835 +.. date: 8045 +.. nonce: FJzJvJ +.. section: Tests + +test_support.transient_internet() catches gaierror(EAI_NONAME) and +gaierror(EAI_NODATA) + +.. + +.. bpo: 7449 +.. date: 8044 +.. nonce: LeKyd_ +.. section: Tests + +Skip test_socketserver if threading support is disabled + +.. + +.. bpo: 0 +.. date: 8043 +.. nonce: b_na1a +.. section: Tests + +On darwin, ``test_site`` assumed that a framework build was being used, +leading to a failure where four directories were expected for site-packages +instead of two in a non-framework build. + +.. + +.. bpo: 0 +.. date: 8042 +.. nonce: g-v7fs +.. section: Build + +Display installer warning that Windows 2000 won't be supported in future +releases. + +.. + +.. bpo: 1759169 +.. date: 8041 +.. nonce: NW035m +.. section: Build + +Drop _XOPEN_SOURCE on Solaris, define it for multiprocessing only. (See +also: bpo-8864) + +.. + +.. bpo: 5464 +.. date: 8040 +.. nonce: R1pj9Y +.. section: Tools/Demos + +Implement plural forms in msgfmt.py. diff --git a/Misc/NEWS.d/2.7rc2.rst b/Misc/NEWS.d/2.7rc2.rst new file mode 100644 index 00000000000..6ad807590f1 --- /dev/null +++ b/Misc/NEWS.d/2.7rc2.rst @@ -0,0 +1,125 @@ +.. bpo: 9058 +.. date: 8091 +.. nonce: l34Hmg +.. release date: 2010-06-20 +.. section: Core and Builtins + +Remove assertions about INT_MAX in UnicodeDecodeError. + +.. + +.. bpo: 8202 +.. date: 8090 +.. nonce: D-a4-i +.. section: Core and Builtins + +Previous change to ``sys.argv[0]`` handling for -m command line option +reverted due to unintended side effects on handling of ``sys.path``. See +tracker issue for details. + +.. + +.. bpo: 8941 +.. date: 8089 +.. nonce: p6MUoO +.. section: Core and Builtins + +decoding big endian UTF-32 data in UCS-2 builds could crash the interpreter +with characters outside the Basic Multilingual Plane (higher than 0x10000). + +.. + +.. bpo: 0 +.. date: 8088 +.. nonce: diKrLc +.. section: Core and Builtins + +In the unicode/str.format(), raise a ValueError when indexes to arguments +are too large. + +.. + +.. bpo: 8854 +.. date: 8087 +.. nonce: gOjstX +.. section: Build + +Fix finding Visual Studio 2008 on Windows x64. + +.. + +.. bpo: 6589 +.. date: 8086 +.. nonce: nEjgGc +.. section: Library + +cleanup asyncore.socket_map in case smtpd.SMTPServer constructor raises an +exception. + +.. + +.. bpo: 8959 +.. date: 8085 +.. nonce: lO7u2O +.. section: Library + +fix regression caused by using unmodified libffi library on Windows. ctypes +does now again check the stack before and after calling foreign functions. + +.. + +.. bpo: 8720 +.. date: 8084 +.. nonce: rgLhvU +.. section: Library + +fix regression caused by fix for #4050 by making getsourcefile smart enough +to find source files in the linecache. + +.. + +.. bpo: 8986 +.. date: 8083 +.. nonce: f31LM5 +.. section: Library + +math.erfc was incorrectly raising OverflowError for values between -27.3 and +-30.0 on some platforms. + +.. + +.. bpo: 8924 +.. date: 8082 +.. nonce: ENI5YP +.. section: Library + +logging: Improved error handling for Unicode in exception text. + +.. + +.. bpo: 8948 +.. date: 8081 +.. nonce: BIIiQc +.. section: Library + +cleanup functions and class / module setups and teardowns are now honored in +unittest debug methods. + +.. + +.. bpo: 8909 +.. date: 8080 +.. nonce: OfU6lI +.. section: Documentation + +Added the size of the bitmap used in the installer created by distutils' +bdist_wininst. Patch by Anatoly Techtonik. + +.. + +.. bpo: 8362 +.. date: 8079 +.. nonce: KsG-3E +.. section: Windows + +Add maintainers.rst: list of module maintainers diff --git a/Misc/NEWS.d/next/Build/008.bpo-28768.b9_a6E.rst b/Misc/NEWS.d/next/Build/008.bpo-28768.b9_a6E.rst new file mode 100644 index 00000000000..702e14e1a94 --- /dev/null +++ b/Misc/NEWS.d/next/Build/008.bpo-28768.b9_a6E.rst @@ -0,0 +1 @@ +Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto diff --git a/Misc/NEWS.d/next/Build/009.bpo-29572.iZ1XKK.rst b/Misc/NEWS.d/next/Build/009.bpo-29572.iZ1XKK.rst new file mode 100644 index 00000000000..9bf71f90d81 --- /dev/null +++ b/Misc/NEWS.d/next/Build/009.bpo-29572.iZ1XKK.rst @@ -0,0 +1 @@ +Update Windows build and OS X installers to use OpenSSL 1.0.2k. diff --git a/Misc/NEWS.d/next/Build/010.bpo-29643.4DrjEB.rst b/Misc/NEWS.d/next/Build/010.bpo-29643.4DrjEB.rst new file mode 100644 index 00000000000..51f66677433 --- /dev/null +++ b/Misc/NEWS.d/next/Build/010.bpo-29643.4DrjEB.rst @@ -0,0 +1 @@ +Fix ``--enable-optimization`` configure option didn't work. diff --git a/Misc/NEWS.d/next/Build/011.bpo-27593.v87xEr.rst b/Misc/NEWS.d/next/Build/011.bpo-27593.v87xEr.rst new file mode 100644 index 00000000000..5b345e67a86 --- /dev/null +++ b/Misc/NEWS.d/next/Build/011.bpo-27593.v87xEr.rst @@ -0,0 +1,3 @@ +sys.version and the platform module python_build(), python_branch(), and +python_revision() functions now use git information rather than hg when +building from a repo. diff --git a/Misc/NEWS.d/next/Build/012.bpo-23404.PdYVWg.rst b/Misc/NEWS.d/next/Build/012.bpo-23404.PdYVWg.rst new file mode 100644 index 00000000000..0addfd094f1 --- /dev/null +++ b/Misc/NEWS.d/next/Build/012.bpo-23404.PdYVWg.rst @@ -0,0 +1,2 @@ +Don't regenerate generated files based on file modification time anymore: +the action is now explicit. Replace ``make touch`` with ``make regen-all``. diff --git a/Misc/NEWS.d/next/Build/013.bpo-29243.WDK4hT.rst b/Misc/NEWS.d/next/Build/013.bpo-29243.WDK4hT.rst new file mode 100644 index 00000000000..378e49f67bc --- /dev/null +++ b/Misc/NEWS.d/next/Build/013.bpo-29243.WDK4hT.rst @@ -0,0 +1,3 @@ +Prevent unnecessary rebuilding of Python during ``make test``, ``make +install`` and some other make targets when configured with ``--enable- +optimizations``. diff --git a/Misc/NEWS.d/next/Core and Builtins/063.bpo-28932.QnLx8A.rst b/Misc/NEWS.d/next/Core and Builtins/063.bpo-28932.QnLx8A.rst new file mode 100644 index 00000000000..e20901189b2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/063.bpo-28932.QnLx8A.rst @@ -0,0 +1 @@ +Do not include if it does not exist. diff --git a/Misc/NEWS.d/next/Core and Builtins/064.bpo-29145.2x5NOb.rst b/Misc/NEWS.d/next/Core and Builtins/064.bpo-29145.2x5NOb.rst new file mode 100644 index 00000000000..36ccc229be0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/064.bpo-29145.2x5NOb.rst @@ -0,0 +1,2 @@ +Fix overflow checks in string, bytearray and unicode. Patch by jan matejek +and Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/065.bpo-29028.BxGcd9.rst b/Misc/NEWS.d/next/Core and Builtins/065.bpo-29028.BxGcd9.rst new file mode 100644 index 00000000000..c17312217dd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/065.bpo-29028.BxGcd9.rst @@ -0,0 +1,2 @@ +Fixed possible use-after-free bugs in the subscription of the buffer object +with custom index object. diff --git a/Misc/NEWS.d/next/Core and Builtins/066.bpo-14376.xrKNqX.rst b/Misc/NEWS.d/next/Core and Builtins/066.bpo-14376.xrKNqX.rst new file mode 100644 index 00000000000..843bf810adf --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/066.bpo-14376.xrKNqX.rst @@ -0,0 +1 @@ +Allow sys.exit to accept longs as well as ints. Patch by Gareth Rees. diff --git a/Misc/NEWS.d/next/Core and Builtins/067.bpo-29347.1RPPGN.rst b/Misc/NEWS.d/next/Core and Builtins/067.bpo-29347.1RPPGN.rst new file mode 100644 index 00000000000..35fa1066645 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/067.bpo-29347.1RPPGN.rst @@ -0,0 +1,2 @@ +Fixed possibly dereferencing undefined pointers when creating weakref +objects. diff --git a/Misc/NEWS.d/next/Core and Builtins/068.bpo-29602.qyyskC.rst b/Misc/NEWS.d/next/Core and Builtins/068.bpo-29602.qyyskC.rst new file mode 100644 index 00000000000..cc1366caf30 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/068.bpo-29602.qyyskC.rst @@ -0,0 +1,3 @@ +Fix incorrect handling of signed zeros in complex constructor for complex +subclasses and for inputs having a __complex__ method. Patch by Serhiy +Storchaka. diff --git a/Misc/NEWS.d/next/Core and Builtins/069.bpo-28598.QxbzQn.rst b/Misc/NEWS.d/next/Core and Builtins/069.bpo-28598.QxbzQn.rst new file mode 100644 index 00000000000..4757347a3d0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/069.bpo-28598.QxbzQn.rst @@ -0,0 +1,2 @@ +Support __rmod__ for subclasses of str being called before str.__mod__. +Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Core and Builtins/070.bpo-29935.2ZTSxR.rst b/Misc/NEWS.d/next/Core and Builtins/070.bpo-29935.2ZTSxR.rst new file mode 100644 index 00000000000..e035ac03b96 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/070.bpo-29935.2ZTSxR.rst @@ -0,0 +1,2 @@ +Fixed error messages in the index() method of tuple and list when pass +indices of wrong type. diff --git a/Misc/NEWS.d/next/Core and Builtins/071.bpo-25794.j0nJ5x.rst b/Misc/NEWS.d/next/Core and Builtins/071.bpo-25794.j0nJ5x.rst new file mode 100644 index 00000000000..ed9286f167e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/071.bpo-25794.j0nJ5x.rst @@ -0,0 +1,2 @@ +Fixed type.__setattr__() and type.__delattr__() for non-interned or unicode +attribute names. Based on patch by Eryk Sun. diff --git a/Misc/NEWS.d/next/Core and Builtins/072.bpo-27945.p29r3O.rst b/Misc/NEWS.d/next/Core and Builtins/072.bpo-27945.p29r3O.rst new file mode 100644 index 00000000000..da5b8d1a2ca --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/072.bpo-27945.p29r3O.rst @@ -0,0 +1,3 @@ +Fixed various segfaults with dict when input collections are mutated during +searching, inserting or comparing. Based on patches by Duane Griffin and +Tim Mitchell. diff --git a/Misc/NEWS.d/next/Core and Builtins/073.bpo-30657.Q_r7JJ.rst b/Misc/NEWS.d/next/Core and Builtins/073.bpo-30657.Q_r7JJ.rst new file mode 100644 index 00000000000..9beaead492f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/073.bpo-30657.Q_r7JJ.rst @@ -0,0 +1,2 @@ +Fixed possible integer overflow in PyString_DecodeEscape. Patch by Jay +Bosamiya. diff --git a/Misc/NEWS.d/next/Documentation/014.bpo-12067.8RbyOz.rst b/Misc/NEWS.d/next/Documentation/014.bpo-12067.8RbyOz.rst new file mode 100644 index 00000000000..72caeee6232 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/014.bpo-12067.8RbyOz.rst @@ -0,0 +1,4 @@ +Rewrite Comparisons section in the Expressions chapter of the language +reference. Some of the details of comparing mixed types were incorrect or +ambiguous. Added default behaviour and consistency suggestions for user- +defined classes. Based on patch from Andy Maier. diff --git a/Misc/NEWS.d/next/Documentation/015.bpo-26355.SDq_8Y.rst b/Misc/NEWS.d/next/Documentation/015.bpo-26355.SDq_8Y.rst new file mode 100644 index 00000000000..2614c0ba850 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/015.bpo-26355.SDq_8Y.rst @@ -0,0 +1,2 @@ +Add canonical header link on each page to corresponding major version of the +documentation. Patch by Matthias Bussonnier. diff --git a/Misc/NEWS.d/next/Documentation/016.bpo-28929.Md7kb0.rst b/Misc/NEWS.d/next/Documentation/016.bpo-28929.Md7kb0.rst new file mode 100644 index 00000000000..acacdd01322 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/016.bpo-28929.Md7kb0.rst @@ -0,0 +1 @@ +Link the documentation to its source file on GitHub. diff --git a/Misc/NEWS.d/next/Documentation/017.bpo-30176.VivmCg.rst b/Misc/NEWS.d/next/Documentation/017.bpo-30176.VivmCg.rst new file mode 100644 index 00000000000..df73aeda646 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/017.bpo-30176.VivmCg.rst @@ -0,0 +1 @@ +Add missing attribute related constants in curses documentation. diff --git a/Misc/NEWS.d/next/Library/018.bpo-28925.9zLygi.rst b/Misc/NEWS.d/next/Library/018.bpo-28925.9zLygi.rst new file mode 100644 index 00000000000..b9a556ac20c --- /dev/null +++ b/Misc/NEWS.d/next/Library/018.bpo-28925.9zLygi.rst @@ -0,0 +1,2 @@ +cPickle now correctly propagates errors when unpickle instances of old-style +classes. diff --git a/Misc/NEWS.d/next/Library/019.bpo-19542.5tCkaK.rst b/Misc/NEWS.d/next/Library/019.bpo-19542.5tCkaK.rst new file mode 100644 index 00000000000..b330241c2a8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/019.bpo-19542.5tCkaK.rst @@ -0,0 +1,2 @@ +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. diff --git a/Misc/NEWS.d/next/Library/020.bpo-29019.MO2AeR.rst b/Misc/NEWS.d/next/Library/020.bpo-29019.MO2AeR.rst new file mode 100644 index 00000000000..5e3ff0b9c4c --- /dev/null +++ b/Misc/NEWS.d/next/Library/020.bpo-29019.MO2AeR.rst @@ -0,0 +1,2 @@ +Fix dict.fromkeys(x) overallocates when x is sparce dict. Original patch by +Rasmus Villemoes. diff --git a/Misc/NEWS.d/next/Library/021.bpo-28923._hrXiL.rst b/Misc/NEWS.d/next/Library/021.bpo-28923._hrXiL.rst new file mode 100644 index 00000000000..057509f0c19 --- /dev/null +++ b/Misc/NEWS.d/next/Library/021.bpo-28923._hrXiL.rst @@ -0,0 +1,2 @@ +Remove editor artifacts from Tix.py, including encoding not recognized by +codecs.lookup. diff --git a/Misc/NEWS.d/next/Library/022.bpo-28998.NfBgmb.rst b/Misc/NEWS.d/next/Library/022.bpo-28998.NfBgmb.rst new file mode 100644 index 00000000000..fcd6ddbd3a4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/022.bpo-28998.NfBgmb.rst @@ -0,0 +1 @@ +More APIs now support longs as well as ints. diff --git a/Misc/NEWS.d/next/Library/023.bpo-28427.vUd-va.rst b/Misc/NEWS.d/next/Library/023.bpo-28427.vUd-va.rst new file mode 100644 index 00000000000..e6eab05306f --- /dev/null +++ b/Misc/NEWS.d/next/Library/023.bpo-28427.vUd-va.rst @@ -0,0 +1,2 @@ +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. diff --git a/Misc/NEWS.d/next/Library/024.bpo-9770.WJJnwP.rst b/Misc/NEWS.d/next/Library/024.bpo-9770.WJJnwP.rst new file mode 100644 index 00000000000..18abe3d6d2c --- /dev/null +++ b/Misc/NEWS.d/next/Library/024.bpo-9770.WJJnwP.rst @@ -0,0 +1 @@ +curses.ascii predicates now work correctly with negative integers. diff --git a/Misc/NEWS.d/next/Library/025.bpo-13051.YzC1Te.rst b/Misc/NEWS.d/next/Library/025.bpo-13051.YzC1Te.rst new file mode 100644 index 00000000000..87fe36e34a6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/025.bpo-13051.YzC1Te.rst @@ -0,0 +1,2 @@ +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. diff --git a/Misc/NEWS.d/next/Library/026.bpo-29142._FTyvm.rst b/Misc/NEWS.d/next/Library/026.bpo-29142._FTyvm.rst new file mode 100644 index 00000000000..137a552e898 --- /dev/null +++ b/Misc/NEWS.d/next/Library/026.bpo-29142._FTyvm.rst @@ -0,0 +1,3 @@ +In urllib, suffixes in no_proxy environment variable with leading dots could +match related hostnames again (e.g. .b.c matches a.b.c). Patch by Milan +Oberkirch. diff --git a/Misc/NEWS.d/next/Library/027.bpo-29188.RI3v1Q.rst b/Misc/NEWS.d/next/Library/027.bpo-29188.RI3v1Q.rst new file mode 100644 index 00000000000..58a161779f4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/027.bpo-29188.RI3v1Q.rst @@ -0,0 +1,4 @@ +Support glibc 2.24 on Linux: don't use getentropy() function but read from +/dev/urandom to get random bytes, for example in os.urandom(). On Linux, +getentropy() is implemented which getrandom() is blocking mode, whereas +os.urandom() should not block. diff --git a/Misc/NEWS.d/next/Library/028.bpo-29082.D5Xs7F.rst b/Misc/NEWS.d/next/Library/028.bpo-29082.D5Xs7F.rst new file mode 100644 index 00000000000..27de57506ed --- /dev/null +++ b/Misc/NEWS.d/next/Library/028.bpo-29082.D5Xs7F.rst @@ -0,0 +1,2 @@ +Fixed loading libraries in ctypes by unicode names on Windows. Original +patch by Chi Hsuan Yen. diff --git a/Misc/NEWS.d/next/Library/029.bpo-29219.kxui7t.rst b/Misc/NEWS.d/next/Library/029.bpo-29219.kxui7t.rst new file mode 100644 index 00000000000..ab6725f596a --- /dev/null +++ b/Misc/NEWS.d/next/Library/029.bpo-29219.kxui7t.rst @@ -0,0 +1 @@ +Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances. diff --git a/Misc/NEWS.d/next/Library/030.bpo-29335._KC7IK.rst b/Misc/NEWS.d/next/Library/030.bpo-29335._KC7IK.rst new file mode 100644 index 00000000000..79e17482299 --- /dev/null +++ b/Misc/NEWS.d/next/Library/030.bpo-29335._KC7IK.rst @@ -0,0 +1,2 @@ +Fix subprocess.Popen.wait() when the child process has exited to a stopped +instead of terminated state (ex: when under ptrace). diff --git a/Misc/NEWS.d/next/Library/031.bpo-29354.TH2vMX.rst b/Misc/NEWS.d/next/Library/031.bpo-29354.TH2vMX.rst new file mode 100644 index 00000000000..f4ce0885919 --- /dev/null +++ b/Misc/NEWS.d/next/Library/031.bpo-29354.TH2vMX.rst @@ -0,0 +1 @@ +Fixed inspect.getargs() for parameters which are cell variables. diff --git a/Misc/NEWS.d/next/Library/032.bpo-29110.IBWuZ2.rst b/Misc/NEWS.d/next/Library/032.bpo-29110.IBWuZ2.rst new file mode 100644 index 00000000000..da04bb13d7a --- /dev/null +++ b/Misc/NEWS.d/next/Library/032.bpo-29110.IBWuZ2.rst @@ -0,0 +1,2 @@ +Fix file object leak in aifc.open() when file is given as a filesystem path +and is not in valid AIFF format. Original patch by Anthony Zhang. diff --git a/Misc/NEWS.d/next/Library/033.bpo-27880.elFFAF.rst b/Misc/NEWS.d/next/Library/033.bpo-27880.elFFAF.rst new file mode 100644 index 00000000000..d51402d8b2c --- /dev/null +++ b/Misc/NEWS.d/next/Library/033.bpo-27880.elFFAF.rst @@ -0,0 +1,2 @@ +Fixed integer overflow in cPickle when pickle large strings or too many +objects. diff --git a/Misc/NEWS.d/next/Library/034.bpo-29861.t2ZoRK.rst b/Misc/NEWS.d/next/Library/034.bpo-29861.t2ZoRK.rst new file mode 100644 index 00000000000..c14091ab5bd --- /dev/null +++ b/Misc/NEWS.d/next/Library/034.bpo-29861.t2ZoRK.rst @@ -0,0 +1,2 @@ +Release references to tasks, their arguments and their results as soon as +they are finished in multiprocessing.Pool. diff --git a/Misc/NEWS.d/next/Library/035.bpo-29942.CsGNuT.rst b/Misc/NEWS.d/next/Library/035.bpo-29942.CsGNuT.rst new file mode 100644 index 00000000000..39b8ba8f3e0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/035.bpo-29942.CsGNuT.rst @@ -0,0 +1,2 @@ +Fix a crash in itertools.chain.from_iterable when encountering long runs of +empty iterables. diff --git a/Misc/NEWS.d/next/Library/036.bpo-27863.pPYHHI.rst b/Misc/NEWS.d/next/Library/036.bpo-27863.pPYHHI.rst new file mode 100644 index 00000000000..49f0f03d7bb --- /dev/null +++ b/Misc/NEWS.d/next/Library/036.bpo-27863.pPYHHI.rst @@ -0,0 +1,2 @@ +Fixed multiple crashes in ElementTree caused by race conditions and wrong +types. diff --git a/Misc/NEWS.d/next/Library/037.bpo-30068.n4q47r.rst b/Misc/NEWS.d/next/Library/037.bpo-30068.n4q47r.rst new file mode 100644 index 00000000000..429673b83ac --- /dev/null +++ b/Misc/NEWS.d/next/Library/037.bpo-30068.n4q47r.rst @@ -0,0 +1 @@ +_io._IOBase.readlines will check if it's closed first when hint is present. diff --git a/Misc/NEWS.d/next/Library/038.bpo-30011.2MLfQj.rst b/Misc/NEWS.d/next/Library/038.bpo-30011.2MLfQj.rst new file mode 100644 index 00000000000..687aaac8b98 --- /dev/null +++ b/Misc/NEWS.d/next/Library/038.bpo-30011.2MLfQj.rst @@ -0,0 +1 @@ +Fixed race condition in HTMLParser.unescape(). diff --git a/Misc/NEWS.d/next/Library/039.bpo-30061.ilxNPt.rst b/Misc/NEWS.d/next/Library/039.bpo-30061.ilxNPt.rst new file mode 100644 index 00000000000..f26dd554c2a --- /dev/null +++ b/Misc/NEWS.d/next/Library/039.bpo-30061.ilxNPt.rst @@ -0,0 +1,4 @@ +Fixed crashes in IOBase methods next() and readlines() when readline() or +next() respectively return non-sizeable object. Fixed possible other errors +caused by not checking results of PyObject_Size(), PySequence_Size(), or +PyMapping_Size(). diff --git a/Misc/NEWS.d/next/Library/040.bpo-30070.XM_B41.rst b/Misc/NEWS.d/next/Library/040.bpo-30070.XM_B41.rst new file mode 100644 index 00000000000..8e31371216a --- /dev/null +++ b/Misc/NEWS.d/next/Library/040.bpo-30070.XM_B41.rst @@ -0,0 +1 @@ +Fixed leaks and crashes in errors handling in the parser module. diff --git a/Misc/NEWS.d/next/Library/041.bpo-26293.wig0YG.rst b/Misc/NEWS.d/next/Library/041.bpo-26293.wig0YG.rst new file mode 100644 index 00000000000..ae977481643 --- /dev/null +++ b/Misc/NEWS.d/next/Library/041.bpo-26293.wig0YG.rst @@ -0,0 +1 @@ +Change resulted because of zipfile breakage. (See also: bpo-29094) diff --git a/Misc/NEWS.d/next/Library/042.bpo-30243.RHQt0v.rst b/Misc/NEWS.d/next/Library/042.bpo-30243.RHQt0v.rst new file mode 100644 index 00000000000..6037eaf2555 --- /dev/null +++ b/Misc/NEWS.d/next/Library/042.bpo-30243.RHQt0v.rst @@ -0,0 +1,3 @@ +Removed the __init__ methods of _json's scanner and encoder. Misusing them +could cause memory leaks or crashes. Now scanner and encoder objects are +completely initialized in the __new__ methods. diff --git a/Misc/NEWS.d/next/Library/043.bpo-29990.HWV6KE.rst b/Misc/NEWS.d/next/Library/043.bpo-29990.HWV6KE.rst new file mode 100644 index 00000000000..7a6793095f4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/043.bpo-29990.HWV6KE.rst @@ -0,0 +1 @@ +Fix range checking in GB18030 decoder. Original patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/044.bpo-30342.87Qgur.rst b/Misc/NEWS.d/next/Library/044.bpo-30342.87Qgur.rst new file mode 100644 index 00000000000..83ac0a4a36b --- /dev/null +++ b/Misc/NEWS.d/next/Library/044.bpo-30342.87Qgur.rst @@ -0,0 +1,2 @@ +Fix sysconfig.is_python_build() if Python is built with Visual Studio 2008 +(VS 9.0). diff --git a/Misc/NEWS.d/next/Library/045.bpo-30329.Yb1MTr.rst b/Misc/NEWS.d/next/Library/045.bpo-30329.Yb1MTr.rst new file mode 100644 index 00000000000..d853028b608 --- /dev/null +++ b/Misc/NEWS.d/next/Library/045.bpo-30329.Yb1MTr.rst @@ -0,0 +1,3 @@ +imaplib now catchs the Windows socket WSAEINVAL error (code 10022) on +shutdown(SHUT_RDWR): An invalid operation was attempted. This error occurs +sometimes on SSL connections. diff --git a/Misc/NEWS.d/next/Library/046.bpo-30365.XVP7_M.rst b/Misc/NEWS.d/next/Library/046.bpo-30365.XVP7_M.rst new file mode 100644 index 00000000000..2fcdbac08b3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/046.bpo-30365.XVP7_M.rst @@ -0,0 +1,3 @@ +Fixed a deprecation warning about the doctype() method of the +xml.etree.ElementTree.XMLParser class. Now it is emitted only when define +the doctype() method in the subclass of XMLParser. diff --git a/Misc/NEWS.d/next/Library/047.bpo-30365.eDwdmC.rst b/Misc/NEWS.d/next/Library/047.bpo-30365.eDwdmC.rst new file mode 100644 index 00000000000..15a5f1bbd9a --- /dev/null +++ b/Misc/NEWS.d/next/Library/047.bpo-30365.eDwdmC.rst @@ -0,0 +1,4 @@ +Running Python with the -3 option now emits deprecation warnings for +getchildren() and getiterator() methods of the Element class in the +xml.etree.cElementTree module and when pass the html argument to +xml.etree.ElementTree.XMLParser(). diff --git a/Misc/NEWS.d/next/Library/048.bpo-30363.l6J41Y.rst b/Misc/NEWS.d/next/Library/048.bpo-30363.l6J41Y.rst new file mode 100644 index 00000000000..7f25f4a1555 --- /dev/null +++ b/Misc/NEWS.d/next/Library/048.bpo-30363.l6J41Y.rst @@ -0,0 +1,3 @@ +Running Python with the -3 option now warns about regular expression syntax +that is invalid or has different semantic in Python 3 or will change the +behavior in future Python versions. diff --git a/Misc/NEWS.d/next/Library/049.bpo-30375.9c8qM7.rst b/Misc/NEWS.d/next/Library/049.bpo-30375.9c8qM7.rst new file mode 100644 index 00000000000..cb0f7eb038c --- /dev/null +++ b/Misc/NEWS.d/next/Library/049.bpo-30375.9c8qM7.rst @@ -0,0 +1,3 @@ +Warnings emitted when compile a regular expression now always point to the +line in the user code. Previously they could point into inners of the re +module if emitted from inside of groups or conditionals. diff --git a/Misc/NEWS.d/next/Library/050.bpo-30003.BOl9HE.rst b/Misc/NEWS.d/next/Library/050.bpo-30003.BOl9HE.rst new file mode 100644 index 00000000000..ac449728fd7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/050.bpo-30003.BOl9HE.rst @@ -0,0 +1 @@ +Fix handling escape characters in HZ codec. Based on patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/051.bpo-30414.jGl1Lb.rst b/Misc/NEWS.d/next/Library/051.bpo-30414.jGl1Lb.rst new file mode 100644 index 00000000000..3bd0a23069e --- /dev/null +++ b/Misc/NEWS.d/next/Library/051.bpo-30414.jGl1Lb.rst @@ -0,0 +1,2 @@ +multiprocessing.Queue._feed background running thread do not break from main +loop on exception. diff --git a/Misc/NEWS.d/next/Library/052.bpo-30310.SAkE6e.rst b/Misc/NEWS.d/next/Library/052.bpo-30310.SAkE6e.rst new file mode 100644 index 00000000000..d6e8448d550 --- /dev/null +++ b/Misc/NEWS.d/next/Library/052.bpo-30310.SAkE6e.rst @@ -0,0 +1 @@ +tkFont now supports unicode options (e.g. font family). diff --git a/Misc/NEWS.d/next/Library/053.bpo-29960.g0wr3r.rst b/Misc/NEWS.d/next/Library/053.bpo-29960.g0wr3r.rst new file mode 100644 index 00000000000..0b37a4b96d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/053.bpo-29960.g0wr3r.rst @@ -0,0 +1,2 @@ +Preserve generator state when _random.Random.setstate() raises an exception. +Patch by Bryan Olson. diff --git a/Misc/NEWS.d/next/Library/054.bpo-30378.R_19_5.rst b/Misc/NEWS.d/next/Library/054.bpo-30378.R_19_5.rst new file mode 100644 index 00000000000..5994abe142c --- /dev/null +++ b/Misc/NEWS.d/next/Library/054.bpo-30378.R_19_5.rst @@ -0,0 +1,2 @@ +Fix the problem that logging.handlers.SysLogHandler cannot handle IPv6 +addresses. diff --git a/Misc/NEWS.d/next/Library/055.bpo-30418.EwISQm.rst b/Misc/NEWS.d/next/Library/055.bpo-30418.EwISQm.rst new file mode 100644 index 00000000000..43e149daffe --- /dev/null +++ b/Misc/NEWS.d/next/Library/055.bpo-30418.EwISQm.rst @@ -0,0 +1,2 @@ +On Windows, subprocess.Popen.communicate() now also ignore EINVAL on +stdin.write() if the child process is still running but closed the pipe. diff --git a/Misc/NEWS.d/next/Library/056.bpo-28994.9vzun1.rst b/Misc/NEWS.d/next/Library/056.bpo-28994.9vzun1.rst new file mode 100644 index 00000000000..80de944b4e8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/056.bpo-28994.9vzun1.rst @@ -0,0 +1,2 @@ +The traceback no longer displayed for SystemExit raised in a callback +registered by atexit. diff --git a/Misc/NEWS.d/next/Library/061.bpo-30746.7drQI0.rst b/Misc/NEWS.d/next/Library/061.bpo-30746.7drQI0.rst new file mode 100644 index 00000000000..94803bb5f1d --- /dev/null +++ b/Misc/NEWS.d/next/Library/061.bpo-30746.7drQI0.rst @@ -0,0 +1,2 @@ +Prohibited the '=' character in environment variable names in +``os.putenv()`` and ``os.spawn*()``. diff --git a/Misc/NEWS.d/next/Library/062.bpo-29169.8ypApm.rst b/Misc/NEWS.d/next/Library/062.bpo-29169.8ypApm.rst new file mode 100644 index 00000000000..96d066d41d2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/062.bpo-29169.8ypApm.rst @@ -0,0 +1 @@ +Update zlib to 1.2.11. diff --git a/Misc/NEWS.d/next/Security/057.bpo-29591.ExKblw.rst b/Misc/NEWS.d/next/Security/057.bpo-29591.ExKblw.rst new file mode 100644 index 00000000000..7394ac2ff0e --- /dev/null +++ b/Misc/NEWS.d/next/Security/057.bpo-29591.ExKblw.rst @@ -0,0 +1,5 @@ +.. original section: Library + +Update expat copy from 2.1.1 to 2.2.0 to get fixes of CVE-2016-0718 and +CVE-2016-4472. See https://sourceforge.net/p/expat/bugs/537/ for more +information. diff --git a/Misc/NEWS.d/next/Security/058.bpo-30500.j5KrEp.rst b/Misc/NEWS.d/next/Security/058.bpo-30500.j5KrEp.rst new file mode 100644 index 00000000000..5d47c5d2ec6 --- /dev/null +++ b/Misc/NEWS.d/next/Security/058.bpo-30500.j5KrEp.rst @@ -0,0 +1,6 @@ +.. original section: Library + +Fix urllib.splithost() to correctly parse fragments. For example, +``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the +``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an +authentification (``login at host``). diff --git a/Misc/NEWS.d/next/Security/059.bpo-30694.WkMWM_.rst b/Misc/NEWS.d/next/Security/059.bpo-30694.WkMWM_.rst new file mode 100644 index 00000000000..ebbd359e63f --- /dev/null +++ b/Misc/NEWS.d/next/Security/059.bpo-30694.WkMWM_.rst @@ -0,0 +1,10 @@ +.. original section: Library + +Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security +vulnerabilities including: CVE-2017-9233 (External entity infinite loop +DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix +regression bugs from 2.2.0's fix to CVE-2016-0718) and CVE-2012-0876 +(Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os- +specific entropy sources like getrandom) doesn't impact Python, since Python +already gets entropy from the OS to set the expat secret using +``XML_SetHashSalt()``. diff --git a/Misc/NEWS.d/next/Security/060.bpo-30730.rJsyTH.rst b/Misc/NEWS.d/next/Security/060.bpo-30730.rJsyTH.rst new file mode 100644 index 00000000000..008aa706d49 --- /dev/null +++ b/Misc/NEWS.d/next/Security/060.bpo-30730.rJsyTH.rst @@ -0,0 +1,4 @@ +.. original section: Library + +Prevent environment variables injection in subprocess on Windows. Prevent +passing other environment variables and command arguments. diff --git a/Misc/NEWS.d/next/Tests/001.bpo-15083.Tz3ZZm.rst b/Misc/NEWS.d/next/Tests/001.bpo-15083.Tz3ZZm.rst new file mode 100644 index 00000000000..3554d9779b4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/001.bpo-15083.Tz3ZZm.rst @@ -0,0 +1 @@ +Convert ElementTree doctests to unittests. diff --git a/Misc/NEWS.d/next/Tests/002.bpo-28087.m8dc4R.rst b/Misc/NEWS.d/next/Tests/002.bpo-28087.m8dc4R.rst new file mode 100644 index 00000000000..5e33e56ad4f --- /dev/null +++ b/Misc/NEWS.d/next/Tests/002.bpo-28087.m8dc4R.rst @@ -0,0 +1,3 @@ +Skip test_asyncore and test_eintr poll failures on macOS. Skip some tests of +select.poll when running on macOS due to unresolved issues with the +underlying system poll function on some macOS versions. diff --git a/Misc/NEWS.d/next/Tests/003.bpo-30197.hajYvd.rst b/Misc/NEWS.d/next/Tests/003.bpo-30197.hajYvd.rst new file mode 100644 index 00000000000..f447c7a598b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/003.bpo-30197.hajYvd.rst @@ -0,0 +1,5 @@ +Enhanced function swap_attr() in the test.test_support module. It now works +when delete replaced attribute inside the with statement. The old value of +the attribute (or None if it doesn't exist) now will be assigned to the +target of the "as" clause, if there is one. Also backported function +swap_item(). diff --git a/Misc/NEWS.d/next/Tests/004.bpo-30207.EiRhGi.rst b/Misc/NEWS.d/next/Tests/004.bpo-30207.EiRhGi.rst new file mode 100644 index 00000000000..8461ed43184 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/004.bpo-30207.EiRhGi.rst @@ -0,0 +1,5 @@ +To simplify backports from Python 3, the test.test_support module was +converted into a package and renamed to test.support. The +test.script_helper module was moved into the test.support package. Names +test.test_support and test.script_helper are left as aliases to test.support +and test.support.script_helper. diff --git a/Misc/NEWS.d/next/Tests/005.bpo-30223.TYC9rA.rst b/Misc/NEWS.d/next/Tests/005.bpo-30223.TYC9rA.rst new file mode 100644 index 00000000000..614a2e1b694 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/005.bpo-30223.TYC9rA.rst @@ -0,0 +1,3 @@ +To unify running tests in Python 2.7 and Python 3, the test package can be +run as a script. This is equivalent to running the test.regrtest module as +a script. diff --git a/Misc/NEWS.d/next/Tests/006.bpo-30236.vOYTDq.rst b/Misc/NEWS.d/next/Tests/006.bpo-30236.vOYTDq.rst new file mode 100644 index 00000000000..5b60803b17f --- /dev/null +++ b/Misc/NEWS.d/next/Tests/006.bpo-30236.vOYTDq.rst @@ -0,0 +1 @@ +Backported test.regrtest options -m/--match and -G/--failfast from Python 3. diff --git a/Misc/NEWS.d/next/Tests/007.bpo-11790.0actZf.rst b/Misc/NEWS.d/next/Tests/007.bpo-11790.0actZf.rst new file mode 100644 index 00000000000..9a29e2d93bb --- /dev/null +++ b/Misc/NEWS.d/next/Tests/007.bpo-11790.0actZf.rst @@ -0,0 +1 @@ +Fix sporadic failures in test_multiprocessing.WithProcessesTestCondition. From webhook-mailer at python.org Mon Sep 4 14:48:00 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 04 Sep 2017 18:48:00 -0000 Subject: [Python-checkins] Improve clarity (and small speed-up) by using tuple unpacking (#3289) Message-ID: https://github.com/python/cpython/commit/1bfbe78b03e6ee3ee7de938b5e39015dd08b0302 commit: 1bfbe78b03e6ee3ee7de938b5e39015dd08b0302 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T11:47:58-07:00 summary: Improve clarity (and small speed-up) by using tuple unpacking (#3289) files: M Lib/heapq.py diff --git a/Lib/heapq.py b/Lib/heapq.py index 0b3e89a3a97..b31f4186cf6 100644 --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -498,10 +498,10 @@ def nsmallest(n, iterable, key=None): for elem in it: if elem < top: _heapreplace(result, (elem, order)) - top = result[0][0] + top, _order = result[0] order += 1 result.sort() - return [r[0] for r in result] + return [elem for (elem, order) in result] # General case, slowest method it = iter(iterable) @@ -516,10 +516,10 @@ def nsmallest(n, iterable, key=None): k = key(elem) if k < top: _heapreplace(result, (k, order, elem)) - top = result[0][0] + top, _order, _elem = result[0] order += 1 result.sort() - return [r[2] for r in result] + return [elem for (k, order, elem) in result] def nlargest(n, iterable, key=None): """Find the n largest elements in a dataset. @@ -559,10 +559,10 @@ def nlargest(n, iterable, key=None): for elem in it: if top < elem: _heapreplace(result, (elem, order)) - top = result[0][0] + top, _order = result[0] order -= 1 result.sort(reverse=True) - return [r[0] for r in result] + return [elem for (elem, order) in result] # General case, slowest method it = iter(iterable) @@ -577,10 +577,10 @@ def nlargest(n, iterable, key=None): k = key(elem) if top < k: _heapreplace(result, (k, order, elem)) - top = result[0][0] + top, _order, _elem = result[0] order -= 1 result.sort(reverse=True) - return [r[2] for r in result] + return [elem for (k, order, elem) in result] # If available, use C implementation try: From webhook-mailer at python.org Mon Sep 4 15:03:30 2017 From: webhook-mailer at python.org (larryhastings) Date: Mon, 04 Sep 2017 19:03:30 -0000 Subject: [Python-checkins] Blurbify 3.6. (#3287) Message-ID: https://github.com/python/cpython/commit/6a116c2aa4e5f13e24f2ee792b5d7af5e8db1c88 commit: 6a116c2aa4e5f13e24f2ee792b5d7af5e8db1c88 branch: 3.6 author: larryhastings committer: GitHub date: 2017-09-04T12:03:25-07:00 summary: Blurbify 3.6. (#3287) Blurbify 3.6. files: A Misc/NEWS.d/3.5.0.rst A Misc/NEWS.d/3.5.0a1.rst A Misc/NEWS.d/3.5.0a2.rst A Misc/NEWS.d/3.5.0a3.rst A Misc/NEWS.d/3.5.0a4.rst A Misc/NEWS.d/3.5.0b1.rst A Misc/NEWS.d/3.5.0b2.rst A Misc/NEWS.d/3.5.0b3.rst A Misc/NEWS.d/3.5.0b4.rst A Misc/NEWS.d/3.5.0rc1.rst A Misc/NEWS.d/3.5.0rc2.rst A Misc/NEWS.d/3.5.0rc3.rst A Misc/NEWS.d/3.5.0rc4.rst A Misc/NEWS.d/3.5.1.rst A Misc/NEWS.d/3.5.1rc1.rst A Misc/NEWS.d/3.5.2.rst A Misc/NEWS.d/3.5.2rc1.rst A Misc/NEWS.d/3.5.3.rst A Misc/NEWS.d/3.5.3rc1.rst A Misc/NEWS.d/3.6.0.rst A Misc/NEWS.d/3.6.0a1.rst A Misc/NEWS.d/3.6.0a2.rst A Misc/NEWS.d/3.6.0a3.rst A Misc/NEWS.d/3.6.0a4.rst A Misc/NEWS.d/3.6.0b1.rst A Misc/NEWS.d/3.6.0b2.rst A Misc/NEWS.d/3.6.0b3.rst A Misc/NEWS.d/3.6.0b4.rst A Misc/NEWS.d/3.6.0rc1.rst A Misc/NEWS.d/3.6.0rc2.rst A Misc/NEWS.d/3.6.1.rst A Misc/NEWS.d/3.6.1rc1.rst A Misc/NEWS.d/3.6.2.rst A Misc/NEWS.d/3.6.2rc1.rst A Misc/NEWS.d/3.6.2rc2.rst A Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst A Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst A Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst A Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst A Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst A Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst D Misc/NEWS M Doc/tools/susp-ignored.csv diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 2dc54045902..6cd5a32878f 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -325,4 +325,3 @@ whatsnew/3.5,,:warning,'WARNING:root:warning\n' whatsnew/3.5,,::,>>> addr6 = ipaddress.IPv6Address('::1') whatsnew/3.5,,:root,ERROR:root:exception whatsnew/3.5,,:exception,ERROR:root:exception -whatsnew/changelog,,:version,import sys; I = version[:version.index(' ')] diff --git a/Misc/NEWS b/Misc/NEWS deleted file mode 100644 index 309b46637e2..00000000000 --- a/Misc/NEWS +++ /dev/null @@ -1,8934 +0,0 @@ -+++++++++++ -Python News -+++++++++++ - -What's New in Python 3.6.3 release candidate 1? -=============================================== - -*Release date: XXXX-XX-XX* - -Core and Builtins ------------------ - -- bpo-31161: Make sure the 'Missing parentheses' syntax error message is - only applied to SyntaxError, not to subclasses. Patch by Martijn Pieters. - -- bpo-30814: Fixed a race condition when import a submodule from a package. - -- bpo-30597: ``print`` now shows expected input in custom error message when - used as a Python 2 statement. Patch by Sanyam Khurana. - -Library -------- - -- bpo-30879: os.listdir() and os.scandir() now emit bytes names when called - with bytes-like argument. - -- bpo-30746: Prohibited the '=' character in environment variable names in - ``os.putenv()`` and ``os.spawn*()``. - -- bpo-29755: Fixed the lgettext() family of functions in the gettext module. - They now always return bytes. - - -What's New in Python 3.6.2? -=========================== - -*Release date: 2017-07-17* - -- No changes since release candidate 2 - - -What's New in Python 3.6.2 release candidate 2? -=============================================== - -*Release date: 2017-07-07* - -Core and Builtins ------------------ - -Library -------- - -- [Security] bpo-30730: Prevent environment variables injection in subprocess on - Windows. Prevent passing other environment variables and command arguments. - -- [Security] bpo-30694: Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes - of multiple security vulnerabilities including: CVE-2017-9233 (External - entity infinite loop DoS), CVE-2016-9063 (Integer overflow, re-fix), - CVE-2016-0718 (Fix regression bugs from 2.2.0's fix to CVE-2016-0718) - and CVE-2012-0876 (Counter hash flooding with SipHash). - Note: the CVE-2016-5300 (Use os-specific entropy sources like getrandom) - doesn't impact Python, since Python already gets entropy from the OS to set - the expat secret using ``XML_SetHashSalt()``. - -- [Security] bpo-30500: Fix urllib.parse.splithost() to correctly parse - fragments. For example, ``splithost('//127.0.0.1#@evil.com/')`` now - correctly returns the ``127.0.0.1`` host, instead of treating ``@evil.com`` - as the host in an authentification (``login at host``). - - -What's New in Python 3.6.2 release candidate 1? -=============================================== - -*Release date: 2017-06-17* - -Core and Builtins ------------------ - -- bpo-30682: Removed a too-strict assertion that failed for certain f-strings, - such as eval("f'\\\n'") and eval("f'\\\r'"). - -- bpo-30604: Move co_extra_freefuncs to not be per-thread to avoid crashes - -- bpo-29104: Fixed parsing backslashes in f-strings. - -- bpo-27945: Fixed various segfaults with dict when input collections are - mutated during searching, inserting or comparing. Based on patches by - Duane Griffin and Tim Mitchell. - -- bpo-25794: Fixed type.__setattr__() and type.__delattr__() for - non-interned attribute names. Based on patch by Eryk Sun. - -- bpo-30039: If a KeyboardInterrupt happens when the interpreter is in - the middle of resuming a chain of nested 'yield from' or 'await' - calls, it's now correctly delivered to the innermost frame. - -- bpo-12414: sys.getsizeof() on a code object now returns the sizes - which includes the code struct and sizes of objects which it references. - Patch by Dong-hee Na. - -- bpo-29949: Fix memory usage regression of set and frozenset object. - -- bpo-29935: Fixed error messages in the index() method of tuple, list and deque - when pass indices of wrong type. - -- bpo-29859: Show correct error messages when any of the pthread_* calls in - thread_pthread.h fails. - -- bpo-28876: ``bool(range)`` works even if ``len(range)`` - raises :exc:`OverflowError`. - -- bpo-29600: Fix wrapping coroutine return values in StopIteration. - -- bpo-28856: Fix an oversight that %b format for bytes should support objects - follow the buffer protocol. - -- bpo-29714: Fix a regression that bytes format may fail when containing zero - bytes inside. - -- bpo-29478: If max_line_length=None is specified while using the Compat32 policy, - it is no longer ignored. Patch by Mircea Cosbuc. - -Library -------- - -- bpo-30616: Functional API of enum allows to create empty enums. - Patched by Dong-hee Na - -- bpo-30038: Fix race condition between signal delivery and wakeup file - descriptor. Patch by Nathaniel Smith. - -- bpo-23894: lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. - -- bpo-23890: unittest.TestCase.assertRaises() now manually breaks a reference - cycle to not keep objects alive longer than expected. - -- bpo-30149: inspect.signature() now supports callables with - variable-argument parameters wrapped with partialmethod. - Patch by Dong-hee Na. - -- bpo-30645: Fix path calculation in imp.load_package(), fixing it for - cases when a package is only shipped with bytecodes. Patch by - Alexandru Ardelean. - -- bpo-29931: Fixed comparison check for ipaddress.ip_interface objects. - Patch by Sanjay Sundaresan. - -- bpo-30605: re.compile() no longer raises a BytesWarning when compiling a - bytes instance with misplaced inline modifier. Patch by Roy Williams. - -- [Security] bpo-29591: Update expat copy from 2.1.1 to 2.2.0 to get fixes - of CVE-2016-0718 and CVE-2016-4472. See - https://sourceforge.net/p/expat/bugs/537/ for more information. - -- bpo-24484: Avoid race condition in multiprocessing cleanup (#2159) - -- bpo-28994: The traceback no longer displayed for SystemExit raised in - a callback registered by atexit. - -- bpo-30508: Don't log exceptions if Task/Future "cancel()" method was - called. - -- bpo-28556: Updates to typing module: Add generic AsyncContextManager, add - support for ContextManager on all versions. Original PRs by Jelle Zijlstra - and Ivan Levkivskyi - -- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl - implementation. Patch by Micha?l Sgha?er. - -- bpo-29743: Closing transport during handshake process leaks open socket. - Patch by Nikolay Kim - -- bpo-27585: Fix waiter cancellation in asyncio.Lock. - Patch by Mathieu Sornay. - -- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL - on stdin.write() if the child process is still running but closed the pipe. - -- bpo-29822: inspect.isabstract() now works during __init_subclass__. Patch - by Nate Soares. - -- bpo-29581: ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base - classes to use keyword parameters in __init_subclass__. Patch by Nate Soares. - -- bpo-30557: faulthandler now correctly filters and displays exception codes - on Windows - -- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot - handle IPv6 addresses. - -- bpo-29960: Preserve generator state when _random.Random.setstate() - raises an exception. Patch by Bryan Olson. - -- bpo-30414: multiprocessing.Queue._feed background running - thread do not break from main loop on exception. - -- bpo-30003: Fix handling escape characters in HZ codec. Based on patch - by Ma Lin. - -- bpo-30301: Fix AttributeError when using SimpleQueue.empty() under - *spawn* and *forkserver* start methods. - -- bpo-30329: imaplib and poplib now catch the Windows socket WSAEINVAL error - (code 10022) on shutdown(SHUT_RDWR): An invalid operation was attempted. - This error occurs sometimes on SSL connections. - -- bpo-30375: Warnings emitted when compile a regular expression now always - point to the line in the user code. Previously they could point into inners - of the re module if emitted from inside of groups or conditionals. - -- bpo-30048: Fixed ``Task.cancel()`` can be ignored when the task is - running coroutine and the coroutine returned without any more ``await``. - -- bpo-30266: contextlib.AbstractContextManager now supports anti-registration - by setting __enter__ = None or __exit__ = None, following the pattern - introduced in bpo-25958. Patch by Jelle Zijlstra. - -- bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. - Now allowed several subsequential inline modifiers at the start of the - pattern (e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments - now are allowed before and between inline modifiers (e.g. - ``'(?x) (?i) (?s)...'``). - -- bpo-29990: Fix range checking in GB18030 decoder. Original patch by Ma Lin. - -- Revert bpo-26293 for zipfile breakage. See also bpo-29094. - -- bpo-30243: Removed the __init__ methods of _json's scanner and encoder. - Misusing them could cause memory leaks or crashes. Now scanner and encoder - objects are completely initialized in the __new__ methods. - -- bpo-30185: Avoid KeyboardInterrupt tracebacks in forkserver helper process - when Ctrl-C is received. - -- bpo-28556: Various updates to typing module: add typing.NoReturn type, use - WrapperDescriptorType, minor bug-fixes. Original PRs by - Jim Fasarakis-Hilliard and Ivan Levkivskyi. - -- bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux. - -- bpo-30070: Fixed leaks and crashes in errors handling in the parser module. - -- bpo-30061: Fixed crashes in IOBase methods __next__() and readlines() when - readline() or __next__() respectively return non-sizeable object. - Fixed possible other errors caused by not checking results of PyObject_Size(), - PySequence_Size(), or PyMapping_Size(). - -- bpo-30017: Allowed calling the close() method of the zip entry writer object - multiple times. Writing to a closed writer now always produces a ValueError. - -- bpo-30068: _io._IOBase.readlines will check if it's closed first when - hint is present. - -- bpo-29694: Fixed race condition in pathlib mkdir with flags - parents=True. Patch by Armin Rigo. - -- bpo-29692: Fixed arbitrary unchaining of RuntimeError exceptions in - contextlib.contextmanager. Patch by Siddharth Velankar. - -- bpo-29998: Pickling and copying ImportError now preserves name and path - attributes. - -- bpo-29953: Fixed memory leaks in the replace() method of datetime and time - objects when pass out of bound fold argument. - -- bpo-29942: Fix a crash in itertools.chain.from_iterable when encountering - long runs of empty iterables. - -- bpo-27863: Fixed multiple crashes in ElementTree caused by race conditions - and wrong types. - -- bpo-28699: Fixed a bug in pools in multiprocessing.pool that raising an - exception at the very first of an iterable may swallow the exception or - make the program hang. Patch by Davin Potts and Xiang Zhang. - -- bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- bpo-29861: Release references to tasks, their arguments and their results - as soon as they are finished in multiprocessing.Pool. - -- bpo-29884: faulthandler: Restore the old sigaltstack during teardown. - Patch by Christophe Zeitouny. - -- bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. - -- bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords - are not strings. Patch by Michael Seifert. - -- bpo-29742: get_extra_info() raises exception if get called on closed ssl transport. - Patch by Nikolay Kim. - -- bpo-8256: Fixed possible failing or crashing input() if attributes "encoding" - or "errors" of sys.stdin or sys.stdout are not set or are not strings. - -- bpo-28298: Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big - intables (objects that have __int__) as elements. Patch by Oren Milman. - -- bpo-28231: The zipfile module now accepts path-like objects for external - paths. - -- bpo-26915: index() and count() methods of collections.abc.Sequence now - check identity before checking equality when do comparisons. - -- bpo-29615: SimpleXMLRPCDispatcher no longer chains KeyError (or any other - exception) to exception(s) raised in the dispatched methods. - Patch by Petr Motejlek. - -- bpo-30177: path.resolve(strict=False) no longer cuts the path after the first - element not present in the filesystem. Patch by Antoine Pietri. - -IDLE ----- - -- bpo-15786: Fix several problems with IDLE's autocompletion box. - The following should now work: clicking on selection box items; - using the scrollbar; selecting an item by hitting Return. - Hangs on MacOSX should no longer happen. Patch by Louie Lu. - -- bpo-25514: Add doc subsubsection about IDLE failure to start. - Popup no-connection message directs users to this section. - -- bpo-30642: Fix reference leaks in IDLE tests. - Patches by Louie Lu and Terry Jan Reedy. - -- bpo-30495: Add docstrings for textview.py and use PEP8 names. - Patches by Cheryl Sabella and Terry Jan Reedy. - -- bpo-30290: Help-about: use pep8 names and add tests. - Increase coverage to 100%. - Patches by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. - -- bpo-30303: Add _utest option to textview; add new tests. - Increase coverage to 100%. - Patches by Louie Lu and Terry Jan Reedy. - -C API ------ - -- Issue #27867: Function PySlice_GetIndicesEx() no longer replaced with a macro - if Py_LIMITED_API is not set. - - -Build ------ - -- bpo-29941: Add ``--with-assertions`` configure flag to explicitly enable - C ``assert()`` checks. Defaults to off. ``--with-pydebug`` implies - ``--with-assertions``. - -- bpo-28787: Fix out-of-tree builds of Python when configured with - ``--with--dtrace``. - -- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, - ``make install`` and some other make targets when configured with - ``--enable-optimizations``. - -- bpo-23404: Don't regenerate generated files based on file modification time - anymore: the action is now explicit. Replace ``make touch`` with - ``make regen-all``. - -- bpo-29643: Fix ``--enable-optimization`` didn't work. - -Documentation -------------- - -- bpo-30176: Add missing attribute related constants in curses documentation. - -- Issue #30052: the link targets for :func:`bytes` and - :func:`bytearray` are now their respective type definitions, rather - than the corresponding builtin function entries. Use :ref:`bytes ` - and :ref:`bytearray ` to reference the latter. - - In order to ensure this and future cross-reference updates are applied - automatically, the daily documentation builds now disable the default - output caching features in Sphinx. - -- bpo-26985: Add missing info of code object in inspect documentation. - -Tools/Demos ------------ - -- Issue #29367: python-gdb.py now supports also ``method-wrapper`` - (``wrapperobject``) objects. - -Tests ------ - -- bpo-30357: test_thread: setUp() now uses support.threading_setup() and - support.threading_cleanup() to wait until threads complete to avoid - random side effects on following tests. Initial patch written by Grzegorz - Grzywacz. - -- bpo-30197: Enhanced functions swap_attr() and swap_item() in the - test.support module. They now work when delete replaced attribute or item - inside the with statement. The old value of the attribute or item (or None - if it doesn't exist) now will be assigned to the target of the "as" clause, - if there is one. - -Windows -------- - -- bpo-30687: Locate msbuild.exe on Windows when building rather than - vcvarsall.bat - -- bpo-30450: The build process on Windows no longer depends on Subversion, - instead pulling external code from GitHub via a Python script. If Python 3.6 - is not found on the system (via ``py -3.6``), NuGet is used to download a - copy of 32-bit Python. - - -What's New in Python 3.6.1? -=========================== - -*Release date: 2017-03-21* - -Core and Builtins ------------------ - -- bpo-29723: The ``sys.path[0]`` initialization change for bpo-29139 caused a - regression by revealing an inconsistency in how sys.path is initialized when - executing ``__main__`` from a zipfile, directory, or other import location. - The interpreter now consistently avoids ever adding the import location's - parent directory to ``sys.path``, and ensures no other ``sys.path`` entries - are inadvertently modified when inserting the import location named on the - command line. - -Build ------ - -- bpo-27593: fix format of git information used in sys.version - -- Fix incompatible comment in python.h - - -What's New in Python 3.6.1 release candidate 1 -============================================== - -*Release date: 2017-03-04* - -Core and Builtins ------------------ - -- bpo-28893: Set correct __cause__ for errors about invalid awaitables - returned from __aiter__ and __anext__. - -- bpo-29683: Fixes to memory allocation in _PyCode_SetExtra. Patch by - Brian Coleman. - -- bpo-29684: Fix minor regression of PyEval_CallObjectWithKeywords. - It should raise TypeError when kwargs is not a dict. But it might - cause segv when args=NULL and kwargs is not a dict. - -- Issue #28598: Support __rmod__ for subclasses of str being called before - str.__mod__. Patch by Martijn Pieters. - -- bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX. - Patch by Matthieu Dartiailh. - -- bpo-29602: Fix incorrect handling of signed zeros in complex constructor for - complex subclasses and for inputs having a __complex__ method. Patch - by Serhiy Storchaka. - -- bpo-29347: Fixed possibly dereferencing undefined pointers - when creating weakref objects. - -- bpo-29438: Fixed use-after-free problem in key sharing dict. - -- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. - -- Issue #29337: Fixed possible BytesWarning when compare the code objects. - Warnings could be emitted at compile time. - -- Issue #29327: Fixed a crash when pass the iterable keyword argument to - sorted(). - -- Issue #29034: Fix memory leak and use-after-free in os module (path_converter). - -- Issue #29159: Fix regression in bytes(x) when x.__index__() raises Exception. - -- Issue #28932: Do not include if it does not exist. - -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. - -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate - form. - -- Issue #26919: On Android, operating system data is now always encoded/decoded - to/from UTF-8, instead of the locale encoding to avoid inconsistencies with - os.fsencode() and os.fsdecode() which are already using UTF-8. - -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy - bug triggerable by a monkey-patched len() function. - -- Issue #28739: f-string expressions are no longer accepted as docstrings and - by ast.literal_eval() even if they do not include expressions. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28918: Fix the cross compilation of xxlimited when Python has been - built with Py_DEBUG defined. - -- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. - Improve speed of dict literal with constant keys up to 30%. - -Extension Modules ------------------ - -- Issue #29169: Update zlib to 1.2.11. - -Library -------- - -- bpo-29623: Allow use of path-like object as a single argument in - ConfigParser.read(). Patch by David Ellis. - -- bpo-28963: Fix out of bound iteration in asyncio.Future.remove_done_callback - implemented in C. - -- bpo-29704: asyncio.subprocess.SubprocessStreamProtocol no longer closes - before all pipes are closed. - -- bpo-29271: Fix Task.current_task and Task.all_tasks implemented in C - to accept None argument as their pure Python implementation. - -- bpo-29703: Fix asyncio to support instantiation of new event loops - in child processes. - -- bpo-29376: Fix assertion error in threading._DummyThread.is_alive(). - -- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts - PathLike objects. Patch by Sayan Chowdhury. - -- bpo-28518: Start a transaction implicitly before a DML statement. - Patch by Aviv Palivoda. - -- bpo-29532: Altering a kwarg dictionary passed to functools.partial() - no longer affects a partial object after creation. - -- bpo-29110: Fix file object leak in aifc.open() when file is given as a - filesystem path and is not in valid AIFF format. Patch by Anthony Zhang. - -- Issue #28556: Various updates to typing module: typing.Counter, typing.ChainMap, - improved ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, - Manuel Krebber, and ?ukasz Langa. - -- Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python - 3.6.0: check minimum and maximum years. - -- Issue #29519: Fix weakref spewing exceptions during interpreter shutdown - when used with a rare combination of multiprocessing and custom codecs. - -- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir - -- Issue #29444: Fixed out-of-bounds buffer access in the group() method of - the match object. Based on patch by WGH. - -- Issue #29335: Fix subprocess.Popen.wait() when the child process has - exited to a stopped instead of terminated state (ex: when under ptrace). - -- Issue #29290: Fix a regression in argparse that help messages would wrap at - non-breaking spaces. - -- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY. - -- Issue #29316: Restore the provisional status of typing module, add - corresponding note to documentation. Patch by Ivan L. - -- Issue #29219: Fixed infinite recursion in the repr of uninitialized - ctypes.CDLL instances. - -- Issue #29011: Fix an important omission by adding Deque to the typing module. - -- Issue #28969: Fixed race condition in C implementation of functools.lru_cache. - KeyError could be raised when cached function with full cache was - simultaneously called from differen threads with the same uncached arguments. - -- Issue #29142: In urllib.request, suffixes in no_proxy environment variable with - leading dots could match related hostnames again (e.g. .b.c matches a.b.c). - Patch by Milan Oberkirch. - -- Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter - anymore. Patch written by Jiajun Huang. - -- Issue #29203: functools.lru_cache() now respects PEP 468 and preserves - the order of keyword arguments. f(a=1, b=2) is now cached separately - from f(b=2, a=1) since both calls could potentially give different results. - -- Issue #15812: inspect.getframeinfo() now correctly shows the first line of - a context. Patch by Sam Breese. - -- Issue #29094: Offsets in a ZIP file created with extern file object and modes - "w" and "x" now are relative to the start of the file. - -- Issue #29085: Allow random.Random.seed() to use high quality OS randomness - rather than the pid and time. - -- Issue #29061: Fixed bug in secrets.randbelow() which would hang when given - a negative input. Patch by Brendan Donegan. - -- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows - -- Issue #13051: Fixed recursion errors in large or resized - curses.textpad.Textbox. Based on patch by Tycho Andersen. - -- Issue #29119: Fix weakrefs in the pure python version of - collections.OrderedDict move_to_end() method. - Contributed by Andra Bogildea. - -- Issue #9770: curses.ascii predicates now work correctly with negative - integers. - -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. - -- Issue #28923: Remove editor artifacts from Tix.py. - -- Issue #29055: Neaten-up empty population error on random.choice() - by suppressing the upstream exception. - -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #20191: Fixed a crash in resource.prlimit() when passing a sequence that - doesn't own its elements as limits. - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. - -- Issue #26937: The chown() method of the tarfile.TarFile class does not fail - now when the grp module cannot be imported, as for example on Android - platforms. - -IDLE ----- - -- Issue #29071: IDLE colors f-string prefixes (but not invalid ur prefixes). - -- Issue #28572: Add 10% to coverage of IDLE's test_configdialog. - Update and augment description of the configuration system. - -Windows -------- - -- bpo-29579: Removes readme.txt from the installer - -- Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) - -- Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) - -- Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) - -- Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. - -- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - -- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. - -C API ------ - -- Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro if - Py_LIMITED_API is not set or set to the value between 0x03050400 - and 0x03060000 (not including) or 0x03060100 or higher. - -- Issue #29083: Fixed the declaration of some public API functions. - PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in - limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and - Py_BuildValue() were not available in limited API of version < 3.3 when - PY_SSIZE_T_CLEAN is defined. - -- Issue #29058: All stable API extensions added after Python 3.2 are now - available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of - the minimum Python version supporting this API. - -Documentation -------------- - -- bpo-28929: Link the documentation to its source file on GitHub. - -- bpo-25008: Document smtpd.py as effectively deprecated and add a pointer to - aiosmtpd, a third-party asyncio-based replacement. - -- Issue #26355: Add canonical header link on each page to corresponding major - version of the documentation. Patch by Matthias Bussonnier. - -- Issue #29349: Fix Python 2 syntax in code for building the documentation. - -Tests ------ - -- bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. - Skip some tests of select.poll when running on macOS due to unresolved - issues with the underlying system poll function on some macOS versions. - -- Issue #29571: to match the behaviour of the ``re.LOCALE`` flag, - test_re.test_locale_flag now uses ``locale.getpreferredencoding(False)`` to - determine the candidate encoding for the test regex (allowing it to correctly - skip the test when the default locale encoding is a multi-byte encoding) - -- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest - command line arguments. - -- Issue #28683: Fix the tests that bind() a unix socket and raise - PermissionError on Android for a non-root user. - -- Issue #26939: Add the support.setswitchinterval() function to fix - test_functools hanging on the Android armv7 qemu emulator. - -Build ------ - -- bpo-27593: sys.version and the platform module python_build(), - python_branch(), and python_revision() functions now use - git information rather than hg when building from a repo. - -- bpo-29572: Update Windows build and OS X installers to use OpenSSL 1.0.2k. - -- Issue #26851: Set Android compilation and link flags. - -- Issue #28768: Fix implicit declaration of function _setmode. Patch by - Masayuki Yamamoto - -- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - -- Issue #23903: Added missed names to PC/python3.def. - -- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK - macro is not defined in android-ndk-r13. - -- Issue #28538: Fix the compilation error that occurs because if_nameindex() is - available on Android API level 24, but the if_nameindex structure is not - defined. - -- Issue #20211: Do not add the directory for installing C header files and the - directory for installing object code libraries to the cross compilation - search paths. Original patch by Thomas Petazzoni. - -- Issue #28849: Do not define sys.implementation._multiarch on Android. - - -What's New in Python 3.6.0? -=========================== - -*Release date: 2016-12-23* - -- No changes since release candidate 2 - - -What's New in Python 3.6.0 release candidate 2? -=============================================== - -*Release date: 2016-12-16* - -Core and Builtins ------------------ - -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. Patch written by INADA - Naoki. - -- Issue #28990: Fix asyncio SSL hanging if connection is closed before - handshake is completed. (Patch by HoHo-Ho) - -Tools/Demos ------------ - -- Issue #28770: Fix python-gdb.py for fastcalls. - -Windows -------- - -- Issue #28896: Deprecate WindowsRegistryFinder. - -Build ------ - -- Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. - - -What's New in Python 3.6.0 release candidate 1? -=============================================== - -*Release date: 2016-12-06* - -Core and Builtins ------------------ - -- Issue #23722: Rather than silently producing a class that doesn't support - zero-argument ``super()`` in methods, failing to pass the new - ``__classcell__`` namespace entry up to ``type.__new__`` now results in a - ``DeprecationWarning`` and a class that supports zero-argument ``super()``. - -- Issue #28797: Modifying the class __dict__ inside the __set_name__ method of - a descriptor that is used inside that class no longer prevents calling the - __set_name__ method of other descriptors. - -- Issue #28782: Fix a bug in the implementation ``yield from`` when checking - if the next instruction is YIELD_FROM. Regression introduced by WORDCODE - (issue #26647). - -Library -------- - -- Issue #27030: Unknown escapes in re.sub() replacement template are allowed - again. But they still are deprecated and will be disabled in 3.7. - -- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): - call warnings.showwarning() if it was overriden inside the context manager. - -- Issue #27172: To assist with upgrades from 2.7, the previously documented - deprecation of ``inspect.getfullargspec()`` has been reversed. This decision - may be revisited again after the Python 2.7 branch is no longer officially - supported. - -- Issue #26273: Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and - :data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by - Omar Sandoval. - -- Issue #24142: Reading a corrupt config file left configparser in an - invalid state. Original patch by Florian H?ch. - -- Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. - -C API ------ - -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - -Documentation -------------- - -- Issue #23722: The data model reference and the porting section in the What's - New guide now cover the additional ``__classcell__`` handling needed for - custom metaclasses to fully support PEP 487 and zero-argument ``super()``. - -Tools/Demos ------------ - -- Issue #28023: Fix python-gdb.py didn't support new dict implementation. - - -What's New in Python 3.6.0 beta 4? -================================== - -*Release date: 2016-11-21* - -Core and Builtins ------------------ - -- Issue #28532: Show sys.version when -V option is supplied twice. - -- Issue #27100: The with-statement now checks for __enter__ before it - checks for __exit__. This gives less confusing error messages when - both methods are missing. Patch by Jonathan Ellington. - -- Issue #28746: Fix the set_inheritable() file descriptor method on platforms - that do not have the ioctl FIOCLEX and FIONCLEX commands. - -- Issue #26920: Fix not getting the locale's charset upon initializing the - interpreter, on platforms that do not have langinfo. - -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X - when decode astral characters. Patch by Xiang Zhang. - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #28665: Improve speed of the STORE_DEREF opcode by 40%. - -- Issue #28583: PyDict_SetDefault didn't combine split table when needed. - Patch by Xiang Zhang. - -- Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning. - As it was agreed in the issue, __aiter__ returning an awaitable - should result in PendingDeprecationWarning in 3.5 and in - DeprecationWarning in 3.6. - -- Issue #26182: Fix a refleak in code that raises DeprecationWarning. - -- Issue #28721: Fix asynchronous generators aclose() and athrow() to - handle StopAsyncIteration propagation properly. - -Library -------- - -- Issue #28752: Restored the __reduce__() methods of datetime objects. - -- Issue #28727: Regular expression patterns, _sre.SRE_Pattern objects created - by re.compile(), become comparable (only x==y and x!=y operators). This - change should fix the issue #18383: don't duplicate warning filters when the - warnings module is reloaded (thing usually only done in unit tests). - -- Issue #20572: The subprocess.Popen.wait method's undocumented - endtime parameter now raises a DeprecationWarning. - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #19717: Makes Path.resolve() succeed on paths that do not exist. - Patch by Vajrasky Kok - -- Issue #28563: Fixed possible DoS and arbitrary code execution when handle - plural form selections in the gettext module. The expression parser now - supports exact syntax supported by GNU gettext. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #28600: Optimize loop.call_soon. - -- Issue #28613: Fix get_event_loop() return the current loop if - called from coroutines/callbacks. - -- Issue #28634: Fix asyncio.isfuture() to support unittest.Mock. - -- Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. - -- Issue #28639: Fix inspect.isawaitable to always return bool - Patch by Justin Mayfield. - -- Issue #28652: Make loop methods reject socket kinds they do not support. - -- Issue #28653: Fix a refleak in functools.lru_cache. - -- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. - -- Issue #28704: Fix create_unix_server to support Path-like objects - (PEP 519). - -- Issue #28720: Add collections.abc.AsyncGenerator. - -Documentation -------------- - -- Issue #28513: Documented command-line interface of zipfile. - -Tests ------ - -- Issue #28666: Now test.support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -Build ------ - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Patch by Gareth Rees. - - -What's New in Python 3.6.0 beta 3? -================================== - -*Release date: 2016-10-31* - -Core and Builtins ------------------ - -- Issue #28128: Deprecation warning for invalid str and byte escape - sequences now prints better information about where the error - occurs. Patch by Serhiy Storchaka and Eric Smith. - -- Issue #28509: dict.update() no longer allocate unnecessary large memory. - -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug - build. - -- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused - keeping unreachable code. - -- Issue #28214: Improved exception reporting for problematic __set_name__ - attributes. - -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception - loss in PyTraceBack_Here(). - -- Issue #28471: Fix "Python memory allocator called without holding the GIL" - crash in socket.setblocking. - -Library -------- - -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if - given empty data twice. Patch by Benjamin Fogle. - -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived - browsers. Based on patch by Oleg Broytman. - -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused - by representing the scale as float value internally in Tk. tkinter.IntVar - now works if float value is set to underlying Tk variable. - -- Issue #18844: The various ways of specifying weights for random.choices() - now produce the same result sequences. - -- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. - -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. - Based on patch by Kaarle Ritvanen. - -- Issue #28353: os.fwalk() no longer fails on broken links. - -- Issue #28430: Fix iterator of C implemented asyncio.Future doesn't accept - non-None value is passed to it.send(val). - -- Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix - for readability. - -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. - -- Issue #25953: re.sub() now raises an error for invalid numerical group - reference in replacement template even if the pattern is not found in - the string. Error message for invalid group reference now includes the - group index and the position of the reference. - Based on patch by SilentGhost. - -- Issue #18219: Optimize csv.DictWriter for large number of columns. - Patch by Mariatta Wijaya. - -- Issue #28448: Fix C implemented asyncio.Future didn't work on Windows. - -- Issue #28480: Fix error building socket module when multithreading is - disabled. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. - -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - handlers. - -- Issue #28492: Fix how StopIteration exception is raised in _asyncio.Future. - -- Issue #28500: Fix asyncio to handle async gens GC from another thread. - -- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all - children are done. - Patch by Johannes Ebke. - -- Issue #26796: Don't configure the number of workers for default - threadpool executor. - Initial patch by Hans Lawrenz. - -- Issue #28544: Implement asyncio.Task in C. - -Windows -------- - -- Issue #28522: Fixes mishandled buffer reallocation in getpathp.c - -Build ------ - -- Issue #28444: Fix missing extensions modules when cross compiling. - -- Issue #28208: Update Windows build and OS X installers to use SQLite 3.14.2. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -Tests ------ - -- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or - missing the effective gid. - -- Issue #28409: regrtest: fix the parser of command line arguments. - - -What's New in Python 3.6.0 beta 2? -================================== - -*Release date: 2016-10-10* - -Core and Builtins ------------------ - -- Issue #28183: Optimize and cleanup dict iteration. - -- Issue #26081: Added C implementation of asyncio.Future. - Original patch by Yury Selivanov. - -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). - Patch by Xiang Zhang. - -- Issue #28376: The type of long range iterator is now registered as Iterator. - Patch by Oren Milman. - -- Issue #28376: Creating instances of range_iterator by calling range_iterator - type now is deprecated. Patch by Oren Milman. - -- Issue #28376: The constructor of range_iterator now checks that step is not 0. - Patch by Oren Milman. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28201: Dict reduces possibility of 2nd conflict in hash table when - hashes have same lower bits. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #26617: Fix crash when GC runs during weakref callbacks. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #21578: Fixed misleading error message when ImportError called with - invalid keyword args. - -- Issue #28203: Fix incorrect type in complex(1.0, {2:3}) error message. - Patch by Soumya Sharma. - -- Issue #28086: Single var-positional argument of tuple subtype was passed - unscathed to the C-defined function. Now it is converted to exact tuple. - -- Issue #28214: Now __set_name__ is looked up on the class instead of the - instance. - -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() - syscall fails with EPERM, for example when blocked by SECCOMP. - -- Issue #28192: Don't import readline in isolated mode. - -- Upgrade internal unicode databases to Unicode version 9.0.0. - -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport - should use the same optimization level as the interpreter. - -- Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly - optimize memcpy(). - -- Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a - "pending key" (Not yet inserted in split-table). Patch by Xiang Zhang. - -- Issue #26182: Raise DeprecationWarning when async and await keywords are - used as variable/attribute/class/function name. - -Library -------- - -- Issue #27998: Fixed bytes path support in os.scandir() on Windows. - Patch by Eryk Sun. - -- Issue #28317: The disassembler now decodes FORMAT_VALUE argument. - -- Issue #26293: Fixed writing ZIP files that starts not from the start of the - file. Offsets in ZIP file now are relative to the start of the archive in - conforming to the specification. - -- Issue #28380: unittest.mock Mock autospec functions now properly support - assert_called, assert_not_called, and assert_called_once. - -- Issue #27181 remove statistics.geometric_mean and defer until 3.7. - -- Issue #28229: lzma module now supports pathlib. - -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. - -- Issue #28225: bz2 module now supports pathlib. Initial patch by Ethan Furman. - -- Issue #28227: gzip now supports pathlib. Patch by Ethan Furman. - -- Issue #27358: Optimized merging var-keyword arguments and improved error - message when passing a non-mapping as a var-keyword argument. - -- Issue #28257: Improved error message when passing a non-iterable as - a var-positional argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. - -- Issue #28322: Fixed possible crashes when unpickle itertools objects from - incorrect pickle data. Based on patch by John Leitch. - -- Issue #28228: imghdr now supports pathlib. - -- Issue #28226: compileall now supports pathlib. - -- Issue #28314: Fix function declaration (C flags) for the getiterator() method - of xml.etree.ElementTree.Element. - -- Issue #28148: Stop using localtime() and gmtime() in the time - module. - - Introduced platform independent _PyTime_localtime API that is - similar to POSIX localtime_r, but available on all platforms. Patch - by Ed Schouten. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Patch by Xiang Zhang. - -- Issue #18844: random.choices() now has k as a keyword-only argument - to improve the readability of common cases and come into line - with the signature used in other languages. - -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. - Patch by Madison May. - -- Issue #27611: Fixed support of default root window in the tkinter.tix module. - Added the master parameter in the DisplayStyle constructor. - -- Issue #27348: In the traceback module, restore the formatting of exception - messages like "Exception: None". This fixes a regression introduced in - 3.5a2. - -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). - -- Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is - interrupted by a signal and a signal handler raises a Python exception. - -- Issue #28200: Fix memory leak on Windows in the os module (fix - path_converter() function). - -- Issue #25400: RobotFileParser now correctly returns default values for - crawl_delay and request_rate. Initial patch by Peter Wirtz. - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Fix UnboundLocalError in socket._sendfile_use_sendfile. - -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of - os.stat(). Patch by Eryk Sun. - -- Issue #22493: Warning message emitted by using inline flags in the middle of - regular expression now contains a (truncated) regex pattern. - Patch by Tim Graham. - -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. - -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. - -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. - -- Issue #28114: Fix a crash in parse_envlist() when env contains byte strings. - Patch by Eryk Sun. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. - -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. - -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. - -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. - -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. - -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. - Patch by Mark Williams. - -- Issue #28368: Refuse monitoring processes if the child watcher has no - loop attached. - Patch by Vincent Michel. - -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. - -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by ????????? ????. - -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. - -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. - -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by ????????? ????. - -- Issue #27972: Prohibit Tasks to await on themselves. - -Windows -------- - -- Issue #28402: Adds signed catalog files for stdlib on Windows. - -- Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by - Eryk Sun) - -- Issue #28251: Improvements to help manuals on Windows. - -- Issue #28110: launcher.msi has different product codes between 32-bit and - 64-bit - -- Issue #28161: Opening CON for write access fails - -- Issue #28162: WindowsConsoleIO readall() fails if first line starts with - Ctrl+Z - -- Issue #28163: WindowsConsoleIO fileno() passes wrong flags to - _open_osfhandle - -- Issue #28164: _PyIO_get_console_type fails for various paths - -- Issue #28137: Renames Windows path file to ._pth - -- Issue #28138: Windows ._pth file should allow import site - -C API ------ - -- Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(), - PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and - PyUnicode_AsEncodedUnicode(). - -Build ------ - -- Issue #28258: Fixed build with Estonian locale (python-config and distclean - targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #15819: Remove redundant include search directory option for building - outside the source tree. - -Tests ------ - -- Issue #28217: Adds _testconsole module to test console input. - - -What's New in Python 3.6.0 beta 1? -================================== - -*Release date: 2016-09-12* - -Core and Builtins ------------------ - -- Issue #23722: The __class__ cell used by zero-argument super() is now - initialized from type.__new__ rather than __build_class__, so class methods - relying on that will now work correctly when called from metaclass methods - during class creation. Patch by Martin Teichmann. - -- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when Python - is compiled with NSMALLPOSINTS = 0. - -- Issue #27080: Implement formatting support for PEP 515. Initial patch - by Chris Angelico. - -- Issue #27199: In tarfile, expose copyfileobj bufsize to improve throughput. - Patch by Jason Fried. - -- Issue #27948: In f-strings, only allow backslashes inside the braces - (where the expressions are). This is a breaking change from the 3.6 - alpha releases, where backslashes are allowed anywhere in an - f-string. Also, require that expressions inside f-strings be - enclosed within literal braces, and not escapes like - ``f'\x7b"hi"\x7d'``. - -- Issue #28046: Remove platform-specific directories from sys.path. - -- Issue #28071: Add early-out for differencing from an empty set. - -- Issue #25758: Prevents zipimport from unnecessarily encoding a filename - (patch by Eryk Sun) - -- Issue #25856: The __module__ attribute of extension classes and functions - now is interned. This leads to more compact pickle data with protocol 4. - -- Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more - efficient bytecode. Patch by Demur Rumed, design by Serhiy Storchaka, - reviewed by Serhiy Storchaka and Victor Stinner. - -- Issue #26331: Implement tokenizing support for PEP 515. Patch by Georg Brandl. - -- Issue #27999: Make "global after use" a SyntaxError, and ditto for nonlocal. - Patch by Ivan Levkivskyi. - -- Issue #28003: Implement PEP 525 -- Asynchronous Generators. - -- Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations. - Patch by Ivan Levkivskyi. - -- Issue #26058: Add a new private version to the builtin dict type, incremented - at each dictionary creation and at each dictionary change. Implementation of - the PEP 509. - -- Issue #27364: A backslash-character pair that is not a valid escape sequence - now generates a DeprecationWarning. Patch by Emanuel Barry. - -- Issue #27350: `dict` implementation is changed like PyPy. It is more compact - and preserves insertion order. - (Concept developed by Raymond Hettinger and patch by Inada Naoki.) - -- Issue #27911: Remove unnecessary error checks in - ``exec_builtin_or_dynamic()``. - -- Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation. - -- Issue #17884: Python now requires systems with inttypes.h and stdint.h - -- Issue #27961: Require platforms to support ``long long``. Python hasn't - compiled without ``long long`` for years, so this is basically a formality. - -- Issue #27355: Removed support for Windows CE. It was never finished, - and Windows CE is no longer a relevant platform for Python. - -- Implement PEP 523. - -- Issue #27870: A left shift of zero by a large integer no longer attempts - to allocate large amounts of memory. - -- Issue #25402: In int-to-decimal-string conversion, improve the estimate - of the intermediate memory required, and remove an unnecessarily strict - overflow check. Patch by Serhiy Storchaka. - -- Issue #27214: In long_invert, be more careful about modifying object - returned by long_add, and remove an unnecessary check for small longs. - Thanks Oren Milman for analysis and patch. - -- Issue #27506: Support passing the bytes/bytearray.translate() "delete" - argument by keyword. - -- Issue #27812: Properly clear out a generator's frame's backreference to the - generator to prevent crashes in frame.clear(). - -- Issue #27811: Fix a crash when a coroutine that has not been awaited is - finalized with warnings-as-errors enabled. - -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check - after use of 'def' in _PyState_AddModule(). - Initial patch by Christian Heimes. - -- Issue #27792: The modulo operation applied to ``bool`` and other - ``int`` subclasses now always returns an ``int``. Previously - the return type depended on the input values. Patch by Xiang Zhang. - -- Issue #26984: int() now always returns an instance of exact int. - -- Issue #25604: Fix a minor bug in integer true division; this bug could - potentially have caused off-by-one-ulp results on platforms with - unreliable ldexp implementations. - -- Issue #24254: Make class definition namespace ordered by default. - -- Issue #27662: Fix an overflow check in ``List_New``: the original code was - checking against ``Py_SIZE_MAX`` instead of the correct upper bound of - ``Py_SSIZE_T_MAX``. Patch by Xiang Zhang. - -- Issue #27782: Multi-phase extension module import now correctly allows the - ``m_methods`` field to be used to add module level functions to instances - of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang. - -- Issue #27936: The round() function accepted a second None argument - for some types but not for others. Fixed the inconsistency by - accepting None for all numeric types. - -- Issue #27487: Warn if a submodule argument to "python -m" or - runpy.run_module() is found in sys.modules after parent packages are - imported, but before the submodule is executed. - -- Issue #27157: Make only type() itself accept the one-argument form. - Patch by Eryk Sun and Emanuel Barry. - -- Issue #27558: Fix a SystemError in the implementation of "raise" statement. - In a brand new thread, raise a RuntimeError since there is no active - exception to reraise. Patch written by Xiang Zhang. - -- Issue #28008: Implement PEP 530 -- asynchronous comprehensions. - -- Issue #27942: Fix memory leak in codeobject.c - -Library -------- - -- Issue #28732: Fix crash in os.spawnv() with no elements in args - -- Issue #28485: Always raise ValueError for negative - compileall.compile_dir(workers=...) parameter, even when multithreading is - unavailable. - -- Issue #28037: Use sqlite3_get_autocommit() instead of setting - Connection->inTransaction manually. - -- Issue #25283: Attributes tm_gmtoff and tm_zone are now available on - all platforms in the return values of time.localtime() and - time.gmtime(). - -- Issue #24454: Regular expression match object groups are now - accessible using __getitem__. "mo[x]" is equivalent to - "mo.group(x)". - -- Issue #10740: sqlite3 no longer implicitly commit an open transaction - before DDL statements. - -- Issue #17941: Add a *module* parameter to collections.namedtuple(). - -- Issue #22493: Inline flags now should be used only at the start of the - regular expression. Deprecation warning is emitted if uses them in the - middle of the regular expression. - -- Issue #26885: xmlrpc now supports unmarshalling additional data types used - by Apache XML-RPC implementation for numerics and None. - -- Issue #28070: Fixed parsing inline verbose flag in regular expressions. - -- Issue #19500: Add client-side SSL session resumption to the ssl module. - -- Issue #28022: Deprecate ssl-related arguments in favor of SSLContext. The - deprecation include manual creation of SSLSocket and certfile/keyfile - (or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib. - -- Issue #28043: SSLContext has improved default settings: OP_NO_SSLv2, - OP_NO_SSLv3, OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, - OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE and HIGH ciphers without MD5. - -- Issue #24693: Changed some RuntimeError's in the zipfile module to more - appropriate types. Improved some error messages and debugging output. - -- Issue #17909: ``json.load`` and ``json.loads`` now support binary input - encoded as UTF-8, UTF-16 or UTF-32. Patch by Serhiy Storchaka. - -- Issue #27137: the pure Python fallback implementation of ``functools.partial`` - now matches the behaviour of its accelerated C counterpart for subclassing, - pickling and text representation purposes. Patch by Emanuel Barry and - Serhiy Storchaka. - -- Fix possible integer overflows and crashes in the mmap module with unusual - usage patterns. - -- Issue #1703178: Fix the ability to pass the --link-objects option to the - distutils build_ext command. - -- Issue #28019: itertools.count() no longer rounds non-integer step in range - between 1.0 and 2.0 to 1. - -- Issue #18401: Pdb now supports the 'readrc' keyword argument to control - whether .pdbrc files should be read. Patch by Martin Matusiak and - Sam Kimbrel. - -- Issue #25969: Update the lib2to3 grammar to handle the unpacking - generalizations added in 3.5. - -- Issue #14977: mailcap now respects the order of the lines in the mailcap - files ("first match"), as required by RFC 1542. Patch by Michael Lazar. - -- Issue #28082: Convert re flag constants to IntFlag. - -- Issue #28025: Convert all ssl module constants to IntEnum and IntFlags. - SSLContext properties now return flags and enums. - -- Issue #23591: Add Flag, IntFlag, and auto() to enum module. - -- Issue #433028: Added support of modifier spans in regular expressions. - -- Issue #24594: Validates persist parameter when opening MSI database - -- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes - (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.) - -- Issue #28047: Fixed calculation of line length used for the base64 CTE - in the new email policies. - -- Issue #27576: Fix call order in OrderedDict.__init__(). - -- email.generator.DecodedGenerator now supports the policy keyword. - -- Issue #28027: Remove undocumented modules from ``Lib/plat-*``: IN, CDROM, - DLFCN, TYPES, CDIO, and STROPTS. - -- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). - Patch by Claude Paroz. - -- Issue #24277: The new email API is no longer provisional, and the docs - have been reorganized and rewritten to emphasize the new API. - -- Issue #22450: urllib now includes an ``Accept: */*`` header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. - -- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file - between runs given the same Grammar.txt input regardless of the hash - randomization setting. - -- Issue #28005: Allow ImportErrors in encoding implementation to propagate. - -- Issue #26667: Support path-like objects in importlib.util. - -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. - -- Issue #22233: Break email header lines *only* on the RFC specified CR and LF - characters, not on arbitrary unicode line breaks. This also fixes a bug in - HTTP header parsing. - -- Issue #27331: The email.mime classes now all accept an optional policy keyword. - -- Issue #27988: Fix email iter_attachments incorrect mutation of payload list. - -- Issue #16113: Add SHA-3 and SHAKE support to hashlib module. - -- Eliminate a tautological-pointer-compare warning in _scproxy.c. - -- Issue #27776: The :func:`os.urandom` function does now block on Linux 3.17 - and newer until the system urandom entropy pool is initialized to increase - the security. This change is part of the :pep:`524`. - -- Issue #27778: Expose the Linux ``getrandom()`` syscall as a new - :func:`os.getrandom` function. This change is part of the :pep:`524`. - -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name - fields in X.509 certs. - -- Issue #18844: Add random.choices(). - -- Issue #25761: Improved error reporting about truncated pickle data in - C implementation of unpickler. UnpicklingError is now raised instead of - AttributeError and ValueError in some cases. - -- Issue #26798: Add BLAKE2 (blake2b and blake2s) to hashlib. - -- Issue #26032: Optimized globbing in pathlib by using os.scandir(); it is now - about 1.5--4 times faster. - -- Issue #25596: Optimized glob() and iglob() functions in the - glob module; they are now about 3--6 times faster. - -- Issue #27928: Add scrypt (password-based key derivation function) to - hashlib module (requires OpenSSL 1.1.0). - -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter - measure sweet32 attack (CVE-2016-2183). - -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. - (Required OpenSSL 1.1.0 or LibreSSL). - -- Issue #25387: Check return value of winsound.MessageBeep. - -- Issue #27866: Add SSLContext.get_ciphers() method to get a list of all - enabled ciphers. - -- Issue #27744: Add AF_ALG (Linux Kernel crypto) to socket module. - -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. - -- Issue #11620: Fix support for SND_MEMORY in winsound.PlaySound. Based on a - patch by Tim Lesher. - -- Issue #11734: Add support for IEEE 754 half-precision floats to the - struct module. Based on a patch by Eli Stevens. - -- Issue #27919: Deprecated ``extra_path`` distribution option in distutils - packaging. - -- Issue #23229: Add new ``cmath`` constants: ``cmath.inf`` and ``cmath.nan`` to - match ``math.inf`` and ``math.nan``, and also ``cmath.infj`` and - ``cmath.nanj`` to match the format used by complex repr. - -- Issue #27842: The csv.DictReader now returns rows of type OrderedDict. - (Contributed by Steve Holden.) - -- Remove support for passing a file descriptor to os.access. It never worked but - previously didn't raise. - -- Issue #12885: Fix error when distutils encounters symlink. - -- Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. - Based on patch by Xiang Zhang. - -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory - creates not a cursor. Patch by Xiang Zhang. - -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. - -- Issue #27706: Restore deterministic behavior of random.Random().seed() - for string seeds using seeding version 1. Allows sequences of calls - to random() to exactly match those obtained in Python 2. - Patch by Nofar Schnider. - -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. - -- Issue #12319: Chunked transfer encoding support added to - http.client.HTTPConnection requests. The - urllib.request.AbstractHTTPHandler class does not enforce a Content-Length - header any more. If a HTTP request has a file or iterable body, but no - Content-Length header, the library now falls back to use chunked transfer- - encoding. - -- A new version of typing.py from https://github.com/python/typing: - - Collection (only for 3.6) (Issue #27598) - - Add FrozenSet to __all__ (upstream #261) - - fix crash in _get_type_vars() (upstream #259) - - Remove the dict constraint in ForwardRef._eval_type (upstream #252) - -- Issue #27832: Make ``_normalize`` parameter to ``Fraction`` constuctor - keyword-only, so that ``Fraction(2, 3, 4)`` now raises ``TypeError``. - -- Issue #27539: Fix unnormalised ``Fraction.__pow__`` result in the case - of negative exponent and negative base. - -- Issue #21718: cursor.description is now available for queries using CTEs. - -- Issue #27819: In distutils sdists, simply produce the "gztar" (gzipped tar - format) distributions on all platforms unless "formats" is supplied. - -- Issue #2466: posixpath.ismount now correctly recognizes mount points which - the user does not have permission to access. - -- Issue #9998: On Linux, ctypes.util.find_library now looks in LD_LIBRARY_PATH - for shared libraries. - -- Issue #27573: exit message for code.interact is now configurable. - -- Issue #27930: Improved behaviour of logging.handlers.QueueListener. - Thanks to Paulo Andrade and Petr Viktorin for the analysis and patch. - -- Issue #6766: Distributed reference counting added to multiprocessing - to support nesting of shared values / proxy objects. - -- Issue #21201: Improves readability of multiprocessing error message. Thanks - to Wojciech Walczak for patch. - -- asyncio: Add set_protocol / get_protocol to Transports. - -- Issue #27456: asyncio: Set TCP_NODELAY by default. - -IDLE ----- - -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. - -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - -- Issue #27891: Consistently group and sort imports within idlelib modules. - -- Issue #17642: add larger font sizes for classroom projection. - -- Add version to title of IDLE help window. - -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. - -- Issue #27821: Fix 3.6.0a3 regression that prevented custom key sets - from being selected when no custom theme was defined. - -C API ------ - -- Issue #26900: Excluded underscored names and other private API from limited API. - -- Issue #26027: Add support for path-like objects in PyUnicode_FSConverter() & - PyUnicode_FSDecoder(). - -Tests ------ - -- Issue #27427: Additional tests for the math module. Patch by Francisco Couzo. - -- Issue #27953: Skip math and cmath tests that fail on OS X 10.4 due to a - poor libm implementation of tan. - -- Issue #26040: Improve test_math and test_cmath coverage and rigour. Patch by - Jeff Allen. - -- Issue #27787: Call gc.collect() before checking each test for "dangling - threads", since the dangling threads are weak references. - -Build ------ - -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) - -- Issue #27705: Update message in validate_ucrtbase.py - -- Issue #27976: Deprecate building _ctypes with the bundled copy of libffi on - non-OSX UNIX platforms. - -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. - -- Issue #21590: Support for DTrace and SystemTap probes. - -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. - -- Issue #26359: Add the --with-optimizations flag to turn on LTO and PGO build - support when available. - -- Issue #27917: Set platform triplets for Android builds. - -- Issue #25825: Update references to the $(LIBPL) installation path on AIX. - This path was changed in 3.2a4. - -- Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2. - -- Issue #21122: Fix LTO builds on OS X. - -- Issue #17128: Build OS X installer with a private copy of OpenSSL. - Also provide a sample Install Certificates command script to install a - set of root certificates from the third-party certifi module. - -Tools/Demos ------------ - -- Issue #27952: Get Tools/scripts/fixcid.py working with Python 3 and the - current "re" module, avoid invalid Python backslash escapes, and fix a bug - parsing escaped C quote signs. - -Windows -------- - -- Issue #28065: Update xz dependency to 5.2.2 and build it from source. - -- Issue #25144: Ensures TargetDir is set before continuing with custom - install. - -- Issue #1602: Windows console doesn't input or print Unicode (PEP 528) - -- Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) - -- Issue #27731: Opt-out of MAX_PATH on Windows 10 - -- Issue #6135: Adds encoding and errors parameters to subprocess. - -- Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to - codec lookup. - -- Issue #27982: The functions of the winsound module now accept keyword - arguments. - -- Issue #20366: Build full text search support into SQLite on Windows. - -- Issue #27756: Adds new icons for Python files and processes on Windows. - Designs by Cherry Wang. - -- Issue #27883: Update sqlite to 3.14.1.0 on Windows. - - -What's New in Python 3.6.0 alpha 4? -=================================== - -*Release date: 2016-08-15* - -Core and Builtins ------------------ - -- Issue #27704: Optimized creating bytes and bytearray from byte-like objects - and iterables. Speed up to 3 times for short objects. Original patch by - Naoki Inada. - -- Issue #26823: Large sections of repeated lines in tracebacks are now - abbreviated as "[Previous line repeated {count} more times]" by the builtin - traceback rendering. Patch by Emanuel Barry. - -- Issue #27574: Decreased an overhead of parsing keyword arguments in functions - implemented with using Argument Clinic. - -- Issue #22557: Now importing already imported modules is up to 2.5 times - faster. - -- Issue #17596: Include to help with Min GW building. - -- Issue #17599: On Windows, rename the privately defined REPARSE_DATA_BUFFER - structure to avoid conflicting with the definition from Min GW. - -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by - Xiang Zhang. - -- Issue #27581: Don't rely on wrapping for overflow check in - PySequence_Tuple(). Patch by Xiang Zhang. - -- Issue #1621: Avoid signed integer overflow in list and tuple operations. - Patch by Xiang Zhang. - -- Issue #27419: Standard __import__() no longer look up "__import__" in globals - or builtins for importing submodules or "from import". Fixed a crash if - raise a warning about unabling to resolve package from __spec__ or - __package__. - -- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows. - -- Issue #27514: Make having too many statically nested blocks a SyntaxError - instead of SystemError. - -- Issue #27366: Implemented PEP 487 (Simpler customization of class creation). - Upon subclassing, the __init_subclass__ classmethod is called on the base - class. Descriptors are initialized with __set_name__ after class creation. - -Library -------- - -- Issue #26027, #27524: Add PEP 519/__fspath__() support to the os and os.path - modules. Includes code from Jelle Zijlstra. - -- Issue #27598: Add Collections to collections.abc. - Patch by Ivan Levkivskyi, docs by Neil Girdhar. - -- Issue #25958: Support "anti-registration" of special methods from - various ABCs, like __hash__, __iter__ or __len__. All these (and - several more) can be set to None in an implementation class and the - behavior will be as if the method is not defined at all. - (Previously, this mechanism existed only for __hash__, to make - mutable classes unhashable.) Code contributed by Andrew Barnert and - Ivan Levkivskyi. - -- Issue #16764: Support keyword arguments to zlib.decompress(). Patch by - Xiang Zhang. - -- Issue #27736: Prevent segfault after interpreter re-initialization due - to ref count problem introduced in code for Issue #27038 in 3.6.0a3. - Patch by Xiang Zhang. - -- Issue #25628: The *verbose* and *rename* parameters for - collections.namedtuple are now keyword-only. - -- Issue #12345: Add mathematical constant tau to math and cmath. See also - PEP 628. - -- Issue #26823: traceback.StackSummary.format now abbreviates large sections of - repeated lines as "[Previous line repeated {count} more times]" (this change - then further affects other traceback display operations in the module). Patch - by Emanuel Barry. - -- Issue #27664: Add to concurrent.futures.thread.ThreadPoolExecutor() - the ability to specify a thread name prefix. - -- Issue #27181: Add geometric_mean and harmonic_mean to statistics module. - -- Issue #27573: code.interact now prints an message when exiting. - -- Issue #6422: Add autorange method to timeit.Timer objects. - -- Issue #27773: Correct some memory management errors server_hostname in - _ssl.wrap_socket(). - -- Issue #26750: unittest.mock.create_autospec() now works properly for - subclasses of property() and other data descriptors. Removes the never - publicly used, never documented unittest.mock.DescriptorTypes tuple. - -- Issue #26754: Undocumented support of general bytes-like objects - as path in compile() and similar functions is now deprecated. - -- Issue #26800: Undocumented support of general bytes-like objects - as paths in os functions is now deprecated. - -- Issue #26981: Add _order_ compatibility shim to enum.Enum for - Python 2/3 code bases. - -- Issue #27661: Added tzinfo keyword argument to datetime.combine. - -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. - -- Issue #27783: Fix possible usage of uninitialized memory in - operator.methodcaller. - -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. - -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - -- Issue #27758: Fix possible integer overflow in the _csv module for large - record lengths. - -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. - -- Issue #7063: Remove dead code from the "array" module's slice handling. - Patch by Chuck. - -- Issue #27656: Do not assume sched.h defines any SCHED_* constants. - -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 4 GiB) when compressing and decompressing. Previously, inputs - were limited to 4 GiB, and compression and decompression operations did not - properly handle results of 4 GiB. - -- Issue #24773: Implemented PEP 495 (Local Time Disambiguation). - -- Expose the EPOLLEXCLUSIVE constant (when it is defined) in the select module. - -- Issue #27567: Expose the EPOLLRDHUP and POLLRDHUP constants in the select - module. - -- Issue #1621: Avoid signed int negation overflow in the "audioop" module. - -- Issue #27533: Release GIL in nt._isdir - -- Issue #17711: Fixed unpickling by the persistent ID with protocol 0. - Original patch by Alexandre Vassalotti. - -- Issue #27522: Avoid an unintentional reference cycle in email.feedparser. - -- Issue #27512: Fix a segfault when os.fspath() called an __fspath__() method - that raised an exception. Patch by Xiang Zhang. - -IDLE ----- - -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. - -- Issue #27621: Put query response validation error messages in the query - box itself instead of in a separate massagebox. Redo tests to match. - Add Mac OSX refinements. Original patch by Mark Roseman. - -- Issue #27620: Escape key now closes Query box as cancelled. - -- Issue #27609: IDLE: tab after initial whitespace should tab, not - autocomplete. This fixes problem with writing docstrings at least - twice indented. - -- Issue #27609: Explicitly return None when there are also non-None - returns. In a few cases, reverse a condition and eliminate a return. - -- Issue #25507: IDLE no longer runs buggy code because of its tkinter imports. - Users must include the same imports required to run directly in Python. - -- Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets. - Make the default key set depend on the platform. - Add tests for the changes to the config module. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -Tests ------ - -- Issue #25805: Skip a test in test_pkgutil as needed that doesn't work when - ``__name__ == __main__``. Patch by SilentGhost. - -- Issue #27472: Add test.support.unix_shell as the path to the default shell. - -- Issue #27369: In test_pyexpat, avoid testing an error message detail that - changed in Expat 2.2.0. - -- Issue #27594: Prevent assertion error when running test_ast with coverage - enabled: ensure code object has a valid first line number. - Patch suggested by Ivan Levkivskyi. - -Windows -------- - -- Issue #27647: Update bundled Tcl/Tk to 8.6.6. - -- Issue #27610: Adds PEP 514 metadata to Windows installer - -- Issue #27469: Adds a shell extension to the launcher so that drag and drop - works correctly. - -- Issue #27309: Enables proper Windows styles in python[w].exe manifest. - -Build ------ - -- Issue #27713: Suppress spurious build warnings when updating importlib's - bootstrap files. Patch by Xiang Zhang - -- Issue #25825: Correct the references to Modules/python.exp, which is - required on AIX. The references were accidentally changed in 3.5.0a1. - -- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Chi Hsuan Yen. - -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen and _freeze_importlib executables from being cross- - compiled. - -- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be - used for file generation during the build. - -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. - - -What's New in Python 3.6.0 alpha 3? -=================================== - -*Release date: 2016-07-11* - -Core and Builtins ------------------ - -- Issue #27473: Fixed possible integer overflow in bytes and bytearray - concatenations. Patch by Xiang Zhang. - -- Issue #23034: The output of a special Python build with defined COUNT_ALLOCS, - SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can - be re-enabled using the "-X showalloccount" option. It now outputs to stderr - instead of stdout. - -- Issue #27443: __length_hint__() of bytearray iterators no longer return a - negative integer for a resized bytearray. - -- Issue #27007: The fromhex() class methods of bytes and bytearray subclasses - now return an instance of corresponding subclass. - -Library -------- - -- Issue #26844: Fix error message for imp.find_module() to refer to 'path' - instead of 'name'. Patch by Lev Maximov. - -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. - -- Issue #27466: Change time format returned by http.cookie.time2netscape, - confirming the netscape cookie format and making it consistent with - documentation. - -- Issue #21708: Deprecated dbm.dumb behavior that differs from common dbm - behavior: creating a database in 'r' and 'w' modes and modifying a database - in 'r' mode. - -- Issue #26721: Change the socketserver.StreamRequestHandler.wfile attribute - to implement BufferedIOBase. In particular, the write() method no longer - does partial writes. - -- Issue #22115: Added methods trace_add, trace_remove and trace_info in the - tkinter.Variable class. They replace old methods trace_variable, trace, - trace_vdelete and trace_vinfo that use obsolete Tcl commands and might - not work in future versions of Tcl. Fixed old tracing methods: - trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now - always returns a list of pairs of strings, tracing in the "u" mode now works. - -- Issue #26243: Only the level argument to zlib.compress() is keyword argument - now. The first argument is positional-only. - -- Issue #27038: Expose the DirEntry type as os.DirEntry. Code patch by - Jelle Zijlstra. - -- Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return value of - __fspath__() to be either str or bytes. - -- Issue #18726: All optional parameters of the dump(), dumps(), - load() and loads() functions and JSONEncoder and JSONDecoder class - constructors in the json module are now keyword-only. - -- Issue #27319: Methods selection_set(), selection_add(), selection_remove() - and selection_toggle() of ttk.TreeView now allow passing multiple items as - multiple arguments instead of passing them as a tuple. Deprecated - undocumented ability of calling the selection() method with arguments. - -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - -- Issue #27294: Numerical state in the repr for Tkinter event objects is now - represented as a combination of known flags. - -- Issue #27177: Match objects in the re module now support index-like objects - as group indices. Based on patches by Jeroen Demeyer and Xiang Zhang. - -- Issue #26754: Some functions (compile() etc) accepted a filename argument - encoded as an iterable of integers. Now only strings and byte-like objects - are accepted. - -- Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by - Daniel Stokes. - -- Issue #27048: Prevents distutils failing on Windows when environment - variables contain non-ASCII characters - -- Issue #27330: Fixed possible leaks in the ctypes module. - -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch - by Jelle Zijlstra. - -- Issue #27122: When an exception is raised within the context being managed - by a contextlib.ExitStack() and one of the exit stack generators - catches and raises it in a chain, do not re-raise the original exception - when exiting, let the new chained one through. This avoids the PEP 479 - bug described in issue25782. - -- [Security] Issue #27278: Fix os.urandom() implementation using getrandom() on - Linux. Truncate size to INT_MAX and loop until we collected enough random - bytes, instead of casting a directly Py_ssize_t to int. - -- Issue #16864: sqlite3.Cursor.lastrowid now supports REPLACE statement. - Initial patch by Alex LordThorsen. - -- Issue #26386: Fixed ttk.TreeView selection operations with item id's - containing spaces. - -- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to - one set by the env var PAGER). - -- [Security] Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). - -- Issue #16182: Fix various functions in the "readline" module to use the - locale encoding, and fix get_begidx() and get_endidx() to return code point - indexes. - -- Issue #27392: Add loop.connect_accepted_socket(). - Patch by Jim Fulton. - -IDLE ----- - -- Issue #27477: IDLE search dialogs now use ttk widgets. - -- Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets. - Make the default key set depend on the platform. - Add tests for the changes to the config module. - -- Issue #27452: make command line "idle-test> python test_help.py" work. - __file__ is relative when python is started in the file's directory. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -- Issue #27380: IDLE: add query.py with base Query dialog and ttk widgets. - Module had subclasses SectionName, ModuleName, and HelpSource, which are - used to get information from users by configdialog and file =>Load Module. - Each subclass has itw own validity checks. Using ModuleName allows users - to edit bad module names instead of starting over. - Add tests and delete the two files combined into the new one. - -- Issue #27372: Test_idle no longer changes the locale. - -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. - -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. - Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. - -- Issue #24137: Run IDLE, test_idle, and htest with tkinter default root - disabled. Fix code and tests that fail with this restriction. Fix htests to - not create a second and redundant root and mainloop. - -- Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. - -C API ------ - -- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as - an iterable of integers. Now only strings and byte-like objects are accepted. - -Build ------ - -- Issue #28066: Fix the logic that searches build directories for generated - include files when building outside the source tree. - -- Issue #27442: Expose the Android API level that python was built against, in - sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'. - -- Issue #27434: The interpreter that runs the cross-build, found in PATH, must - now be of the same feature version (e.g. 3.6) as the source being built. - -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. - -- Issue #23968: Rename the platform directory from plat-$(MACHDEP) to - plat-$(PLATFORM_TRIPLET). - Rename the config directory (LIBPL) from config-$(LDVERSION) to - config-$(LDVERSION)-$(PLATFORM_TRIPLET). - Install the platform specifc _sysconfigdata module into the platform - directory and rename it to include the ABIFLAGS. - -- Don't use largefile support for GNU/Hurd. - -Tools/Demos ------------ - -- Issue #27332: Fixed the type of the first argument of module-level functions - generated by Argument Clinic. Patch by Petr Viktorin. - -- Issue #27418: Fixed Tools/importbench/importbench.py. - -Documentation -------------- - -- Issue #19489: Moved the search box from the sidebar to the header and footer - of each page. Patch by Ammar Askar. - -- Issue #27285: Update documentation to reflect the deprecation of ``pyvenv`` - and normalize on the term "virtual environment". Patch by Steve Piercy. - -Tests ------ - -- Issue #27027: Added test.support.is_android that is True when this is an - Android build. - - -What's New in Python 3.6.0 alpha 2? -=================================== - -*Release date: 2016-06-13* - -Core and Builtins ------------------ - -- Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. - Patch by Demur Rumed. - -- Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. - Patch by Dave Sawyer. - -- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling - function with generalized unpacking (PEP 448) and conflicting keyword names - could cause undefined behavior. - -- Issue #27140: Added BUILD_CONST_KEY_MAP opcode. - -- Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519). - -- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a - negative number without setting an exception. - -- Issue #26983: float() now always return an instance of exact float. - The deprecation warning is emitted if __float__ returns an instance of - a strict subclass of float. In a future versions of Python this can - be an error. - -- Issue #27097: Python interpreter is now about 7% faster due to optimized - instruction decoding. Based on patch by Demur Rumed. - -- Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode. - Patch by Demur Rumed. - -- Issue #23275: Allow assigning to an empty target list in round brackets: - () = iterable. - -- Issue #27243: Update the __aiter__ protocol: instead of returning - an awaitable that resolves to an asynchronous iterator, the asynchronous - iterator should be returned directly. Doing the former will trigger a - PendingDeprecationWarning. - - -Library -------- - -- Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants - exposed on the API which are not implemented on GNU/Hurd. They would not - work at runtime anyway. - -- Issue #27025: Generated names for Tkinter widgets are now more meanful - and recognizirable. - -- Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and - functools.partial objects. - -- Issue #27294: Improved repr for Tkinter event objects. - -- Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. - Patch by Gareth Rees. - -- [Security] Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - -- [Security] Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. - Reported by Team Oststrom. - -- Issue #21386: Implement missing IPv4Address.is_global property. It was - documented since 07a5610bae9d. Initial patch by Roger Luethi. - -- Issue #27029: Removed deprecated support of universal newlines mode from - ZipFile.open(). - -- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in - regular expressions now are errors. The re.LOCALE flag now can be used - only with bytes patterns. - -- Issue #27186: Add os.PathLike support to DirEntry (part of PEP 519). - Initial patch by Jelle Zijlstra. - -- Issue #20900: distutils register command now decodes HTTP responses - correctly. Initial patch by ingrid. - -- Issue #27186: Add os.PathLike support to pathlib, removing its provisional - status (part of PEP 519). Initial patch by Dusty Phillips. - -- Issue #27186: Add support for os.PathLike objects to os.fsencode() and - os.fsdecode() (part of PEP 519). - -- Issue #27186: Introduce os.PathLike and os.fspath() (part of PEP 519). - -- A new version of typing.py provides several new classes and - features: @overload outside stubs, Reversible, DefaultDict, Text, - ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug - fixes (note that some of the new features are not yet implemented in - mypy or other static analyzers). Also classes for PEP 492 - (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact - they made it into 3.5.1 but were never mentioned). - -- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from - sending a message body for 205 Reset Content. Also, don't send Content - header fields in responses that don't have a body. Patch by Susumu - Koshiba. - -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. - -- [Security] Issue #26839: On Linux, :func:`os.urandom` now calls - ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading - ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch - written by Colm Buckley. - -- Issue #23883: Added missing APIs to __all__ to match the documented APIs - for the following modules: cgi, mailbox, mimetypes, plistlib and smtpd. - Patches by Jacek Ko?odziej. - -- Issue #27164: In the zlib module, allow decompressing raw Deflate streams - with a predefined zdict. Based on patch by Xiang Zhang. - -- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely - write data to the client. Previously it could do partial writes and - truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout - doing partial writes, but this is deprecated. - -- Issue #21272: Use _sysconfigdata.py to initialize distutils.sysconfig. - -- Issue #19611: :mod:`inspect` now reports the implicit ``.0`` parameters - generated by the compiler for comprehension and generator expression scopes - as if they were positional-only parameters called ``implicit0``. - Patch by Jelle Zijlstra. - -- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - -- Issue #26373: subprocess.Popen.communicate now correctly ignores - BrokenPipeError when the child process dies before .communicate() - is called in more/all circumstances. - -- signal, socket, and ssl module IntEnum constant name lookups now return a - consistent name for values having multiple names. Ex: signal.Signals(6) - now refers to itself as signal.SIGALRM rather than flipping between that - and signal.SIGIOT based on the interpreter's hash randomization seed. - -- Issue #27167: Clarify the subprocess.CalledProcessError error message text - when the child process died due to a signal. - -- Issue #25931: Don't define socketserver.Forking* names on platforms such - as Windows that do not support os.fork(). - -- Issue #21776: distutils.upload now correctly handles HTTPError. - Initial patch by Claudiu Popa. - -- Issue #26526: Replace custom parse tree validation in the parser - module with a simple DFA validator. - -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with - PermissionError - -- Issue #18383: Avoid creating duplicate filters when using filterwarnings - and simplefilter. Based on patch by Alex Shkop. - -- Issue #23026: winreg.QueryValueEx() now return an integer for REG_QWORD type. - -- Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning - if the child process is still running. - -- Issue #27056: Optimize pickle.load() and pickle.loads(), up to 10% faster - to deserialize a lot of small objects. - -- Issue #21271: New keyword only parameters in reset_mock call. - -IDLE ----- - -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. - -- Issue #24750: Switch all scrollbars in IDLE to ttk versions. - Where needed, minimal tests are added to cover changes. - -- Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. - Delete now unneeded tk version tests and code for older versions. - Add test for IDLE syntax colorizoer. - -- Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. - -- Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. - -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. - -- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. - These persisted after other warnings were suppressed in #20567. - Apply Serhiy Storchaka's update_idletasks solution to four test files. - Record this additional advice in idle_test/README.txt - -- Issue #20567: Revise idle_test/README.txt with advice about avoiding - tk warning messages from tests. Apply advice to several IDLE tests. - -- Issue #24225: Update idlelib/README.txt with new file names - and event handlers. - -- Issue #27156: Remove obsolete code not used by IDLE. Replacements: - 1. help.txt, replaced by help.html, is out-of-date and should not be used. - Its dedicated viewer has be replaced by the html viewer in help.py. - 2. ``import idlever; I = idlever.IDLE_VERSION`` is the same as - ``import sys; I = version[:version.index(' ')]`` - 3. After ``ob = stackviewer.VariablesTreeItem(*args)``, - ``ob.keys() == list(ob.object.keys)``. - 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk - -- Issue #27117: Make colorizer htest and turtledemo work with dark themes. - Move code for configuring text widget colors to a new function. - -- Issue #24225: Rename many `idlelib/*.py` and `idle_test/test_*.py` files. - Edit files to replace old names with new names when the old name - referred to the module rather than the class it contained. - See the issue and IDLE section in What's New in 3.6 for more. - -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. - -- Issue #21939: Add test for IDLE's percolator. - Original patch by Saimadhav Heblikar. - -- Issue #21676: Add test for IDLE's replace dialog. - Original patch by Saimadhav Heblikar. - -- Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. - -- Issue #21703: Add test for undo delegator. Patch mostly by - Saimadhav Heblikar . - -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. - -- Issue #23977: Add more asserts to test_delegator. - -Documentation -------------- - -- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the - resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik - Nadikuditi. - -- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - -- Issue #22558: Add remaining doc links to source code for Python-coded modules. - Patch by Yoni Lavi. - -Tests ------ - -- Issue #25285: regrtest now uses subprocesses when the -j1 command line option - is used: each test file runs in a fresh child process. Before, the -j1 option - was ignored. - -- Issue #25285: Tools/buildbot/test.bat script now uses -j1 by default to run - each test file in fresh child process. - -Windows -------- - -- Issue #27064: The py.exe launcher now defaults to Python 3. - The Windows launcher ``py.exe`` no longer prefers an installed - Python 2 version over Python 3 by default when used interactively. - -Build ------ - -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. - -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. - -Misc ----- - -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. - -C API ------ - -- Issue #27186: Add the PyOS_FSPath() function (part of PEP 519). - -- Issue #26282: PyArg_ParseTupleAndKeywords() now supports positional-only - parameters. - -Tools/Demos ------------ - -- Issue #26282: Argument Clinic now supports positional-only and keyword - parameters in the same function. - - -What's New in Python 3.6.0 alpha 1? -=================================== - -Release date: 2016-05-16 - -Core and Builtins ------------------ - -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. - -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" - format unit. - -- Issue #26991: Fix possible refleak when creating a function with annotations. - -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Based on - patch by Joe Jevnik. - -- Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. - -- Issue #27005: Optimized the float.fromhex() class method for exact float. - It is now 2 times faster. - -- Issue #18531: Single var-keyword argument of dict subtype was passed - unscathed to the C-defined function. Now it is converted to exact dict. - -- Issue #26811: gc.get_objects() no longer contains a broken tuple with NULL - pointer. - -- Issue #20120: Use RawConfigParser for .pypirc parsing, - removing support for interpolation unintentionally added - with move to Python 3. Behavior no longer does any - interpolation in .pypirc files, matching behavior in Python - 2.7 and Setuptools 19.0. - -- Issue #26249: Memory functions of the :c:func:`PyMem_Malloc` domain - (:c:data:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc allocator ` - rather than system :c:func:`malloc`. Applications calling - :c:func:`PyMem_Malloc` without holding the GIL can now crash: use - ``PYTHONMALLOC=debug`` environment variable to validate the usage of memory - allocators in your application. - -- Issue #26802: Optimize function calls only using unpacking like - ``func(*tuple)`` (no other positional argument, no keyword): avoid copying - the tuple. Patch written by Joe Jevnik. - -- Issue #26659: Make the builtin slice type support cycle collection. - -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. - NOTE: A direct call of super.__init__ is not endorsed! - -- Issue #27138: Fix the doc comment for FileFinder.find_spec(). - -- Issue #27147: Mention PEP 420 in the importlib docs. - -- Issue #25339: PYTHONIOENCODING now has priority over locale in setting the - error handler for stdin and stdout. - -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of str, bytes, - bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding - views and os.scandir() iterator. - -- Issue #26574: Optimize ``bytes.replace(b'', b'.')`` and - ``bytearray.replace(b'', b'.')``. Patch written by Josh Snider. - -- Issue #26581: If coding cookie is specified multiple times on a line in - Python source code file, only the first one is taken to account. - -- Issue #19711: Add tests for reloading namespace packages. - -- Issue #21099: Switch applicable importlib tests to use PEP 451 API. - -- Issue #26563: Debug hooks on Python memory allocators now raise a fatal - error if functions of the :c:func:`PyMem_Malloc` family are called without - holding the GIL. - -- Issue #26564: On error, the debug hooks on Python memory allocators now use - the :mod:`tracemalloc` module to get the traceback where a memory block was - allocated. - -- Issue #26558: The debug hooks on Python memory allocator - :c:func:`PyObject_Malloc` now detect when functions are called without - holding the GIL. - -- Issue #26516: Add :envvar:`PYTHONMALLOC` environment variable to set the - Python memory allocators and/or install debug hooks. - -- Issue #26516: The :c:func:`PyMem_SetupDebugHooks` function can now also be - used on Python compiled in release mode. - -- Issue #26516: The :envvar:`PYTHONMALLOCSTATS` environment variable can now - also be used on Python compiled in release mode. It now has no effect if - set to an empty string. - -- Issue #26516: In debug mode, debug hooks are now also installed on Python - memory allocators when Python is configured without pymalloc. - -- Issue #26464: Fix str.translate() when string is ASCII and first replacements - removes character, but next replacement uses a non-ASCII character or a - string longer than 1 character. Regression introduced in Python 3.5.0. - -- Issue #22836: Ensure exception reports from PyErr_Display() and - PyErr_WriteUnraisable() are sensible even when formatting them produces - secondary errors. This affects the reports produced by - sys.__excepthook__() and when __del__() raises an exception. - -- Issue #26302: Correct behavior to reject comma as a legal character for - cookie names. - -- Issue #26136: Upgrade the warning when a generator raises StopIteration - from PendingDeprecationWarning to DeprecationWarning. Patch by Anish - Shah. - -- Issue #26204: The compiler now ignores all constant statements: bytes, str, - int, float, complex, name constants (None, False, True), Ellipsis - and ast.Constant; not only str and int. For example, ``1.0`` is now ignored - in ``def f(): 1.0``. - -- Issue #4806: Avoid masking the original TypeError exception when using star - (``*``) unpacking in function calls. Based on patch by Hagen F?rstenau and - Daniel Urban. - -- Issue #26146: Add a new kind of AST node: ``ast.Constant``. It can be used - by external AST optimizers, but the compiler does not emit directly such - node. - -- Issue #23601: Sped-up allocation of dict key objects by using Python's - small object allocator. (Contributed by Julian Taylor.) - -- Issue #18018: Import raises ImportError instead of SystemError if a relative - import is attempted without a known parent package. - -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and ``1.0`` - are equal. - -- Issue #26107: The format of the ``co_lnotab`` attribute of code objects - changes to support negative line number delta. - -- Issue #26154: Add a new private _PyThreadState_UncheckedGet() function to get - the current Python thread state, but don't issue a fatal error if it is NULL. - This new function must be used instead of accessing directly the - _PyThreadState_Current variable. The variable is no more exposed since - Python 3.5.1 to hide the exact implementation of atomic C types, to avoid - compiler issues. - -- Issue #25791: If __package__ != __spec__.parent or if neither __package__ or - __spec__ are defined then ImportWarning is raised. - -- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in - _PyObject_GetState() due to regressions observed in Cython-based projects. - -- Issue #25961: Disallowed null characters in the type name. - -- Issue #25973: Fix segfault when an invalid nonlocal statement binds a name - starting with two underscores. - -- Issue #22995: Instances of extension types with a state that aren't - subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. - -- Issue #20440: Massive replacing unsafe attribute setting code with special - macro Py_SETREF. - -- Issue #25766: Special method __bytes__() now works in str subclasses. - -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. - This allows sys.getsize() to work correctly with their subclasses with - __slots__ defined. - -- Issue #25709: Fixed problem with in-place string concatenation and utf-8 - cache. - -- Issue #5319: New Py_FinalizeEx() API allowing Python to set an exit status - of 120 on failure to flush buffered streams. - -- Issue #25485: telnetlib.Telnet is now a context manager. - -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside - __getattr__. - -- Issue #24731: Fixed crash on converting objects with special methods - __bytes__, __trunc__, and __float__ returning instances of subclasses of - bytes, int, and float to subclasses of bytes, int, and float correspondingly. - -- Issue #25630: Fix a possible segfault during argument parsing in functions - that accept filesystem paths. - -- Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess - internals regarding how fds_to_pass were passed to the child. The bug had - no actual impact as subprocess.py already avoided it. - -- Issue #25388: Fixed tokenizer crash when processing undecodable source code - with a null byte. - -- Issue #25462: The hash of the key now is calculated only once in most - operations in C implementation of OrderedDict. - -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now - rejects builtin types with not defined __new__. - -- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() - and eval() are passed bytes-like objects. These objects are not - necessarily terminated by a null byte, but the functions assumed they were. - -- Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node - when compiling AST from Python objects. - -- Issue #24726: Fixed a crash and leaking NULL in repr() of OrderedDict that - was mutated by direct calls of dict methods. - -- Issue #25449: Iterating OrderedDict with keys with unstable hash now raises - KeyError in C implementations as well as in Python implementation. - -- Issue #25395: Fixed crash when highly nested OrderedDict structures were - garbage collected. - -- Issue #25401: Optimize bytes.fromhex() and bytearray.fromhex(): they are now - between 2x and 3.5x faster. - -- Issue #25399: Optimize bytearray % args using the new private _PyBytesWriter - API. Formatting is now between 2.5 and 5 times faster. - -- Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new - recursion limit is too low depending at the current recursion depth. Modify - also the "lower-water mark" formula to make it monotonic. This mark is used - to decide when the overflowed flag of the thread state is reset. - -- Issue #24402: Fix input() to prompt to the redirected stdout when - sys.stdout.fileno() fails. - -- Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API. - Formatting is now up to 2 times faster. - -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. - -- Issue #25301: The UTF-8 decoder is now up to 15 times as fast for error - handlers: ``ignore``, ``replace`` and ``surrogateescape``. - -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. - -- Issue #25267: The UTF-8 encoder is now up to 75 times as fast for error - handlers: ``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``. - Patch co-written with Serhiy Storchaka. - -- Issue #25280: Import trace messages emitted in verbose (-v) mode are no - longer formatted twice. - -- Issue #25227: Optimize ASCII and latin1 encoders with the ``surrogateescape`` - error handler: the encoders are now up to 3 times as fast. Initial patch - written by Serhiy Storchaka. - -- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the - getrandom() function instead of the getentropy() function. The getentropy() - function is blocking to generate very good quality entropy, os.urandom() - doesn't need such high-quality entropy. - -- Issue #9232: Modify Python's grammar to allow trailing commas in the - argument list of a function declaration. For example, "def f(\*, a = - 3,): pass" is now legal. Patch from Mark Dickinson. - -- Issue #24965: Implement PEP 498 "Literal String Interpolation". This - allows you to embed expressions inside f-strings, which are - converted to normal strings at run time. Given x=3, then - f'value={x}' == 'value=3'. Patch by Eric V. Smith. - -- Issue #26478: Fix semantic bugs when using binary operators with dictionary - views and tuples. - -- Issue #26171: Fix possible integer overflow and heap corruption in - zipimporter.get_data(). - -- Issue #25660: Fix TAB key behaviour in REPL with readline. - -- Issue #26288: Optimize PyLong_AsDouble. - -- Issues #26289 and #26315: Optimize floor and modulo division for - single-digit longs. Microbenchmarks show 2-2.5x improvement. Built-in - 'divmod' function is now also ~10% faster. - -- Issue #25887: Raise a RuntimeError when a coroutine object is awaited - more than once. - -Library -------- - -- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by - SELinux and fails with EACCESS. The function now falls back to fcntl(). - Patch written by Micha? Bednarski. - -- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! - -- Issue #27031: Removed dummy methods in Tkinter widget classes: tk_menuBar() - and tk_bindForTraversal(). - -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Original fix by J?n Janech. - -- Issue #17214: The "urllib.request" module now percent-encodes non-ASCII - bytes found in redirect target URLs. Some servers send Location header - fields with non-ASCII bytes, but "http.client" requires the request target - to be ASCII-encodable, otherwise a UnicodeEncodeError is raised. Based on - patch by Christian Heimes. - -- Issue #27033: The default value of the decode_data parameter for - smtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to False. - -- Issue #27034: Removed deprecated class asynchat.fifo. - -- Issue #26870: Added readline.set_auto_history(), which can stop entries - being automatically added to the history list. Based on patch by Tyler - Crompton. - -- Issue #26039: zipfile.ZipFile.open() can now be used to write data into a ZIP - file, as well as for extracting data. Patch by Thomas Kluyver. - -- Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch - contributed by Chi Hsuan Yen. - -- Issue #22274: In the subprocess module, allow stderr to be redirected to - stdout even when stdout is not redirected. Patch by Akira Li. - -- Issue #26807: mock_open 'files' no longer error on readline at end of file. - Patch from Yolanda Robla. - -- Issue #25745: Fixed leaking a userptr in curses panel destructor. - -- Issue #26977: Removed unnecessary, and ignored, call to sum of squares helper - in statistics.pvariance. - -- Issue #26002: Use bisect in statistics.median instead of a linear search. - Patch by Upendra Kuma. - -- Issue #25974: Make use of new Decimal.as_integer_ratio() method in statistics - module. Patch by Stefan Krah. - -- Issue #26996: Add secrets module as described in PEP 506. - -- Issue #26881: The modulefinder module now supports extended opcode arguments. - -- Issue #23815: Fixed crashes related to directly created instances of types in - _tkinter and curses.panel modules. - -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. - Patch by Georg Brandl. - -- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags - instead of silently return incorrect result. - -- Issue #26915: The __contains__ methods in the collections ABCs now check - for identity before checking equality. This better matches the behavior - of the concrete classes, allows sensible handling of NaNs, and makes it - easier to reason about container invariants. - -- Issue #26711: Fixed the comparison of plistlib.Data with other types. - -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. - -- Issue #26864: In urllib.request, change the proxy bypass host checking - against no_proxy to be case-insensitive, and to not match unrelated host - names that happen to have a bypassed hostname as a suffix. Patch by Xiang - Zhang. - -- Issue #24902: Print server URL on http.server startup. Initial patch by - Felix Kaiser. - -- Issue #25788: fileinput.hook_encoded() now supports an "errors" argument - for passing to open. Original patch by Joseph Hackman. - -- Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by - Xiang Zhang. - -- Issue #26804: urllib.request will prefer lower_case proxy environment - variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter - Jansen. - -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items (like bytes in the -b mode). This affects assertListEqual() - and assertTupleEqual(). - -- Issue #26041: Remove "will be removed in Python 3.7" from deprecation - messages of platform.dist() and platform.linux_distribution(). - Patch by Kumaripaba Miyurusara Athukorala. - -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer - silently ignore keyword arguments. - -- Issue #26733: Disassembling a class now disassembles class and static methods. - Patch by Xiang Zhang. - -- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch - :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel - Barry. - -- Issue #24838: tarfile's ustar and gnu formats now correctly calculate name - and link field limits for multibyte character encodings like utf-8. - -- [Security] Issue #26657: Fix directory traversal vulnerability with - http.server on Windows. This fixes a regression that was introduced in - 3.3.4rc1 and 3.4.0rc1. Based on patch by Philipp Hagemeister. - -- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by - Anthony Sottile. - -- Issue #26782: Add STARTUPINFO to subprocess.__all__ on Windows. - -- Issue #26404: Add context manager to socketserver. Patch by Aviv Palivoda. - -- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading - more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of - 1024 bytes per call. - -- Issue #26585: Eliminate http.server._quote_html() and use - html.escape(quote=False). Patch by Xiang Zhang. - -- Issue #26685: Raise OSError if closing a socket fails. - -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. - -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. - -- Issue #26587: the site module now allows .pth files to specify files to be - added to sys.path (e.g. zip files). - -- Issue #25609: Introduce contextlib.AbstractContextManager and - typing.ContextManager. - -- Issue #26709: Fixed Y2038 problem in loading binary PLists. - -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our - own SIGWINCH handler. Patch by Eric Price. - -- Issue #25951: Change SSLSocket.sendall() to return None, as explicitly - documented for plain socket objects. Patch by Aviv Palivoda. - -- Issue #26586: In http.server, respond with "413 Request header fields too - large" if there are too many header fields to parse, rather than killing - the connection and raising an unhandled exception. Patch by Xiang Zhang. - -- Issue #26676: Added missing XMLPullParser to ElementTree.__all__. - -- Issue #22854: Change BufferedReader.writable() and - BufferedWriter.readable() to always return False. - -- Issue #26492: Exhausted iterator of array.array now conforms with the behavior - of iterators of other mutable sequences: it lefts exhausted even if iterated - array is extended. - -- Issue #26641: doctest.DocFileTest and doctest.testfile() now support - packages (module splitted into multiple directories) for the package - parameter. - -- Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of - tuple (changeset 3603bae63c13 only works for classes) so we need to - implement __ne__ ourselves. Patch by Andrew Plummer. - -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). - -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes - instead of up to 1024. - -- Issue #26616: Fixed a bug in datetime.astimezone() method. - -- Issue #26637: The :mod:`importlib` module now emits an :exc:`ImportError` - rather than a :exc:`TypeError` if :func:`__import__` is tried during the - Python shutdown process but :data:`sys.path` is already cleared (set to - ``None``). - -- Issue #21925: :func:`warnings.formatwarning` now catches exceptions when - calling :func:`linecache.getline` and - :func:`tracemalloc.get_object_traceback` to be able to log - :exc:`ResourceWarning` emitted late during the Python shutdown process. - -- Issue #23848: On Windows, faulthandler.enable() now also installs an - exception handler to dump the traceback of all Python threads on any Windows - exception, not only on UNIX signals (SIGSEGV, SIGFPE, SIGABRT). - -- Issue #26530: Add C functions :c:func:`_PyTraceMalloc_Track` and - :c:func:`_PyTraceMalloc_Untrack` to track memory blocks using the - :mod:`tracemalloc` module. Add :c:func:`_PyTraceMalloc_GetTraceback` to get - the traceback of an object. - -- Issue #26588: The _tracemalloc now supports tracing memory allocations of - multiple address spaces (domains). - -- Issue #24266: Ctrl+C during Readline history search now cancels the search - mode when compiled with Readline 7. - -- Issue #26590: Implement a safe finalizer for the _socket.socket type. It now - releases the GIL to close the socket. - -- Issue #18787: spwd.getspnam() now raises a PermissionError if the user - doesn't have privileges. - -- Issue #26560: Avoid potential ValueError in BaseHandler.start_response. - Initial patch by Peter Inglesby. - -- Issue #26567: Add a new function :c:func:`PyErr_ResourceWarning` function to - pass the destroyed object. Add a *source* attribute to - :class:`warnings.WarningMessage`. Add warnings._showwarnmsg() which uses - tracemalloc to get the traceback where source object was allocated. - -- [Security] Issue #26313: ssl.py _load_windows_store_certs fails if windows - cert store is empty. Patch by Baji. - -- Issue #26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` - to support importing packages. - -- Issue #26499: Account for remaining Content-Length in - HTTPResponse.readline() and read1(). Based on patch by Silent Ghost. - Also document that HTTPResponse now supports these methods. - -- Issue #25320: Handle sockets in directories unittest discovery is scanning. - Patch from Victor van den Elzen. - -- Issue #16181: cookiejar.http2time() now returns None if year is higher than - datetime.MAXYEAR. - -- Issue #26513: Fixes platform module detection of Windows Server - -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by - Tam?s Bence Gedai. - -- Issue #26323: Add Mock.assert_called() and Mock.assert_called_once() - methods to unittest.mock. Patch written by Amit Saha. - -- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise - NotImplementedError instead of ImportError. - -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. - -- Issue #15068: Got rid of excessive buffering in fileinput. - The bufsize parameter is now deprecated and ignored. - -- Issue #19475: Added an optional argument timespec to the datetime - isoformat() method to choose the precision of the time component. - -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu - Dupuy. - -- Issue #26167: Minimized overhead in copy.copy() and copy.deepcopy(). - Optimized copying and deepcopying bytearrays, NotImplemented, slices, - short lists, tuples, dicts, sets. - -- Issue #25718: Fixed pickling and copying the accumulate() iterator with - total is None. - -- Issue #26475: Fixed debugging output for regular expressions with the (?x) - flag. - -- Issue #26482: Allowed pickling recursive dequeues. - -- Issue #26335: Make mmap.write() return the number of bytes written like - other write methods. Patch by Jakub Stasiak. - -- Issue #26457: Fixed the subnets() methods in IP network classes for the case - when resulting prefix length is equal to maximal prefix length. - Based on patch by Xiang Zhang. - -- Issue #26385: Remove the file if the internal open() call in - NamedTemporaryFile() fails. Patch by Silent Ghost. - -- Issue #26402: Fix XML-RPC client to retry when the server shuts down a - persistent connection. This was a regression related to the new - http.client.RemoteDisconnected exception in 3.5.0a4. - -- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with - adobe=True. Patch by Swati Jaiswal. - -- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader. - -- Issue #26367: importlib.__import__() raises ImportError like - builtins.__import__() when ``level`` is specified but without an accompanying - package specified. - -- Issue #26309: In the "socketserver" module, shut down the request (closing - the connected socket) when verify_request() returns false. Patch by Aviv - Palivoda. - -- Issue #23430: Change the socketserver module to only catch exceptions - raised from a request handler that are derived from Exception (instead of - BaseException). Therefore SystemExit and KeyboardInterrupt no longer - trigger the handle_error() method, and will now to stop a single-threaded - server. - -- [Security] Issue #25939: On Windows open the cert store readonly in - ssl.enum_certificates. - -- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. - -- Issue #25994: Added the close() method and the support of the context manager - protocol for the os.scandir() iterator. - -- Issue #23992: multiprocessing: make MapResult not fail-fast upon exception. - -- Issue #26243: Support keyword arguments to zlib.compress(). Patch by Aviv - Palivoda. - -- Issue #26117: The os.scandir() iterator now closes file descriptor not only - when the iteration is finished, but when it was failed with error. - -- Issue #25949: __dict__ for an OrderedDict instance is now created only when - needed. - -- Issue #25911: Restored support of bytes paths in os.walk() on Windows. - -- Issue #26045: Add UTF-8 suggestion to error message when posting a - non-Latin-1 string with http.client. - -- Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir(). - Patch by Thomas Kluyver. - -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. - -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. - -- Issue #26202: copy.deepcopy() now correctly copies range() objects with - non-atomic attributes. - -- Issue #23076: Path.glob() now raises a ValueError if it's called with an - invalid pattern. Patch by Thomas Nyberg. - -- Issue #19883: Fixed possible integer overflows in zipimport. - -- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and - gethostbyname_ex() functions of the socket module now decode the hostname - from the ANSI code page rather than UTF-8. - -- Issue #26099: The site module now writes an error into stderr if - sitecustomize module can be imported but executing the module raise an - ImportError. Same change for usercustomize. - -- Issue #26147: xmlrpc now works with strings not encodable with used - non-UTF-8 encoding. - -- Issue #25935: Garbage collector now breaks reference loops with OrderedDict. - -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). - -- Issue #26013: Added compatibility with broken protocol 2 pickles created - in old Python 3 versions (3.4.3 and lower). - -- Issue #26129: Deprecated accepting non-integers in grp.getgrgid(). - -- Issue #25850: Use cross-compilation by default for 64-bit Windows. - -- Issue #25822: Add docstrings to the fields of urllib.parse results. - Patch contributed by Swati Jaiswal. - -- Issue #22642: Convert trace module option parsing mechanism to argparse. - Patch contributed by SilentGhost. - -- Issue #24705: Fix sysconfig._parse_makefile not expanding ${} vars - appearing before $() vars. - -- Issue #26069: Remove the deprecated apis in the trace module. - -- Issue #22138: Fix mock.patch behavior when patching descriptors. Restore - original values after patching. Patch contributed by Sean McCully. - -- Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode - option if it is safe to do so. - -- Issue #26012: Don't traverse into symlinks for ``**`` pattern in - pathlib.Path.[r]glob(). - -- Issue #24120: Ignore PermissionError when traversing a tree with - pathlib.Path.[r]glob(). Patch by Ulrich Petri. - -- Issue #21815: Accept ] characters in the data portion of imap responses, - in order to handle the flags with square brackets accepted and produced - by servers such as gmail. - -- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a - buffer attribute (restores backward compatibility). - -- Issue #25971: Optimized creating Fractions from floats by 2 times and from - Decimals by 3 times. - -- Issue #25802: Document as deprecated the remaining implementations of - importlib.abc.Loader.load_module(). - -- Issue #25928: Add Decimal.as_integer_ratio(). - -- Issue #25447: Copying the lru_cache() wrapper object now always works, - independently from the type of the wrapped object (by returning the original - object unchanged). - -- Issue #25768: Have the functions in compileall return booleans instead of - ints and add proper documentation and tests for the return values. - -- Issue #24103: Fixed possible use after free in ElementTree.XMLPullParser. - -- Issue #25860: os.fwalk() no longer skips remaining directories when error - occurs. Original patch by Samson Lee. - -- Issue #25914: Fixed and simplified OrderedDict.__sizeof__. - -- Issue #25869: Optimized deepcopying ElementTree; it is now 20 times faster. - -- Issue #25873: Optimized iterating ElementTree. Iterating elements - Element.iter() is now 40% faster, iterating text Element.itertext() - is now up to 2.5 times faster. - -- Issue #25902: Fixed various refcount issues in ElementTree iteration. - -- Issue #22227: The TarFile iterator is reimplemented using generator. - This implementation is simpler that using class. - -- Issue #25638: Optimized ElementTree.iterparse(); it is now 2x faster. - Optimized ElementTree parsing; it is now 10% faster. - -- Issue #25761: Improved detecting errors in broken pickle data. - -- Issue #25717: Restore the previous behaviour of tolerating most fstat() - errors when opening files. This was a regression in 3.5a1, and stopped - anonymous temporary files from working in special cases. - -- Issue #24903: Fix regression in number of arguments compileall accepts when - '-d' is specified. The check on the number of arguments has been dropped - completely as it never worked correctly anyway. - -- Issue #25764: In the subprocess module, preserve any exception caused by - fork() failure when preexec_fn is used. - -- Issue #25771: Tweak the exception message for importlib.util.resolve_name() - when 'package' isn't specified but necessary. - -- Issue #6478: _strptime's regexp cache now is reset after changing timezone - with time.tzset(). - -- Issue #14285: When executing a package with the "python -m package" option, - and package initialization fails, a proper traceback is now reported. The - "runpy" module now lets exceptions from package initialization pass back to - the caller, rather than raising ImportError. - -- Issue #19771: Also in runpy and the "-m" option, omit the irrelevant - message ". . . is a package and cannot be directly executed" if the package - could not even be initialized (e.g. due to a bad ``*.pyc`` file). - -- Issue #25177: Fixed problem with the mean of very small and very large - numbers. As a side effect, statistics.mean and statistics.variance should - be significantly faster. - -- Issue #25718: Fixed copying object with state with boolean value is false. - -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. - -- Issue #7990: dir() on ElementTree.Element now lists properties: "tag", - "text", "tail" and "attrib". Original patch by Santoso Wijaya. - -- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling - invalid data including tuple instructions. - -- Issue #25663: In the Readline completer, avoid listing duplicate global - names, and search the global namespace before searching builtins. - -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. - -- Issue #23914: Fixed SystemError raised by unpickler on broken pickle data. - -- Issue #25691: Fixed crash on deleting ElementTree.Element attributes. - -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory - entries. Patch by Dingyuan Wang. - -- Issue #25626: Change three zlib functions to accept sizes that fit in - Py_ssize_t, but internally cap those sizes to UINT_MAX. This resolves a - regression in 3.5 where GzipFile.read() failed to read chunks larger than 2 - or 4 GiB. The change affects the zlib.Decompress.decompress() max_length - parameter, the zlib.decompress() bufsize parameter, and the - zlib.Decompress.flush() length parameter. - -- Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- Issue #25593: Change semantics of EventLoop.stop() in asyncio. - -- Issue #6973: When we know a subprocess.Popen process has died, do - not allow the send_signal(), terminate(), or kill() methods to do - anything as they could potentially signal a different process. - -- Issue #23883: Added missing APIs to __all__ to match the documented APIs - for the following modules: calendar, csv, enum, fileinput, ftplib, logging, - optparse, tarfile, threading and wave. Also added a - test.support.check__all__() helper. Patches by Jacek Ko?odziej, Mauro - S. M. Rodrigues and Joel Taddei. - -- Issue #25590: In the Readline completer, only call getattr() once per - attribute. Also complete names of attributes such as properties and slots - which are listed by dir() but not yet created on an instance. - -- Issue #25498: Fix a crash when garbage-collecting ctypes objects created - by wrapping a memoryview. This was a regression made in 3.5a1. Based - on patch by Eryksun. - -- Issue #25584: Added "escape" to the __all__ list in the glob module. - -- Issue #25584: Fixed recursive glob() with patterns starting with ``**``. - -- Issue #25446: Fix regression in smtplib's AUTH LOGIN support. - -- Issue #18010: Fix the pydoc web server's module search function to handle - exceptions from importing packages. - -- Issue #25554: Got rid of circular references in regular expression parsing. - -- Issue #18973: Command-line interface of the calendar module now uses argparse - instead of optparse. - -- Issue #25510: fileinput.FileInput.readline() now returns b'' instead of '' - at the end if the FileInput was opened with binary mode. - Patch by Ryosuke Ito. - -- Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. - Original patch by John Mark Vandenberg. - -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. - -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. - -- Issue #25447: The lru_cache() wrapper objects now can be copied and pickled - (by returning the original object unchanged). - -- Issue #25390: typing: Don't crash on Union[str, Pattern]. - -- Issue #25441: asyncio: Raise error from drain() when socket is closed. - -- Issue #25410: Cleaned up and fixed minor bugs in C implementation of - OrderedDict. - -- Issue #25411: Improved Unicode support in SMTPHandler through better use of - the email package. Thanks to user simon04 for the patch. - -- Move the imp module from a PendingDeprecationWarning to DeprecationWarning. - -- Issue #25407: Remove mentions of the formatter module being removed in - Python 3.6. - -- Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() - that caused segmentation fault or hang in iterating after moving several - items to the start of ordered dict. - -- Issue #25382: pickletools.dis() now outputs implicit memo index for the - MEMOIZE opcode. - -- Issue #25357: Add an optional newline paramer to binascii.b2a_base64(). - base64.b64encode() uses it to avoid a memory copy. - -- Issue #24164: Objects that need calling ``__new__`` with keyword arguments, - can now be pickled using pickle protocols older than protocol version 4. - -- Issue #25364: zipfile now works in threads disabled builds. - -- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both - decode_data and enable_SMTPUTF8 are set to true. - -- Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate - extensions. Patch by Nikolay Bogoychev. - -- Issue #25316: distutils raises OSError instead of DistutilsPlatformError - when MSVC is not installed. - -- Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in - pickletools.opcodes. - -- Issue #23972: Updates asyncio datagram create method allowing reuseport - and reuseaddr socket options to be set prior to binding the socket. - Mirroring the existing asyncio create_server method the reuseaddr option - for datagram sockets defaults to True if the O/S is 'posix' (except if the - platform is Cygwin). Patch by Chris Laws. - -- Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you - submit a coroutine to a loop from another thread, returning a - concurrent.futures.Future. By Vincent Michel. - -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the - first question mark (?) rather than the last. Patch from Xiang Zhang. - -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. - -- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not - supported. Check if it is supported, it may not be supported on OpenBSD for - example. - -- Issue #23600: Default implementation of tzinfo.fromutc() was returning - wrong results in some cases. - -- Issue #25203: Failed readline.set_completer_delims() no longer left the - module in inconsistent state. - -- Issue #25011: rlcompleter now omits private and special attribute names unless - the prefix starts with underscores. - -- Issue #25209: rlcompleter now can add a space or a colon after completed - keyword. - -- Issue #22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'. - -- Issue #23517: fromtimestamp() and utcfromtimestamp() methods of - datetime.datetime now round microseconds to nearest with ties going to - nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding - towards -Infinity (ROUND_FLOOR). - -- Issue #23552: Timeit now warns when there is substantial (4x) variance - between best and worst times. Patch from Serhiy Storchaka. - -- Issue #24633: site-packages/README -> README.txt. - -- Issue #24879: help() and pydoc can now list named tuple fields in the - order they were defined rather than alphabetically. The ordering is - determined by the _fields attribute if present. - -- Issue #24874: Improve speed of itertools.cycle() and make its - pickle more compact. - -- Fix crash in itertools.cycle.__setstate__() when the first argument wasn't - a list. - -- Issue #20059: urllib.parse raises ValueError on all invalid ports. - Patch by Martin Panter. - -- Issue #24360: Improve __repr__ of argparse.Namespace() for invalid - identifiers. Patch by Matthias Bussonnier. - -- Issue #23426: run_setup was broken in distutils. - Patch from Alexander Belopolsky. - -- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. - -- Issue #2091: open() accepted a 'U' mode string containing '+', but 'U' can - only be used with 'r'. Patch from Jeff Balogh and John O'Connor. - -- Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence. - -- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. - Patch from Nicola Palumbo and Laurent De Buyst. - -- Issue #24426: Fast searching optimization in regular expressions now works - for patterns that starts with capturing groups. Fast searching optimization - now can't be disabled at compile time. - -- Issue #23661: unittest.mock side_effects can now be exceptions again. This - was a regression vs Python 3.4. Patch from Ignacio Rossi - -- Issue #13248: Remove deprecated inspect.getmoduleinfo function. - -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). - -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating - ssl.SSLContext. - -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). - -- Issue #25471: Sockets returned from accept() shouldn't appear to be - nonblocking. - -- Issue #25319: When threading.Event is reinitialized, the underlying condition - should use a regular lock rather than a recursive lock. - -- Skip getaddrinfo if host is already resolved. - Patch by A. Jesse Jiryu Davis. - -- Issue #26050: Add asyncio.StreamReader.readuntil() method. - Patch by ???? ?????????. - -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. - -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on - current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. - -- Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. - Patch by Jack O'Connor. - -- Issue #27040: Add loop.get_exception_handler method - -- Issue #27041: asyncio: Add loop.create_future method - -IDLE ----- - -- Issue #20640: Add tests for idlelib.configHelpSourceEdit. - Patch by Saimadhav Heblikar. - -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. - -- Issue #25507: fix incorrect change in IOBinding that prevented printing. - Augment IOBinding htest to include all major IOBinding functions. - -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. - -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. - -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the - debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. - -- Change 'The program' to 'Your program' in an IDLE 'kill program?' message - to make it clearer that the program referred to is the currently running - user program, not IDLE itself. - -- Issue #24750: Improve the appearance of the IDLE editor window status bar. - Patch by Mark Roseman. - -- Issue #25313: Change the handling of new built-in text color themes to better - address the compatibility problem introduced by the addition of IDLE Dark. - Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. - -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences - dialog rather than a separate dialog. The former tabs are now a sorted - list. Patch by Mark Roseman. - -- Issue #22726: Re-activate the config dialog help button with some content - about the other buttons and the new IDLE Dark theme. - -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. - -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. - 'IDLE' now means 'Integrated Development and Learning Environment'. - -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. - -- Issue #24972: Inactive selection background now matches active selection - background, as configured by users, on all systems. Found items are now - always highlighted on Windows. Initial patch by Mark Roseman. - -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. - -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. - -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. - -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. - -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. - -- Issue #25225: Condense and rewrite Idle doc section on text colors. - -- Issue #21995: Explain some differences between IDLE and console Python. - -- Issue #22820: Explain need for *print* when running file from Idle editor. - -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. - -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. - -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Rose Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - -Documentation -------------- - -- Issue #26736: Used HTTPS for external links in the documentation if possible. - -- Issue #6953: Rework the Readline module documentation to group related - functions together, and add more details such as what underlying Readline - functions and variables are accessed. - -- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. - -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "_thread" modules. Patch from Mattip. - -- Issue #26014: Update 3.x packaging documentation: - * "See also" links to the new docs are now provided in the legacy pages - * links to setuptools documentation have been updated - -Tests ------ - -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. - -- Issue #26295: When using "python3 -m test --testdir=TESTDIR", regrtest - doesn't add "test." prefix to test module names. - -- Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) - was untested. - -- Issue #26015: Added new tests for pickling iterators of mutable sequences. - -- Issue #26325: Added test.support.check_no_resource_warning() to check that - no ResourceWarning is emitted. - -- Issue #25940: Changed test_ssl to use its internal local server more. This - avoids relying on svn.python.org, which recently changed root certificate. - -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. - -- Issue #25449: Added tests for OrderedDict subclasses. - -- Issue #25188: Add -P/--pgo to test.regrtest to suppress error output when - running the test suite for the purposes of a PGO build. Initial patch by - Alecsandru Patrascu. - -- Issue #22806: Add ``python -m test --list-tests`` command to list tests. - -- Issue #18174: ``python -m test --huntrleaks ...`` now also checks for leak of - file descriptors. Patch written by Richard Oudkerk. - -- Issue #25260: Fix ``python -m test --coverage`` on Windows. Remove the - list of ignored directories. - -- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. - -- Issue #26583: Skip test_timestamp_overflow in test_import if bytecode - files cannot be written. - -Build ------ - -- Issue #21277: Don't try to link _ctypes with a ffi_convenience library. - -- Issue #26884: Fix linking extension modules for cross builds. - Patch by Xavier de Gaye. - -- Issue #26932: Fixed support of RTLD_* constants defined as enum values, - not via macros (in particular on Android). Patch by Chi Hsuan Yen. - -- Issue #22359: Disable the rules for running _freeze_importlib and pgen when - cross-compiling. The output of these programs is normally saved with the - source code anyway, and is still regenerated when doing a native build. - Patch by Xavier de Gaye. - -- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, - except on Mac OS X. Patch written by Chi Hsuan Yen. - -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. - -- Issue #26624: Adds validation of ucrtbase[d].dll version with warning - for old versions. - -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a - lower-level check for st_blocks in struct stat. - -- Issue #26079: Fixing the build output folder for tix-8.4.3.6. Patch by - Bjoern Thiel. - -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to - ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The - old ``PCbuild\build_pgo.bat`` script is removed. - -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. - -- Issue #25696: Fix installation of Python on UNIX with make -j9. - -- Issue #24986: It is now possible to build Python on Windows without errors - when external libraries are not available. - -- Issue #24421: Compile Modules/_math.c once, before building extensions. - Previously it could fail to compile properly if the math and cmath builds - were concurrent. - -- Issue #26465: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2g. - -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. - -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. - -- Issue #24324: Do not enable unreachable code warnings when using - gcc as the option does not work correctly in older versions of gcc - and has been silently removed as of gcc-4.5. - -Windows -------- - -- Issue #27053: Updates make_zip.py to correctly generate library ZIP file. - -- Issue #26268: Update the prepare_ssl.py script to handle OpenSSL releases - that don't include the contents of the include directory (that is, 1.0.2e - and later). - -- Issue #26071: bdist_wininst created binaries fail to start and find - 32bit Python - -- Issue #26073: Update the list of magic numbers in launcher - -- Issue #26065: Excludes venv from library when generating embeddable - distro. - -- Issue #25022: Removed very outdated PC/example_nt/ directory. - -Tools/Demos ------------ - -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas - Ilsche. - -- Issue #26271: Fix the Freeze tool to properly use flags passed through - configure. Patch by Daniel Shaulov. - -- Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py. - Patch by Guo Ci Teo. - -- Issue #26316: Fix variable name typo in Argument Clinic. - -- Issue #25440: Fix output of python-config --extension-suffix. - -- Issue #25154: The pyvenv script has been deprecated in favour of - `python3 -m venv`. - -C API ------ - -- Issue #26312: SystemError is now raised in all programming bugs with using - PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some - programming bugs. - -- Issue #26198: ValueError is now raised instead of TypeError on buffer - overflow in parsing "es#" and "et#" format units. SystemError is now raised - instead of TypeError on programmical error in parsing format string. - - -What's New in Python 3.5.3? -=========================== - -Release date: 2017-01-17 - -There were no code changes between 3.5.3rc1 and 3.5.3 final. - - -What's New in Python 3.5.3 release candidate 1? -=============================================== - -Release date: 2017-01-02 - -Core and Builtins ------------------ - -- Issue #29073: bytearray formatting no longer truncates on first null byte. - -- Issue #28932: Do not include if it does not exist. - -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. - -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. - -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate - form. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy - bug caused by a monkey-patched len() function. - -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X - when decode astral characters. Patch by Xiang Zhang. - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug - build. - -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception - loss in PyTraceBack_Here(). - -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). - Patch by Xiang Zhang. - -- Issue #28376: The type of long range iterator is now registered as Iterator. - Patch by Oren Milman. - -- Issue #28376: The constructor of range_iterator now checks that step is not 0. - Patch by Oren Milman. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #26617: Fix crash when GC runs during weakref callbacks. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #21578: Fixed misleading error message when ImportError called with - invalid keyword args. - -- Issue #28203: Fix incorrect type in error message from - ``complex(1.0, {2:3})``. Patch by Soumya Sharma. - -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() - syscall fails with EPERM, for example when blocked by SECCOMP. - -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport - should use the same optimization level as the interpreter. - -- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when - Python is compiled with NSMALLPOSINTS = 0. - -- Issue #25758: Prevents zipimport from unnecessarily encoding a filename - (patch by Eryk Sun) - -- Issue #28189: dictitems_contains no longer swallows compare errors. - (Patch by Xiang Zhang) - -- Issue #27812: Properly clear out a generator's frame's backreference to the - generator to prevent crashes in frame.clear(). - -- Issue #27811: Fix a crash when a coroutine that has not been awaited is - finalized with warnings-as-errors enabled. - -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check - after use of 'def' in _PyState_AddModule(). - Initial patch by Christian Heimes. - -- Issue #26020: set literal evaluation order did not match documented behaviour. - -- Issue #27782: Multi-phase extension module import now correctly allows the - ``m_methods`` field to be used to add module level functions to instances - of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang. - -- Issue #27936: The round() function accepted a second None argument - for some types but not for others. Fixed the inconsistency by - accepting None for all numeric types. - -- Issue #27487: Warn if a submodule argument to "python -m" or - runpy.run_module() is found in sys.modules after parent packages are - imported, but before the submodule is executed. - -- Issue #27558: Fix a SystemError in the implementation of "raise" statement. - In a brand new thread, raise a RuntimeError since there is no active - exception to reraise. Patch written by Xiang Zhang. - -- Issue #27419: Standard __import__() no longer look up "__import__" in globals - or builtins for importing submodules or "from import". Fixed handling an - error of non-string package name. - -- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows. - -- Issue #27514: Make having too many statically nested blocks a SyntaxError - instead of SystemError. - -- Issue #27473: Fixed possible integer overflow in bytes and bytearray - concatenations. Patch by Xiang Zhang. - -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by - Xiang Zhang. - -- Issue #27581: Don't rely on wrapping for overflow check in - PySequence_Tuple(). Patch by Xiang Zhang. - -- Issue #27443: __length_hint__() of bytearray iterators no longer return a - negative integer for a resized bytearray. - -- Issue #27942: Fix memory leak in codeobject.c - -Library -------- - -- Issue #15812: inspect.getframeinfo() now correctly shows the first line of - a context. Patch by Sam Breese. - -- Issue #29094: Offsets in a ZIP file created with extern file object and modes - "w" and "x" now are relative to the start of the file. - -- Issue #13051: Fixed recursion errors in large or resized - curses.textpad.Textbox. Based on patch by Tycho Andersen. - -- Issue #29119: Fix weakrefs in the pure python version of - collections.OrderedDict move_to_end() method. - Contributed by Andra Bogildea. - -- Issue #9770: curses.ascii predicates now work correctly with negative - integers. - -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. - -- Issue #28923: Remove editor artifacts from Tix.py. - -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that - doesn't own its elements as limits. - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #28732: Fix crash in os.spawnv() with no elements in args - -- Issue #28485: Always raise ValueError for negative - compileall.compile_dir(workers=...) parameter, even when multithreading is - unavailable. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if - given empty data twice. Patch by Benjamin Fogle. - -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived - browsers. Based on patch by Oleg Broytman. - -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused - by representing the scale as float value internally in Tk. tkinter.IntVar - now works if float value is set to underlying Tk variable. - -- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. - -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. - Based on patch by Kaarle Ritvanen. - -- Issue #28353: os.fwalk() no longer fails on broken links. - -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer add entry "./" to ZIP archive. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. - -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - handlers. - -- Issue #26293: Fixed writing ZIP files that starts not from the start of the - file. Offsets in ZIP file now are relative to the start of the archive in - conforming to the specification. - -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. - -- Issue #28322: Fixed possible crashes when unpickle itertools objects from - incorrect pickle data. Based on patch by John Leitch. - -- Fix possible integer overflows and crashes in the mmap module with unusual - usage patterns. - -- Issue #1703178: Fix the ability to pass the --link-objects option to the - distutils build_ext command. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Patch by Xiang Zhang. - -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. - Patch by Madison May. - -- Issue #27611: Fixed support of default root window in the tkinter.tix module. - -- Issue #27348: In the traceback module, restore the formatting of exception - messages like "Exception: None". This fixes a regression introduced in - 3.5a2. - -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Fix UnboundLocalError in socket._sendfile_use_sendfile. - -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of - os.stat(). Patch by Eryk Sun. - -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. - -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. - -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #19003:m email.generator now replaces only ``\r`` and/or ``\n`` line - endings, per the RFC, instead of all unicode line endings. - -- Issue #28019: itertools.count() no longer rounds non-integer step in range - between 1.0 and 2.0 to 1. - -- Issue #25969: Update the lib2to3 grammar to handle the unpacking - generalizations added in 3.5. - -- Issue #14977: mailcap now respects the order of the lines in the mailcap - files ("first match"), as required by RFC 1542. Patch by Michael Lazar. - -- Issue #24594: Validates persist parameter when opening MSI database - -- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes - (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.) - -- Issue #28047: Fixed calculation of line length used for the base64 CTE - in the new email policies. - -- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). - Patch by Claude Paroz. - -- Issue #22450: urllib now includes an ``Accept: */*`` header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. - -- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file - between runs given the same Grammar.txt input regardless of the hash - randomization setting. - -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. - -- Issue #22233: Break email header lines *only* on the RFC specified CR and LF - characters, not on arbitrary unicode line breaks. This also fixes a bug in - HTTP header parsing. - -- Issue #27988: Fix email iter_attachments incorrect mutation of payload list. - -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name - fields in X.509 certs. - -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter - measure sweet32 attack (CVE-2016-2183). - -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. - (Required OpenSSL 1.1.0 or LibreSSL). - -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. - -- Remove support for passing a file descriptor to os.access. It never worked but - previously didn't raise. - -- Issue #12885: Fix error when distutils encounters symlink. - -- Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. - Based on patch by Xiang Zhang. - -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory - creates not a cursor. Patch by Xiang Zhang. - -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. - -- Issue #27706: Restore deterministic behavior of random.Random().seed() - for string seeds using seeding version 1. Allows sequences of calls - to random() to exactly match those obtained in Python 2. - Patch by Nofar Schnider. - -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. - -- A new version of typing.py from https://github.com/python/typing: - - Collection (only for 3.6) (Issue #27598) - - Add FrozenSet to __all__ (upstream #261) - - fix crash in _get_type_vars() (upstream #259) - - Remove the dict constraint in ForwardRef._eval_type (upstream #252) - -- Issue #27539: Fix unnormalised ``Fraction.__pow__`` result in the case - of negative exponent and negative base. - -- Issue #21718: cursor.description is now available for queries using CTEs. - -- Issue #2466: posixpath.ismount now correctly recognizes mount points which - the user does not have permission to access. - -- Issue #27773: Correct some memory management errors server_hostname in - _ssl.wrap_socket(). - -- Issue #26750: unittest.mock.create_autospec() now works properly for - subclasses of property() and other data descriptors. - -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. - -- Issue #27783: Fix possible usage of uninitialized memory in - operator.methodcaller. - -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. - -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - -- Issue #27758: Fix possible integer overflow in the _csv module for large - record lengths. - -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. - -- Issue #27656: Do not assume sched.h defines any SCHED_* constants. - -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 4 GiB) when compressing and decompressing. Previously, inputs - were limited to 4 GiB, and compression and decompression operations did not - properly handle results of 4 GiB. - -- Issue #27533: Release GIL in nt._isdir - -- Issue #17711: Fixed unpickling by the persistent ID with protocol 0. - Original patch by Alexandre Vassalotti. - -- Issue #27522: Avoid an unintentional reference cycle in email.feedparser. - -- Issue #26844: Fix error message for imp.find_module() to refer to 'path' - instead of 'name'. Patch by Lev Maximov. - -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. - -- Issue #27466: Change time format returned by http.cookie.time2netscape, - confirming the netscape cookie format and making it consistent with - documentation. - -- Issue #26664: Fix activate.fish by removing mis-use of ``$``. - -- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong - mode no longer break tracing, trace_vinfo() now always returns a list of - pairs of strings, tracing in the "u" mode now works. - -- Fix a scoping issue in importlib.util.LazyLoader which triggered an - UnboundLocalError when lazy-loading a module that was already put into - sys.modules. - -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - -- Issue #26754: Some functions (compile() etc) accepted a filename argument - encoded as an iterable of integers. Now only strings and byte-like objects - are accepted. - -- Issue #27048: Prevents distutils failing on Windows when environment - variables contain non-ASCII characters - -- Issue #27330: Fixed possible leaks in the ctypes module. - -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch - by Jelle Zijlstra. - -- Issue #27122: When an exception is raised within the context being managed - by a contextlib.ExitStack() and one of the exit stack generators - catches and raises it in a chain, do not re-raise the original exception - when exiting, let the new chained one through. This avoids the PEP 479 - bug described in issue25782. - -- [Security] Issue #27278: Fix os.urandom() implementation using getrandom() on - Linux. Truncate size to INT_MAX and loop until we collected enough random - bytes, instead of casting a directly Py_ssize_t to int. - -- Issue #26386: Fixed ttk.TreeView selection operations with item id's - containing spaces. - -- [Security] Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). - -- Issue #16182: Fix various functions in the "readline" module to use the - locale encoding, and fix get_begidx() and get_endidx() to return code point - indexes. - -- Issue #27392: Add loop.connect_accepted_socket(). - Patch by Jim Fulton. - -- Issue #27930: Improved behaviour of logging.handlers.QueueListener. - Thanks to Paulo Andrade and Petr Viktorin for the analysis and patch. - -- Issue #21201: Improves readability of multiprocessing error message. Thanks - to Wojciech Walczak for patch. - -- Issue #27456: asyncio: Set TCP_NODELAY by default. - -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. - -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. - -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. - -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. - -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. - -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. - Patch by Mark Williams. - -- Issue #28368: Refuse monitoring processes if the child watcher has - no loop attached. - Patch by Vincent Michel. - -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. - -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by ????????? ????. - -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. - -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. - -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by ????????? ????. - -- Issue #27972: Prohibit Tasks to await on themselves. - -- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all - children are done. - Patch by Johannes Ebke. - -- Issue #26796: Don't configure the number of workers for default - threadpool executor. - Initial patch by Hans Lawrenz. - -- Issue #28600: Optimize loop.call_soon(). - -- Issue #28613: Fix get_event_loop() return the current loop if - called from coroutines/callbacks. - -- Issue #28639: Fix inspect.isawaitable to always return bool - Patch by Justin Mayfield. - -- Issue #28652: Make loop methods reject socket kinds they do not support. - -- Issue #28653: Fix a refleak in functools.lru_cache. - -- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. - -- Issue #24142: Reading a corrupt config file left the parser in an - invalid state. Original patch by Florian H?ch. - -- Issue #28990: Fix SSL hanging if connection is closed before handshake - completed. - (Patch by HoHo-Ho) - -IDLE ----- - -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. - -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - -- Add version to title of IDLE help window. - -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. - -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. - -- Issue #25507: IDLE no longer runs buggy code because of its tkinter imports. - Users must include the same imports required to run directly in Python. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. - -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. - Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. - -C API ------ - -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - -- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as - an iterable of integers. Now only strings and bytes-like objects are accepted. - -Documentation -------------- - -- Issue #28513: Documented command-line interface of zipfile. - -Tests ------ - -- Issue #28950: Disallow -j0 to be combined with -T/-l/-M in regrtest - command line arguments. - -- Issue #28666: Now test.support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -- Issue #28409: regrtest: fix the parser of command line arguments. - -- Issue #27787: Call gc.collect() before checking each test for "dangling - threads", since the dangling threads are weak references. - -- Issue #27369: In test_pyexpat, avoid testing an error message detail that - changed in Expat 2.2.0. - -Tools/Demos ------------ - -- Issue #27952: Get Tools/scripts/fixcid.py working with Python 3 and the - current "re" module, avoid invalid Python backslash escapes, and fix a bug - parsing escaped C quote signs. - -- Issue #27332: Fixed the type of the first argument of module-level functions - generated by Argument Clinic. Patch by Petr Viktorin. - -- Issue #27418: Fixed Tools/importbench/importbench.py. - -Windows -------- - -- Issue #28251: Improvements to help manuals on Windows. - -- Issue #28110: launcher.msi has different product codes between 32-bit and - 64-bit - -- Issue #25144: Ensures TargetDir is set before continuing with custom - install. - -- Issue #27469: Adds a shell extension to the launcher so that drag and drop - works correctly. - -- Issue #27309: Enabled proper Windows styles in python[w].exe manifest. - -Build ------ - -- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - -- Issue #23903: Added missed names to PC/python3.def. - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28444: Fix missing extensions modules when cross compiling. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -- Issue #28258: Fixed build with Estonian locale (python-config and distclean - targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #28066: Fix the logic that searches build directories for generated - include files when building outside the source tree. - -- Issue #15819: Remove redundant include search directory option for building - outside the source tree. - -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) - -- Issue #27705: Update message in validate_ucrtbase.py - -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. - -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. - -- Issue #26359: Add the --with-optimizations configure flag. - -- Issue #27713: Suppress spurious build warnings when updating importlib's - bootstrap files. Patch by Xiang Zhang - -- Issue #25825: Correct the references to Modules/python.exp and ld_so_aix, - which are required on AIX. This updates references to an installation path - that was changed in 3.2a4, and undoes changed references to the build tree - that were made in 3.5.0a1. - -- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Chi Hsuan Yen. - -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen and _freeze_importlib executables from being cross- - compiled. - -- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be - used for file generation during the build. - -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Patch by Gareth Rees. - - -What's New in Python 3.5.2? -=========================== - -Release date: 2016-06-26 - -Core and Builtins ------------------ - -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. - -Tests ------ - -- Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. - -IDLE ----- - -- Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. - - -What's New in Python 3.5.2 release candidate 1? -=============================================== - -Release date: 2016-06-12 - -Core and Builtins ------------------ - -- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a - negative number without setting an exception. - -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. - -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" - format unit. - -- Issue #26991: Fix possible refleak when creating a function with annotations. - -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by - Joe Jevnik. - -- Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. - -- Issue #26811: gc.get_objects() no longer contains a broken tuple with NULL - pointer. - -- Issue #20120: Use RawConfigParser for .pypirc parsing, - removing support for interpolation unintentionally added - with move to Python 3. Behavior no longer does any - interpolation in .pypirc files, matching behavior in Python - 2.7 and Setuptools 19.0. - -- Issue #26659: Make the builtin slice type support cycle collection. - -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. - NOTE: A direct call of super.__init__ is not endorsed! - -- Issue #25339: PYTHONIOENCODING now has priority over locale in setting the - error handler for stdin and stdout. - -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of str, bytes, - bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding - views and os.scandir() iterator. - -- Issue #26581: If coding cookie is specified multiple times on a line in - Python source code file, only the first one is taken to account. - -- Issue #26464: Fix str.translate() when string is ASCII and first replacements - removes character, but next replacement uses a non-ASCII character or a - string longer than 1 character. Regression introduced in Python 3.5.0. - -- Issue #22836: Ensure exception reports from PyErr_Display() and - PyErr_WriteUnraisable() are sensible even when formatting them produces - secondary errors. This affects the reports produced by - sys.__excepthook__() and when __del__() raises an exception. - -- Issue #26302: Correct behavior to reject comma as a legal character for - cookie names. - -- Issue #4806: Avoid masking the original TypeError exception when using star - (``*``) unpacking in function calls. Based on patch by Hagen F?rstenau and - Daniel Urban. - -- Issue #27138: Fix the doc comment for FileFinder.find_spec(). - -- Issue #26154: Add a new private _PyThreadState_UncheckedGet() function to get - the current Python thread state, but don't issue a fatal error if it is NULL. - This new function must be used instead of accessing directly the - _PyThreadState_Current variable. The variable is no more exposed since - Python 3.5.1 to hide the exact implementation of atomic C types, to avoid - compiler issues. - -- Issue #26194: Deque.insert() gave odd results for bounded deques that had - reached their maximum size. Now an IndexError will be raised when attempting - to insert into a full deque. - -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` - are equal. - -- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in - _PyObject_GetState() due to regressions observed in Cython-based projects. - -- Issue #25961: Disallowed null characters in the type name. - -- Issue #25973: Fix segfault when an invalid nonlocal statement binds a name - starting with two underscores. - -- Issue #22995: Instances of extension types with a state that aren't - subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. - -- Issue #20440: Massive replacing unsafe attribute setting code with special - macro Py_SETREF. - -- Issue #25766: Special method __bytes__() now works in str subclasses. - -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. - This allows sys.getsize() to work correctly with their subclasses with - __slots__ defined. - -- Issue #25709: Fixed problem with in-place string concatenation and utf-8 - cache. - -- Issue #27147: Mention PEP 420 in the importlib docs. - -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside - __getattr__. - -- Issue #24731: Fixed crash on converting objects with special methods - __bytes__, __trunc__, and __float__ returning instances of subclasses of - bytes, int, and float to subclasses of bytes, int, and float correspondingly. - -- Issue #26478: Fix semantic bugs when using binary operators with dictionary - views and tuples. - -- Issue #26171: Fix possible integer overflow and heap corruption in - zipimporter.get_data(). - -- Issue #25660: Fix TAB key behaviour in REPL with readline. - -- Issue #25887: Raise a RuntimeError when a coroutine object is awaited - more than once. - -- Issue #27243: Update the __aiter__ protocol: instead of returning - an awaitable that resolves to an asynchronous iterator, the asynchronous - iterator should be returned directly. Doing the former will trigger a - PendingDeprecationWarning. - - -Library -------- - -- [Security] Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - -- [Security] Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. - Reported by Team Oststrom - -- Issue #21386: Implement missing IPv4Address.is_global property. It was - documented since 07a5610bae9d. Initial patch by Roger Luethi. - -- Issue #20900: distutils register command now decodes HTTP responses - correctly. Initial patch by ingrid. - -- A new version of typing.py provides several new classes and - features: @overload outside stubs, Reversible, DefaultDict, Text, - ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug - fixes (note that some of the new features are not yet implemented in - mypy or other static analyzers). Also classes for PEP 492 - (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact - they made it into 3.5.1 but were never mentioned). - -- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from - sending a message body for 205 Reset Content. Also, don't send Content - header fields in responses that don't have a body. Patch by Susumu - Koshiba. - -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. - -- [Security] Issue #26839: On Linux, :func:`os.urandom` now calls - ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading - ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch - written by Colm Buckley. - -- Issue #27164: In the zlib module, allow decompressing raw Deflate streams - with a predefined zdict. Based on patch by Xiang Zhang. - -- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely - write data to the client. Previously it could do partial writes and - truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout - doing partial writes, but this is deprecated. - -- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - -- Issue #26373: subprocess.Popen.communicate now correctly ignores - BrokenPipeError when the child process dies before .communicate() - is called in more/all circumstances. - -- Issue #21776: distutils.upload now correctly handles HTTPError. - Initial patch by Claudiu Popa. - -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with - PermissionError - -- Issue #18383: Avoid creating duplicate filters when using filterwarnings - and simplefilter. Based on patch by Alex Shkop. - -- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by - SELinux and fails with EACCESS. The function now falls back to fcntl(). - Patch written by Micha? Bednarski. - -- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! - -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Original fix by J?n Janech. - -- Issue #17214: The "urllib.request" module now percent-encodes non-ASCII - bytes found in redirect target URLs. Some servers send Location header - fields with non-ASCII bytes, but "http.client" requires the request target - to be ASCII-encodable, otherwise a UnicodeEncodeError is raised. Based on - patch by Christian Heimes. - -- Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch - contributed by Chi Hsuan Yen. - -- Issue #22274: In the subprocess module, allow stderr to be redirected to - stdout even when stdout is not redirected. Patch by Akira Li. - -- Issue #26807: mock_open 'files' no longer error on readline at end of file. - Patch from Yolanda Robla. - -- Issue #25745: Fixed leaking a userptr in curses panel destructor. - -- Issue #26977: Removed unnecessary, and ignored, call to sum of squares helper - in statistics.pvariance. - -- Issue #26881: The modulefinder module now supports extended opcode arguments. - -- Issue #23815: Fixed crashes related to directly created instances of types in - _tkinter and curses.panel modules. - -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. - Patch by Georg Brandl. - -- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags - instead of silently return incorrect result. - -- Issue #26711: Fixed the comparison of plistlib.Data with other types. - -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. - -- Issue #26864: In urllib.request, change the proxy bypass host checking - against no_proxy to be case-insensitive, and to not match unrelated host - names that happen to have a bypassed hostname as a suffix. Patch by Xiang - Zhang. - -- Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by - Xiang Zhang. - -- Issue #26804: urllib.request will prefer lower_case proxy environment - variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter - Jansen. - -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items (like bytes in the -b mode). This affects assertListEqual() - and assertTupleEqual(). - -- Issue #26041: Remove "will be removed in Python 3.7" from deprecation - messages of platform.dist() and platform.linux_distribution(). - Patch by Kumaripaba Miyurusara Athukorala. - -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer - silently ignore keyword arguments. - -- Issue #26733: Disassembling a class now disassembles class and static methods. - Patch by Xiang Zhang. - -- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch - :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel - Barry. - -- Issue #24838: tarfile's ustar and gnu formats now correctly calculate name - and link field limits for multibyte character encodings like utf-8. - -- [Security] Issue #26657: Fix directory traversal vulnerability with - http.server on Windows. This fixes a regression that was introduced in - 3.3.4rc1 and 3.4.0rc1. Based on patch by Philipp Hagemeister. - -- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by - Anthony Sottile. - -- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading - more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of - 1024 bytes per call. - -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. - -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. - -- Issue #26709: Fixed Y2038 problem in loading binary PLists. - -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our - own SIGWINCH handler. Patch by Eric Price. - -- Issue #26586: In http.server, respond with "413 Request header fields too - large" if there are too many header fields to parse, rather than killing - the connection and raising an unhandled exception. Patch by Xiang Zhang. - -- Issue #22854: Change BufferedReader.writable() and - BufferedWriter.readable() to always return False. - -- Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of - tuple (changeset 3603bae63c13 only works for classes) so we need to - implement __ne__ ourselves. Patch by Andrew Plummer. - -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). - -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes - instead of up to 1024. - -- Issue #26616: Fixed a bug in datetime.astimezone() method. - -- Issue #21925: :func:`warnings.formatwarning` now catches exceptions on - ``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` emitted - late during the Python shutdown process. - -- Issue #24266: Ctrl+C during Readline history search now cancels the search - mode when compiled with Readline 7. - -- Issue #26560: Avoid potential ValueError in BaseHandler.start_response. - Initial patch by Peter Inglesby. - -- [Security] Issue #26313: ssl.py _load_windows_store_certs fails if windows - cert store is empty. Patch by Baji. - -- Issue #26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` - to support importing packages. - -- Issue #26499: Account for remaining Content-Length in - HTTPResponse.readline() and read1(). Based on patch by Silent Ghost. - Also document that HTTPResponse now supports these methods. - -- Issue #25320: Handle sockets in directories unittest discovery is scanning. - Patch from Victor van den Elzen. - -- Issue #16181: cookiejar.http2time() now returns None if year is higher than - datetime.MAXYEAR. - -- Issue #26513: Fixes platform module detection of Windows Server - -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by - Tam?s Bence Gedai. - -- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise - NotImplementedError instead of ImportError. - -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. - -- Issue #15068: Got rid of excessive buffering in the fileinput module. - The bufsize parameter is no longer used. - -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu - Dupuy. - -- Issue #25718: Fixed pickling and copying the accumulate() iterator with - total is None. - -- Issue #26475: Fixed debugging output for regular expressions with the (?x) - flag. - -- Issue #26457: Fixed the subnets() methods in IP network classes for the case - when resulting prefix length is equal to maximal prefix length. - Based on patch by Xiang Zhang. - -- Issue #26385: Remove the file if the internal open() call in - NamedTemporaryFile() fails. Patch by Silent Ghost. - -- Issue #26402: Fix XML-RPC client to retry when the server shuts down a - persistent connection. This was a regression related to the new - http.client.RemoteDisconnected exception in 3.5.0a4. - -- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with - adobe=True. Patch by Swati Jaiswal. - -- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader. - -- Issue #26367: importlib.__import__() raises SystemError like - builtins.__import__() when ``level`` is specified but without an accompanying - package specified. - -- Issue #26309: In the "socketserver" module, shut down the request (closing - the connected socket) when verify_request() returns false. Patch by Aviv - Palivoda. - -- [Security] Issue #25939: On Windows open the cert store readonly in - ssl.enum_certificates. - -- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. - -- Issue #26117: The os.scandir() iterator now closes file descriptor not only - when the iteration is finished, but when it was failed with error. - -- Issue #25911: Restored support of bytes paths in os.walk() on Windows. - -- Issue #26045: Add UTF-8 suggestion to error message when posting a - non-Latin-1 string with http.client. - -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. - -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. - -- Issue #26202: copy.deepcopy() now correctly copies range() objects with - non-atomic attributes. - -- Issue #23076: Path.glob() now raises a ValueError if it's called with an - invalid pattern. Patch by Thomas Nyberg. - -- Issue #19883: Fixed possible integer overflows in zipimport. - -- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and - gethostbyname_ex() functions of the socket module now decode the hostname - from the ANSI code page rather than UTF-8. - -- Issue #26147: xmlrpc now works with strings not encodable with used - non-UTF-8 encoding. - -- Issue #25935: Garbage collector now breaks reference loops with OrderedDict. - -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). - -- Issue #26013: Added compatibility with broken protocol 2 pickles created - in old Python 3 versions (3.4.3 and lower). - -- Issue #25850: Use cross-compilation by default for 64-bit Windows. - -- Issue #17633: Improve zipimport's support for namespace packages. - -- Issue #24705: Fix sysconfig._parse_makefile not expanding ${} vars - appearing before $() vars. - -- Issue #22138: Fix mock.patch behavior when patching descriptors. Restore - original values after patching. Patch contributed by Sean McCully. - -- Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode - option if it is safe to do so. - -- Issue #26012: Don't traverse into symlinks for ``**`` pattern in - pathlib.Path.[r]glob(). - -- Issue #24120: Ignore PermissionError when traversing a tree with - pathlib.Path.[r]glob(). Patch by Ulrich Petri. - -- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a - buffer attribute (restores backward compatibility). - -- Issue #25447: Copying the lru_cache() wrapper object now always works, - independedly from the type of the wrapped object (by returning the original - object unchanged). - -- Issue #24103: Fixed possible use after free in ElementTree.XMLPullParser. - -- Issue #25860: os.fwalk() no longer skips remaining directories when error - occurs. Original patch by Samson Lee. - -- Issue #25914: Fixed and simplified OrderedDict.__sizeof__. - -- Issue #25902: Fixed various refcount issues in ElementTree iteration. - -- Issue #25717: Restore the previous behaviour of tolerating most fstat() - errors when opening files. This was a regression in 3.5a1, and stopped - anonymous temporary files from working in special cases. - -- Issue #24903: Fix regression in number of arguments compileall accepts when - '-d' is specified. The check on the number of arguments has been dropped - completely as it never worked correctly anyway. - -- Issue #25764: In the subprocess module, preserve any exception caused by - fork() failure when preexec_fn is used. - -- Issue #6478: _strptime's regexp cache now is reset after changing timezone - with time.tzset(). - -- Issue #14285: When executing a package with the "python -m package" option, - and package initialization fails, a proper traceback is now reported. The - "runpy" module now lets exceptions from package initialization pass back to - the caller, rather than raising ImportError. - -- Issue #19771: Also in runpy and the "-m" option, omit the irrelevant - message ". . . is a package and cannot be directly executed" if the package - could not even be initialized (e.g. due to a bad ``*.pyc`` file). - -- Issue #25177: Fixed problem with the mean of very small and very large - numbers. As a side effect, statistics.mean and statistics.variance should - be significantly faster. - -- Issue #25718: Fixed copying object with state with boolean value is false. - -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. - -- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling - invalid data including tuple instructions. - -- Issue #25663: In the Readline completer, avoid listing duplicate global - names, and search the global namespace before searching builtins. - -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. - -- Issue #23914: Fixed SystemError raised by unpickler on broken pickle data. - -- Issue #25691: Fixed crash on deleting ElementTree.Element attributes. - -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory - entries. Patch by Dingyuan Wang. - -- Skip getaddrinfo if host is already resolved. - Patch by A. Jesse Jiryu Davis. - -- Issue #26050: Add asyncio.StreamReader.readuntil() method. - Patch by ???? ?????????. - -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. - -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on - current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. - -- Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. - Patch by Jack O'Connor. - -- Issue #27040: Add loop.get_exception_handler method - -- Issue #27041: asyncio: Add loop.create_future method - -- Issue #27223: asyncio: Fix _read_ready and _write_ready to respect - _conn_lost. - Patch by ?ukasz Langa. - -- Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait. - Patch by David Coles. - -IDLE ----- - -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. - -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. - -- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. - These persisted after other warnings were suppressed in #20567. - Apply Serhiy Storchaka's update_idletasks solution to four test files. - Record this additional advice in idle_test/README.txt - -- Issue #20567: Revise idle_test/README.txt with advice about avoiding - tk warning messages from tests. Apply advice to several IDLE tests. - -- Issue #27117: Make colorizer htest and turtledemo work with dark themes. - Move code for configuring text widget colors to a new function. - -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. - -- Issue #21939: Add test for IDLE's percolator. - Original patch by Saimadhav Heblikar. - -- Issue #21676: Add test for IDLE's replace dialog. - Original patch by Saimadhav Heblikar. - -- Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. - -- Issue #21703: Add test for IDLE's undo delegator. - Original patch by Saimadhav Heblikar . - -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. - -- Issue #23977: Add more asserts to test_delegator. - -- Issue #20640: Add tests for idlelib.configHelpSourceEdit. - Patch by Saimadhav Heblikar. - -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. - -- Issue #25507: fix incorrect change in IOBinding that prevented printing. - Augment IOBinding htest to include all major IOBinding functions. - -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. - -Documentation -------------- - -- Issue #19489: Moved the search box from the sidebar to the header and footer - of each page. Patch by Ammar Askar. - -- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - -- Issue #26736: Used HTTPS for external links in the documentation if possible. - -- Issue #6953: Rework the Readline module documentation to group related - functions together, and add more details such as what underlying Readline - functions and variables are accessed. - -- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. - -- Issue #25500: Fix documentation to not claim that __import__ is searched for - in the global scope. - -- Issue #26014: Update 3.x packaging documentation: - * "See also" links to the new docs are now provided in the legacy pages - * links to setuptools documentation have been updated - -Tests ------ - -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. - -- Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) - was untested. - -- Issue #26015: Added new tests for pickling iterators of mutable sequences. - -- Issue #26325: Added test.support.check_no_resource_warning() to check that - no ResourceWarning is emitted. - -- Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This - avoids relying on svn.python.org, which recently changed root certificate. - -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. - -- Issue #26583: Skip test_timestamp_overflow in test_import if bytecode - files cannot be written. - -Build ------ - -- Issue #26884: Fix linking extension modules for cross builds. - Patch by Xavier de Gaye. - -- Issue #22359: Disable the rules for running _freeze_importlib and pgen when - cross-compiling. The output of these programs is normally saved with the - source code anyway, and is still regenerated when doing a native build. - Patch by Xavier de Gaye. - -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. - -- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, - except on Mac OS X. Patch written by Xavier de Gaye. - -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. - -- Issue #26624: Adds validation of ucrtbase[d].dll version with warning - for old versions. - -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a - lower-level check for st_blocks in struct stat. - -- Issue #26079: Fixing the build output folder for tix-8.4.3.6. Patch by - Bjoern Thiel. - -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - -- Issue #24421: Compile Modules/_math.c once, before building extensions. - Previously it could fail to compile properly if the math and cmath builds - were concurrent. - -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to - ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The - old ``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls - ``PCbuild\build.bat --pgo %*``. - -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. - -- Issue #25696: Fix installation of Python on UNIX with make -j9. - -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. - -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. - -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. - -- Issue #24324: Do not enable unreachable code warnings when using - gcc as the option does not work correctly in older versions of gcc - and has been silently removed as of gcc-4.5. - -Windows -------- - -- Issue #27053: Updates make_zip.py to correctly generate library ZIP file. - -- Issue #26268: Update the prepare_ssl.py script to handle OpenSSL releases - that don't include the contents of the include directory (that is, 1.0.2e - and later). - -- Issue #26071: bdist_wininst created binaries fail to start and find - 32bit Python - -- Issue #26073: Update the list of magic numbers in launcher - -- Issue #26065: Excludes venv from library when generating embeddable - distro. - -Tools/Demos ------------ - -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas - Ilsche. - -- Issue #26271: Fix the Freeze tool to properly use flags passed through - configure. Patch by Daniel Shaulov. - -- Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py. - Patch by Guo Ci Teo. - -- Issue #26316: Fix variable name typo in Argument Clinic. - -Misc ----- - -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. - - -What's New in Python 3.5.1 final? -================================= - -Release date: 2015-12-06 - -Core and Builtins ------------------ - -- Issue #25709: Fixed problem with in-place string concatenation and - utf-8 cache. - -Windows -------- - -- Issue #25715: Python 3.5.1 installer shows wrong upgrade path and incorrect - logic for launcher detection. - - -What's New in Python 3.5.1 release candidate 1? -=============================================== - -Release date: 2015-11-22 - -Core and Builtins ------------------ - -- Issue #25630: Fix a possible segfault during argument parsing in functions - that accept filesystem paths. - -- Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess - internals regarding how fds_to_pass were passed to the child. The bug had - no actual impact as subprocess.py already avoided it. - -- Issue #25388: Fixed tokenizer crash when processing undecodable source code - with a null byte. - -- Issue #25462: The hash of the key now is calculated only once in most - operations in C implementation of OrderedDict. - -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now - rejects builtin types with not defined __new__. - -- Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node - when compiling AST from Python objects. - -- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() - and eval() are passed bytes-like objects. These objects are not - necessarily terminated by a null byte, but the functions assumed they were. - -- Issue #24726: Fixed a crash and leaking NULL in repr() of OrderedDict that - was mutated by direct calls of dict methods. - -- Issue #25449: Iterating OrderedDict with keys with unstable hash now raises - KeyError in C implementations as well as in Python implementation. - -- Issue #25395: Fixed crash when highly nested OrderedDict structures were - garbage collected. - -- Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new - recursion limit is too low depending at the current recursion depth. Modify - also the "lower-water mark" formula to make it monotonic. This mark is used - to decide when the overflowed flag of the thread state is reset. - -- Issue #24402: Fix input() to prompt to the redirected stdout when - sys.stdout.fileno() fails. - -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. - -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. - -- Issue #25280: Import trace messages emitted in verbose (-v) mode are no - longer formatted twice. - -- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the - getrandom() function instead of the getentropy() function. The getentropy() - function is blocking to generate very good quality entropy, os.urandom() - doesn't need such high-quality entropy. - -- Issue #25182: The stdprinter (used as sys.stderr before the io module is - imported at startup) now uses the backslashreplace error handler. - -- Issue #25131: Make the line number and column offset of set/dict literals and - comprehensions correspond to the opening brace. - -- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public - Python.h header to fix a compilation error with OpenMP. PyThreadState_GET() - becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies. - -Library -------- - -- Issue #25626: Change three zlib functions to accept sizes that fit in - Py_ssize_t, but internally cap those sizes to UINT_MAX. This resolves a - regression in 3.5 where GzipFile.read() failed to read chunks larger than 2 - or 4 GiB. The change affects the zlib.Decompress.decompress() max_length - parameter, the zlib.decompress() bufsize parameter, and the - zlib.Decompress.flush() length parameter. - -- Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- Issue #25593: Change semantics of EventLoop.stop() in asyncio. - -- Issue #6973: When we know a subprocess.Popen process has died, do - not allow the send_signal(), terminate(), or kill() methods to do - anything as they could potentially signal a different process. - -- Issue #25590: In the Readline completer, only call getattr() once per - attribute. - -- Issue #25498: Fix a crash when garbage-collecting ctypes objects created - by wrapping a memoryview. This was a regression made in 3.5a1. Based - on patch by Eryksun. - -- Issue #25584: Added "escape" to the __all__ list in the glob module. - -- Issue #25584: Fixed recursive glob() with patterns starting with ``**``. - -- Issue #25446: Fix regression in smtplib's AUTH LOGIN support. - -- Issue #18010: Fix the pydoc web server's module search function to handle - exceptions from importing packages. - -- Issue #25554: Got rid of circular references in regular expression parsing. - -- Issue #25510: fileinput.FileInput.readline() now returns b'' instead of '' - at the end if the FileInput was opened with binary mode. - Patch by Ryosuke Ito. - -- Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. - Original patch by John Mark Vandenberg. - -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. - -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. - -- Issue #25447: The lru_cache() wrapper objects now can be copied and pickled - (by returning the original object unchanged). - -- Issue #25390: typing: Don't crash on Union[str, Pattern]. - -- Issue #25441: asyncio: Raise error from drain() when socket is closed. - -- Issue #25410: Cleaned up and fixed minor bugs in C implementation of - OrderedDict. - -- Issue #25411: Improved Unicode support in SMTPHandler through better use of - the email package. Thanks to user simon04 for the patch. - -- Issue #25407: Remove mentions of the formatter module being removed in - Python 3.6. - -- Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() - that caused segmentation fault or hang in iterating after moving several - items to the start of ordered dict. - -- Issue #25364: zipfile now works in threads disabled builds. - -- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both - decode_data and enable_SMTPUTF8 are set to true. - -- Issue #25316: distutils raises OSError instead of DistutilsPlatformError - when MSVC is not installed. - -- Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in - pickletools.opcodes. - -- Issue #23972: Updates asyncio datagram create method allowing reuseport - and reuseaddr socket options to be set prior to binding the socket. - Mirroring the existing asyncio create_server method the reuseaddr option - for datagram sockets defaults to True if the O/S is 'posix' (except if the - platform is Cygwin). Patch by Chris Laws. - -- Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you - submit a coroutine to a loop from another thread, returning a - concurrent.futures.Future. By Vincent Michel. - -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the - first question mark (?) rather than the last. Patch from Xiang Zhang. - -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. - -- Issue #24483: C implementation of functools.lru_cache() now calculates key's - hash only once. - -- Issue #22958: Constructor and update method of weakref.WeakValueDictionary - now accept the self and the dict keyword arguments. - -- Issue #22609: Constructor of collections.UserDict now accepts the self keyword - argument. - -- Issue #25111: Fixed comparison of traceback.FrameSummary. - -- Issue #25262: Added support for BINBYTES8 opcode in Python implementation of - unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 - opcodes no longer silently ignored on 32-bit platforms in C implementation. - -- Issue #25034: Fix string.Formatter problem with auto-numbering and - nested format_specs. Patch by Anthon van der Neut. - -- Issue #25233: Rewrite the guts of asyncio.Queue and - asyncio.Semaphore to be more understandable and correct. - -- Issue #25203: Failed readline.set_completer_delims() no longer left the - module in inconsistent state. - -- Issue #23600: Default implementation of tzinfo.fromutc() was returning - wrong results in some cases. - -- Issue #23329: Allow the ssl module to be built with older versions of - LibreSSL. - -- Prevent overflow in _Unpickler_Read. - -- Issue #25047: The XML encoding declaration written by Element Tree now - respects the letter case given by the user. This restores the ability to - write encoding names in uppercase like "UTF-8", which worked in Python 2. - -- Issue #25135: Make deque_clear() safer by emptying the deque before clearing. - This helps avoid possible reentrancy issues. - -- Issue #19143: platform module now reads Windows version from kernel32.dll to - avoid compatibility shims. - -- Issue #25092: Fix datetime.strftime() failure when errno was already set to - EINVAL. - -- Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods - of datetime.datetime: microseconds are now rounded to nearest with ties - going to nearest even integer (ROUND_HALF_EVEN), instead of being rounding - towards minus infinity (ROUND_FLOOR). It's important that these methods use - the same rounding mode than datetime.timedelta to keep the property: - (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t). - It also the rounding mode used by round(float) for example. - -- Issue #25155: Fix datetime.datetime.now() and datetime.datetime.utcnow() on - Windows to support date after year 2038. It was a regression introduced in - Python 3.5.0. - -- Issue #25108: Omitted internal frames in traceback functions print_stack(), - format_stack(), and extract_stack() called without arguments. - -- Issue #25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows. - -- Issue #24684: socket.socket.getaddrinfo() now calls - PyUnicode_AsEncodedString() instead of calling the encode() method of the - host, to handle correctly custom string with an encode() method which doesn't - return a byte string. The encoder of the IDNA codec is now called directly - instead of calling the encode() method of the string. - -- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode. - -- Issue #24857: Comparing call_args to a long sequence now correctly returns a - boolean result instead of raising an exception. Patch by A Kaptur. - -- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even - when convert_charrefs is True. - -- Issue #24982: shutil.make_archive() with the "zip" format now adds entries - for directories (including empty directories) in ZIP file. - -- Issue #25019: Fixed a crash caused by setting non-string key of expat parser. - Based on patch by John Leitch. - -- Issue #16180: Exit pdb if file has syntax error, instead of trapping user - in an infinite loop. Patch by Xavier de Gaye. - -- Issue #24891: Fix a race condition at Python startup if the file descriptor - of stdin (0), stdout (1) or stderr (2) is closed while Python is creating - sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set - to None if the creation of the object failed, instead of raising an OSError - exception. Initial patch written by Marco Paolini. - -- Issue #24992: Fix error handling and a race condition (related to garbage - collection) in collections.OrderedDict constructor. - -- Issue #24881: Fixed setting binary mode in Python implementation of FileIO - on Windows and Cygwin. Patch from Akira Li. - -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). - -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating - ssl.SSLContext. - -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). - -- Issue #25471: Sockets returned from accept() shouldn't appear to be - nonblocking. - -- Issue #25319: When threading.Event is reinitialized, the underlying condition - should use a regular lock rather than a recursive lock. - -- Issue #21112: Fix regression in unittest.expectedFailure on subclasses. - Patch from Berker Peksag. - -- Issue #24764: cgi.FieldStorage.read_multi() now ignores the Content-Length - header in part headers. Patch written by Peter Landry and reviewed by Pierre - Quentel. - -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. - -- Issue #24774: Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. - -- Issue #21159: Improve message in configparser.InterpolationMissingOptionError. - Patch from ?ukasz Langa. - -- Issue #20362: Honour TestCase.longMessage correctly in assertRegex. - Patch from Ilia Kurenkov. - -- Issue #23572: Fixed functools.singledispatch on classes with falsy - metaclasses. Patch by Ethan Furman. - -- asyncio: ensure_future() now accepts awaitable objects. - -IDLE ----- - -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. - -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the - debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. - -- Change 'The program' to 'Your program' in an IDLE 'kill program?' message - to make it clearer that the program referred to is the currently running - user program, not IDLE itself. - -- Issue #24750: Improve the appearance of the IDLE editor window status bar. - Patch by Mark Roseman. - -- Issue #25313: Change the handling of new built-in text color themes to better - address the compatibility problem introduced by the addition of IDLE Dark. - Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. - -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences - dialog rather than a separate dialog. The former tabs are now a sorted - list. Patch by Mark Roseman. - -- Issue #22726: Re-activate the config dialog help button with some content - about the other buttons and the new IDLE Dark theme. - -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. - -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. - 'IDLE' now means 'Integrated Development and Learning Environment'. - -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. - -- Issue #24972: Inactive selection background now matches active selection - background, as configured by users, on all systems. Found items are now - always highlighted on Windows. Initial patch by Mark Roseman. - -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. - -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. - -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. - -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. - -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. - -- Issue #25225: Condense and rewrite Idle doc section on text colors. - -- Issue #21995: Explain some differences between IDLE and console Python. - -- Issue #22820: Explain need for *print* when running file from Idle editor. - -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. - -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. - -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Mark Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - -Documentation -------------- - -- Issue #22558: Add remaining doc links to source code for Python-coded modules. - Patch by Yoni Lavi. - -- Issue #12067: Rewrite Comparisons section in the Expressions chapter of the - language reference. Some of the details of comparing mixed types were - incorrect or ambiguous. NotImplemented is only relevant at a lower level - than the Expressions chapter. Added details of comparing range() objects, - and default behaviour and consistency suggestions for user-defined classes. - Patch from Andy Maier. - -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "_thread" modules. Patch from Mattip. - -- Issue #23725: Overhaul tempfile docs. Note deprecated status of mktemp. - Patch from Zbigniew J?drzejewski-Szmek. - -- Issue #24808: Update the types of some PyTypeObject fields. Patch by - Joseph Weston. - -- Issue #22812: Fix unittest discovery examples. - Patch from Pam McA'Nulty. - -Tests ------ - -- Issue #25449: Added tests for OrderedDict subclasses. - -- Issue #25099: Make test_compileall not fail when an entry on sys.path cannot - be written to (commonly seen in administrative installs on Windows). - -- Issue #23919: Prevents assert dialogs appearing in the test suite. - -- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. - -Build ------ - -- Issue #24915: Add LLVM support for PGO builds and use the test suite to - generate the profile data. Initial patch by Alecsandru Patrascu of Intel. - -- Issue #24910: Windows MSIs now have unique display names. - -- Issue #24986: It is now possible to build Python on Windows without errors - when external libraries are not available. - -Windows -------- - -- Issue #25450: Updates shortcuts to start Python in installation directory. - -- Issue #25164: Changes default all-users install directory to match per-user - directory. - -- Issue #25143: Improves installer error messages for unsupported platforms. - -- Issue #25163: Display correct directory in installer when using non-default - settings. - -- Issue #25361: Disables use of SSE2 instructions in Windows 32-bit build - -- Issue #25089: Adds logging to installer for case where launcher is not - selected on upgrade. - -- Issue #25165: Windows uninstallation should not remove launcher if other - versions remain - -- Issue #25112: py.exe launcher is missing icons - -- Issue #25102: Windows installer does not precompile for -O or -OO. - -- Issue #25081: Makes Back button in installer go back to upgrade page when - upgrading. - -- Issue #25091: Increases font size of the installer. - -- Issue #25126: Clarifies that the non-web installer will download some - components. - -- Issue #25213: Restores requestedExecutionLevel to manifest to disable - UAC virtualization. - -- Issue #25022: Removed very outdated PC/example_nt/ directory. - -Tools/Demos ------------ - -- Issue #25440: Fix output of python-config --extension-suffix. - - -What's New in Python 3.5.0 final? -================================= - -Release date: 2015-09-13 - -Build ------ - -- Issue #25071: Windows installer should not require TargetDir - parameter when installing quietly. - - -What's New in Python 3.5.0 release candidate 4? -=============================================== - -Release date: 2015-09-09 - -Library -------- - -- Issue #25029: Fixes MemoryError in test_strptime. - -Build ------ - -- Issue #25027: Reverts partial-static build options and adds - vcruntime140.dll to Windows installation. - - -What's New in Python 3.5.0 release candidate 3? -=============================================== - -Release date: 2015-09-07 - -Core and Builtins ------------------ - -- Issue #24305: Prevent import subsystem stack frames from being counted - by the warnings.warn(stacklevel=) parameter. - -- Issue #24912: Prevent __class__ assignment to immutable built-in objects. - -- Issue #24975: Fix AST compilation for PEP 448 syntax. - -Library -------- - -- Issue #24917: time_strftime() buffer over-read. - -- Issue #24748: To resolve a compatibility problem found with py2exe and - pywin32, imp.load_dynamic() once again ignores previously loaded modules - to support Python modules replacing themselves with extension modules. - Patch by Petr Viktorin. - -- Issue #24635: Fixed a bug in typing.py where isinstance([], typing.Iterable) - would return True once, then False on subsequent calls. - -- Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is - set beyond size. Based on patch by John Leitch. - -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. - - -What's New in Python 3.5.0 release candidate 2? -=============================================== - -Release date: 2015-08-25 - -Core and Builtins ------------------ - -- Issue #24769: Interpreter now starts properly when dynamic loading - is disabled. Patch by Petr Viktorin. - -- Issue #21167: NAN operations are now handled correctly when python is - compiled with ICC even if -fp-model strict is not specified. - -- Issue #24492: A "package" lacking a __name__ attribute when trying to perform - a ``from .. import ...`` statement will trigger an ImportError instead of an - AttributeError. - -Library -------- - -- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk. - -- Issue #24839: platform._syscmd_ver raises DeprecationWarning - -- Issue #24867: Fix Task.get_stack() for 'async def' coroutines - - -What's New in Python 3.5.0 release candidate 1? -=============================================== - -Release date: 2015-08-09 - -Core and Builtins ------------------ - -- Issue #24667: Resize odict in all cases that the underlying dict resizes. - -Library -------- - -- Issue #24824: Signatures of codecs.encode() and codecs.decode() now are - compatible with pydoc. - -- Issue #24634: Importing uuid should not try to load libc on Windows - -- Issue #24798: _msvccompiler.py doesn't properly support manifests - -- Issue #4395: Better testing and documentation of binary operators. - Patch by Martin Panter. - -- Issue #23973: Update typing.py from GitHub repo. - -- Issue #23004: mock_open() now reads binary data correctly when the type of - read_data is bytes. Initial patch by Aaron Hill. - -- Issue #23888: Handle fractional time in cookie expiry. Patch by ssh. - -- Issue #23652: Make it possible to compile the select module against the - libc headers from the Linux Standard Base, which do not include some - EPOLL macros. Patch by Matt Frank. - -- Issue #22932: Fix timezones in email.utils.formatdate. - Patch from Dmitry Shachnev. - -- Issue #23779: imaplib raises TypeError if authenticator tries to abort. - Patch from Craig Holmquist. - -- Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch - written by Matthieu Gautier. - -- Issue #23254: Document how to close the TCPServer listening socket. - Patch from Martin Panter. - -- Issue #19450: Update Windows and OS X installer builds to use SQLite 3.8.11. - -- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella. - -- Issue #24791: Fix grammar regression for call syntax: 'g(\*a or b)'. - -IDLE ----- - -- Issue #23672: Allow Idle to edit and run files with astral chars in name. - Patch by Mohd Sanad Zaki Rizvi. - -- Issue #24745: Idle editor default font. Switch from Courier to - platform-sensitive TkFixedFont. This should not affect current customized - font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg - and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. - -- Issue #21192: Idle editor. When a file is run, put its name in the restart bar. - Do not print false prompts. Original patch by Adnan Umer. - -- Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy. - -Documentation -------------- - -- Issue #24129: Clarify the reference documentation for name resolution. - This includes removing the assumption that readers will be familiar with the - name resolution scheme Python used prior to the introduction of lexical - scoping for function namespaces. Patch by Ivan Levkivskyi. - -- Issue #20769: Improve reload() docs. Patch by Dorian Pula. - -- Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. - -- Issue #24729: Correct IO tutorial to match implementation regarding - encoding parameter to open function. - -Tests ------ - -- Issue #24751: When running regrtest with the ``-w`` command line option, - a test run is no longer marked as a failure if all tests succeed when - re-run. - - -What's New in Python 3.5.0 beta 4? -================================== - -Release date: 2015-07-26 - -Core and Builtins ------------------ - -- Issue #23573: Restored optimization of bytes.rfind() and bytearray.rfind() - for single-byte argument on Linux. - -- Issue #24569: Make PEP 448 dictionary evaluation more consistent. - -- Issue #24583: Fix crash when set is mutated while being updated. - -- Issue #24407: Fix crash when dict is mutated while being updated. - -- Issue #24619: New approach for tokenizing async/await. As a consequence, - it is now possible to have one-line 'async def foo(): await ..' functions. - -- Issue #24687: Plug refleak on SyntaxError in function parameters - annotations. - -- Issue #15944: memoryview: Allow arbitrary formats when casting to bytes. - Patch by Martin Panter. - -Library -------- - -- Issue #23441: rcompleter now prints a tab character instead of displaying - possible completions for an empty word. Initial patch by Martin Sekera. - -- Issue #24683: Fixed crashes in _json functions called with arguments of - inappropriate type. - -- Issue #21697: shutil.copytree() now correctly handles symbolic links that - point to directories. Patch by Eduardo Seabra and Thomas Kluyver. - -- Issue #14373: Fixed segmentation fault when gc.collect() is called during - constructing lru_cache (C implementation). - -- Issue #24695: Fix a regression in traceback.print_exception(). If - exc_traceback is None we shouldn't print a traceback header like described - in the documentation. - -- Issue #24620: Random.setstate() now validates the value of state last element. - -- Issue #22485: Fixed an issue that caused `inspect.getsource` to return - incorrect results on nested functions. - -- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero. - -- Issue #24580: Symbolic group references to open group in re patterns now are - explicitly forbidden as well as numeric group references. - -- Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes. - -- Issue #24631: Fixed regression in the timeit module with multiline setup. - -- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. - Patch from Nicola Palumbo and Laurent De Buyst. - -- Issue #23661: unittest.mock side_effects can now be exceptions again. This - was a regression vs Python 3.4. Patch from Ignacio Rossi - -- Issue #24608: chunk.Chunk.read() now always returns bytes, not str. - -- Issue #18684: Fixed reading out of the buffer in the re module. - -- Issue #24259: tarfile now raises a ReadError if an archive is truncated - inside a data segment. - -- Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional - initial-response argument to the SMTP AUTH command. - -- Issue #24669: Fix inspect.getsource() for 'async def' functions. - Patch by Kai Groner. - -- Issue #24688: ast.get_docstring() for 'async def' functions. - -Build ------ - -- Issue #24603: Update Windows builds and OS X 10.5 installer to use OpenSSL - 1.0.2d. - - -What's New in Python 3.5.0 beta 3? -================================== - -Release date: 2015-07-05 - -Core and Builtins ------------------ - -- Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray - object now always allocates place for trailing null byte and it's buffer now - is always null-terminated. - -- Upgrade to Unicode 8.0.0. - -- Issue #24345: Add Py_tp_finalize slot for the stable ABI. - -- Issue #24400: Introduce a distinct type for PEP 492 coroutines; add - types.CoroutineType, inspect.getcoroutinestate, inspect.getcoroutinelocals; - coroutines no longer use CO_GENERATOR flag; sys.set_coroutine_wrapper - works only for 'async def' coroutines; inspect.iscoroutine no longer - uses collections.abc.Coroutine, it's intended to test for pure 'async def' - coroutines only; add new opcode: GET_YIELD_FROM_ITER; fix generators wrapper - used in types.coroutine to be instance of collections.abc.Generator; - collections.abc.Awaitable and collections.abc.Coroutine can no longer - be used to detect generator-based coroutines--use inspect.isawaitable - instead. - -- Issue #24450: Add gi_yieldfrom to generators and cr_await to coroutines. - Contributed by Benno Leslie and Yury Selivanov. - -- Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. - -Library -------- - -- Issue #21750: mock_open.read_data can now be read from each instance, as it - could in Python 3.3. - -- Issue #24552: Fix use after free in an error case of the _pickle module. - -- Issue #24514: tarfile now tolerates number fields consisting of only - whitespace. - -- Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree. - A deprecation warning no longer issued by XMLParser subclass with default - doctype() method. Direct call of doctype() now issues a warning. Parser's - doctype() now is not called if target's doctype() is called. Based on patch - by Martin Panter. - -- Issue #20387: Restore semantic round-trip correctness in tokenize/untokenize - for tab-indented blocks. - -- Issue #24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() - functions of the audioop module. - -- Issue #24336: The contextmanager decorator now works with functions with - keyword arguments called "func" and "self". Patch by Martin Panter. - -- Issue #24522: Fix possible integer overflow in json accelerator module. - -- Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). - -- Issue #24408: Fixed AttributeError in measure() and metrics() methods of - tkinter.Font. - -- Issue #14373: C implementation of functools.lru_cache() now can be used with - methods. - -- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. - -- Issue #24348: Drop superfluous incref/decref. - -- Issue #24359: Check for changed OrderedDict size during iteration. - -- Issue #24368: Support keyword arguments in OrderedDict methods. - -- Issue #24362: Simplify the C OrderedDict fast nodes resize logic. - -- Issue #24377: Fix a ref leak in OrderedDict.__repr__. - -- Issue #24369: Defend against key-changes during iteration. - -Tests ------ - -- Issue #24373: _testmultiphase and xxlimited now use tp_traverse and - tp_finalize to avoid reference leaks encountered when combining tp_dealloc - with PyType_FromSpec (see issue #16690 for details) - -Documentation -------------- - -- Issue #24458: Update documentation to cover multi-phase initialization for - extension modules (PEP 489). Patch by Petr Viktorin. - -- Issue #24351: Clarify what is meant by "identifier" in the context of - string.Template instances. - -Build ------ - -- Issue #24432: Update Windows builds and OS X 10.5 installer to use OpenSSL - 1.0.2c. - - -What's New in Python 3.5.0 beta 2? -================================== - -Release date: 2015-05-31 - -Core and Builtins ------------------ - -- Issue #24284: The startswith and endswith methods of the str class no longer - return True when finding the empty string and the indexes are completely out - of range. - -- Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(), - PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() - to check for and handle errors correctly. - -- Issue #24328: Fix importing one character extension modules. - -- Issue #11205: In dictionary displays, evaluate the key before the value. - -- Issue #24285: Fixed regression that prevented importing extension modules - from inside packages. Patch by Petr Viktorin. - -Library -------- - -- Issue #23247: Fix a crash in the StreamWriter.reset() of CJK codecs. - -- Issue #24270: Add math.isclose() and cmath.isclose() functions as per PEP 485. - Contributed by Chris Barker and Tal Einat. - -- Issue #5633: Fixed timeit when the statement is a string and the setup is not. - -- Issue #24326: Fixed audioop.ratecv() with non-default weightB argument. - Original patch by David Moore. - -- Issue #16991: Add a C implementation of OrderedDict. - -- Issue #23934: Fix inspect.signature to fail correctly for builtin types - lacking signature information. Initial patch by James Powell. - - -What's New in Python 3.5.0 beta 1? -================================== - -Release date: 2015-05-24 - -Core and Builtins ------------------ - -- Issue #24276: Fixed optimization of property descriptor getter. - -- Issue #24268: PEP 489: Multi-phase extension module initialization. - Patch by Petr Viktorin. - -- Issue #23955: Add pyvenv.cfg option to suppress registry/environment - lookup for generating sys.path on Windows. - -- Issue #24257: Fixed system error in the comparison of faked - types.SimpleNamespace. - -- Issue #22939: Fixed integer overflow in iterator object. Patch by - Clement Rouault. - -- Issue #23985: Fix a possible buffer overrun when deleting a slice from - the front of a bytearray and then appending some other bytes data. - -- Issue #24102: Fixed exception type checking in standard error handlers. - -- Issue #15027: The UTF-32 encoder is now 3x to 7x faster. - -- Issue #23290: Optimize set_merge() for cases where the target is empty. - (Contributed by Serhiy Storchaka.) - -- Issue #2292: PEP 448: Additional Unpacking Generalizations. - -- Issue #24096: Make warnings.warn_explicit more robust against mutation of the - warnings.filters list. - -- Issue #23996: Avoid a crash when a delegated generator raises an - unnormalized StopIteration exception. Patch by Stefan Behnel. - -- Issue #23910: Optimize property() getter calls. Patch by Joe Jevnik. - -- Issue #23911: Move path-based importlib bootstrap code to a separate - frozen module. - -- Issue #24192: Fix namespace package imports. - -- Issue #24022: Fix tokenizer crash when processing undecodable source code. - -- Issue #9951: Added a hex() method to bytes, bytearray, and memoryview. - -- Issue #22906: PEP 479: Change StopIteration handling inside generators. - -- Issue #24017: PEP 492: Coroutines with async and await syntax. - -Library -------- - -- Issue #14373: Added C implementation of functools.lru_cache(). Based on - patches by Matt Joiner and Alexey Kachayev. - -- Issue #24230: The tempfile module now accepts bytes for prefix, suffix and dir - parameters and returns bytes in such situations (matching the os module APIs). - -- Issue #22189: collections.UserString now supports __getnewargs__(), - __rmod__(), casefold(), format_map(), isprintable(), and maketrans(). - Patch by Joe Jevnik. - -- Issue #24244: Prevents termination when an invalid format string is - encountered on Windows in strftime. - -- Issue #23973: PEP 484: Add the typing module. - -- Issue #23086: The collections.abc.Sequence() abstract base class added - *start* and *stop* parameters to the index() mixin. - Patch by Devin Jeanpierre. - -- Issue #20035: Replaced the ``tkinter._fix`` module used for setting up the - Tcl/Tk environment on Windows with a private function in the ``_tkinter`` - module that makes no permanent changes to the environment. - -- Issue #24257: Fixed segmentation fault in sqlite3.Row constructor with faked - cursor type. - -- Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and - assertWarnsRegex() assertments now check the type of the first argument - to prevent possible user error. Based on patch by Daniel Wagner-Hall. - -- Issue #9858: Add missing method stubs to _io.RawIOBase. Patch by Laura - Rupprecht. - -- Issue #22955: attrgetter, itemgetter and methodcaller objects in the operator - module now support pickling. Added readable and evaluable repr for these - objects. Based on patch by Josh Rosenberg. - -- Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again - when a directory with the chosen name already exists on Windows as well as - on Unix. tempfile.mkstemp() now fails early if parent directory is not - valid (not exists or is a file) on Windows. - -- Issue #23780: Improved error message in os.path.join() with single argument. - -- Issue #6598: Increased time precision and random number range in - email.utils.make_msgid() to strengthen the uniqueness of the message ID. - -- Issue #24091: Fixed various crashes in corner cases in C implementation of - ElementTree. - -- Issue #21931: msilib.FCICreate() now raises TypeError in the case of a bad - argument instead of a ValueError with a bogus FCI error number. - Patch by Jeffrey Armstrong. - -- Issue #13866: *quote_via* argument added to urllib.parse.urlencode. - -- Issue #20098: New mangle_from policy option for email, default True - for compat32, but False for all other policies. - -- Issue #24211: The email library now supports RFC 6532: it can generate - headers using utf-8 instead of encoded words. - -- Issue #16314: Added support for the LZMA compression in distutils. - -- Issue #21804: poplib now supports RFC 6856 (UTF8). - -- Issue #18682: Optimized pprint functions for builtin scalar types. - -- Issue #22027: smtplib now supports RFC 6531 (SMTPUTF8). - -- Issue #23488: Random generator objects now consume 2x less memory on 64-bit. - -- Issue #1322: platform.dist() and platform.linux_distribution() functions are - now deprecated. Initial patch by Vajrasky Kok. - -- Issue #22486: Added the math.gcd() function. The fractions.gcd() function - now is deprecated. Based on patch by Mark Dickinson. - -- Issue #24064: Property() docstrings are now writeable. - (Patch by Berker Peksag.) - -- Issue #22681: Added support for the koi8_t encoding. - -- Issue #22682: Added support for the kz1048 encoding. - -- Issue #23796: peek and read1 methods of BufferedReader now raise ValueError - if they called on a closed object. Patch by John Hergenroeder. - -- Issue #21795: smtpd now supports the 8BITMIME extension whenever - the new *decode_data* constructor argument is set to False. - -- Issue #24155: optimize heapq.heapify() for better cache performance - when heapifying large lists. - -- Issue #21800: imaplib now supports RFC 5161 (enable), RFC 6855 - (utf8/internationalized email) and automatically encodes non-ASCII - usernames and passwords to UTF8. - -- Issue #20274: When calling a _sqlite.Connection, it now complains if passed - any keyword arguments. Previously it silently ignored them. - -- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three - METH_VARARGS methods on _sqlite.Connection. - -- Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and - assertWarnsRegex() checks now emits a deprecation warning when callable is - None or keyword arguments except msg is passed in the context manager mode. - -- Issue #24018: Add a collections.abc.Generator abstract base class. - Contributed by Stefan Behnel. - -- Issue #23880: Tkinter's getint() and getdouble() now support Tcl_Obj. - Tkinter's getdouble() now supports any numbers (in particular int). - -- Issue #22619: Added negative limit support in the traceback module. - Based on patch by Dmitry Kazakov. - -- Issue #24094: Fix possible crash in json.encode with poorly behaved dict - subclasses. - -- Issue #9246: On POSIX, os.getcwd() now supports paths longer than 1025 bytes. - Patch written by William Orr. - -- Issue #17445: add difflib.diff_bytes() to support comparison of - byte strings (fixes a regression from Python 2). - -- Issue #23917: Fall back to sequential compilation when ProcessPoolExecutor - doesn't exist. Patch by Claudiu Popa. - -- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. - -- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't - increment unfinished tasks (this bug was introduced when - JoinableQueue was merged with Queue). - -- Issue #23908: os functions now reject paths with embedded null character - on Windows instead of silently truncating them. - -- Issue #23728: binascii.crc_hqx() could return an integer outside of the range - 0-0xffff for empty data. - -- Issue #23887: urllib.error.HTTPError now has a proper repr() representation. - Patch by Berker Peksag. - -- asyncio: New event loop APIs: set_task_factory() and get_task_factory(). - -- asyncio: async() function is deprecated in favour of ensure_future(). - -- Issue #24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore - support new 'async with' syntax. Contributed by Yury Selivanov. - -- Issue #24179: Support 'async for' for asyncio.StreamReader. - Contributed by Yury Selivanov. - -- Issue #24184: Add AsyncIterator and AsyncIterable ABCs to - collections.abc. Contributed by Yury Selivanov. - -- Issue #22547: Implement informative __repr__ for inspect.BoundArguments. - Contributed by Yury Selivanov. - -- Issue #24190: Implement inspect.BoundArgument.apply_defaults() method. - Contributed by Yury Selivanov. - -- Issue #20691: Add 'follow_wrapped' argument to - inspect.Signature.from_callable() and inspect.signature(). - Contributed by Yury Selivanov. - -- Issue #24248: Deprecate inspect.Signature.from_function() and - inspect.Signature.from_builtin(). - -- Issue #23898: Fix inspect.classify_class_attrs() to support attributes - with overloaded __eq__ and __bool__. Patch by Mike Bayer. - -- Issue #24298: Fix inspect.signature() to correctly unwrap wrappers - around bound methods. - -IDLE ----- - -- Issue #23184: remove unused names and imports in idlelib. - Initial patch by Al Sweigart. - -Tests ------ - -- Issue #21520: test_zipfile no longer fails if the word 'bad' appears - anywhere in the name of the current directory. - -- Issue #9517: Move script_helper into the support package. - Patch by Christie Wilson. - -Documentation -------------- - -- Issue #22155: Add File Handlers subsection with createfilehandler to tkinter - doc. Remove obsolete example from FAQ. Patch by Martin Panter. - -- Issue #24029: Document the name binding behavior for submodule imports. - -- Issue #24077: Fix typo in man page for -I command option: -s, not -S - -Tools/Demos ------------ - -- Issue #24000: Improved Argument Clinic's mapping of converters to legacy - "format units". Updated the documentation to match. - -- Issue #24001: Argument Clinic converters now use accept={type} - instead of types={'type'} to specify the types the converter accepts. - -- Issue #23330: h2py now supports arbitrary filenames in #include. - -- Issue #24031: make patchcheck now supports git checkouts, too. - - -What's New in Python 3.5.0 alpha 4? -=================================== - -Release date: 2015-04-19 - -Core and Builtins ------------------ - -- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include - the architecture triplet in the extension name, to make it easy to test builds - for different ABIs in the same working tree. Under OS X, the extension name - now includes PEP 3149-style information. - -- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES. - Patch courtesy of Joe Jevnik. - -- Issue #23731: Implement PEP 488: removal of .pyo files. - -- Issue #23726: Don't enable GC for user subclasses of non-GC types that - don't add any new fields. Patch by Eugene Toder. - -- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted - while it is holding a lock to a buffered I/O object, and the main thread - tries to use the same I/O object (typically stdout or stderr). A fatal - error is emitted instead. - -- Issue #22977: Fixed formatting Windows error messages on Wine. - Patch by Martin Panter. - -- Issue #23466: %c, %o, %x, and %X in bytes formatting now raise TypeError on - non-integer input. - -- Issue #24044: Fix possible null pointer dereference in list.sort in out of - memory conditions. - -- Issue #21354: PyCFunction_New function is exposed by python DLL again. - -Library -------- - -- Issue #23840: tokenize.open() now closes the temporary binary file on error - to fix a resource warning. - -- Issue #16914: new debuglevel 2 in smtplib adds timestamps to debug output. - -- Issue #7159: urllib.request now supports sending auth credentials - automatically after the first 401. This enhancement is a superset of the - enhancement from issue #19494 and supersedes that change. - -- Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a. - Patch by Demian Brecht. - -- Issue #4254: Adds _curses.update_lines_cols(). Patch by Arnon Yaari - -- Issue #19933: Provide default argument for ndigits in round. Patch by - Vajrasky Kok. - -- Issue #23193: Add a numeric_owner parameter to - tarfile.TarFile.extract and tarfile.TarFile.extractall. Patch by - Michael Vogt and Eric Smith. - -- Issue #23342: Add a subprocess.run() function than returns a CalledProcess - instance for a more consistent API than the existing call* functions. - -- Issue #21217: inspect.getsourcelines() now tries to compute the start and end - lines from the code object, fixing an issue when a lambda function is used as - decorator argument. Patch by Thomas Ballinger and Allison Kaptur. - -- Issue #24521: Fix possible integer overflows in the pickle module. - -- Issue #22931: Allow '[' and ']' in cookie values. - -- The keywords attribute of functools.partial is now always a dictionary. - -- Issue #23811: Add missing newline to the PyCompileError error message. - Patch by Alex Shkop. - -- Issue #21116: Avoid blowing memory when allocating a multiprocessing shared - array that's larger than 50% of the available RAM. Patch by M?d?ric Boquien. - -- Issue #22982: Improve BOM handling when seeking to multiple positions of - a writable text file. - -- Issue #23464: Removed deprecated asyncio JoinableQueue. - -- Issue #23529: Limit the size of decompressed data when reading from - GzipFile, BZ2File or LZMAFile. This defeats denial of service attacks - using compressed bombs (i.e. compressed payloads which decompress to a huge - size). Patch by Martin Panter and Nikolaus Rath. - -- Issue #21859: Added Python implementation of io.FileIO. - -- Issue #23865: close() methods in multiple modules now are idempotent and more - robust at shutdown. If they need to release multiple resources, all are - released even if errors occur. - -- Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not - available. Patch by Davin Potts. - -- Issue #10838: The subprocess now module includes SubprocessError and - TimeoutError in its list of exported names for the users wild enough - to use ``from subprocess import *``. - -- Issue #23411: Added DefragResult, ParseResult, SplitResult, DefragResultBytes, - ParseResultBytes, and SplitResultBytes to urllib.parse.__all__. - Patch by Martin Panter. - -- Issue #23881: urllib.request.ftpwrapper constructor now closes the socket if - the FTP connection failed to fix a ResourceWarning. - -- Issue #23853: :meth:`socket.socket.sendall` does no more reset the socket - timeout each time data is sent successfully. The socket timeout is now the - maximum total duration to send all data. - -- Issue #22721: An order of multiline pprint output of set or dict containing - orderable and non-orderable elements no longer depends on iteration order of - set or dict. - -- Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always - returns bool. tkinter.BooleanVar now validates input values (accepted bool, - int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns bool. - -- Issue #10590: xml.sax.parseString() now supports string argument. - -- Issue #23338: Fixed formatting ctypes error messages on Cygwin. - Patch by Makoto Kato. - -- Issue #15582: inspect.getdoc() now follows inheritance chains. - -- Issue #2175: SAX parsers now support a character stream of InputSource object. - -- Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and - arbitrary precision integers added in Tcl 8.5. - -- Issue #23834: Fix socket.sendto(), use the C Py_ssize_t type to store the - result of sendto() instead of the C int type. - -- Issue #23618: :meth:`socket.socket.connect` now waits until the connection - completes instead of raising :exc:`InterruptedError` if the connection is - interrupted by signals, signal handlers don't raise an exception and the - socket is blocking or has a timeout. :meth:`socket.socket.connect` still - raise :exc:`InterruptedError` for non-blocking sockets. - -- Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. - -- Issue #23836: Fix the faulthandler module to handle reentrant calls to - its signal handlers. - -- Issue #23838: linecache now clears the cache and returns an empty result on - MemoryError. - -- Issue #10395: Added os.path.commonpath(). Implemented in posixpath and ntpath. - Based on patch by Rafik Draoui. - -- Issue #23611: Serializing more "lookupable" objects (such as unbound methods - or nested classes) now are supported with pickle protocols < 4. - -- Issue #13583: sqlite3.Row now supports slice indexing. - -- Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings. Fixed - ambigious reverse mappings. Added many new mappings. Import mapping is no - longer applied to modules already mapped with full name mapping. - -- Issue #23485: select.select() is now retried automatically with the - recomputed timeout when interrupted by a signal, except if the signal handler - raises an exception. This change is part of the PEP 475. - -- Issue #23752: When built from an existing file descriptor, io.FileIO() now - only calls fstat() once. Before fstat() was called twice, which was not - necessary. - -- Issue #23704: collections.deque() objects now support __add__, __mul__, and - __imul__(). - -- Issue #23171: csv.Writer.writerow() now supports arbitrary iterables. - -- Issue #23745: The new email header parser now handles duplicate MIME - parameter names without error, similar to how get_param behaves. - -- Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus - infinity (-inf) instead of rounding towards zero. - -- Issue #23310: Fix MagicMock's initializer to work with __methods__, just - like configure_mock(). Patch by Kasia Jachim. - -Build ------ - -- Issue #23817: FreeBSD now uses "1.0" in the SOVERSION as other operating - systems, instead of just "1". - -- Issue #23501: Argument Clinic now generates code into separate files by default. - -Tests ------ - -- Issue #23799: Added test.support.start_threads() for running and - cleaning up multiple threads. - -- Issue #22390: test.regrtest now emits a warning if temporary files or - directories are left after running a test. - -Tools/Demos ------------ - -- Issue #18128: pygettext now uses standard +NNNN format in the - POT-Creation-Date header. - -- Issue #23935: Argument Clinic's understanding of format units - accepting bytes, bytearrays, and buffers is now consistent with - both the documentation and the implementation. - -- Issue #23944: Argument Clinic now wraps long impl prototypes at column 78. - -- Issue #20586: Argument Clinic now ensures that functions without docstrings - have signatures. - -- Issue #23492: Argument Clinic now generates argument parsing code with - PyArg_Parse instead of PyArg_ParseTuple if possible. - -- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef" - (empty) definition of the methoddef macro: it's only generated once, even - if Argument Clinic processes the same symbol multiple times, and it's emitted - at the end of all processing rather than immediately after the first use. - -C API ------ - -- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error - - -What's New in Python 3.5.0 alpha 3? -=================================== - -Release date: 2015-03-28 - -Core and Builtins ------------------ - -- Issue #23573: Increased performance of string search operations (str.find, - str.index, str.count, the in operator, str.split, str.partition) with - arguments of different kinds (UCS1, UCS2, UCS4). - -- Issue #23753: Python doesn't support anymore platforms without stat() or - fstat(), these functions are always required. - -- Issue #23681: The -b option now affects comparisons of bytes with int. - -- Issue #23632: Memoryviews now allow tuple indexing (including for - multi-dimensional memoryviews). - -- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet. - -- Issue #23629: Fix the default __sizeof__ implementation for variable-sized - objects. - -Library -------- - -- Issue #14260: The groupindex attribute of regular expression pattern object - now is non-modifiable mapping. - -- Issue #23792: Ignore KeyboardInterrupt when the pydoc pager is active. - This mimics the behavior of the standard unix pagers, and prevents - pipepager from shutting down while the pager itself is still running. - -- Issue #23775: pprint() of OrderedDict now outputs the same representation - as repr(). - -- Issue #23765: Removed IsBadStringPtr calls in ctypes - -- Issue #22364: Improved some re error messages using regex for hints. - -- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. - -- Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive - creation) mode. - -- Issue #21802: The reader in BufferedRWPair now is closed even when closing - writer failed in BufferedRWPair.close(). - -- Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. - -- Issue #23671: string.Template now allows specifying the "self" parameter as - a keyword argument. string.Formatter now allows specifying the "self" and - the "format_string" parameters as keyword arguments. - -- Issue #23502: The pprint module now supports mapping proxies. - -- Issue #17530: pprint now wraps long bytes objects and bytearrays. - -- Issue #22687: Fixed some corner cases in breaking words in tetxtwrap. - Got rid of quadratic complexity in breaking long words. - -- Issue #4727: The copy module now uses pickle protocol 4 (PEP 3154) and - supports copying of instances of classes whose __new__ method takes - keyword-only arguments. - -- Issue #23491: Added a zipapp module to support creating executable zip - file archives of Python code. Registered ".pyz" and ".pyzw" extensions - on Windows for these archives (PEP 441). - -- Issue #23657: Avoid explicit checks for str in zipapp, adding support - for pathlib.Path objects as arguments. - -- Issue #23688: Added support of arbitrary bytes-like objects and avoided - unnecessary copying of memoryview in gzip.GzipFile.write(). - Original patch by Wolfgang Maier. - -- Issue #23252: Added support for writing ZIP files to unseekable streams. - -- Issue #23647: Increase impalib's MAXLINE to accommodate modern mailbox sizes. - -- Issue #23539: If body is None, http.client.HTTPConnection.request now sets - Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors from - some web servers. - -- Issue #22351: The nntplib.NNTP constructor no longer leaves the connection - and socket open until the garbage collector cleans them up. Patch by - Martin Panter. - -- Issue #23704: collections.deque() objects now support methods for index(), - insert(), and copy(). This allows deques to be registered as a - MutableSequence and it improves their substitutability for lists. - -- Issue #23715: :func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are - now retried when interrupted by a signal not in the *sigset* parameter, if - the signal handler does not raise an exception. signal.sigtimedwait() - recomputes the timeout with a monotonic clock when it is retried. - -- Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and - codecs, that accepted only read-only bytes-like object now accept writable - bytes-like object too. - -- Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now - retried with the recomputed delay, except if the signal handler raises an - exception (PEP 475). - -- Issue #23136: _strptime now uniformly handles all days in week 0, including - Dec 30 of previous year. Based on patch by Jim Carroll. - -- Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to - NamedTemporaryFile instance. Patch by Bohuslav Kabrda. - -- Issue #22903: The fake test case created by unittest.loader when it fails - importing a test module is now picklable. - -- Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall if - available, syscall introduced in the Linux kernel 3.17. It is more reliable - and more secure, because it avoids the need of a file descriptor and waits - until the kernel has enough entropy. - -- Issue #2211: Updated the implementation of the http.cookies.Morsel class. - Setting attributes key, value and coded_value directly now is deprecated. - update() and setdefault() now transform and check keys. Comparing for - equality now takes into account attributes key, value and coded_value. - copy() now returns a Morsel, not a dict. repr() now contains all attributes. - Optimized checking keys and quoting values. Added new tests. - Original patch by Demian Brecht. - -- Issue #18983: Allow selection of output units in timeit. - Patch by Julian Gindi. - -- Issue #23631: Fix traceback.format_list when a traceback has been mutated. - -- Issue #23568: Add rdivmod support to MagicMock() objects. - Patch by H?kan L?vdahl. - -- Issue #2052: Add charset parameter to HtmlDiff.make_file(). - -- Issue #23668: Support os.truncate and os.ftruncate on Windows. - -- Issue #23138: Fixed parsing cookies with absent keys or values in cookiejar. - Patch by Demian Brecht. - -- Issue #23051: multiprocessing.Pool methods imap() and imap_unordered() now - handle exceptions raised by an iterator. Patch by Alon Diamant and Davin - Potts. - -- Issue #23581: Add matmul support to MagicMock. Patch by H?kan L?vdahl. - -- Issue #23566: enable(), register(), dump_traceback() and - dump_traceback_later() functions of faulthandler now accept file - descriptors. Patch by Wei Wu. - -- Issue #22928: Disabled HTTP header injections in http.client. - Original patch by Demian Brecht. - -- Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with - imp.reload(). Patch by Thomas Kluyver. - -- Issue #23605: os.walk() now calls os.scandir() instead of os.listdir(). - The usage of os.scandir() reduces the number of calls to os.stat(). - Initial patch written by Ben Hoyt. - -Build ------ - -- Issue #23585: make patchcheck will ensure the interpreter is built. - -Tests ------ - -- Issue #23583: Added tests for standard IO streams in IDLE. - -- Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. - -Tools/Demos ------------ - -- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better - compatible with regular files (in particular it now supports the context - management protocol). - - -What's New in Python 3.5 alpha 2? -================================= - -Release date: 2015-03-09 - -Core and Builtins ------------------ - -- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError - if a function returns a result and raises an exception. The SystemError is - chained to the previous exception. - -Library -------- - -- Issue #22524: New os.scandir() function, part of the PEP 471: "os.scandir() - function -- a better and faster directory iterator". Patch written by Ben - Hoyt. - -- Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address. - -- Issue #21793: BaseHTTPRequestHandler again logs response code as numeric, - not as stringified enum. Patch by Demian Brecht. - -- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST - flag on certificate stores when it is available. - -- Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the - SSL layer but the underlying connection hasn't been closed. - -- Issue #23504: Added an __all__ to the types module. - -- Issue #23563: Optimized utility functions in urllib.parse. - -- Issue #7830: Flatten nested functools.partial. - -- Issue #20204: Added the __module__ attribute to _tkinter classes. - -- Issue #19980: Improved help() for non-recognized strings. help('') now - shows the help on str. help('help') now shows the help on help(). - Original patch by Mark Lawrence. - -- Issue #23521: Corrected pure python implementation of timedelta division. - - * Eliminated OverflowError from ``timedelta * float`` for some floats; - * Corrected rounding in timedlta true division. - -- Issue #21619: Popen objects no longer leave a zombie after exit in the with - statement if the pipe was broken. Patch by Martin Panter. - -- Issue #22936: Make it possible to show local variables in tracebacks for - both the traceback module and unittest. - -- Issue #15955: Add an option to limit the output size in bz2.decompress(). - Patch by Nikolaus Rath. - -- Issue #6639: Module-level turtle functions no longer raise TclError after - closing the window. - -- Issues #814253, #9179: Group references and conditional group references now - work in lookbehind assertions in regular expressions. - -- Issue #23215: Multibyte codecs with custom error handlers that ignores errors - consumed too much memory and raised SystemError or MemoryError. - Original patch by Aleksi Torhamo. - -- Issue #5700: io.FileIO() called flush() after closing the file. - flush() was not called in close() if closefd=False. - -- Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding - differs from file system encoding (e.g. on Mac OS). - -- Issue #23481: Remove RC4 from the SSL module's default cipher list. - -- Issue #21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty - docstrings. - -- Issue #22885: Fixed arbitrary code execution vulnerability in the dbm.dumb - module. Original patch by Claudiu Popa. - -- Issue #23239: ssl.match_hostname() now supports matching of IP addresses. - -- Issue #23146: Fix mishandling of absolute Windows paths with forward - slashes in pathlib. - -- Issue #23096: Pickle representation of floats with protocol 0 now is the same - for both Python and C implementations. - -- Issue #19105: pprint now more efficiently uses free space at the right. - -- Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. Patch by - Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson. - -- Issue #21717: tarfile.open() now supports 'x' (exclusive creation) mode. - -- Issue #23344: marshal.dumps() is now 20-25% faster on average. - -- Issue #20416: marshal.dumps() with protocols 3 and 4 is now 40-50% faster on - average. - -- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h. - -- Issue #23367: Fix possible overflows in the unicodedata module. - -- Issue #23361: Fix possible overflow in Windows subprocess creation code. - -- logging.handlers.QueueListener now takes a respect_handler_level keyword - argument which, if set to True, will pass messages to handlers taking handler - levels into account. - -- Issue #19705: turtledemo now has a visual sorting algorithm demo. Original - patch from Jason Yeo. - -- Issue #23801: Fix issue where cgi.FieldStorage did not always ignore the - entire preamble to a multipart body. - -Build ------ - -- Issue #23445: pydebug builds now use "gcc -Og" where possible, to make - the resulting executable faster. - -- Issue #23686: Update OS X 10.5 installer build to use OpenSSL 1.0.2a. - -C API ------ - -- Issue #20204: Deprecation warning is now raised for builtin types without the - __module__ attribute. - -Windows -------- - -- Issue #23465: Implement PEP 486 - Make the Python Launcher aware of virtual - environments. Patch by Paul Moore. - -- Issue #23437: Make user scripts directory versioned on Windows. Patch by Paul - Moore. - - -What's New in Python 3.5 alpha 1? -================================= - -Release date: 2015-02-08 - -Core and Builtins ------------------ - -- Issue #23285: PEP 475 - EINTR handling. - -- Issue #22735: Fix many edge cases (including crashes) involving custom mro() - implementations. - -- Issue #22896: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() - and PyObject_AsWriteBuffer(). - -- Issue #21295: Revert some changes (issue #16795) to AST line numbers and - column offsets that constituted a regression. - -- Issue #22986: Allow changing an object's __class__ between a dynamic type and - static type in some cases. - -- Issue #15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and - PyUnicode_EncodeCodePage() now raise an exception if the object is not a - Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on - platforms other than Windows. Patch written by Campbell Barton. - -- Issue #21408: The default __ne__() now returns NotImplemented if __eq__() - returned NotImplemented. Original patch by Martin Panter. - -- Issue #23321: Fixed a crash in str.decode() when error handler returned - replacment string longer than mailformed input data. - -- Issue #22286: The "backslashreplace" error handlers now works with - decoding and translating. - -- Issue #23253: Delay-load ShellExecute[AW] in os.startfile for reduced - startup overhead on Windows. - -- Issue #22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for - atomic memory access if available. Patch written by Vitor de Lima and Gustavo - Temple. - -- Issue #20284: %-interpolation (aka printf) formatting added for bytes and - bytearray. - -- Issue #23048: Fix jumping out of an infinite while loop in the pdb. - -- Issue #20335: bytes constructor now raises TypeError when encoding or errors - is specified with non-string argument. Based on patch by Renaud Blanch. - -- Issue #22834: If the current working directory ends up being set to a - non-existent directory then import will no longer raise FileNotFoundError. - -- Issue #22869: Move the interpreter startup & shutdown code to a new - dedicated pylifecycle.c module - -- Issue #22847: Improve method cache efficiency. - -- Issue #22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff - bytes on a 32-bit platform. - -- Issue #22653: Fix an assertion failure in debug mode when doing a reentrant - dict insertion in debug mode. - -- Issue #22643: Fix integer overflow in Unicode case operations (upper, lower, - title, swapcase, casefold). - -- Issue #17636: Circular imports involving relative imports are now - supported. - -- Issue #22604: Fix assertion error in debug mode when dividing a complex - number by (nan+0j). - -- Issue #21052: Do not raise ImportWarning when sys.path_hooks or sys.meta_path - are set to None. - -- Issue #16518: Use 'bytes-like object required' in error messages that - previously used the far more cryptic "'x' does not support the buffer - protocol. - -- Issue #22470: Fixed integer overflow issues in "backslashreplace", - "xmlcharrefreplace", and "surrogatepass" error handlers. - -- Issue #22540: speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the - common case that the second argument has metaclass `type`. - -- Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` - but accepting a `va_list` argument. - -- Issue #22520: Fix overflow checking when generating the repr of a unicode - object. - -- Issue #22519: Fix overflow checking in PyBytes_Repr. - -- Issue #22518: Fix integer overflow issues in latin-1 encoding. - -- Issue #16324: _charset parameter of MIMEText now also accepts - email.charset.Charset instances. Initial patch by Claude Paroz. - -- Issue #1764286: Fix inspect.getsource() to support decorated functions. - Patch by Claudiu Popa. - -- Issue #18554: os.__all__ includes posix functions. - -- Issue #21391: Use os.path.abspath in the shutil module. - -- Issue #11471: avoid generating a JUMP_FORWARD instruction at the end of - an if-block if there is no else-clause. Original patch by Eugene Toder. - -- Issue #22215: Now ValueError is raised instead of TypeError when str or bytes - argument contains not permitted null character or byte. - -- Issue #22258: Fix the internal function set_inheritable() on Illumos. - This platform exposes the function ``ioctl(FIOCLEX)``, but calling it fails - with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() - now falls back to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``). - -- Issue #21389: Displaying the __qualname__ of the underlying function in the - repr of a bound method. - -- Issue #22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM - and returns -1 (error) on integer overflow. - -- Issue #20184: Argument Clinic based signature introspection added for - 30 of the builtin functions. - -- Issue #22116: C functions and methods (of the 'builtin_function_or_method' - type) can now be weakref'ed. Patch by Wei Wu. - -- Issue #22077: Improve index error messages for bytearrays, bytes, lists, - and tuples by adding 'or slices'. Added ', not ' for bytearrays. - Original patch by Claudiu Popa. - -- Issue #20179: Apply Argument Clinic to bytes and bytearray. - Patch by Tal Einat. - -- Issue #22082: Clear interned strings in slotdefs. - -- Upgrade Unicode database to Unicode 7.0.0. - -- Issue #21897: Fix a crash with the f_locals attribute with closure - variables when frame.clear() has been called. - -- Issue #21205: Add a new ``__qualname__`` attribute to generator, the - qualified name, and use it in the representation of a generator - (``repr(gen)``). The default name of the generator (``__name__`` attribute) - is now get from the function instead of the code. Use ``gen.gi_code.co_name`` - to get the name of the code. - -- Issue #21669: With the aid of heuristics in SyntaxError.__init__, the - parser now attempts to generate more meaningful (or at least more search - engine friendly) error messages when "exec" and "print" are used as - statements. - -- Issue #21642: In the conditional if-else expression, allow an integer written - with no space between itself and the ``else`` keyword (e.g. ``True if 42else - False``) to be valid syntax. - -- Issue #21523: Fix over-pessimistic computation of the stack effect of - some opcodes in the compiler. This also fixes a quadratic compilation - time issue noticeable when compiling code with a large number of "and" - and "or" operators. - -- Issue #21418: Fix a crash in the builtin function super() when called without - argument and without current frame (ex: embedded Python). - -- Issue #21425: Fix flushing of standard streams in the interactive - interpreter. - -- Issue #21435: In rare cases, when running finalizers on objects in cyclic - trash a bad pointer dereference could occur due to a subtle flaw in - internal iteration logic. - -- Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the - first argument has a reference count of 1. Patch by Nikolaus Rath. - -- Issue #20355: -W command line options now have higher priority than the - PYTHONWARNINGS environment variable. Patch by Arfrever. - -- Issue #21274: Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. - -- Issue #20904: Support setting FPU precision on m68k. - -- Issue #21209: Fix sending tuples to custom generator objects with the yield - from syntax. - -- Issue #21193: pow(a, b, c) now raises ValueError rather than TypeError when b - is negative. Patch by Josh Rosenberg. - -- PEP 465 and Issue #21176: Add the '@' operator for matrix multiplication. - -- Issue #21134: Fix segfault when str is called on an uninitialized - UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object. - -- Issue #19537: Fix PyUnicode_DATA() alignment under m68k. Patch by - Andreas Schwab. - -- Issue #20929: Add a type cast to avoid shifting a negative number. - -- Issue #20731: Properly position in source code files even if they - are opened in text mode. Patch by Serhiy Storchaka. - -- Issue #20637: Key-sharing now also works for instance dictionaries of - subclasses. Patch by Peter Ingebretson. - -- Issue #8297: Attributes missing from modules now include the module name - in the error text. Original patch by ysj.ray. - -- Issue #19995: %c, %o, %x, and %X now raise TypeError on non-integer input. - -- Issue #19655: The ASDL parser - used by the build process to generate code for - managing the Python AST in C - was rewritten. The new parser is self contained - and does not require to carry long the spark.py parser-generator library; - spark.py was removed from the source base. - -- Issue #12546: Allow ``\x00`` to be used as a fill character when using str, int, - float, and complex __format__ methods. - -- Issue #20480: Add ipaddress.reverse_pointer. Patch by Leon Weber. - -- Issue #13598: Modify string.Formatter to support auto-numbering of - replacement fields. It now matches the behavior of str.format() in - this regard. Patches by Phil Elson and Ramchandra Apte. - -- Issue #8931: Make alternate formatting ('#') for type 'c' raise an - exception. In versions prior to 3.5, '#' with 'c' had no effect. Now - specifying it is an error. Patch by Torsten Landschoff. - -- Issue #23165: Perform overflow checks before allocating memory in the - _Py_char2wchar function. - -Library -------- - -- Issue #23399: pyvenv creates relative symlinks where possible. - -- Issue #20289: cgi.FieldStorage() now supports the context management - protocol. - -- Issue #13128: Print response headers for CONNECT requests when debuglevel - > 0. Patch by Demian Brecht. - -- Issue #15381: Optimized io.BytesIO to make less allocations and copyings. - -- Issue #22818: Splitting on a pattern that could match an empty string now - raises a warning. Patterns that can only match empty strings are now - rejected. - -- Issue #23099: Closing io.BytesIO with exported buffer is rejected now to - prevent corrupting exported buffer. - -- Issue #23326: Removed __ne__ implementations. Since fixing default __ne__ - implementation in issue #21408 they are redundant. - -- Issue #23363: Fix possible overflow in itertools.permutations. - -- Issue #23364: Fix possible overflow in itertools.product. - -- Issue #23366: Fixed possible integer overflow in itertools.combinations. - -- Issue #23369: Fixed possible integer overflow in - _json.encode_basestring_ascii. - -- Issue #23353: Fix the exception handling of generators in - PyEval_EvalFrameEx(). At entry, save or swap the exception state even if - PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception state - is now always restored or swapped, not only if why is WHY_YIELD or - WHY_RETURN. Patch co-written with Antoine Pitrou. - -- Issue #14099: Restored support of writing ZIP files to tellable but - non-seekable streams. - -- Issue #14099: Writing to ZipFile and reading multiple ZipExtFiles is - threadsafe now. - -- Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError. - -- Issue #18518: timeit now rejects statements which can't be compiled outside - a function or a loop (e.g. "return" or "break"). - -- Issue #23094: Fixed readline with frames in Python implementation of pickle. - -- Issue #23268: Fixed bugs in the comparison of ipaddress classes. - -- Issue #21408: Removed incorrect implementations of __ne__() which didn't - returned NotImplemented if __eq__() returned NotImplemented. The default - __ne__() now works correctly. - -- Issue #19996: :class:`email.feedparser.FeedParser` now handles (malformed) - headers with no key rather than assuming the body has started. - -- Issue #20188: Support Application-Layer Protocol Negotiation (ALPN) in the ssl - module. - -- Issue #23133: Pickling of ipaddress objects now produces more compact and - portable representation. - -- Issue #23248: Update ssl error codes from latest OpenSSL git master. - -- Issue #23266: Much faster implementation of ipaddress.collapse_addresses() - when there are many non-consecutive addresses. - -- Issue #23098: 64-bit dev_t is now supported in the os module. - -- Issue #21817: When an exception is raised in a task submitted to a - ProcessPoolExecutor, the remote traceback is now displayed in the - parent process. Patch by Claudiu Popa. - -- Issue #15955: Add an option to limit output size when decompressing LZMA - data. Patch by Nikolaus Rath and Martin Panter. - -- Issue #23250: In the http.cookies module, capitalize "HttpOnly" and "Secure" - as they are written in the standard. - -- Issue #23063: In the disutils' check command, fix parsing of reST with code or - code-block directives. - -- Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a - RuntimeError if the selector is closed. And selectors.BaseSelector.close() - now clears its internal reference to the selector mapping to break a - reference cycle. Initial patch written by Martin Richard. - -- Issue #17911: Provide a way to seed the linecache for a PEP-302 module - without actually loading the code. - -- Issue #17911: Provide a new object API for traceback, including the ability - to not lookup lines at all until the traceback is actually rendered, without - any trace of the original objects being kept alive. - -- Issue #19777: Provide a home() classmethod on Path objects. Contributed - by Victor Salgado and Mayank Tripathi. - -- Issue #23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the - default case of ``ensure_ascii=True``. Patch by Naoki Inada. - -- Issue #23185: Add math.inf and math.nan constants. - -- Issue #23186: Add ssl.SSLObject.shared_ciphers() and - ssl.SSLSocket.shared_ciphers() to fetch the client's list ciphers sent at - handshake. - -- Issue #23143: Remove compatibility with OpenSSLs older than 0.9.8. - -- Issue #23132: Improve performance and introspection support of comparison - methods created by functool.total_ordering. - -- Issue #19776: Add an expanduser() method on Path objects. - -- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and - fragment when it redirects to add a trailing slash. - -- Issue #21793: Added http.HTTPStatus enums (i.e. HTTPStatus.OK, - HTTPStatus.NOT_FOUND). Patch by Demian Brecht. - -- Issue #23093: In the io, module allow more operations to work on detached - streams. - -- Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol - version. - -- Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), - instead of reading /dev/urandom, to get pseudo-random bytes. - -- Issue #19104: pprint now produces evaluable output for wrapped strings. - -- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. - -- Issue #22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX - opcode if possible. - -- Issue #15513: Added a __sizeof__ implementation for pickle classes. - -- Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can - produce more compact result and no longer produces invalid output if input - data contains MEMOIZE opcodes together with PUT or BINPUT opcodes. - -- Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port - value in the host header was set to "None". Patch by Demian Brecht. - -- Issue #23016: A warning no longer produces an AttributeError when the program - is run with pythonw.exe. - -- Issue #21775: shutil.copytree(): fix crash when copying to VFAT. An exception - handler assumed that OSError objects always have a 'winerror' attribute. - That is not the case, so the exception handler itself raised AttributeError - when run on Linux (and, presumably, any other non-Windows OS). - Patch by Greg Ward. - -- Issue #1218234: Fix inspect.getsource() to load updated source of - reloaded module. Initial patch by Berker Peksag. - -- Issue #21740: Support wrapped callables in doctest. Patch by Claudiu Popa. - -- Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no - FD is registered. - -- Issue #22959: In the constructor of http.client.HTTPSConnection, prefer the - context's check_hostname attribute over the *check_hostname* parameter. - -- Issue #22696: Add function :func:`sys.is_finalizing` to know about - interpreter shutdown. - -- Issue #16043: Add a default limit for the amount of data xmlrpclib.gzip_decode - will return. This resolves CVE-2013-1753. - -- Issue #14099: ZipFile.open() no longer reopen the underlying file. Objects - returned by ZipFile.open() can now operate independently of the ZipFile even - if the ZipFile was created by passing in a file-like object as the first - argument to the constructor. - -- Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is - asked to compile a source file containing multiple dots in the source file - name. - -- Issue #21971: Update turtledemo doc and add module to the index. - -- Issue #21032: Fixed socket leak if HTTPConnection.getresponse() fails. - Original patch by Martin Panter. - -- Issue #22407: Deprecated the use of re.LOCALE flag with str patterns or - re.ASCII. It was newer worked. - -- Issue #22902: The "ip" command is now used on Linux to determine MAC address - in uuid.getnode(). Pach by Bruno Cauet. - -- Issue #22960: Add a context argument to xmlrpclib.ServerProxy constructor. - -- Issue #22389: Add contextlib.redirect_stderr(). - -- Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The - availability of the function is checked during the compilation. Patch written - by Bernard Spil. - -- Issue #22915: SAX parser now supports files opened with file descriptor or - bytes path. - -- Issue #22609: Constructors and update methods of mapping classes in the - collections module now accept the self keyword argument. - -- Issue #22940: Add readline.append_history_file. - -- Issue #19676: Added the "namereplace" error handler. - -- Issue #22788: Add *context* parameter to logging.handlers.HTTPHandler. - -- Issue #22921: Allow SSLContext to take the *hostname* parameter even if - OpenSSL doesn't support SNI. - -- Issue #22894: TestCase.subTest() would cause the test suite to be stopped - when in failfast mode, even in the absence of failures. - -- Issue #22796: HTTP cookie parsing is now stricter, in order to protect - against potential injection attacks. - -- Issue #22370: Windows detection in pathlib is now more robust. - -- Issue #22841: Reject coroutines in asyncio add_signal_handler(). - Patch by Ludovic.Gasc. - -- Issue #19494: Added urllib.request.HTTPBasicPriorAuthHandler. Patch by - Matej Cepl. - -- Issue #22578: Added attributes to the re.error class. - -- Issue #22849: Fix possible double free in the io.TextIOWrapper constructor. - -- Issue #12728: Different Unicode characters having the same uppercase but - different lowercase are now matched in case-insensitive regular expressions. - -- Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian - platforms. - -- Issue #21650: Add an `--sort-keys` option to json.tool CLI. - -- Issue #22824: Updated reprlib output format for sets to use set literals. - Patch contributed by Berker Peksag. - -- Issue #22824: Updated reprlib output format for arrays to display empty - arrays without an unnecessary empty list. Suggested by Serhiy Storchaka. - -- Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x. - Based on patch by Martin Panter. - -- Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat. - Based on patch by Aivars Kalv?ns. - -- Issue #22769: Fixed ttk.Treeview.tag_has() when called without arguments. - -- Issue #22417: Verify certificates by default in httplib (PEP 476). - -- Issue #22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2 - and above. Patch by Tim Graham. - -- Issue #22776: Brought excluded code into the scope of a try block in - SysLogHandler.emit(). - -- Issue #22665: Add missing get_terminal_size and SameFileError to - shutil.__all__. - -- Issue #6623: Remove deprecated Netrc class in the ftplib module. Patch by - Matt Chaput. - -- Issue #17381: Fixed handling of case-insensitive ranges in regular - expressions. - -- Issue #22410: Module level functions in the re module now cache compiled - locale-dependent regular expressions taking into account the locale. - -- Issue #22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) - now return False when the underlying stat call raises NotADirectoryError. - -- Issue #8876: distutils now falls back to copying files when hard linking - doesn't work. This allows use with special filesystems such as VirtualBox - shared folders. - -- Issue #22217: Implemented reprs of classes in the zipfile module. - -- Issue #22457: Honour load_tests in the start_dir of discovery. - -- Issue #18216: gettext now raises an error when a .mo file has an - unsupported major version number. Patch by Aaron Hill. - -- Issue #13918: Provide a locale.delocalize() function which can remove - locale-specific number formatting from a string representing a number, - without then converting it to a specific type. Patch by C?dric Krier. - -- Issue #22676: Make the pickling of global objects which don't have a - __module__ attribute less slow. - -- Issue #18853: Fixed ResourceWarning in shlex.__nain__. - -- Issue #9351: Defaults set with set_defaults on an argparse subparser - are no longer ignored when also set on the parent parser. - -- Issue #7559: unittest test loading ImportErrors are reported as import errors - with their import exception rather than as attribute errors after the import - has already failed. - -- Issue #19746: Make it possible to examine the errors from unittest - discovery without executing the test suite. The new `errors` attribute - on TestLoader exposes these non-fatal errors encountered during discovery. - -- Issue #21991: Make email.headerregistry's header 'params' attributes - be read-only (MappingProxyType). Previously the dictionary was modifiable - but a new one was created on each access of the attribute. - -- Issue #22638: SSLv3 is now disabled throughout the standard library. - It can still be enabled by instantiating a SSLContext manually. - -- Issue #22641: In asyncio, the default SSL context for client connections - is now created using ssl.create_default_context(), for stronger security. - -- Issue #17401: Include closefd in io.FileIO repr. - -- Issue #21338: Add silent mode for compileall. quiet parameters of - compile_{dir, file, path} functions now have a multilevel value. Also, - -q option of the CLI now have a multilevel value. Patch by Thomas Kluyver. - -- Issue #20152: Convert the array and cmath modules to Argument Clinic. - -- Issue #18643: Add socket.socketpair() on Windows. - -- Issue #22435: Fix a file descriptor leak when socketserver bind fails. - -- Issue #13096: Fixed segfault in CTypes POINTER handling of large - values. - -- Issue #11694: Raise ConversionError in xdrlib as documented. Patch - by Filip Gruszczy?ski and Claudiu Popa. - -- Issue #19380: Optimized parsing of regular expressions. - -- Issue #1519638: Now unmatched groups are replaced with empty strings in re.sub() - and re.subn(). - -- Issue #18615: sndhdr.what/whathdr now return a namedtuple. - -- Issue #22462: Fix pyexpat's creation of a dummy frame to make it - appear in exception tracebacks. - -- Issue #21965: Add support for in-memory SSL to the ssl module. Patch - by Geert Jansen. - -- Issue #21173: Fix len() on a WeakKeyDictionary when .clear() was called - with an iterator alive. - -- Issue #11866: Eliminated race condition in the computation of names - for new threads. - -- Issue #21905: Avoid RuntimeError in pickle.whichmodule() when sys.modules - is mutated while iterating. Patch by Olivier Grisel. - -- Issue #11271: concurrent.futures.Executor.map() now takes a *chunksize* - argument to allow batching of tasks in child processes and improve - performance of ProcessPoolExecutor. Patch by Dan O'Reilly. - -- Issue #21883: os.path.join() and os.path.relpath() now raise a TypeError with - more helpful error message for unsupported or mismatched types of arguments. - -- Issue #22219: The zipfile module CLI now adds entries for directories - (including empty directories) in ZIP file. - -- Issue #22449: In the ssl.SSLContext.load_default_certs, consult the - environmental variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. - -- Issue #22508: The email.__version__ variable has been removed; the email - code is no longer shipped separately from the stdlib, and __version__ - hasn't been updated in several releases. - -- Issue #20076: Added non derived UTF-8 aliases to locale aliases table. - -- Issue #20079: Added locales supported in glibc 2.18 to locale alias table. - -- Issue #20218: Added convenience methods read_text/write_text and read_bytes/ - write_bytes to pathlib.Path objects. - -- Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor - os.posix_fallocate() because their prototypes in system headers are wrong. - -- Issue #22517: When an io.BufferedRWPair object is deallocated, clear its - weakrefs. - -- Issue #22437: Number of capturing groups in regular expression is no longer - limited by 100. - -- Issue #17442: InteractiveInterpreter now displays the full chained traceback - in its showtraceback method, to match the built in interactive interpreter. - -- Issue #23392: Added tests for marshal C API that works with FILE*. - - -- Issue #10510: distutils register and upload methods now use HTML standards - compliant CRLF line endings. - -- Issue #9850: Fixed macpath.join() for empty first component. Patch by - Oleg Oshmyan. - -- Issue #5309: distutils' build and build_ext commands now accept a ``-j`` - option to enable parallel building of extension modules. - -- Issue #22448: Improve canceled timer handles cleanup to prevent - unbound memory usage. Patch by Joshua Moore-Oliva. - -- Issue #22427: TemporaryDirectory no longer attempts to clean up twice when - used in the with statement in generator. - -- Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in - regular expressions. - -- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS - directory attributes. - -- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory - records if allowZip64 is false. - -- Issue #22278: Fix urljoin problem with relative urls, a regression observed - after changes to issue22118 were submitted. - -- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re - module. Removed trailing spaces in debugging output. - -- Issue #22423: Unhandled exception in thread no longer causes unhandled - AttributeError when sys.stderr is None. - -- Issue #21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects - line buffering, rather than block buffering. Patch by Akira Li. - -- Issue #21091: Fix API bug: email.message.EmailMessage.is_attachment is now - a method. - -- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the - correct result when the header has parameters as well as a value. - -- Issue #22247: Add NNTPError to nntplib.__all__. - -- Issue #22366: urllib.request.urlopen will accept a context object - (SSLContext) as an argument which will then be used for HTTPS connection. - Patch by Alex Gaynor. - -- Issue #4180: The warnings registries are now reset when the filters - are modified. - -- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to - 65536 bytes and send a 414 error code for higher lengths. Patch contributed - by Devin Cook. - -- Lax cookie parsing in http.cookies could be a security issue when combined - with non-standard cookie handling in some Web browsers. Reported by - Sergey Bobrov. - -- Issue #20537: logging methods now accept an exception instance as well as a - Boolean value or exception tuple. Thanks to Yury Selivanov for the patch. - -- Issue #22384: An exception in Tkinter callback no longer crashes the program - when it is run with pythonw.exe. - -- Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X. - -- Issue #21147: sqlite3 now raises an exception if the request contains a null - character instead of truncating it. Based on patch by Victor Stinner. - -- Issue #13968: The glob module now supports recursive search in - subdirectories using the ``**`` pattern. - -- Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with - empty string or tuple argument. - -- Issue #21951: Tkinter now most likely raises MemoryError instead of crash - if the memory allocation fails. - -- Issue #22338: Fix a crash in the json module on memory allocation failure. - -- Issue #12410: imaplib.IMAP4 now supports the context management protocol. - Original patch by Tarek Ziad?. - -- Issue #21270: We now override tuple methods in mock.call objects so that - they can be used as normal call attributes. - -- Issue #16662: load_tests() is now unconditionally run when it is present in - a package's __init__.py. TestLoader.loadTestsFromModule() still accepts - use_load_tests, but it is deprecated and ignored. A new keyword-only - attribute `pattern` is added and documented. Patch given by Robert Collins, - tweaked by Barry Warsaw. - -- Issue #22226: First letter no longer is stripped from the "status" key in - the result of Treeview.heading(). - -- Issue #19524: Fixed resource leak in the HTTP connection when an invalid - response is received. Patch by Martin Panter. - -- Issue #20421: Add a .version() method to SSL sockets exposing the actual - protocol version in use. - -- Issue #19546: configparser exceptions no longer expose implementation details. - Chained KeyErrors are removed, which leads to cleaner tracebacks. Patch by - Claudiu Popa. - -- Issue #22051: turtledemo no longer reloads examples to re-run them. - Initialization of variables and gui setup should be done in main(), - which is called each time a demo is run, but not on import. - -- Issue #21933: Turtledemo users can change the code font size with a menu - selection or control(command) '-' or '+' or control-mousewheel. - Original patch by Lita Cho. - -- Issue #21597: The separator between the turtledemo text pane and the drawing - canvas can now be grabbed and dragged with a mouse. The code text pane can - be widened to easily view or copy the full width of the text. The canvas - can be widened on small screens. Original patches by Jan Kanis and Lita Cho. - -- Issue #18132: Turtledemo buttons no longer disappear when the window is - shrunk. Original patches by Jan Kanis and Lita Cho. - -- Issue #22043: time.monotonic() is now always available. - ``threading.Lock.acquire()``, ``threading.RLock.acquire()`` and socket - operations now use a monotonic clock, instead of the system clock, when a - timeout is used. - -- Issue #21527: Add a default number of workers to ThreadPoolExecutor equal - to 5 times the number of CPUs. Patch by Claudiu Popa. - -- Issue #22216: smtplib now resets its state more completely after a quit. The - most obvious consequence of the previous behavior was a STARTTLS failure - during a connect/starttls/quit/connect/starttls sequence. - -- Issue #22098: ctypes' BigEndianStructure and LittleEndianStructure now - define an empty __slots__ so that subclasses don't always get an instance - dict. Patch by Claudiu Popa. - -- Issue #22185: Fix an occasional RuntimeError in threading.Condition.wait() - caused by mutation of the waiters queue without holding the lock. Patch - by Doug Zongker. - -- Issue #22287: On UNIX, _PyTime_gettimeofday() now uses - clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now - depends on the librt library on Solaris and on Linux (only with glibc older - than 2.17). - -- Issue #22182: Use e.args to unpack exceptions correctly in - distutils.file_util.move_file. Patch by Claudiu Popa. - -- The webbrowser module now uses subprocess's start_new_session=True rather - than a potentially risky preexec_fn=os.setsid call. - -- Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file - descriptor is in blocking mode. - -- Issue #16808: inspect.stack() now returns a named tuple instead of a tuple. - Patch by Daniel Shahaf. - -- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode. - -- Issue #2527: Add a *globals* argument to timeit functions, in order to - override the globals namespace in which the timed code is executed. - Patch by Ben Roberts. - -- Issue #22118: Switch urllib.parse to use RFC 3986 semantics for the - resolution of relative URLs, rather than RFCs 1808 and 2396. - Patch by Demian Brecht. - -- Issue #21549: Added the "members" parameter to TarFile.list(). - -- Issue #19628: Allow compileall recursion depth to be specified with a -r - option. - -- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. - -- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter. - -- Issue #22165: SimpleHTTPRequestHandler now supports undecodable file names. - -- Issue #15381: Optimized line reading in io.BytesIO. - -- Issue #8797: Raise HTTPError on failed Basic Authentication immediately. - Initial patch by Sam Bull. - -- Issue #20729: Restored the use of lazy iterkeys()/itervalues()/iteritems() - in the mailbox module. - -- Issue #21448: Changed FeedParser feed() to avoid O(N**2) behavior when - parsing long line. Original patch by Raymond Hettinger. - -- Issue #22184: The functools LRU Cache decorator factory now gives an earlier - and clearer error message when the user forgets the required parameters. - -- Issue #17923: glob() patterns ending with a slash no longer match non-dirs on - AIX. Based on patch by Delhallt. - -- Issue #21725: Added support for RFC 6531 (SMTPUTF8) in smtpd. - -- Issue #22176: Update the ctypes module's libffi to v3.1. This release - adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian - architectures. - -- Issue #5411: Added support for the "xztar" format in the shutil module. - -- Issue #21121: Don't force 3rd party C extensions to be built with - -Werror=declaration-after-statement. - -- Issue #21975: Fixed crash when using uninitialized sqlite3.Row (in particular - when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the - __new__() method. - -- Issue #20170: Convert posixmodule to use Argument Clinic. - -- Issue #21539: Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic - `mkdir -p` and `os.makedirs()` functionality. When true, ignore - FileExistsErrors. Patch by Berker Peksag. - -- Issue #22127: Bypass IDNA for pure-ASCII host names in the socket module - (in particular for numeric IPs). - -- Issue #21047: set the default value for the *convert_charrefs* argument - of HTMLParser to True. Patch by Berker Peksag. - -- Add an __all__ to html.entities. - -- Issue #15114: the strict mode and argument of HTMLParser, HTMLParser.error, - and the HTMLParserError exception have been removed. - -- Issue #22085: Dropped support of Tk 8.3 in Tkinter. - -- Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk. - In particular this allows initializing images from binary data. - -- Issue #22003: When initialized from a bytes object, io.BytesIO() now - defers making a copy until it is mutated, improving performance and - memory use on some use cases. Patch by David Wilson. - -- Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets. - A side effect is that Python depends to the WinSock library. - -- Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get - and set the blocking mode of a file descriptor (False if the O_NONBLOCK flag - is set, True otherwise). These functions are not available on Windows. - -- Issue #17172: Make turtledemo start as active on OS X even when run with - subprocess. Patch by Lita Cho. - -- Issue #21704: Fix build error for _multiprocessing when semaphores - are not available. Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #20173: Convert sha1, sha256, sha512 and md5 to ArgumentClinic. - Patch by Vajrasky Kok. - -- Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError - on closed socket. repr(socket.socket) already works fine. - -- Issue #22033: Reprs of most Python implemened classes now contain actual - class name instead of hardcoded one. - -- Issue #21947: The dis module can now disassemble generator-iterator - objects based on their gi_code attribute. Patch by Clement Rouault. - -- Issue #16133: The asynchat.async_chat.handle_read() method now ignores - BlockingIOError exceptions. - -- Issue #22044: Fixed premature DECREF in call_tzinfo_method. - Patch by Tom Flanagan. - -- Issue #19884: readline: Disable the meta modifier key if stdout is not - a terminal to not write the ANSI sequence ``"\033[1034h"`` into stdout. This - sequence is used on some terminal (ex: TERM=xterm-256color") to enable - support of 8 bit characters. - -- Issue #4350: Removed a number of out-of-dated and non-working for a long time - Tkinter methods. - -- Issue #6167: Scrollbar.activate() now returns the name of active element if - the argument is not specified. Scrollbar.set() now always accepts only 2 - arguments. - -- Issue #15275: Clean up and speed up the ntpath module. - -- Issue #21888: plistlib's load() and loads() now work if the fmt parameter is - specified. - -- Issue #22032: __qualname__ instead of __name__ is now always used to format - fully qualified class names of Python implemented classes. - -- Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix - when contain an id in form " at 0x...". - -- Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a - ValueError on ``fstat()`` failure. - -- Issue #21044: tarfile.open() now handles fileobj with an integer 'name' - attribute. Based on patch by Antoine Pietri. - -- Issue #21966: Respect -q command-line option when code module is ran. - -- Issue #19076: Don't pass the redundant 'file' argument to self.error(). - -- Issue #16382: Improve exception message of warnings.warn() for bad - category. Initial patch by Phil Elson. - -- Issue #21932: os.read() now uses a :c:func:`Py_ssize_t` type instead of - :c:type:`int` for the size to support reading more than 2 GB at once. On - Windows, the size is truncted to INT_MAX. As any call to os.read(), the OS - may read less bytes than the number of requested bytes. - -- Issue #21942: Fixed source file viewing in pydoc's server mode on Windows. - -- Issue #11259: asynchat.async_chat().set_terminator() now raises a ValueError - if the number of received bytes is negative. - -- Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't - get a bytes string - -- Issue #21707: Add missing kwonlyargcount argument to - ModuleFinder.replace_paths_in_code(). - -- Issue #20639: calling Path.with_suffix('') allows removing the suffix - again. Patch by July Tikhonov. - -- Issue #21714: Disallow the construction of invalid paths using - Path.with_name(). Original patch by Antony Lee. - -- Issue #15014: Added 'auth' method to smtplib to make implementing auth - mechanisms simpler, and used it internally in the login method. - -- Issue #21151: Fixed a segfault in the winreg module when ``None`` is passed - as a ``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. - -- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before, - it ignored I/O errors if at least the first C call read() succeed. - -- Issue #5800: headers parameter of wsgiref.headers.Headers is now optional. - Initial patch by Pablo Torres Navarrete and SilentGhost. - -- Issue #21781: ssl.RAND_add() now supports strings longer than 2 GB. - -- Issue #21679: Prevent extraneous fstat() calls during open(). Patch by - Bohuslav Kabrda. - -- Issue #21863: cProfile now displays the module name of C extension functions, - in addition to their own name. - -- Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper - object is destroyed. The destructor now closes the file if needed. The - close() method can now be called twice: the second call does nothing. - -- Issue #21858: Better handling of Python exceptions in the sqlite3 module. - -- Issue #21476: Make sure the email.parser.BytesParser TextIOWrapper is - discarded after parsing, so the input file isn't unexpectedly closed. - -- Issue #20295: imghdr now recognizes OpenEXR format images. - -- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure - files closing. Patch by Claudiu Popa. - -- Issue #21491: socketserver: Fix a race condition in child processes reaping. - -- Issue #21719: Added the ``st_file_attributes`` field to os.stat_result on - Windows. - -- Issue #21832: Require named tuple inputs to be exact strings. - -- Issue #21722: The distutils "upload" command now exits with a non-zero - return code when uploading fails. Patch by Martin Dengler. - -- Issue #21723: asyncio.Queue: support any type of number (ex: float) for the - maximum size. Patch written by Vajrasky Kok. - -- Issue #21711: support for "site-python" directories has now been removed - from the site module (it was deprecated in 3.4). - -- Issue #17552: new socket.sendfile() method allowing a file to be sent over a - socket by using high-performance os.sendfile() on UNIX. - Patch by Giampaolo Rodola'. - -- Issue #18039: dbm.dump.open() now always creates a new database when the - flag has the value 'n'. Patch by Claudiu Popa. - -- Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoop. - run_forever() and run_until_complete() methods of asyncio.BaseEventLoop now - raise an exception if the event loop was closed. - -- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths - before checking for a CGI script at that path. - -- Issue #21310: Fixed possible resource leak in failed open(). - -- Issue #21256: Printout of keyword args should be in deterministic order in - a mock function call. This will help to write better doctests. - -- Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. - -- Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a - valid file. - -- Issue #21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. - -- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods - that use 'self' in the example code is generated correctly. - -- Issue #21463: In urllib.request, fix pruning of the FTP cache. - -- Issue #21618: The subprocess module could fail to close open fds that were - inherited by the calling process and already higher than POSIX resource - limits would otherwise allow. On systems with a functioning /proc/self/fd - or /dev/fd interface the max is now ignored and all fds are closed. - -- Issue #20383: Introduce importlib.util.module_from_spec() as the preferred way - to create a new module. - -- Issue #21552: Fixed possible integer overflow of too long string lengths in - the tkinter module on 64-bit platforms. - -- Issue #14315: The zipfile module now ignores extra fields in the central - directory that are too short to be parsed instead of letting a struct.unpack - error bubble up as this "bad data" appears in many real world zip files in - the wild and is ignored by other zip tools. - -- Issue #13742: Added "key" and "reverse" parameters to heapq.merge(). - (First draft of patch contributed by Simon Sapin.) - -- Issue #21402: tkinter.ttk now works when default root window is not set. - -- Issue #3015: _tkinter.create() now creates tkapp object with wantobject=1 by - default. - -- Issue #10203: sqlite3.Row now truly supports sequence protocol. In particular - it supports reverse() and negative indices. Original patch by Claudiu Popa. - -- Issue #18807: If copying (no symlinks) specified for a venv, then the python - interpreter aliases (python, python3) are now created by copying rather than - symlinking. - -- Issue #20197: Added support for the WebP image type in the imghdr module. - Patch by Fabrice Aneche and Claudiu Popa. - -- Issue #21513: Speedup some properties of IP addresses (IPv4Address, - IPv6Address) such as .is_private or .is_multicast. - -- Issue #21137: Improve the repr for threading.Lock() and its variants - by showing the "locked" or "unlocked" status. Patch by Berker Peksag. - -- Issue #21538: The plistlib module now supports loading of binary plist files - when reference or offset size is not a power of two. - -- Issue #21455: Add a default backlog to socket.listen(). - -- Issue #21525: Most Tkinter methods which accepted tuples now accept lists too. - -- Issue #22166: With the assistance of a new internal _codecs._forget_codec - helping function, test_codecs now clears the encoding caches to avoid the - appearance of a reference leak - -- Issue #22236: Tkinter tests now don't reuse default root window. New root - window is created for every test class. - -- Issue #10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial - shape. - -- Issue #20826: Optimize ipaddress.collapse_addresses(). - -- Issue #21487: Optimize ipaddress.summarize_address_range() and - ipaddress.{IPv4Network,IPv6Network}.subnets(). - -- Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and - ipaddress.IPv6Network. - -- Issue #13916: Disallowed the surrogatepass error handler for non UTF-\* - encodings. - -- Issue #20998: Fixed re.fullmatch() of repeated single character pattern - with ignore case. Original patch by Matthew Barnett. - -- Issue #21075: fileinput.FileInput now reads bytes from standard stream if - binary mode is specified. Patch by Sam Kimbrel. - -- Issue #19775: Add a samefile() method to pathlib Path objects. Initial - patch by Vajrasky Kok. - -- Issue #21226: Set up modules properly in PyImport_ExecCodeModuleObject - (and friends). - -- Issue #21398: Fix a unicode error in the pydoc pager when the documentation - contains characters not encodable to the stdout encoding. - -- Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept - an (address, netmask) tuple argument, so as to easily construct network - objects from existing addresses. - -- Issue #21156: importlib.abc.InspectLoader.source_to_code() is now a - staticmethod. - -- Issue #21424: Simplified and optimized heaqp.nlargest() and nmsmallest() - to make fewer tuple comparisons. - -- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a - flush() on the underlying binary stream. Patch by akira. - -- Issue #18314: Unlink now removes junctions on Windows. Patch by Kim Gr?sman - -- Issue #21088: Bugfix for curses.window.addch() regression in 3.4.0. - In porting to Argument Clinic, the first two arguments were reversed. - -- Issue #21407: _decimal: The module now supports function signatures. - -- Issue #10650: Remove the non-standard 'watchexp' parameter from the - Decimal.quantize() method in the Python version. It had never been - present in the C version. - -- Issue #21469: Reduced the risk of false positives in robotparser by - checking to make sure that robots.txt has been read or does not exist - prior to returning True in can_fetch(). - -- Issue #19414: Have the OrderedDict mark deleted links as unusable. - This gives an early failure if the link is deleted during iteration. - -- Issue #21421: Add __slots__ to the MappingViews ABC. - Patch by Josh Rosenberg. - -- Issue #21101: Eliminate double hashing in the C speed-up code for - collections.Counter(). - -- Issue #21321: itertools.islice() now releases the reference to the source - iterator when the slice is exhausted. Patch by Anton Afanasyev. - -- Issue #21057: TextIOWrapper now allows the underlying binary stream's - read() or read1() method to return an arbitrary bytes-like object - (such as a memoryview). Patch by Nikolaus Rath. - -- Issue #20951: SSLSocket.send() now raises either SSLWantReadError or - SSLWantWriteError on a non-blocking socket if the operation would block. - Previously, it would return 0. Patch by Nikolaus Rath. - -- Issue #13248: removed previously deprecated asyncore.dispatcher __getattr__ - cheap inheritance hack. - -- Issue #9815: assertRaises now tries to clear references to local variables - in the exception's traceback. - -- Issue #19940: ssl.cert_time_to_seconds() now interprets the given time - string in the UTC timezone (as specified in RFC 5280), not the local - timezone. - -- Issue #13204: Calling sys.flags.__new__ would crash the interpreter, - now it raises a TypeError. - -- Issue #19385: Make operations on a closed dbm.dumb database always raise the - same exception. - -- Issue #21207: Detect when the os.urandom cached fd has been closed or - replaced, and open it anew. - -- Issue #21291: subprocess's Popen.wait() is now thread safe so that - multiple threads may be calling wait() or poll() on a Popen instance - at the same time without losing the Popen.returncode value. - -- Issue #21127: Path objects can now be instantiated from str subclass - instances (such as ``numpy.str_``). - -- Issue #15002: urllib.response object to use _TemporaryFileWrapper (and - _TemporaryFileCloser) facility. Provides a better way to handle file - descriptor close. Patch contributed by Christian Theune. - -- Issue #12220: mindom now raises a custom ValueError indicating it doesn't - support spaces in URIs instead of letting a 'split' ValueError bubble up. - -- Issue #21068: The ssl.PROTOCOL* constants are now enum members. - -- Issue #21276: posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. - -- Issue #21262: New method assert_not_called for Mock. - It raises AssertionError if the mock has been called. - -- Issue #21238: New keyword argument `unsafe` to Mock. It raises - `AttributeError` incase of an attribute startswith assert or assret. - -- Issue #20896: ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not - PROTOCOL_SSLv3, for maximum compatibility. - -- Issue #21239: patch.stopall() didn't work deterministically when the same - name was patched more than once. - -- Issue #21203: Updated fileConfig and dictConfig to remove inconsistencies. - Thanks to Jure Koren for the patch. - -- Issue #21222: Passing name keyword argument to mock.create_autospec now - works. - -- Issue #21197: Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. - -- Issue #17498: Some SMTP servers disconnect after certain errors, violating - strict RFC conformance. Instead of losing the error code when we issue the - subsequent RSET, smtplib now returns the error code and defers raising the - SMTPServerDisconnected error until the next command is issued. - -- Issue #17826: setting an iterable side_effect on a mock function created by - create_autospec now works. Patch by Kushal Das. - -- Issue #7776: Fix ``Host:`` header and reconnection when using - http.client.HTTPConnection.set_tunnel(). Patch by Nikolaus Rath. - -- Issue #20968: unittest.mock.MagicMock now supports division. - Patch by Johannes Baiter. - -- Issue #21529 (CVE-2014-4616): Fix arbitrary memory access in - JSONDecoder.raw_decode with a negative second parameter. Bug reported by Guido - Vranken. - -- Issue #21169: getpass now handles non-ascii characters that the - input stream encoding cannot encode by re-encoding using the - replace error handler. - -- Issue #21171: Fixed undocumented filter API of the rot13 codec. - Patch by Berker Peksag. - -- Issue #20539: Improved math.factorial error message for large positive inputs - and changed exception type (OverflowError -> ValueError) for large negative - inputs. - -- Issue #21172: isinstance check relaxed from dict to collections.Mapping. - -- Issue #21155: asyncio.EventLoop.create_unix_server() now raises a ValueError - if path and sock are specified at the same time. - -- Issue #21136: Avoid unnecessary normalization of Fractions resulting from - power and other operations. Patch by Raymond Hettinger. - -- Issue #17621: Introduce importlib.util.LazyLoader. - -- Issue #21076: signal module constants were turned into enums. - Patch by Giampaolo Rodola'. - -- Issue #20636: Improved the repr of Tkinter widgets. - -- Issue #19505: The items, keys, and values views of OrderedDict now support - reverse iteration using reversed(). - -- Issue #21149: Improved thread-safety in logging cleanup during interpreter - shutdown. Thanks to Devin Jeanpierre for the patch. - -- Issue #21058: Fix a leak of file descriptor in - :func:`tempfile.NamedTemporaryFile`, close the file descriptor if - :func:`io.open` fails - -- Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing. - -- Issue #21013: Enhance ssl.create_default_context() when used for server side - sockets to provide better security by default. - -- Issue #20145: `assertRaisesRegex` and `assertWarnsRegex` now raise a - TypeError if the second argument is not a string or compiled regex. - -- Issue #20633: Replace relative import by absolute import. - -- Issue #20980: Stop wrapping exception when using ThreadPool. - -- Issue #21082: In os.makedirs, do not set the process-wide umask. Note this - changes behavior of makedirs when exist_ok=True. - -- Issue #20990: Fix issues found by pyflakes for multiprocessing. - -- Issue #21015: SSL contexts will now automatically select an elliptic - curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise - default to "prime256v1". - -- Issue #21000: Improve the command-line interface of json.tool. - -- Issue #20995: Enhance default ciphers used by the ssl module to enable - better security and prioritize perfect forward secrecy. - -- Issue #20884: Don't assume that __file__ is defined on importlib.__init__. - -- Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests. - -- Issue #20627: xmlrpc.client.ServerProxy is now a context manager. - -- Issue #19165: The formatter module now raises DeprecationWarning instead of - PendingDeprecationWarning. - -- Issue #13936: Remove the ability of datetime.time instances to be considered - false in boolean contexts. - -- Issue #18931: selectors module now supports /dev/poll on Solaris. - Patch by Giampaolo Rodola'. - -- Issue #19977: When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), - :py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the - ``surrogateescape`` error handler, instead of the ``strict`` error handler. - -- Issue #20574: Implement incremental decoder for cp65001 code (Windows code - page 65001, Microsoft UTF-8). - -- Issue #20879: Delay the initialization of encoding and decoding tables for - base32, ascii85 and base85 codecs in the base64 module, and delay the - initialization of the unquote_to_bytes() table of the urllib.parse module, to - not waste memory if these modules are not used. - -- Issue #19157: Include the broadcast address in the usuable hosts for IPv6 - in ipaddress. - -- Issue #11599: When an external command (e.g. compiler) fails, distutils now - prints out the whole command line (instead of just the command name) if the - environment variable DISTUTILS_DEBUG is set. - -- Issue #4931: distutils should not produce unhelpful "error: None" messages - anymore. distutils.util.grok_environment_error is kept but doc-deprecated. - -- Issue #20875: Prevent possible gzip "'read' is not defined" NameError. - Patch by Claudiu Popa. - -- Issue #11558: ``email.message.Message.attach`` now returns a more - useful error message if ``attach`` is called on a message for which - ``is_multipart`` is False. - -- Issue #20283: RE pattern methods now accept the string keyword parameters - as documented. The pattern and source keyword parameters are left as - deprecated aliases. - -- Issue #20778: Fix modulefinder to work with bytecode-only modules. - -- Issue #20791: copy.copy() now doesn't make a copy when the input is - a bytes object. Initial patch by Peter Otten. - -- Issue #19748: On AIX, time.mktime() now raises an OverflowError for year - outsize range [1902; 2037]. - -- Issue #19573: inspect.signature: Use enum for parameter kind constants. - -- Issue #20726: inspect.signature: Make Signature and Parameter picklable. - -- Issue #17373: Add inspect.Signature.from_callable method. - -- Issue #20378: Improve repr of inspect.Signature and inspect.Parameter. - -- Issue #20816: Fix inspect.getcallargs() to raise correct TypeError for - missing keyword-only arguments. Patch by Jeremiah Lowin. - -- Issue #20817: Fix inspect.getcallargs() to fail correctly if more - than 3 arguments are missing. Patch by Jeremiah Lowin. - -- Issue #6676: Ensure a meaningful exception is raised when attempting - to parse more than one XML document per pyexpat xmlparser instance. - (Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with - suggested wording by David Gutteridge) - -- Issue #21117: Fix inspect.signature to better support functools.partial. - Due to the specifics of functools.partial implementation, - positional-or-keyword arguments passed as keyword arguments become - keyword-only. - -- Issue #20334: inspect.Signature and inspect.Parameter are now hashable. - Thanks to Antony Lee for bug reports and suggestions. - -- Issue #15916: doctest.DocTestSuite returns an empty unittest.TestSuite instead - of raising ValueError if it finds no tests - -- Issue #21209: Fix asyncio.tasks.CoroWrapper to workaround a bug - in yield-from implementation in CPythons prior to 3.4.1. - -- asyncio: Add gi_{frame,running,code} properties to CoroWrapper - (upstream issue #163). - -- Issue #21311: Avoid exception in _osx_support with non-standard compiler - configurations. Patch by John Szakmeister. - -- Issue #11571: Ensure that the turtle window becomes the topmost window - when launched on OS X. - -- Issue #21801: Validate that __signature__ is None or an instance of Signature. - -- Issue #21923: Prevent AttributeError in distutils.sysconfig.customize_compiler - due to possible uninitialized _config_vars. - -- Issue #21323: Fix http.server to again handle scripts in CGI subdirectories, - broken by the fix for security issue #19435. Patch by Zach Byrne. - -- Issue #22733: Fix ffi_prep_args not zero-extending argument values correctly - on 64-bit Windows. - -- Issue #23302: Default to TCP_NODELAY=1 upon establishing an HTTPConnection. - Removed use of hard-coded MSS as it's an optimization that's no longer needed - with Nagle disabled. - -IDLE ----- - -- Issue #20577: Configuration of the max line length for the FormatParagraph - extension has been moved from the General tab of the Idle preferences dialog - to the FormatParagraph tab of the Config Extensions dialog. - Patch by Tal Einat. - -- Issue #16893: Update Idle doc chapter to match current Idle and add new - information. - -- Issue #3068: Add Idle extension configuration dialog to Options menu. - Changes are written to HOME/.idlerc/config-extensions.cfg. - Original patch by Tal Einat. - -- Issue #16233: A module browser (File : Class Browser, Alt+C) requires an - editor window with a filename. When Class Browser is requested otherwise, - from a shell, output window, or 'Untitled' editor, Idle no longer displays - an error box. It now pops up an Open Module box (Alt+M). If a valid name - is entered and a module is opened, a corresponding browser is also opened. - -- Issue #4832: Save As to type Python files automatically adds .py to the - name you enter (even if your system does not display it). Some systems - automatically add .txt when type is Text files. - -- Issue #21986: Code objects are not normally pickled by the pickle module. - To match this, they are no longer pickled when running under Idle. - -- Issue #17390: Adjust Editor window title; remove 'Python', - move version to end. - -- Issue #14105: Idle debugger breakpoints no longer disappear - when inserting or deleting lines. - -- Issue #17172: Turtledemo can now be run from Idle. - Currently, the entry is on the Help menu, but it may move to Run. - Patch by Ramchandra Apt and Lita Cho. - -- Issue #21765: Add support for non-ascii identifiers to HyperParser. - -- Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav - Heblikar. - -- Issue #18592: Add unittest for SearchDialogBase. Patch by Phil Webster. - -- Issue #21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar. - -- Issue #21686: add unittest for HyperParser. Original patch by Saimadhav - Heblikar. - -- Issue #12387: Add missing upper(lower)case versions of default Windows key - bindings for Idle so Caps Lock does not disable them. Patch by Roger Serwy. - -- Issue #21695: Closing a Find-in-files output window while the search is - still in progress no longer closes Idle. - -- Issue #18910: Add unittest for textView. Patch by Phil Webster. - -- Issue #18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar. - -- Issue #18409: Add unittest for AutoComplete. Patch by Phil Webster. - -- Issue #21477: htest.py - Improve framework, complete set of tests. - Patches by Saimadhav Heblikar - -- Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin - consolidating and improving human-validated tests of Idle. Change other files - as needed to work with htest. Running the module as __main__ runs all tests. - -- Issue #21139: Change default paragraph width to 72, the PEP 8 recommendation. - -- Issue #21284: Paragraph reformat test passes after user changes reformat width. - -- Issue #17654: Ensure IDLE menus are customized properly on OS X for - non-framework builds and for all variants of Tk. - -- Issue #23180: Rename IDLE "Windows" menu item to "Window". - Patch by Al Sweigart. - -Build ------ - -- Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure - script. - -- Issue #22935: Allow the ssl module to be compiled if openssl doesn't support - SSL 3. - -- Issue #22592: Drop support of the Borland C compiler to build Python. The - distutils module still supports it to build extensions. - -- Issue #22591: Drop support of MS-DOS, especially of the DJGPP compiler - (MS-DOS port of GCC). - -- Issue #16537: Check whether self.extensions is empty in setup.py. Patch by - Jonathan Hosmer. - -- Issue #22359: Remove incorrect uses of recursive make. Patch by Jonas - Wagner. - -- Issue #21958: Define HAVE_ROUND when building with Visual Studio 2013 and - above. Patch by Zachary Turner. - -- Issue #18093: the programs that embed the CPython runtime are now in a - separate "Programs" directory, rather than being kept in the Modules - directory. - -- Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/ - now display special message when and only when there are failures. - -- Issue #21141: The Windows build process no longer attempts to find Perl, - instead relying on OpenSSL source being configured and ready to build. The - ``PCbuild\build_ssl.py`` script has been re-written and re-named to - ``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source - for both 32 and 64 bit platforms. OpenSSL sources obtained from - svn.python.org will always be pre-configured and ready to build. - -- Issue #21037: Add a build option to enable AddressSanitizer support. - -- Issue #19962: The Windows build process now creates "python.bat" in the - root of the source tree, which passes all arguments through to the most - recently built interpreter. - -- Issue #21285: Refactor and fix curses configure check to always search - in a ncursesw directory. - -- Issue #15234: For BerkelyDB and Sqlite, only add the found library and - include directories if they aren't already being searched. This avoids - an explicit runtime library dependency. - -- Issue #17861: Tools/scripts/generate_opcode_h.py automatically regenerates - Include/opcode.h from Lib/opcode.py if the latter gets any change. - -- Issue #20644: OS X installer build support for documentation build changes - in 3.4.1: assume externally supplied sphinx-build is available in /usr/bin. - -- Issue #20022: Eliminate use of deprecated bundlebuilder in OS X builds. - -- Issue #15968: Incorporated Tcl, Tk, and Tix builds into the Windows build - solution. - -- Issue #17095: Fix Modules/Setup *shared* support. - -- Issue #21811: Anticipated fixes to support OS X versions > 10.9. - -- Issue #21166: Prevent possible segfaults and other random failures of - python --generate-posix-vars in pybuilddir.txt build target. - -- Issue #18096: Fix library order returned by python-config. - -- Issue #17219: Add library build dir for Python extension cross-builds. - -- Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), - which will be used for the official release. - -- Issue #21236: Build _msi.pyd with cabinet.lib instead of fci.lib - -- Issue #17128: Use private version of OpenSSL for OS X 10.5+ installer. - -C API ------ - -- Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo(), - bytearray_getbuffer(), bytesiobuf_getbuffer() and array_buffer_getbuf(). - All functions now raise BufferError in that case. - -- Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity - tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation - flag. Previously the function reported false negatives for corner cases. - -- Issue #22079: PyType_Ready() now checks that statically allocated type has - no dynamically allocated bases. - -- Issue #22453: Removed non-documented macro PyObject_REPR(). - -- Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, - rename ``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document - these functions. - -- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), - PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) is now using - ``calloc()`` instead of ``malloc()`` for large objects which is faster and - use less memory. - -- Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to - match what importlib does; this affects _frozen_importlib as well as any - module loaded using imp.init_frozen(). - -Documentation -------------- - -- Issue #19548: Update the codecs module documentation to better cover the - distinction between text encodings and other codecs, together with other - clarifications. Patch by Martin Panter. - -- Issue #22394: Doc/Makefile now supports ``make venv PYTHON=../python`` to - create a venv for generating the documentation, e.g., - ``make html PYTHON=venv/bin/python3``. - -- Issue #21514: The documentation of the json module now refers to new JSON RFC - 7159 instead of obsoleted RFC 4627. - -- Issue #21777: The binary sequence methods on bytes and bytearray are now - documented explicitly, rather than assuming users will be able to derive - the expected behaviour from the behaviour of the corresponding str methods. - -- Issue #6916: undocument deprecated asynchat.fifo class. - -- Issue #17386: Expanded functionality of the ``Doc/make.bat`` script to make - it much more comparable to ``Doc/Makefile``. - -- Issue #21312: Update the thread_foobar.h template file to include newer - threading APIs. Patch by Jack McCracken. - -- Issue #21043: Remove the recommendation for specific CA organizations and to - mention the ability to load the OS certificates. - -- Issue #20765: Add missing documentation for PurePath.with_name() and - PurePath.with_suffix(). - -- Issue #19407: New package installation and distribution guides based on - the Python Packaging Authority tools. Existing guides have been retained - as legacy links from the distutils docs, as they still contain some - required reference material for tool developers that isn't recorded - anywhere else. - -- Issue #19697: Document cases where __main__.__spec__ is None. - -Tests ------ - -- Issue #18982: Add tests for CLI of the calendar module. - -- Issue #19548: Added some additional checks to test_codecs to ensure that - statements in the updated documentation remain accurate. Patch by Martin - Panter. - -- Issue #22838: All test_re tests now work with unittest test discovery. - -- Issue #22173: Update lib2to3 tests to use unittest test discovery. - -- Issue #16000: Convert test_curses to use unittest. - -- Issue #21456: Skip two tests in test_urllib2net.py if _ssl module not - present. Patch by Remi Pointel. - -- Issue #20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier - de Gaye. - -- Issue #22060: test_ctypes has been somewhat cleaned up and simplified; it - now uses unittest test discovery to find its tests. - -- Issue #22104: regrtest.py no longer holds a reference to the suite of tests - loaded from test modules that don't define test_main(). - -- Issue #22111: Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. - -- Issue #22002: Added ``load_package_tests`` function to test.support and used - it to implement/augment test discovery in test_asyncio, test_email, - test_importlib, test_json, and test_tools. - -- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks - to William Orr. - -- Issue #21918: Converted test_tools from a module to a package containing - separate test files for each tested script. - -- Issue #9554: Use modern unittest features in test_argparse. Initial patch by - Denver Coneybeare and Radu Voicilas. - -- Issue #20155: Changed HTTP method names in failing tests in test_httpservers - so that packet filtering software (specifically Windows Base Filtering Engine) - does not interfere with the transaction semantics expected by the tests. - -- Issue #19493: Refactored the ctypes test package to skip tests explicitly - rather than silently. - -- Issue #18492: All resources are now allowed when tests are not run by - regrtest.py. - -- Issue #21634: Fix pystone micro-benchmark: use floor division instead of true - division to benchmark integers instead of floating point numbers. Set pystone - version to 1.2. Patch written by Lennart Regebro. - -- Issue #21605: Added tests for Tkinter images. - -- Issue #21493: Added test for ntpath.expanduser(). Original patch by - Claudiu Popa. - -- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok. - -- Issue #21522: Added Tkinter tests for Listbox.itemconfigure(), - PanedWindow.paneconfigure(), and Menu.entryconfigure(). - -- Issue #17756: Fix test_code test when run from the installed location. - -- Issue #17752: Fix distutils tests when run from the installed location. - -- Issue #18604: Consolidated checks for GUI availability. All platforms now - at least check whether Tk can be instantiated when the GUI resource is - requested. - -- Issue #21275: Fix a socket test on KFreeBSD. - -- Issue #21223: Pass test_site/test_startup_imports when some of the extensions - are built as builtins. - -- Issue #20635: Added tests for Tk geometry managers. - -- Add test case for freeze. - -- Issue #20743: Fix a reference leak in test_tcl. - -- Issue #21097: Move test_namespace_pkgs into test_importlib. - -- Issue #21503: Use test_both() consistently in test_importlib. - -- Issue #20939: Avoid various network test failures due to new - redirect of http://www.python.org/ to https://www.python.org: - use http://www.example.com instead. - -- Issue #20668: asyncio tests no longer rely on tests.txt file. - (Patch by Vajrasky Kok) - -- Issue #21093: Prevent failures of ctypes test_macholib on OS X if a - copy of libz exists in $HOME/lib or /usr/local/lib. - -- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests. - -- Issue #23211: Workaround test_logging failure on some OS X 10.6 systems. - -- Issue #23345: Prevent test_ssl failures with large OpenSSL patch level - values (like 0.9.8zc). - -Tools/Demos ------------ - -- Issue #22314: pydoc now works when the LINES environment variable is set. - -- Issue #22615: Argument Clinic now supports the "type" argument for the - int converter. This permits using the int converter with enums and - typedefs. - -- Issue #20076: The makelocalealias.py script no longer ignores UTF-8 mapping. - -- Issue #20079: The makelocalealias.py script now can parse the SUPPORTED file - from glibc sources and supports command line options for source paths. - -- Issue #22201: Command-line interface of the zipfile module now correctly - extracts ZIP files with directory entries. Patch by Ryan Wilson. - -- Issue #22120: For functions using an unsigned integer return converter, - Argument Clinic now generates a cast to that type for the comparison - to -1 in the generated code. (This suppresses a compilation warning.) - -- Issue #18974: Tools/scripts/diff.py now uses argparse instead of optparse. - -- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3. - Patch by Zachary Ware. - -- Issue #21629: Fix Argument Clinic's "--converters" feature. - -- Add support for ``yield from`` to 2to3. - -- Add support for the PEP 465 matrix multiplication operator to 2to3. - -- Issue #16047: Fix module exception list and __file__ handling in freeze. - Patch by Meador Inge. - -- Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge. - -- Issue #20535: PYTHONWARNING no longer affects the run_tests.py script. - Patch by Arfrever Frehtes Taifersar Arahesis. - -Windows -------- - -- Issue #23260: Update Windows installer - -- The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible - result of this change is the addition of new native file dialogs when - running on Windows Vista or newer. See Tcl/Tk's TIP 432 for more - information. Also, this version of Tcl/Tk includes support for Windows 10. - -- Issue #17896: The Windows build scripts now expect external library sources - to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``. - -- Issue #17717: The Windows build scripts now use a copy of NASM pulled from - svn.python.org to build OpenSSL. - -- Issue #21907: Improved the batch scripts provided for building Python. - -- Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j. - -- Issue #10747: Use versioned labels in the Windows start menu. - Patch by Olive Kilburn. - -- Issue #22980: .pyd files with a version and platform tag (for example, - ".cp35-win32.pyd") will now be loaded in preference to those without tags. - - -**(For information about older versions, consult the HISTORY file.)** diff --git a/Misc/NEWS.d/3.5.0.rst b/Misc/NEWS.d/3.5.0.rst new file mode 100644 index 00000000000..130b6781df2 --- /dev/null +++ b/Misc/NEWS.d/3.5.0.rst @@ -0,0 +1,8 @@ +.. bpo: 25071 +.. date: 8265 +.. nonce: EwjXl1 +.. release date: 2015-09-13 +.. section: Build + +Windows installer should not require TargetDir parameter when installing +quietly. diff --git a/Misc/NEWS.d/3.5.0a1.rst b/Misc/NEWS.d/3.5.0a1.rst new file mode 100644 index 00000000000..97fe42d18fb --- /dev/null +++ b/Misc/NEWS.d/3.5.0a1.rst @@ -0,0 +1,5869 @@ +.. bpo: 23285 +.. date: 7908 +.. nonce: bJJA8B +.. release date: 2015-02-08 +.. section: Core and Builtins + +PEP 475 - EINTR handling. + +.. + +.. bpo: 22735 +.. date: 7907 +.. nonce: mFEX9n +.. section: Core and Builtins + +Fix many edge cases (including crashes) involving custom mro() +implementations. + +.. + +.. bpo: 22896 +.. date: 7906 +.. nonce: xSDAHK +.. section: Core and Builtins + +Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and +PyObject_AsWriteBuffer(). + +.. + +.. bpo: 21295 +.. date: 7905 +.. nonce: LYq9nF +.. section: Core and Builtins + +Revert some changes (issue #16795) to AST line numbers and column offsets +that constituted a regression. + +.. + +.. bpo: 22986 +.. date: 7904 +.. nonce: yay2Lv +.. section: Core and Builtins + +Allow changing an object's __class__ between a dynamic type and static type +in some cases. + +.. + +.. bpo: 15859 +.. date: 7903 +.. nonce: Fs5mE2 +.. section: Core and Builtins + +PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and +PyUnicode_EncodeCodePage() now raise an exception if the object is not a +Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on +platforms other than Windows. Patch written by Campbell Barton. + +.. + +.. bpo: 21408 +.. date: 7902 +.. nonce: Lz6P3P +.. section: Core and Builtins + +The default __ne__() now returns NotImplemented if __eq__() returned +NotImplemented. Original patch by Martin Panter. + +.. + +.. bpo: 23321 +.. date: 7901 +.. nonce: HQelge +.. section: Core and Builtins + +Fixed a crash in str.decode() when error handler returned replacment string +longer than mailformed input data. + +.. + +.. bpo: 22286 +.. date: 7900 +.. nonce: l6Qyy1 +.. section: Core and Builtins + +The "backslashreplace" error handlers now works with decoding and +translating. + +.. + +.. bpo: 23253 +.. date: 7899 +.. nonce: p4B1H- +.. section: Core and Builtins + +Delay-load ShellExecute[AW] in os.startfile for reduced startup overhead on +Windows. + +.. + +.. bpo: 22038 +.. date: 7898 +.. nonce: BMZUHx +.. section: Core and Builtins + +pyatomic.h now uses stdatomic.h or GCC built-in functions for atomic memory +access if available. Patch written by Vitor de Lima and Gustavo Temple. + +.. + +.. bpo: 20284 +.. date: 7897 +.. nonce: CH8wpD +.. section: Core and Builtins + +%-interpolation (aka printf) formatting added for bytes and bytearray. + +.. + +.. bpo: 23048 +.. date: 7896 +.. nonce: X5BUd3 +.. section: Core and Builtins + +Fix jumping out of an infinite while loop in the pdb. + +.. + +.. bpo: 20335 +.. date: 7895 +.. nonce: YcAPOs +.. section: Core and Builtins + +bytes constructor now raises TypeError when encoding or errors is specified +with non-string argument. Based on patch by Renaud Blanch. + +.. + +.. bpo: 22834 +.. date: 7894 +.. nonce: N1kAXN +.. section: Core and Builtins + +If the current working directory ends up being set to a non-existent +directory then import will no longer raise FileNotFoundError. + +.. + +.. bpo: 22869 +.. date: 7893 +.. nonce: rAWg-V +.. section: Core and Builtins + +Move the interpreter startup & shutdown code to a new dedicated +pylifecycle.c module + +.. + +.. bpo: 22847 +.. date: 7892 +.. nonce: 6baj9f +.. section: Core and Builtins + +Improve method cache efficiency. + +.. + +.. bpo: 22335 +.. date: 7891 +.. nonce: DWsXiy +.. section: Core and Builtins + +Fix crash when trying to enlarge a bytearray to 0x7fffffff bytes on a 32-bit +platform. + +.. + +.. bpo: 22653 +.. date: 7890 +.. nonce: pCNlpv +.. section: Core and Builtins + +Fix an assertion failure in debug mode when doing a reentrant dict insertion +in debug mode. + +.. + +.. bpo: 22643 +.. date: 7889 +.. nonce: xv8xev +.. section: Core and Builtins + +Fix integer overflow in Unicode case operations (upper, lower, title, +swapcase, casefold). + +.. + +.. bpo: 17636 +.. date: 7888 +.. nonce: wiqnhw +.. section: Core and Builtins + +Circular imports involving relative imports are now supported. + +.. + +.. bpo: 22604 +.. date: 7887 +.. nonce: yii-It +.. section: Core and Builtins + +Fix assertion error in debug mode when dividing a complex number by +(nan+0j). + +.. + +.. bpo: 21052 +.. date: 7886 +.. nonce: -sf3tp +.. section: Core and Builtins + +Do not raise ImportWarning when sys.path_hooks or sys.meta_path are set to +None. + +.. + +.. bpo: 16518 +.. date: 7885 +.. nonce: UADwcN +.. section: Core and Builtins + +Use 'bytes-like object required' in error messages that previously used the +far more cryptic "'x' does not support the buffer protocol. + +.. + +.. bpo: 22470 +.. date: 7884 +.. nonce: igrgN2 +.. section: Core and Builtins + +Fixed integer overflow issues in "backslashreplace", "xmlcharrefreplace", +and "surrogatepass" error handlers. + +.. + +.. bpo: 22540 +.. date: 7883 +.. nonce: FM72m- +.. section: Core and Builtins + +speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the common case +that the second argument has metaclass `type`. + +.. + +.. bpo: 18711 +.. date: 7882 +.. nonce: ds5wQa +.. section: Core and Builtins + +Add a new `PyErr_FormatV` function, similar to `PyErr_Format` but accepting +a `va_list` argument. + +.. + +.. bpo: 22520 +.. date: 7881 +.. nonce: ZPJXSq +.. section: Core and Builtins + +Fix overflow checking when generating the repr of a unicode object. + +.. + +.. bpo: 22519 +.. date: 7880 +.. nonce: xvJVg0 +.. section: Core and Builtins + +Fix overflow checking in PyBytes_Repr. + +.. + +.. bpo: 22518 +.. date: 7879 +.. nonce: C9T6ed +.. section: Core and Builtins + +Fix integer overflow issues in latin-1 encoding. + +.. + +.. bpo: 16324 +.. date: 7878 +.. nonce: YfrBNz +.. section: Core and Builtins + +_charset parameter of MIMEText now also accepts email.charset.Charset +instances. Initial patch by Claude Paroz. + +.. + +.. bpo: 1764286 +.. date: 7877 +.. nonce: L4seL2 +.. section: Core and Builtins + +Fix inspect.getsource() to support decorated functions. Patch by Claudiu +Popa. + +.. + +.. bpo: 18554 +.. date: 7876 +.. nonce: hxnaui +.. section: Core and Builtins + +os.__all__ includes posix functions. + +.. + +.. bpo: 21391 +.. date: 7875 +.. nonce: 3jntPd +.. section: Core and Builtins + +Use os.path.abspath in the shutil module. + +.. + +.. bpo: 11471 +.. date: 7874 +.. nonce: Uu752F +.. section: Core and Builtins + +avoid generating a JUMP_FORWARD instruction at the end of an if-block if +there is no else-clause. Original patch by Eugene Toder. + +.. + +.. bpo: 22215 +.. date: 7873 +.. nonce: IBFi6H +.. section: Core and Builtins + +Now ValueError is raised instead of TypeError when str or bytes argument +contains not permitted null character or byte. + +.. + +.. bpo: 22258 +.. date: 7872 +.. nonce: 4FszMt +.. section: Core and Builtins + +Fix the internal function set_inheritable() on Illumos. This platform +exposes the function ``ioctl(FIOCLEX)``, but calling it fails with errno is +ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls back +to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``). + +.. + +.. bpo: 21389 +.. date: 7871 +.. nonce: dnWZBn +.. section: Core and Builtins + +Displaying the __qualname__ of the underlying function in the repr of a +bound method. + +.. + +.. bpo: 22206 +.. date: 7870 +.. nonce: 0i_ihB +.. section: Core and Builtins + +Using pthread, PyThread_create_key() now sets errno to ENOMEM and returns -1 +(error) on integer overflow. + +.. + +.. bpo: 20184 +.. date: 7869 +.. nonce: bb3uHY +.. section: Core and Builtins + +Argument Clinic based signature introspection added for 30 of the builtin +functions. + +.. + +.. bpo: 22116 +.. date: 7868 +.. nonce: auVmIt +.. section: Core and Builtins + +C functions and methods (of the 'builtin_function_or_method' type) can now +be weakref'ed. Patch by Wei Wu. + +.. + +.. bpo: 22077 +.. date: 7867 +.. nonce: KZUDR- +.. section: Core and Builtins + +Improve index error messages for bytearrays, bytes, lists, and tuples by +adding 'or slices'. Added ', not ' for bytearrays. Original patch +by Claudiu Popa. + +.. + +.. bpo: 20179 +.. date: 7866 +.. nonce: Nvhffc +.. section: Core and Builtins + +Apply Argument Clinic to bytes and bytearray. Patch by Tal Einat. + +.. + +.. bpo: 22082 +.. date: 7865 +.. nonce: 6X8Qmg +.. section: Core and Builtins + +Clear interned strings in slotdefs. + +.. + +.. bpo: 0 +.. date: 7864 +.. nonce: tuMnCc +.. section: Core and Builtins + +Upgrade Unicode database to Unicode 7.0.0. + +.. + +.. bpo: 21897 +.. date: 7863 +.. nonce: kiOGHe +.. section: Core and Builtins + +Fix a crash with the f_locals attribute with closure variables when +frame.clear() has been called. + +.. + +.. bpo: 21205 +.. date: 7862 +.. nonce: wZsx1K +.. section: Core and Builtins + +Add a new ``__qualname__`` attribute to generator, the qualified name, and +use it in the representation of a generator (``repr(gen)``). The default +name of the generator (``__name__`` attribute) is now get from the function +instead of the code. Use ``gen.gi_code.co_name`` to get the name of the +code. + +.. + +.. bpo: 21669 +.. date: 7861 +.. nonce: DFDrBA +.. section: Core and Builtins + +With the aid of heuristics in SyntaxError.__init__, the parser now attempts +to generate more meaningful (or at least more search engine friendly) error +messages when "exec" and "print" are used as statements. + +.. + +.. bpo: 21642 +.. date: 7860 +.. nonce: -lWoKz +.. section: Core and Builtins + +In the conditional if-else expression, allow an integer written with no +space between itself and the ``else`` keyword (e.g. ``True if 42else +False``) to be valid syntax. + +.. + +.. bpo: 21523 +.. date: 7859 +.. nonce: f_PPYO +.. section: Core and Builtins + +Fix over-pessimistic computation of the stack effect of some opcodes in the +compiler. This also fixes a quadratic compilation time issue noticeable +when compiling code with a large number of "and" and "or" operators. + +.. + +.. bpo: 21418 +.. date: 7858 +.. nonce: z9jp1_ +.. section: Core and Builtins + +Fix a crash in the builtin function super() when called without argument and +without current frame (ex: embedded Python). + +.. + +.. bpo: 21425 +.. date: 7857 +.. nonce: i3Teb8 +.. section: Core and Builtins + +Fix flushing of standard streams in the interactive interpreter. + +.. + +.. bpo: 21435 +.. date: 7856 +.. nonce: ZojVOT +.. section: Core and Builtins + +In rare cases, when running finalizers on objects in cyclic trash a bad +pointer dereference could occur due to a subtle flaw in internal iteration +logic. + +.. + +.. bpo: 21377 +.. date: 7855 +.. nonce: OawYfl +.. section: Core and Builtins + +PyBytes_Concat() now tries to concatenate in-place when the first argument +has a reference count of 1. Patch by Nikolaus Rath. + +.. + +.. bpo: 20355 +.. date: 7854 +.. nonce: OrCNkZ +.. section: Core and Builtins + +-W command line options now have higher priority than the PYTHONWARNINGS +environment variable. Patch by Arfrever. + +.. + +.. bpo: 21274 +.. date: 7853 +.. nonce: fVGfwq +.. section: Core and Builtins + +Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. + +.. + +.. bpo: 20904 +.. date: 7852 +.. nonce: fAGdj2 +.. section: Core and Builtins + +Support setting FPU precision on m68k. + +.. + +.. bpo: 21209 +.. date: 7851 +.. nonce: nMljFr +.. section: Core and Builtins + +Fix sending tuples to custom generator objects with the yield from syntax. + +.. + +.. bpo: 21193 +.. date: 7850 +.. nonce: Dg98Oo +.. section: Core and Builtins + +pow(a, b, c) now raises ValueError rather than TypeError when b is negative. +Patch by Josh Rosenberg. + +.. + +.. bpo: 21176 +.. date: 7849 +.. nonce: mitDhW +.. section: Core and Builtins + +PEP 465: Add the '@' operator for matrix multiplication. + +.. + +.. bpo: 21134 +.. date: 7848 +.. nonce: ZL4SKo +.. section: Core and Builtins + +Fix segfault when str is called on an uninitialized UnicodeEncodeError, +UnicodeDecodeError, or UnicodeTranslateError object. + +.. + +.. bpo: 19537 +.. date: 7847 +.. nonce: AkuC_J +.. section: Core and Builtins + +Fix PyUnicode_DATA() alignment under m68k. Patch by Andreas Schwab. + +.. + +.. bpo: 20929 +.. date: 7846 +.. nonce: 9NlUR7 +.. section: Core and Builtins + +Add a type cast to avoid shifting a negative number. + +.. + +.. bpo: 20731 +.. date: 7845 +.. nonce: _03SZg +.. section: Core and Builtins + +Properly position in source code files even if they are opened in text mode. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 20637 +.. date: 7844 +.. nonce: ppYU0o +.. section: Core and Builtins + +Key-sharing now also works for instance dictionaries of subclasses. Patch +by Peter Ingebretson. + +.. + +.. bpo: 8297 +.. date: 7843 +.. nonce: _XdGON +.. section: Core and Builtins + +Attributes missing from modules now include the module name in the error +text. Original patch by ysj.ray. + +.. + +.. bpo: 19995 +.. date: 7842 +.. nonce: mnHEzX +.. section: Core and Builtins + +%c, %o, %x, and %X now raise TypeError on non-integer input. + +.. + +.. bpo: 19655 +.. date: 7841 +.. nonce: JgVdes +.. section: Core and Builtins + +The ASDL parser - used by the build process to generate code for managing +the Python AST in C - was rewritten. The new parser is self contained and +does not require to carry long the spark.py parser-generator library; +spark.py was removed from the source base. + +.. + +.. bpo: 12546 +.. date: 7840 +.. nonce: 09naZ9 +.. section: Core and Builtins + +Allow ``\x00`` to be used as a fill character when using str, int, float, +and complex __format__ methods. + +.. + +.. bpo: 20480 +.. date: 7839 +.. nonce: TIYPLo +.. section: Core and Builtins + +Add ipaddress.reverse_pointer. Patch by Leon Weber. + +.. + +.. bpo: 13598 +.. date: 7838 +.. nonce: GJelrw +.. section: Core and Builtins + +Modify string.Formatter to support auto-numbering of replacement fields. It +now matches the behavior of str.format() in this regard. Patches by Phil +Elson and Ramchandra Apte. + +.. + +.. bpo: 8931 +.. date: 7837 +.. nonce: M05x4f +.. section: Core and Builtins + +Make alternate formatting ('#') for type 'c' raise an exception. In versions +prior to 3.5, '#' with 'c' had no effect. Now specifying it is an error. +Patch by Torsten Landschoff. + +.. + +.. bpo: 23165 +.. date: 7836 +.. nonce: lk8uCE +.. section: Core and Builtins + +Perform overflow checks before allocating memory in the _Py_char2wchar +function. + +.. + +.. bpo: 23399 +.. date: 7835 +.. nonce: hXMYgA +.. section: Library + +pyvenv creates relative symlinks where possible. + +.. + +.. bpo: 20289 +.. date: 7834 +.. nonce: nio1N- +.. section: Library + +cgi.FieldStorage() now supports the context management protocol. + +.. + +.. bpo: 13128 +.. date: 7833 +.. nonce: vqEcsy +.. section: Library + +Print response headers for CONNECT requests when debuglevel > 0. Patch by +Demian Brecht. + +.. + +.. bpo: 15381 +.. date: 7832 +.. nonce: Xv-wu8 +.. section: Library + +Optimized io.BytesIO to make less allocations and copyings. + +.. + +.. bpo: 22818 +.. date: 7831 +.. nonce: NYdAc9 +.. section: Library + +Splitting on a pattern that could match an empty string now raises a +warning. Patterns that can only match empty strings are now rejected. + +.. + +.. bpo: 23099 +.. date: 7830 +.. nonce: ZASrUo +.. section: Library + +Closing io.BytesIO with exported buffer is rejected now to prevent +corrupting exported buffer. + +.. + +.. bpo: 23326 +.. date: 7829 +.. nonce: 8VzlZD +.. section: Library + +Removed __ne__ implementations. Since fixing default __ne__ implementation +in issue #21408 they are redundant. + +.. + +.. bpo: 23363 +.. date: 7828 +.. nonce: -koaol +.. section: Library + +Fix possible overflow in itertools.permutations. + +.. + +.. bpo: 23364 +.. date: 7827 +.. nonce: 3yBV-6 +.. section: Library + +Fix possible overflow in itertools.product. + +.. + +.. bpo: 23366 +.. date: 7826 +.. nonce: tyAfm8 +.. section: Library + +Fixed possible integer overflow in itertools.combinations. + +.. + +.. bpo: 23369 +.. date: 7825 +.. nonce: nqChyE +.. section: Library + +Fixed possible integer overflow in _json.encode_basestring_ascii. + +.. + +.. bpo: 23353 +.. date: 7824 +.. nonce: Iytkpc +.. section: Library + +Fix the exception handling of generators in PyEval_EvalFrameEx(). At entry, +save or swap the exception state even if PyEval_EvalFrameEx() is called with +throwflag=0. At exit, the exception state is now always restored or swapped, +not only if why is WHY_YIELD or WHY_RETURN. Patch co-written with Antoine +Pitrou. + +.. + +.. bpo: 14099 +.. date: 7823 +.. nonce: t9-HVE +.. section: Library + +Restored support of writing ZIP files to tellable but non-seekable streams. + +.. + +.. bpo: 14099 +.. date: 7822 +.. nonce: Myxxww +.. section: Library + +Writing to ZipFile and reading multiple ZipExtFiles is threadsafe now. + +.. + +.. bpo: 19361 +.. date: 7821 +.. nonce: 2mvrV3 +.. section: Library + +JSON decoder now raises JSONDecodeError instead of ValueError. + +.. + +.. bpo: 18518 +.. date: 7820 +.. nonce: JXgicC +.. section: Library + +timeit now rejects statements which can't be compiled outside a function or +a loop (e.g. "return" or "break"). + +.. + +.. bpo: 23094 +.. date: 7819 +.. nonce: -8AXSi +.. section: Library + +Fixed readline with frames in Python implementation of pickle. + +.. + +.. bpo: 23268 +.. date: 7818 +.. nonce: ATtRa5 +.. section: Library + +Fixed bugs in the comparison of ipaddress classes. + +.. + +.. bpo: 21408 +.. date: 7817 +.. nonce: 0rI6tx +.. section: Library + +Removed incorrect implementations of __ne__() which didn't returned +NotImplemented if __eq__() returned NotImplemented. The default __ne__() +now works correctly. + +.. + +.. bpo: 19996 +.. date: 7816 +.. nonce: 2-SiMf +.. section: Library + +:class:`email.feedparser.FeedParser` now handles (malformed) headers with no +key rather than assuming the body has started. + +.. + +.. bpo: 20188 +.. date: 7815 +.. nonce: xocY-2 +.. section: Library + +Support Application-Layer Protocol Negotiation (ALPN) in the ssl module. + +.. + +.. bpo: 23133 +.. date: 7814 +.. nonce: 8p2Wnl +.. section: Library + +Pickling of ipaddress objects now produces more compact and portable +representation. + +.. + +.. bpo: 23248 +.. date: 7813 +.. nonce: FjcyCP +.. section: Library + +Update ssl error codes from latest OpenSSL git master. + +.. + +.. bpo: 23266 +.. date: 7812 +.. nonce: Mo7alR +.. section: Library + +Much faster implementation of ipaddress.collapse_addresses() when there are +many non-consecutive addresses. + +.. + +.. bpo: 23098 +.. date: 7811 +.. nonce: 7VwF3K +.. section: Library + +64-bit dev_t is now supported in the os module. + +.. + +.. bpo: 21817 +.. date: 7810 +.. nonce: xYUW-9 +.. section: Library + +When an exception is raised in a task submitted to a ProcessPoolExecutor, +the remote traceback is now displayed in the parent process. Patch by +Claudiu Popa. + +.. + +.. bpo: 15955 +.. date: 7809 +.. nonce: uvpBL4 +.. section: Library + +Add an option to limit output size when decompressing LZMA data. Patch by +Nikolaus Rath and Martin Panter. + +.. + +.. bpo: 23250 +.. date: 7808 +.. nonce: qNGAUf +.. section: Library + +In the http.cookies module, capitalize "HttpOnly" and "Secure" as they are +written in the standard. + +.. + +.. bpo: 23063 +.. date: 7807 +.. nonce: 9-UJRs +.. section: Library + +In the disutils' check command, fix parsing of reST with code or code-block +directives. + +.. + +.. bpo: 23209 +.. date: 7806 +.. nonce: I0bCCH +.. section: Library + +selectors.BaseSelector.get_key() now raises a RuntimeError if the selector +is closed. And selectors.BaseSelector.close() now clears its internal +reference to the selector mapping to break a reference cycle. Initial patch +written by Martin Richard. (See also: bpo-23225) + +.. + +.. bpo: 17911 +.. date: 7805 +.. nonce: yg65Iu +.. section: Library + +Provide a way to seed the linecache for a PEP-302 module without actually +loading the code. + +.. + +.. bpo: 17911 +.. date: 7804 +.. nonce: qeTePa +.. section: Library + +Provide a new object API for traceback, including the ability to not lookup +lines at all until the traceback is actually rendered, without any trace of +the original objects being kept alive. + +.. + +.. bpo: 19777 +.. date: 7803 +.. nonce: H_NDIA +.. section: Library + +Provide a home() classmethod on Path objects. Contributed by Victor Salgado +and Mayank Tripathi. + +.. + +.. bpo: 23206 +.. date: 7802 +.. nonce: xSiYwq +.. section: Library + +Make ``json.dumps(..., ensure_ascii=False)`` as fast as the default case of +``ensure_ascii=True``. Patch by Naoki Inada. + +.. + +.. bpo: 23185 +.. date: 7801 +.. nonce: KHyoSO +.. section: Library + +Add math.inf and math.nan constants. + +.. + +.. bpo: 23186 +.. date: 7800 +.. nonce: KzWLP2 +.. section: Library + +Add ssl.SSLObject.shared_ciphers() and ssl.SSLSocket.shared_ciphers() to +fetch the client's list ciphers sent at handshake. + +.. + +.. bpo: 23143 +.. date: 7799 +.. nonce: AWxJXV +.. section: Library + +Remove compatibility with OpenSSLs older than 0.9.8. + +.. + +.. bpo: 23132 +.. date: 7798 +.. nonce: pbQcut +.. section: Library + +Improve performance and introspection support of comparison methods created +by functool.total_ordering. + +.. + +.. bpo: 19776 +.. date: 7797 +.. nonce: BxNgxd +.. section: Library + +Add an expanduser() method on Path objects. + +.. + +.. bpo: 23112 +.. date: 7796 +.. nonce: dZGf82 +.. section: Library + +Fix SimpleHTTPServer to correctly carry the query string and fragment when +it redirects to add a trailing slash. + +.. + +.. bpo: 21793 +.. date: 7795 +.. nonce: T1kQBL +.. section: Library + +Added http.HTTPStatus enums (i.e. HTTPStatus.OK, HTTPStatus.NOT_FOUND). +Patch by Demian Brecht. + +.. + +.. bpo: 23093 +.. date: 7794 +.. nonce: cP7OqD +.. section: Library + +In the io, module allow more operations to work on detached streams. + +.. + +.. bpo: 23111 +.. date: 7793 +.. nonce: A34IA4 +.. section: Library + +In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol version. + +.. + +.. bpo: 22585 +.. date: 7792 +.. nonce: F4BkNo +.. section: Library + +On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), instead of +reading /dev/urandom, to get pseudo-random bytes. + +.. + +.. bpo: 19104 +.. date: 7791 +.. nonce: _eIThy +.. section: Library + +pprint now produces evaluable output for wrapped strings. + +.. + +.. bpo: 23071 +.. date: 7790 +.. nonce: 3BSqF7 +.. section: Library + +Added missing names to codecs.__all__. Patch by Martin Panter. + +.. + +.. bpo: 22783 +.. date: 7789 +.. nonce: OfYxBd +.. section: Library + +Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX opcode if +possible. + +.. + +.. bpo: 15513 +.. date: 7788 +.. nonce: 7yVnRE +.. section: Library + +Added a __sizeof__ implementation for pickle classes. + +.. + +.. bpo: 19858 +.. date: 7787 +.. nonce: cqOlIt +.. section: Library + +pickletools.optimize() now aware of the MEMOIZE opcode, can produce more +compact result and no longer produces invalid output if input data contains +MEMOIZE opcodes together with PUT or BINPUT opcodes. + +.. + +.. bpo: 22095 +.. date: 7786 +.. nonce: iISzxM +.. section: Library + +Fixed HTTPConnection.set_tunnel with default port. The port value in the +host header was set to "None". Patch by Demian Brecht. + +.. + +.. bpo: 23016 +.. date: 7785 +.. nonce: LyrPd_ +.. section: Library + +A warning no longer produces an AttributeError when the program is run with +pythonw.exe. + +.. + +.. bpo: 21775 +.. date: 7784 +.. nonce: ELR_Al +.. section: Library + +shutil.copytree(): fix crash when copying to VFAT. An exception handler +assumed that OSError objects always have a 'winerror' attribute. That is not +the case, so the exception handler itself raised AttributeError when run on +Linux (and, presumably, any other non-Windows OS). Patch by Greg Ward. + +.. + +.. bpo: 1218234 +.. date: 7783 +.. nonce: 4GcoQK +.. section: Library + +Fix inspect.getsource() to load updated source of reloaded module. Initial +patch by Berker Peksag. + +.. + +.. bpo: 21740 +.. date: 7782 +.. nonce: TtAApO +.. section: Library + +Support wrapped callables in doctest. Patch by Claudiu Popa. + +.. + +.. bpo: 23009 +.. date: 7781 +.. nonce: -sW7gk +.. section: Library + +Make sure selectors.EpollSelecrtor.select() works when no FD is registered. + +.. + +.. bpo: 22959 +.. date: 7780 +.. nonce: Vxt3EP +.. section: Library + +In the constructor of http.client.HTTPSConnection, prefer the context's +check_hostname attribute over the *check_hostname* parameter. + +.. + +.. bpo: 22696 +.. date: 7779 +.. nonce: pvdcxs +.. section: Library + +Add function :func:`sys.is_finalizing` to know about interpreter shutdown. + +.. + +.. bpo: 16043 +.. date: 7778 +.. nonce: TGIC7t +.. section: Library + +Add a default limit for the amount of data xmlrpclib.gzip_decode will +return. This resolves CVE-2013-1753. + +.. + +.. bpo: 14099 +.. date: 7777 +.. nonce: GJ5meQ +.. section: Library + +ZipFile.open() no longer reopen the underlying file. Objects returned by +ZipFile.open() can now operate independently of the ZipFile even if the +ZipFile was created by passing in a file-like object as the first argument +to the constructor. + +.. + +.. bpo: 22966 +.. date: 7776 +.. nonce: zIxDrT +.. section: Library + +Fix __pycache__ pyc file name clobber when pyc_compile is asked to compile a +source file containing multiple dots in the source file name. + +.. + +.. bpo: 21971 +.. date: 7775 +.. nonce: XlTc22 +.. section: Library + +Update turtledemo doc and add module to the index. + +.. + +.. bpo: 21032 +.. date: 7774 +.. nonce: wxT_41 +.. section: Library + +Fixed socket leak if HTTPConnection.getresponse() fails. Original patch by +Martin Panter. + +.. + +.. bpo: 22407 +.. date: 7773 +.. nonce: CWi1wX +.. section: Library + +Deprecated the use of re.LOCALE flag with str patterns or re.ASCII. It was +newer worked. + +.. + +.. bpo: 22902 +.. date: 7772 +.. nonce: ZqXriA +.. section: Library + +The "ip" command is now used on Linux to determine MAC address in +uuid.getnode(). Pach by Bruno Cauet. + +.. + +.. bpo: 22960 +.. date: 7771 +.. nonce: 2VDILT +.. section: Library + +Add a context argument to xmlrpclib.ServerProxy constructor. + +.. + +.. bpo: 22389 +.. date: 7770 +.. nonce: 82DuwD +.. section: Library + +Add contextlib.redirect_stderr(). + +.. + +.. bpo: 21356 +.. date: 7769 +.. nonce: 8NY75J +.. section: Library + +Make ssl.RAND_egd() optional to support LibreSSL. The availability of the +function is checked during the compilation. Patch written by Bernard Spil. + +.. + +.. bpo: 22915 +.. date: 7768 +.. nonce: 709UAo +.. section: Library + +SAX parser now supports files opened with file descriptor or bytes path. + +.. + +.. bpo: 22609 +.. date: 7767 +.. nonce: mmLoeb +.. section: Library + +Constructors and update methods of mapping classes in the collections module +now accept the self keyword argument. + +.. + +.. bpo: 22940 +.. date: 7766 +.. nonce: SP99Nf +.. section: Library + +Add readline.append_history_file. + +.. + +.. bpo: 19676 +.. date: 7765 +.. nonce: Wijwr8 +.. section: Library + +Added the "namereplace" error handler. + +.. + +.. bpo: 22788 +.. date: 7764 +.. nonce: vofL9e +.. section: Library + +Add *context* parameter to logging.handlers.HTTPHandler. + +.. + +.. bpo: 22921 +.. date: 7763 +.. nonce: a4wx1C +.. section: Library + +Allow SSLContext to take the *hostname* parameter even if OpenSSL doesn't +support SNI. + +.. + +.. bpo: 22894 +.. date: 7762 +.. nonce: 4AkwPA +.. section: Library + +TestCase.subTest() would cause the test suite to be stopped when in failfast +mode, even in the absence of failures. + +.. + +.. bpo: 22796 +.. date: 7761 +.. nonce: _pFPFA +.. section: Library + +HTTP cookie parsing is now stricter, in order to protect against potential +injection attacks. + +.. + +.. bpo: 22370 +.. date: 7760 +.. nonce: j4y21u +.. section: Library + +Windows detection in pathlib is now more robust. + +.. + +.. bpo: 22841 +.. date: 7759 +.. nonce: 8wpk7T +.. section: Library + +Reject coroutines in asyncio add_signal_handler(). Patch by Ludovic.Gasc. + +.. + +.. bpo: 19494 +.. date: 7758 +.. nonce: 7O5O8k +.. section: Library + +Added urllib.request.HTTPBasicPriorAuthHandler. Patch by Matej Cepl. + +.. + +.. bpo: 22578 +.. date: 7757 +.. nonce: 6XZ0Jf +.. section: Library + +Added attributes to the re.error class. + +.. + +.. bpo: 22849 +.. date: 7756 +.. nonce: AqBPyj +.. section: Library + +Fix possible double free in the io.TextIOWrapper constructor. + +.. + +.. bpo: 12728 +.. date: 7755 +.. nonce: rHZmXO +.. section: Library + +Different Unicode characters having the same uppercase but different +lowercase are now matched in case-insensitive regular expressions. + +.. + +.. bpo: 22821 +.. date: 7754 +.. nonce: 30cQ-U +.. section: Library + +Fixed fcntl() with integer argument on 64-bit big-endian platforms. + +.. + +.. bpo: 21650 +.. date: 7753 +.. nonce: 62MLqr +.. section: Library + +Add an `--sort-keys` option to json.tool CLI. + +.. + +.. bpo: 22824 +.. date: 7752 +.. nonce: d5Txvr +.. section: Library + +Updated reprlib output format for sets to use set literals. Patch +contributed by Berker Peksag. + +.. + +.. bpo: 22824 +.. date: 7751 +.. nonce: H_r9uH +.. section: Library + +Updated reprlib output format for arrays to display empty arrays without an +unnecessary empty list. Suggested by Serhiy Storchaka. + +.. + +.. bpo: 22406 +.. date: 7750 +.. nonce: sPlVbI +.. section: Library + +Fixed the uu_codec codec incorrectly ported to 3.x. Based on patch by Martin +Panter. + +.. + +.. bpo: 17293 +.. date: 7749 +.. nonce: Hk06bO +.. section: Library + +uuid.getnode() now determines MAC address on AIX using netstat. Based on +patch by Aivars Kalv?ns. + +.. + +.. bpo: 22769 +.. date: 7748 +.. nonce: PunnvQ +.. section: Library + +Fixed ttk.Treeview.tag_has() when called without arguments. + +.. + +.. bpo: 22417 +.. date: 7747 +.. nonce: To4b7U +.. section: Library + +Verify certificates by default in httplib (PEP 476). + +.. + +.. bpo: 22775 +.. date: 7746 +.. nonce: V5aCUz +.. section: Library + +Fixed unpickling of http.cookies.SimpleCookie with protocol 2 and above. +Patch by Tim Graham. + +.. + +.. bpo: 22776 +.. date: 7745 +.. nonce: xNcRse +.. section: Library + +Brought excluded code into the scope of a try block in SysLogHandler.emit(). + +.. + +.. bpo: 22665 +.. date: 7744 +.. nonce: j6Jlp8 +.. section: Library + +Add missing get_terminal_size and SameFileError to shutil.__all__. + +.. + +.. bpo: 6623 +.. date: 7743 +.. nonce: 6LOidS +.. section: Library + +Remove deprecated Netrc class in the ftplib module. Patch by Matt Chaput. + +.. + +.. bpo: 17381 +.. date: 7742 +.. nonce: 4J5yv7 +.. section: Library + +Fixed handling of case-insensitive ranges in regular expressions. + +.. + +.. bpo: 22410 +.. date: 7741 +.. nonce: 99YFdd +.. section: Library + +Module level functions in the re module now cache compiled locale-dependent +regular expressions taking into account the locale. + +.. + +.. bpo: 22759 +.. date: 7740 +.. nonce: BJPdiL +.. section: Library + +Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False +when the underlying stat call raises NotADirectoryError. + +.. + +.. bpo: 8876 +.. date: 7739 +.. nonce: A83Av4 +.. section: Library + +distutils now falls back to copying files when hard linking doesn't work. +This allows use with special filesystems such as VirtualBox shared folders. + +.. + +.. bpo: 22217 +.. date: 7738 +.. nonce: nXzGur +.. section: Library + +Implemented reprs of classes in the zipfile module. + +.. + +.. bpo: 22457 +.. date: 7737 +.. nonce: Xd2Mk- +.. section: Library + +Honour load_tests in the start_dir of discovery. + +.. + +.. bpo: 18216 +.. date: 7736 +.. nonce: trTZw4 +.. section: Library + +gettext now raises an error when a .mo file has an unsupported major version +number. Patch by Aaron Hill. + +.. + +.. bpo: 13918 +.. date: 7735 +.. nonce: -OnUhD +.. section: Library + +Provide a locale.delocalize() function which can remove locale-specific +number formatting from a string representing a number, without then +converting it to a specific type. Patch by C?dric Krier. + +.. + +.. bpo: 22676 +.. date: 7734 +.. nonce: d2v8QM +.. section: Library + +Make the pickling of global objects which don't have a __module__ attribute +less slow. + +.. + +.. bpo: 18853 +.. date: 7733 +.. nonce: 76DrPD +.. section: Library + +Fixed ResourceWarning in shlex.__nain__. + +.. + +.. bpo: 9351 +.. date: 7732 +.. nonce: u5UI-6 +.. section: Library + +Defaults set with set_defaults on an argparse subparser are no longer +ignored when also set on the parent parser. + +.. + +.. bpo: 7559 +.. date: 7731 +.. nonce: QG35ZP +.. section: Library + +unittest test loading ImportErrors are reported as import errors with their +import exception rather than as attribute errors after the import has +already failed. + +.. + +.. bpo: 19746 +.. date: 7730 +.. nonce: S1dg1K +.. section: Library + +Make it possible to examine the errors from unittest discovery without +executing the test suite. The new `errors` attribute on TestLoader exposes +these non-fatal errors encountered during discovery. + +.. + +.. bpo: 21991 +.. date: 7729 +.. nonce: Mkm0IN +.. section: Library + +Make email.headerregistry's header 'params' attributes be read-only +(MappingProxyType). Previously the dictionary was modifiable but a new one +was created on each access of the attribute. + +.. + +.. bpo: 22638 +.. date: 7728 +.. nonce: Ur73gJ +.. section: Library + +SSLv3 is now disabled throughout the standard library. It can still be +enabled by instantiating a SSLContext manually. + +.. + +.. bpo: 22641 +.. date: 7727 +.. nonce: m0ldtl +.. section: Library + +In asyncio, the default SSL context for client connections is now created +using ssl.create_default_context(), for stronger security. + +.. + +.. bpo: 17401 +.. date: 7726 +.. nonce: SZd19P +.. section: Library + +Include closefd in io.FileIO repr. + +.. + +.. bpo: 21338 +.. date: 7725 +.. nonce: evDyHD +.. section: Library + +Add silent mode for compileall. quiet parameters of compile_{dir, file, +path} functions now have a multilevel value. Also, -q option of the CLI now +have a multilevel value. Patch by Thomas Kluyver. + +.. + +.. bpo: 20152 +.. date: 7724 +.. nonce: 9_o92A +.. section: Library + +Convert the array and cmath modules to Argument Clinic. + +.. + +.. bpo: 18643 +.. date: 7723 +.. nonce: 6Qdc0J +.. section: Library + +Add socket.socketpair() on Windows. + +.. + +.. bpo: 22435 +.. date: 7722 +.. nonce: s2U7Zm +.. section: Library + +Fix a file descriptor leak when socketserver bind fails. + +.. + +.. bpo: 13096 +.. date: 7721 +.. nonce: rsailB +.. section: Library + +Fixed segfault in CTypes POINTER handling of large values. + +.. + +.. bpo: 11694 +.. date: 7720 +.. nonce: JuDrch +.. section: Library + +Raise ConversionError in xdrlib as documented. Patch by Filip Gruszczy?ski +and Claudiu Popa. + +.. + +.. bpo: 19380 +.. date: 7719 +.. nonce: nqgoRQ +.. section: Library + +Optimized parsing of regular expressions. + +.. + +.. bpo: 1519638 +.. date: 7718 +.. nonce: 2pbuog +.. section: Library + +Now unmatched groups are replaced with empty strings in re.sub() and +re.subn(). + +.. + +.. bpo: 18615 +.. date: 7717 +.. nonce: 65TxnY +.. section: Library + +sndhdr.what/whathdr now return a namedtuple. + +.. + +.. bpo: 22462 +.. date: 7716 +.. nonce: 1h4Kpr +.. section: Library + +Fix pyexpat's creation of a dummy frame to make it appear in exception +tracebacks. + +.. + +.. bpo: 21965 +.. date: 7715 +.. nonce: n_jnXs +.. section: Library + +Add support for in-memory SSL to the ssl module. Patch by Geert Jansen. + +.. + +.. bpo: 21173 +.. date: 7714 +.. nonce: egkbEx +.. section: Library + +Fix len() on a WeakKeyDictionary when .clear() was called with an iterator +alive. + +.. + +.. bpo: 11866 +.. date: 7713 +.. nonce: xrvbIC +.. section: Library + +Eliminated race condition in the computation of names for new threads. + +.. + +.. bpo: 21905 +.. date: 7712 +.. nonce: coKyRo +.. section: Library + +Avoid RuntimeError in pickle.whichmodule() when sys.modules is mutated while +iterating. Patch by Olivier Grisel. + +.. + +.. bpo: 11271 +.. date: 7711 +.. nonce: ZYiJru +.. section: Library + +concurrent.futures.Executor.map() now takes a *chunksize* argument to allow +batching of tasks in child processes and improve performance of +ProcessPoolExecutor. Patch by Dan O'Reilly. + +.. + +.. bpo: 21883 +.. date: 7710 +.. nonce: qpuQu6 +.. section: Library + +os.path.join() and os.path.relpath() now raise a TypeError with more helpful +error message for unsupported or mismatched types of arguments. + +.. + +.. bpo: 22219 +.. date: 7709 +.. nonce: l9Enh9 +.. section: Library + +The zipfile module CLI now adds entries for directories (including empty +directories) in ZIP file. + +.. + +.. bpo: 22449 +.. date: 7708 +.. nonce: nFW_Fl +.. section: Library + +In the ssl.SSLContext.load_default_certs, consult the environmental +variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. + +.. + +.. bpo: 22508 +.. date: 7707 +.. nonce: 2LbnGQ +.. section: Library + +The email.__version__ variable has been removed; the email code is no longer +shipped separately from the stdlib, and __version__ hasn't been updated in +several releases. + +.. + +.. bpo: 20076 +.. date: 7706 +.. nonce: -7OIVB +.. section: Library + +Added non derived UTF-8 aliases to locale aliases table. + +.. + +.. bpo: 20079 +.. date: 7705 +.. nonce: qM949O +.. section: Library + +Added locales supported in glibc 2.18 to locale alias table. + +.. + +.. bpo: 20218 +.. date: 7704 +.. nonce: CMgOyE +.. section: Library + +Added convenience methods read_text/write_text and read_bytes/ write_bytes +to pathlib.Path objects. + +.. + +.. bpo: 22396 +.. date: 7703 +.. nonce: cQSizA +.. section: Library + +On 32-bit AIX platform, don't expose os.posix_fadvise() nor +os.posix_fallocate() because their prototypes in system headers are wrong. + +.. + +.. bpo: 22517 +.. date: 7702 +.. nonce: qT6-aB +.. section: Library + +When an io.BufferedRWPair object is deallocated, clear its weakrefs. + +.. + +.. bpo: 22437 +.. date: 7701 +.. nonce: MRVnmQ +.. section: Library + +Number of capturing groups in regular expression is no longer limited by +100. + +.. + +.. bpo: 17442 +.. date: 7700 +.. nonce: rnc87D +.. section: Library + +InteractiveInterpreter now displays the full chained traceback in its +showtraceback method, to match the built in interactive interpreter. + +.. + +.. bpo: 23392 +.. date: 7699 +.. nonce: Pe7_WK +.. section: Library + +Added tests for marshal C API that works with FILE*. + +.. + +.. bpo: 10510 +.. date: 7698 +.. nonce: N-ntcD +.. section: Library + +distutils register and upload methods now use HTML standards compliant CRLF +line endings. + +.. + +.. bpo: 9850 +.. date: 7697 +.. nonce: D-UnVi +.. section: Library + +Fixed macpath.join() for empty first component. Patch by Oleg Oshmyan. + +.. + +.. bpo: 5309 +.. date: 7696 +.. nonce: pVMmQ8 +.. section: Library + +distutils' build and build_ext commands now accept a ``-j`` option to enable +parallel building of extension modules. + +.. + +.. bpo: 22448 +.. date: 7695 +.. nonce: fAapvE +.. section: Library + +Improve canceled timer handles cleanup to prevent unbound memory usage. +Patch by Joshua Moore-Oliva. + +.. + +.. bpo: 22427 +.. date: 7694 +.. nonce: TZ5S_u +.. section: Library + +TemporaryDirectory no longer attempts to clean up twice when used in the +with statement in generator. + +.. + +.. bpo: 22362 +.. date: 7693 +.. nonce: xIBThN +.. section: Library + +Forbidden ambiguous octal escapes out of range 0-0o377 in regular +expressions. + +.. + +.. bpo: 20912 +.. date: 7692 +.. nonce: cAq3mZ +.. section: Library + +Now directories added to ZIP file have correct Unix and MS-DOS directory +attributes. + +.. + +.. bpo: 21866 +.. date: 7691 +.. nonce: hSc4wM +.. section: Library + +ZipFile.close() no longer writes ZIP64 central directory records if +allowZip64 is false. + +.. + +.. bpo: 22278 +.. date: 7690 +.. nonce: abqBXZ +.. section: Library + +Fix urljoin problem with relative urls, a regression observed after changes +to issue22118 were submitted. + +.. + +.. bpo: 22415 +.. date: 7689 +.. nonce: xJLAvI +.. section: Library + +Fixed debugging output of the GROUPREF_EXISTS opcode in the re module. +Removed trailing spaces in debugging output. + +.. + +.. bpo: 22423 +.. date: 7688 +.. nonce: Rtb4oT +.. section: Library + +Unhandled exception in thread no longer causes unhandled AttributeError when +sys.stderr is None. + +.. + +.. bpo: 21332 +.. date: 7687 +.. nonce: Gwxwlr +.. section: Library + +Ensure that ``bufsize=1`` in subprocess.Popen() selects line buffering, +rather than block buffering. Patch by Akira Li. + +.. + +.. bpo: 21091 +.. date: 7686 +.. nonce: M5hAtT +.. section: Library + +Fix API bug: email.message.EmailMessage.is_attachment is now a method. + +.. + +.. bpo: 21079 +.. date: 7685 +.. nonce: czVcL8 +.. section: Library + +Fix email.message.EmailMessage.is_attachment to return the correct result +when the header has parameters as well as a value. + +.. + +.. bpo: 22247 +.. date: 7684 +.. nonce: sGIpR3 +.. section: Library + +Add NNTPError to nntplib.__all__. + +.. + +.. bpo: 22366 +.. date: 7683 +.. nonce: Dd1eFj +.. section: Library + +urllib.request.urlopen will accept a context object (SSLContext) as an +argument which will then be used for HTTPS connection. Patch by Alex Gaynor. + +.. + +.. bpo: 4180 +.. date: 7682 +.. nonce: QBx0JK +.. section: Library + +The warnings registries are now reset when the filters are modified. + +.. + +.. bpo: 22419 +.. date: 7681 +.. nonce: FqH4aC +.. section: Library + +Limit the length of incoming HTTP request in wsgiref server to 65536 bytes +and send a 414 error code for higher lengths. Patch contributed by Devin +Cook. + +.. + +.. bpo: 0 +.. date: 7680 +.. nonce: y7r3O2 +.. section: Library + +Lax cookie parsing in http.cookies could be a security issue when combined +with non-standard cookie handling in some Web browsers. Reported by Sergey +Bobrov. + +.. + +.. bpo: 20537 +.. date: 7679 +.. nonce: E0CE54 +.. section: Library + +logging methods now accept an exception instance as well as a Boolean value +or exception tuple. Thanks to Yury Selivanov for the patch. + +.. + +.. bpo: 22384 +.. date: 7678 +.. nonce: -Nl4He +.. section: Library + +An exception in Tkinter callback no longer crashes the program when it is +run with pythonw.exe. + +.. + +.. bpo: 22168 +.. date: 7677 +.. nonce: vLeKWC +.. section: Library + +Prevent turtle AttributeError with non-default Canvas on OS X. + +.. + +.. bpo: 21147 +.. date: 7676 +.. nonce: w9DE17 +.. section: Library + +sqlite3 now raises an exception if the request contains a null character +instead of truncating it. Based on patch by Victor Stinner. + +.. + +.. bpo: 13968 +.. date: 7675 +.. nonce: 1okGqm +.. section: Library + +The glob module now supports recursive search in subdirectories using the +``**`` pattern. + +.. + +.. bpo: 21951 +.. date: 7674 +.. nonce: 3vS4LK +.. section: Library + +Fixed a crash in Tkinter on AIX when called Tcl command with empty string or +tuple argument. + +.. + +.. bpo: 21951 +.. date: 7673 +.. nonce: _CCC4v +.. section: Library + +Tkinter now most likely raises MemoryError instead of crash if the memory +allocation fails. + +.. + +.. bpo: 22338 +.. date: 7672 +.. nonce: rKlCMz +.. section: Library + +Fix a crash in the json module on memory allocation failure. + +.. + +.. bpo: 12410 +.. date: 7671 +.. nonce: oFf-cB +.. section: Library + +imaplib.IMAP4 now supports the context management protocol. Original patch +by Tarek Ziad?. + +.. + +.. bpo: 21270 +.. date: 7670 +.. nonce: qMBaY- +.. section: Library + +We now override tuple methods in mock.call objects so that they can be used +as normal call attributes. + +.. + +.. bpo: 16662 +.. date: 7669 +.. nonce: Nghn-Y +.. section: Library + +load_tests() is now unconditionally run when it is present in a package's +__init__.py. TestLoader.loadTestsFromModule() still accepts use_load_tests, +but it is deprecated and ignored. A new keyword-only attribute `pattern` is +added and documented. Patch given by Robert Collins, tweaked by Barry +Warsaw. + +.. + +.. bpo: 22226 +.. date: 7668 +.. nonce: T1ZMPY +.. section: Library + +First letter no longer is stripped from the "status" key in the result of +Treeview.heading(). + +.. + +.. bpo: 19524 +.. date: 7667 +.. nonce: EQJjlF +.. section: Library + +Fixed resource leak in the HTTP connection when an invalid response is +received. Patch by Martin Panter. + +.. + +.. bpo: 20421 +.. date: 7666 +.. nonce: iR0S1s +.. section: Library + +Add a .version() method to SSL sockets exposing the actual protocol version +in use. + +.. + +.. bpo: 19546 +.. date: 7665 +.. nonce: 8VdYBK +.. section: Library + +configparser exceptions no longer expose implementation details. Chained +KeyErrors are removed, which leads to cleaner tracebacks. Patch by Claudiu +Popa. + +.. + +.. bpo: 22051 +.. date: 7664 +.. nonce: cUjFqL +.. section: Library + +turtledemo no longer reloads examples to re-run them. Initialization of +variables and gui setup should be done in main(), which is called each time +a demo is run, but not on import. + +.. + +.. bpo: 21933 +.. date: 7663 +.. nonce: IhMjN1 +.. section: Library + +Turtledemo users can change the code font size with a menu selection or +control(command) '-' or '+' or control-mousewheel. Original patch by Lita +Cho. + +.. + +.. bpo: 21597 +.. date: 7662 +.. nonce: aPTCWJ +.. section: Library + +The separator between the turtledemo text pane and the drawing canvas can +now be grabbed and dragged with a mouse. The code text pane can be widened +to easily view or copy the full width of the text. The canvas can be +widened on small screens. Original patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 18132 +.. date: 7661 +.. nonce: 2R2nwM +.. section: Library + +Turtledemo buttons no longer disappear when the window is shrunk. Original +patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 22043 +.. date: 7660 +.. nonce: Q6RvGL +.. section: Library + +time.monotonic() is now always available. ``threading.Lock.acquire()``, +``threading.RLock.acquire()`` and socket operations now use a monotonic +clock, instead of the system clock, when a timeout is used. + +.. + +.. bpo: 21527 +.. date: 7659 +.. nonce: N5WPxr +.. section: Library + +Add a default number of workers to ThreadPoolExecutor equal to 5 times the +number of CPUs. Patch by Claudiu Popa. + +.. + +.. bpo: 22216 +.. date: 7658 +.. nonce: Cmalu6 +.. section: Library + +smtplib now resets its state more completely after a quit. The most obvious +consequence of the previous behavior was a STARTTLS failure during a +connect/starttls/quit/connect/starttls sequence. + +.. + +.. bpo: 22098 +.. date: 7657 +.. nonce: 5JYiQN +.. section: Library + +ctypes' BigEndianStructure and LittleEndianStructure now define an empty +__slots__ so that subclasses don't always get an instance dict. Patch by +Claudiu Popa. + +.. + +.. bpo: 22185 +.. date: 7656 +.. nonce: 1SCCIK +.. section: Library + +Fix an occasional RuntimeError in threading.Condition.wait() caused by +mutation of the waiters queue without holding the lock. Patch by Doug +Zongker. + +.. + +.. bpo: 22287 +.. date: 7655 +.. nonce: awH2AI +.. section: Library + +On UNIX, _PyTime_gettimeofday() now uses clock_gettime(CLOCK_REALTIME) if +available. As a side effect, Python now depends on the librt library on +Solaris and on Linux (only with glibc older than 2.17). + +.. + +.. bpo: 22182 +.. date: 7654 +.. nonce: 5EG1Bc +.. section: Library + +Use e.args to unpack exceptions correctly in distutils.file_util.move_file. +Patch by Claudiu Popa. + +.. + +.. bpo: 0 +.. date: 7653 +.. nonce: zBfe8J +.. section: Library + +The webbrowser module now uses subprocess's start_new_session=True rather +than a potentially risky preexec_fn=os.setsid call. + +.. + +.. bpo: 22042 +.. date: 7652 +.. nonce: WZvb8s +.. section: Library + +signal.set_wakeup_fd(fd) now raises an exception if the file descriptor is +in blocking mode. + +.. + +.. bpo: 16808 +.. date: 7651 +.. nonce: kPy_5U +.. section: Library + +inspect.stack() now returns a named tuple instead of a tuple. Patch by +Daniel Shahaf. + +.. + +.. bpo: 22236 +.. date: 7650 +.. nonce: 1utXkg +.. section: Library + +Fixed Tkinter images copying operations in NoDefaultRoot mode. + +.. + +.. bpo: 2527 +.. date: 7649 +.. nonce: fR2GS6 +.. section: Library + +Add a *globals* argument to timeit functions, in order to override the +globals namespace in which the timed code is executed. Patch by Ben Roberts. + +.. + +.. bpo: 22118 +.. date: 7648 +.. nonce: 3gdkOF +.. section: Library + +Switch urllib.parse to use RFC 3986 semantics for the resolution of relative +URLs, rather than RFCs 1808 and 2396. Patch by Demian Brecht. + +.. + +.. bpo: 21549 +.. date: 7647 +.. nonce: i1LVvg +.. section: Library + +Added the "members" parameter to TarFile.list(). + +.. + +.. bpo: 19628 +.. date: 7646 +.. nonce: ssQVP8 +.. section: Library + +Allow compileall recursion depth to be specified with a -r option. + +.. + +.. bpo: 15696 +.. date: 7645 +.. nonce: PTwXYJ +.. section: Library + +Add a __sizeof__ implementation for mmap objects on Windows. + +.. + +.. bpo: 22068 +.. date: 7644 +.. nonce: wCdaW0 +.. section: Library + +Avoided reference loops with Variables and Fonts in Tkinter. + +.. + +.. bpo: 22165 +.. date: 7643 +.. nonce: J1np4o +.. section: Library + +SimpleHTTPRequestHandler now supports undecodable file names. + +.. + +.. bpo: 15381 +.. date: 7642 +.. nonce: Ia8pf6 +.. section: Library + +Optimized line reading in io.BytesIO. + +.. + +.. bpo: 8797 +.. date: 7641 +.. nonce: aJcIPu +.. section: Library + +Raise HTTPError on failed Basic Authentication immediately. Initial patch by +Sam Bull. + +.. + +.. bpo: 20729 +.. date: 7640 +.. nonce: I-1Lap +.. section: Library + +Restored the use of lazy iterkeys()/itervalues()/iteritems() in the mailbox +module. + +.. + +.. bpo: 21448 +.. date: 7639 +.. nonce: THJSYB +.. section: Library + +Changed FeedParser feed() to avoid O(N**2) behavior when parsing long line. +Original patch by Raymond Hettinger. + +.. + +.. bpo: 22184 +.. date: 7638 +.. nonce: UCbSOt +.. section: Library + +The functools LRU Cache decorator factory now gives an earlier and clearer +error message when the user forgets the required parameters. + +.. + +.. bpo: 17923 +.. date: 7637 +.. nonce: YI_QjG +.. section: Library + +glob() patterns ending with a slash no longer match non-dirs on AIX. Based +on patch by Delhallt. + +.. + +.. bpo: 21725 +.. date: 7636 +.. nonce: eIu-2N +.. section: Library + +Added support for RFC 6531 (SMTPUTF8) in smtpd. + +.. + +.. bpo: 22176 +.. date: 7635 +.. nonce: rgbRyg +.. section: Library + +Update the ctypes module's libffi to v3.1. This release adds support for +the Linux AArch64 and POWERPC ELF ABIv2 little endian architectures. + +.. + +.. bpo: 5411 +.. date: 7634 +.. nonce: 5Utapn +.. section: Library + +Added support for the "xztar" format in the shutil module. + +.. + +.. bpo: 21121 +.. date: 7633 +.. nonce: ZLsRil +.. section: Library + +Don't force 3rd party C extensions to be built with -Werror=declaration- +after-statement. + +.. + +.. bpo: 21975 +.. date: 7632 +.. nonce: MI8ntO +.. section: Library + +Fixed crash when using uninitialized sqlite3.Row (in particular when +unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the +__new__() method. + +.. + +.. bpo: 20170 +.. date: 7631 +.. nonce: 8QfhN7 +.. section: Library + +Convert posixmodule to use Argument Clinic. + +.. + +.. bpo: 21539 +.. date: 7630 +.. nonce: YccmZF +.. section: Library + +Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic `mkdir -p` and +`os.makedirs()` functionality. When true, ignore FileExistsErrors. Patch +by Berker Peksag. + +.. + +.. bpo: 22127 +.. date: 7629 +.. nonce: 0l2OO5 +.. section: Library + +Bypass IDNA for pure-ASCII host names in the socket module (in particular +for numeric IPs). + +.. + +.. bpo: 21047 +.. date: 7628 +.. nonce: XfUQG3 +.. section: Library + +set the default value for the *convert_charrefs* argument of HTMLParser to +True. Patch by Berker Peksag. + +.. + +.. bpo: 0 +.. date: 7627 +.. nonce: 56bAnQ +.. section: Library + +Add an __all__ to html.entities. + +.. + +.. bpo: 15114 +.. date: 7626 +.. nonce: jXwseC +.. section: Library + +the strict mode and argument of HTMLParser, HTMLParser.error, and the +HTMLParserError exception have been removed. + +.. + +.. bpo: 22085 +.. date: 7625 +.. nonce: 3JM_Aw +.. section: Library + +Dropped support of Tk 8.3 in Tkinter. + +.. + +.. bpo: 21580 +.. date: 7624 +.. nonce: 3ssycS +.. section: Library + +Now Tkinter correctly handles bytes arguments passed to Tk. In particular +this allows initializing images from binary data. + +.. + +.. bpo: 22003 +.. date: 7623 +.. nonce: 4ZIDS1 +.. section: Library + +When initialized from a bytes object, io.BytesIO() now defers making a copy +until it is mutated, improving performance and memory use on some use cases. +Patch by David Wilson. + +.. + +.. bpo: 22018 +.. date: 7622 +.. nonce: 6ApxSH +.. section: Library + +On Windows, signal.set_wakeup_fd() now also supports sockets. A side effect +is that Python depends to the WinSock library. + +.. + +.. bpo: 22054 +.. date: 7621 +.. nonce: zp6Svw +.. section: Library + +Add os.get_blocking() and os.set_blocking() functions to get and set the +blocking mode of a file descriptor (False if the O_NONBLOCK flag is set, +True otherwise). These functions are not available on Windows. + +.. + +.. bpo: 17172 +.. date: 7620 +.. nonce: R_LI_2 +.. section: Library + +Make turtledemo start as active on OS X even when run with subprocess. +Patch by Lita Cho. + +.. + +.. bpo: 21704 +.. date: 7619 +.. nonce: gL3ikj +.. section: Library + +Fix build error for _multiprocessing when semaphores are not available. +Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 20173 +.. date: 7618 +.. nonce: FAL-4L +.. section: Library + +Convert sha1, sha256, sha512 and md5 to ArgumentClinic. Patch by Vajrasky +Kok. + +.. + +.. bpo: 0 +.. date: 7617 +.. nonce: G25tq3 +.. section: Library + +Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError on +closed socket. repr(socket.socket) already works fine. + +.. + +.. bpo: 22033 +.. date: 7616 +.. nonce: nkBNci +.. section: Library + +Reprs of most Python implemened classes now contain actual class name +instead of hardcoded one. + +.. + +.. bpo: 21947 +.. date: 7615 +.. nonce: mlisu- +.. section: Library + +The dis module can now disassemble generator-iterator objects based on their +gi_code attribute. Patch by Clement Rouault. + +.. + +.. bpo: 16133 +.. date: 7614 +.. nonce: tYuYQF +.. section: Library + +The asynchat.async_chat.handle_read() method now ignores BlockingIOError +exceptions. + +.. + +.. bpo: 22044 +.. date: 7613 +.. nonce: t09GRU +.. section: Library + +Fixed premature DECREF in call_tzinfo_method. Patch by Tom Flanagan. + +.. + +.. bpo: 19884 +.. date: 7612 +.. nonce: v73gSn +.. section: Library + +readline: Disable the meta modifier key if stdout is not a terminal to not +write the ANSI sequence ``"\033[1034h"`` into stdout. This sequence is used +on some terminal (ex: TERM=xterm-256color") to enable support of 8 bit +characters. + +.. + +.. bpo: 4350 +.. date: 7611 +.. nonce: nrTzJn +.. section: Library + +Removed a number of out-of-dated and non-working for a long time Tkinter +methods. + +.. + +.. bpo: 6167 +.. date: 7610 +.. nonce: n9dV_D +.. section: Library + +Scrollbar.activate() now returns the name of active element if the argument +is not specified. Scrollbar.set() now always accepts only 2 arguments. + +.. + +.. bpo: 15275 +.. date: 7609 +.. nonce: jk0tTI +.. section: Library + +Clean up and speed up the ntpath module. + +.. + +.. bpo: 21888 +.. date: 7608 +.. nonce: danlpz +.. section: Library + +plistlib's load() and loads() now work if the fmt parameter is specified. + +.. + +.. bpo: 22032 +.. date: 7607 +.. nonce: UklzQW +.. section: Library + +__qualname__ instead of __name__ is now always used to format fully +qualified class names of Python implemented classes. + +.. + +.. bpo: 22031 +.. date: 7606 +.. nonce: 9aazp1 +.. section: Library + +Reprs now always use hexadecimal format with the "0x" prefix when contain an +id in form " at 0x...". + +.. + +.. bpo: 22018 +.. date: 7605 +.. nonce: b_JTHH +.. section: Library + +signal.set_wakeup_fd() now raises an OSError instead of a ValueError on +``fstat()`` failure. + +.. + +.. bpo: 21044 +.. date: 7604 +.. nonce: 16xo9u +.. section: Library + +tarfile.open() now handles fileobj with an integer 'name' attribute. Based +on patch by Antoine Pietri. + +.. + +.. bpo: 21966 +.. date: 7603 +.. nonce: hHD9MK +.. section: Library + +Respect -q command-line option when code module is ran. + +.. + +.. bpo: 19076 +.. date: 7602 +.. nonce: xCoIai +.. section: Library + +Don't pass the redundant 'file' argument to self.error(). + +.. + +.. bpo: 16382 +.. date: 7601 +.. nonce: -XBK7z +.. section: Library + +Improve exception message of warnings.warn() for bad category. Initial patch +by Phil Elson. + +.. + +.. bpo: 21932 +.. date: 7600 +.. nonce: LK_5S1 +.. section: Library + +os.read() now uses a :c:func:`Py_ssize_t` type instead of :c:type:`int` for +the size to support reading more than 2 GB at once. On Windows, the size is +truncted to INT_MAX. As any call to os.read(), the OS may read less bytes +than the number of requested bytes. + +.. + +.. bpo: 21942 +.. date: 7599 +.. nonce: TLOS41 +.. section: Library + +Fixed source file viewing in pydoc's server mode on Windows. + +.. + +.. bpo: 11259 +.. date: 7598 +.. nonce: GxfYnE +.. section: Library + +asynchat.async_chat().set_terminator() now raises a ValueError if the number +of received bytes is negative. + +.. + +.. bpo: 12523 +.. date: 7597 +.. nonce: XBdAky +.. section: Library + +asynchat.async_chat.push() now raises a TypeError if it doesn't get a bytes +string + +.. + +.. bpo: 21707 +.. date: 7596 +.. nonce: rrY_wd +.. section: Library + +Add missing kwonlyargcount argument to ModuleFinder.replace_paths_in_code(). + +.. + +.. bpo: 20639 +.. date: 7595 +.. nonce: YdvOpp +.. section: Library + +calling Path.with_suffix('') allows removing the suffix again. Patch by +July Tikhonov. + +.. + +.. bpo: 21714 +.. date: 7594 +.. nonce: HhkGXW +.. section: Library + +Disallow the construction of invalid paths using Path.with_name(). Original +patch by Antony Lee. + +.. + +.. bpo: 15014 +.. date: 7593 +.. nonce: dB50zb +.. section: Library + +Added 'auth' method to smtplib to make implementing auth mechanisms simpler, +and used it internally in the login method. + +.. + +.. bpo: 21151 +.. date: 7592 +.. nonce: o7IuiD +.. section: Library + +Fixed a segfault in the winreg module when ``None`` is passed as a +``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. + +.. + +.. bpo: 21090 +.. date: 7591 +.. nonce: 20Ooif +.. section: Library + +io.FileIO.readall() does not ignore I/O errors anymore. Before, it ignored +I/O errors if at least the first C call read() succeed. + +.. + +.. bpo: 5800 +.. date: 7590 +.. nonce: ZJiLZP +.. section: Library + +headers parameter of wsgiref.headers.Headers is now optional. Initial patch +by Pablo Torres Navarrete and SilentGhost. + +.. + +.. bpo: 21781 +.. date: 7589 +.. nonce: u_oiv9 +.. section: Library + +ssl.RAND_add() now supports strings longer than 2 GB. + +.. + +.. bpo: 21679 +.. date: 7588 +.. nonce: CTVT9A +.. section: Library + +Prevent extraneous fstat() calls during open(). Patch by Bohuslav Kabrda. + +.. + +.. bpo: 21863 +.. date: 7587 +.. nonce: BzbwSL +.. section: Library + +cProfile now displays the module name of C extension functions, in addition +to their own name. + +.. + +.. bpo: 11453 +.. date: 7586 +.. nonce: 53Gr_R +.. section: Library + +asyncore: emit a ResourceWarning when an unclosed file_wrapper object is +destroyed. The destructor now closes the file if needed. The close() method +can now be called twice: the second call does nothing. + +.. + +.. bpo: 21858 +.. date: 7585 +.. nonce: 0hbFBG +.. section: Library + +Better handling of Python exceptions in the sqlite3 module. + +.. + +.. bpo: 21476 +.. date: 7584 +.. nonce: VN-5pW +.. section: Library + +Make sure the email.parser.BytesParser TextIOWrapper is discarded after +parsing, so the input file isn't unexpectedly closed. + +.. + +.. bpo: 20295 +.. date: 7583 +.. nonce: U1MPhw +.. section: Library + +imghdr now recognizes OpenEXR format images. + +.. + +.. bpo: 21729 +.. date: 7582 +.. nonce: dk7o_U +.. section: Library + +Used the "with" statement in the dbm.dumb module to ensure files closing. +Patch by Claudiu Popa. + +.. + +.. bpo: 21491 +.. date: 7581 +.. nonce: Zxmut- +.. section: Library + +socketserver: Fix a race condition in child processes reaping. + +.. + +.. bpo: 21719 +.. date: 7580 +.. nonce: DhQz3I +.. section: Library + +Added the ``st_file_attributes`` field to os.stat_result on Windows. + +.. + +.. bpo: 21832 +.. date: 7579 +.. nonce: PBA0Uu +.. section: Library + +Require named tuple inputs to be exact strings. + +.. + +.. bpo: 21722 +.. date: 7578 +.. nonce: WTHuRy +.. section: Library + +The distutils "upload" command now exits with a non-zero return code when +uploading fails. Patch by Martin Dengler. + +.. + +.. bpo: 21723 +.. date: 7577 +.. nonce: r86fwb +.. section: Library + +asyncio.Queue: support any type of number (ex: float) for the maximum size. +Patch written by Vajrasky Kok. + +.. + +.. bpo: 21711 +.. date: 7576 +.. nonce: JWPFQZ +.. section: Library + +support for "site-python" directories has now been removed from the site +module (it was deprecated in 3.4). + +.. + +.. bpo: 17552 +.. date: 7575 +.. nonce: NunErD +.. section: Library + +new socket.sendfile() method allowing a file to be sent over a socket by +using high-performance os.sendfile() on UNIX. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 18039 +.. date: 7574 +.. nonce: vC9hNy +.. section: Library + +dbm.dump.open() now always creates a new database when the flag has the +value 'n'. Patch by Claudiu Popa. + +.. + +.. bpo: 21326 +.. date: 7573 +.. nonce: Y6iW3s +.. section: Library + +Add a new is_closed() method to asyncio.BaseEventLoop. run_forever() and +run_until_complete() methods of asyncio.BaseEventLoop now raise an exception +if the event loop was closed. + +.. + +.. bpo: 21766 +.. date: 7572 +.. nonce: 0xk_xC +.. section: Library + +Prevent a security hole in CGIHTTPServer by URL unquoting paths before +checking for a CGI script at that path. + +.. + +.. bpo: 21310 +.. date: 7571 +.. nonce: 2mjByJ +.. section: Library + +Fixed possible resource leak in failed open(). + +.. + +.. bpo: 21256 +.. date: 7570 +.. nonce: dGq6cw +.. section: Library + +Printout of keyword args should be in deterministic order in a mock function +call. This will help to write better doctests. + +.. + +.. bpo: 21677 +.. date: 7569 +.. nonce: 58CDDD +.. section: Library + +Fixed chaining nonnormalized exceptions in io close() methods. + +.. + +.. bpo: 11709 +.. date: 7568 +.. nonce: JdObvL +.. section: Library + +Fix the pydoc.help function to not fail when sys.stdin is not a valid file. + +.. + +.. bpo: 21515 +.. date: 7567 +.. nonce: D9TLJF +.. section: Library + +tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. + +.. + +.. bpo: 13223 +.. date: 7566 +.. nonce: 9AzEbN +.. section: Library + +Fix pydoc.writedoc so that the HTML documentation for methods that use +'self' in the example code is generated correctly. + +.. + +.. bpo: 21463 +.. date: 7565 +.. nonce: 09PsgH +.. section: Library + +In urllib.request, fix pruning of the FTP cache. + +.. + +.. bpo: 21618 +.. date: 7564 +.. nonce: 3Z7WS3 +.. section: Library + +The subprocess module could fail to close open fds that were inherited by +the calling process and already higher than POSIX resource limits would +otherwise allow. On systems with a functioning /proc/self/fd or /dev/fd +interface the max is now ignored and all fds are closed. + +.. + +.. bpo: 20383 +.. date: 7563 +.. nonce: pSPFpW +.. section: Library + +Introduce importlib.util.module_from_spec() as the preferred way to create a +new module. + +.. + +.. bpo: 21552 +.. date: 7562 +.. nonce: uVy4tM +.. section: Library + +Fixed possible integer overflow of too long string lengths in the tkinter +module on 64-bit platforms. + +.. + +.. bpo: 14315 +.. date: 7561 +.. nonce: YzZzS8 +.. section: Library + +The zipfile module now ignores extra fields in the central directory that +are too short to be parsed instead of letting a struct.unpack error bubble +up as this "bad data" appears in many real world zip files in the wild and +is ignored by other zip tools. + +.. + +.. bpo: 13742 +.. date: 7560 +.. nonce: QJiVSC +.. section: Library + +Added "key" and "reverse" parameters to heapq.merge(). (First draft of patch +contributed by Simon Sapin.) + +.. + +.. bpo: 21402 +.. date: 7559 +.. nonce: 51vDXt +.. section: Library + +tkinter.ttk now works when default root window is not set. + +.. + +.. bpo: 3015 +.. date: 7558 +.. nonce: FE_PII +.. section: Library + +_tkinter.create() now creates tkapp object with wantobject=1 by default. + +.. + +.. bpo: 10203 +.. date: 7557 +.. nonce: zgr0hh +.. section: Library + +sqlite3.Row now truly supports sequence protocol. In particular it supports +reverse() and negative indices. Original patch by Claudiu Popa. + +.. + +.. bpo: 18807 +.. date: 7556 +.. nonce: XP7p8B +.. section: Library + +If copying (no symlinks) specified for a venv, then the python interpreter +aliases (python, python3) are now created by copying rather than symlinking. + +.. + +.. bpo: 20197 +.. date: 7555 +.. nonce: nYR9fq +.. section: Library + +Added support for the WebP image type in the imghdr module. Patch by Fabrice +Aneche and Claudiu Popa. + +.. + +.. bpo: 21513 +.. date: 7554 +.. nonce: ro4AOe +.. section: Library + +Speedup some properties of IP addresses (IPv4Address, IPv6Address) such as +.is_private or .is_multicast. + +.. + +.. bpo: 21137 +.. date: 7553 +.. nonce: wgHb_F +.. section: Library + +Improve the repr for threading.Lock() and its variants by showing the +"locked" or "unlocked" status. Patch by Berker Peksag. + +.. + +.. bpo: 21538 +.. date: 7552 +.. nonce: Q60FWA +.. section: Library + +The plistlib module now supports loading of binary plist files when +reference or offset size is not a power of two. + +.. + +.. bpo: 21455 +.. date: 7551 +.. nonce: 6-Uvv4 +.. section: Library + +Add a default backlog to socket.listen(). + +.. + +.. bpo: 21525 +.. date: 7550 +.. nonce: hAKOve +.. section: Library + +Most Tkinter methods which accepted tuples now accept lists too. + +.. + +.. bpo: 22166 +.. date: 7549 +.. nonce: sZYhmv +.. section: Library + +With the assistance of a new internal _codecs._forget_codec helping +function, test_codecs now clears the encoding caches to avoid the appearance +of a reference leak + +.. + +.. bpo: 22236 +.. date: 7548 +.. nonce: ginJSI +.. section: Library + +Tkinter tests now don't reuse default root window. New root window is +created for every test class. + +.. + +.. bpo: 10744 +.. date: 7547 +.. nonce: kfV0wm +.. section: Library + +Fix PEP 3118 format strings on ctypes objects with a nontrivial shape. + +.. + +.. bpo: 20826 +.. date: 7546 +.. nonce: 3rXqMC +.. section: Library + +Optimize ipaddress.collapse_addresses(). + +.. + +.. bpo: 21487 +.. date: 7545 +.. nonce: sX8YmK +.. section: Library + +Optimize ipaddress.summarize_address_range() and +ipaddress.{IPv4Network,IPv6Network}.subnets(). + +.. + +.. bpo: 21486 +.. date: 7544 +.. nonce: CeFKRP +.. section: Library + +Optimize parsing of netmasks in ipaddress.IPv4Network and +ipaddress.IPv6Network. + +.. + +.. bpo: 13916 +.. date: 7543 +.. nonce: D77YVH +.. section: Library + +Disallowed the surrogatepass error handler for non UTF-\* encodings. + +.. + +.. bpo: 20998 +.. date: 7542 +.. nonce: fkxpXI +.. section: Library + +Fixed re.fullmatch() of repeated single character pattern with ignore case. +Original patch by Matthew Barnett. + +.. + +.. bpo: 21075 +.. date: 7541 +.. nonce: f_hmEh +.. section: Library + +fileinput.FileInput now reads bytes from standard stream if binary mode is +specified. Patch by Sam Kimbrel. + +.. + +.. bpo: 19775 +.. date: 7540 +.. nonce: yxxD_R +.. section: Library + +Add a samefile() method to pathlib Path objects. Initial patch by Vajrasky +Kok. + +.. + +.. bpo: 21226 +.. date: 7539 +.. nonce: pzGmG1 +.. section: Library + +Set up modules properly in PyImport_ExecCodeModuleObject (and friends). + +.. + +.. bpo: 21398 +.. date: 7538 +.. nonce: guSBXt +.. section: Library + +Fix a unicode error in the pydoc pager when the documentation contains +characters not encodable to the stdout encoding. + +.. + +.. bpo: 16531 +.. date: 7537 +.. nonce: AhrY_v +.. section: Library + +ipaddress.IPv4Network and ipaddress.IPv6Network now accept an (address, +netmask) tuple argument, so as to easily construct network objects from +existing addresses. + +.. + +.. bpo: 21156 +.. date: 7536 +.. nonce: 3dmBEp +.. section: Library + +importlib.abc.InspectLoader.source_to_code() is now a staticmethod. + +.. + +.. bpo: 21424 +.. date: 7535 +.. nonce: 8CJBqW +.. section: Library + +Simplified and optimized heaqp.nlargest() and nmsmallest() to make fewer +tuple comparisons. + +.. + +.. bpo: 21396 +.. date: 7534 +.. nonce: cqO6DN +.. section: Library + +Fix TextIOWrapper(..., write_through=True) to not force a flush() on the +underlying binary stream. Patch by akira. + +.. + +.. bpo: 18314 +.. date: 7533 +.. nonce: NCd_KF +.. section: Library + +Unlink now removes junctions on Windows. Patch by Kim Gr?sman + +.. + +.. bpo: 21088 +.. date: 7532 +.. nonce: WOg7Xy +.. section: Library + +Bugfix for curses.window.addch() regression in 3.4.0. In porting to Argument +Clinic, the first two arguments were reversed. + +.. + +.. bpo: 21407 +.. date: 7531 +.. nonce: cZjFde +.. section: Library + +_decimal: The module now supports function signatures. + +.. + +.. bpo: 10650 +.. date: 7530 +.. nonce: HYT4Oe +.. section: Library + +Remove the non-standard 'watchexp' parameter from the Decimal.quantize() +method in the Python version. It had never been present in the C version. + +.. + +.. bpo: 21469 +.. date: 7529 +.. nonce: _fFGuq +.. section: Library + +Reduced the risk of false positives in robotparser by checking to make sure +that robots.txt has been read or does not exist prior to returning True in +can_fetch(). + +.. + +.. bpo: 19414 +.. date: 7528 +.. nonce: bAAw4D +.. section: Library + +Have the OrderedDict mark deleted links as unusable. This gives an early +failure if the link is deleted during iteration. + +.. + +.. bpo: 21421 +.. date: 7527 +.. nonce: 5AKAat +.. section: Library + +Add __slots__ to the MappingViews ABC. Patch by Josh Rosenberg. + +.. + +.. bpo: 21101 +.. date: 7526 +.. nonce: Lj-_P4 +.. section: Library + +Eliminate double hashing in the C speed-up code for collections.Counter(). + +.. + +.. bpo: 21321 +.. date: 7525 +.. nonce: wUkTON +.. section: Library + +itertools.islice() now releases the reference to the source iterator when +the slice is exhausted. Patch by Anton Afanasyev. + +.. + +.. bpo: 21057 +.. date: 7524 +.. nonce: 0TC4Xl +.. section: Library + +TextIOWrapper now allows the underlying binary stream's read() or read1() +method to return an arbitrary bytes-like object (such as a memoryview). +Patch by Nikolaus Rath. + +.. + +.. bpo: 20951 +.. date: 7523 +.. nonce: tF0dJi +.. section: Library + +SSLSocket.send() now raises either SSLWantReadError or SSLWantWriteError on +a non-blocking socket if the operation would block. Previously, it would +return 0. Patch by Nikolaus Rath. + +.. + +.. bpo: 13248 +.. date: 7522 +.. nonce: 7vtGj0 +.. section: Library + +removed previously deprecated asyncore.dispatcher __getattr__ cheap +inheritance hack. + +.. + +.. bpo: 9815 +.. date: 7521 +.. nonce: 52FPlI +.. section: Library + +assertRaises now tries to clear references to local variables in the +exception's traceback. + +.. + +.. bpo: 19940 +.. date: 7520 +.. nonce: 2qtBQ8 +.. section: Library + +ssl.cert_time_to_seconds() now interprets the given time string in the UTC +timezone (as specified in RFC 5280), not the local timezone. + +.. + +.. bpo: 13204 +.. date: 7519 +.. nonce: ZPKA5g +.. section: Library + +Calling sys.flags.__new__ would crash the interpreter, now it raises a +TypeError. + +.. + +.. bpo: 19385 +.. date: 7518 +.. nonce: PexO_g +.. section: Library + +Make operations on a closed dbm.dumb database always raise the same +exception. + +.. + +.. bpo: 21207 +.. date: 7517 +.. nonce: Hr72AB +.. section: Library + +Detect when the os.urandom cached fd has been closed or replaced, and open +it anew. + +.. + +.. bpo: 21291 +.. date: 7516 +.. nonce: 5sSLWN +.. section: Library + +subprocess's Popen.wait() is now thread safe so that multiple threads may be +calling wait() or poll() on a Popen instance at the same time without losing +the Popen.returncode value. + +.. + +.. bpo: 21127 +.. date: 7515 +.. nonce: A1aBjG +.. section: Library + +Path objects can now be instantiated from str subclass instances (such as +``numpy.str_``). + +.. + +.. bpo: 15002 +.. date: 7514 +.. nonce: qorYDe +.. section: Library + +urllib.response object to use _TemporaryFileWrapper (and +_TemporaryFileCloser) facility. Provides a better way to handle file +descriptor close. Patch contributed by Christian Theune. + +.. + +.. bpo: 12220 +.. date: 7513 +.. nonce: U25uE9 +.. section: Library + +mindom now raises a custom ValueError indicating it doesn't support spaces +in URIs instead of letting a 'split' ValueError bubble up. + +.. + +.. bpo: 21068 +.. date: 7512 +.. nonce: 9k6N9m +.. section: Library + +The ssl.PROTOCOL* constants are now enum members. + +.. + +.. bpo: 21276 +.. date: 7511 +.. nonce: JkfhvQ +.. section: Library + +posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. + +.. + +.. bpo: 21262 +.. date: 7510 +.. nonce: 1J5ylk +.. section: Library + +New method assert_not_called for Mock. It raises AssertionError if the mock +has been called. + +.. + +.. bpo: 21238 +.. date: 7509 +.. nonce: 5CDoox +.. section: Library + +New keyword argument `unsafe` to Mock. It raises `AttributeError` incase of +an attribute startswith assert or assret. + +.. + +.. bpo: 20896 +.. date: 7508 +.. nonce: oWwAb1 +.. section: Library + +ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not PROTOCOL_SSLv3, +for maximum compatibility. + +.. + +.. bpo: 21239 +.. date: 7507 +.. nonce: EalCNt +.. section: Library + +patch.stopall() didn't work deterministically when the same name was patched +more than once. + +.. + +.. bpo: 21203 +.. date: 7506 +.. nonce: 1IMs-Z +.. section: Library + +Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure +Koren for the patch. + +.. + +.. bpo: 21222 +.. date: 7505 +.. nonce: G6MQBP +.. section: Library + +Passing name keyword argument to mock.create_autospec now works. + +.. + +.. bpo: 21197 +.. date: 7504 +.. nonce: Gzfqdl +.. section: Library + +Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. + +.. + +.. bpo: 17498 +.. date: 7503 +.. nonce: LR9xyb +.. section: Library + +Some SMTP servers disconnect after certain errors, violating strict RFC +conformance. Instead of losing the error code when we issue the subsequent +RSET, smtplib now returns the error code and defers raising the +SMTPServerDisconnected error until the next command is issued. + +.. + +.. bpo: 17826 +.. date: 7502 +.. nonce: z0zMRV +.. section: Library + +setting an iterable side_effect on a mock function created by +create_autospec now works. Patch by Kushal Das. + +.. + +.. bpo: 7776 +.. date: 7501 +.. nonce: K5S2Pe +.. section: Library + +Fix ``Host:`` header and reconnection when using +http.client.HTTPConnection.set_tunnel(). Patch by Nikolaus Rath. + +.. + +.. bpo: 20968 +.. date: 7500 +.. nonce: 53Aagz +.. section: Library + +unittest.mock.MagicMock now supports division. Patch by Johannes Baiter. + +.. + +.. bpo: 21529 +.. date: 7499 +.. nonce: 57R_Fc +.. section: Library + +Fix arbitrary memory access in JSONDecoder.raw_decode with a negative second +parameter. Bug reported by Guido Vranken. (See also: CVE-2014-4616) + +.. + +.. bpo: 21169 +.. date: 7498 +.. nonce: KE7B0M +.. section: Library + +getpass now handles non-ascii characters that the input stream encoding +cannot encode by re-encoding using the replace error handler. + +.. + +.. bpo: 21171 +.. date: 7497 +.. nonce: iUbV9S +.. section: Library + +Fixed undocumented filter API of the rot13 codec. Patch by Berker Peksag. + +.. + +.. bpo: 20539 +.. date: 7496 +.. nonce: 62nbEb +.. section: Library + +Improved math.factorial error message for large positive inputs and changed +exception type (OverflowError -> ValueError) for large negative inputs. + +.. + +.. bpo: 21172 +.. date: 7495 +.. nonce: dQ7yY7 +.. section: Library + +isinstance check relaxed from dict to collections.Mapping. + +.. + +.. bpo: 21155 +.. date: 7494 +.. nonce: JSKEE7 +.. section: Library + +asyncio.EventLoop.create_unix_server() now raises a ValueError if path and +sock are specified at the same time. + +.. + +.. bpo: 21136 +.. date: 7493 +.. nonce: JZAKv3 +.. section: Library + +Avoid unnecessary normalization of Fractions resulting from power and other +operations. Patch by Raymond Hettinger. + +.. + +.. bpo: 17621 +.. date: 7492 +.. nonce: 1x0mvJ +.. section: Library + +Introduce importlib.util.LazyLoader. + +.. + +.. bpo: 21076 +.. date: 7491 +.. nonce: upxQc6 +.. section: Library + +signal module constants were turned into enums. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 20636 +.. date: 7490 +.. nonce: KGh-BD +.. section: Library + +Improved the repr of Tkinter widgets. + +.. + +.. bpo: 19505 +.. date: 7489 +.. nonce: VEtIE6 +.. section: Library + +The items, keys, and values views of OrderedDict now support reverse +iteration using reversed(). + +.. + +.. bpo: 21149 +.. date: 7488 +.. nonce: cnjwMR +.. section: Library + +Improved thread-safety in logging cleanup during interpreter shutdown. +Thanks to Devin Jeanpierre for the patch. + +.. + +.. bpo: 21058 +.. date: 7487 +.. nonce: IhluPP +.. section: Library + +Fix a leak of file descriptor in :func:`tempfile.NamedTemporaryFile`, close +the file descriptor if :func:`io.open` fails + +.. + +.. bpo: 21200 +.. date: 7486 +.. nonce: Kht8yD +.. section: Library + +Return None from pkgutil.get_loader() when __spec__ is missing. + +.. + +.. bpo: 21013 +.. date: 7485 +.. nonce: 3s8Ic0 +.. section: Library + +Enhance ssl.create_default_context() when used for server side sockets to +provide better security by default. + +.. + +.. bpo: 20145 +.. date: 7484 +.. nonce: FP5FY0 +.. section: Library + +`assertRaisesRegex` and `assertWarnsRegex` now raise a TypeError if the +second argument is not a string or compiled regex. + +.. + +.. bpo: 20633 +.. date: 7483 +.. nonce: 6kaPjT +.. section: Library + +Replace relative import by absolute import. + +.. + +.. bpo: 20980 +.. date: 7482 +.. nonce: cYszHY +.. section: Library + +Stop wrapping exception when using ThreadPool. + +.. + +.. bpo: 21082 +.. date: 7481 +.. nonce: GLzGlV +.. section: Library + +In os.makedirs, do not set the process-wide umask. Note this changes +behavior of makedirs when exist_ok=True. + +.. + +.. bpo: 20990 +.. date: 7480 +.. nonce: PBfjW3 +.. section: Library + +Fix issues found by pyflakes for multiprocessing. + +.. + +.. bpo: 21015 +.. date: 7479 +.. nonce: xnwWAH +.. section: Library + +SSL contexts will now automatically select an elliptic curve for ECDH key +exchange on OpenSSL 1.0.2 and later, and otherwise default to "prime256v1". + +.. + +.. bpo: 21000 +.. date: 7478 +.. nonce: JUyyVV +.. section: Library + +Improve the command-line interface of json.tool. + +.. + +.. bpo: 20995 +.. date: 7477 +.. nonce: KSORJT +.. section: Library + +Enhance default ciphers used by the ssl module to enable better security and +prioritize perfect forward secrecy. + +.. + +.. bpo: 20884 +.. date: 7476 +.. nonce: qNmub_ +.. section: Library + +Don't assume that __file__ is defined on importlib.__init__. + +.. + +.. bpo: 21499 +.. date: 7475 +.. nonce: wU4OBi +.. section: Library + +Ignore __builtins__ in several test_importlib.test_api tests. + +.. + +.. bpo: 20627 +.. date: 7474 +.. nonce: fgfQ1x +.. section: Library + +xmlrpc.client.ServerProxy is now a context manager. + +.. + +.. bpo: 19165 +.. date: 7473 +.. nonce: sAkUjU +.. section: Library + +The formatter module now raises DeprecationWarning instead of +PendingDeprecationWarning. + +.. + +.. bpo: 13936 +.. date: 7472 +.. nonce: _Q0Yog +.. section: Library + +Remove the ability of datetime.time instances to be considered false in +boolean contexts. + +.. + +.. bpo: 18931 +.. date: 7471 +.. nonce: mq4Mud +.. section: Library + +selectors module now supports /dev/poll on Solaris. Patch by Giampaolo +Rodola'. + +.. + +.. bpo: 19977 +.. date: 7470 +.. nonce: A-sQ_V +.. section: Library + +When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), +:py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the +``surrogateescape`` error handler, instead of the ``strict`` error handler. + +.. + +.. bpo: 20574 +.. date: 7469 +.. nonce: KaKqSs +.. section: Library + +Implement incremental decoder for cp65001 code (Windows code page 65001, +Microsoft UTF-8). + +.. + +.. bpo: 20879 +.. date: 7468 +.. nonce: myeYdq +.. section: Library + +Delay the initialization of encoding and decoding tables for base32, ascii85 +and base85 codecs in the base64 module, and delay the initialization of the +unquote_to_bytes() table of the urllib.parse module, to not waste memory if +these modules are not used. + +.. + +.. bpo: 19157 +.. date: 7467 +.. nonce: V1-XhC +.. section: Library + +Include the broadcast address in the usuable hosts for IPv6 in ipaddress. + +.. + +.. bpo: 11599 +.. date: 7466 +.. nonce: 9QOXf4 +.. section: Library + +When an external command (e.g. compiler) fails, distutils now prints out the +whole command line (instead of just the command name) if the environment +variable DISTUTILS_DEBUG is set. + +.. + +.. bpo: 4931 +.. date: 7465 +.. nonce: uF10hr +.. section: Library + +distutils should not produce unhelpful "error: None" messages anymore. +distutils.util.grok_environment_error is kept but doc-deprecated. + +.. + +.. bpo: 20875 +.. date: 7464 +.. nonce: IjfI5V +.. section: Library + +Prevent possible gzip "'read' is not defined" NameError. Patch by Claudiu +Popa. + +.. + +.. bpo: 11558 +.. date: 7463 +.. nonce: pxrsmq +.. section: Library + +``email.message.Message.attach`` now returns a more useful error message if +``attach`` is called on a message for which ``is_multipart`` is False. + +.. + +.. bpo: 20283 +.. date: 7462 +.. nonce: v0Vs9V +.. section: Library + +RE pattern methods now accept the string keyword parameters as documented. +The pattern and source keyword parameters are left as deprecated aliases. + +.. + +.. bpo: 20778 +.. date: 7461 +.. nonce: g_fAGI +.. section: Library + +Fix modulefinder to work with bytecode-only modules. + +.. + +.. bpo: 20791 +.. date: 7460 +.. nonce: n_zrkc +.. section: Library + +copy.copy() now doesn't make a copy when the input is a bytes object. +Initial patch by Peter Otten. + +.. + +.. bpo: 19748 +.. date: 7459 +.. nonce: kiA171 +.. section: Library + +On AIX, time.mktime() now raises an OverflowError for year outsize range +[1902; 2037]. + +.. + +.. bpo: 19573 +.. date: 7458 +.. nonce: QJvX_V +.. section: Library + +inspect.signature: Use enum for parameter kind constants. + +.. + +.. bpo: 20726 +.. date: 7457 +.. nonce: 0yfRDI +.. section: Library + +inspect.signature: Make Signature and Parameter picklable. + +.. + +.. bpo: 17373 +.. date: 7456 +.. nonce: ECwuJO +.. section: Library + +Add inspect.Signature.from_callable method. + +.. + +.. bpo: 20378 +.. date: 7455 +.. nonce: l9M3H- +.. section: Library + +Improve repr of inspect.Signature and inspect.Parameter. + +.. + +.. bpo: 20816 +.. date: 7454 +.. nonce: DFMEgN +.. section: Library + +Fix inspect.getcallargs() to raise correct TypeError for missing keyword- +only arguments. Patch by Jeremiah Lowin. + +.. + +.. bpo: 20817 +.. date: 7453 +.. nonce: O5XyZB +.. section: Library + +Fix inspect.getcallargs() to fail correctly if more than 3 arguments are +missing. Patch by Jeremiah Lowin. + +.. + +.. bpo: 6676 +.. date: 7452 +.. nonce: CJu5On +.. section: Library + +Ensure a meaningful exception is raised when attempting to parse more than +one XML document per pyexpat xmlparser instance. (Original patches by +Hirokazu Yamamoto and Amaury Forgeot d'Arc, with suggested wording by David +Gutteridge) + +.. + +.. bpo: 21117 +.. date: 7451 +.. nonce: hyH7EK +.. section: Library + +Fix inspect.signature to better support functools.partial. Due to the +specifics of functools.partial implementation, positional-or-keyword +arguments passed as keyword arguments become keyword-only. + +.. + +.. bpo: 20334 +.. date: 7450 +.. nonce: 0yFmfQ +.. section: Library + +inspect.Signature and inspect.Parameter are now hashable. Thanks to Antony +Lee for bug reports and suggestions. + +.. + +.. bpo: 15916 +.. date: 7449 +.. nonce: _vhKPn +.. section: Library + +doctest.DocTestSuite returns an empty unittest.TestSuite instead of raising +ValueError if it finds no tests + +.. + +.. bpo: 21209 +.. date: 7448 +.. nonce: wRE7Dn +.. section: Library + +Fix asyncio.tasks.CoroWrapper to workaround a bug in yield-from +implementation in CPythons prior to 3.4.1. + +.. + +.. bpo: 0 +.. date: 7447 +.. nonce: Q1I78Z +.. section: Library + +asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream +issue #163). + +.. + +.. bpo: 21311 +.. date: 7446 +.. nonce: JsDF8H +.. section: Library + +Avoid exception in _osx_support with non-standard compiler configurations. +Patch by John Szakmeister. + +.. + +.. bpo: 11571 +.. date: 7445 +.. nonce: RPeGNo +.. section: Library + +Ensure that the turtle window becomes the topmost window when launched on OS +X. + +.. + +.. bpo: 21801 +.. date: 7444 +.. nonce: rzfhYl +.. section: Library + +Validate that __signature__ is None or an instance of Signature. + +.. + +.. bpo: 21923 +.. date: 7443 +.. nonce: hXnoZa +.. section: Library + +Prevent AttributeError in distutils.sysconfig.customize_compiler due to +possible uninitialized _config_vars. + +.. + +.. bpo: 21323 +.. date: 7442 +.. nonce: quiWfl +.. section: Library + +Fix http.server to again handle scripts in CGI subdirectories, broken by the +fix for security issue #19435. Patch by Zach Byrne. + +.. + +.. bpo: 22733 +.. date: 7441 +.. nonce: 21gJBp +.. section: Library + +Fix ffi_prep_args not zero-extending argument values correctly on 64-bit +Windows. + +.. + +.. bpo: 23302 +.. date: 7440 +.. nonce: X2dabK +.. section: Library + +Default to TCP_NODELAY=1 upon establishing an HTTPConnection. Removed use of +hard-coded MSS as it's an optimization that's no longer needed with Nagle +disabled. + +.. + +.. bpo: 20577 +.. date: 7439 +.. nonce: Y71IMj +.. section: IDLE + +Configuration of the max line length for the FormatParagraph extension has +been moved from the General tab of the Idle preferences dialog to the +FormatParagraph tab of the Config Extensions dialog. Patch by Tal Einat. + +.. + +.. bpo: 16893 +.. date: 7438 +.. nonce: JfHAA4 +.. section: IDLE + +Update Idle doc chapter to match current Idle and add new information. + +.. + +.. bpo: 3068 +.. date: 7437 +.. nonce: TYjXTA +.. section: IDLE + +Add Idle extension configuration dialog to Options menu. Changes are written +to HOME/.idlerc/config-extensions.cfg. Original patch by Tal Einat. + +.. + +.. bpo: 16233 +.. date: 7436 +.. nonce: sOadNo +.. section: IDLE + +A module browser (File : Class Browser, Alt+C) requires an editor window +with a filename. When Class Browser is requested otherwise, from a shell, +output window, or 'Untitled' editor, Idle no longer displays an error box. +It now pops up an Open Module box (Alt+M). If a valid name is entered and a +module is opened, a corresponding browser is also opened. + +.. + +.. bpo: 4832 +.. date: 7435 +.. nonce: GRKi9M +.. section: IDLE + +Save As to type Python files automatically adds .py to the name you enter +(even if your system does not display it). Some systems automatically add +.txt when type is Text files. + +.. + +.. bpo: 21986 +.. date: 7434 +.. nonce: 04GUv2 +.. section: IDLE + +Code objects are not normally pickled by the pickle module. To match this, +they are no longer pickled when running under Idle. + +.. + +.. bpo: 17390 +.. date: 7433 +.. nonce: I4vHFh +.. section: IDLE + +Adjust Editor window title; remove 'Python', move version to end. + +.. + +.. bpo: 14105 +.. date: 7432 +.. nonce: -FZwYH +.. section: IDLE + +Idle debugger breakpoints no longer disappear when inserting or deleting +lines. + +.. + +.. bpo: 17172 +.. date: 7431 +.. nonce: R8jkU1 +.. section: IDLE + +Turtledemo can now be run from Idle. Currently, the entry is on the Help +menu, but it may move to Run. Patch by Ramchandra Apt and Lita Cho. + +.. + +.. bpo: 21765 +.. date: 7430 +.. nonce: JyiDbd +.. section: IDLE + +Add support for non-ascii identifiers to HyperParser. + +.. + +.. bpo: 21940 +.. date: 7429 +.. nonce: VlIRz7 +.. section: IDLE + +Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar. + +.. + +.. bpo: 18592 +.. date: 7428 +.. nonce: sMG-SZ +.. section: IDLE + +Add unittest for SearchDialogBase. Patch by Phil Webster. + +.. + +.. bpo: 21694 +.. date: 7427 +.. nonce: 1oLmRo +.. section: IDLE + +Add unittest for ParenMatch. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 21686 +.. date: 7426 +.. nonce: TAkFB0 +.. section: IDLE + +add unittest for HyperParser. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 12387 +.. date: 7425 +.. nonce: XO7Ozk +.. section: IDLE + +Add missing upper(lower)case versions of default Windows key bindings for +Idle so Caps Lock does not disable them. Patch by Roger Serwy. + +.. + +.. bpo: 21695 +.. date: 7424 +.. nonce: g-t0Tm +.. section: IDLE + +Closing a Find-in-files output window while the search is still in progress +no longer closes Idle. + +.. + +.. bpo: 18910 +.. date: 7423 +.. nonce: ke8lMK +.. section: IDLE + +Add unittest for textView. Patch by Phil Webster. + +.. + +.. bpo: 18292 +.. date: 7422 +.. nonce: ks_3wm +.. section: IDLE + +Add unittest for AutoExpand. Patch by Saihadhav Heblikar. + +.. + +.. bpo: 18409 +.. date: 7421 +.. nonce: 7fe-aK +.. section: IDLE + +Add unittest for AutoComplete. Patch by Phil Webster. + +.. + +.. bpo: 21477 +.. date: 7420 +.. nonce: 33NOe0 +.. section: IDLE + +htest.py - Improve framework, complete set of tests. Patches by Saimadhav +Heblikar + +.. + +.. bpo: 18104 +.. date: 7419 +.. nonce: 8Fj9Pf +.. section: IDLE + +Add idlelib/idle_test/htest.py with a few sample tests to begin +consolidating and improving human-validated tests of Idle. Change other +files as needed to work with htest. Running the module as __main__ runs all +tests. + +.. + +.. bpo: 21139 +.. date: 7418 +.. nonce: kqetng +.. section: IDLE + +Change default paragraph width to 72, the PEP 8 recommendation. + +.. + +.. bpo: 21284 +.. date: 7417 +.. nonce: KKJfmv +.. section: IDLE + +Paragraph reformat test passes after user changes reformat width. + +.. + +.. bpo: 17654 +.. date: 7416 +.. nonce: NbzhNS +.. section: IDLE + +Ensure IDLE menus are customized properly on OS X for non-framework builds +and for all variants of Tk. + +.. + +.. bpo: 23180 +.. date: 7415 +.. nonce: cE_89F +.. section: IDLE + +Rename IDLE "Windows" menu item to "Window". Patch by Al Sweigart. + +.. + +.. bpo: 15506 +.. date: 7414 +.. nonce: nh8KlR +.. section: Build + +Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure script. + +.. + +.. bpo: 22935 +.. date: 7413 +.. nonce: -vY3lc +.. section: Build + +Allow the ssl module to be compiled if openssl doesn't support SSL 3. + +.. + +.. bpo: 22592 +.. date: 7412 +.. nonce: O_IE9W +.. section: Build + +Drop support of the Borland C compiler to build Python. The distutils module +still supports it to build extensions. + +.. + +.. bpo: 22591 +.. date: 7411 +.. nonce: wwBlG8 +.. section: Build + +Drop support of MS-DOS, especially of the DJGPP compiler (MS-DOS port of +GCC). + +.. + +.. bpo: 16537 +.. date: 7410 +.. nonce: llFo71 +.. section: Build + +Check whether self.extensions is empty in setup.py. Patch by Jonathan +Hosmer. + +.. + +.. bpo: 22359 +.. date: 7409 +.. nonce: YYFOFG +.. section: Build + +Remove incorrect uses of recursive make. Patch by Jonas Wagner. + +.. + +.. bpo: 21958 +.. date: 7408 +.. nonce: 3rq4qR +.. section: Build + +Define HAVE_ROUND when building with Visual Studio 2013 and above. Patch by +Zachary Turner. + +.. + +.. bpo: 18093 +.. date: 7407 +.. nonce: gnZieo +.. section: Build + +the programs that embed the CPython runtime are now in a separate "Programs" +directory, rather than being kept in the Modules directory. + +.. + +.. bpo: 15759 +.. date: 7406 +.. nonce: iGLR6O +.. section: Build + +"make suspicious", "make linkcheck" and "make doctest" in Doc/ now display +special message when and only when there are failures. + +.. + +.. bpo: 21141 +.. date: 7405 +.. nonce: 669LzK +.. section: Build + +The Windows build process no longer attempts to find Perl, instead relying +on OpenSSL source being configured and ready to build. The +``PCbuild\build_ssl.py`` script has been re-written and re-named to +``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source for +both 32 and 64 bit platforms. OpenSSL sources obtained from svn.python.org +will always be pre-configured and ready to build. + +.. + +.. bpo: 21037 +.. date: 7404 +.. nonce: v1rZzo +.. section: Build + +Add a build option to enable AddressSanitizer support. + +.. + +.. bpo: 19962 +.. date: 7403 +.. nonce: HDlwsE +.. section: Build + +The Windows build process now creates "python.bat" in the root of the source +tree, which passes all arguments through to the most recently built +interpreter. + +.. + +.. bpo: 21285 +.. date: 7402 +.. nonce: cU9p2E +.. section: Build + +Refactor and fix curses configure check to always search in a ncursesw +directory. + +.. + +.. bpo: 15234 +.. date: 7401 +.. nonce: vlM720 +.. section: Build + +For BerkelyDB and Sqlite, only add the found library and include directories +if they aren't already being searched. This avoids an explicit runtime +library dependency. + +.. + +.. bpo: 17861 +.. date: 7400 +.. nonce: jCi44U +.. section: Build + +Tools/scripts/generate_opcode_h.py automatically regenerates +Include/opcode.h from Lib/opcode.py if the latter gets any change. + +.. + +.. bpo: 20644 +.. date: 7399 +.. nonce: aV0zq7 +.. section: Build + +OS X installer build support for documentation build changes in 3.4.1: +assume externally supplied sphinx-build is available in /usr/bin. + +.. + +.. bpo: 20022 +.. date: 7398 +.. nonce: EqSCTW +.. section: Build + +Eliminate use of deprecated bundlebuilder in OS X builds. + +.. + +.. bpo: 15968 +.. date: 7397 +.. nonce: vxUxHK +.. section: Build + +Incorporated Tcl, Tk, and Tix builds into the Windows build solution. + +.. + +.. bpo: 17095 +.. date: 7396 +.. nonce: -XEBIU +.. section: Build + +Fix Modules/Setup *shared* support. + +.. + +.. bpo: 21811 +.. date: 7395 +.. nonce: 3_Xyr- +.. section: Build + +Anticipated fixes to support OS X versions > 10.9. + +.. + +.. bpo: 21166 +.. date: 7394 +.. nonce: KAl7aO +.. section: Build + +Prevent possible segfaults and other random failures of python --generate- +posix-vars in pybuilddir.txt build target. + +.. + +.. bpo: 18096 +.. date: 7393 +.. nonce: ELyAUJ +.. section: Build + +Fix library order returned by python-config. + +.. + +.. bpo: 17219 +.. date: 7392 +.. nonce: q8ueQ0 +.. section: Build + +Add library build dir for Python extension cross-builds. + +.. + +.. bpo: 22919 +.. date: 7391 +.. nonce: 1XThL9 +.. section: Build + +Windows build updated to support VC 14.0 (Visual Studio 2015), which will be +used for the official release. + +.. + +.. bpo: 21236 +.. date: 7390 +.. nonce: 84LXxj +.. section: Build + +Build _msi.pyd with cabinet.lib instead of fci.lib + +.. + +.. bpo: 17128 +.. date: 7389 +.. nonce: U2biLA +.. section: Build + +Use private version of OpenSSL for OS X 10.5+ installer. + +.. + +.. bpo: 14203 +.. date: 7388 +.. nonce: 3hv0TX +.. section: C API + +Remove obsolete support for view==NULL in PyBuffer_FillInfo(), +bytearray_getbuffer(), bytesiobuf_getbuffer() and array_buffer_getbuf(). All +functions now raise BufferError in that case. + +.. + +.. bpo: 22445 +.. date: 7387 +.. nonce: s0AOAS +.. section: C API + +PyBuffer_IsContiguous() now implements precise contiguity tests, compatible +with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation flag. Previously the +function reported false negatives for corner cases. + +.. + +.. bpo: 22079 +.. date: 7386 +.. nonce: zhs2qM +.. section: C API + +PyType_Ready() now checks that statically allocated type has no dynamically +allocated bases. + +.. + +.. bpo: 22453 +.. date: 7385 +.. nonce: XoO4ns +.. section: C API + +Removed non-documented macro PyObject_REPR(). + +.. + +.. bpo: 18395 +.. date: 7384 +.. nonce: YC9B06 +.. section: C API + +Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename +``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these +functions. + +.. + +.. bpo: 21233 +.. date: 7383 +.. nonce: 98hZAt +.. section: C API + +Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), PyObject_Calloc(), +_PyObject_GC_Calloc(). bytes(int) is now using ``calloc()`` instead of +``malloc()`` for large objects which is faster and use less memory. + +.. + +.. bpo: 20942 +.. date: 7382 +.. nonce: qHLJ5- +.. section: C API + +PyImport_ImportFrozenModuleObject() no longer sets __file__ to match what +importlib does; this affects _frozen_importlib as well as any module loaded +using imp.init_frozen(). + +.. + +.. bpo: 19548 +.. date: 7381 +.. nonce: yOX8sS +.. section: Documentation + +Update the codecs module documentation to better cover the distinction +between text encodings and other codecs, together with other clarifications. +Patch by Martin Panter. + +.. + +.. bpo: 22394 +.. date: 7380 +.. nonce: 6bJywY +.. section: Documentation + +Doc/Makefile now supports ``make venv PYTHON=../python`` to create a venv +for generating the documentation, e.g., ``make html +PYTHON=venv/bin/python3``. + +.. + +.. bpo: 21514 +.. date: 7379 +.. nonce: 1H16T6 +.. section: Documentation + +The documentation of the json module now refers to new JSON RFC 7159 instead +of obsoleted RFC 4627. + +.. + +.. bpo: 21777 +.. date: 7378 +.. nonce: dtQCWV +.. section: Documentation + +The binary sequence methods on bytes and bytearray are now documented +explicitly, rather than assuming users will be able to derive the expected +behaviour from the behaviour of the corresponding str methods. + +.. + +.. bpo: 6916 +.. date: 7377 +.. nonce: 4sm3nE +.. section: Documentation + +undocument deprecated asynchat.fifo class. + +.. + +.. bpo: 17386 +.. date: 7376 +.. nonce: ivaGLb +.. section: Documentation + +Expanded functionality of the ``Doc/make.bat`` script to make it much more +comparable to ``Doc/Makefile``. + +.. + +.. bpo: 21312 +.. date: 7375 +.. nonce: 6IqcV4 +.. section: Documentation + +Update the thread_foobar.h template file to include newer threading APIs. +Patch by Jack McCracken. + +.. + +.. bpo: 21043 +.. date: 7374 +.. nonce: oEOC8O +.. section: Documentation + +Remove the recommendation for specific CA organizations and to mention the +ability to load the OS certificates. + +.. + +.. bpo: 20765 +.. date: 7373 +.. nonce: Rv3GgV +.. section: Documentation + +Add missing documentation for PurePath.with_name() and +PurePath.with_suffix(). + +.. + +.. bpo: 19407 +.. date: 7372 +.. nonce: mRyNnG +.. section: Documentation + +New package installation and distribution guides based on the Python +Packaging Authority tools. Existing guides have been retained as legacy +links from the distutils docs, as they still contain some required reference +material for tool developers that isn't recorded anywhere else. + +.. + +.. bpo: 19697 +.. date: 7371 +.. nonce: 2jMQBP +.. section: Documentation + +Document cases where __main__.__spec__ is None. + +.. + +.. bpo: 18982 +.. date: 7370 +.. nonce: TynSM6 +.. section: Tests + +Add tests for CLI of the calendar module. + +.. + +.. bpo: 19548 +.. date: 7369 +.. nonce: 25Kxq_ +.. section: Tests + +Added some additional checks to test_codecs to ensure that statements in the +updated documentation remain accurate. Patch by Martin Panter. + +.. + +.. bpo: 22838 +.. date: 7368 +.. nonce: VZBtZg +.. section: Tests + +All test_re tests now work with unittest test discovery. + +.. + +.. bpo: 22173 +.. date: 7367 +.. nonce: dxIIVx +.. section: Tests + +Update lib2to3 tests to use unittest test discovery. + +.. + +.. bpo: 16000 +.. date: 7366 +.. nonce: Y7O6TP +.. section: Tests + +Convert test_curses to use unittest. + +.. + +.. bpo: 21456 +.. date: 7365 +.. nonce: Axsw43 +.. section: Tests + +Skip two tests in test_urllib2net.py if _ssl module not present. Patch by +Remi Pointel. + +.. + +.. bpo: 20746 +.. date: 7364 +.. nonce: N2pzAY +.. section: Tests + +Fix test_pdb to run in refleak mode (-R). Patch by Xavier de Gaye. + +.. + +.. bpo: 22060 +.. date: 7363 +.. nonce: TduJNO +.. section: Tests + +test_ctypes has been somewhat cleaned up and simplified; it now uses +unittest test discovery to find its tests. + +.. + +.. bpo: 22104 +.. date: 7362 +.. nonce: -YYDup +.. section: Tests + +regrtest.py no longer holds a reference to the suite of tests loaded from +test modules that don't define test_main(). + +.. + +.. bpo: 22111 +.. date: 7361 +.. nonce: 0XlFAU +.. section: Tests + +Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. + +.. + +.. bpo: 22002 +.. date: 7360 +.. nonce: jpiaA2 +.. section: Tests + +Added ``load_package_tests`` function to test.support and used it to +implement/augment test discovery in test_asyncio, test_email, +test_importlib, test_json, and test_tools. + +.. + +.. bpo: 21976 +.. date: 7359 +.. nonce: Slq6se +.. section: Tests + +Fix test_ssl to accept LibreSSL version strings. Thanks to William Orr. + +.. + +.. bpo: 21918 +.. date: 7358 +.. nonce: QTFFSj +.. section: Tests + +Converted test_tools from a module to a package containing separate test +files for each tested script. + +.. + +.. bpo: 9554 +.. date: 7357 +.. nonce: VsP0Ve +.. section: Tests + +Use modern unittest features in test_argparse. Initial patch by Denver +Coneybeare and Radu Voicilas. + +.. + +.. bpo: 20155 +.. date: 7356 +.. nonce: nphzS3 +.. section: Tests + +Changed HTTP method names in failing tests in test_httpservers so that +packet filtering software (specifically Windows Base Filtering Engine) does +not interfere with the transaction semantics expected by the tests. + +.. + +.. bpo: 19493 +.. date: 7355 +.. nonce: SwbzLQ +.. section: Tests + +Refactored the ctypes test package to skip tests explicitly rather than +silently. + +.. + +.. bpo: 18492 +.. date: 7354 +.. nonce: ylPRU7 +.. section: Tests + +All resources are now allowed when tests are not run by regrtest.py. + +.. + +.. bpo: 21634 +.. date: 7353 +.. nonce: Eng06F +.. section: Tests + +Fix pystone micro-benchmark: use floor division instead of true division to +benchmark integers instead of floating point numbers. Set pystone version to +1.2. Patch written by Lennart Regebro. + +.. + +.. bpo: 21605 +.. date: 7352 +.. nonce: qsLV8d +.. section: Tests + +Added tests for Tkinter images. + +.. + +.. bpo: 21493 +.. date: 7351 +.. nonce: NqhRsy +.. section: Tests + +Added test for ntpath.expanduser(). Original patch by Claudiu Popa. + +.. + +.. bpo: 19925 +.. date: 7350 +.. nonce: dhMx08 +.. section: Tests + +Added tests for the spwd module. Original patch by Vajrasky Kok. + +.. + +.. bpo: 21522 +.. date: 7349 +.. nonce: b-VwFW +.. section: Tests + +Added Tkinter tests for Listbox.itemconfigure(), +PanedWindow.paneconfigure(), and Menu.entryconfigure(). + +.. + +.. bpo: 17756 +.. date: 7348 +.. nonce: LLfbfU +.. section: Tests + +Fix test_code test when run from the installed location. + +.. + +.. bpo: 17752 +.. date: 7347 +.. nonce: P8iG44 +.. section: Tests + +Fix distutils tests when run from the installed location. + +.. + +.. bpo: 18604 +.. date: 7346 +.. nonce: Q00Xrj +.. section: Tests + +Consolidated checks for GUI availability. All platforms now at least check +whether Tk can be instantiated when the GUI resource is requested. + +.. + +.. bpo: 21275 +.. date: 7345 +.. nonce: lI5FkX +.. section: Tests + +Fix a socket test on KFreeBSD. + +.. + +.. bpo: 21223 +.. date: 7344 +.. nonce: lMY6ka +.. section: Tests + +Pass test_site/test_startup_imports when some of the extensions are built as +builtins. + +.. + +.. bpo: 20635 +.. date: 7343 +.. nonce: mzWmoS +.. section: Tests + +Added tests for Tk geometry managers. + +.. + +.. bpo: 0 +.. date: 7342 +.. nonce: E5XNqr +.. section: Tests + +Add test case for freeze. + +.. + +.. bpo: 20743 +.. date: 7341 +.. nonce: hxZQUf +.. section: Tests + +Fix a reference leak in test_tcl. + +.. + +.. bpo: 21097 +.. date: 7340 +.. nonce: gsUesm +.. section: Tests + +Move test_namespace_pkgs into test_importlib. + +.. + +.. bpo: 21503 +.. date: 7339 +.. nonce: H9TPCg +.. section: Tests + +Use test_both() consistently in test_importlib. + +.. + +.. bpo: 20939 +.. date: 7338 +.. nonce: x3KQ35 +.. section: Tests + +Avoid various network test failures due to new redirect of +http://www.python.org/ to https://www.python.org: use http://www.example.com +instead. + +.. + +.. bpo: 20668 +.. date: 7337 +.. nonce: IWjOSC +.. section: Tests + +asyncio tests no longer rely on tests.txt file. (Patch by Vajrasky Kok) + +.. + +.. bpo: 21093 +.. date: 7336 +.. nonce: CcpRim +.. section: Tests + +Prevent failures of ctypes test_macholib on OS X if a copy of libz exists in +$HOME/lib or /usr/local/lib. + +.. + +.. bpo: 22770 +.. date: 7335 +.. nonce: FxAh91 +.. section: Tests + +Prevent some Tk segfaults on OS X when running gui tests. + +.. + +.. bpo: 23211 +.. date: 7334 +.. nonce: Bc-QfJ +.. section: Tests + +Workaround test_logging failure on some OS X 10.6 systems. + +.. + +.. bpo: 23345 +.. date: 7333 +.. nonce: HIGBKx +.. section: Tests + +Prevent test_ssl failures with large OpenSSL patch level values (like +0.9.8zc). + +.. + +.. bpo: 22314 +.. date: 7332 +.. nonce: ws6xsH +.. section: Tools/Demos + +pydoc now works when the LINES environment variable is set. + +.. + +.. bpo: 22615 +.. date: 7331 +.. nonce: My3DWN +.. section: Tools/Demos + +Argument Clinic now supports the "type" argument for the int converter. +This permits using the int converter with enums and typedefs. + +.. + +.. bpo: 20076 +.. date: 7330 +.. nonce: ZNuBrC +.. section: Tools/Demos + +The makelocalealias.py script no longer ignores UTF-8 mapping. + +.. + +.. bpo: 20079 +.. date: 7329 +.. nonce: ogPXcK +.. section: Tools/Demos + +The makelocalealias.py script now can parse the SUPPORTED file from glibc +sources and supports command line options for source paths. + +.. + +.. bpo: 22201 +.. date: 7328 +.. nonce: k1Awbh +.. section: Tools/Demos + +Command-line interface of the zipfile module now correctly extracts ZIP +files with directory entries. Patch by Ryan Wilson. + +.. + +.. bpo: 22120 +.. date: 7327 +.. nonce: KmBUj- +.. section: Tools/Demos + +For functions using an unsigned integer return converter, Argument Clinic +now generates a cast to that type for the comparison to -1 in the generated +code. (This suppresses a compilation warning.) + +.. + +.. bpo: 18974 +.. date: 7326 +.. nonce: I3DdAo +.. section: Tools/Demos + +Tools/scripts/diff.py now uses argparse instead of optparse. + +.. + +.. bpo: 21906 +.. date: 7325 +.. nonce: ZsKy9v +.. section: Tools/Demos + +Make Tools/scripts/md5sum.py work in Python 3. Patch by Zachary Ware. + +.. + +.. bpo: 21629 +.. date: 7324 +.. nonce: 9kZmQl +.. section: Tools/Demos + +Fix Argument Clinic's "--converters" feature. + +.. + +.. bpo: 0 +.. date: 7323 +.. nonce: _-ge-g +.. section: Tools/Demos + +Add support for ``yield from`` to 2to3. + +.. + +.. bpo: 0 +.. date: 7322 +.. nonce: dpFbyZ +.. section: Tools/Demos + +Add support for the PEP 465 matrix multiplication operator to 2to3. + +.. + +.. bpo: 16047 +.. date: 7321 +.. nonce: IsgTzm +.. section: Tools/Demos + +Fix module exception list and __file__ handling in freeze. Patch by Meador +Inge. + +.. + +.. bpo: 11824 +.. date: 7320 +.. nonce: OBWc3T +.. section: Tools/Demos + +Consider ABI tags in freeze. Patch by Meador Inge. + +.. + +.. bpo: 20535 +.. date: 7319 +.. nonce: 0qkvZZ +.. section: Tools/Demos + +PYTHONWARNING no longer affects the run_tests.py script. Patch by Arfrever +Frehtes Taifersar Arahesis. + +.. + +.. bpo: 23260 +.. date: 7318 +.. nonce: aZ5VLH +.. section: Windows + +Update Windows installer + +.. + +.. bpo: 0 +.. date: 7317 +.. nonce: _aEUNt +.. section: Windows + +The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible +result of this change is the addition of new native file dialogs when +running on Windows Vista or newer. See Tcl/Tk's TIP 432 for more +information. Also, this version of Tcl/Tk includes support for Windows 10. + +.. + +.. bpo: 17896 +.. date: 7316 +.. nonce: o79rHM +.. section: Windows + +The Windows build scripts now expect external library sources to be in +``PCbuild\..\externals`` rather than ``PCbuild\..\..``. + +.. + +.. bpo: 17717 +.. date: 7315 +.. nonce: y1zoye +.. section: Windows + +The Windows build scripts now use a copy of NASM pulled from svn.python.org +to build OpenSSL. + +.. + +.. bpo: 21907 +.. date: 7314 +.. nonce: jm1smN +.. section: Windows + +Improved the batch scripts provided for building Python. + +.. + +.. bpo: 22644 +.. date: 7313 +.. nonce: gosBki +.. section: Windows + +The bundled version of OpenSSL has been updated to 1.0.1j. + +.. + +.. bpo: 10747 +.. date: 7312 +.. nonce: LTWhLn +.. section: Windows + +Use versioned labels in the Windows start menu. Patch by Olive Kilburn. + +.. + +.. bpo: 22980 +.. date: 7311 +.. nonce: -UypE5 +.. section: Windows + +.pyd files with a version and platform tag (for example, ".cp35-win32.pyd") +will now be loaded in preference to those without tags. diff --git a/Misc/NEWS.d/3.5.0a2.rst b/Misc/NEWS.d/3.5.0a2.rst new file mode 100644 index 00000000000..d66e4cbdeb5 --- /dev/null +++ b/Misc/NEWS.d/3.5.0a2.rst @@ -0,0 +1,406 @@ +.. bpo: 23571 +.. date: 7950 +.. nonce: GTkAkq +.. release date: 2015-03-09 +.. section: Core and Builtins + +PyObject_Call() and PyCFunction_Call() now raise a SystemError if a function +returns a result and raises an exception. The SystemError is chained to the +previous exception. + +.. + +.. bpo: 22524 +.. date: 7949 +.. nonce: Ks6_2x +.. section: Library + +New os.scandir() function, part of the PEP 471: "os.scandir() function -- a +better and faster directory iterator". Patch written by Ben Hoyt. + +.. + +.. bpo: 23103 +.. date: 7948 +.. nonce: I3RLIV +.. section: Library + +Reduced the memory consumption of IPv4Address and IPv6Address. + +.. + +.. bpo: 21793 +.. date: 7947 +.. nonce: GQtYMM +.. section: Library + +BaseHTTPRequestHandler again logs response code as numeric, not as +stringified enum. Patch by Demian Brecht. + +.. + +.. bpo: 23476 +.. date: 7946 +.. nonce: 82QV9I +.. section: Library + +In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST flag on +certificate stores when it is available. + +.. + +.. bpo: 23576 +.. date: 7945 +.. nonce: 98F-PP +.. section: Library + +Avoid stalling in SSL reads when EOF has been reached in the SSL layer but +the underlying connection hasn't been closed. + +.. + +.. bpo: 23504 +.. date: 7944 +.. nonce: o31h5I +.. section: Library + +Added an __all__ to the types module. + +.. + +.. bpo: 23563 +.. date: 7943 +.. nonce: iQB-ba +.. section: Library + +Optimized utility functions in urllib.parse. + +.. + +.. bpo: 7830 +.. date: 7942 +.. nonce: irvPdC +.. section: Library + +Flatten nested functools.partial. + +.. + +.. bpo: 20204 +.. date: 7941 +.. nonce: DorA4b +.. section: Library + +Added the __module__ attribute to _tkinter classes. + +.. + +.. bpo: 19980 +.. date: 7940 +.. nonce: whwzL_ +.. section: Library + +Improved help() for non-recognized strings. help('') now shows the help on +str. help('help') now shows the help on help(). Original patch by Mark +Lawrence. + +.. + +.. bpo: 23521 +.. date: 7939 +.. nonce: HvwFfd +.. section: Library + +Corrected pure python implementation of timedelta division. + +Eliminated OverflowError from ``timedelta * float`` for some floats; +Corrected rounding in timedlta true division. + +.. + +.. bpo: 21619 +.. date: 7938 +.. nonce: uL0SZh +.. section: Library + +Popen objects no longer leave a zombie after exit in the with statement if +the pipe was broken. Patch by Martin Panter. + +.. + +.. bpo: 22936 +.. date: 7937 +.. nonce: JrhGYd +.. section: Library + +Make it possible to show local variables in tracebacks for both the +traceback module and unittest. + +.. + +.. bpo: 15955 +.. date: 7936 +.. nonce: _8nYPy +.. section: Library + +Add an option to limit the output size in bz2.decompress(). Patch by +Nikolaus Rath. + +.. + +.. bpo: 6639 +.. date: 7935 +.. nonce: rmjUmG +.. section: Library + +Module-level turtle functions no longer raise TclError after closing the +window. + +.. + +.. bpo: 814253 +.. date: 7934 +.. nonce: icZb-I +.. section: Library + +Group references and conditional group references now work in lookbehind +assertions in regular expressions. (See also: bpo-9179) + +.. + +.. bpo: 23215 +.. date: 7933 +.. nonce: VHVSVX +.. section: Library + +Multibyte codecs with custom error handlers that ignores errors consumed too +much memory and raised SystemError or MemoryError. Original patch by Aleksi +Torhamo. + +.. + +.. bpo: 5700 +.. date: 7932 +.. nonce: iA5yzL +.. section: Library + +io.FileIO() called flush() after closing the file. flush() was not called in +close() if closefd=False. + +.. + +.. bpo: 23374 +.. date: 7931 +.. nonce: 8A9LuZ +.. section: Library + +Fixed pydoc failure with non-ASCII files when stdout encoding differs from +file system encoding (e.g. on Mac OS). + +.. + +.. bpo: 23481 +.. date: 7930 +.. nonce: ZWwliG +.. section: Library + +Remove RC4 from the SSL module's default cipher list. + +.. + +.. bpo: 21548 +.. date: 7929 +.. nonce: CmO_Yh +.. section: Library + +Fix pydoc.synopsis() and pydoc.apropos() on modules with empty docstrings. + +.. + +.. bpo: 22885 +.. date: 7928 +.. nonce: p8FnYk +.. section: Library + +Fixed arbitrary code execution vulnerability in the dbm.dumb module. +Original patch by Claudiu Popa. + +.. + +.. bpo: 23239 +.. date: 7927 +.. nonce: PGUq7T +.. section: Library + +ssl.match_hostname() now supports matching of IP addresses. + +.. + +.. bpo: 23146 +.. date: 7926 +.. nonce: PW-O3u +.. section: Library + +Fix mishandling of absolute Windows paths with forward slashes in pathlib. + +.. + +.. bpo: 23096 +.. date: 7925 +.. nonce: Ftrmf3 +.. section: Library + +Pickle representation of floats with protocol 0 now is the same for both +Python and C implementations. + +.. + +.. bpo: 19105 +.. date: 7924 +.. nonce: ZK07Ff +.. section: Library + +pprint now more efficiently uses free space at the right. + +.. + +.. bpo: 14910 +.. date: 7923 +.. nonce: zueIhP +.. section: Library + +Add allow_abbrev parameter to argparse.ArgumentParser. Patch by Jonathan +Paugh, Steven Bethard, paul j3 and Daniel Eriksson. + +.. + +.. bpo: 21717 +.. date: 7922 +.. nonce: Knut81 +.. section: Library + +tarfile.open() now supports 'x' (exclusive creation) mode. + +.. + +.. bpo: 23344 +.. date: 7921 +.. nonce: ieu8C1 +.. section: Library + +marshal.dumps() is now 20-25% faster on average. + +.. + +.. bpo: 20416 +.. date: 7920 +.. nonce: cwEgkL +.. section: Library + +marshal.dumps() with protocols 3 and 4 is now 40-50% faster on average. + +.. + +.. bpo: 23421 +.. date: 7919 +.. nonce: eckzoV +.. section: Library + +Fixed compression in tarfile CLI. Patch by wdv4758h. + +.. + +.. bpo: 23367 +.. date: 7918 +.. nonce: kHnFiz +.. section: Library + +Fix possible overflows in the unicodedata module. + +.. + +.. bpo: 23361 +.. date: 7917 +.. nonce: I_w0-z +.. section: Library + +Fix possible overflow in Windows subprocess creation code. + +.. + +.. bpo: 0 +.. date: 7916 +.. nonce: sfmjTs +.. section: Library + +logging.handlers.QueueListener now takes a respect_handler_level keyword +argument which, if set to True, will pass messages to handlers taking +handler levels into account. + +.. + +.. bpo: 19705 +.. date: 7915 +.. nonce: WLzTRV +.. section: Library + +turtledemo now has a visual sorting algorithm demo. Original patch from +Jason Yeo. + +.. + +.. bpo: 23801 +.. date: 7914 +.. nonce: jyJK3z +.. section: Library + +Fix issue where cgi.FieldStorage did not always ignore the entire preamble +to a multipart body. + +.. + +.. bpo: 23445 +.. date: 7913 +.. nonce: 7fmkYO +.. section: Build + +pydebug builds now use "gcc -Og" where possible, to make the resulting +executable faster. + +.. + +.. bpo: 23686 +.. date: 7912 +.. nonce: B7jDXY +.. section: Build + +Update OS X 10.5 installer build to use OpenSSL 1.0.2a. + +.. + +.. bpo: 20204 +.. date: 7911 +.. nonce: M_jcNK +.. section: C API + +Deprecation warning is now raised for builtin types without the __module__ +attribute. + +.. + +.. bpo: 23465 +.. date: 7910 +.. nonce: qBauCy +.. section: Windows + +Implement PEP 486 - Make the Python Launcher aware of virtual environments. +Patch by Paul Moore. + +.. + +.. bpo: 23437 +.. date: 7909 +.. nonce: ro9X8r +.. section: Windows + +Make user scripts directory versioned on Windows. Patch by Paul Moore. diff --git a/Misc/NEWS.d/3.5.0a3.rst b/Misc/NEWS.d/3.5.0a3.rst new file mode 100644 index 00000000000..b69c4c39ca0 --- /dev/null +++ b/Misc/NEWS.d/3.5.0a3.rst @@ -0,0 +1,518 @@ +.. bpo: 23573 +.. date: 8002 +.. nonce: ZpM4D- +.. release date: 2015-03-28 +.. section: Core and Builtins + +Increased performance of string search operations (str.find, str.index, +str.count, the in operator, str.split, str.partition) with arguments of +different kinds (UCS1, UCS2, UCS4). + +.. + +.. bpo: 23753 +.. date: 8001 +.. nonce: CREjLC +.. section: Core and Builtins + +Python doesn't support anymore platforms without stat() or fstat(), these +functions are always required. + +.. + +.. bpo: 23681 +.. date: 8000 +.. nonce: kh02TF +.. section: Core and Builtins + +The -b option now affects comparisons of bytes with int. + +.. + +.. bpo: 23632 +.. date: 7999 +.. nonce: UVdIZY +.. section: Core and Builtins + +Memoryviews now allow tuple indexing (including for multi-dimensional +memoryviews). + +.. + +.. bpo: 23192 +.. date: 7998 +.. nonce: QKqdow +.. section: Core and Builtins + +Fixed generator lambdas. Patch by Bruno Cauet. + +.. + +.. bpo: 23629 +.. date: 7997 +.. nonce: r9Mt2C +.. section: Core and Builtins + +Fix the default __sizeof__ implementation for variable-sized objects. + +.. + +.. bpo: 14260 +.. date: 7996 +.. nonce: b5M04V +.. section: Library + +The groupindex attribute of regular expression pattern object now is non- +modifiable mapping. + +.. + +.. bpo: 23792 +.. date: 7995 +.. nonce: Kfm9-f +.. section: Library + +Ignore KeyboardInterrupt when the pydoc pager is active. This mimics the +behavior of the standard unix pagers, and prevents pipepager from shutting +down while the pager itself is still running. + +.. + +.. bpo: 23775 +.. date: 7994 +.. nonce: xKGrSQ +.. section: Library + +pprint() of OrderedDict now outputs the same representation as repr(). + +.. + +.. bpo: 23765 +.. date: 7993 +.. nonce: 2ta_C4 +.. section: Library + +Removed IsBadStringPtr calls in ctypes + +.. + +.. bpo: 22364 +.. date: 7992 +.. nonce: ejtoKl +.. section: Library + +Improved some re error messages using regex for hints. + +.. + +.. bpo: 23742 +.. date: 7991 +.. nonce: _EkAIa +.. section: Library + +ntpath.expandvars() no longer loses unbalanced single quotes. + +.. + +.. bpo: 21717 +.. date: 7990 +.. nonce: pKndpx +.. section: Library + +The zipfile.ZipFile.open function now supports 'x' (exclusive creation) +mode. + +.. + +.. bpo: 21802 +.. date: 7989 +.. nonce: ygSM2A +.. section: Library + +The reader in BufferedRWPair now is closed even when closing writer failed +in BufferedRWPair.close(). + +.. + +.. bpo: 23622 +.. date: 7988 +.. nonce: 9-ZRqj +.. section: Library + +Unknown escapes in regular expressions that consist of ``'\'`` and ASCII +letter now raise a deprecation warning and will be forbidden in Python 3.6. + +.. + +.. bpo: 23671 +.. date: 7987 +.. nonce: zWPm-a +.. section: Library + +string.Template now allows specifying the "self" parameter as a keyword +argument. string.Formatter now allows specifying the "self" and the +"format_string" parameters as keyword arguments. + +.. + +.. bpo: 23502 +.. date: 7986 +.. nonce: AH20IQ +.. section: Library + +The pprint module now supports mapping proxies. + +.. + +.. bpo: 17530 +.. date: 7985 +.. nonce: PUp8rL +.. section: Library + +pprint now wraps long bytes objects and bytearrays. + +.. + +.. bpo: 22687 +.. date: 7984 +.. nonce: zEJPd9 +.. section: Library + +Fixed some corner cases in breaking words in tetxtwrap. Got rid of quadratic +complexity in breaking long words. + +.. + +.. bpo: 4727 +.. date: 7983 +.. nonce: iDQSpi +.. section: Library + +The copy module now uses pickle protocol 4 (PEP 3154) and supports copying +of instances of classes whose __new__ method takes keyword-only arguments. + +.. + +.. bpo: 23491 +.. date: 7982 +.. nonce: P_WKrt +.. section: Library + +Added a zipapp module to support creating executable zip file archives of +Python code. Registered ".pyz" and ".pyzw" extensions on Windows for these +archives (PEP 441). + +.. + +.. bpo: 23657 +.. date: 7981 +.. nonce: y1OaV- +.. section: Library + +Avoid explicit checks for str in zipapp, adding support for pathlib.Path +objects as arguments. + +.. + +.. bpo: 23688 +.. date: 7980 +.. nonce: d6LVy3 +.. section: Library + +Added support of arbitrary bytes-like objects and avoided unnecessary +copying of memoryview in gzip.GzipFile.write(). Original patch by Wolfgang +Maier. + +.. + +.. bpo: 23252 +.. date: 7979 +.. nonce: Goi18g +.. section: Library + +Added support for writing ZIP files to unseekable streams. + +.. + +.. bpo: 23647 +.. date: 7978 +.. nonce: pX2qrx +.. section: Library + +Increase impalib's MAXLINE to accommodate modern mailbox sizes. + +.. + +.. bpo: 23539 +.. date: 7977 +.. nonce: 5BVUim +.. section: Library + +If body is None, http.client.HTTPConnection.request now sets Content-Length +to 0 for PUT, POST, and PATCH headers to avoid 411 errors from some web +servers. + +.. + +.. bpo: 22351 +.. date: 7976 +.. nonce: agB8Y3 +.. section: Library + +The nntplib.NNTP constructor no longer leaves the connection and socket open +until the garbage collector cleans them up. Patch by Martin Panter. + +.. + +.. bpo: 23704 +.. date: 7975 +.. nonce: LTyyxL +.. section: Library + +collections.deque() objects now support methods for index(), insert(), and +copy(). This allows deques to be registered as a MutableSequence and it +improves their substitutability for lists. + +.. + +.. bpo: 23715 +.. date: 7974 +.. nonce: Yap3tU +.. section: Library + +:func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are now retried +when interrupted by a signal not in the *sigset* parameter, if the signal +handler does not raise an exception. signal.sigtimedwait() recomputes the +timeout with a monotonic clock when it is retried. + +.. + +.. bpo: 23001 +.. date: 7973 +.. nonce: YSFnam +.. section: Library + +Few functions in modules mmap, ossaudiodev, socket, ssl, and codecs, that +accepted only read-only bytes-like object now accept writable bytes-like +object too. + +.. + +.. bpo: 23646 +.. date: 7972 +.. nonce: Tljc1S +.. section: Library + +If time.sleep() is interrupted by a signal, the sleep is now retried with +the recomputed delay, except if the signal handler raises an exception (PEP +475). + +.. + +.. bpo: 23136 +.. date: 7971 +.. nonce: 1bnpnb +.. section: Library + +_strptime now uniformly handles all days in week 0, including Dec 30 of +previous year. Based on patch by Jim Carroll. + +.. + +.. bpo: 23700 +.. date: 7970 +.. nonce: VfnWwi +.. section: Library + +Iterator of NamedTemporaryFile now keeps a reference to NamedTemporaryFile +instance. Patch by Bohuslav Kabrda. + +.. + +.. bpo: 22903 +.. date: 7969 +.. nonce: 2GjTHY +.. section: Library + +The fake test case created by unittest.loader when it fails importing a test +module is now picklable. + +.. + +.. bpo: 22181 +.. date: 7968 +.. nonce: 7mnxea +.. section: Library + +On Linux, os.urandom() now uses the new getrandom() syscall if available, +syscall introduced in the Linux kernel 3.17. It is more reliable and more +secure, because it avoids the need of a file descriptor and waits until the +kernel has enough entropy. + +.. + +.. bpo: 2211 +.. date: 7967 +.. nonce: 17Iz5U +.. section: Library + +Updated the implementation of the http.cookies.Morsel class. Setting +attributes key, value and coded_value directly now is deprecated. update() +and setdefault() now transform and check keys. Comparing for equality now +takes into account attributes key, value and coded_value. copy() now returns +a Morsel, not a dict. repr() now contains all attributes. Optimized +checking keys and quoting values. Added new tests. Original patch by Demian +Brecht. + +.. + +.. bpo: 18983 +.. date: 7966 +.. nonce: vF4i2S +.. section: Library + +Allow selection of output units in timeit. Patch by Julian Gindi. + +.. + +.. bpo: 23631 +.. date: 7965 +.. nonce: GfSqNI +.. section: Library + +Fix traceback.format_list when a traceback has been mutated. + +.. + +.. bpo: 23568 +.. date: 7964 +.. nonce: ffzJc7 +.. section: Library + +Add rdivmod support to MagicMock() objects. Patch by H?kan L?vdahl. + +.. + +.. bpo: 2052 +.. date: 7963 +.. nonce: ujNgna +.. section: Library + +Add charset parameter to HtmlDiff.make_file(). + +.. + +.. bpo: 23668 +.. date: 7962 +.. nonce: nF_jnN +.. section: Library + +Support os.truncate and os.ftruncate on Windows. + +.. + +.. bpo: 23138 +.. date: 7961 +.. nonce: 4vMoMZ +.. section: Library + +Fixed parsing cookies with absent keys or values in cookiejar. Patch by +Demian Brecht. + +.. + +.. bpo: 23051 +.. date: 7960 +.. nonce: Vi5tCZ +.. section: Library + +multiprocessing.Pool methods imap() and imap_unordered() now handle +exceptions raised by an iterator. Patch by Alon Diamant and Davin Potts. + +.. + +.. bpo: 23581 +.. date: 7959 +.. nonce: D4Lknl +.. section: Library + +Add matmul support to MagicMock. Patch by H?kan L?vdahl. + +.. + +.. bpo: 23566 +.. date: 7958 +.. nonce: F6LSyk +.. section: Library + +enable(), register(), dump_traceback() and dump_traceback_later() functions +of faulthandler now accept file descriptors. Patch by Wei Wu. + +.. + +.. bpo: 22928 +.. date: 7957 +.. nonce: q2TmY0 +.. section: Library + +Disabled HTTP header injections in http.client. Original patch by Demian +Brecht. + +.. + +.. bpo: 23615 +.. date: 7956 +.. nonce: 5Kx9k5 +.. section: Library + +Modules bz2, tarfile and tokenize now can be reloaded with imp.reload(). +Patch by Thomas Kluyver. + +.. + +.. bpo: 23605 +.. date: 7955 +.. nonce: JUOA_X +.. section: Library + +os.walk() now calls os.scandir() instead of os.listdir(). The usage of +os.scandir() reduces the number of calls to os.stat(). Initial patch written +by Ben Hoyt. + +.. + +.. bpo: 23585 +.. date: 7954 +.. nonce: DTIIoI +.. section: Build + +make patchcheck will ensure the interpreter is built. + +.. + +.. bpo: 23583 +.. date: 7953 +.. nonce: bY8AbM +.. section: Tests + +Added tests for standard IO streams in IDLE. + +.. + +.. bpo: 22289 +.. date: 7952 +.. nonce: ybGcC- +.. section: Tests + +Prevent test_urllib2net failures due to ftp connection timeout. + +.. + +.. bpo: 22826 +.. date: 7951 +.. nonce: 3bcoDL +.. section: Tools/Demos + +The result of open() in Tools/freeze/bkfile.py is now better compatible with +regular files (in particular it now supports the context management +protocol). diff --git a/Misc/NEWS.d/3.5.0a4.rst b/Misc/NEWS.d/3.5.0a4.rst new file mode 100644 index 00000000000..0707cf6a4c8 --- /dev/null +++ b/Misc/NEWS.d/3.5.0a4.rst @@ -0,0 +1,665 @@ +.. bpo: 22980 +.. date: 8069 +.. nonce: Lu_y6y +.. release date: 2015-04-19 +.. section: Core and Builtins + +Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include the +architecture triplet in the extension name, to make it easy to test builds +for different ABIs in the same working tree. Under OS X, the extension name +now includes PEP 3149-style information. + +.. + +.. bpo: 22631 +.. date: 8068 +.. nonce: nTx_ZF +.. section: Core and Builtins + +Added Linux-specific socket constant CAN_RAW_FD_FRAMES. Patch courtesy of +Joe Jevnik. + +.. + +.. bpo: 23731 +.. date: 8067 +.. nonce: FOXb37 +.. section: Core and Builtins + +Implement PEP 488: removal of .pyo files. + +.. + +.. bpo: 23726 +.. date: 8066 +.. nonce: ZopTQ0 +.. section: Core and Builtins + +Don't enable GC for user subclasses of non-GC types that don't add any new +fields. Patch by Eugene Toder. + +.. + +.. bpo: 23309 +.. date: 8065 +.. nonce: Wfnsnz +.. section: Core and Builtins + +Avoid a deadlock at shutdown if a daemon thread is aborted while it is +holding a lock to a buffered I/O object, and the main thread tries to use +the same I/O object (typically stdout or stderr). A fatal error is emitted +instead. + +.. + +.. bpo: 22977 +.. date: 8064 +.. nonce: hutEse +.. section: Core and Builtins + +Fixed formatting Windows error messages on Wine. Patch by Martin Panter. + +.. + +.. bpo: 23466 +.. date: 8063 +.. nonce: KhMltK +.. section: Core and Builtins + +%c, %o, %x, and %X in bytes formatting now raise TypeError on non-integer +input. + +.. + +.. bpo: 24044 +.. date: 8062 +.. nonce: H7vb6- +.. section: Core and Builtins + +Fix possible null pointer dereference in list.sort in out of memory +conditions. + +.. + +.. bpo: 21354 +.. date: 8061 +.. nonce: ZZTe1E +.. section: Core and Builtins + +PyCFunction_New function is exposed by python DLL again. + +.. + +.. bpo: 23840 +.. date: 8060 +.. nonce: mtSbqO +.. section: Library + +tokenize.open() now closes the temporary binary file on error to fix a +resource warning. + +.. + +.. bpo: 16914 +.. date: 8059 +.. nonce: GrP2Jr +.. section: Library + +new debuglevel 2 in smtplib adds timestamps to debug output. + +.. + +.. bpo: 7159 +.. date: 8058 +.. nonce: KCgOUm +.. section: Library + +urllib.request now supports sending auth credentials automatically after the +first 401. This enhancement is a superset of the enhancement from issue +#19494 and supersedes that change. + +.. + +.. bpo: 23703 +.. date: 8057 +.. nonce: kYybxm +.. section: Library + +Fix a regression in urljoin() introduced in 901e4e52b20a. Patch by Demian +Brecht. + +.. + +.. bpo: 4254 +.. date: 8056 +.. nonce: eUC_2H +.. section: Library + +Adds _curses.update_lines_cols(). Patch by Arnon Yaari + +.. + +.. bpo: 19933 +.. date: 8055 +.. nonce: Qq8utk +.. section: Library + +Provide default argument for ndigits in round. Patch by Vajrasky Kok. + +.. + +.. bpo: 23193 +.. date: 8054 +.. nonce: n5ahcG +.. section: Library + +Add a numeric_owner parameter to tarfile.TarFile.extract and +tarfile.TarFile.extractall. Patch by Michael Vogt and Eric Smith. + +.. + +.. bpo: 23342 +.. date: 8053 +.. nonce: CbSzYI +.. section: Library + +Add a subprocess.run() function than returns a CalledProcess instance for a +more consistent API than the existing call* functions. + +.. + +.. bpo: 21217 +.. date: 8052 +.. nonce: TkFTlk +.. section: Library + +inspect.getsourcelines() now tries to compute the start and end lines from +the code object, fixing an issue when a lambda function is used as decorator +argument. Patch by Thomas Ballinger and Allison Kaptur. + +.. + +.. bpo: 24521 +.. date: 8051 +.. nonce: bn4U-y +.. section: Library + +Fix possible integer overflows in the pickle module. + +.. + +.. bpo: 22931 +.. date: 8050 +.. nonce: 4CuWYD +.. section: Library + +Allow '[' and ']' in cookie values. + +.. + +.. bpo: 0 +.. date: 8049 +.. nonce: fgX8Qe +.. section: Library + +The keywords attribute of functools.partial is now always a dictionary. + +.. + +.. bpo: 23811 +.. date: 8048 +.. nonce: B6tzf9 +.. section: Library + +Add missing newline to the PyCompileError error message. Patch by Alex +Shkop. + +.. + +.. bpo: 21116 +.. date: 8047 +.. nonce: Orft3K +.. section: Library + +Avoid blowing memory when allocating a multiprocessing shared array that's +larger than 50% of the available RAM. Patch by M?d?ric Boquien. + +.. + +.. bpo: 22982 +.. date: 8046 +.. nonce: xYmG62 +.. section: Library + +Improve BOM handling when seeking to multiple positions of a writable text +file. + +.. + +.. bpo: 23464 +.. date: 8045 +.. nonce: _XGkBk +.. section: Library + +Removed deprecated asyncio JoinableQueue. + +.. + +.. bpo: 23529 +.. date: 8044 +.. nonce: Hr7AHH +.. section: Library + +Limit the size of decompressed data when reading from GzipFile, BZ2File or +LZMAFile. This defeats denial of service attacks using compressed bombs +(i.e. compressed payloads which decompress to a huge size). Patch by Martin +Panter and Nikolaus Rath. + +.. + +.. bpo: 21859 +.. date: 8043 +.. nonce: GYrUNP +.. section: Library + +Added Python implementation of io.FileIO. + +.. + +.. bpo: 23865 +.. date: 8042 +.. nonce: PtSLgU +.. section: Library + +close() methods in multiple modules now are idempotent and more robust at +shutdown. If they need to release multiple resources, all are released even +if errors occur. + +.. + +.. bpo: 23400 +.. date: 8041 +.. nonce: JSh9Z3 +.. section: Library + +Raise same exception on both Python 2 and 3 if sem_open is not available. +Patch by Davin Potts. + +.. + +.. bpo: 10838 +.. date: 8040 +.. nonce: p9tSPC +.. section: Library + +The subprocess now module includes SubprocessError and TimeoutError in its +list of exported names for the users wild enough to use ``from subprocess +import *``. + +.. + +.. bpo: 23411 +.. date: 8039 +.. nonce: 0im3Qw +.. section: Library + +Added DefragResult, ParseResult, SplitResult, DefragResultBytes, +ParseResultBytes, and SplitResultBytes to urllib.parse.__all__. Patch by +Martin Panter. + +.. + +.. bpo: 23881 +.. date: 8038 +.. nonce: yZjl4b +.. section: Library + +urllib.request.ftpwrapper constructor now closes the socket if the FTP +connection failed to fix a ResourceWarning. + +.. + +.. bpo: 23853 +.. date: 8037 +.. nonce: mNY1eI +.. section: Library + +:meth:`socket.socket.sendall` does no more reset the socket timeout each +time data is sent successfully. The socket timeout is now the maximum total +duration to send all data. + +.. + +.. bpo: 22721 +.. date: 8036 +.. nonce: MVfBL9 +.. section: Library + +An order of multiline pprint output of set or dict containing orderable and +non-orderable elements no longer depends on iteration order of set or dict. + +.. + +.. bpo: 15133 +.. date: 8035 +.. nonce: C0QfV8 +.. section: Library + +_tkinter.tkapp.getboolean() now supports Tcl_Obj and always returns bool. +tkinter.BooleanVar now validates input values (accepted bool, int, str, and +Tcl_Obj). tkinter.BooleanVar.get() now always returns bool. + +.. + +.. bpo: 10590 +.. date: 8034 +.. nonce: nkxXfU +.. section: Library + +xml.sax.parseString() now supports string argument. + +.. + +.. bpo: 23338 +.. date: 8033 +.. nonce: ZYMGN1 +.. section: Library + +Fixed formatting ctypes error messages on Cygwin. Patch by Makoto Kato. + +.. + +.. bpo: 15582 +.. date: 8032 +.. nonce: 26wJNk +.. section: Library + +inspect.getdoc() now follows inheritance chains. + +.. + +.. bpo: 2175 +.. date: 8031 +.. nonce: cHiVOp +.. section: Library + +SAX parsers now support a character stream of InputSource object. + +.. + +.. bpo: 16840 +.. date: 8030 +.. nonce: kKIhPm +.. section: Library + +Tkinter now supports 64-bit integers added in Tcl 8.4 and arbitrary +precision integers added in Tcl 8.5. + +.. + +.. bpo: 23834 +.. date: 8029 +.. nonce: fX3TF4 +.. section: Library + +Fix socket.sendto(), use the C Py_ssize_t type to store the result of +sendto() instead of the C int type. + +.. + +.. bpo: 23618 +.. date: 8028 +.. nonce: Of_q5t +.. section: Library + +:meth:`socket.socket.connect` now waits until the connection completes +instead of raising :exc:`InterruptedError` if the connection is interrupted +by signals, signal handlers don't raise an exception and the socket is +blocking or has a timeout. :meth:`socket.socket.connect` still raise +:exc:`InterruptedError` for non-blocking sockets. + +.. + +.. bpo: 21526 +.. date: 8027 +.. nonce: QQEXrR +.. section: Library + +Tkinter now supports new boolean type in Tcl 8.5. + +.. + +.. bpo: 23836 +.. date: 8026 +.. nonce: zrEmlR +.. section: Library + +Fix the faulthandler module to handle reentrant calls to its signal +handlers. + +.. + +.. bpo: 23838 +.. date: 8025 +.. nonce: IX6FPX +.. section: Library + +linecache now clears the cache and returns an empty result on MemoryError. + +.. + +.. bpo: 10395 +.. date: 8024 +.. nonce: fi_lZp +.. section: Library + +Added os.path.commonpath(). Implemented in posixpath and ntpath. Based on +patch by Rafik Draoui. + +.. + +.. bpo: 23611 +.. date: 8023 +.. nonce: QkBJVB +.. section: Library + +Serializing more "lookupable" objects (such as unbound methods or nested +classes) now are supported with pickle protocols < 4. + +.. + +.. bpo: 13583 +.. date: 8022 +.. nonce: -MPBjZ +.. section: Library + +sqlite3.Row now supports slice indexing. + +.. + +.. bpo: 18473 +.. date: 8021 +.. nonce: 89RHm- +.. section: Library + +Fixed 2to3 and 3to2 compatible pickle mappings. Fixed ambigious reverse +mappings. Added many new mappings. Import mapping is no longer applied to +modules already mapped with full name mapping. + +.. + +.. bpo: 23485 +.. date: 8020 +.. nonce: kQWN6L +.. section: Library + +select.select() is now retried automatically with the recomputed timeout +when interrupted by a signal, except if the signal handler raises an +exception. This change is part of the PEP 475. + +.. + +.. bpo: 23752 +.. date: 8019 +.. nonce: 5fbVNb +.. section: Library + +When built from an existing file descriptor, io.FileIO() now only calls +fstat() once. Before fstat() was called twice, which was not necessary. + +.. + +.. bpo: 23704 +.. date: 8018 +.. nonce: Ggjvm8 +.. section: Library + +collections.deque() objects now support __add__, __mul__, and __imul__(). + +.. + +.. bpo: 23171 +.. date: 8017 +.. nonce: b6PBzM +.. section: Library + +csv.Writer.writerow() now supports arbitrary iterables. + +.. + +.. bpo: 23745 +.. date: 8016 +.. nonce: E00Bml +.. section: Library + +The new email header parser now handles duplicate MIME parameter names +without error, similar to how get_param behaves. + +.. + +.. bpo: 22117 +.. date: 8015 +.. nonce: bTO0xx +.. section: Library + +Fix os.utime(), it now rounds the timestamp towards minus infinity (-inf) +instead of rounding towards zero. + +.. + +.. bpo: 23310 +.. date: 8014 +.. nonce: GXmFMR +.. section: Library + +Fix MagicMock's initializer to work with __methods__, just like +configure_mock(). Patch by Kasia Jachim. + +.. + +.. bpo: 23817 +.. date: 8013 +.. nonce: DTmVan +.. section: Build + +FreeBSD now uses "1.0" in the SOVERSION as other operating systems, instead +of just "1". + +.. + +.. bpo: 23501 +.. date: 8012 +.. nonce: iz10e6 +.. section: Build + +Argument Clinic now generates code into separate files by default. + +.. + +.. bpo: 23799 +.. date: 8011 +.. nonce: XU2xDw +.. section: Tests + +Added test.support.start_threads() for running and cleaning up multiple +threads. + +.. + +.. bpo: 22390 +.. date: 8010 +.. nonce: UPVFnq +.. section: Tests + +test.regrtest now emits a warning if temporary files or directories are left +after running a test. + +.. + +.. bpo: 18128 +.. date: 8009 +.. nonce: lx2V5a +.. section: Tools/Demos + +pygettext now uses standard +NNNN format in the POT-Creation-Date header. + +.. + +.. bpo: 23935 +.. date: 8008 +.. nonce: JSYowT +.. section: Tools/Demos + +Argument Clinic's understanding of format units accepting bytes, bytearrays, +and buffers is now consistent with both the documentation and the +implementation. + +.. + +.. bpo: 23944 +.. date: 8007 +.. nonce: Q8ZL2s +.. section: Tools/Demos + +Argument Clinic now wraps long impl prototypes at column 78. + +.. + +.. bpo: 20586 +.. date: 8006 +.. nonce: 7BiEkx +.. section: Tools/Demos + +Argument Clinic now ensures that functions without docstrings have +signatures. + +.. + +.. bpo: 23492 +.. date: 8005 +.. nonce: kjIcQW +.. section: Tools/Demos + +Argument Clinic now generates argument parsing code with PyArg_Parse instead +of PyArg_ParseTuple if possible. + +.. + +.. bpo: 23500 +.. date: 8004 +.. nonce: H6_dX_ +.. section: Tools/Demos + +Argument Clinic is now smarter about generating the "#ifndef" (empty) +definition of the methoddef macro: it's only generated once, even if +Argument Clinic processes the same symbol multiple times, and it's emitted +at the end of all processing rather than immediately after the first use. + +.. + +.. bpo: 23998 +.. date: 8003 +.. nonce: z7mlLW +.. section: C API + +PyImport_ReInitLock() now checks for lock allocation error diff --git a/Misc/NEWS.d/3.5.0b1.rst b/Misc/NEWS.d/3.5.0b1.rst new file mode 100644 index 00000000000..cdbed923bf4 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b1.rst @@ -0,0 +1,848 @@ +.. bpo: 24276 +.. date: 8157 +.. nonce: awsxJJ +.. release date: 2015-05-24 +.. section: Core and Builtins + +Fixed optimization of property descriptor getter. + +.. + +.. bpo: 24268 +.. date: 8156 +.. nonce: nS7uea +.. section: Core and Builtins + +PEP 489: Multi-phase extension module initialization. Patch by Petr +Viktorin. + +.. + +.. bpo: 23955 +.. date: 8155 +.. nonce: hBHSaU +.. section: Core and Builtins + +Add pyvenv.cfg option to suppress registry/environment lookup for generating +sys.path on Windows. + +.. + +.. bpo: 24257 +.. date: 8154 +.. nonce: UBxshR +.. section: Core and Builtins + +Fixed system error in the comparison of faked types.SimpleNamespace. + +.. + +.. bpo: 22939 +.. date: 8153 +.. nonce: DWA9ls +.. section: Core and Builtins + +Fixed integer overflow in iterator object. Patch by Clement Rouault. + +.. + +.. bpo: 23985 +.. date: 8152 +.. nonce: eezPxO +.. section: Core and Builtins + +Fix a possible buffer overrun when deleting a slice from the front of a +bytearray and then appending some other bytes data. + +.. + +.. bpo: 24102 +.. date: 8151 +.. nonce: 9T6h3m +.. section: Core and Builtins + +Fixed exception type checking in standard error handlers. + +.. + +.. bpo: 15027 +.. date: 8150 +.. nonce: wi9sCd +.. section: Core and Builtins + +The UTF-32 encoder is now 3x to 7x faster. + +.. + +.. bpo: 23290 +.. date: 8149 +.. nonce: 57aqLU +.. section: Core and Builtins + +Optimize set_merge() for cases where the target is empty. (Contributed by +Serhiy Storchaka.) + +.. + +.. bpo: 2292 +.. date: 8148 +.. nonce: h4sibO +.. section: Core and Builtins + +PEP 448: Additional Unpacking Generalizations. + +.. + +.. bpo: 24096 +.. date: 8147 +.. nonce: a_Rap7 +.. section: Core and Builtins + +Make warnings.warn_explicit more robust against mutation of the +warnings.filters list. + +.. + +.. bpo: 23996 +.. date: 8146 +.. nonce: znqcT8 +.. section: Core and Builtins + +Avoid a crash when a delegated generator raises an unnormalized +StopIteration exception. Patch by Stefan Behnel. + +.. + +.. bpo: 23910 +.. date: 8145 +.. nonce: _gDzaj +.. section: Core and Builtins + +Optimize property() getter calls. Patch by Joe Jevnik. + +.. + +.. bpo: 23911 +.. date: 8144 +.. nonce: 0FnTHk +.. section: Core and Builtins + +Move path-based importlib bootstrap code to a separate frozen module. + +.. + +.. bpo: 24192 +.. date: 8143 +.. nonce: 6ZxJ_R +.. section: Core and Builtins + +Fix namespace package imports. + +.. + +.. bpo: 24022 +.. date: 8142 +.. nonce: 1l8YBm +.. section: Core and Builtins + +Fix tokenizer crash when processing undecodable source code. + +.. + +.. bpo: 9951 +.. date: 8141 +.. nonce: wGztNC +.. section: Core and Builtins + +Added a hex() method to bytes, bytearray, and memoryview. + +.. + +.. bpo: 22906 +.. date: 8140 +.. nonce: WN_kQ6 +.. section: Core and Builtins + +PEP 479: Change StopIteration handling inside generators. + +.. + +.. bpo: 24017 +.. date: 8139 +.. nonce: QJa1SC +.. section: Core and Builtins + +PEP 492: Coroutines with async and await syntax. + +.. + +.. bpo: 14373 +.. date: 8138 +.. nonce: 0sk6kE +.. section: Library + +Added C implementation of functools.lru_cache(). Based on patches by Matt +Joiner and Alexey Kachayev. + +.. + +.. bpo: 24230 +.. date: 8137 +.. nonce: b-kgme +.. section: Library + +The tempfile module now accepts bytes for prefix, suffix and dir parameters +and returns bytes in such situations (matching the os module APIs). + +.. + +.. bpo: 22189 +.. date: 8136 +.. nonce: 8epgat +.. section: Library + +collections.UserString now supports __getnewargs__(), __rmod__(), +casefold(), format_map(), isprintable(), and maketrans(). Patch by Joe +Jevnik. + +.. + +.. bpo: 24244 +.. date: 8135 +.. nonce: OKE_3R +.. section: Library + +Prevents termination when an invalid format string is encountered on Windows +in strftime. + +.. + +.. bpo: 23973 +.. date: 8134 +.. nonce: EK6awi +.. section: Library + +PEP 484: Add the typing module. + +.. + +.. bpo: 23086 +.. date: 8133 +.. nonce: Aix6Nv +.. section: Library + +The collections.abc.Sequence() abstract base class added *start* and *stop* +parameters to the index() mixin. Patch by Devin Jeanpierre. + +.. + +.. bpo: 20035 +.. date: 8132 +.. nonce: UNZzw6 +.. section: Library + +Replaced the ``tkinter._fix`` module used for setting up the Tcl/Tk +environment on Windows with a private function in the ``_tkinter`` module +that makes no permanent changes to the environment. + +.. + +.. bpo: 24257 +.. date: 8131 +.. nonce: L_efq0 +.. section: Library + +Fixed segmentation fault in sqlite3.Row constructor with faked cursor type. + +.. + +.. bpo: 15836 +.. date: 8130 +.. nonce: gU3Rmx +.. section: Library + +assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() +assertments now check the type of the first argument to prevent possible +user error. Based on patch by Daniel Wagner-Hall. + +.. + +.. bpo: 9858 +.. date: 8129 +.. nonce: uke9pa +.. section: Library + +Add missing method stubs to _io.RawIOBase. Patch by Laura Rupprecht. + +.. + +.. bpo: 22955 +.. date: 8128 +.. nonce: Jw_B9_ +.. section: Library + +attrgetter, itemgetter and methodcaller objects in the operator module now +support pickling. Added readable and evaluable repr for these objects. +Based on patch by Josh Rosenberg. + +.. + +.. bpo: 22107 +.. date: 8127 +.. nonce: 2F8k4W +.. section: Library + +tempfile.gettempdir() and tempfile.mkdtemp() now try again when a directory +with the chosen name already exists on Windows as well as on Unix. +tempfile.mkstemp() now fails early if parent directory is not valid (not +exists or is a file) on Windows. + +.. + +.. bpo: 23780 +.. date: 8126 +.. nonce: jFPVcN +.. section: Library + +Improved error message in os.path.join() with single argument. + +.. + +.. bpo: 6598 +.. date: 8125 +.. nonce: JdZNDt +.. section: Library + +Increased time precision and random number range in email.utils.make_msgid() +to strengthen the uniqueness of the message ID. + +.. + +.. bpo: 24091 +.. date: 8124 +.. nonce: Jw0-wj +.. section: Library + +Fixed various crashes in corner cases in C implementation of ElementTree. + +.. + +.. bpo: 21931 +.. date: 8123 +.. nonce: t6lGxY +.. section: Library + +msilib.FCICreate() now raises TypeError in the case of a bad argument +instead of a ValueError with a bogus FCI error number. Patch by Jeffrey +Armstrong. + +.. + +.. bpo: 13866 +.. date: 8122 +.. nonce: n5NAj0 +.. section: Library + +*quote_via* argument added to urllib.parse.urlencode. + +.. + +.. bpo: 20098 +.. date: 8121 +.. nonce: Y4otaf +.. section: Library + +New mangle_from policy option for email, default True for compat32, but +False for all other policies. + +.. + +.. bpo: 24211 +.. date: 8120 +.. nonce: j3Afpc +.. section: Library + +The email library now supports RFC 6532: it can generate headers using utf-8 +instead of encoded words. + +.. + +.. bpo: 16314 +.. date: 8119 +.. nonce: Xc4d1O +.. section: Library + +Added support for the LZMA compression in distutils. + +.. + +.. bpo: 21804 +.. date: 8118 +.. nonce: lEhTlc +.. section: Library + +poplib now supports RFC 6856 (UTF8). + +.. + +.. bpo: 18682 +.. date: 8117 +.. nonce: 6Pnfte +.. section: Library + +Optimized pprint functions for builtin scalar types. + +.. + +.. bpo: 22027 +.. date: 8116 +.. nonce: _aeUQS +.. section: Library + +smtplib now supports RFC 6531 (SMTPUTF8). + +.. + +.. bpo: 23488 +.. date: 8115 +.. nonce: 7gs3Cm +.. section: Library + +Random generator objects now consume 2x less memory on 64-bit. + +.. + +.. bpo: 1322 +.. date: 8114 +.. nonce: 495nFL +.. section: Library + +platform.dist() and platform.linux_distribution() functions are now +deprecated. Initial patch by Vajrasky Kok. + +.. + +.. bpo: 22486 +.. date: 8113 +.. nonce: Yxov5m +.. section: Library + +Added the math.gcd() function. The fractions.gcd() function now is +deprecated. Based on patch by Mark Dickinson. + +.. + +.. bpo: 24064 +.. date: 8112 +.. nonce: zXC7OL +.. section: Library + +Property() docstrings are now writeable. (Patch by Berker Peksag.) + +.. + +.. bpo: 22681 +.. date: 8111 +.. nonce: 2rIoA2 +.. section: Library + +Added support for the koi8_t encoding. + +.. + +.. bpo: 22682 +.. date: 8110 +.. nonce: cP4i3L +.. section: Library + +Added support for the kz1048 encoding. + +.. + +.. bpo: 23796 +.. date: 8109 +.. nonce: JJmUnc +.. section: Library + +peek and read1 methods of BufferedReader now raise ValueError if they called +on a closed object. Patch by John Hergenroeder. + +.. + +.. bpo: 21795 +.. date: 8108 +.. nonce: BDLMS4 +.. section: Library + +smtpd now supports the 8BITMIME extension whenever the new *decode_data* +constructor argument is set to False. + +.. + +.. bpo: 24155 +.. date: 8107 +.. nonce: FZx5c2 +.. section: Library + +optimize heapq.heapify() for better cache performance when heapifying large +lists. + +.. + +.. bpo: 21800 +.. date: 8106 +.. nonce: evGSKc +.. section: Library + +imaplib now supports RFC 5161 (enable), RFC 6855 (utf8/internationalized +email) and automatically encodes non-ASCII usernames and passwords to UTF8. + +.. + +.. bpo: 20274 +.. date: 8105 +.. nonce: uVHogg +.. section: Library + +When calling a _sqlite.Connection, it now complains if passed any keyword +arguments. Previously it silently ignored them. + +.. + +.. bpo: 20274 +.. date: 8104 +.. nonce: hBst4M +.. section: Library + +Remove ignored and erroneous "kwargs" parameters from three METH_VARARGS +methods on _sqlite.Connection. + +.. + +.. bpo: 24134 +.. date: 8103 +.. nonce: Ajw0S- +.. section: Library + +assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() +checks now emits a deprecation warning when callable is None or keyword +arguments except msg is passed in the context manager mode. + +.. + +.. bpo: 24018 +.. date: 8102 +.. nonce: hk7Rcn +.. section: Library + +Add a collections.abc.Generator abstract base class. Contributed by Stefan +Behnel. + +.. + +.. bpo: 23880 +.. date: 8101 +.. nonce: QtKupC +.. section: Library + +Tkinter's getint() and getdouble() now support Tcl_Obj. Tkinter's +getdouble() now supports any numbers (in particular int). + +.. + +.. bpo: 22619 +.. date: 8100 +.. nonce: 1gJEqV +.. section: Library + +Added negative limit support in the traceback module. Based on patch by +Dmitry Kazakov. + +.. + +.. bpo: 24094 +.. date: 8099 +.. nonce: 7T-u7k +.. section: Library + +Fix possible crash in json.encode with poorly behaved dict subclasses. + +.. + +.. bpo: 9246 +.. date: 8098 +.. nonce: oM-Ikk +.. section: Library + +On POSIX, os.getcwd() now supports paths longer than 1025 bytes. Patch +written by William Orr. + +.. + +.. bpo: 17445 +.. date: 8097 +.. nonce: Z-QYh5 +.. section: Library + +add difflib.diff_bytes() to support comparison of byte strings (fixes a +regression from Python 2). + +.. + +.. bpo: 23917 +.. date: 8096 +.. nonce: uMVPV7 +.. section: Library + +Fall back to sequential compilation when ProcessPoolExecutor doesn't exist. +Patch by Claudiu Popa. + +.. + +.. bpo: 23008 +.. date: 8095 +.. nonce: OZFCd- +.. section: Library + +Fixed resolving attributes with boolean value is False in pydoc. + +.. + +.. bpo: 0 +.. date: 8094 +.. nonce: 6tJNf2 +.. section: Library + +Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't increment +unfinished tasks (this bug was introduced when JoinableQueue was merged with +Queue). + +.. + +.. bpo: 23908 +.. date: 8093 +.. nonce: ATdNG- +.. section: Library + +os functions now reject paths with embedded null character on Windows +instead of silently truncating them. + +.. + +.. bpo: 23728 +.. date: 8092 +.. nonce: YBmQmV +.. section: Library + +binascii.crc_hqx() could return an integer outside of the range 0-0xffff for +empty data. + +.. + +.. bpo: 23887 +.. date: 8091 +.. nonce: _XpjPN +.. section: Library + +urllib.error.HTTPError now has a proper repr() representation. Patch by +Berker Peksag. + +.. + +.. bpo: 0 +.. date: 8090 +.. nonce: MjNdSC +.. section: Library + +asyncio: New event loop APIs: set_task_factory() and get_task_factory(). + +.. + +.. bpo: 0 +.. date: 8089 +.. nonce: rVcHXp +.. section: Library + +asyncio: async() function is deprecated in favour of ensure_future(). + +.. + +.. bpo: 24178 +.. date: 8088 +.. nonce: -enO4y +.. section: Library + +asyncio.Lock, Condition, Semaphore, and BoundedSemaphore support new 'async +with' syntax. Contributed by Yury Selivanov. + +.. + +.. bpo: 24179 +.. date: 8087 +.. nonce: wDy_WZ +.. section: Library + +Support 'async for' for asyncio.StreamReader. Contributed by Yury Selivanov. + +.. + +.. bpo: 24184 +.. date: 8086 +.. nonce: El74TU +.. section: Library + +Add AsyncIterator and AsyncIterable ABCs to collections.abc. Contributed by +Yury Selivanov. + +.. + +.. bpo: 22547 +.. date: 8085 +.. nonce: _ikCaj +.. section: Library + +Implement informative __repr__ for inspect.BoundArguments. Contributed by +Yury Selivanov. + +.. + +.. bpo: 24190 +.. date: 8084 +.. nonce: 1a3vWW +.. section: Library + +Implement inspect.BoundArgument.apply_defaults() method. Contributed by Yury +Selivanov. + +.. + +.. bpo: 20691 +.. date: 8083 +.. nonce: -raLyf +.. section: Library + +Add 'follow_wrapped' argument to inspect.Signature.from_callable() and +inspect.signature(). Contributed by Yury Selivanov. + +.. + +.. bpo: 24248 +.. date: 8082 +.. nonce: IxWooo +.. section: Library + +Deprecate inspect.Signature.from_function() and +inspect.Signature.from_builtin(). + +.. + +.. bpo: 23898 +.. date: 8081 +.. nonce: OSiZie +.. section: Library + +Fix inspect.classify_class_attrs() to support attributes with overloaded +__eq__ and __bool__. Patch by Mike Bayer. + +.. + +.. bpo: 24298 +.. date: 8080 +.. nonce: u_TaxI +.. section: Library + +Fix inspect.signature() to correctly unwrap wrappers around bound methods. + +.. + +.. bpo: 23184 +.. date: 8079 +.. nonce: G_Cp9v +.. section: IDLE + +remove unused names and imports in idlelib. Initial patch by Al Sweigart. + +.. + +.. bpo: 21520 +.. date: 8078 +.. nonce: FKtvmQ +.. section: Tests + +test_zipfile no longer fails if the word 'bad' appears anywhere in the name +of the current directory. + +.. + +.. bpo: 9517 +.. date: 8077 +.. nonce: W0Ag2V +.. section: Tests + +Move script_helper into the support package. Patch by Christie Wilson. + +.. + +.. bpo: 22155 +.. date: 8076 +.. nonce: 9EbOit +.. section: Documentation + +Add File Handlers subsection with createfilehandler to tkinter doc. Remove +obsolete example from FAQ. Patch by Martin Panter. + +.. + +.. bpo: 24029 +.. date: 8075 +.. nonce: M2Bnks +.. section: Documentation + +Document the name binding behavior for submodule imports. + +.. + +.. bpo: 24077 +.. date: 8074 +.. nonce: 2Og2j- +.. section: Documentation + +Fix typo in man page for -I command option: -s, not -S + +.. + +.. bpo: 24000 +.. date: 8073 +.. nonce: MJyXRr +.. section: Tools/Demos + +Improved Argument Clinic's mapping of converters to legacy "format units". +Updated the documentation to match. + +.. + +.. bpo: 24001 +.. date: 8072 +.. nonce: m74vst +.. section: Tools/Demos + +Argument Clinic converters now use accept={type} instead of types={'type'} +to specify the types the converter accepts. + +.. + +.. bpo: 23330 +.. date: 8071 +.. nonce: LTlKDp +.. section: Tools/Demos + +h2py now supports arbitrary filenames in #include. + +.. + +.. bpo: 24031 +.. date: 8070 +.. nonce: duGo88 +.. section: Tools/Demos + +make patchcheck now supports git checkouts, too. diff --git a/Misc/NEWS.d/3.5.0b2.rst b/Misc/NEWS.d/3.5.0b2.rst new file mode 100644 index 00000000000..1197b5947f7 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b2.rst @@ -0,0 +1,104 @@ +.. bpo: 24284 +.. date: 8168 +.. nonce: NvtEnc +.. release date: 2015-05-31 +.. section: Core and Builtins + +The startswith and endswith methods of the str class no longer return True +when finding the empty string and the indexes are completely out of range. + +.. + +.. bpo: 24115 +.. date: 8167 +.. nonce: y9e_MO +.. section: Core and Builtins + +Update uses of PyObject_IsTrue(), PyObject_Not(), PyObject_IsInstance(), +PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle +errors correctly. + +.. + +.. bpo: 24328 +.. date: 8166 +.. nonce: 5gL8or +.. section: Core and Builtins + +Fix importing one character extension modules. + +.. + +.. bpo: 11205 +.. date: 8165 +.. nonce: bikrRP +.. section: Core and Builtins + +In dictionary displays, evaluate the key before the value. + +.. + +.. bpo: 24285 +.. date: 8164 +.. nonce: wvJumr +.. section: Core and Builtins + +Fixed regression that prevented importing extension modules from inside +packages. Patch by Petr Viktorin. + +.. + +.. bpo: 23247 +.. date: 8163 +.. nonce: nN-K74 +.. section: Library + +Fix a crash in the StreamWriter.reset() of CJK codecs. + +.. + +.. bpo: 24270 +.. date: 8162 +.. nonce: M2rJNs +.. section: Library + +Add math.isclose() and cmath.isclose() functions as per PEP 485. Contributed +by Chris Barker and Tal Einat. + +.. + +.. bpo: 5633 +.. date: 8161 +.. nonce: JNzKZq +.. section: Library + +Fixed timeit when the statement is a string and the setup is not. + +.. + +.. bpo: 24326 +.. date: 8160 +.. nonce: 4t_6Gy +.. section: Library + +Fixed audioop.ratecv() with non-default weightB argument. Original patch by +David Moore. + +.. + +.. bpo: 16991 +.. date: 8159 +.. nonce: 19_Zmj +.. section: Library + +Add a C implementation of OrderedDict. + +.. + +.. bpo: 23934 +.. date: 8158 +.. nonce: esb-45 +.. section: Library + +Fix inspect.signature to fail correctly for builtin types lacking signature +information. Initial patch by James Powell. diff --git a/Misc/NEWS.d/3.5.0b3.rst b/Misc/NEWS.d/3.5.0b3.rst new file mode 100644 index 00000000000..6b72d4b177e --- /dev/null +++ b/Misc/NEWS.d/3.5.0b3.rst @@ -0,0 +1,273 @@ +.. bpo: 24467 +.. date: 8196 +.. nonce: BAJ80- +.. release date: 2015-07-05 +.. section: Core and Builtins + +Fixed possible buffer over-read in bytearray. The bytearray object now +always allocates place for trailing null byte and it's buffer now is always +null-terminated. + +.. + +.. bpo: 0 +.. date: 8195 +.. nonce: 944IUY +.. section: Core and Builtins + +Upgrade to Unicode 8.0.0. + +.. + +.. bpo: 24345 +.. date: 8194 +.. nonce: fVcTaB +.. section: Core and Builtins + +Add Py_tp_finalize slot for the stable ABI. + +.. + +.. bpo: 24400 +.. date: 8193 +.. nonce: 2mNeD8 +.. section: Core and Builtins + +Introduce a distinct type for PEP 492 coroutines; add types.CoroutineType, +inspect.getcoroutinestate, inspect.getcoroutinelocals; coroutines no longer +use CO_GENERATOR flag; sys.set_coroutine_wrapper works only for 'async def' +coroutines; inspect.iscoroutine no longer uses collections.abc.Coroutine, +it's intended to test for pure 'async def' coroutines only; add new opcode: +GET_YIELD_FROM_ITER; fix generators wrapper used in types.coroutine to be +instance of collections.abc.Generator; collections.abc.Awaitable and +collections.abc.Coroutine can no longer be used to detect generator-based +coroutines--use inspect.isawaitable instead. + +.. + +.. bpo: 24450 +.. date: 8192 +.. nonce: lF0S5c +.. section: Core and Builtins + +Add gi_yieldfrom to generators and cr_await to coroutines. Contributed by +Benno Leslie and Yury Selivanov. + +.. + +.. bpo: 19235 +.. date: 8191 +.. nonce: 0kW4n5 +.. section: Core and Builtins + +Add new RecursionError exception. Patch by Georg Brandl. + +.. + +.. bpo: 21750 +.. date: 8190 +.. nonce: _Ycvgi +.. section: Library + +mock_open.read_data can now be read from each instance, as it could in +Python 3.3. + +.. + +.. bpo: 24552 +.. date: 8189 +.. nonce: VTO6sf +.. section: Library + +Fix use after free in an error case of the _pickle module. + +.. + +.. bpo: 24514 +.. date: 8188 +.. nonce: _xRb2r +.. section: Library + +tarfile now tolerates number fields consisting of only whitespace. + +.. + +.. bpo: 19176 +.. date: 8187 +.. nonce: 8V6nOK +.. section: Library + +Fixed doctype() related bugs in C implementation of ElementTree. A +deprecation warning no longer issued by XMLParser subclass with default +doctype() method. Direct call of doctype() now issues a warning. Parser's +doctype() now is not called if target's doctype() is called. Based on patch +by Martin Panter. + +.. + +.. bpo: 20387 +.. date: 8186 +.. nonce: aAbWbQ +.. section: Library + +Restore semantic round-trip correctness in tokenize/untokenize for tab- +indented blocks. + +.. + +.. bpo: 24456 +.. date: 8185 +.. nonce: yYSd2u +.. section: Library + +Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() functions of +the audioop module. + +.. + +.. bpo: 24336 +.. date: 8184 +.. nonce: 4a5y1m +.. section: Library + +The contextmanager decorator now works with functions with keyword arguments +called "func" and "self". Patch by Martin Panter. + +.. + +.. bpo: 24522 +.. date: 8183 +.. nonce: PkcqCA +.. section: Library + +Fix possible integer overflow in json accelerator module. + +.. + +.. bpo: 24489 +.. date: 8182 +.. nonce: GJnMcW +.. section: Library + +ensure a previously set C errno doesn't disturb cmath.polar(). + +.. + +.. bpo: 24408 +.. date: 8181 +.. nonce: vPb5UK +.. section: Library + +Fixed AttributeError in measure() and metrics() methods of tkinter.Font. + +.. + +.. bpo: 14373 +.. date: 8180 +.. nonce: CTYZ4J +.. section: Library + +C implementation of functools.lru_cache() now can be used with methods. + +.. + +.. bpo: 24347 +.. date: 8179 +.. nonce: CPPDb8 +.. section: Library + +Set KeyError if PyDict_GetItemWithError returns NULL. + +.. + +.. bpo: 24348 +.. date: 8178 +.. nonce: U11rhr +.. section: Library + +Drop superfluous incref/decref. + +.. + +.. bpo: 24359 +.. date: 8177 +.. nonce: -IRNG9 +.. section: Library + +Check for changed OrderedDict size during iteration. + +.. + +.. bpo: 24368 +.. date: 8176 +.. nonce: 550kDT +.. section: Library + +Support keyword arguments in OrderedDict methods. + +.. + +.. bpo: 24362 +.. date: 8175 +.. nonce: cHYce5 +.. section: Library + +Simplify the C OrderedDict fast nodes resize logic. + +.. + +.. bpo: 24377 +.. date: 8174 +.. nonce: Gp1Bqr +.. section: Library + +Fix a ref leak in OrderedDict.__repr__. + +.. + +.. bpo: 24369 +.. date: 8173 +.. nonce: qFl7lZ +.. section: Library + +Defend against key-changes during iteration. + +.. + +.. bpo: 24373 +.. date: 8172 +.. nonce: 6TL2XG +.. section: Tests + +_testmultiphase and xxlimited now use tp_traverse and tp_finalize to avoid +reference leaks encountered when combining tp_dealloc with PyType_FromSpec +(see issue #16690 for details) + +.. + +.. bpo: 24458 +.. date: 8171 +.. nonce: 1egApX +.. section: Documentation + +Update documentation to cover multi-phase initialization for extension +modules (PEP 489). Patch by Petr Viktorin. + +.. + +.. bpo: 24351 +.. date: 8170 +.. nonce: XeSVl5 +.. section: Documentation + +Clarify what is meant by "identifier" in the context of string.Template +instances. + +.. + +.. bpo: 24432 +.. date: 8169 +.. nonce: IvUSiN +.. section: Build + +Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2c. diff --git a/Misc/NEWS.d/3.5.0b4.rst b/Misc/NEWS.d/3.5.0b4.rst new file mode 100644 index 00000000000..6f115483567 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b4.rst @@ -0,0 +1,255 @@ +.. bpo: 23573 +.. date: 8223 +.. nonce: HdJPs7 +.. release date: 2015-07-26 +.. section: Core and Builtins + +Restored optimization of bytes.rfind() and bytearray.rfind() for single-byte +argument on Linux. + +.. + +.. bpo: 24569 +.. date: 8222 +.. nonce: bqh6PQ +.. section: Core and Builtins + +Make PEP 448 dictionary evaluation more consistent. + +.. + +.. bpo: 24583 +.. date: 8221 +.. nonce: Ooq0Tn +.. section: Core and Builtins + +Fix crash when set is mutated while being updated. + +.. + +.. bpo: 24407 +.. date: 8220 +.. nonce: GmCBB3 +.. section: Core and Builtins + +Fix crash when dict is mutated while being updated. + +.. + +.. bpo: 24619 +.. date: 8219 +.. nonce: cnfZGo +.. section: Core and Builtins + +New approach for tokenizing async/await. As a consequence, it is now +possible to have one-line 'async def foo(): await ..' functions. + +.. + +.. bpo: 24687 +.. date: 8218 +.. nonce: 0UaXFe +.. section: Core and Builtins + +Plug refleak on SyntaxError in function parameters annotations. + +.. + +.. bpo: 15944 +.. date: 8217 +.. nonce: 4GuwqX +.. section: Core and Builtins + +memoryview: Allow arbitrary formats when casting to bytes. Patch by Martin +Panter. + +.. + +.. bpo: 23441 +.. date: 8216 +.. nonce: JXt2Yt +.. section: Library + +rcompleter now prints a tab character instead of displaying possible +completions for an empty word. Initial patch by Martin Sekera. + +.. + +.. bpo: 24683 +.. date: 8215 +.. nonce: aJdWEv +.. section: Library + +Fixed crashes in _json functions called with arguments of inappropriate +type. + +.. + +.. bpo: 21697 +.. date: 8214 +.. nonce: jpATha +.. section: Library + +shutil.copytree() now correctly handles symbolic links that point to +directories. Patch by Eduardo Seabra and Thomas Kluyver. + +.. + +.. bpo: 14373 +.. date: 8213 +.. nonce: Je0yDg +.. section: Library + +Fixed segmentation fault when gc.collect() is called during constructing +lru_cache (C implementation). + +.. + +.. bpo: 24695 +.. date: 8212 +.. nonce: QjZzFb +.. section: Library + +Fix a regression in traceback.print_exception(). If exc_traceback is None +we shouldn't print a traceback header like described in the documentation. + +.. + +.. bpo: 24620 +.. date: 8211 +.. nonce: rrnxB- +.. section: Library + +Random.setstate() now validates the value of state last element. + +.. + +.. bpo: 22485 +.. date: 8210 +.. nonce: HvJf6T +.. section: Library + +Fixed an issue that caused `inspect.getsource` to return incorrect results +on nested functions. + +.. + +.. bpo: 22153 +.. date: 8209 +.. nonce: 6n6yld +.. section: Library + +Improve unittest docs. Patch from Martin Panter and evilzero. + +.. + +.. bpo: 24580 +.. date: 8208 +.. nonce: AGi4Gm +.. section: Library + +Symbolic group references to open group in re patterns now are explicitly +forbidden as well as numeric group references. + +.. + +.. bpo: 24206 +.. date: 8207 +.. nonce: ffkVHH +.. section: Library + +Fixed __eq__ and __ne__ methods of inspect classes. + +.. + +.. bpo: 24631 +.. date: 8206 +.. nonce: uljPxM +.. section: Library + +Fixed regression in the timeit module with multiline setup. + +.. + +.. bpo: 18622 +.. date: 8205 +.. nonce: i6nCCW +.. section: Library + +unittest.mock.mock_open().reset_mock would recurse infinitely. Patch from +Nicola Palumbo and Laurent De Buyst. + +.. + +.. bpo: 23661 +.. date: 8204 +.. nonce: 5VHJmh +.. section: Library + +unittest.mock side_effects can now be exceptions again. This was a +regression vs Python 3.4. Patch from Ignacio Rossi + +.. + +.. bpo: 24608 +.. date: 8203 +.. nonce: 0TndL0 +.. section: Library + +chunk.Chunk.read() now always returns bytes, not str. + +.. + +.. bpo: 18684 +.. date: 8202 +.. nonce: S2es0F +.. section: Library + +Fixed reading out of the buffer in the re module. + +.. + +.. bpo: 24259 +.. date: 8201 +.. nonce: vMAi1A +.. section: Library + +tarfile now raises a ReadError if an archive is truncated inside a data +segment. + +.. + +.. bpo: 15014 +.. date: 8200 +.. nonce: hwXwCH +.. section: Library + +SMTP.auth() and SMTP.login() now support RFC 4954's optional initial- +response argument to the SMTP AUTH command. + +.. + +.. bpo: 24669 +.. date: 8199 +.. nonce: kFThK0 +.. section: Library + +Fix inspect.getsource() for 'async def' functions. Patch by Kai Groner. + +.. + +.. bpo: 24688 +.. date: 8198 +.. nonce: -yWfcO +.. section: Library + +ast.get_docstring() for 'async def' functions. + +.. + +.. bpo: 24603 +.. date: 8197 +.. nonce: PyHyF5 +.. section: Build + +Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2d. diff --git a/Misc/NEWS.d/3.5.0rc1.rst b/Misc/NEWS.d/3.5.0rc1.rst new file mode 100644 index 00000000000..859e60247a2 --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc1.rst @@ -0,0 +1,241 @@ +.. bpo: 24667 +.. date: 8248 +.. nonce: tdwszf +.. release date: 2015-08-09 +.. section: Core and Builtins + +Resize odict in all cases that the underlying dict resizes. + +.. + +.. bpo: 24824 +.. date: 8247 +.. nonce: Eoc4lq +.. section: Library + +Signatures of codecs.encode() and codecs.decode() now are compatible with +pydoc. + +.. + +.. bpo: 24634 +.. date: 8246 +.. nonce: 7bnVgr +.. section: Library + +Importing uuid should not try to load libc on Windows + +.. + +.. bpo: 24798 +.. date: 8245 +.. nonce: zDXL5R +.. section: Library + +_msvccompiler.py doesn't properly support manifests + +.. + +.. bpo: 4395 +.. date: 8244 +.. nonce: JpT0k7 +.. section: Library + +Better testing and documentation of binary operators. Patch by Martin +Panter. + +.. + +.. bpo: 23973 +.. date: 8243 +.. nonce: wT59Vh +.. section: Library + +Update typing.py from GitHub repo. + +.. + +.. bpo: 23004 +.. date: 8242 +.. nonce: xswcPm +.. section: Library + +mock_open() now reads binary data correctly when the type of read_data is +bytes. Initial patch by Aaron Hill. + +.. + +.. bpo: 23888 +.. date: 8241 +.. nonce: 7gw4oO +.. section: Library + +Handle fractional time in cookie expiry. Patch by ssh. + +.. + +.. bpo: 23652 +.. date: 8240 +.. nonce: DKQ_7t +.. section: Library + +Make it possible to compile the select module against the libc headers from +the Linux Standard Base, which do not include some EPOLL macros. Patch by +Matt Frank. + +.. + +.. bpo: 22932 +.. date: 8239 +.. nonce: mPclSJ +.. section: Library + +Fix timezones in email.utils.formatdate. Patch from Dmitry Shachnev. + +.. + +.. bpo: 23779 +.. date: 8238 +.. nonce: ET4JJP +.. section: Library + +imaplib raises TypeError if authenticator tries to abort. Patch from Craig +Holmquist. + +.. + +.. bpo: 23319 +.. date: 8237 +.. nonce: FXyUH- +.. section: Library + +Fix ctypes.BigEndianStructure, swap correctly bytes. Patch written by +Matthieu Gautier. + +.. + +.. bpo: 23254 +.. date: 8236 +.. nonce: zNiy1X +.. section: Library + +Document how to close the TCPServer listening socket. Patch from Martin +Panter. + +.. + +.. bpo: 19450 +.. date: 8235 +.. nonce: VG7T-L +.. section: Library + +Update Windows and OS X installer builds to use SQLite 3.8.11. + +.. + +.. bpo: 17527 +.. date: 8234 +.. nonce: ve9fyw +.. section: Library + +Add PATCH to wsgiref.validator. Patch from Luca Sbardella. + +.. + +.. bpo: 24791 +.. date: 8233 +.. nonce: Ok-3nA +.. section: Library + +Fix grammar regression for call syntax: 'g(\*a or b)'. + +.. + +.. bpo: 23672 +.. date: 8232 +.. nonce: 8td2se +.. section: IDLE + +Allow Idle to edit and run files with astral chars in name. Patch by Mohd +Sanad Zaki Rizvi. + +.. + +.. bpo: 24745 +.. date: 8231 +.. nonce: edbziT +.. section: IDLE + +Idle editor default font. Switch from Courier to platform-sensitive +TkFixedFont. This should not affect current customized font selections. If +there is a problem, edit $HOME/.idlerc/config-main.cfg and remove 'fontxxx' +entries from [Editor Window]. Patch by Mark Roseman. + +.. + +.. bpo: 21192 +.. date: 8230 +.. nonce: CdbipH +.. section: IDLE + +Idle editor. When a file is run, put its name in the restart bar. Do not +print false prompts. Original patch by Adnan Umer. + +.. + +.. bpo: 13884 +.. date: 8229 +.. nonce: vVcO1E +.. section: IDLE + +Idle menus. Remove tearoff lines. Patch by Roger Serwy. + +.. + +.. bpo: 24129 +.. date: 8228 +.. nonce: Imr54z +.. section: Documentation + +Clarify the reference documentation for name resolution. This includes +removing the assumption that readers will be familiar with the name +resolution scheme Python used prior to the introduction of lexical scoping +for function namespaces. Patch by Ivan Levkivskyi. + +.. + +.. bpo: 20769 +.. date: 8227 +.. nonce: ZUc9z9 +.. section: Documentation + +Improve reload() docs. Patch by Dorian Pula. + +.. + +.. bpo: 23589 +.. date: 8226 +.. nonce: rjU421 +.. section: Documentation + +Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. + +.. + +.. bpo: 24729 +.. date: 8225 +.. nonce: PH3A9p +.. section: Documentation + +Correct IO tutorial to match implementation regarding encoding parameter to +open function. + +.. + +.. bpo: 24751 +.. date: 8224 +.. nonce: pL2pbj +.. section: Tests + +When running regrtest with the ``-w`` command line option, a test run is no +longer marked as a failure if all tests succeed when re-run. diff --git a/Misc/NEWS.d/3.5.0rc2.rst b/Misc/NEWS.d/3.5.0rc2.rst new file mode 100644 index 00000000000..94511092e04 --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc2.rst @@ -0,0 +1,56 @@ +.. bpo: 24769 +.. date: 8254 +.. nonce: XgRA0n +.. release date: 2015-08-25 +.. section: Core and Builtins + +Interpreter now starts properly when dynamic loading is disabled. Patch by +Petr Viktorin. + +.. + +.. bpo: 21167 +.. date: 8253 +.. nonce: uom-Dq +.. section: Core and Builtins + +NAN operations are now handled correctly when python is compiled with ICC +even if -fp-model strict is not specified. + +.. + +.. bpo: 24492 +.. date: 8252 +.. nonce: LKDAIu +.. section: Core and Builtins + +A "package" lacking a __name__ attribute when trying to perform a ``from .. +import ...`` statement will trigger an ImportError instead of an +AttributeError. + +.. + +.. bpo: 24847 +.. date: 8251 +.. nonce: SHiiO_ +.. section: Library + +Removes vcruntime140.dll dependency from Tcl/Tk. + +.. + +.. bpo: 24839 +.. date: 8250 +.. nonce: 7_iQZl +.. section: Library + +platform._syscmd_ver raises DeprecationWarning + +.. + +.. bpo: 24867 +.. date: 8249 +.. nonce: rxJIl7 +.. section: Library + +Fix Task.get_stack() for 'async def' coroutines diff --git a/Misc/NEWS.d/3.5.0rc3.rst b/Misc/NEWS.d/3.5.0rc3.rst new file mode 100644 index 00000000000..72e6578c29a --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc3.rst @@ -0,0 +1,76 @@ +.. bpo: 24305 +.. date: 8262 +.. nonce: QeF4A8 +.. release date: 2015-09-07 +.. section: Core and Builtins + +Prevent import subsystem stack frames from being counted by the +warnings.warn(stacklevel=) parameter. + +.. + +.. bpo: 24912 +.. date: 8261 +.. nonce: ubSi5J +.. section: Core and Builtins + +Prevent __class__ assignment to immutable built-in objects. + +.. + +.. bpo: 24975 +.. date: 8260 +.. nonce: 2gLdfN +.. section: Core and Builtins + +Fix AST compilation for PEP 448 syntax. + +.. + +.. bpo: 24917 +.. date: 8259 +.. nonce: xaQocz +.. section: Library + +time_strftime() buffer over-read. + +.. + +.. bpo: 24748 +.. date: 8258 +.. nonce: 83NuO8 +.. section: Library + +To resolve a compatibility problem found with py2exe and pywin32, +imp.load_dynamic() once again ignores previously loaded modules to support +Python modules replacing themselves with extension modules. Patch by Petr +Viktorin. + +.. + +.. bpo: 24635 +.. date: 8257 +.. nonce: EiJPPf +.. section: Library + +Fixed a bug in typing.py where isinstance([], typing.Iterable) would return +True once, then False on subsequent calls. + +.. + +.. bpo: 24989 +.. date: 8256 +.. nonce: 9BJLiy +.. section: Library + +Fixed buffer overread in BytesIO.readline() if a position is set beyond +size. Based on patch by John Leitch. + +.. + +.. bpo: 24913 +.. date: 8255 +.. nonce: p2ZAJ4 +.. section: Library + +Fix overrun error in deque.index(). Found by John Leitch and Bryce Darling. diff --git a/Misc/NEWS.d/3.5.0rc4.rst b/Misc/NEWS.d/3.5.0rc4.rst new file mode 100644 index 00000000000..e62c80d9b6e --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc4.rst @@ -0,0 +1,17 @@ +.. bpo: 25029 +.. date: 8264 +.. nonce: Zf97rk +.. release date: 2015-09-09 +.. section: Library + +Fixes MemoryError in test_strptime. + +.. + +.. bpo: 25027 +.. date: 8263 +.. nonce: Zaib78 +.. section: Build + +Reverts partial-static build options and adds vcruntime140.dll to Windows +installation. diff --git a/Misc/NEWS.d/3.5.1.rst b/Misc/NEWS.d/3.5.1.rst new file mode 100644 index 00000000000..9a09342047e --- /dev/null +++ b/Misc/NEWS.d/3.5.1.rst @@ -0,0 +1,17 @@ +.. bpo: 25709 +.. date: 8412 +.. nonce: OPX2TS +.. release date: 2015-12-06 +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 25715 +.. date: 8411 +.. nonce: 3LLYLj +.. section: Windows + +Python 3.5.1 installer shows wrong upgrade path and incorrect logic for +launcher detection. diff --git a/Misc/NEWS.d/3.5.1rc1.rst b/Misc/NEWS.d/3.5.1rc1.rst new file mode 100644 index 00000000000..45cf6d93c22 --- /dev/null +++ b/Misc/NEWS.d/3.5.1rc1.rst @@ -0,0 +1,1451 @@ +.. bpo: 25630 +.. date: 8410 +.. nonce: ZxzcoY +.. release date: 2015-11-22 +.. section: Core and Builtins + +Fix a possible segfault during argument parsing in functions that accept +filesystem paths. + +.. + +.. bpo: 23564 +.. date: 8409 +.. nonce: XHarGG +.. section: Core and Builtins + +Fixed a partially broken sanity check in the _posixsubprocess internals +regarding how fds_to_pass were passed to the child. The bug had no actual +impact as subprocess.py already avoided it. + +.. + +.. bpo: 25388 +.. date: 8408 +.. nonce: zm3uuQ +.. section: Core and Builtins + +Fixed tokenizer crash when processing undecodable source code with a null +byte. + +.. + +.. bpo: 25462 +.. date: 8407 +.. nonce: eXDzgO +.. section: Core and Builtins + +The hash of the key now is calculated only once in most operations in C +implementation of OrderedDict. + +.. + +.. bpo: 22995 +.. date: 8406 +.. nonce: 90kpuP +.. section: Core and Builtins + +Default implementation of __reduce__ and __reduce_ex__ now rejects builtin +types with not defined __new__. + +.. + +.. bpo: 25555 +.. date: 8405 +.. nonce: MUpG-j +.. section: Core and Builtins + +Fix parser and AST: fill lineno and col_offset of "arg" node when compiling +AST from Python objects. + +.. + +.. bpo: 24802 +.. date: 8404 +.. nonce: Qie066 +.. section: Core and Builtins + +Avoid buffer overreads when int(), float(), compile(), exec() and eval() are +passed bytes-like objects. These objects are not necessarily terminated by +a null byte, but the functions assumed they were. + +.. + +.. bpo: 24726 +.. date: 8403 +.. nonce: AHk4v2 +.. section: Core and Builtins + +Fixed a crash and leaking NULL in repr() of OrderedDict that was mutated by +direct calls of dict methods. + +.. + +.. bpo: 25449 +.. date: 8402 +.. nonce: VqTOFi +.. section: Core and Builtins + +Iterating OrderedDict with keys with unstable hash now raises KeyError in C +implementations as well as in Python implementation. + +.. + +.. bpo: 25395 +.. date: 8401 +.. nonce: htkE3W +.. section: Core and Builtins + +Fixed crash when highly nested OrderedDict structures were garbage +collected. + +.. + +.. bpo: 25274 +.. date: 8400 +.. nonce: QCGvAF +.. section: Core and Builtins + +sys.setrecursionlimit() now raises a RecursionError if the new recursion +limit is too low depending at the current recursion depth. Modify also the +"lower-water mark" formula to make it monotonic. This mark is used to decide +when the overflowed flag of the thread state is reset. + +.. + +.. bpo: 24402 +.. date: 8399 +.. nonce: MAgi3X +.. section: Core and Builtins + +Fix input() to prompt to the redirected stdout when sys.stdout.fileno() +fails. + +.. + +.. bpo: 24806 +.. date: 8398 +.. nonce: Nb0znT +.. section: Core and Builtins + +Prevent builtin types that are not allowed to be subclassed from being +subclassed through multiple inheritance. + +.. + +.. bpo: 24848 +.. date: 8397 +.. nonce: HlUSuy +.. section: Core and Builtins + +Fixed a number of bugs in UTF-7 decoding of misformed data. + +.. + +.. bpo: 25280 +.. date: 8396 +.. nonce: ivTMwd +.. section: Core and Builtins + +Import trace messages emitted in verbose (-v) mode are no longer formatted +twice. + +.. + +.. bpo: 25003 +.. date: 8395 +.. nonce: _ban92 +.. section: Core and Builtins + +On Solaris 11.3 or newer, os.urandom() now uses the getrandom() function +instead of the getentropy() function. The getentropy() function is blocking +to generate very good quality entropy, os.urandom() doesn't need such high- +quality entropy. + +.. + +.. bpo: 25182 +.. date: 8394 +.. nonce: gBDq-T +.. section: Core and Builtins + +The stdprinter (used as sys.stderr before the io module is imported at +startup) now uses the backslashreplace error handler. + +.. + +.. bpo: 25131 +.. date: 8393 +.. nonce: j5hH6a +.. section: Core and Builtins + +Make the line number and column offset of set/dict literals and +comprehensions correspond to the opening brace. + +.. + +.. bpo: 25150 +.. date: 8392 +.. nonce: 0Gh-Ty +.. section: Core and Builtins + +Hide the private _Py_atomic_xxx symbols from the public Python.h header to +fix a compilation error with OpenMP. PyThreadState_GET() becomes an alias to +PyThreadState_Get() to avoid ABI incompatibilies. + +.. + +.. bpo: 25626 +.. date: 8391 +.. nonce: TQ3fvb +.. section: Library + +Change three zlib functions to accept sizes that fit in Py_ssize_t, but +internally cap those sizes to UINT_MAX. This resolves a regression in 3.5 +where GzipFile.read() failed to read chunks larger than 2 or 4 GiB. The +change affects the zlib.Decompress.decompress() max_length parameter, the +zlib.decompress() bufsize parameter, and the zlib.Decompress.flush() length +parameter. + +.. + +.. bpo: 25583 +.. date: 8390 +.. nonce: Gk-cim +.. section: Library + +Avoid incorrect errors raised by os.makedirs(exist_ok=True) when the OS +gives priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 25593 +.. date: 8389 +.. nonce: 56uegI +.. section: Library + +Change semantics of EventLoop.stop() in asyncio. + +.. + +.. bpo: 6973 +.. date: 8388 +.. nonce: nl5cHt +.. section: Library + +When we know a subprocess.Popen process has died, do not allow the +send_signal(), terminate(), or kill() methods to do anything as they could +potentially signal a different process. + +.. + +.. bpo: 25590 +.. date: 8387 +.. nonce: aCt-yW +.. section: Library + +In the Readline completer, only call getattr() once per attribute. + +.. + +.. bpo: 25498 +.. date: 8386 +.. nonce: AvqEBl +.. section: Library + +Fix a crash when garbage-collecting ctypes objects created by wrapping a +memoryview. This was a regression made in 3.5a1. Based on patch by +Eryksun. + +.. + +.. bpo: 25584 +.. date: 8385 +.. nonce: 124mYw +.. section: Library + +Added "escape" to the __all__ list in the glob module. + +.. + +.. bpo: 25584 +.. date: 8384 +.. nonce: ZeWX0J +.. section: Library + +Fixed recursive glob() with patterns starting with ``**``. + +.. + +.. bpo: 25446 +.. date: 8383 +.. nonce: k1DByx +.. section: Library + +Fix regression in smtplib's AUTH LOGIN support. + +.. + +.. bpo: 18010 +.. date: 8382 +.. nonce: Azyf1C +.. section: Library + +Fix the pydoc web server's module search function to handle exceptions from +importing packages. + +.. + +.. bpo: 25554 +.. date: 8381 +.. nonce: UM9MlR +.. section: Library + +Got rid of circular references in regular expression parsing. + +.. + +.. bpo: 25510 +.. date: 8380 +.. nonce: 79g7LA +.. section: Library + +fileinput.FileInput.readline() now returns b'' instead of '' at the end if +the FileInput was opened with binary mode. Patch by Ryosuke Ito. + +.. + +.. bpo: 25503 +.. date: 8379 +.. nonce: Zea0Y7 +.. section: Library + +Fixed inspect.getdoc() for inherited docstrings of properties. Original +patch by John Mark Vandenberg. + +.. + +.. bpo: 25515 +.. date: 8378 +.. nonce: fQsyYG +.. section: Library + +Always use os.urandom as a source of randomness in uuid.uuid4. + +.. + +.. bpo: 21827 +.. date: 8377 +.. nonce: k2oreR +.. section: Library + +Fixed textwrap.dedent() for the case when largest common whitespace is a +substring of smallest leading whitespace. Based on patch by Robert Li. + +.. + +.. bpo: 25447 +.. date: 8376 +.. nonce: eDYc4t +.. section: Library + +The lru_cache() wrapper objects now can be copied and pickled (by returning +the original object unchanged). + +.. + +.. bpo: 25390 +.. date: 8375 +.. nonce: 6mSgRq +.. section: Library + +typing: Don't crash on Union[str, Pattern]. + +.. + +.. bpo: 25441 +.. date: 8374 +.. nonce: d7zph6 +.. section: Library + +asyncio: Raise error from drain() when socket is closed. + +.. + +.. bpo: 25410 +.. date: 8373 +.. nonce: QAs_3B +.. section: Library + +Cleaned up and fixed minor bugs in C implementation of OrderedDict. + +.. + +.. bpo: 25411 +.. date: 8372 +.. nonce: qsJTCb +.. section: Library + +Improved Unicode support in SMTPHandler through better use of the email +package. Thanks to user simon04 for the patch. + +.. + +.. bpo: 25407 +.. date: 8371 +.. nonce: ukNt1D +.. section: Library + +Remove mentions of the formatter module being removed in Python 3.6. + +.. + +.. bpo: 25406 +.. date: 8370 +.. nonce: 5MZKU_ +.. section: Library + +Fixed a bug in C implementation of OrderedDict.move_to_end() that caused +segmentation fault or hang in iterating after moving several items to the +start of ordered dict. + +.. + +.. bpo: 25364 +.. date: 8369 +.. nonce: u_1Wi6 +.. section: Library + +zipfile now works in threads disabled builds. + +.. + +.. bpo: 25328 +.. date: 8368 +.. nonce: Rja1Xg +.. section: Library + +smtpd's SMTPChannel now correctly raises a ValueError if both decode_data +and enable_SMTPUTF8 are set to true. + +.. + +.. bpo: 25316 +.. date: 8367 +.. nonce: dHQHWI +.. section: Library + +distutils raises OSError instead of DistutilsPlatformError when MSVC is not +installed. + +.. + +.. bpo: 25380 +.. date: 8366 +.. nonce: sKZ6-I +.. section: Library + +Fixed protocol for the STACK_GLOBAL opcode in pickletools.opcodes. + +.. + +.. bpo: 23972 +.. date: 8365 +.. nonce: s2g30g +.. section: Library + +Updates asyncio datagram create method allowing reuseport and reuseaddr +socket options to be set prior to binding the socket. Mirroring the existing +asyncio create_server method the reuseaddr option for datagram sockets +defaults to True if the O/S is 'posix' (except if the platform is Cygwin). +Patch by Chris Laws. + +.. + +.. bpo: 25304 +.. date: 8364 +.. nonce: CsmLyI +.. section: Library + +Add asyncio.run_coroutine_threadsafe(). This lets you submit a coroutine to +a loop from another thread, returning a concurrent.futures.Future. By +Vincent Michel. + +.. + +.. bpo: 25232 +.. date: 8363 +.. nonce: KhKjCE +.. section: Library + +Fix CGIRequestHandler to split the query from the URL at the first question +mark (?) rather than the last. Patch from Xiang Zhang. + +.. + +.. bpo: 24657 +.. date: 8362 +.. nonce: h2Ag7y +.. section: Library + +Prevent CGIRequestHandler from collapsing slashes in the query part of the +URL as if it were a path. Patch from Xiang Zhang. + +.. + +.. bpo: 24483 +.. date: 8361 +.. nonce: WPLGSJ +.. section: Library + +C implementation of functools.lru_cache() now calculates key's hash only +once. + +.. + +.. bpo: 22958 +.. date: 8360 +.. nonce: Ebu7Gl +.. section: Library + +Constructor and update method of weakref.WeakValueDictionary now accept the +self and the dict keyword arguments. + +.. + +.. bpo: 22609 +.. date: 8359 +.. nonce: fV7hdV +.. section: Library + +Constructor of collections.UserDict now accepts the self keyword argument. + +.. + +.. bpo: 25111 +.. date: 8358 +.. nonce: azL4qE +.. section: Library + +Fixed comparison of traceback.FrameSummary. + +.. + +.. bpo: 25262 +.. date: 8357 +.. nonce: pQS5cB +.. section: Library + +Added support for BINBYTES8 opcode in Python implementation of unpickler. +Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 opcodes no +longer silently ignored on 32-bit platforms in C implementation. + +.. + +.. bpo: 25034 +.. date: 8356 +.. nonce: eGvOIb +.. section: Library + +Fix string.Formatter problem with auto-numbering and nested format_specs. +Patch by Anthon van der Neut. + +.. + +.. bpo: 25233 +.. date: 8355 +.. nonce: EdZV9x +.. section: Library + +Rewrite the guts of asyncio.Queue and asyncio.Semaphore to be more +understandable and correct. + +.. + +.. bpo: 25203 +.. date: 8354 +.. nonce: IgDEbt +.. section: Library + +Failed readline.set_completer_delims() no longer left the module in +inconsistent state. + +.. + +.. bpo: 23600 +.. date: 8353 +.. nonce: 7J_RD5 +.. section: Library + +Default implementation of tzinfo.fromutc() was returning wrong results in +some cases. + +.. + +.. bpo: 23329 +.. date: 8352 +.. nonce: yccJBE +.. section: Library + +Allow the ssl module to be built with older versions of LibreSSL. + +.. + +.. bpo: 0 +.. date: 8351 +.. nonce: ww9QSm +.. section: Library + +Prevent overflow in _Unpickler_Read. + +.. + +.. bpo: 25047 +.. date: 8350 +.. nonce: kc8tqx +.. section: Library + +The XML encoding declaration written by Element Tree now respects the letter +case given by the user. This restores the ability to write encoding names in +uppercase like "UTF-8", which worked in Python 2. + +.. + +.. bpo: 25135 +.. date: 8349 +.. nonce: gVHNy- +.. section: Library + +Make deque_clear() safer by emptying the deque before clearing. This helps +avoid possible reentrancy issues. + +.. + +.. bpo: 19143 +.. date: 8348 +.. nonce: 76SBSO +.. section: Library + +platform module now reads Windows version from kernel32.dll to avoid +compatibility shims. + +.. + +.. bpo: 25092 +.. date: 8347 +.. nonce: fQ37Ac +.. section: Library + +Fix datetime.strftime() failure when errno was already set to EINVAL. + +.. + +.. bpo: 23517 +.. date: 8346 +.. nonce: 3ABmf1 +.. section: Library + +Fix rounding in fromtimestamp() and utcfromtimestamp() methods of +datetime.datetime: microseconds are now rounded to nearest with ties going +to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards +minus infinity (ROUND_FLOOR). It's important that these methods use the same +rounding mode than datetime.timedelta to keep the property: +(datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t). +It also the rounding mode used by round(float) for example. + +.. + +.. bpo: 25155 +.. date: 8345 +.. nonce: JiETzD +.. section: Library + +Fix datetime.datetime.now() and datetime.datetime.utcnow() on Windows to +support date after year 2038. It was a regression introduced in Python +3.5.0. + +.. + +.. bpo: 25108 +.. date: 8344 +.. nonce: zGPbgA +.. section: Library + +Omitted internal frames in traceback functions print_stack(), +format_stack(), and extract_stack() called without arguments. + +.. + +.. bpo: 25118 +.. date: 8343 +.. nonce: wGm1u6 +.. section: Library + +Fix a regression of Python 3.5.0 in os.waitpid() on Windows. + +.. + +.. bpo: 24684 +.. date: 8342 +.. nonce: t4T77O +.. section: Library + +socket.socket.getaddrinfo() now calls PyUnicode_AsEncodedString() instead of +calling the encode() method of the host, to handle correctly custom string +with an encode() method which doesn't return a byte string. The encoder of +the IDNA codec is now called directly instead of calling the encode() method +of the string. + +.. + +.. bpo: 25060 +.. date: 8341 +.. nonce: zLdvIk +.. section: Library + +Correctly compute stack usage of the BUILD_MAP opcode. + +.. + +.. bpo: 24857 +.. date: 8340 +.. nonce: PpJWZ9 +.. section: Library + +Comparing call_args to a long sequence now correctly returns a boolean +result instead of raising an exception. Patch by A Kaptur. + +.. + +.. bpo: 23144 +.. date: 8339 +.. nonce: cLf67X +.. section: Library + +Make sure that HTMLParser.feed() returns all the data, even when +convert_charrefs is True. + +.. + +.. bpo: 24982 +.. date: 8338 +.. nonce: sGMMAR +.. section: Library + +shutil.make_archive() with the "zip" format now adds entries for directories +(including empty directories) in ZIP file. + +.. + +.. bpo: 25019 +.. date: 8337 +.. nonce: JQJlOZ +.. section: Library + +Fixed a crash caused by setting non-string key of expat parser. Based on +patch by John Leitch. + +.. + +.. bpo: 16180 +.. date: 8336 +.. nonce: 6IUcNS +.. section: Library + +Exit pdb if file has syntax error, instead of trapping user in an infinite +loop. Patch by Xavier de Gaye. + +.. + +.. bpo: 24891 +.. date: 8335 +.. nonce: ddVmHS +.. section: Library + +Fix a race condition at Python startup if the file descriptor of stdin (0), +stdout (1) or stderr (2) is closed while Python is creating sys.stdin, +sys.stdout and sys.stderr objects. These attributes are now set to None if +the creation of the object failed, instead of raising an OSError exception. +Initial patch written by Marco Paolini. + +.. + +.. bpo: 24992 +.. date: 8334 +.. nonce: 5sqF74 +.. section: Library + +Fix error handling and a race condition (related to garbage collection) in +collections.OrderedDict constructor. + +.. + +.. bpo: 24881 +.. date: 8333 +.. nonce: ZoVZXu +.. section: Library + +Fixed setting binary mode in Python implementation of FileIO on Windows and +Cygwin. Patch from Akira Li. + +.. + +.. bpo: 25578 +.. date: 8332 +.. nonce: G6S-ft +.. section: Library + +Fix (another) memory leak in SSLSocket.getpeercer(). + +.. + +.. bpo: 25530 +.. date: 8331 +.. nonce: hDFkwu +.. section: Library + +Disable the vulnerable SSLv3 protocol by default when creating +ssl.SSLContext. + +.. + +.. bpo: 25569 +.. date: 8330 +.. nonce: CfvQjK +.. section: Library + +Fix memory leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 25471 +.. date: 8329 +.. nonce: T0A02M +.. section: Library + +Sockets returned from accept() shouldn't appear to be nonblocking. + +.. + +.. bpo: 25319 +.. date: 8328 +.. nonce: iyuglv +.. section: Library + +When threading.Event is reinitialized, the underlying condition should use a +regular lock rather than a recursive lock. + +.. + +.. bpo: 21112 +.. date: 8327 +.. nonce: vSFU1r +.. section: Library + +Fix regression in unittest.expectedFailure on subclasses. Patch from Berker +Peksag. + +.. + +.. bpo: 24764 +.. date: 8326 +.. nonce: QwFZ2S +.. section: Library + +cgi.FieldStorage.read_multi() now ignores the Content-Length header in part +headers. Patch written by Peter Landry and reviewed by Pierre Quentel. + +.. + +.. bpo: 24913 +.. date: 8325 +.. nonce: p2ZAJ4 +.. section: Library + +Fix overrun error in deque.index(). Found by John Leitch and Bryce Darling. + +.. + +.. bpo: 24774 +.. date: 8324 +.. nonce: xLbskG +.. section: Library + +Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. + +.. + +.. bpo: 21159 +.. date: 8323 +.. nonce: ochL5W +.. section: Library + +Improve message in configparser.InterpolationMissingOptionError. Patch from +?ukasz Langa. + +.. + +.. bpo: 20362 +.. date: 8322 +.. nonce: 5aP_Ri +.. section: Library + +Honour TestCase.longMessage correctly in assertRegex. Patch from Ilia +Kurenkov. + +.. + +.. bpo: 23572 +.. date: 8321 +.. nonce: QhQ9RD +.. section: Library + +Fixed functools.singledispatch on classes with falsy metaclasses. Patch by +Ethan Furman. + +.. + +.. bpo: 0 +.. date: 8320 +.. nonce: DO1sFa +.. section: Library + +asyncio: ensure_future() now accepts awaitable objects. + +.. + +.. bpo: 15348 +.. date: 8319 +.. nonce: d1Fg01 +.. section: IDLE + +Stop the debugger engine (normally in a user process) before closing the +debugger window (running in the IDLE process). This prevents the +RuntimeErrors that were being caught and ignored. + +.. + +.. bpo: 24455 +.. date: 8318 +.. nonce: x6YqtE +.. section: IDLE + +Prevent IDLE from hanging when a) closing the shell while the debugger is +active (15347); b) closing the debugger with the [X] button (15348); and c) +activating the debugger when already active (24455). The patch by Mark +Roseman does this by making two changes. 1. Suspend and resume the +gui.interaction method with the tcl vwait mechanism intended for this +purpose (instead of root.mainloop & .quit). 2. In gui.run, allow any +existing interaction to terminate first. + +.. + +.. bpo: 0 +.. date: 8317 +.. nonce: Yp9LRY +.. section: IDLE + +Change 'The program' to 'Your program' in an IDLE 'kill program?' message to +make it clearer that the program referred to is the currently running user +program, not IDLE itself. + +.. + +.. bpo: 24750 +.. date: 8316 +.. nonce: xgsi-K +.. section: IDLE + +Improve the appearance of the IDLE editor window status bar. Patch by Mark +Roseman. + +.. + +.. bpo: 25313 +.. date: 8315 +.. nonce: xMXHpO +.. section: IDLE + +Change the handling of new built-in text color themes to better address the +compatibility problem introduced by the addition of IDLE Dark. Consistently +use the revised idleConf.CurrentTheme everywhere in idlelib. + +.. + +.. bpo: 24782 +.. date: 8314 +.. nonce: RgIPYE +.. section: IDLE + +Extension configuration is now a tab in the IDLE Preferences dialog rather +than a separate dialog. The former tabs are now a sorted list. Patch by +Mark Roseman. + +.. + +.. bpo: 22726 +.. date: 8313 +.. nonce: x8T0dA +.. section: IDLE + +Re-activate the config dialog help button with some content about the other +buttons and the new IDLE Dark theme. + +.. + +.. bpo: 24820 +.. date: 8312 +.. nonce: TFPJhr +.. section: IDLE + +IDLE now has an 'IDLE Dark' built-in text color theme. It is more or less +IDLE Classic inverted, with a cobalt blue background. Strings, comments, +keywords, ... are still green, red, orange, ... . To use it with IDLEs +released before November 2015, hit the 'Save as New Custom Theme' button and +enter a new name, such as 'Custom Dark'. The custom theme will work with +any IDLE release, and can be modified. + +.. + +.. bpo: 25224 +.. date: 8311 +.. nonce: 5Llwo4 +.. section: IDLE + +README.txt is now an idlelib index for IDLE developers and curious users. +The previous user content is now in the IDLE doc chapter. 'IDLE' now means +'Integrated Development and Learning Environment'. + +.. + +.. bpo: 24820 +.. date: 8310 +.. nonce: ZUz9Fn +.. section: IDLE + +Users can now set breakpoint colors in Settings -> Custom Highlighting. +Original patch by Mark Roseman. + +.. + +.. bpo: 24972 +.. date: 8309 +.. nonce: uc0uNo +.. section: IDLE + +Inactive selection background now matches active selection background, as +configured by users, on all systems. Found items are now always highlighted +on Windows. Initial patch by Mark Roseman. + +.. + +.. bpo: 24570 +.. date: 8308 +.. nonce: s3EkNn +.. section: IDLE + +Idle: make calltip and completion boxes appear on Macs affected by a tk +regression. Initial patch by Mark Roseman. + +.. + +.. bpo: 24988 +.. date: 8307 +.. nonce: tXqq4T +.. section: IDLE + +Idle ScrolledList context menus (used in debugger) now work on Mac Aqua. +Patch by Mark Roseman. + +.. + +.. bpo: 24801 +.. date: 8306 +.. nonce: -bj_Ou +.. section: IDLE + +Make right-click for context menu work on Mac Aqua. Patch by Mark Roseman. + +.. + +.. bpo: 25173 +.. date: 8305 +.. nonce: EZzrPg +.. section: IDLE + +Associate tkinter messageboxes with a specific widget. For Mac OSX, make +them a 'sheet'. Patch by Mark Roseman. + +.. + +.. bpo: 25198 +.. date: 8304 +.. nonce: -j_BV7 +.. section: IDLE + +Enhance the initial html viewer now used for Idle Help. * Properly indent +fixed-pitch text (patch by Mark Roseman). * Give code snippet a very Sphinx- +like light blueish-gray background. * Re-use initial width and height set by +users for shell and editor. * When the Table of Contents (TOC) menu is used, +put the section header at the top of the screen. + +.. + +.. bpo: 25225 +.. date: 8303 +.. nonce: 9pvdq6 +.. section: IDLE + +Condense and rewrite Idle doc section on text colors. + +.. + +.. bpo: 21995 +.. date: 8302 +.. nonce: C5Rmzx +.. section: IDLE + +Explain some differences between IDLE and console Python. + +.. + +.. bpo: 22820 +.. date: 8301 +.. nonce: hix_8X +.. section: IDLE + +Explain need for *print* when running file from Idle editor. + +.. + +.. bpo: 25224 +.. date: 8300 +.. nonce: UVMYQq +.. section: IDLE + +Doc: augment Idle feature list and no-subprocess section. + +.. + +.. bpo: 25219 +.. date: 8299 +.. nonce: 8_9DYg +.. section: IDLE + +Update doc for Idle command line options. Some were missing and notes were +not correct. + +.. + +.. bpo: 24861 +.. date: 8298 +.. nonce: Ecg2yT +.. section: IDLE + +Most of idlelib is private and subject to change. Use idleib.idle.* to start +Idle. See idlelib.__init__.__doc__. + +.. + +.. bpo: 25199 +.. date: 8297 +.. nonce: ih7yY3 +.. section: IDLE + +Idle: add synchronization comments for future maintainers. + +.. + +.. bpo: 16893 +.. date: 8296 +.. nonce: bZtPgJ +.. section: IDLE + +Replace help.txt with help.html for Idle doc display. The new +idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks +better than help.txt and will better document Idle as released. The tkinter +html viewer that works for this file was written by Mark Roseman. The now +unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +.. + +.. bpo: 24199 +.. date: 8295 +.. nonce: VKnZEv +.. section: IDLE + +Deprecate unused idlelib.idlever with possible removal in 3.6. + +.. + +.. bpo: 24790 +.. date: 8294 +.. nonce: hD1hlj +.. section: IDLE + +Remove extraneous code (which also create 2 & 3 conflicts). + +.. + +.. bpo: 22558 +.. date: 8293 +.. nonce: Pk02YC +.. section: Documentation + +Add remaining doc links to source code for Python-coded modules. Patch by +Yoni Lavi. + +.. + +.. bpo: 12067 +.. date: 8292 +.. nonce: nLD2M- +.. section: Documentation + +Rewrite Comparisons section in the Expressions chapter of the language +reference. Some of the details of comparing mixed types were incorrect or +ambiguous. NotImplemented is only relevant at a lower level than the +Expressions chapter. Added details of comparing range() objects, and default +behaviour and consistency suggestions for user-defined classes. Patch from +Andy Maier. + +.. + +.. bpo: 24952 +.. date: 8291 +.. nonce: RHhFPE +.. section: Documentation + +Clarify the default size argument of stack_size() in the "threading" and +"_thread" modules. Patch from Mattip. + +.. + +.. bpo: 23725 +.. date: 8290 +.. nonce: 49TZ5f +.. section: Documentation + +Overhaul tempfile docs. Note deprecated status of mktemp. Patch from +Zbigniew J?drzejewski-Szmek. + +.. + +.. bpo: 24808 +.. date: 8289 +.. nonce: MGjc3F +.. section: Documentation + +Update the types of some PyTypeObject fields. Patch by Joseph Weston. + +.. + +.. bpo: 22812 +.. date: 8288 +.. nonce: kLCF0G +.. section: Documentation + +Fix unittest discovery examples. Patch from Pam McA'Nulty. + +.. + +.. bpo: 25449 +.. date: 8287 +.. nonce: MP6KNs +.. section: Tests + +Added tests for OrderedDict subclasses. + +.. + +.. bpo: 25099 +.. date: 8286 +.. nonce: tJQOWx +.. section: Tests + +Make test_compileall not fail when an entry on sys.path cannot be written to +(commonly seen in administrative installs on Windows). + +.. + +.. bpo: 23919 +.. date: 8285 +.. nonce: vJnjaq +.. section: Tests + +Prevents assert dialogs appearing in the test suite. + +.. + +.. bpo: 0 +.. date: 8284 +.. nonce: X-Bk5l +.. section: Tests + +``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass +along to regrtest.py. Previously there was a limit of 9. + +.. + +.. bpo: 24915 +.. date: 8283 +.. nonce: PgD3Cx +.. section: Build + +Add LLVM support for PGO builds and use the test suite to generate the +profile data. Initial patch by Alecsandru Patrascu of Intel. + +.. + +.. bpo: 24910 +.. date: 8282 +.. nonce: ZZdfl0 +.. section: Build + +Windows MSIs now have unique display names. + +.. + +.. bpo: 24986 +.. date: 8281 +.. nonce: 1WyXeU +.. section: Build + +It is now possible to build Python on Windows without errors when external +libraries are not available. + +.. + +.. bpo: 25450 +.. date: 8280 +.. nonce: X4xlWf +.. section: Windows + +Updates shortcuts to start Python in installation directory. + +.. + +.. bpo: 25164 +.. date: 8279 +.. nonce: FHVOOA +.. section: Windows + +Changes default all-users install directory to match per-user directory. + +.. + +.. bpo: 25143 +.. date: 8278 +.. nonce: hmxsia +.. section: Windows + +Improves installer error messages for unsupported platforms. + +.. + +.. bpo: 25163 +.. date: 8277 +.. nonce: uCRe8H +.. section: Windows + +Display correct directory in installer when using non-default settings. + +.. + +.. bpo: 25361 +.. date: 8276 +.. nonce: GETaSY +.. section: Windows + +Disables use of SSE2 instructions in Windows 32-bit build + +.. + +.. bpo: 25089 +.. date: 8275 +.. nonce: n_YJgw +.. section: Windows + +Adds logging to installer for case where launcher is not selected on +upgrade. + +.. + +.. bpo: 25165 +.. date: 8274 +.. nonce: aUTN1e +.. section: Windows + +Windows uninstallation should not remove launcher if other versions remain + +.. + +.. bpo: 25112 +.. date: 8273 +.. nonce: frdKij +.. section: Windows + +py.exe launcher is missing icons + +.. + +.. bpo: 25102 +.. date: 8272 +.. nonce: 6y6Akl +.. section: Windows + +Windows installer does not precompile for -O or -OO. + +.. + +.. bpo: 25081 +.. date: 8271 +.. nonce: dcRCTO +.. section: Windows + +Makes Back button in installer go back to upgrade page when upgrading. + +.. + +.. bpo: 25091 +.. date: 8270 +.. nonce: 1u-VKy +.. section: Windows + +Increases font size of the installer. + +.. + +.. bpo: 25126 +.. date: 8269 +.. nonce: ANx3DW +.. section: Windows + +Clarifies that the non-web installer will download some components. + +.. + +.. bpo: 25213 +.. date: 8268 +.. nonce: KGmXoe +.. section: Windows + +Restores requestedExecutionLevel to manifest to disable UAC virtualization. + +.. + +.. bpo: 25022 +.. date: 8267 +.. nonce: vAt_zr +.. section: Windows + +Removed very outdated PC/example_nt/ directory. + +.. + +.. bpo: 25440 +.. date: 8266 +.. nonce: 5xhyGr +.. section: Tools/Demos + +Fix output of python-config --extension-suffix. diff --git a/Misc/NEWS.d/3.5.2.rst b/Misc/NEWS.d/3.5.2.rst new file mode 100644 index 00000000000..f08657cd13d --- /dev/null +++ b/Misc/NEWS.d/3.5.2.rst @@ -0,0 +1,25 @@ +.. bpo: 26930 +.. date: 8636 +.. nonce: 9JUeSD +.. release date: 2016-06-26 +.. section: Core and Builtins + +Update Windows builds to use OpenSSL 1.0.2h. + +.. + +.. bpo: 26867 +.. date: 8635 +.. nonce: QPSyP5 +.. section: Tests + +Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. + +.. + +.. bpo: 27365 +.. date: 8634 +.. nonce: ipkJ_M +.. section: IDLE + +Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. diff --git a/Misc/NEWS.d/3.5.2rc1.rst b/Misc/NEWS.d/3.5.2rc1.rst new file mode 100644 index 00000000000..2cd4580d588 --- /dev/null +++ b/Misc/NEWS.d/3.5.2rc1.rst @@ -0,0 +1,2204 @@ +.. bpo: 27066 +.. date: 8633 +.. nonce: SNExZi +.. release date: 2016-06-12 +.. section: Core and Builtins + +Fixed SystemError if a custom opener (for open()) returns a negative number +without setting an exception. + +.. + +.. bpo: 20041 +.. date: 8632 +.. nonce: TypyGp +.. section: Core and Builtins + +Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. + +.. + +.. bpo: 26168 +.. date: 8631 +.. nonce: -nPBL6 +.. section: Core and Builtins + +Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. + +.. + +.. bpo: 26991 +.. date: 8630 +.. nonce: yWGNhz +.. section: Core and Builtins + +Fix possible refleak when creating a function with annotations. + +.. + +.. bpo: 27039 +.. date: 8629 +.. nonce: Zj7tV7 +.. section: Core and Builtins + +Fixed bytearray.remove() for values greater than 127. Patch by Joe Jevnik. + +.. + +.. bpo: 23640 +.. date: 8628 +.. nonce: kvNC4c +.. section: Core and Builtins + +int.from_bytes() no longer bypasses constructors for subclasses. + +.. + +.. bpo: 26811 +.. date: 8627 +.. nonce: oNzUWt +.. section: Core and Builtins + +gc.get_objects() no longer contains a broken tuple with NULL pointer. + +.. + +.. bpo: 20120 +.. date: 8626 +.. nonce: c-FZZc +.. section: Core and Builtins + +Use RawConfigParser for .pypirc parsing, removing support for interpolation +unintentionally added with move to Python 3. Behavior no longer does any +interpolation in .pypirc files, matching behavior in Python 2.7 and +Setuptools 19.0. + +.. + +.. bpo: 26659 +.. date: 8625 +.. nonce: 5PRa83 +.. section: Core and Builtins + +Make the builtin slice type support cycle collection. + +.. + +.. bpo: 26718 +.. date: 8624 +.. nonce: K5PQ8j +.. section: Core and Builtins + +super.__init__ no longer leaks memory if called multiple times. NOTE: A +direct call of super.__init__ is not endorsed! + +.. + +.. bpo: 25339 +.. date: 8623 +.. nonce: ZcaC2E +.. section: Core and Builtins + +PYTHONIOENCODING now has priority over locale in setting the error handler +for stdin and stdout. + +.. + +.. bpo: 26494 +.. date: 8622 +.. nonce: G6eXIi +.. section: Core and Builtins + +Fixed crash on iterating exhausting iterators. Affected classes are generic +sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, +frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator. + +.. + +.. bpo: 26581 +.. date: 8621 +.. nonce: yNA7nm +.. section: Core and Builtins + +If coding cookie is specified multiple times on a line in Python source code +file, only the first one is taken to account. + +.. + +.. bpo: 26464 +.. date: 8620 +.. nonce: 7BreGz +.. section: Core and Builtins + +Fix str.translate() when string is ASCII and first replacements removes +character, but next replacement uses a non-ASCII character or a string +longer than 1 character. Regression introduced in Python 3.5.0. + +.. + +.. bpo: 22836 +.. date: 8619 +.. nonce: cimt1y +.. section: Core and Builtins + +Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() +are sensible even when formatting them produces secondary errors. This +affects the reports produced by sys.__excepthook__() and when __del__() +raises an exception. + +.. + +.. bpo: 26302 +.. date: 8618 +.. nonce: UD9XQt +.. section: Core and Builtins + +Correct behavior to reject comma as a legal character for cookie names. + +.. + +.. bpo: 4806 +.. date: 8617 +.. nonce: i9m3hj +.. section: Core and Builtins + +Avoid masking the original TypeError exception when using star (``*``) +unpacking in function calls. Based on patch by Hagen F?rstenau and Daniel +Urban. + +.. + +.. bpo: 27138 +.. date: 8616 +.. nonce: ifYEro +.. section: Core and Builtins + +Fix the doc comment for FileFinder.find_spec(). + +.. + +.. bpo: 26154 +.. date: 8615 +.. nonce: MtnRAH +.. section: Core and Builtins + +Add a new private _PyThreadState_UncheckedGet() function to get the current +Python thread state, but don't issue a fatal error if it is NULL. This new +function must be used instead of accessing directly the +_PyThreadState_Current variable. The variable is no more exposed since +Python 3.5.1 to hide the exact implementation of atomic C types, to avoid +compiler issues. + +.. + +.. bpo: 26194 +.. date: 8614 +.. nonce: j9zand +.. section: Core and Builtins + +Deque.insert() gave odd results for bounded deques that had reached their +maximum size. Now an IndexError will be raised when attempting to insert +into a full deque. + +.. + +.. bpo: 25843 +.. date: 8613 +.. nonce: t2kGug +.. section: Core and Builtins + +When compiling code, don't merge constants if they are equal but have a +different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now +correctly compiled to two different functions: ``f1()`` returns ``1`` +(``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` +are equal. + +.. + +.. bpo: 22995 +.. date: 8612 +.. nonce: KYNKvs +.. section: Core and Builtins + +[UPDATE] Comment out the one of the pickleability tests in +_PyObject_GetState() due to regressions observed in Cython-based projects. + +.. + +.. bpo: 25961 +.. date: 8611 +.. nonce: Hdjjw0 +.. section: Core and Builtins + +Disallowed null characters in the type name. + +.. + +.. bpo: 25973 +.. date: 8610 +.. nonce: Ud__ZP +.. section: Core and Builtins + +Fix segfault when an invalid nonlocal statement binds a name starting with +two underscores. + +.. + +.. bpo: 22995 +.. date: 8609 +.. nonce: Wq0E86 +.. section: Core and Builtins + +Instances of extension types with a state that aren't subclasses of list or +dict and haven't implemented any pickle-related methods (__reduce__, +__reduce_ex__, __getnewargs__, __getnewargs_ex__, or __getstate__), can no +longer be pickled. Including memoryview. + +.. + +.. bpo: 20440 +.. date: 8608 +.. nonce: GCwOfH +.. section: Core and Builtins + +Massive replacing unsafe attribute setting code with special macro +Py_SETREF. + +.. + +.. bpo: 25766 +.. date: 8607 +.. nonce: jn93Yu +.. section: Core and Builtins + +Special method __bytes__() now works in str subclasses. + +.. + +.. bpo: 25421 +.. date: 8606 +.. nonce: c47YEL +.. section: Core and Builtins + +__sizeof__ methods of builtin types now use dynamic basic size. This allows +sys.getsize() to work correctly with their subclasses with __slots__ +defined. + +.. + +.. bpo: 25709 +.. date: 8605 +.. nonce: WwGm2k +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 27147 +.. date: 8604 +.. nonce: tCCgmH +.. section: Core and Builtins + +Mention PEP 420 in the importlib docs. + +.. + +.. bpo: 24097 +.. date: 8603 +.. nonce: Vt4E-i +.. section: Core and Builtins + +Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. + +.. + +.. bpo: 24731 +.. date: 8602 +.. nonce: h9-hnz +.. section: Core and Builtins + +Fixed crash on converting objects with special methods __bytes__, __trunc__, +and __float__ returning instances of subclasses of bytes, int, and float to +subclasses of bytes, int, and float correspondingly. + +.. + +.. bpo: 26478 +.. date: 8601 +.. nonce: n0dB8e +.. section: Core and Builtins + +Fix semantic bugs when using binary operators with dictionary views and +tuples. + +.. + +.. bpo: 26171 +.. date: 8600 +.. nonce: 8SaQEa +.. section: Core and Builtins + +Fix possible integer overflow and heap corruption in zipimporter.get_data(). + +.. + +.. bpo: 25660 +.. date: 8599 +.. nonce: 93DzBo +.. section: Core and Builtins + +Fix TAB key behaviour in REPL with readline. + +.. + +.. bpo: 25887 +.. date: 8598 +.. nonce: PtVIX7 +.. section: Core and Builtins + +Raise a RuntimeError when a coroutine object is awaited more than once. + +.. + +.. bpo: 27243 +.. date: 8597 +.. nonce: U36M4E +.. section: Core and Builtins + +Update the __aiter__ protocol: instead of returning an awaitable that +resolves to an asynchronous iterator, the asynchronous iterator should be +returned directly. Doing the former will trigger a +PendingDeprecationWarning. + +.. + +.. bpo: 26556 +.. date: 8596 +.. nonce: v5j2uL +.. original section: Library +.. section: Security + +Update expat to 2.1.1, fixes CVE-2015-1283. + +.. + +.. bpo: 0 +.. date: 8595 +.. nonce: E4ochz +.. original section: Library +.. section: Security + +Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. Reported by Team +Oststrom + +.. + +.. bpo: 21386 +.. date: 8594 +.. nonce: DjV72U +.. section: Library + +Implement missing IPv4Address.is_global property. It was documented since +07a5610bae9d. Initial patch by Roger Luethi. + +.. + +.. bpo: 20900 +.. date: 8593 +.. nonce: H5YQPR +.. section: Library + +distutils register command now decodes HTTP responses correctly. Initial +patch by ingrid. + +.. + +.. bpo: 0 +.. date: 8592 +.. nonce: iYIeng +.. section: Library + +A new version of typing.py provides several new classes and features: + at overload outside stubs, Reversible, DefaultDict, Text, ContextManager, +Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of +the new features are not yet implemented in mypy or other static analyzers). +Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been +added (in fact they made it into 3.5.1 but were never mentioned). + +.. + +.. bpo: 25738 +.. date: 8591 +.. nonce: mED9w4 +.. section: Library + +Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message +body for 205 Reset Content. Also, don't send Content header fields in +responses that don't have a body. Patch by Susumu Koshiba. + +.. + +.. bpo: 21313 +.. date: 8590 +.. nonce: W30MBr +.. section: Library + +Fix the "platform" module to tolerate when sys.version contains truncated +build information. + +.. + +.. bpo: 26839 +.. date: 8589 +.. nonce: yVvy7R +.. original section: Library +.. section: Security + +On Linux, :func:`os.urandom` now calls ``getrandom()`` with +``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom +entropy pool is not initialized yet. Patch written by Colm Buckley. + +.. + +.. bpo: 27164 +.. date: 8588 +.. nonce: 6wmjx2 +.. section: Library + +In the zlib module, allow decompressing raw Deflate streams with a +predefined zdict. Based on patch by Xiang Zhang. + +.. + +.. bpo: 24291 +.. date: 8587 +.. nonce: Ac6HvL +.. section: Library + +Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the +client. Previously it could do partial writes and truncate data. Also, +wsgiref.handler.ServerHandler can now handle stdout doing partial writes, +but this is deprecated. + +.. + +.. bpo: 26809 +.. date: 8586 +.. nonce: ya7JMb +.. section: Library + +Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + +.. + +.. bpo: 26373 +.. date: 8585 +.. nonce: P6qz6o +.. section: Library + +subprocess.Popen.communicate now correctly ignores BrokenPipeError when the +child process dies before .communicate() is called in more/all +circumstances. + +.. + +.. bpo: 21776 +.. date: 8584 +.. nonce: 04eQfa +.. section: Library + +distutils.upload now correctly handles HTTPError. Initial patch by Claudiu +Popa. + +.. + +.. bpo: 27114 +.. date: 8583 +.. nonce: bGCuAM +.. section: Library + +Fix SSLContext._load_windows_store_certs fails with PermissionError + +.. + +.. bpo: 18383 +.. date: 8582 +.. nonce: jr-b0l +.. section: Library + +Avoid creating duplicate filters when using filterwarnings and simplefilter. +Based on patch by Alex Shkop. + +.. + +.. bpo: 27057 +.. date: 8581 +.. nonce: YzTA_Q +.. section: Library + +Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails +with EACCESS. The function now falls back to fcntl(). Patch written by +Micha? Bednarski. + +.. + +.. bpo: 27014 +.. date: 8580 +.. nonce: ui7Khn +.. section: Library + +Fix infinite recursion using typing.py. Thanks to Kalle Tuure! + +.. + +.. bpo: 14132 +.. date: 8579 +.. nonce: 5wR9MN +.. section: Library + +Fix urllib.request redirect handling when the target only has a query +string. Original fix by J?n Janech. + +.. + +.. bpo: 17214 +.. date: 8578 +.. nonce: lUbZOV +.. section: Library + +The "urllib.request" module now percent-encodes non-ASCII bytes found in +redirect target URLs. Some servers send Location header fields with non- +ASCII bytes, but "http.client" requires the request target to be ASCII- +encodable, otherwise a UnicodeEncodeError is raised. Based on patch by +Christian Heimes. + +.. + +.. bpo: 26892 +.. date: 8577 +.. nonce: XIXb0h +.. section: Library + +Honor debuglevel flag in urllib.request.HTTPHandler. Patch contributed by +Chi Hsuan Yen. + +.. + +.. bpo: 22274 +.. date: 8576 +.. nonce: 0RHDMN +.. section: Library + +In the subprocess module, allow stderr to be redirected to stdout even when +stdout is not redirected. Patch by Akira Li. + +.. + +.. bpo: 26807 +.. date: 8575 +.. nonce: LXSPP6 +.. section: Library + +mock_open 'files' no longer error on readline at end of file. Patch from +Yolanda Robla. + +.. + +.. bpo: 25745 +.. date: 8574 +.. nonce: -n8acU +.. section: Library + +Fixed leaking a userptr in curses panel destructor. + +.. + +.. bpo: 26977 +.. date: 8573 +.. nonce: 5G4HtL +.. section: Library + +Removed unnecessary, and ignored, call to sum of squares helper in +statistics.pvariance. + +.. + +.. bpo: 26881 +.. date: 8572 +.. nonce: mdiq_L +.. section: Library + +The modulefinder module now supports extended opcode arguments. + +.. + +.. bpo: 23815 +.. date: 8571 +.. nonce: _krNe8 +.. section: Library + +Fixed crashes related to directly created instances of types in _tkinter and +curses.panel modules. + +.. + +.. bpo: 17765 +.. date: 8570 +.. nonce: hiSVS1 +.. section: Library + +weakref.ref() no longer silently ignores keyword arguments. Patch by Georg +Brandl. + +.. + +.. bpo: 26873 +.. date: 8569 +.. nonce: cYXRcH +.. section: Library + +xmlrpc now raises ResponseError on unsupported type tags instead of silently +return incorrect result. + +.. + +.. bpo: 26711 +.. date: 8568 +.. nonce: Eu85Qw +.. section: Library + +Fixed the comparison of plistlib.Data with other types. + +.. + +.. bpo: 24114 +.. date: 8567 +.. nonce: RMRMtM +.. section: Library + +Fix an uninitialized variable in `ctypes.util`. + +The bug only occurs on SunOS when the ctypes implementation searches for the +`crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. + +.. + +.. bpo: 26864 +.. date: 8566 +.. nonce: 1KgGds +.. section: Library + +In urllib.request, change the proxy bypass host checking against no_proxy to +be case-insensitive, and to not match unrelated host names that happen to +have a bypassed hostname as a suffix. Patch by Xiang Zhang. + +.. + +.. bpo: 26634 +.. date: 8565 +.. nonce: FZvsSb +.. section: Library + +recursive_repr() now sets __qualname__ of wrapper. Patch by Xiang Zhang. + +.. + +.. bpo: 26804 +.. date: 8564 +.. nonce: 9Orp-G +.. section: Library + +urllib.request will prefer lower_case proxy environment variables over +UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter Jansen. + +.. + +.. bpo: 26837 +.. date: 8563 +.. nonce: 2FXGsD +.. section: Library + +assertSequenceEqual() now correctly outputs non-stringified differing items +(like bytes in the -b mode). This affects assertListEqual() and +assertTupleEqual(). + +.. + +.. bpo: 26041 +.. date: 8562 +.. nonce: bVem-p +.. section: Library + +Remove "will be removed in Python 3.7" from deprecation messages of +platform.dist() and platform.linux_distribution(). Patch by Kumaripaba +Miyurusara Athukorala. + +.. + +.. bpo: 26822 +.. date: 8561 +.. nonce: rYSL4W +.. section: Library + +itemgetter, attrgetter and methodcaller objects no longer silently ignore +keyword arguments. + +.. + +.. bpo: 26733 +.. date: 8560 +.. nonce: YxaJmL +.. section: Library + +Disassembling a class now disassembles class and static methods. Patch by +Xiang Zhang. + +.. + +.. bpo: 26801 +.. date: 8559 +.. nonce: TQGY-7 +.. section: Library + +Fix error handling in :func:`shutil.get_terminal_size`, catch +:exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel +Barry. + +.. + +.. bpo: 24838 +.. date: 8558 +.. nonce: 3Pfx8T +.. section: Library + +tarfile's ustar and gnu formats now correctly calculate name and link field +limits for multibyte character encodings like utf-8. + +.. + +.. bpo: 26657 +.. date: 8557 +.. nonce: C_-XFg +.. original section: Library +.. section: Security + +Fix directory traversal vulnerability with http.server on Windows. This +fixes a regression that was introduced in 3.3.4rc1 and 3.4.0rc1. Based on +patch by Philipp Hagemeister. + +.. + +.. bpo: 26717 +.. date: 8556 +.. nonce: jngTdu +.. section: Library + +Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by Anthony Sottile. + +.. + +.. bpo: 26735 +.. date: 8555 +.. nonce: riSl3b +.. section: Library + +Fix :func:`os.urandom` on Solaris 11.3 and newer when reading more than +1,024 bytes: call ``getrandom()`` multiple times with a limit of 1024 bytes +per call. + +.. + +.. bpo: 16329 +.. date: 8554 +.. nonce: nuXD8W +.. section: Library + +Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 13952 +.. date: 8553 +.. nonce: SOoTVE +.. section: Library + +Add .csv to mimetypes.types_map. Patch by Geoff Wilson. + +.. + +.. bpo: 26709 +.. date: 8552 +.. nonce: luOPbP +.. section: Library + +Fixed Y2038 problem in loading binary PLists. + +.. + +.. bpo: 23735 +.. date: 8551 +.. nonce: Y5oQ9r +.. section: Library + +Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH +handler. Patch by Eric Price. + +.. + +.. bpo: 26586 +.. date: 8550 +.. nonce: V5pZNa +.. section: Library + +In http.server, respond with "413 Request header fields too large" if there +are too many header fields to parse, rather than killing the connection and +raising an unhandled exception. Patch by Xiang Zhang. + +.. + +.. bpo: 22854 +.. date: 8549 +.. nonce: K3rMEH +.. section: Library + +Change BufferedReader.writable() and BufferedWriter.readable() to always +return False. + +.. + +.. bpo: 25195 +.. date: 8548 +.. nonce: EOc4Po +.. section: Library + +Fix a regression in mock.MagicMock. _Call is a subclass of tuple (changeset +3603bae63c13 only works for classes) so we need to implement __ne__ +ourselves. Patch by Andrew Plummer. + +.. + +.. bpo: 26644 +.. date: 8547 +.. nonce: 7tt1tk +.. section: Library + +Raise ValueError rather than SystemError when a negative length is passed to +SSLSocket.recv() or read(). + +.. + +.. bpo: 23804 +.. date: 8546 +.. nonce: PP63Ff +.. section: Library + +Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to +1024. + +.. + +.. bpo: 26616 +.. date: 8545 +.. nonce: v3QwdD +.. section: Library + +Fixed a bug in datetime.astimezone() method. + +.. + +.. bpo: 21925 +.. date: 8544 +.. nonce: _fr69L +.. section: Library + +:func:`warnings.formatwarning` now catches exceptions on +``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` emitted +late during the Python shutdown process. + +.. + +.. bpo: 24266 +.. date: 8543 +.. nonce: YZgVyM +.. section: Library + +Ctrl+C during Readline history search now cancels the search mode when +compiled with Readline 7. + +.. + +.. bpo: 26560 +.. date: 8542 +.. nonce: A4WXNz +.. section: Library + +Avoid potential ValueError in BaseHandler.start_response. Initial patch by +Peter Inglesby. + +.. + +.. bpo: 26313 +.. date: 8541 +.. nonce: LjZAjy +.. original section: Library +.. section: Security + +ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch +by Baji. + +.. + +.. bpo: 26569 +.. date: 8540 +.. nonce: EX8vF1 +.. section: Library + +Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` to support +importing packages. + +.. + +.. bpo: 26499 +.. date: 8539 +.. nonce: NP08PI +.. section: Library + +Account for remaining Content-Length in HTTPResponse.readline() and read1(). +Based on patch by Silent Ghost. Also document that HTTPResponse now supports +these methods. + +.. + +.. bpo: 25320 +.. date: 8538 +.. nonce: V96LIy +.. section: Library + +Handle sockets in directories unittest discovery is scanning. Patch from +Victor van den Elzen. + +.. + +.. bpo: 16181 +.. date: 8537 +.. nonce: P7lLvo +.. section: Library + +cookiejar.http2time() now returns None if year is higher than +datetime.MAXYEAR. + +.. + +.. bpo: 26513 +.. date: 8536 +.. nonce: HoPepy +.. section: Library + +Fixes platform module detection of Windows Server + +.. + +.. bpo: 23718 +.. date: 8535 +.. nonce: AMPC0o +.. section: Library + +Fixed parsing time in week 0 before Jan 1. Original patch by Tam?s Bence +Gedai. + +.. + +.. bpo: 20589 +.. date: 8534 +.. nonce: NsQ_I1 +.. section: Library + +Invoking Path.owner() and Path.group() on Windows now raise +NotImplementedError instead of ImportError. + +.. + +.. bpo: 26177 +.. date: 8533 +.. nonce: HlSWer +.. section: Library + +Fixed the keys() method for Canvas and Scrollbar widgets. + +.. + +.. bpo: 15068 +.. date: 8532 +.. nonce: bcHtiw +.. section: Library + +Got rid of excessive buffering in the fileinput module. The bufsize +parameter is no longer used. + +.. + +.. bpo: 2202 +.. date: 8531 +.. nonce: dk9sd0 +.. section: Library + +Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls. +Initial patch by Mathieu Dupuy. + +.. + +.. bpo: 25718 +.. date: 8530 +.. nonce: 4EjZyv +.. section: Library + +Fixed pickling and copying the accumulate() iterator with total is None. + +.. + +.. bpo: 26475 +.. date: 8529 +.. nonce: JXVccY +.. section: Library + +Fixed debugging output for regular expressions with the (?x) flag. + +.. + +.. bpo: 26457 +.. date: 8528 +.. nonce: Xe6Clh +.. section: Library + +Fixed the subnets() methods in IP network classes for the case when +resulting prefix length is equal to maximal prefix length. Based on patch by +Xiang Zhang. + +.. + +.. bpo: 26385 +.. date: 8527 +.. nonce: 50bDXm +.. section: Library + +Remove the file if the internal open() call in NamedTemporaryFile() fails. +Patch by Silent Ghost. + +.. + +.. bpo: 26402 +.. date: 8526 +.. nonce: k7DVuU +.. section: Library + +Fix XML-RPC client to retry when the server shuts down a persistent +connection. This was a regression related to the new +http.client.RemoteDisconnected exception in 3.5.0a4. + +.. + +.. bpo: 25913 +.. date: 8525 +.. nonce: 5flb95 +.. section: Library + +Leading ``<~`` is optional now in base64.a85decode() with adobe=True. Patch +by Swati Jaiswal. + +.. + +.. bpo: 26186 +.. date: 8524 +.. nonce: R9rfiL +.. section: Library + +Remove an invalid type check in importlib.util.LazyLoader. + +.. + +.. bpo: 26367 +.. date: 8523 +.. nonce: ckpNeU +.. section: Library + +importlib.__import__() raises SystemError like builtins.__import__() when +``level`` is specified but without an accompanying package specified. + +.. + +.. bpo: 26309 +.. date: 8522 +.. nonce: ubEeiz +.. section: Library + +In the "socketserver" module, shut down the request (closing the connected +socket) when verify_request() returns false. Patch by Aviv Palivoda. + +.. + +.. bpo: 25939 +.. date: 8521 +.. nonce: X49Fqd +.. original section: Library +.. section: Security + +On Windows open the cert store readonly in ssl.enum_certificates. + +.. + +.. bpo: 25995 +.. date: 8520 +.. nonce: NfcimP +.. section: Library + +os.walk() no longer uses FDs proportional to the tree depth. + +.. + +.. bpo: 26117 +.. date: 8519 +.. nonce: ne6p11 +.. section: Library + +The os.scandir() iterator now closes file descriptor not only when the +iteration is finished, but when it was failed with error. + +.. + +.. bpo: 25911 +.. date: 8518 +.. nonce: d4Zadh +.. section: Library + +Restored support of bytes paths in os.walk() on Windows. + +.. + +.. bpo: 26045 +.. date: 8517 +.. nonce: WmzUrX +.. section: Library + +Add UTF-8 suggestion to error message when posting a non-Latin-1 string with +http.client. + +.. + +.. bpo: 12923 +.. date: 8516 +.. nonce: HPAu-B +.. section: Library + +Reset FancyURLopener's redirect counter even if there is an exception. +Based on patches by Brian Brazil and Daniel Rocco. + +.. + +.. bpo: 25945 +.. date: 8515 +.. nonce: guNgNM +.. section: Library + +Fixed a crash when unpickle the functools.partial object with wrong state. +Fixed a leak in failed functools.partial constructor. "args" and "keywords" +attributes of functools.partial have now always types tuple and dict +correspondingly. + +.. + +.. bpo: 26202 +.. date: 8514 +.. nonce: LPIXLg +.. section: Library + +copy.deepcopy() now correctly copies range() objects with non-atomic +attributes. + +.. + +.. bpo: 23076 +.. date: 8513 +.. nonce: 8rphoP +.. section: Library + +Path.glob() now raises a ValueError if it's called with an invalid pattern. +Patch by Thomas Nyberg. + +.. + +.. bpo: 19883 +.. date: 8512 +.. nonce: z9TsO6 +.. section: Library + +Fixed possible integer overflows in zipimport. + +.. + +.. bpo: 26227 +.. date: 8511 +.. nonce: Fe6oiB +.. section: Library + +On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions +of the socket module now decode the hostname from the ANSI code page rather +than UTF-8. + +.. + +.. bpo: 26147 +.. date: 8510 +.. nonce: i-Jc01 +.. section: Library + +xmlrpc now works with strings not encodable with used non-UTF-8 encoding. + +.. + +.. bpo: 25935 +.. date: 8509 +.. nonce: cyni91 +.. section: Library + +Garbage collector now breaks reference loops with OrderedDict. + +.. + +.. bpo: 16620 +.. date: 8508 +.. nonce: rxpn_Y +.. section: Library + +Fixed AttributeError in msilib.Directory.glob(). + +.. + +.. bpo: 26013 +.. date: 8507 +.. nonce: 93RKNz +.. section: Library + +Added compatibility with broken protocol 2 pickles created in old Python 3 +versions (3.4.3 and lower). + +.. + +.. bpo: 25850 +.. date: 8506 +.. nonce: jwFPxj +.. section: Library + +Use cross-compilation by default for 64-bit Windows. + +.. + +.. bpo: 17633 +.. date: 8505 +.. nonce: 9mpbUO +.. section: Library + +Improve zipimport's support for namespace packages. + +.. + +.. bpo: 24705 +.. date: 8504 +.. nonce: IZYwjR +.. section: Library + +Fix sysconfig._parse_makefile not expanding ${} vars appearing before $() +vars. + +.. + +.. bpo: 22138 +.. date: 8503 +.. nonce: nRNYkc +.. section: Library + +Fix mock.patch behavior when patching descriptors. Restore original values +after patching. Patch contributed by Sean McCully. + +.. + +.. bpo: 25672 +.. date: 8502 +.. nonce: fw9RJP +.. section: Library + +In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode option if it is +safe to do so. + +.. + +.. bpo: 26012 +.. date: 8501 +.. nonce: IFSXNm +.. section: Library + +Don't traverse into symlinks for ``**`` pattern in pathlib.Path.[r]glob(). + +.. + +.. bpo: 24120 +.. date: 8500 +.. nonce: Yiwa0h +.. section: Library + +Ignore PermissionError when traversing a tree with pathlib.Path.[r]glob(). +Patch by Ulrich Petri. + +.. + +.. bpo: 25447 +.. date: 8499 +.. nonce: -4m4xO +.. section: Library + +fileinput now uses sys.stdin as-is if it does not have a buffer attribute +(restores backward compatibility). + +.. + +.. bpo: 25447 +.. date: 8498 +.. nonce: AtHkWA +.. section: Library + +Copying the lru_cache() wrapper object now always works, independedly from +the type of the wrapped object (by returning the original object unchanged). + +.. + +.. bpo: 24103 +.. date: 8497 +.. nonce: WufqrQ +.. section: Library + +Fixed possible use after free in ElementTree.XMLPullParser. + +.. + +.. bpo: 25860 +.. date: 8496 +.. nonce: 0hActb +.. section: Library + +os.fwalk() no longer skips remaining directories when error occurs. +Original patch by Samson Lee. + +.. + +.. bpo: 25914 +.. date: 8495 +.. nonce: h0V61F +.. section: Library + +Fixed and simplified OrderedDict.__sizeof__. + +.. + +.. bpo: 25902 +.. date: 8494 +.. nonce: 6t2FmH +.. section: Library + +Fixed various refcount issues in ElementTree iteration. + +.. + +.. bpo: 25717 +.. date: 8493 +.. nonce: 0_xjaK +.. section: Library + +Restore the previous behaviour of tolerating most fstat() errors when +opening files. This was a regression in 3.5a1, and stopped anonymous +temporary files from working in special cases. + +.. + +.. bpo: 24903 +.. date: 8492 +.. nonce: 3LBdzb +.. section: Library + +Fix regression in number of arguments compileall accepts when '-d' is +specified. The check on the number of arguments has been dropped completely +as it never worked correctly anyway. + +.. + +.. bpo: 25764 +.. date: 8491 +.. nonce: 7WWG07 +.. section: Library + +In the subprocess module, preserve any exception caused by fork() failure +when preexec_fn is used. + +.. + +.. bpo: 6478 +.. date: 8490 +.. nonce: -Bi9Hb +.. section: Library + +_strptime's regexp cache now is reset after changing timezone with +time.tzset(). + +.. + +.. bpo: 14285 +.. date: 8489 +.. nonce: UyG8Hj +.. section: Library + +When executing a package with the "python -m package" option, and package +initialization fails, a proper traceback is now reported. The "runpy" +module now lets exceptions from package initialization pass back to the +caller, rather than raising ImportError. + +.. + +.. bpo: 19771 +.. date: 8488 +.. nonce: 5NG-bg +.. section: Library + +Also in runpy and the "-m" option, omit the irrelevant message ". . . is a +package and cannot be directly executed" if the package could not even be +initialized (e.g. due to a bad ``*.pyc`` file). + +.. + +.. bpo: 25177 +.. date: 8487 +.. nonce: aNR4Ha +.. section: Library + +Fixed problem with the mean of very small and very large numbers. As a side +effect, statistics.mean and statistics.variance should be significantly +faster. + +.. + +.. bpo: 25718 +.. date: 8486 +.. nonce: D9mHZF +.. section: Library + +Fixed copying object with state with boolean value is false. + +.. + +.. bpo: 10131 +.. date: 8485 +.. nonce: a7tptz +.. section: Library + +Fixed deep copying of minidom documents. Based on patch by Marian Ganisin. + +.. + +.. bpo: 25725 +.. date: 8484 +.. nonce: XIKv3R +.. section: Library + +Fixed a reference leak in pickle.loads() when unpickling invalid data +including tuple instructions. + +.. + +.. bpo: 25663 +.. date: 8483 +.. nonce: Ofwfqa +.. section: Library + +In the Readline completer, avoid listing duplicate global names, and search +the global namespace before searching builtins. + +.. + +.. bpo: 25688 +.. date: 8482 +.. nonce: 8P1HOv +.. section: Library + +Fixed file leak in ElementTree.iterparse() raising an error. + +.. + +.. bpo: 23914 +.. date: 8481 +.. nonce: 1sEz4J +.. section: Library + +Fixed SystemError raised by unpickler on broken pickle data. + +.. + +.. bpo: 25691 +.. date: 8480 +.. nonce: ZEaapY +.. section: Library + +Fixed crash on deleting ElementTree.Element attributes. + +.. + +.. bpo: 25624 +.. date: 8479 +.. nonce: ed-fM0 +.. section: Library + +ZipFile now always writes a ZIP_STORED header for directory entries. Patch +by Dingyuan Wang. + +.. + +.. bpo: 0 +.. date: 8478 +.. nonce: rtZyid +.. section: Library + +Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26050 +.. date: 8477 +.. nonce: sclyvk +.. section: Library + +Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. + +.. + +.. bpo: 25924 +.. date: 8476 +.. nonce: Uxr2vt +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on OS X versions +10.5 or higher. Original patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26406 +.. date: 8475 +.. nonce: ihvhF4 +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on current versions +of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26848 +.. date: 8474 +.. nonce: ChBOpQ +.. section: Library + +Fix asyncio/subprocess.communicate() to handle empty input. Patch by Jack +O'Connor. + +.. + +.. bpo: 27040 +.. date: 8473 +.. nonce: UASyCC +.. section: Library + +Add loop.get_exception_handler method + +.. + +.. bpo: 27041 +.. date: 8472 +.. nonce: p3893U +.. section: Library + +asyncio: Add loop.create_future method + +.. + +.. bpo: 27223 +.. date: 8471 +.. nonce: PRf4I6 +.. section: Library + +asyncio: Fix _read_ready and _write_ready to respect _conn_lost. Patch by +?ukasz Langa. + +.. + +.. bpo: 22970 +.. date: 8470 +.. nonce: WhdhyM +.. section: Library + +asyncio: Fix inconsistency cancelling Condition.wait. Patch by David Coles. + +.. + +.. bpo: 5124 +.. date: 8469 +.. nonce: 4kwBvM +.. section: IDLE + +Paste with text selected now replaces the selection on X11. This matches how +paste works on Windows, Mac, most modern Linux apps, and ttk widgets. +Original patch by Serhiy Storchaka. + +.. + +.. bpo: 24759 +.. date: 8468 +.. nonce: ccmySu +.. section: IDLE + +Make clear in idlelib.idle_test.__init__ that the directory is a private +implementation of test.test_idle and tool for maintainers. + +.. + +.. bpo: 27196 +.. date: 8467 +.. nonce: 3yp8TF +.. section: IDLE + +Stop 'ThemeChanged' warnings when running IDLE tests. These persisted after +other warnings were suppressed in #20567. Apply Serhiy Storchaka's +update_idletasks solution to four test files. Record this additional advice +in idle_test/README.txt + +.. + +.. bpo: 20567 +.. date: 8466 +.. nonce: hhT32b +.. section: IDLE + +Revise idle_test/README.txt with advice about avoiding tk warning messages +from tests. Apply advice to several IDLE tests. + +.. + +.. bpo: 27117 +.. date: 8465 +.. nonce: YrLPf4 +.. section: IDLE + +Make colorizer htest and turtledemo work with dark themes. Move code for +configuring text widget colors to a new function. + +.. + +.. bpo: 26673 +.. date: 8464 +.. nonce: dh0_Ij +.. section: IDLE + +When tk reports font size as 0, change to size 10. Such fonts on Linux +prevented the configuration dialog from opening. + +.. + +.. bpo: 21939 +.. date: 8463 +.. nonce: pWz-OK +.. section: IDLE + +Add test for IDLE's percolator. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 21676 +.. date: 8462 +.. nonce: hqy6Qh +.. section: IDLE + +Add test for IDLE's replace dialog. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 18410 +.. date: 8461 +.. nonce: DLSPZo +.. section: IDLE + +Add test for IDLE's search dialog. Original patch by Westley Mart?nez. + +.. + +.. bpo: 21703 +.. date: 8460 +.. nonce: BAZfDM +.. section: IDLE + +Add test for IDLE's undo delegator. Original patch by Saimadhav Heblikar . + +.. + +.. bpo: 27044 +.. date: 8459 +.. nonce: 4y7tyM +.. section: IDLE + +Add ConfigDialog.remove_var_callbacks to stop memory leaks. + +.. + +.. bpo: 23977 +.. date: 8458 +.. nonce: miDjj8 +.. section: IDLE + +Add more asserts to test_delegator. + +.. + +.. bpo: 20640 +.. date: 8457 +.. nonce: PmI-G8 +.. section: IDLE + +Add tests for idlelib.configHelpSourceEdit. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 0 +.. date: 8456 +.. nonce: _YJfG7 +.. section: IDLE + +In the 'IDLE-console differences' section of the IDLE doc, clarify how +running with IDLE affects sys.modules and the standard streams. + +.. + +.. bpo: 25507 +.. date: 8455 +.. nonce: i8bNpk +.. section: IDLE + +fix incorrect change in IOBinding that prevented printing. Augment IOBinding +htest to include all major IOBinding functions. + +.. + +.. bpo: 25905 +.. date: 8454 +.. nonce: FzNb3B +.. section: IDLE + +Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION MARK in +README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to +utf-8 and open it with 'utf-8'. + +.. + +.. bpo: 19489 +.. date: 8453 +.. nonce: jvzuO7 +.. section: Documentation + +Moved the search box from the sidebar to the header and footer of each page. +Patch by Ammar Askar. + +.. + +.. bpo: 24136 +.. date: 8452 +.. nonce: MUK0zK +.. section: Documentation + +Document the new PEP 448 unpacking syntax of 3.5. + +.. + +.. bpo: 26736 +.. date: 8451 +.. nonce: U_Hyqo +.. section: Documentation + +Used HTTPS for external links in the documentation if possible. + +.. + +.. bpo: 6953 +.. date: 8450 +.. nonce: Zk6rno +.. section: Documentation + +Rework the Readline module documentation to group related functions +together, and add more details such as what underlying Readline functions +and variables are accessed. + +.. + +.. bpo: 23606 +.. date: 8449 +.. nonce: 9MhIso +.. section: Documentation + +Adds note to ctypes documentation regarding cdll.msvcrt. + +.. + +.. bpo: 25500 +.. date: 8448 +.. nonce: AV47eF +.. section: Documentation + +Fix documentation to not claim that __import__ is searched for in the global +scope. + +.. + +.. bpo: 26014 +.. date: 8447 +.. nonce: ptdZ_I +.. section: Documentation + +Update 3.x packaging documentation: * "See also" links to the new docs are +now provided in the legacy pages * links to setuptools documentation have +been updated + +.. + +.. bpo: 21916 +.. date: 8446 +.. nonce: muwCyp +.. section: Tests + +Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle +Zijlstra. + +.. + +.. bpo: 26523 +.. date: 8445 +.. nonce: em_Uzt +.. section: Tests + +The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. + +.. + +.. bpo: 26015 +.. date: 8444 +.. nonce: p3oWK3 +.. section: Tests + +Added new tests for pickling iterators of mutable sequences. + +.. + +.. bpo: 26325 +.. date: 8443 +.. nonce: KOUc82 +.. section: Tests + +Added test.support.check_no_resource_warning() to check that no +ResourceWarning is emitted. + +.. + +.. bpo: 25940 +.. date: 8442 +.. nonce: PgiLVN +.. section: Tests + +Changed test_ssl to use self-signed.pythontest.net. This avoids relying on +svn.python.org, which recently changed root certificate. + +.. + +.. bpo: 25616 +.. date: 8441 +.. nonce: Qr-60p +.. section: Tests + +Tests for OrderedDict are extracted from test_collections into separate file +test_ordered_dict. + +.. + +.. bpo: 26583 +.. date: 8440 +.. nonce: Up7hTl +.. section: Tests + +Skip test_timestamp_overflow in test_import if bytecode files cannot be +written. + +.. + +.. bpo: 26884 +.. date: 8439 +.. nonce: O8-azL +.. section: Build + +Fix linking extension modules for cross builds. Patch by Xavier de Gaye. + +.. + +.. bpo: 22359 +.. date: 8438 +.. nonce: HDjM4s +.. section: Build + +Disable the rules for running _freeze_importlib and pgen when cross- +compiling. The output of these programs is normally saved with the source +code anyway, and is still regenerated when doing a native build. Patch by +Xavier de Gaye. + +.. + +.. bpo: 27229 +.. date: 8437 +.. nonce: C2NDch +.. section: Build + +Fix the cross-compiling pgen rule for in-tree builds. Patch by Xavier de +Gaye. + +.. + +.. bpo: 21668 +.. date: 8436 +.. nonce: 4sMAa1 +.. section: Build + +Link audioop, _datetime, _ctypes_test modules to libm, except on Mac OS X. +Patch written by Xavier de Gaye. + +.. + +.. bpo: 25702 +.. date: 8435 +.. nonce: ipxyJs +.. section: Build + +A --with-lto configure option has been added that will enable link time +optimizations at build time during a make profile-opt. Some compilers and +toolchains are known to not produce stable code when using LTO, be sure to +test things thoroughly before relying on it. It can provide a few % speed up +over profile-opt alone. + +.. + +.. bpo: 26624 +.. date: 8434 +.. nonce: 4fGrTl +.. section: Build + +Adds validation of ucrtbase[d].dll version with warning for old versions. + +.. + +.. bpo: 17603 +.. date: 8433 +.. nonce: 102DA- +.. section: Build + +Avoid error about nonexistant fileblocks.o file by using a lower-level check +for st_blocks in struct stat. + +.. + +.. bpo: 26079 +.. date: 8432 +.. nonce: mEzW0O +.. section: Build + +Fixing the build output folder for tix-8.4.3.6. Patch by Bjoern Thiel. + +.. + +.. bpo: 26465 +.. date: 8431 +.. nonce: _YR608 +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2g. + +.. + +.. bpo: 24421 +.. date: 8430 +.. nonce: 2zY7vM +.. section: Build + +Compile Modules/_math.c once, before building extensions. Previously it +could fail to compile properly if the math and cmath builds were concurrent. + +.. + +.. bpo: 25348 +.. date: 8429 +.. nonce: u6_BaQ +.. section: Build + +Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for +building with Profile-Guided Optimization. The old +``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls +``PCbuild\build.bat --pgo %*``. + +.. + +.. bpo: 25827 +.. date: 8428 +.. nonce: yg3DMM +.. section: Build + +Add support for building with ICC to ``configure``, including a new +``--with-icc`` flag. + +.. + +.. bpo: 25696 +.. date: 8427 +.. nonce: 2R_wIv +.. section: Build + +Fix installation of Python on UNIX with make -j9. + +.. + +.. bpo: 26930 +.. date: 8426 +.. nonce: Sqz2O3 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2h. + +.. + +.. bpo: 26268 +.. date: 8425 +.. nonce: I3-YLh +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2f. + +.. + +.. bpo: 25136 +.. date: 8424 +.. nonce: Vi-fmO +.. section: Build + +Support Apple Xcode 7's new textual SDK stub libraries. + +.. + +.. bpo: 24324 +.. date: 8423 +.. nonce: m6DZMx +.. section: Build + +Do not enable unreachable code warnings when using gcc as the option does +not work correctly in older versions of gcc and has been silently removed as +of gcc-4.5. + +.. + +.. bpo: 27053 +.. date: 8422 +.. nonce: 1IRbae +.. section: Windows + +Updates make_zip.py to correctly generate library ZIP file. + +.. + +.. bpo: 26268 +.. date: 8421 +.. nonce: Z-lJEh +.. section: Windows + +Update the prepare_ssl.py script to handle OpenSSL releases that don't +include the contents of the include directory (that is, 1.0.2e and later). + +.. + +.. bpo: 26071 +.. date: 8420 +.. nonce: wLxL2l +.. section: Windows + +bdist_wininst created binaries fail to start and find 32bit Python + +.. + +.. bpo: 26073 +.. date: 8419 +.. nonce: XwWgHp +.. section: Windows + +Update the list of magic numbers in launcher + +.. + +.. bpo: 26065 +.. date: 8418 +.. nonce: SkVLJp +.. section: Windows + +Excludes venv from library when generating embeddable distro. + +.. + +.. bpo: 26799 +.. date: 8417 +.. nonce: gK2VXX +.. section: Tools/Demos + +Fix python-gdb.py: don't get C types once when the Python code is loaded, +but get C types on demand. The C types can change if python-gdb.py is loaded +before the Python executable. Patch written by Thomas Ilsche. + +.. + +.. bpo: 26271 +.. date: 8416 +.. nonce: wg-rzr +.. section: Tools/Demos + +Fix the Freeze tool to properly use flags passed through configure. Patch by +Daniel Shaulov. + +.. + +.. bpo: 26489 +.. date: 8415 +.. nonce: rJ_U5S +.. section: Tools/Demos + +Add dictionary unpacking support to Tools/parser/unparse.py. Patch by Guo Ci +Teo. + +.. + +.. bpo: 26316 +.. date: 8414 +.. nonce: QJvVOi +.. section: Tools/Demos + +Fix variable name typo in Argument Clinic. + +.. + +.. bpo: 17500 +.. date: 8413 +.. nonce: QTZbRV +.. section: Windows + +Remove unused and outdated icons. (See also: +https://github.com/python/pythondotorg/issues/945) diff --git a/Misc/NEWS.d/3.5.3.rst b/Misc/NEWS.d/3.5.3.rst new file mode 100644 index 00000000000..716e156403c --- /dev/null +++ b/Misc/NEWS.d/3.5.3.rst @@ -0,0 +1,7 @@ +.. bpo: 0 +.. date: 8859 +.. no changes: True +.. nonce: zYPqUK +.. release date: 2017-01-17 + +There were no code changes between 3.5.3rc1 and 3.5.3 final. diff --git a/Misc/NEWS.d/3.5.3rc1.rst b/Misc/NEWS.d/3.5.3rc1.rst new file mode 100644 index 00000000000..caba4d403be --- /dev/null +++ b/Misc/NEWS.d/3.5.3rc1.rst @@ -0,0 +1,2164 @@ +.. bpo: 29073 +.. date: 8858 +.. nonce: EFpHQ7 +.. release date: 2017-01-02 +.. section: Core and Builtins + +bytearray formatting no longer truncates on first null byte. + +.. + +.. bpo: 28932 +.. date: 8857 +.. nonce: QnLx8A +.. section: Core and Builtins + +Do not include if it does not exist. + +.. + +.. bpo: 28147 +.. date: 8856 +.. nonce: EV4bm6 +.. section: Core and Builtins + +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. + +.. + +.. bpo: 25677 +.. date: 8855 +.. nonce: RWhZrb +.. section: Core and Builtins + +Correct the positioning of the syntax error caret for indented blocks. +Based on patch by Michael Layzell. + +.. + +.. bpo: 29000 +.. date: 8854 +.. nonce: K6wQ-3 +.. section: Core and Builtins + +Fixed bytes formatting of octals with zero padding in alternate form. + +.. + +.. bpo: 28512 +.. date: 8853 +.. nonce: i-pv6d +.. section: Core and Builtins + +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +.. + +.. bpo: 28991 +.. date: 8852 +.. nonce: -qOTxS +.. section: Core and Builtins + +functools.lru_cache() was susceptible to an obscure reentrancy bug caused by +a monkey-patched len() function. + +.. + +.. bpo: 28648 +.. date: 8851 +.. nonce: z7B52W +.. section: Core and Builtins + +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. + +.. + +.. bpo: 19398 +.. date: 8850 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 28426 +.. date: 8849 +.. nonce: E_quyK +.. section: Core and Builtins + +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. + +.. + +.. bpo: 23782 +.. date: 8848 +.. nonce: lonDzj +.. section: Core and Builtins + +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). + +.. + +.. bpo: 28379 +.. date: 8847 +.. nonce: DuXlco +.. section: Core and Builtins + +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. + +.. + +.. bpo: 28376 +.. date: 8846 +.. nonce: oPD-5D +.. section: Core and Builtins + +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. + +.. + +.. bpo: 28376 +.. date: 8845 +.. nonce: fLeHM2 +.. section: Core and Builtins + +The constructor of range_iterator now checks that step is not 0. Patch by +Oren Milman. + +.. + +.. bpo: 26906 +.. date: 8844 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 8843 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 8842 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28350 +.. date: 8841 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 26617 +.. date: 8840 +.. nonce: Gh5LvN +.. section: Core and Builtins + +Fix crash when GC runs during weakref callbacks. + +.. + +.. bpo: 27942 +.. date: 8839 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 21578 +.. date: 8838 +.. nonce: GI1bhj +.. section: Core and Builtins + +Fixed misleading error message when ImportError called with invalid keyword +args. + +.. + +.. bpo: 28203 +.. date: 8837 +.. nonce: kOgvtp +.. section: Core and Builtins + +Fix incorrect type in error message from ``complex(1.0, {2:3})``. Patch by +Soumya Sharma. + +.. + +.. bpo: 27955 +.. date: 8836 +.. nonce: HC4pZ4 +.. section: Core and Builtins + +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. + +.. + +.. bpo: 28131 +.. date: 8835 +.. nonce: owq0wW +.. section: Core and Builtins + +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. + +.. + +.. bpo: 25221 +.. date: 8834 +.. nonce: Zvkz9i +.. section: Core and Builtins + +Fix corrupted result from PyLong_FromLong(0) when Python is compiled with +NSMALLPOSINTS = 0. + +.. + +.. bpo: 25758 +.. date: 8833 +.. nonce: yR-YTD +.. section: Core and Builtins + +Prevents zipimport from unnecessarily encoding a filename (patch by Eryk +Sun) + +.. + +.. bpo: 28189 +.. date: 8832 +.. nonce: c_nbR_ +.. section: Core and Builtins + +dictitems_contains no longer swallows compare errors. (Patch by Xiang Zhang) + +.. + +.. bpo: 27812 +.. date: 8831 +.. nonce: sidcs8 +.. section: Core and Builtins + +Properly clear out a generator's frame's backreference to the generator to +prevent crashes in frame.clear(). + +.. + +.. bpo: 27811 +.. date: 8830 +.. nonce: T4AuBo +.. section: Core and Builtins + +Fix a crash when a coroutine that has not been awaited is finalized with +warnings-as-errors enabled. + +.. + +.. bpo: 27587 +.. date: 8829 +.. nonce: mbavY2 +.. section: Core and Builtins + +Fix another issue found by PVS-Studio: Null pointer check after use of 'def' +in _PyState_AddModule(). Initial patch by Christian Heimes. + +.. + +.. bpo: 26020 +.. date: 8828 +.. nonce: niLbLa +.. section: Core and Builtins + +set literal evaluation order did not match documented behaviour. + +.. + +.. bpo: 27782 +.. date: 8827 +.. nonce: C8OBQD +.. section: Core and Builtins + +Multi-phase extension module import now correctly allows the ``m_methods`` +field to be used to add module level functions to instances of non-module +types returned from ``Py_create_mod``. Patch by Xiang Zhang. + +.. + +.. bpo: 27936 +.. date: 8826 +.. nonce: AdOann +.. section: Core and Builtins + +The round() function accepted a second None argument for some types but not +for others. Fixed the inconsistency by accepting None for all numeric +types. + +.. + +.. bpo: 27487 +.. date: 8825 +.. nonce: jeTQNr +.. section: Core and Builtins + +Warn if a submodule argument to "python -m" or runpy.run_module() is found +in sys.modules after parent packages are imported, but before the submodule +is executed. + +.. + +.. bpo: 27558 +.. date: 8824 +.. nonce: VmltMh +.. section: Core and Builtins + +Fix a SystemError in the implementation of "raise" statement. In a brand new +thread, raise a RuntimeError since there is no active exception to reraise. +Patch written by Xiang Zhang. + +.. + +.. bpo: 27419 +.. date: 8823 +.. nonce: JZ94ju +.. section: Core and Builtins + +Standard __import__() no longer look up "__import__" in globals or builtins +for importing submodules or "from import". Fixed handling an error of non- +string package name. + +.. + +.. bpo: 27083 +.. date: 8822 +.. nonce: F4ZT1C +.. section: Core and Builtins + +Respect the PYTHONCASEOK environment variable under Windows. + +.. + +.. bpo: 27514 +.. date: 8821 +.. nonce: NLbwPG +.. section: Core and Builtins + +Make having too many statically nested blocks a SyntaxError instead of +SystemError. + +.. + +.. bpo: 27473 +.. date: 8820 +.. nonce: _nOtTA +.. section: Core and Builtins + +Fixed possible integer overflow in bytes and bytearray concatenations. +Patch by Xiang Zhang. + +.. + +.. bpo: 27507 +.. date: 8819 +.. nonce: 3pX0Be +.. section: Core and Builtins + +Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. + +.. + +.. bpo: 27581 +.. date: 8818 +.. nonce: KezjNt +.. section: Core and Builtins + +Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by +Xiang Zhang. + +.. + +.. bpo: 27443 +.. date: 8817 +.. nonce: 87ZwZ1 +.. section: Core and Builtins + +__length_hint__() of bytearray iterators no longer return a negative integer +for a resized bytearray. + +.. + +.. bpo: 27942 +.. date: 8816 +.. nonce: wCAkW5 +.. section: Core and Builtins + +Fix memory leak in codeobject.c + +.. + +.. bpo: 15812 +.. date: 8815 +.. nonce: R1U-Ec +.. section: Library + +inspect.getframeinfo() now correctly shows the first line of a context. +Patch by Sam Breese. + +.. + +.. bpo: 29094 +.. date: 8814 +.. nonce: 460ZQo +.. section: Library + +Offsets in a ZIP file created with extern file object and modes "w" and "x" +now are relative to the start of the file. + +.. + +.. bpo: 13051 +.. date: 8813 +.. nonce: YzC1Te +.. section: Library + +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. + +.. + +.. bpo: 29119 +.. date: 8812 +.. nonce: Ov69fr +.. section: Library + +Fix weakrefs in the pure python version of collections.OrderedDict +move_to_end() method. Contributed by Andra Bogildea. + +.. + +.. bpo: 9770 +.. date: 8811 +.. nonce: WJJnwP +.. section: Library + +curses.ascii predicates now work correctly with negative integers. + +.. + +.. bpo: 28427 +.. date: 8810 +.. nonce: vUd-va +.. section: Library + +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. + +.. + +.. bpo: 28923 +.. date: 8809 +.. nonce: naVULD +.. section: Library + +Remove editor artifacts from Tix.py. + +.. + +.. bpo: 28871 +.. date: 8808 +.. nonce: cPMXCJ +.. section: Library + +Fixed a crash when deallocate deep ElementTree. + +.. + +.. bpo: 19542 +.. date: 8807 +.. nonce: 5tCkaK +.. section: Library + +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. + +.. + +.. bpo: 20191 +.. date: 8806 +.. nonce: P_EZ7c +.. section: Library + +Fixed a crash in resource.prlimit() when pass a sequence that doesn't own +its elements as limits. + +.. + +.. bpo: 28779 +.. date: 8805 +.. nonce: t-mjED +.. section: Library + +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. + +.. + +.. bpo: 28847 +.. date: 8804 +.. nonce: J7d3nG +.. section: Library + +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. + +.. + +.. bpo: 25659 +.. date: 8803 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 28732 +.. date: 8802 +.. nonce: xkG8k7 +.. section: Library + +Fix crash in os.spawnv() with no elements in args + +.. + +.. bpo: 28485 +.. date: 8801 +.. nonce: WuKqKh +.. section: Library + +Always raise ValueError for negative compileall.compile_dir(workers=...) +parameter, even when multithreading is unavailable. + +.. + +.. bpo: 28387 +.. date: 8800 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 27517 +.. date: 8799 +.. nonce: 1CYM8A +.. section: Library + +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. + +.. + +.. bpo: 28549 +.. date: 8798 +.. nonce: ShnM2y +.. section: Library + +Fixed segfault in curses's addch() with ncurses6. + +.. + +.. bpo: 28449 +.. date: 8797 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 23262 +.. date: 8796 +.. nonce: 6EVB7N +.. section: Library + +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. + +.. + +.. bpo: 27939 +.. date: 8795 +.. nonce: mTfADV +.. section: Library + +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. + +.. + +.. bpo: 28255 +.. date: 8794 +.. nonce: _ZH4wm +.. section: Library + +calendar.TextCalendar().prmonth() no longer prints a space at the start of +new line after printing a month's calendar. Patch by Xiang Zhang. + +.. + +.. bpo: 20491 +.. date: 8793 +.. nonce: ObgnQ2 +.. section: Library + +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. + +.. + +.. bpo: 28353 +.. date: 8792 +.. nonce: sKGbLL +.. section: Library + +os.fwalk() no longer fails on broken links. + +.. + +.. bpo: 25464 +.. date: 8791 +.. nonce: HDUTCu +.. section: Library + +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. + +.. + +.. bpo: 28488 +.. date: 8790 +.. nonce: NlkjBM +.. section: Library + +shutil.make_archive() no longer add entry "./" to ZIP archive. + +.. + +.. bpo: 24452 +.. date: 8789 +.. nonce: m9Kyg3 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. + +.. + +.. bpo: 20766 +.. date: 8788 +.. nonce: 4kvCzx +.. section: Library + +Fix references leaked by pdb in the handling of SIGINT handlers. + +.. + +.. bpo: 26293 +.. date: 8787 +.. nonce: 2mjvwX +.. section: Library + +Fixed writing ZIP files that starts not from the start of the file. Offsets +in ZIP file now are relative to the start of the archive in conforming to +the specification. + +.. + +.. bpo: 28321 +.. date: 8786 +.. nonce: bQ-IIX +.. section: Library + +Fixed writing non-BMP characters with binary format in plistlib. + +.. + +.. bpo: 28322 +.. date: 8785 +.. nonce: l9hzap +.. section: Library + +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. + +.. + +.. bpo: 0 +.. date: 8784 +.. nonce: 81jNns +.. section: Library + +Fix possible integer overflows and crashes in the mmap module with unusual +usage patterns. + +.. + +.. bpo: 1703178 +.. date: 8783 +.. nonce: meb49K +.. section: Library + +Fix the ability to pass the --link-objects option to the distutils build_ext +command. + +.. + +.. bpo: 28253 +.. date: 8782 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 28275 +.. date: 8781 +.. nonce: EhWIsz +.. section: Library + +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. + +.. + +.. bpo: 27897 +.. date: 8780 +.. nonce: I0Ppmx +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. + +.. + +.. bpo: 18893 +.. date: 8779 +.. nonce: osiX5c +.. section: Library + +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. + +.. + +.. bpo: 27611 +.. date: 8778 +.. nonce: qL-UVQ +.. section: Library + +Fixed support of default root window in the tkinter.tix module. + +.. + +.. bpo: 27348 +.. date: 8777 +.. nonce: tDx7Vw +.. section: Library + +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. + +.. + +.. bpo: 25651 +.. date: 8776 +.. nonce: 3UhyPo +.. section: Library + +Allow falsy values to be used for msg parameter of subTest(). + +.. + +.. bpo: 27932 +.. date: 8775 +.. nonce: mtgl-6 +.. section: Library + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 0 +.. date: 8774 +.. nonce: iPpjqX +.. section: Library + +Fix UnboundLocalError in socket._sendfile_use_sendfile. + +.. + +.. bpo: 28075 +.. date: 8773 +.. nonce: aLiUs9 +.. section: Library + +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. + +.. + +.. bpo: 25270 +.. date: 8772 +.. nonce: jrZruM +.. section: Library + +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. + +.. + +.. bpo: 28181 +.. date: 8771 +.. nonce: NGc4Yv +.. section: Library + +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +.. + +.. bpo: 25895 +.. date: 8770 +.. nonce: j92qoQ +.. section: Library + +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. + +.. + +.. bpo: 27599 +.. date: 8769 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 19003 +.. date: 8768 +.. nonce: UUcK_F +.. section: Library + +m email.generator now replaces only ``\r`` and/or ``\n`` line endings, per +the RFC, instead of all unicode line endings. + +.. + +.. bpo: 28019 +.. date: 8767 +.. nonce: KUhBaS +.. section: Library + +itertools.count() no longer rounds non-integer step in range between 1.0 and +2.0 to 1. + +.. + +.. bpo: 25969 +.. date: 8766 +.. nonce: qSPkl- +.. section: Library + +Update the lib2to3 grammar to handle the unpacking generalizations added in +3.5. + +.. + +.. bpo: 14977 +.. date: 8765 +.. nonce: 4MvALg +.. section: Library + +mailcap now respects the order of the lines in the mailcap files ("first +match"), as required by RFC 1542. Patch by Michael Lazar. + +.. + +.. bpo: 24594 +.. date: 8764 +.. nonce: 9CnFVS +.. section: Library + +Validates persist parameter when opening MSI database + +.. + +.. bpo: 17582 +.. date: 8763 +.. nonce: MXEHxQ +.. section: Library + +xml.etree.ElementTree nows preserves whitespaces in attributes (Patch by +Duane Griffin. Reviewed and approved by Stefan Behnel.) + +.. + +.. bpo: 28047 +.. date: 8762 +.. nonce: pDu3Fm +.. section: Library + +Fixed calculation of line length used for the base64 CTE in the new email +policies. + +.. + +.. bpo: 27445 +.. date: 8761 +.. nonce: wOG0C0 +.. section: Library + +Don't pass str(_charset) to MIMEText.set_payload(). Patch by Claude Paroz. + +.. + +.. bpo: 22450 +.. date: 8760 +.. nonce: T3Sn_J +.. section: Library + +urllib now includes an ``Accept: */*`` header among the default headers. +This makes the results of REST API requests more consistent and predictable +especially when proxy servers are involved. + +.. + +.. bpo: 0 +.. date: 8759 +.. nonce: PVZStR +.. section: Library + +lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between +runs given the same Grammar.txt input regardless of the hash randomization +setting. + +.. + +.. bpo: 27570 +.. date: 8758 +.. nonce: pU0Zie +.. section: Library + +Avoid zero-length memcpy() etc calls with null source pointers in the +"ctypes" and "array" modules. + +.. + +.. bpo: 22233 +.. date: 8757 +.. nonce: uXSN0R +.. section: Library + +Break email header lines *only* on the RFC specified CR and LF characters, +not on arbitrary unicode line breaks. This also fixes a bug in HTTP header +parsing. + +.. + +.. bpo: 27988 +.. date: 8756 +.. nonce: VfMzZH +.. section: Library + +Fix email iter_attachments incorrect mutation of payload list. + +.. + +.. bpo: 27691 +.. date: 8755 +.. nonce: TMYF5_ +.. section: Library + +Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 +certs. + +.. + +.. bpo: 27850 +.. date: 8754 +.. nonce: kIVQ0m +.. section: Library + +Remove 3DES from ssl module's default cipher list to counter measure sweet32 +attack (CVE-2016-2183). + +.. + +.. bpo: 27766 +.. date: 8753 +.. nonce: WI70Tc +.. section: Library + +Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL +1.1.0 or LibreSSL). + +.. + +.. bpo: 26470 +.. date: 8752 +.. nonce: QGu_wo +.. section: Library + +Port ssl and hashlib module to OpenSSL 1.1.0. + +.. + +.. bpo: 0 +.. date: 8751 +.. nonce: 6TjEgz +.. section: Library + +Remove support for passing a file descriptor to os.access. It never worked +but previously didn't raise. + +.. + +.. bpo: 12885 +.. date: 8750 +.. nonce: r-IV1g +.. section: Library + +Fix error when distutils encounters symlink. + +.. + +.. bpo: 27881 +.. date: 8749 +.. nonce: fkETd9 +.. section: Library + +Fixed possible bugs when setting sqlite3.Connection.isolation_level. Based +on patch by Xiang Zhang. + +.. + +.. bpo: 27861 +.. date: 8748 +.. nonce: DBYuo9 +.. section: Library + +Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a +cursor. Patch by Xiang Zhang. + +.. + +.. bpo: 19884 +.. date: 8747 +.. nonce: MO8AWH +.. section: Library + +Avoid spurious output on OS X with Gnu Readline. + +.. + +.. bpo: 27706 +.. date: 8746 +.. nonce: ZY67yu +.. section: Library + +Restore deterministic behavior of random.Random().seed() for string seeds +using seeding version 1. Allows sequences of calls to random() to exactly +match those obtained in Python 2. Patch by Nofar Schnider. + +.. + +.. bpo: 10513 +.. date: 8745 +.. nonce: tQIQD_ +.. section: Library + +Fix a regression in Connection.commit(). Statements should not be reset +after a commit. + +.. + +.. bpo: 0 +.. date: 8744 +.. nonce: cYraeH +.. section: Library + +A new version of typing.py from https://github.com/python/typing: - +Collection (only for 3.6) (Issue #27598) - Add FrozenSet to __all__ +(upstream #261) - fix crash in _get_type_vars() (upstream #259) - Remove the +dict constraint in ForwardRef._eval_type (upstream #252) + +.. + +.. bpo: 27539 +.. date: 8743 +.. nonce: S4L1cq +.. section: Library + +Fix unnormalised ``Fraction.__pow__`` result in the case of negative +exponent and negative base. + +.. + +.. bpo: 21718 +.. date: 8742 +.. nonce: FUJd-7 +.. section: Library + +cursor.description is now available for queries using CTEs. + +.. + +.. bpo: 2466 +.. date: 8741 +.. nonce: VRNlkg +.. section: Library + +posixpath.ismount now correctly recognizes mount points which the user does +not have permission to access. + +.. + +.. bpo: 27773 +.. date: 8740 +.. nonce: hMSSeX +.. section: Library + +Correct some memory management errors server_hostname in _ssl.wrap_socket(). + +.. + +.. bpo: 26750 +.. date: 8739 +.. nonce: rv76vt +.. section: Library + +unittest.mock.create_autospec() now works properly for subclasses of +property() and other data descriptors. + +.. + +.. bpo: 0 +.. date: 8738 +.. nonce: Ny9oPv +.. section: Library + +In the curses module, raise an error if window.getstr() or window.instr() is +passed a negative value. + +.. + +.. bpo: 27783 +.. date: 8737 +.. nonce: cR1jXH +.. section: Library + +Fix possible usage of uninitialized memory in operator.methodcaller. + +.. + +.. bpo: 27774 +.. date: 8736 +.. nonce: FDcik1 +.. section: Library + +Fix possible Py_DECREF on unowned object in _sre. + +.. + +.. bpo: 27760 +.. date: 8735 +.. nonce: gxMjp4 +.. section: Library + +Fix possible integer overflow in binascii.b2a_qp. + +.. + +.. bpo: 27758 +.. date: 8734 +.. nonce: 0NRV03 +.. section: Library + +Fix possible integer overflow in the _csv module for large record lengths. + +.. + +.. bpo: 27568 +.. date: 8733 +.. nonce: OnuO9s +.. section: Library + +Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the HTTP_PROXY variable +when REQUEST_METHOD environment is set, which indicates that the script is +in CGI mode. + +.. + +.. bpo: 27656 +.. date: 8732 +.. nonce: joTscM +.. section: Library + +Do not assume sched.h defines any SCHED_* constants. + +.. + +.. bpo: 27130 +.. date: 8731 +.. nonce: SUxwXZ +.. section: Library + +In the "zlib" module, fix handling of large buffers (typically 4 GiB) when +compressing and decompressing. Previously, inputs were limited to 4 GiB, +and compression and decompression operations did not properly handle results +of 4 GiB. + +.. + +.. bpo: 27533 +.. date: 8730 +.. nonce: iDmKzV +.. section: Library + +Release GIL in nt._isdir + +.. + +.. bpo: 17711 +.. date: 8729 +.. nonce: 47AILJ +.. section: Library + +Fixed unpickling by the persistent ID with protocol 0. Original patch by +Alexandre Vassalotti. + +.. + +.. bpo: 27522 +.. date: 8728 +.. nonce: 8vVz_t +.. section: Library + +Avoid an unintentional reference cycle in email.feedparser. + +.. + +.. bpo: 26844 +.. date: 8727 +.. nonce: I0wdnY +.. section: Library + +Fix error message for imp.find_module() to refer to 'path' instead of +'name'. Patch by Lev Maximov. + +.. + +.. bpo: 23804 +.. date: 8726 +.. nonce: ipFvxc +.. section: Library + +Fix SSL zero-length recv() calls to not block and not raise an error about +unclean EOF. + +.. + +.. bpo: 27466 +.. date: 8725 +.. nonce: C_3a8E +.. section: Library + +Change time format returned by http.cookie.time2netscape, confirming the +netscape cookie format and making it consistent with documentation. + +.. + +.. bpo: 26664 +.. date: 8724 +.. nonce: OzsSzf +.. section: Library + +Fix activate.fish by removing mis-use of ``$``. + +.. + +.. bpo: 22115 +.. date: 8723 +.. nonce: apoFQ9 +.. section: Library + +Fixed tracing Tkinter variables: trace_vdelete() with wrong mode no longer +break tracing, trace_vinfo() now always returns a list of pairs of strings, +tracing in the "u" mode now works. + +.. + +.. bpo: 0 +.. date: 8722 +.. nonce: oZOeFE +.. section: Library + +Fix a scoping issue in importlib.util.LazyLoader which triggered an +UnboundLocalError when lazy-loading a module that was already put into +sys.modules. + +.. + +.. bpo: 27079 +.. date: 8721 +.. nonce: c7d0Ym +.. section: Library + +Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +.. + +.. bpo: 26754 +.. date: 8720 +.. nonce: J3n0QW +.. section: Library + +Some functions (compile() etc) accepted a filename argument encoded as an +iterable of integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 27048 +.. date: 8719 +.. nonce: EVe-Bk +.. section: Library + +Prevents distutils failing on Windows when environment variables contain +non-ASCII characters + +.. + +.. bpo: 27330 +.. date: 8718 +.. nonce: GJaFCV +.. section: Library + +Fixed possible leaks in the ctypes module. + +.. + +.. bpo: 27238 +.. date: 8717 +.. nonce: Q6v6Qv +.. section: Library + +Got rid of bare excepts in the turtle module. Original patch by Jelle +Zijlstra. + +.. + +.. bpo: 27122 +.. date: 8716 +.. nonce: 06t7zN +.. section: Library + +When an exception is raised within the context being managed by a +contextlib.ExitStack() and one of the exit stack generators catches and +raises it in a chain, do not re-raise the original exception when exiting, +let the new chained one through. This avoids the PEP 479 bug described in +issue25782. + +.. + +.. bpo: 27278 +.. date: 8715 +.. nonce: y_HkGw +.. original section: Library +.. section: Security + +Fix os.urandom() implementation using getrandom() on Linux. Truncate size +to INT_MAX and loop until we collected enough random bytes, instead of +casting a directly Py_ssize_t to int. + +.. + +.. bpo: 26386 +.. date: 8714 +.. nonce: 9L3Ut4 +.. section: Library + +Fixed ttk.TreeView selection operations with item id's containing spaces. + +.. + +.. bpo: 22636 +.. date: 8713 +.. nonce: 3fQW_g +.. original section: Library +.. section: Security + +Avoid shell injection problems with ctypes.util.find_library(). + +.. + +.. bpo: 16182 +.. date: 8712 +.. nonce: RgFXyr +.. section: Library + +Fix various functions in the "readline" module to use the locale encoding, +and fix get_begidx() and get_endidx() to return code point indexes. + +.. + +.. bpo: 27392 +.. date: 8711 +.. nonce: obfni7 +.. section: Library + +Add loop.connect_accepted_socket(). Patch by Jim Fulton. + +.. + +.. bpo: 27930 +.. date: 8710 +.. nonce: BkOfSi +.. section: Library + +Improved behaviour of logging.handlers.QueueListener. Thanks to Paulo +Andrade and Petr Viktorin for the analysis and patch. + +.. + +.. bpo: 21201 +.. date: 8709 +.. nonce: wLCKiA +.. section: Library + +Improves readability of multiprocessing error message. Thanks to Wojciech +Walczak for patch. + +.. + +.. bpo: 27456 +.. date: 8708 +.. nonce: lI_IE7 +.. section: Library + +asyncio: Set TCP_NODELAY by default. + +.. + +.. bpo: 27906 +.. date: 8707 +.. nonce: TBBXrv +.. section: Library + +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. + +.. + +.. bpo: 28174 +.. date: 8706 +.. nonce: CV1UdI +.. section: Library + +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. + +.. + +.. bpo: 26654 +.. date: 8705 +.. nonce: XtzTE9 +.. section: Library + +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. + +.. + +.. bpo: 26909 +.. date: 8704 +.. nonce: ASiakT +.. section: Library + +Fix slow pipes IO in asyncio. Patch by INADA Naoki. + +.. + +.. bpo: 28176 +.. date: 8703 +.. nonce: sU8R6L +.. section: Library + +Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +.. + +.. bpo: 27759 +.. date: 8702 +.. nonce: qpMDGq +.. section: Library + +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. + +.. + +.. bpo: 28368 +.. date: 8701 +.. nonce: n594X4 +.. section: Library + +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. + +.. + +.. bpo: 28369 +.. date: 8700 +.. nonce: 8DTANe +.. section: Library + +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. + +.. + +.. bpo: 28370 +.. date: 8699 +.. nonce: 18jBuZ +.. section: Library + +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. + +.. + +.. bpo: 28371 +.. date: 8698 +.. nonce: U9Zqdk +.. section: Library + +Deprecate passing asyncio.Handles to run_in_executor. + +.. + +.. bpo: 28372 +.. date: 8697 +.. nonce: njcIPk +.. section: Library + +Fix asyncio to support formatting of non-python coroutines. + +.. + +.. bpo: 28399 +.. date: 8696 +.. nonce: QKIqRX +.. section: Library + +Remove UNIX socket from FS before binding. Patch by ????????? ????. + +.. + +.. bpo: 27972 +.. date: 8695 +.. nonce: ZK-GFm +.. section: Library + +Prohibit Tasks to await on themselves. + +.. + +.. bpo: 26923 +.. date: 8694 +.. nonce: 8dh3AV +.. section: Library + +Fix asyncio.Gather to refuse being cancelled once all children are done. +Patch by Johannes Ebke. + +.. + +.. bpo: 26796 +.. date: 8693 +.. nonce: TZyAfJ +.. section: Library + +Don't configure the number of workers for default threadpool executor. +Initial patch by Hans Lawrenz. + +.. + +.. bpo: 28600 +.. date: 8692 +.. nonce: 2ThUQV +.. section: Library + +Optimize loop.call_soon(). + +.. + +.. bpo: 28613 +.. date: 8691 +.. nonce: sqUPrv +.. section: Library + +Fix get_event_loop() return the current loop if called from +coroutines/callbacks. + +.. + +.. bpo: 28639 +.. date: 8690 +.. nonce: WUPo1o +.. section: Library + +Fix inspect.isawaitable to always return bool Patch by Justin Mayfield. + +.. + +.. bpo: 28652 +.. date: 8689 +.. nonce: f5M8FG +.. section: Library + +Make loop methods reject socket kinds they do not support. + +.. + +.. bpo: 28653 +.. date: 8688 +.. nonce: S5bA9i +.. section: Library + +Fix a refleak in functools.lru_cache. + +.. + +.. bpo: 28703 +.. date: 8687 +.. nonce: CRLTJc +.. section: Library + +Fix asyncio.iscoroutinefunction to handle Mock objects. + +.. + +.. bpo: 24142 +.. date: 8686 +.. nonce: _BgogI +.. section: Library + +Reading a corrupt config file left the parser in an invalid state. Original +patch by Florian H?ch. + +.. + +.. bpo: 28990 +.. date: 8685 +.. nonce: W8tuYZ +.. section: Library + +Fix SSL hanging if connection is closed before handshake completed. (Patch +by HoHo-Ho) + +.. + +.. bpo: 15308 +.. date: 8684 +.. nonce: zZxn8m +.. section: IDLE + +Add 'interrupt execution' (^C) to Shell menu. Patch by Roger Serwy, updated +by Bayard Randel. + +.. + +.. bpo: 27922 +.. date: 8683 +.. nonce: UEtEv9 +.. section: IDLE + +Stop IDLE tests from 'flashing' gui widgets on the screen. + +.. + +.. bpo: 0 +.. date: 8682 +.. nonce: zWZs6o +.. section: IDLE + +Add version to title of IDLE help window. + +.. + +.. bpo: 25564 +.. date: 8681 +.. nonce: GN0p14 +.. section: IDLE + +In section on IDLE -- console differences, mention that using exec means +that __builtins__ is defined for each statement. + +.. + +.. bpo: 27714 +.. date: 8680 +.. nonce: bUEDsI +.. section: IDLE + +text_textview and test_autocomplete now pass when re-run in the same +process. This occurs when test_idle fails when run with the -w option but +without -jn. Fix warning from test_config. + +.. + +.. bpo: 25507 +.. date: 8679 +.. nonce: lxf68d +.. section: IDLE + +IDLE no longer runs buggy code because of its tkinter imports. Users must +include the same imports required to run directly in Python. + +.. + +.. bpo: 27452 +.. date: 8678 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 27365 +.. date: 8677 +.. nonce: y7ys_A +.. section: IDLE + +Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +.. + +.. bpo: 27245 +.. date: 8676 +.. nonce: u9aKO1 +.. section: IDLE + +IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE +was started from a console or by import, a cascade of warnings was emitted. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 28808 +.. date: 8675 +.. nonce: A03X6r +.. section: C API + +PyUnicode_CompareWithASCIIString() now never raises exceptions. + +.. + +.. bpo: 26754 +.. date: 8674 +.. nonce: j2czHF +.. section: C API + +PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of +integers. Now only strings and bytes-like objects are accepted. + +.. + +.. bpo: 28513 +.. date: 8673 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 28950 +.. date: 8672 +.. nonce: 9_vY6R +.. section: Tests + +Disallow -j0 to be combined with -T/-l/-M in regrtest command line +arguments. + +.. + +.. bpo: 28666 +.. date: 8671 +.. nonce: RtTk-4 +.. section: Tests + +Now test.support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 8670 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 28409 +.. date: 8669 +.. nonce: Q2IlxJ +.. section: Tests + +regrtest: fix the parser of command line arguments. + +.. + +.. bpo: 27787 +.. date: 8668 +.. nonce: kf0YAt +.. section: Tests + +Call gc.collect() before checking each test for "dangling threads", since +the dangling threads are weak references. + +.. + +.. bpo: 27369 +.. date: 8667 +.. nonce: LG7U2D +.. section: Tests + +In test_pyexpat, avoid testing an error message detail that changed in Expat +2.2.0. + +.. + +.. bpo: 27952 +.. date: 8666 +.. nonce: WX9Ufc +.. section: Tools/Demos + +Get Tools/scripts/fixcid.py working with Python 3 and the current "re" +module, avoid invalid Python backslash escapes, and fix a bug parsing +escaped C quote signs. + +.. + +.. bpo: 27332 +.. date: 8665 +.. nonce: OuRZp9 +.. section: Tools/Demos + +Fixed the type of the first argument of module-level functions generated by +Argument Clinic. Patch by Petr Viktorin. + +.. + +.. bpo: 27418 +.. date: 8664 +.. nonce: W2m_8I +.. section: Tools/Demos + +Fixed Tools/importbench/importbench.py. + +.. + +.. bpo: 28251 +.. date: 8663 +.. nonce: tR_AFs +.. section: Windows + +Improvements to help manuals on Windows. + +.. + +.. bpo: 28110 +.. date: 8662 +.. nonce: cnkP5F +.. section: Windows + +launcher.msi has different product codes between 32-bit and 64-bit + +.. + +.. bpo: 25144 +.. date: 8661 +.. nonce: iUha52 +.. section: Windows + +Ensures TargetDir is set before continuing with custom install. + +.. + +.. bpo: 27469 +.. date: 8660 +.. nonce: 0GwDkX +.. section: Windows + +Adds a shell extension to the launcher so that drag and drop works +correctly. + +.. + +.. bpo: 27309 +.. date: 8659 +.. nonce: 4DPjhF +.. section: Windows + +Enabled proper Windows styles in python[w].exe manifest. + +.. + +.. bpo: 29080 +.. date: 8658 +.. nonce: b3qLQT +.. section: Build + +Removes hard dependency on hg.exe from PCBuild/build.bat + +.. + +.. bpo: 23903 +.. date: 8657 +.. nonce: JXJ889 +.. section: Build + +Added missed names to PC/python3.def. + +.. + +.. bpo: 10656 +.. date: 8656 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 8655 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28444 +.. date: 8654 +.. nonce: zkc9nT +.. section: Build + +Fix missing extensions modules when cross compiling. + +.. + +.. bpo: 28248 +.. date: 8653 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 28258 +.. date: 8652 +.. nonce: iKtAHd +.. section: Build + +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 8651 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 28066 +.. date: 8650 +.. nonce: _3xImV +.. section: Build + +Fix the logic that searches build directories for generated include files +when building outside the source tree. + +.. + +.. bpo: 15819 +.. date: 8649 +.. nonce: QVDr3E +.. section: Build + +Remove redundant include search directory option for building outside the +source tree. + +.. + +.. bpo: 27566 +.. date: 8648 +.. nonce: xDWjEb +.. section: Build + +Fix clean target in freeze makefile (patch by Lisa Roach) + +.. + +.. bpo: 27705 +.. date: 8647 +.. nonce: 8C2Ms3 +.. section: Build + +Update message in validate_ucrtbase.py + +.. + +.. bpo: 27983 +.. date: 8646 +.. nonce: jL_1n8 +.. section: Build + +Cause lack of llvm-profdata tool when using clang as required for PGO +linking to be a configure time error rather than make time when --with- +optimizations is enabled. Also improve our ability to find the llvm- +profdata tool on MacOS and some Linuxes. + +.. + +.. bpo: 26307 +.. date: 8645 +.. nonce: Puk2rd +.. section: Build + +The profile-opt build now applies PGO to the built-in modules. + +.. + +.. bpo: 26359 +.. date: 8644 +.. nonce: WXBL-Y +.. section: Build + +Add the --with-optimizations configure flag. + +.. + +.. bpo: 27713 +.. date: 8643 +.. nonce: _3DgXG +.. section: Build + +Suppress spurious build warnings when updating importlib's bootstrap files. +Patch by Xiang Zhang + +.. + +.. bpo: 25825 +.. date: 8642 +.. nonce: JD8aRp +.. section: Build + +Correct the references to Modules/python.exp and ld_so_aix, which are +required on AIX. This updates references to an installation path that was +changed in 3.2a4, and undoes changed references to the build tree that were +made in 3.5.0a1. + +.. + +.. bpo: 27453 +.. date: 8641 +.. nonce: Pb5DBi +.. section: Build + +CPP invocation in configure must use CPPFLAGS. Patch by Chi Hsuan Yen. + +.. + +.. bpo: 27641 +.. date: 8640 +.. nonce: eGzgCk +.. section: Build + +The configure script now inserts comments into the makefile to prevent the +pgen and _freeze_importlib executables from being cross- compiled. + +.. + +.. bpo: 26662 +.. date: 8639 +.. nonce: XkwRxM +.. section: Build + +Set PYTHON_FOR_GEN in configure as the Python program to be used for file +generation during the build. + +.. + +.. bpo: 10910 +.. date: 8638 +.. nonce: ZdRayb +.. section: Build + +Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD +version checks for the original ctype UTF-8 workaround. + +.. + +.. bpo: 28676 +.. date: 8637 +.. nonce: Wxf6Ds +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. diff --git a/Misc/NEWS.d/3.6.0.rst b/Misc/NEWS.d/3.6.0.rst new file mode 100644 index 00000000000..f9805cab286 --- /dev/null +++ b/Misc/NEWS.d/3.6.0.rst @@ -0,0 +1,7 @@ +.. bpo: 0 +.. date: 9796 +.. no changes: True +.. nonce: F9ENBV +.. release date: 2016-12-23 + +No changes since release candidate 2 diff --git a/Misc/NEWS.d/3.6.0a1.rst b/Misc/NEWS.d/3.6.0a1.rst new file mode 100644 index 00000000000..e9745fb3033 --- /dev/null +++ b/Misc/NEWS.d/3.6.0a1.rst @@ -0,0 +1,3941 @@ +.. bpo: 20041 +.. date: 9253 +.. nonce: TypyGp +.. release date: 2016-05-16 +.. section: Core and Builtins + +Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. + +.. + +.. bpo: 26168 +.. date: 9252 +.. nonce: -nPBL6 +.. section: Core and Builtins + +Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. + +.. + +.. bpo: 26991 +.. date: 9251 +.. nonce: yWGNhz +.. section: Core and Builtins + +Fix possible refleak when creating a function with annotations. + +.. + +.. bpo: 27039 +.. date: 9250 +.. nonce: oO-wLV +.. section: Core and Builtins + +Fixed bytearray.remove() for values greater than 127. Based on patch by Joe +Jevnik. + +.. + +.. bpo: 23640 +.. date: 9249 +.. nonce: kvNC4c +.. section: Core and Builtins + +int.from_bytes() no longer bypasses constructors for subclasses. + +.. + +.. bpo: 27005 +.. date: 9248 +.. nonce: ZtcJf- +.. section: Core and Builtins + +Optimized the float.fromhex() class method for exact float. It is now 2 +times faster. + +.. + +.. bpo: 18531 +.. date: 9247 +.. nonce: PkXgtO +.. section: Core and Builtins + +Single var-keyword argument of dict subtype was passed unscathed to the +C-defined function. Now it is converted to exact dict. + +.. + +.. bpo: 26811 +.. date: 9246 +.. nonce: oNzUWt +.. section: Core and Builtins + +gc.get_objects() no longer contains a broken tuple with NULL pointer. + +.. + +.. bpo: 20120 +.. date: 9245 +.. nonce: c-FZZc +.. section: Core and Builtins + +Use RawConfigParser for .pypirc parsing, removing support for interpolation +unintentionally added with move to Python 3. Behavior no longer does any +interpolation in .pypirc files, matching behavior in Python 2.7 and +Setuptools 19.0. + +.. + +.. bpo: 26249 +.. date: 9244 +.. nonce: ZbpWF3 +.. section: Core and Builtins + +Memory functions of the :c:func:`PyMem_Malloc` domain +(:c:data:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc allocator +` rather than system :c:func:`malloc`. Applications calling +:c:func:`PyMem_Malloc` without holding the GIL can now crash: use +``PYTHONMALLOC=debug`` environment variable to validate the usage of memory +allocators in your application. + +.. + +.. bpo: 26802 +.. date: 9243 +.. nonce: hWpU4v +.. section: Core and Builtins + +Optimize function calls only using unpacking like ``func(*tuple)`` (no other +positional argument, no keyword): avoid copying the tuple. Patch written by +Joe Jevnik. + +.. + +.. bpo: 26659 +.. date: 9242 +.. nonce: 5PRa83 +.. section: Core and Builtins + +Make the builtin slice type support cycle collection. + +.. + +.. bpo: 26718 +.. date: 9241 +.. nonce: K5PQ8j +.. section: Core and Builtins + +super.__init__ no longer leaks memory if called multiple times. NOTE: A +direct call of super.__init__ is not endorsed! + +.. + +.. bpo: 27138 +.. date: 9240 +.. nonce: ifYEro +.. section: Core and Builtins + +Fix the doc comment for FileFinder.find_spec(). + +.. + +.. bpo: 27147 +.. date: 9239 +.. nonce: tCCgmH +.. section: Core and Builtins + +Mention PEP 420 in the importlib docs. + +.. + +.. bpo: 25339 +.. date: 9238 +.. nonce: ZcaC2E +.. section: Core and Builtins + +PYTHONIOENCODING now has priority over locale in setting the error handler +for stdin and stdout. + +.. + +.. bpo: 26494 +.. date: 9237 +.. nonce: G6eXIi +.. section: Core and Builtins + +Fixed crash on iterating exhausting iterators. Affected classes are generic +sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, +frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator. + +.. + +.. bpo: 26574 +.. date: 9236 +.. nonce: D2YL_w +.. section: Core and Builtins + +Optimize ``bytes.replace(b'', b'.')`` and ``bytearray.replace(b'', b'.')``. +Patch written by Josh Snider. + +.. + +.. bpo: 26581 +.. date: 9235 +.. nonce: yNA7nm +.. section: Core and Builtins + +If coding cookie is specified multiple times on a line in Python source code +file, only the first one is taken to account. + +.. + +.. bpo: 19711 +.. date: 9234 +.. nonce: gDDPJE +.. section: Core and Builtins + +Add tests for reloading namespace packages. + +.. + +.. bpo: 21099 +.. date: 9233 +.. nonce: CuMWZJ +.. section: Core and Builtins + +Switch applicable importlib tests to use PEP 451 API. + +.. + +.. bpo: 26563 +.. date: 9232 +.. nonce: lyrB2Q +.. section: Core and Builtins + +Debug hooks on Python memory allocators now raise a fatal error if functions +of the :c:func:`PyMem_Malloc` family are called without holding the GIL. + +.. + +.. bpo: 26564 +.. date: 9231 +.. nonce: xeRXaz +.. section: Core and Builtins + +On error, the debug hooks on Python memory allocators now use the +:mod:`tracemalloc` module to get the traceback where a memory block was +allocated. + +.. + +.. bpo: 26558 +.. date: 9230 +.. nonce: s05jz7 +.. section: Core and Builtins + +The debug hooks on Python memory allocator :c:func:`PyObject_Malloc` now +detect when functions are called without holding the GIL. + +.. + +.. bpo: 26516 +.. date: 9229 +.. nonce: OjekqZ +.. section: Core and Builtins + +Add :envvar:`PYTHONMALLOC` environment variable to set the Python memory +allocators and/or install debug hooks. + +.. + +.. bpo: 26516 +.. date: 9228 +.. nonce: chNJuF +.. section: Core and Builtins + +The :c:func:`PyMem_SetupDebugHooks` function can now also be used on Python +compiled in release mode. + +.. + +.. bpo: 26516 +.. date: 9227 +.. nonce: q7fu1f +.. section: Core and Builtins + +The :envvar:`PYTHONMALLOCSTATS` environment variable can now also be used on +Python compiled in release mode. It now has no effect if set to an empty +string. + +.. + +.. bpo: 26516 +.. date: 9226 +.. nonce: 2k9k6R +.. section: Core and Builtins + +In debug mode, debug hooks are now also installed on Python memory +allocators when Python is configured without pymalloc. + +.. + +.. bpo: 26464 +.. date: 9225 +.. nonce: 7BreGz +.. section: Core and Builtins + +Fix str.translate() when string is ASCII and first replacements removes +character, but next replacement uses a non-ASCII character or a string +longer than 1 character. Regression introduced in Python 3.5.0. + +.. + +.. bpo: 22836 +.. date: 9224 +.. nonce: cimt1y +.. section: Core and Builtins + +Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() +are sensible even when formatting them produces secondary errors. This +affects the reports produced by sys.__excepthook__() and when __del__() +raises an exception. + +.. + +.. bpo: 26302 +.. date: 9223 +.. nonce: UD9XQt +.. section: Core and Builtins + +Correct behavior to reject comma as a legal character for cookie names. + +.. + +.. bpo: 26136 +.. date: 9222 +.. nonce: eZ0t1K +.. section: Core and Builtins + +Upgrade the warning when a generator raises StopIteration from +PendingDeprecationWarning to DeprecationWarning. Patch by Anish Shah. + +.. + +.. bpo: 26204 +.. date: 9221 +.. nonce: x3Zp8E +.. section: Core and Builtins + +The compiler now ignores all constant statements: bytes, str, int, float, +complex, name constants (None, False, True), Ellipsis and ast.Constant; not +only str and int. For example, ``1.0`` is now ignored in ``def f(): 1.0``. + +.. + +.. bpo: 4806 +.. date: 9220 +.. nonce: i9m3hj +.. section: Core and Builtins + +Avoid masking the original TypeError exception when using star (``*``) +unpacking in function calls. Based on patch by Hagen F?rstenau and Daniel +Urban. + +.. + +.. bpo: 26146 +.. date: 9219 +.. nonce: HKrUth +.. section: Core and Builtins + +Add a new kind of AST node: ``ast.Constant``. It can be used by external AST +optimizers, but the compiler does not emit directly such node. + +.. + +.. bpo: 23601 +.. date: 9218 +.. nonce: 2E4seG +.. section: Core and Builtins + +Sped-up allocation of dict key objects by using Python's small object +allocator. (Contributed by Julian Taylor.) + +.. + +.. bpo: 18018 +.. date: 9217 +.. nonce: XKKap3 +.. section: Core and Builtins + +Import raises ImportError instead of SystemError if a relative import is +attempted without a known parent package. + +.. + +.. bpo: 25843 +.. date: 9216 +.. nonce: NtJZie +.. section: Core and Builtins + +When compiling code, don't merge constants if they are equal but have a +different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now +correctly compiled to two different functions: ``f1()`` returns ``1`` +(``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and +``1.0`` are equal. + +.. + +.. bpo: 26107 +.. date: 9215 +.. nonce: q0LBMY +.. section: Core and Builtins + +The format of the ``co_lnotab`` attribute of code objects changes to support +negative line number delta. + +.. + +.. bpo: 26154 +.. date: 9214 +.. nonce: MtnRAH +.. section: Core and Builtins + +Add a new private _PyThreadState_UncheckedGet() function to get the current +Python thread state, but don't issue a fatal error if it is NULL. This new +function must be used instead of accessing directly the +_PyThreadState_Current variable. The variable is no more exposed since +Python 3.5.1 to hide the exact implementation of atomic C types, to avoid +compiler issues. + +.. + +.. bpo: 25791 +.. date: 9213 +.. nonce: gllzPw +.. section: Core and Builtins + +If __package__ != __spec__.parent or if neither __package__ or __spec__ are +defined then ImportWarning is raised. + +.. + +.. bpo: 22995 +.. date: 9212 +.. nonce: KYNKvs +.. section: Core and Builtins + +[UPDATE] Comment out the one of the pickleability tests in +_PyObject_GetState() due to regressions observed in Cython-based projects. + +.. + +.. bpo: 25961 +.. date: 9211 +.. nonce: Hdjjw0 +.. section: Core and Builtins + +Disallowed null characters in the type name. + +.. + +.. bpo: 25973 +.. date: 9210 +.. nonce: Ud__ZP +.. section: Core and Builtins + +Fix segfault when an invalid nonlocal statement binds a name starting with +two underscores. + +.. + +.. bpo: 22995 +.. date: 9209 +.. nonce: Wq0E86 +.. section: Core and Builtins + +Instances of extension types with a state that aren't subclasses of list or +dict and haven't implemented any pickle-related methods (__reduce__, +__reduce_ex__, __getnewargs__, __getnewargs_ex__, or __getstate__), can no +longer be pickled. Including memoryview. + +.. + +.. bpo: 20440 +.. date: 9208 +.. nonce: GCwOfH +.. section: Core and Builtins + +Massive replacing unsafe attribute setting code with special macro +Py_SETREF. + +.. + +.. bpo: 25766 +.. date: 9207 +.. nonce: jn93Yu +.. section: Core and Builtins + +Special method __bytes__() now works in str subclasses. + +.. + +.. bpo: 25421 +.. date: 9206 +.. nonce: c47YEL +.. section: Core and Builtins + +__sizeof__ methods of builtin types now use dynamic basic size. This allows +sys.getsize() to work correctly with their subclasses with __slots__ +defined. + +.. + +.. bpo: 25709 +.. date: 9205 +.. nonce: WwGm2k +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 5319 +.. date: 9204 +.. nonce: HxlGwI +.. section: Core and Builtins + +New Py_FinalizeEx() API allowing Python to set an exit status of 120 on +failure to flush buffered streams. + +.. + +.. bpo: 25485 +.. date: 9203 +.. nonce: 9qnaPt +.. section: Core and Builtins + +telnetlib.Telnet is now a context manager. + +.. + +.. bpo: 24097 +.. date: 9202 +.. nonce: Vt4E-i +.. section: Core and Builtins + +Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. + +.. + +.. bpo: 24731 +.. date: 9201 +.. nonce: h9-hnz +.. section: Core and Builtins + +Fixed crash on converting objects with special methods __bytes__, __trunc__, +and __float__ returning instances of subclasses of bytes, int, and float to +subclasses of bytes, int, and float correspondingly. + +.. + +.. bpo: 25630 +.. date: 9200 +.. nonce: ZxzcoY +.. section: Core and Builtins + +Fix a possible segfault during argument parsing in functions that accept +filesystem paths. + +.. + +.. bpo: 23564 +.. date: 9199 +.. nonce: XHarGG +.. section: Core and Builtins + +Fixed a partially broken sanity check in the _posixsubprocess internals +regarding how fds_to_pass were passed to the child. The bug had no actual +impact as subprocess.py already avoided it. + +.. + +.. bpo: 25388 +.. date: 9198 +.. nonce: zm3uuQ +.. section: Core and Builtins + +Fixed tokenizer crash when processing undecodable source code with a null +byte. + +.. + +.. bpo: 25462 +.. date: 9197 +.. nonce: eXDzgO +.. section: Core and Builtins + +The hash of the key now is calculated only once in most operations in C +implementation of OrderedDict. + +.. + +.. bpo: 22995 +.. date: 9196 +.. nonce: 90kpuP +.. section: Core and Builtins + +Default implementation of __reduce__ and __reduce_ex__ now rejects builtin +types with not defined __new__. + +.. + +.. bpo: 24802 +.. date: 9195 +.. nonce: Qie066 +.. section: Core and Builtins + +Avoid buffer overreads when int(), float(), compile(), exec() and eval() are +passed bytes-like objects. These objects are not necessarily terminated by +a null byte, but the functions assumed they were. + +.. + +.. bpo: 25555 +.. date: 9194 +.. nonce: MUpG-j +.. section: Core and Builtins + +Fix parser and AST: fill lineno and col_offset of "arg" node when compiling +AST from Python objects. + +.. + +.. bpo: 24726 +.. date: 9193 +.. nonce: AHk4v2 +.. section: Core and Builtins + +Fixed a crash and leaking NULL in repr() of OrderedDict that was mutated by +direct calls of dict methods. + +.. + +.. bpo: 25449 +.. date: 9192 +.. nonce: VqTOFi +.. section: Core and Builtins + +Iterating OrderedDict with keys with unstable hash now raises KeyError in C +implementations as well as in Python implementation. + +.. + +.. bpo: 25395 +.. date: 9191 +.. nonce: htkE3W +.. section: Core and Builtins + +Fixed crash when highly nested OrderedDict structures were garbage +collected. + +.. + +.. bpo: 25401 +.. date: 9190 +.. nonce: ofrAtd +.. section: Core and Builtins + +Optimize bytes.fromhex() and bytearray.fromhex(): they are now between 2x +and 3.5x faster. + +.. + +.. bpo: 25399 +.. date: 9189 +.. nonce: dNKIhY +.. section: Core and Builtins + +Optimize bytearray % args using the new private _PyBytesWriter API. +Formatting is now between 2.5 and 5 times faster. + +.. + +.. bpo: 25274 +.. date: 9188 +.. nonce: QCGvAF +.. section: Core and Builtins + +sys.setrecursionlimit() now raises a RecursionError if the new recursion +limit is too low depending at the current recursion depth. Modify also the +"lower-water mark" formula to make it monotonic. This mark is used to decide +when the overflowed flag of the thread state is reset. + +.. + +.. bpo: 24402 +.. date: 9187 +.. nonce: MAgi3X +.. section: Core and Builtins + +Fix input() to prompt to the redirected stdout when sys.stdout.fileno() +fails. + +.. + +.. bpo: 25349 +.. date: 9186 +.. nonce: 7lBgJ8 +.. section: Core and Builtins + +Optimize bytes % args using the new private _PyBytesWriter API. Formatting +is now up to 2 times faster. + +.. + +.. bpo: 24806 +.. date: 9185 +.. nonce: Nb0znT +.. section: Core and Builtins + +Prevent builtin types that are not allowed to be subclassed from being +subclassed through multiple inheritance. + +.. + +.. bpo: 25301 +.. date: 9184 +.. nonce: hUTCfr +.. section: Core and Builtins + +The UTF-8 decoder is now up to 15 times as fast for error handlers: +``ignore``, ``replace`` and ``surrogateescape``. + +.. + +.. bpo: 24848 +.. date: 9183 +.. nonce: HlUSuy +.. section: Core and Builtins + +Fixed a number of bugs in UTF-7 decoding of misformed data. + +.. + +.. bpo: 25267 +.. date: 9182 +.. nonce: SW8Gs6 +.. section: Core and Builtins + +The UTF-8 encoder is now up to 75 times as fast for error handlers: +``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``. Patch co- +written with Serhiy Storchaka. + +.. + +.. bpo: 25280 +.. date: 9181 +.. nonce: ivTMwd +.. section: Core and Builtins + +Import trace messages emitted in verbose (-v) mode are no longer formatted +twice. + +.. + +.. bpo: 25227 +.. date: 9180 +.. nonce: 19v5rp +.. section: Core and Builtins + +Optimize ASCII and latin1 encoders with the ``surrogateescape`` error +handler: the encoders are now up to 3 times as fast. Initial patch written +by Serhiy Storchaka. + +.. + +.. bpo: 25003 +.. date: 9179 +.. nonce: _ban92 +.. section: Core and Builtins + +On Solaris 11.3 or newer, os.urandom() now uses the getrandom() function +instead of the getentropy() function. The getentropy() function is blocking +to generate very good quality entropy, os.urandom() doesn't need such high- +quality entropy. + +.. + +.. bpo: 9232 +.. date: 9178 +.. nonce: pjsmWw +.. section: Core and Builtins + +Modify Python's grammar to allow trailing commas in the argument list of a +function declaration. For example, "def f(\*, a = 3,): pass" is now legal. +Patch from Mark Dickinson. + +.. + +.. bpo: 24965 +.. date: 9177 +.. nonce: wfyxbB +.. section: Core and Builtins + +Implement PEP 498 "Literal String Interpolation". This allows you to embed +expressions inside f-strings, which are converted to normal strings at run +time. Given x=3, then f'value={x}' == 'value=3'. Patch by Eric V. Smith. + +.. + +.. bpo: 26478 +.. date: 9176 +.. nonce: n0dB8e +.. section: Core and Builtins + +Fix semantic bugs when using binary operators with dictionary views and +tuples. + +.. + +.. bpo: 26171 +.. date: 9175 +.. nonce: 8SaQEa +.. section: Core and Builtins + +Fix possible integer overflow and heap corruption in zipimporter.get_data(). + +.. + +.. bpo: 25660 +.. date: 9174 +.. nonce: 93DzBo +.. section: Core and Builtins + +Fix TAB key behaviour in REPL with readline. + +.. + +.. bpo: 26288 +.. date: 9173 +.. nonce: f67RLk +.. section: Core and Builtins + +Optimize PyLong_AsDouble. + +.. + +.. bpo: 26289 +.. date: 9172 +.. nonce: uG9ozG +.. section: Core and Builtins + +Optimize floor and modulo division for single-digit longs. Microbenchmarks +show 2-2.5x improvement. Built-in 'divmod' function is now also ~10% +faster. (See also: bpo-26315) + +.. + +.. bpo: 25887 +.. date: 9171 +.. nonce: PtVIX7 +.. section: Core and Builtins + +Raise a RuntimeError when a coroutine object is awaited more than once. + +.. + +.. bpo: 27057 +.. date: 9170 +.. nonce: YzTA_Q +.. section: Library + +Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails +with EACCESS. The function now falls back to fcntl(). Patch written by +Micha? Bednarski. + +.. + +.. bpo: 27014 +.. date: 9169 +.. nonce: ui7Khn +.. section: Library + +Fix infinite recursion using typing.py. Thanks to Kalle Tuure! + +.. + +.. bpo: 27031 +.. date: 9168 +.. nonce: FtvDPs +.. section: Library + +Removed dummy methods in Tkinter widget classes: tk_menuBar() and +tk_bindForTraversal(). + +.. + +.. bpo: 14132 +.. date: 9167 +.. nonce: 5wR9MN +.. section: Library + +Fix urllib.request redirect handling when the target only has a query +string. Original fix by J?n Janech. + +.. + +.. bpo: 17214 +.. date: 9166 +.. nonce: lUbZOV +.. section: Library + +The "urllib.request" module now percent-encodes non-ASCII bytes found in +redirect target URLs. Some servers send Location header fields with non- +ASCII bytes, but "http.client" requires the request target to be ASCII- +encodable, otherwise a UnicodeEncodeError is raised. Based on patch by +Christian Heimes. + +.. + +.. bpo: 27033 +.. date: 9165 +.. nonce: o4XIPr +.. section: Library + +The default value of the decode_data parameter for smtpd.SMTPChannel and +smtpd.SMTPServer constructors is changed to False. + +.. + +.. bpo: 27034 +.. date: 9164 +.. nonce: ptzz_S +.. section: Library + +Removed deprecated class asynchat.fifo. + +.. + +.. bpo: 26870 +.. date: 9163 +.. nonce: 5tCUlp +.. section: Library + +Added readline.set_auto_history(), which can stop entries being +automatically added to the history list. Based on patch by Tyler Crompton. + +.. + +.. bpo: 26039 +.. date: 9162 +.. nonce: JnXjiE +.. section: Library + +zipfile.ZipFile.open() can now be used to write data into a ZIP file, as +well as for extracting data. Patch by Thomas Kluyver. + +.. + +.. bpo: 26892 +.. date: 9161 +.. nonce: XIXb0h +.. section: Library + +Honor debuglevel flag in urllib.request.HTTPHandler. Patch contributed by +Chi Hsuan Yen. + +.. + +.. bpo: 22274 +.. date: 9160 +.. nonce: 0RHDMN +.. section: Library + +In the subprocess module, allow stderr to be redirected to stdout even when +stdout is not redirected. Patch by Akira Li. + +.. + +.. bpo: 26807 +.. date: 9159 +.. nonce: LXSPP6 +.. section: Library + +mock_open 'files' no longer error on readline at end of file. Patch from +Yolanda Robla. + +.. + +.. bpo: 25745 +.. date: 9158 +.. nonce: -n8acU +.. section: Library + +Fixed leaking a userptr in curses panel destructor. + +.. + +.. bpo: 26977 +.. date: 9157 +.. nonce: 5G4HtL +.. section: Library + +Removed unnecessary, and ignored, call to sum of squares helper in +statistics.pvariance. + +.. + +.. bpo: 26002 +.. date: 9156 +.. nonce: bVD4pW +.. section: Library + +Use bisect in statistics.median instead of a linear search. Patch by Upendra +Kuma. + +.. + +.. bpo: 25974 +.. date: 9155 +.. nonce: cpOy5R +.. section: Library + +Make use of new Decimal.as_integer_ratio() method in statistics module. +Patch by Stefan Krah. + +.. + +.. bpo: 26996 +.. date: 9154 +.. nonce: LR__VD +.. section: Library + +Add secrets module as described in PEP 506. + +.. + +.. bpo: 26881 +.. date: 9153 +.. nonce: mdiq_L +.. section: Library + +The modulefinder module now supports extended opcode arguments. + +.. + +.. bpo: 23815 +.. date: 9152 +.. nonce: _krNe8 +.. section: Library + +Fixed crashes related to directly created instances of types in _tkinter and +curses.panel modules. + +.. + +.. bpo: 17765 +.. date: 9151 +.. nonce: hiSVS1 +.. section: Library + +weakref.ref() no longer silently ignores keyword arguments. Patch by Georg +Brandl. + +.. + +.. bpo: 26873 +.. date: 9150 +.. nonce: cYXRcH +.. section: Library + +xmlrpc now raises ResponseError on unsupported type tags instead of silently +return incorrect result. + +.. + +.. bpo: 26915 +.. date: 9149 +.. nonce: GoQKUL +.. section: Library + +The __contains__ methods in the collections ABCs now check for identity +before checking equality. This better matches the behavior of the concrete +classes, allows sensible handling of NaNs, and makes it easier to reason +about container invariants. + +.. + +.. bpo: 26711 +.. date: 9148 +.. nonce: Eu85Qw +.. section: Library + +Fixed the comparison of plistlib.Data with other types. + +.. + +.. bpo: 24114 +.. date: 9147 +.. nonce: RMRMtM +.. section: Library + +Fix an uninitialized variable in `ctypes.util`. + +The bug only occurs on SunOS when the ctypes implementation searches for the +`crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. + +.. + +.. bpo: 26864 +.. date: 9146 +.. nonce: 1KgGds +.. section: Library + +In urllib.request, change the proxy bypass host checking against no_proxy to +be case-insensitive, and to not match unrelated host names that happen to +have a bypassed hostname as a suffix. Patch by Xiang Zhang. + +.. + +.. bpo: 24902 +.. date: 9145 +.. nonce: bwWpLj +.. section: Library + +Print server URL on http.server startup. Initial patch by Felix Kaiser. + +.. + +.. bpo: 25788 +.. date: 9144 +.. nonce: 9weIV5 +.. section: Library + +fileinput.hook_encoded() now supports an "errors" argument for passing to +open. Original patch by Joseph Hackman. + +.. + +.. bpo: 26634 +.. date: 9143 +.. nonce: FZvsSb +.. section: Library + +recursive_repr() now sets __qualname__ of wrapper. Patch by Xiang Zhang. + +.. + +.. bpo: 26804 +.. date: 9142 +.. nonce: 9Orp-G +.. section: Library + +urllib.request will prefer lower_case proxy environment variables over +UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter Jansen. + +.. + +.. bpo: 26837 +.. date: 9141 +.. nonce: 2FXGsD +.. section: Library + +assertSequenceEqual() now correctly outputs non-stringified differing items +(like bytes in the -b mode). This affects assertListEqual() and +assertTupleEqual(). + +.. + +.. bpo: 26041 +.. date: 9140 +.. nonce: bVem-p +.. section: Library + +Remove "will be removed in Python 3.7" from deprecation messages of +platform.dist() and platform.linux_distribution(). Patch by Kumaripaba +Miyurusara Athukorala. + +.. + +.. bpo: 26822 +.. date: 9139 +.. nonce: rYSL4W +.. section: Library + +itemgetter, attrgetter and methodcaller objects no longer silently ignore +keyword arguments. + +.. + +.. bpo: 26733 +.. date: 9138 +.. nonce: YxaJmL +.. section: Library + +Disassembling a class now disassembles class and static methods. Patch by +Xiang Zhang. + +.. + +.. bpo: 26801 +.. date: 9137 +.. nonce: TQGY-7 +.. section: Library + +Fix error handling in :func:`shutil.get_terminal_size`, catch +:exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel +Barry. + +.. + +.. bpo: 24838 +.. date: 9136 +.. nonce: 3Pfx8T +.. section: Library + +tarfile's ustar and gnu formats now correctly calculate name and link field +limits for multibyte character encodings like utf-8. + +.. + +.. bpo: 26657 +.. date: 9135 +.. nonce: C_-XFg +.. original section: Library +.. section: Security + +Fix directory traversal vulnerability with http.server on Windows. This +fixes a regression that was introduced in 3.3.4rc1 and 3.4.0rc1. Based on +patch by Philipp Hagemeister. + +.. + +.. bpo: 26717 +.. date: 9134 +.. nonce: jngTdu +.. section: Library + +Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by Anthony Sottile. + +.. + +.. bpo: 26782 +.. date: 9133 +.. nonce: JWLPrH +.. section: Library + +Add STARTUPINFO to subprocess.__all__ on Windows. + +.. + +.. bpo: 26404 +.. date: 9132 +.. nonce: hXw7Bs +.. section: Library + +Add context manager to socketserver. Patch by Aviv Palivoda. + +.. + +.. bpo: 26735 +.. date: 9131 +.. nonce: riSl3b +.. section: Library + +Fix :func:`os.urandom` on Solaris 11.3 and newer when reading more than +1,024 bytes: call ``getrandom()`` multiple times with a limit of 1024 bytes +per call. + +.. + +.. bpo: 26585 +.. date: 9130 +.. nonce: kfb749 +.. section: Library + +Eliminate http.server._quote_html() and use html.escape(quote=False). Patch +by Xiang Zhang. + +.. + +.. bpo: 26685 +.. date: 9129 +.. nonce: sI_1Ff +.. section: Library + +Raise OSError if closing a socket fails. + +.. + +.. bpo: 16329 +.. date: 9128 +.. nonce: nuXD8W +.. section: Library + +Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 13952 +.. date: 9127 +.. nonce: SOoTVE +.. section: Library + +Add .csv to mimetypes.types_map. Patch by Geoff Wilson. + +.. + +.. bpo: 26587 +.. date: 9126 +.. nonce: Qo-B6C +.. section: Library + +the site module now allows .pth files to specify files to be added to +sys.path (e.g. zip files). + +.. + +.. bpo: 25609 +.. date: 9125 +.. nonce: t1ydQM +.. section: Library + +Introduce contextlib.AbstractContextManager and typing.ContextManager. + +.. + +.. bpo: 26709 +.. date: 9124 +.. nonce: luOPbP +.. section: Library + +Fixed Y2038 problem in loading binary PLists. + +.. + +.. bpo: 23735 +.. date: 9123 +.. nonce: Y5oQ9r +.. section: Library + +Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH +handler. Patch by Eric Price. + +.. + +.. bpo: 25951 +.. date: 9122 +.. nonce: 1CUASJ +.. section: Library + +Change SSLSocket.sendall() to return None, as explicitly documented for +plain socket objects. Patch by Aviv Palivoda. + +.. + +.. bpo: 26586 +.. date: 9121 +.. nonce: V5pZNa +.. section: Library + +In http.server, respond with "413 Request header fields too large" if there +are too many header fields to parse, rather than killing the connection and +raising an unhandled exception. Patch by Xiang Zhang. + +.. + +.. bpo: 26676 +.. date: 9120 +.. nonce: zLRFed +.. section: Library + +Added missing XMLPullParser to ElementTree.__all__. + +.. + +.. bpo: 22854 +.. date: 9119 +.. nonce: K3rMEH +.. section: Library + +Change BufferedReader.writable() and BufferedWriter.readable() to always +return False. + +.. + +.. bpo: 26492 +.. date: 9118 +.. nonce: YN18iz +.. section: Library + +Exhausted iterator of array.array now conforms with the behavior of +iterators of other mutable sequences: it lefts exhausted even if iterated +array is extended. + +.. + +.. bpo: 26641 +.. date: 9117 +.. nonce: 1ICQz0 +.. section: Library + +doctest.DocFileTest and doctest.testfile() now support packages (module +splitted into multiple directories) for the package parameter. + +.. + +.. bpo: 25195 +.. date: 9116 +.. nonce: EOc4Po +.. section: Library + +Fix a regression in mock.MagicMock. _Call is a subclass of tuple (changeset +3603bae63c13 only works for classes) so we need to implement __ne__ +ourselves. Patch by Andrew Plummer. + +.. + +.. bpo: 26644 +.. date: 9115 +.. nonce: 7tt1tk +.. section: Library + +Raise ValueError rather than SystemError when a negative length is passed to +SSLSocket.recv() or read(). + +.. + +.. bpo: 23804 +.. date: 9114 +.. nonce: PP63Ff +.. section: Library + +Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to +1024. + +.. + +.. bpo: 26616 +.. date: 9113 +.. nonce: v3QwdD +.. section: Library + +Fixed a bug in datetime.astimezone() method. + +.. + +.. bpo: 26637 +.. date: 9112 +.. nonce: ttiUf7 +.. section: Library + +The :mod:`importlib` module now emits an :exc:`ImportError` rather than a +:exc:`TypeError` if :func:`__import__` is tried during the Python shutdown +process but :data:`sys.path` is already cleared (set to ``None``). + +.. + +.. bpo: 21925 +.. date: 9111 +.. nonce: xFz-hR +.. section: Library + +:func:`warnings.formatwarning` now catches exceptions when calling +:func:`linecache.getline` and :func:`tracemalloc.get_object_traceback` to be +able to log :exc:`ResourceWarning` emitted late during the Python shutdown +process. + +.. + +.. bpo: 23848 +.. date: 9110 +.. nonce: RkKqPi +.. section: Library + +On Windows, faulthandler.enable() now also installs an exception handler to +dump the traceback of all Python threads on any Windows exception, not only +on UNIX signals (SIGSEGV, SIGFPE, SIGABRT). + +.. + +.. bpo: 26530 +.. date: 9109 +.. nonce: RWN1jR +.. section: Library + +Add C functions :c:func:`_PyTraceMalloc_Track` and +:c:func:`_PyTraceMalloc_Untrack` to track memory blocks using the +:mod:`tracemalloc` module. Add :c:func:`_PyTraceMalloc_GetTraceback` to get +the traceback of an object. + +.. + +.. bpo: 26588 +.. date: 9108 +.. nonce: uen0XP +.. section: Library + +The _tracemalloc now supports tracing memory allocations of multiple address +spaces (domains). + +.. + +.. bpo: 24266 +.. date: 9107 +.. nonce: YZgVyM +.. section: Library + +Ctrl+C during Readline history search now cancels the search mode when +compiled with Readline 7. + +.. + +.. bpo: 26590 +.. date: 9106 +.. nonce: qEy91x +.. section: Library + +Implement a safe finalizer for the _socket.socket type. It now releases the +GIL to close the socket. + +.. + +.. bpo: 18787 +.. date: 9105 +.. nonce: rWyzgA +.. section: Library + +spwd.getspnam() now raises a PermissionError if the user doesn't have +privileges. + +.. + +.. bpo: 26560 +.. date: 9104 +.. nonce: A4WXNz +.. section: Library + +Avoid potential ValueError in BaseHandler.start_response. Initial patch by +Peter Inglesby. + +.. + +.. bpo: 26567 +.. date: 9103 +.. nonce: kcC99B +.. section: Library + +Add a new function :c:func:`PyErr_ResourceWarning` function to pass the +destroyed object. Add a *source* attribute to +:class:`warnings.WarningMessage`. Add warnings._showwarnmsg() which uses +tracemalloc to get the traceback where source object was allocated. + +.. + +.. bpo: 26313 +.. date: 9102 +.. nonce: LjZAjy +.. original section: Library +.. section: Security + +ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch +by Baji. + +.. + +.. bpo: 26569 +.. date: 9101 +.. nonce: EX8vF1 +.. section: Library + +Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` to support +importing packages. + +.. + +.. bpo: 26499 +.. date: 9100 +.. nonce: NP08PI +.. section: Library + +Account for remaining Content-Length in HTTPResponse.readline() and read1(). +Based on patch by Silent Ghost. Also document that HTTPResponse now supports +these methods. + +.. + +.. bpo: 25320 +.. date: 9099 +.. nonce: V96LIy +.. section: Library + +Handle sockets in directories unittest discovery is scanning. Patch from +Victor van den Elzen. + +.. + +.. bpo: 16181 +.. date: 9098 +.. nonce: P7lLvo +.. section: Library + +cookiejar.http2time() now returns None if year is higher than +datetime.MAXYEAR. + +.. + +.. bpo: 26513 +.. date: 9097 +.. nonce: HoPepy +.. section: Library + +Fixes platform module detection of Windows Server + +.. + +.. bpo: 23718 +.. date: 9096 +.. nonce: AMPC0o +.. section: Library + +Fixed parsing time in week 0 before Jan 1. Original patch by Tam?s Bence +Gedai. + +.. + +.. bpo: 26323 +.. date: 9095 +.. nonce: KkZqEj +.. section: Library + +Add Mock.assert_called() and Mock.assert_called_once() methods to +unittest.mock. Patch written by Amit Saha. + +.. + +.. bpo: 20589 +.. date: 9094 +.. nonce: NsQ_I1 +.. section: Library + +Invoking Path.owner() and Path.group() on Windows now raise +NotImplementedError instead of ImportError. + +.. + +.. bpo: 26177 +.. date: 9093 +.. nonce: HlSWer +.. section: Library + +Fixed the keys() method for Canvas and Scrollbar widgets. + +.. + +.. bpo: 15068 +.. date: 9092 +.. nonce: xokEVC +.. section: Library + +Got rid of excessive buffering in fileinput. The bufsize parameter is now +deprecated and ignored. + +.. + +.. bpo: 19475 +.. date: 9091 +.. nonce: MH2HH9 +.. section: Library + +Added an optional argument timespec to the datetime isoformat() method to +choose the precision of the time component. + +.. + +.. bpo: 2202 +.. date: 9090 +.. nonce: dk9sd0 +.. section: Library + +Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls. +Initial patch by Mathieu Dupuy. + +.. + +.. bpo: 26167 +.. date: 9089 +.. nonce: 3F-d12 +.. section: Library + +Minimized overhead in copy.copy() and copy.deepcopy(). Optimized copying and +deepcopying bytearrays, NotImplemented, slices, short lists, tuples, dicts, +sets. + +.. + +.. bpo: 25718 +.. date: 9088 +.. nonce: 4EjZyv +.. section: Library + +Fixed pickling and copying the accumulate() iterator with total is None. + +.. + +.. bpo: 26475 +.. date: 9087 +.. nonce: JXVccY +.. section: Library + +Fixed debugging output for regular expressions with the (?x) flag. + +.. + +.. bpo: 26482 +.. date: 9086 +.. nonce: d635gW +.. section: Library + +Allowed pickling recursive dequeues. + +.. + +.. bpo: 26335 +.. date: 9085 +.. nonce: iXw5Yb +.. section: Library + +Make mmap.write() return the number of bytes written like other write +methods. Patch by Jakub Stasiak. + +.. + +.. bpo: 26457 +.. date: 9084 +.. nonce: Xe6Clh +.. section: Library + +Fixed the subnets() methods in IP network classes for the case when +resulting prefix length is equal to maximal prefix length. Based on patch by +Xiang Zhang. + +.. + +.. bpo: 26385 +.. date: 9083 +.. nonce: 50bDXm +.. section: Library + +Remove the file if the internal open() call in NamedTemporaryFile() fails. +Patch by Silent Ghost. + +.. + +.. bpo: 26402 +.. date: 9082 +.. nonce: k7DVuU +.. section: Library + +Fix XML-RPC client to retry when the server shuts down a persistent +connection. This was a regression related to the new +http.client.RemoteDisconnected exception in 3.5.0a4. + +.. + +.. bpo: 25913 +.. date: 9081 +.. nonce: 5flb95 +.. section: Library + +Leading ``<~`` is optional now in base64.a85decode() with adobe=True. Patch +by Swati Jaiswal. + +.. + +.. bpo: 26186 +.. date: 9080 +.. nonce: R9rfiL +.. section: Library + +Remove an invalid type check in importlib.util.LazyLoader. + +.. + +.. bpo: 26367 +.. date: 9079 +.. nonce: Qct-9S +.. section: Library + +importlib.__import__() raises ImportError like builtins.__import__() when +``level`` is specified but without an accompanying package specified. + +.. + +.. bpo: 26309 +.. date: 9078 +.. nonce: ubEeiz +.. section: Library + +In the "socketserver" module, shut down the request (closing the connected +socket) when verify_request() returns false. Patch by Aviv Palivoda. + +.. + +.. bpo: 23430 +.. date: 9077 +.. nonce: s_mLiA +.. section: Library + +Change the socketserver module to only catch exceptions raised from a +request handler that are derived from Exception (instead of BaseException). +Therefore SystemExit and KeyboardInterrupt no longer trigger the +handle_error() method, and will now to stop a single-threaded server. + +.. + +.. bpo: 25939 +.. date: 9076 +.. nonce: X49Fqd +.. original section: Library +.. section: Security + +On Windows open the cert store readonly in ssl.enum_certificates. + +.. + +.. bpo: 25995 +.. date: 9075 +.. nonce: NfcimP +.. section: Library + +os.walk() no longer uses FDs proportional to the tree depth. + +.. + +.. bpo: 25994 +.. date: 9074 +.. nonce: ga9rT- +.. section: Library + +Added the close() method and the support of the context manager protocol for +the os.scandir() iterator. + +.. + +.. bpo: 23992 +.. date: 9073 +.. nonce: O0Hhvc +.. section: Library + +multiprocessing: make MapResult not fail-fast upon exception. + +.. + +.. bpo: 26243 +.. date: 9072 +.. nonce: 41WSpF +.. section: Library + +Support keyword arguments to zlib.compress(). Patch by Aviv Palivoda. + +.. + +.. bpo: 26117 +.. date: 9071 +.. nonce: ne6p11 +.. section: Library + +The os.scandir() iterator now closes file descriptor not only when the +iteration is finished, but when it was failed with error. + +.. + +.. bpo: 25949 +.. date: 9070 +.. nonce: -Lh9vz +.. section: Library + +__dict__ for an OrderedDict instance is now created only when needed. + +.. + +.. bpo: 25911 +.. date: 9069 +.. nonce: d4Zadh +.. section: Library + +Restored support of bytes paths in os.walk() on Windows. + +.. + +.. bpo: 26045 +.. date: 9068 +.. nonce: WmzUrX +.. section: Library + +Add UTF-8 suggestion to error message when posting a non-Latin-1 string with +http.client. + +.. + +.. bpo: 26039 +.. date: 9067 +.. nonce: a5Bxm4 +.. section: Library + +Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir(). Patch by +Thomas Kluyver. + +.. + +.. bpo: 12923 +.. date: 9066 +.. nonce: HPAu-B +.. section: Library + +Reset FancyURLopener's redirect counter even if there is an exception. +Based on patches by Brian Brazil and Daniel Rocco. + +.. + +.. bpo: 25945 +.. date: 9065 +.. nonce: guNgNM +.. section: Library + +Fixed a crash when unpickle the functools.partial object with wrong state. +Fixed a leak in failed functools.partial constructor. "args" and "keywords" +attributes of functools.partial have now always types tuple and dict +correspondingly. + +.. + +.. bpo: 26202 +.. date: 9064 +.. nonce: LPIXLg +.. section: Library + +copy.deepcopy() now correctly copies range() objects with non-atomic +attributes. + +.. + +.. bpo: 23076 +.. date: 9063 +.. nonce: 8rphoP +.. section: Library + +Path.glob() now raises a ValueError if it's called with an invalid pattern. +Patch by Thomas Nyberg. + +.. + +.. bpo: 19883 +.. date: 9062 +.. nonce: z9TsO6 +.. section: Library + +Fixed possible integer overflows in zipimport. + +.. + +.. bpo: 26227 +.. date: 9061 +.. nonce: Fe6oiB +.. section: Library + +On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions +of the socket module now decode the hostname from the ANSI code page rather +than UTF-8. + +.. + +.. bpo: 26099 +.. date: 9060 +.. nonce: CH5jer +.. section: Library + +The site module now writes an error into stderr if sitecustomize module can +be imported but executing the module raise an ImportError. Same change for +usercustomize. + +.. + +.. bpo: 26147 +.. date: 9059 +.. nonce: i-Jc01 +.. section: Library + +xmlrpc now works with strings not encodable with used non-UTF-8 encoding. + +.. + +.. bpo: 25935 +.. date: 9058 +.. nonce: cyni91 +.. section: Library + +Garbage collector now breaks reference loops with OrderedDict. + +.. + +.. bpo: 16620 +.. date: 9057 +.. nonce: rxpn_Y +.. section: Library + +Fixed AttributeError in msilib.Directory.glob(). + +.. + +.. bpo: 26013 +.. date: 9056 +.. nonce: 93RKNz +.. section: Library + +Added compatibility with broken protocol 2 pickles created in old Python 3 +versions (3.4.3 and lower). + +.. + +.. bpo: 26129 +.. date: 9055 +.. nonce: g4RQZd +.. section: Library + +Deprecated accepting non-integers in grp.getgrgid(). + +.. + +.. bpo: 25850 +.. date: 9054 +.. nonce: jwFPxj +.. section: Library + +Use cross-compilation by default for 64-bit Windows. + +.. + +.. bpo: 25822 +.. date: 9053 +.. nonce: 0Eafyi +.. section: Library + +Add docstrings to the fields of urllib.parse results. Patch contributed by +Swati Jaiswal. + +.. + +.. bpo: 22642 +.. date: 9052 +.. nonce: PEgS9F +.. section: Library + +Convert trace module option parsing mechanism to argparse. Patch contributed +by SilentGhost. + +.. + +.. bpo: 24705 +.. date: 9051 +.. nonce: IZYwjR +.. section: Library + +Fix sysconfig._parse_makefile not expanding ${} vars appearing before $() +vars. + +.. + +.. bpo: 26069 +.. date: 9050 +.. nonce: NaF4lN +.. section: Library + +Remove the deprecated apis in the trace module. + +.. + +.. bpo: 22138 +.. date: 9049 +.. nonce: nRNYkc +.. section: Library + +Fix mock.patch behavior when patching descriptors. Restore original values +after patching. Patch contributed by Sean McCully. + +.. + +.. bpo: 25672 +.. date: 9048 +.. nonce: fw9RJP +.. section: Library + +In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode option if it is +safe to do so. + +.. + +.. bpo: 26012 +.. date: 9047 +.. nonce: IFSXNm +.. section: Library + +Don't traverse into symlinks for ``**`` pattern in pathlib.Path.[r]glob(). + +.. + +.. bpo: 24120 +.. date: 9046 +.. nonce: Yiwa0h +.. section: Library + +Ignore PermissionError when traversing a tree with pathlib.Path.[r]glob(). +Patch by Ulrich Petri. + +.. + +.. bpo: 21815 +.. date: 9045 +.. nonce: h7-UY8 +.. section: Library + +Accept ] characters in the data portion of imap responses, in order to +handle the flags with square brackets accepted and produced by servers such +as gmail. + +.. + +.. bpo: 25447 +.. date: 9044 +.. nonce: -4m4xO +.. section: Library + +fileinput now uses sys.stdin as-is if it does not have a buffer attribute +(restores backward compatibility). + +.. + +.. bpo: 25971 +.. date: 9043 +.. nonce: vhMeG0 +.. section: Library + +Optimized creating Fractions from floats by 2 times and from Decimals by 3 +times. + +.. + +.. bpo: 25802 +.. date: 9042 +.. nonce: Y2KOnA +.. section: Library + +Document as deprecated the remaining implementations of +importlib.abc.Loader.load_module(). + +.. + +.. bpo: 25928 +.. date: 9041 +.. nonce: JsQfKK +.. section: Library + +Add Decimal.as_integer_ratio(). + +.. + +.. bpo: 25447 +.. date: 9040 +.. nonce: ajPRDy +.. section: Library + +Copying the lru_cache() wrapper object now always works, independently from +the type of the wrapped object (by returning the original object unchanged). + +.. + +.. bpo: 25768 +.. date: 9039 +.. nonce: GDj2ip +.. section: Library + +Have the functions in compileall return booleans instead of ints and add +proper documentation and tests for the return values. + +.. + +.. bpo: 24103 +.. date: 9038 +.. nonce: WufqrQ +.. section: Library + +Fixed possible use after free in ElementTree.XMLPullParser. + +.. + +.. bpo: 25860 +.. date: 9037 +.. nonce: 0hActb +.. section: Library + +os.fwalk() no longer skips remaining directories when error occurs. +Original patch by Samson Lee. + +.. + +.. bpo: 25914 +.. date: 9036 +.. nonce: h0V61F +.. section: Library + +Fixed and simplified OrderedDict.__sizeof__. + +.. + +.. bpo: 25869 +.. date: 9035 +.. nonce: eAnRH5 +.. section: Library + +Optimized deepcopying ElementTree; it is now 20 times faster. + +.. + +.. bpo: 25873 +.. date: 9034 +.. nonce: L4Fgjm +.. section: Library + +Optimized iterating ElementTree. Iterating elements Element.iter() is now +40% faster, iterating text Element.itertext() is now up to 2.5 times faster. + +.. + +.. bpo: 25902 +.. date: 9033 +.. nonce: 6t2FmH +.. section: Library + +Fixed various refcount issues in ElementTree iteration. + +.. + +.. bpo: 22227 +.. date: 9032 +.. nonce: 5utM-Q +.. section: Library + +The TarFile iterator is reimplemented using generator. This implementation +is simpler that using class. + +.. + +.. bpo: 25638 +.. date: 9031 +.. nonce: yitRj4 +.. section: Library + +Optimized ElementTree.iterparse(); it is now 2x faster. Optimized +ElementTree parsing; it is now 10% faster. + +.. + +.. bpo: 25761 +.. date: 9030 +.. nonce: JGgMOP +.. section: Library + +Improved detecting errors in broken pickle data. + +.. + +.. bpo: 25717 +.. date: 9029 +.. nonce: 0_xjaK +.. section: Library + +Restore the previous behaviour of tolerating most fstat() errors when +opening files. This was a regression in 3.5a1, and stopped anonymous +temporary files from working in special cases. + +.. + +.. bpo: 24903 +.. date: 9028 +.. nonce: 3LBdzb +.. section: Library + +Fix regression in number of arguments compileall accepts when '-d' is +specified. The check on the number of arguments has been dropped completely +as it never worked correctly anyway. + +.. + +.. bpo: 25764 +.. date: 9027 +.. nonce: 7WWG07 +.. section: Library + +In the subprocess module, preserve any exception caused by fork() failure +when preexec_fn is used. + +.. + +.. bpo: 25771 +.. date: 9026 +.. nonce: It-7Qf +.. section: Library + +Tweak the exception message for importlib.util.resolve_name() when 'package' +isn't specified but necessary. + +.. + +.. bpo: 6478 +.. date: 9025 +.. nonce: -Bi9Hb +.. section: Library + +_strptime's regexp cache now is reset after changing timezone with +time.tzset(). + +.. + +.. bpo: 14285 +.. date: 9024 +.. nonce: UyG8Hj +.. section: Library + +When executing a package with the "python -m package" option, and package +initialization fails, a proper traceback is now reported. The "runpy" +module now lets exceptions from package initialization pass back to the +caller, rather than raising ImportError. + +.. + +.. bpo: 19771 +.. date: 9023 +.. nonce: 5NG-bg +.. section: Library + +Also in runpy and the "-m" option, omit the irrelevant message ". . . is a +package and cannot be directly executed" if the package could not even be +initialized (e.g. due to a bad ``*.pyc`` file). + +.. + +.. bpo: 25177 +.. date: 9022 +.. nonce: aNR4Ha +.. section: Library + +Fixed problem with the mean of very small and very large numbers. As a side +effect, statistics.mean and statistics.variance should be significantly +faster. + +.. + +.. bpo: 25718 +.. date: 9021 +.. nonce: D9mHZF +.. section: Library + +Fixed copying object with state with boolean value is false. + +.. + +.. bpo: 10131 +.. date: 9020 +.. nonce: a7tptz +.. section: Library + +Fixed deep copying of minidom documents. Based on patch by Marian Ganisin. + +.. + +.. bpo: 7990 +.. date: 9019 +.. nonce: fpvQxH +.. section: Library + +dir() on ElementTree.Element now lists properties: "tag", "text", "tail" and +"attrib". Original patch by Santoso Wijaya. + +.. + +.. bpo: 25725 +.. date: 9018 +.. nonce: XIKv3R +.. section: Library + +Fixed a reference leak in pickle.loads() when unpickling invalid data +including tuple instructions. + +.. + +.. bpo: 25663 +.. date: 9017 +.. nonce: Ofwfqa +.. section: Library + +In the Readline completer, avoid listing duplicate global names, and search +the global namespace before searching builtins. + +.. + +.. bpo: 25688 +.. date: 9016 +.. nonce: 8P1HOv +.. section: Library + +Fixed file leak in ElementTree.iterparse() raising an error. + +.. + +.. bpo: 23914 +.. date: 9015 +.. nonce: 1sEz4J +.. section: Library + +Fixed SystemError raised by unpickler on broken pickle data. + +.. + +.. bpo: 25691 +.. date: 9014 +.. nonce: ZEaapY +.. section: Library + +Fixed crash on deleting ElementTree.Element attributes. + +.. + +.. bpo: 25624 +.. date: 9013 +.. nonce: ed-fM0 +.. section: Library + +ZipFile now always writes a ZIP_STORED header for directory entries. Patch +by Dingyuan Wang. + +.. + +.. bpo: 25626 +.. date: 9012 +.. nonce: TQ3fvb +.. section: Library + +Change three zlib functions to accept sizes that fit in Py_ssize_t, but +internally cap those sizes to UINT_MAX. This resolves a regression in 3.5 +where GzipFile.read() failed to read chunks larger than 2 or 4 GiB. The +change affects the zlib.Decompress.decompress() max_length parameter, the +zlib.decompress() bufsize parameter, and the zlib.Decompress.flush() length +parameter. + +.. + +.. bpo: 25583 +.. date: 9011 +.. nonce: Gk-cim +.. section: Library + +Avoid incorrect errors raised by os.makedirs(exist_ok=True) when the OS +gives priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 25593 +.. date: 9010 +.. nonce: 56uegI +.. section: Library + +Change semantics of EventLoop.stop() in asyncio. + +.. + +.. bpo: 6973 +.. date: 9009 +.. nonce: nl5cHt +.. section: Library + +When we know a subprocess.Popen process has died, do not allow the +send_signal(), terminate(), or kill() methods to do anything as they could +potentially signal a different process. + +.. + +.. bpo: 23883 +.. date: 9008 +.. nonce: OQS5sS +.. section: Library + +Added missing APIs to __all__ to match the documented APIs for the following +modules: calendar, csv, enum, fileinput, ftplib, logging, optparse, tarfile, +threading and wave. Also added a test.support.check__all__() helper. +Patches by Jacek Ko?odziej, Mauro S. M. Rodrigues and Joel Taddei. + +.. + +.. bpo: 25590 +.. date: 9007 +.. nonce: KPcnfv +.. section: Library + +In the Readline completer, only call getattr() once per attribute. Also +complete names of attributes such as properties and slots which are listed +by dir() but not yet created on an instance. + +.. + +.. bpo: 25498 +.. date: 9006 +.. nonce: AvqEBl +.. section: Library + +Fix a crash when garbage-collecting ctypes objects created by wrapping a +memoryview. This was a regression made in 3.5a1. Based on patch by +Eryksun. + +.. + +.. bpo: 25584 +.. date: 9005 +.. nonce: 124mYw +.. section: Library + +Added "escape" to the __all__ list in the glob module. + +.. + +.. bpo: 25584 +.. date: 9004 +.. nonce: ZeWX0J +.. section: Library + +Fixed recursive glob() with patterns starting with ``**``. + +.. + +.. bpo: 25446 +.. date: 9003 +.. nonce: k1DByx +.. section: Library + +Fix regression in smtplib's AUTH LOGIN support. + +.. + +.. bpo: 18010 +.. date: 9002 +.. nonce: Azyf1C +.. section: Library + +Fix the pydoc web server's module search function to handle exceptions from +importing packages. + +.. + +.. bpo: 25554 +.. date: 9001 +.. nonce: UM9MlR +.. section: Library + +Got rid of circular references in regular expression parsing. + +.. + +.. bpo: 18973 +.. date: 9000 +.. nonce: Am9jFL +.. section: Library + +Command-line interface of the calendar module now uses argparse instead of +optparse. + +.. + +.. bpo: 25510 +.. date: 8999 +.. nonce: 79g7LA +.. section: Library + +fileinput.FileInput.readline() now returns b'' instead of '' at the end if +the FileInput was opened with binary mode. Patch by Ryosuke Ito. + +.. + +.. bpo: 25503 +.. date: 8998 +.. nonce: Zea0Y7 +.. section: Library + +Fixed inspect.getdoc() for inherited docstrings of properties. Original +patch by John Mark Vandenberg. + +.. + +.. bpo: 25515 +.. date: 8997 +.. nonce: fQsyYG +.. section: Library + +Always use os.urandom as a source of randomness in uuid.uuid4. + +.. + +.. bpo: 21827 +.. date: 8996 +.. nonce: k2oreR +.. section: Library + +Fixed textwrap.dedent() for the case when largest common whitespace is a +substring of smallest leading whitespace. Based on patch by Robert Li. + +.. + +.. bpo: 25447 +.. date: 8995 +.. nonce: eDYc4t +.. section: Library + +The lru_cache() wrapper objects now can be copied and pickled (by returning +the original object unchanged). + +.. + +.. bpo: 25390 +.. date: 8994 +.. nonce: 6mSgRq +.. section: Library + +typing: Don't crash on Union[str, Pattern]. + +.. + +.. bpo: 25441 +.. date: 8993 +.. nonce: d7zph6 +.. section: Library + +asyncio: Raise error from drain() when socket is closed. + +.. + +.. bpo: 25410 +.. date: 8992 +.. nonce: QAs_3B +.. section: Library + +Cleaned up and fixed minor bugs in C implementation of OrderedDict. + +.. + +.. bpo: 25411 +.. date: 8991 +.. nonce: qsJTCb +.. section: Library + +Improved Unicode support in SMTPHandler through better use of the email +package. Thanks to user simon04 for the patch. + +.. + +.. bpo: 0 +.. date: 8990 +.. nonce: pFHJ0i +.. section: Library + +Move the imp module from a PendingDeprecationWarning to DeprecationWarning. + +.. + +.. bpo: 25407 +.. date: 8989 +.. nonce: ukNt1D +.. section: Library + +Remove mentions of the formatter module being removed in Python 3.6. + +.. + +.. bpo: 25406 +.. date: 8988 +.. nonce: 5MZKU_ +.. section: Library + +Fixed a bug in C implementation of OrderedDict.move_to_end() that caused +segmentation fault or hang in iterating after moving several items to the +start of ordered dict. + +.. + +.. bpo: 25382 +.. date: 8987 +.. nonce: XQ44yE +.. section: Library + +pickletools.dis() now outputs implicit memo index for the MEMOIZE opcode. + +.. + +.. bpo: 25357 +.. date: 8986 +.. nonce: ebqGy- +.. section: Library + +Add an optional newline paramer to binascii.b2a_base64(). base64.b64encode() +uses it to avoid a memory copy. + +.. + +.. bpo: 24164 +.. date: 8985 +.. nonce: oi6H3E +.. section: Library + +Objects that need calling ``__new__`` with keyword arguments, can now be +pickled using pickle protocols older than protocol version 4. + +.. + +.. bpo: 25364 +.. date: 8984 +.. nonce: u_1Wi6 +.. section: Library + +zipfile now works in threads disabled builds. + +.. + +.. bpo: 25328 +.. date: 8983 +.. nonce: Rja1Xg +.. section: Library + +smtpd's SMTPChannel now correctly raises a ValueError if both decode_data +and enable_SMTPUTF8 are set to true. + +.. + +.. bpo: 16099 +.. date: 8982 +.. nonce: _MTt3k +.. section: Library + +RobotFileParser now supports Crawl-delay and Request-rate extensions. Patch +by Nikolay Bogoychev. + +.. + +.. bpo: 25316 +.. date: 8981 +.. nonce: dHQHWI +.. section: Library + +distutils raises OSError instead of DistutilsPlatformError when MSVC is not +installed. + +.. + +.. bpo: 25380 +.. date: 8980 +.. nonce: sKZ6-I +.. section: Library + +Fixed protocol for the STACK_GLOBAL opcode in pickletools.opcodes. + +.. + +.. bpo: 23972 +.. date: 8979 +.. nonce: s2g30g +.. section: Library + +Updates asyncio datagram create method allowing reuseport and reuseaddr +socket options to be set prior to binding the socket. Mirroring the existing +asyncio create_server method the reuseaddr option for datagram sockets +defaults to True if the O/S is 'posix' (except if the platform is Cygwin). +Patch by Chris Laws. + +.. + +.. bpo: 25304 +.. date: 8978 +.. nonce: CsmLyI +.. section: Library + +Add asyncio.run_coroutine_threadsafe(). This lets you submit a coroutine to +a loop from another thread, returning a concurrent.futures.Future. By +Vincent Michel. + +.. + +.. bpo: 25232 +.. date: 8977 +.. nonce: KhKjCE +.. section: Library + +Fix CGIRequestHandler to split the query from the URL at the first question +mark (?) rather than the last. Patch from Xiang Zhang. + +.. + +.. bpo: 24657 +.. date: 8976 +.. nonce: h2Ag7y +.. section: Library + +Prevent CGIRequestHandler from collapsing slashes in the query part of the +URL as if it were a path. Patch from Xiang Zhang. + +.. + +.. bpo: 25287 +.. date: 8975 +.. nonce: KhzzMW +.. section: Library + +Don't add crypt.METHOD_CRYPT to crypt.methods if it's not supported. Check +if it is supported, it may not be supported on OpenBSD for example. + +.. + +.. bpo: 23600 +.. date: 8974 +.. nonce: 7J_RD5 +.. section: Library + +Default implementation of tzinfo.fromutc() was returning wrong results in +some cases. + +.. + +.. bpo: 25203 +.. date: 8973 +.. nonce: IgDEbt +.. section: Library + +Failed readline.set_completer_delims() no longer left the module in +inconsistent state. + +.. + +.. bpo: 25011 +.. date: 8972 +.. nonce: VcaCd6 +.. section: Library + +rlcompleter now omits private and special attribute names unless the prefix +starts with underscores. + +.. + +.. bpo: 25209 +.. date: 8971 +.. nonce: WxKcdJ +.. section: Library + +rlcompleter now can add a space or a colon after completed keyword. + +.. + +.. bpo: 22241 +.. date: 8970 +.. nonce: a-Mtw2 +.. section: Library + +timezone.utc name is now plain 'UTC', not 'UTC-00:00'. + +.. + +.. bpo: 23517 +.. date: 8969 +.. nonce: 0ABp8q +.. section: Library + +fromtimestamp() and utcfromtimestamp() methods of datetime.datetime now +round microseconds to nearest with ties going to nearest even integer +(ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity +(ROUND_FLOOR). + +.. + +.. bpo: 23552 +.. date: 8968 +.. nonce: I0T-M- +.. section: Library + +Timeit now warns when there is substantial (4x) variance between best and +worst times. Patch from Serhiy Storchaka. + +.. + +.. bpo: 24633 +.. date: 8967 +.. nonce: 6Unn9B +.. section: Library + +site-packages/README -> README.txt. + +.. + +.. bpo: 24879 +.. date: 8966 +.. nonce: YUzg_z +.. section: Library + +help() and pydoc can now list named tuple fields in the order they were +defined rather than alphabetically. The ordering is determined by the +_fields attribute if present. + +.. + +.. bpo: 24874 +.. date: 8965 +.. nonce: luBfgA +.. section: Library + +Improve speed of itertools.cycle() and make its pickle more compact. + +.. + +.. bpo: 0 +.. date: 8964 +.. nonce: mD-_3v +.. section: Library + +Fix crash in itertools.cycle.__setstate__() when the first argument wasn't a +list. + +.. + +.. bpo: 20059 +.. date: 8963 +.. nonce: SHv0Ji +.. section: Library + +urllib.parse raises ValueError on all invalid ports. Patch by Martin Panter. + +.. + +.. bpo: 24360 +.. date: 8962 +.. nonce: 5RwH-e +.. section: Library + +Improve __repr__ of argparse.Namespace() for invalid identifiers. Patch by +Matthias Bussonnier. + +.. + +.. bpo: 23426 +.. date: 8961 +.. nonce: PUV-Cx +.. section: Library + +run_setup was broken in distutils. Patch from Alexander Belopolsky. + +.. + +.. bpo: 13938 +.. date: 8960 +.. nonce: e5NSE1 +.. section: Library + +2to3 converts StringTypes to a tuple. Patch from Mark Hammond. + +.. + +.. bpo: 2091 +.. date: 8959 +.. nonce: bp56pO +.. section: Library + +open() accepted a 'U' mode string containing '+', but 'U' can only be used +with 'r'. Patch from Jeff Balogh and John O'Connor. + +.. + +.. bpo: 8585 +.. date: 8958 +.. nonce: 78hPc2 +.. section: Library + +improved tests for zipimporter2. Patch from Mark Lawrence. + +.. + +.. bpo: 18622 +.. date: 8957 +.. nonce: i6nCCW +.. section: Library + +unittest.mock.mock_open().reset_mock would recurse infinitely. Patch from +Nicola Palumbo and Laurent De Buyst. + +.. + +.. bpo: 24426 +.. date: 8956 +.. nonce: yCtQfT +.. section: Library + +Fast searching optimization in regular expressions now works for patterns +that starts with capturing groups. Fast searching optimization now can't be +disabled at compile time. + +.. + +.. bpo: 23661 +.. date: 8955 +.. nonce: 5VHJmh +.. section: Library + +unittest.mock side_effects can now be exceptions again. This was a +regression vs Python 3.4. Patch from Ignacio Rossi + +.. + +.. bpo: 13248 +.. date: 8954 +.. nonce: SA2hvu +.. section: Library + +Remove deprecated inspect.getmoduleinfo function. + +.. + +.. bpo: 25578 +.. date: 8953 +.. nonce: G6S-ft +.. section: Library + +Fix (another) memory leak in SSLSocket.getpeercer(). + +.. + +.. bpo: 25530 +.. date: 8952 +.. nonce: hDFkwu +.. section: Library + +Disable the vulnerable SSLv3 protocol by default when creating +ssl.SSLContext. + +.. + +.. bpo: 25569 +.. date: 8951 +.. nonce: CfvQjK +.. section: Library + +Fix memory leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 25471 +.. date: 8950 +.. nonce: T0A02M +.. section: Library + +Sockets returned from accept() shouldn't appear to be nonblocking. + +.. + +.. bpo: 25319 +.. date: 8949 +.. nonce: iyuglv +.. section: Library + +When threading.Event is reinitialized, the underlying condition should use a +regular lock rather than a recursive lock. + +.. + +.. bpo: 0 +.. date: 8948 +.. nonce: rtZyid +.. section: Library + +Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26050 +.. date: 8947 +.. nonce: sclyvk +.. section: Library + +Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. + +.. + +.. bpo: 25924 +.. date: 8946 +.. nonce: Uxr2vt +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on OS X versions +10.5 or higher. Original patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26406 +.. date: 8945 +.. nonce: ihvhF4 +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on current versions +of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26848 +.. date: 8944 +.. nonce: ChBOpQ +.. section: Library + +Fix asyncio/subprocess.communicate() to handle empty input. Patch by Jack +O'Connor. + +.. + +.. bpo: 27040 +.. date: 8943 +.. nonce: UASyCC +.. section: Library + +Add loop.get_exception_handler method + +.. + +.. bpo: 27041 +.. date: 8942 +.. nonce: p3893U +.. section: Library + +asyncio: Add loop.create_future method + +.. + +.. bpo: 20640 +.. date: 8941 +.. nonce: PmI-G8 +.. section: IDLE + +Add tests for idlelib.configHelpSourceEdit. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 0 +.. date: 8940 +.. nonce: _YJfG7 +.. section: IDLE + +In the 'IDLE-console differences' section of the IDLE doc, clarify how +running with IDLE affects sys.modules and the standard streams. + +.. + +.. bpo: 25507 +.. date: 8939 +.. nonce: i8bNpk +.. section: IDLE + +fix incorrect change in IOBinding that prevented printing. Augment IOBinding +htest to include all major IOBinding functions. + +.. + +.. bpo: 25905 +.. date: 8938 +.. nonce: FzNb3B +.. section: IDLE + +Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION MARK in +README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to +utf-8 and open it with 'utf-8'. + +.. + +.. bpo: 15348 +.. date: 8937 +.. nonce: d1Fg01 +.. section: IDLE + +Stop the debugger engine (normally in a user process) before closing the +debugger window (running in the IDLE process). This prevents the +RuntimeErrors that were being caught and ignored. + +.. + +.. bpo: 24455 +.. date: 8936 +.. nonce: x6YqtE +.. section: IDLE + +Prevent IDLE from hanging when a) closing the shell while the debugger is +active (15347); b) closing the debugger with the [X] button (15348); and c) +activating the debugger when already active (24455). The patch by Mark +Roseman does this by making two changes. 1. Suspend and resume the +gui.interaction method with the tcl vwait mechanism intended for this +purpose (instead of root.mainloop & .quit). 2. In gui.run, allow any +existing interaction to terminate first. + +.. + +.. bpo: 0 +.. date: 8935 +.. nonce: Yp9LRY +.. section: IDLE + +Change 'The program' to 'Your program' in an IDLE 'kill program?' message to +make it clearer that the program referred to is the currently running user +program, not IDLE itself. + +.. + +.. bpo: 24750 +.. date: 8934 +.. nonce: xgsi-K +.. section: IDLE + +Improve the appearance of the IDLE editor window status bar. Patch by Mark +Roseman. + +.. + +.. bpo: 25313 +.. date: 8933 +.. nonce: xMXHpO +.. section: IDLE + +Change the handling of new built-in text color themes to better address the +compatibility problem introduced by the addition of IDLE Dark. Consistently +use the revised idleConf.CurrentTheme everywhere in idlelib. + +.. + +.. bpo: 24782 +.. date: 8932 +.. nonce: RgIPYE +.. section: IDLE + +Extension configuration is now a tab in the IDLE Preferences dialog rather +than a separate dialog. The former tabs are now a sorted list. Patch by +Mark Roseman. + +.. + +.. bpo: 22726 +.. date: 8931 +.. nonce: x8T0dA +.. section: IDLE + +Re-activate the config dialog help button with some content about the other +buttons and the new IDLE Dark theme. + +.. + +.. bpo: 24820 +.. date: 8930 +.. nonce: TFPJhr +.. section: IDLE + +IDLE now has an 'IDLE Dark' built-in text color theme. It is more or less +IDLE Classic inverted, with a cobalt blue background. Strings, comments, +keywords, ... are still green, red, orange, ... . To use it with IDLEs +released before November 2015, hit the 'Save as New Custom Theme' button and +enter a new name, such as 'Custom Dark'. The custom theme will work with +any IDLE release, and can be modified. + +.. + +.. bpo: 25224 +.. date: 8929 +.. nonce: 5Llwo4 +.. section: IDLE + +README.txt is now an idlelib index for IDLE developers and curious users. +The previous user content is now in the IDLE doc chapter. 'IDLE' now means +'Integrated Development and Learning Environment'. + +.. + +.. bpo: 24820 +.. date: 8928 +.. nonce: ZUz9Fn +.. section: IDLE + +Users can now set breakpoint colors in Settings -> Custom Highlighting. +Original patch by Mark Roseman. + +.. + +.. bpo: 24972 +.. date: 8927 +.. nonce: uc0uNo +.. section: IDLE + +Inactive selection background now matches active selection background, as +configured by users, on all systems. Found items are now always highlighted +on Windows. Initial patch by Mark Roseman. + +.. + +.. bpo: 24570 +.. date: 8926 +.. nonce: s3EkNn +.. section: IDLE + +Idle: make calltip and completion boxes appear on Macs affected by a tk +regression. Initial patch by Mark Roseman. + +.. + +.. bpo: 24988 +.. date: 8925 +.. nonce: tXqq4T +.. section: IDLE + +Idle ScrolledList context menus (used in debugger) now work on Mac Aqua. +Patch by Mark Roseman. + +.. + +.. bpo: 24801 +.. date: 8924 +.. nonce: -bj_Ou +.. section: IDLE + +Make right-click for context menu work on Mac Aqua. Patch by Mark Roseman. + +.. + +.. bpo: 25173 +.. date: 8923 +.. nonce: EZzrPg +.. section: IDLE + +Associate tkinter messageboxes with a specific widget. For Mac OSX, make +them a 'sheet'. Patch by Mark Roseman. + +.. + +.. bpo: 25198 +.. date: 8922 +.. nonce: -j_BV7 +.. section: IDLE + +Enhance the initial html viewer now used for Idle Help. * Properly indent +fixed-pitch text (patch by Mark Roseman). * Give code snippet a very Sphinx- +like light blueish-gray background. * Re-use initial width and height set by +users for shell and editor. * When the Table of Contents (TOC) menu is used, +put the section header at the top of the screen. + +.. + +.. bpo: 25225 +.. date: 8921 +.. nonce: 9pvdq6 +.. section: IDLE + +Condense and rewrite Idle doc section on text colors. + +.. + +.. bpo: 21995 +.. date: 8920 +.. nonce: C5Rmzx +.. section: IDLE + +Explain some differences between IDLE and console Python. + +.. + +.. bpo: 22820 +.. date: 8919 +.. nonce: hix_8X +.. section: IDLE + +Explain need for *print* when running file from Idle editor. + +.. + +.. bpo: 25224 +.. date: 8918 +.. nonce: UVMYQq +.. section: IDLE + +Doc: augment Idle feature list and no-subprocess section. + +.. + +.. bpo: 25219 +.. date: 8917 +.. nonce: 8_9DYg +.. section: IDLE + +Update doc for Idle command line options. Some were missing and notes were +not correct. + +.. + +.. bpo: 24861 +.. date: 8916 +.. nonce: Ecg2yT +.. section: IDLE + +Most of idlelib is private and subject to change. Use idleib.idle.* to start +Idle. See idlelib.__init__.__doc__. + +.. + +.. bpo: 25199 +.. date: 8915 +.. nonce: ih7yY3 +.. section: IDLE + +Idle: add synchronization comments for future maintainers. + +.. + +.. bpo: 16893 +.. date: 8914 +.. nonce: uIi1oB +.. section: IDLE + +Replace help.txt with help.html for Idle doc display. The new +idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks +better than help.txt and will better document Idle as released. The tkinter +html viewer that works for this file was written by Rose Roseman. The now +unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +.. + +.. bpo: 24199 +.. date: 8913 +.. nonce: VKnZEv +.. section: IDLE + +Deprecate unused idlelib.idlever with possible removal in 3.6. + +.. + +.. bpo: 24790 +.. date: 8912 +.. nonce: hD1hlj +.. section: IDLE + +Remove extraneous code (which also create 2 & 3 conflicts). + +.. + +.. bpo: 26736 +.. date: 8911 +.. nonce: U_Hyqo +.. section: Documentation + +Used HTTPS for external links in the documentation if possible. + +.. + +.. bpo: 6953 +.. date: 8910 +.. nonce: Zk6rno +.. section: Documentation + +Rework the Readline module documentation to group related functions +together, and add more details such as what underlying Readline functions +and variables are accessed. + +.. + +.. bpo: 23606 +.. date: 8909 +.. nonce: 9MhIso +.. section: Documentation + +Adds note to ctypes documentation regarding cdll.msvcrt. + +.. + +.. bpo: 24952 +.. date: 8908 +.. nonce: RHhFPE +.. section: Documentation + +Clarify the default size argument of stack_size() in the "threading" and +"_thread" modules. Patch from Mattip. + +.. + +.. bpo: 26014 +.. date: 8907 +.. nonce: ptdZ_I +.. section: Documentation + +Update 3.x packaging documentation: * "See also" links to the new docs are +now provided in the legacy pages * links to setuptools documentation have +been updated + +.. + +.. bpo: 21916 +.. date: 8906 +.. nonce: muwCyp +.. section: Tests + +Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle +Zijlstra. + +.. + +.. bpo: 26295 +.. date: 8905 +.. nonce: sYBtj5 +.. section: Tests + +When using "python3 -m test --testdir=TESTDIR", regrtest doesn't add "test." +prefix to test module names. + +.. + +.. bpo: 26523 +.. date: 8904 +.. nonce: em_Uzt +.. section: Tests + +The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. + +.. + +.. bpo: 26015 +.. date: 8903 +.. nonce: p3oWK3 +.. section: Tests + +Added new tests for pickling iterators of mutable sequences. + +.. + +.. bpo: 26325 +.. date: 8902 +.. nonce: KOUc82 +.. section: Tests + +Added test.support.check_no_resource_warning() to check that no +ResourceWarning is emitted. + +.. + +.. bpo: 25940 +.. date: 8901 +.. nonce: MvBwSe +.. section: Tests + +Changed test_ssl to use its internal local server more. This avoids relying +on svn.python.org, which recently changed root certificate. + +.. + +.. bpo: 25616 +.. date: 8900 +.. nonce: Qr-60p +.. section: Tests + +Tests for OrderedDict are extracted from test_collections into separate file +test_ordered_dict. + +.. + +.. bpo: 25449 +.. date: 8899 +.. nonce: MP6KNs +.. section: Tests + +Added tests for OrderedDict subclasses. + +.. + +.. bpo: 25188 +.. date: 8898 +.. nonce: lnLnIW +.. section: Tests + +Add -P/--pgo to test.regrtest to suppress error output when running the test +suite for the purposes of a PGO build. Initial patch by Alecsandru Patrascu. + +.. + +.. bpo: 22806 +.. date: 8897 +.. nonce: _QHyyV +.. section: Tests + +Add ``python -m test --list-tests`` command to list tests. + +.. + +.. bpo: 18174 +.. date: 8896 +.. nonce: TzH9d_ +.. section: Tests + +``python -m test --huntrleaks ...`` now also checks for leak of file +descriptors. Patch written by Richard Oudkerk. + +.. + +.. bpo: 25260 +.. date: 8895 +.. nonce: jw3p83 +.. section: Tests + +Fix ``python -m test --coverage`` on Windows. Remove the list of ignored +directories. + +.. + +.. bpo: 0 +.. date: 8894 +.. nonce: X-Bk5l +.. section: Tests + +``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass +along to regrtest.py. Previously there was a limit of 9. + +.. + +.. bpo: 26583 +.. date: 8893 +.. nonce: Up7hTl +.. section: Tests + +Skip test_timestamp_overflow in test_import if bytecode files cannot be +written. + +.. + +.. bpo: 21277 +.. date: 8892 +.. nonce: 7y1j9a +.. section: Build + +Don't try to link _ctypes with a ffi_convenience library. + +.. + +.. bpo: 26884 +.. date: 8891 +.. nonce: O8-azL +.. section: Build + +Fix linking extension modules for cross builds. Patch by Xavier de Gaye. + +.. + +.. bpo: 26932 +.. date: 8890 +.. nonce: 5kzaG9 +.. section: Build + +Fixed support of RTLD_* constants defined as enum values, not via macros (in +particular on Android). Patch by Chi Hsuan Yen. + +.. + +.. bpo: 22359 +.. date: 8889 +.. nonce: HDjM4s +.. section: Build + +Disable the rules for running _freeze_importlib and pgen when cross- +compiling. The output of these programs is normally saved with the source +code anyway, and is still regenerated when doing a native build. Patch by +Xavier de Gaye. + +.. + +.. bpo: 21668 +.. date: 8888 +.. nonce: qWwBui +.. section: Build + +Link audioop, _datetime, _ctypes_test modules to libm, except on Mac OS X. +Patch written by Chi Hsuan Yen. + +.. + +.. bpo: 25702 +.. date: 8887 +.. nonce: ipxyJs +.. section: Build + +A --with-lto configure option has been added that will enable link time +optimizations at build time during a make profile-opt. Some compilers and +toolchains are known to not produce stable code when using LTO, be sure to +test things thoroughly before relying on it. It can provide a few % speed up +over profile-opt alone. + +.. + +.. bpo: 26624 +.. date: 8886 +.. nonce: 4fGrTl +.. section: Build + +Adds validation of ucrtbase[d].dll version with warning for old versions. + +.. + +.. bpo: 17603 +.. date: 8885 +.. nonce: 102DA- +.. section: Build + +Avoid error about nonexistant fileblocks.o file by using a lower-level check +for st_blocks in struct stat. + +.. + +.. bpo: 26079 +.. date: 8884 +.. nonce: mEzW0O +.. section: Build + +Fixing the build output folder for tix-8.4.3.6. Patch by Bjoern Thiel. + +.. + +.. bpo: 26465 +.. date: 8883 +.. nonce: _YR608 +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2g. + +.. + +.. bpo: 25348 +.. date: 8882 +.. nonce: FLSPfp +.. section: Build + +Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for +building with Profile-Guided Optimization. The old +``PCbuild\build_pgo.bat`` script is removed. + +.. + +.. bpo: 25827 +.. date: 8881 +.. nonce: yg3DMM +.. section: Build + +Add support for building with ICC to ``configure``, including a new +``--with-icc`` flag. + +.. + +.. bpo: 25696 +.. date: 8880 +.. nonce: 2R_wIv +.. section: Build + +Fix installation of Python on UNIX with make -j9. + +.. + +.. bpo: 24986 +.. date: 8879 +.. nonce: 1WyXeU +.. section: Build + +It is now possible to build Python on Windows without errors when external +libraries are not available. + +.. + +.. bpo: 24421 +.. date: 8878 +.. nonce: 2zY7vM +.. section: Build + +Compile Modules/_math.c once, before building extensions. Previously it +could fail to compile properly if the math and cmath builds were concurrent. + +.. + +.. bpo: 26465 +.. date: 8877 +.. nonce: PkIaV8 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2g. + +.. + +.. bpo: 26268 +.. date: 8876 +.. nonce: I3-YLh +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2f. + +.. + +.. bpo: 25136 +.. date: 8875 +.. nonce: Vi-fmO +.. section: Build + +Support Apple Xcode 7's new textual SDK stub libraries. + +.. + +.. bpo: 24324 +.. date: 8874 +.. nonce: m6DZMx +.. section: Build + +Do not enable unreachable code warnings when using gcc as the option does +not work correctly in older versions of gcc and has been silently removed as +of gcc-4.5. + +.. + +.. bpo: 27053 +.. date: 8873 +.. nonce: 1IRbae +.. section: Windows + +Updates make_zip.py to correctly generate library ZIP file. + +.. + +.. bpo: 26268 +.. date: 8872 +.. nonce: Z-lJEh +.. section: Windows + +Update the prepare_ssl.py script to handle OpenSSL releases that don't +include the contents of the include directory (that is, 1.0.2e and later). + +.. + +.. bpo: 26071 +.. date: 8871 +.. nonce: wLxL2l +.. section: Windows + +bdist_wininst created binaries fail to start and find 32bit Python + +.. + +.. bpo: 26073 +.. date: 8870 +.. nonce: XwWgHp +.. section: Windows + +Update the list of magic numbers in launcher + +.. + +.. bpo: 26065 +.. date: 8869 +.. nonce: SkVLJp +.. section: Windows + +Excludes venv from library when generating embeddable distro. + +.. + +.. bpo: 25022 +.. date: 8868 +.. nonce: vAt_zr +.. section: Windows + +Removed very outdated PC/example_nt/ directory. + +.. + +.. bpo: 26799 +.. date: 8867 +.. nonce: gK2VXX +.. section: Tools/Demos + +Fix python-gdb.py: don't get C types once when the Python code is loaded, +but get C types on demand. The C types can change if python-gdb.py is loaded +before the Python executable. Patch written by Thomas Ilsche. + +.. + +.. bpo: 26271 +.. date: 8866 +.. nonce: wg-rzr +.. section: Tools/Demos + +Fix the Freeze tool to properly use flags passed through configure. Patch by +Daniel Shaulov. + +.. + +.. bpo: 26489 +.. date: 8865 +.. nonce: rJ_U5S +.. section: Tools/Demos + +Add dictionary unpacking support to Tools/parser/unparse.py. Patch by Guo Ci +Teo. + +.. + +.. bpo: 26316 +.. date: 8864 +.. nonce: QJvVOi +.. section: Tools/Demos + +Fix variable name typo in Argument Clinic. + +.. + +.. bpo: 25440 +.. date: 8863 +.. nonce: 5xhyGr +.. section: Tools/Demos + +Fix output of python-config --extension-suffix. + +.. + +.. bpo: 25154 +.. date: 8862 +.. nonce: yLO-r4 +.. section: Tools/Demos + +The pyvenv script has been deprecated in favour of `python3 -m venv`. + +.. + +.. bpo: 26312 +.. date: 8861 +.. nonce: h1T61B +.. section: C API + +SystemError is now raised in all programming bugs with using +PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some +programming bugs. + +.. + +.. bpo: 26198 +.. date: 8860 +.. nonce: lVn1HX +.. section: C API + +ValueError is now raised instead of TypeError on buffer overflow in parsing +"es#" and "et#" format units. SystemError is now raised instead of +TypeError on programmical error in parsing format string. diff --git a/Misc/NEWS.d/3.6.0a2.rst b/Misc/NEWS.d/3.6.0a2.rst new file mode 100644 index 00000000000..3984fabedba --- /dev/null +++ b/Misc/NEWS.d/3.6.0a2.rst @@ -0,0 +1,799 @@ +.. bpo: 27095 +.. date: 9332 +.. nonce: 92UoyH +.. release date: 2016-06-13 +.. section: Core and Builtins + +Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. Patch by Demur +Rumed. + +.. + +.. bpo: 27190 +.. date: 9331 +.. nonce: DHDFeD +.. section: Core and Builtins + +Raise NotSupportedError if sqlite3 is older than 3.3.1. Patch by Dave +Sawyer. + +.. + +.. bpo: 27286 +.. date: 9330 +.. nonce: U8q6B1 +.. section: Core and Builtins + +Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with +generalized unpacking (PEP 448) and conflicting keyword names could cause +undefined behavior. + +.. + +.. bpo: 27140 +.. date: 9329 +.. nonce: uc39-1 +.. section: Core and Builtins + +Added BUILD_CONST_KEY_MAP opcode. + +.. + +.. bpo: 27186 +.. date: 9328 +.. nonce: EAnCS7 +.. section: Core and Builtins + +Add support for os.PathLike objects to open() (part of PEP 519). + +.. + +.. bpo: 27066 +.. date: 9327 +.. nonce: SNExZi +.. section: Core and Builtins + +Fixed SystemError if a custom opener (for open()) returns a negative number +without setting an exception. + +.. + +.. bpo: 26983 +.. date: 9326 +.. nonce: A0f3fK +.. section: Core and Builtins + +float() now always return an instance of exact float. The deprecation +warning is emitted if __float__ returns an instance of a strict subclass of +float. In a future versions of Python this can be an error. + +.. + +.. bpo: 27097 +.. date: 9325 +.. nonce: woRKey +.. section: Core and Builtins + +Python interpreter is now about 7% faster due to optimized instruction +decoding. Based on patch by Demur Rumed. + +.. + +.. bpo: 26647 +.. date: 9324 +.. nonce: DLSzRi +.. section: Core and Builtins + +Python interpreter now uses 16-bit wordcode instead of bytecode. Patch by +Demur Rumed. + +.. + +.. bpo: 23275 +.. date: 9323 +.. nonce: YGPb_y +.. section: Core and Builtins + +Allow assigning to an empty target list in round brackets: () = iterable. + +.. + +.. bpo: 27243 +.. date: 9322 +.. nonce: U36M4E +.. section: Core and Builtins + +Update the __aiter__ protocol: instead of returning an awaitable that +resolves to an asynchronous iterator, the asynchronous iterator should be +returned directly. Doing the former will trigger a +PendingDeprecationWarning. + +.. + +.. bpo: 0 +.. date: 9321 +.. nonce: nBpVM1 +.. section: Library + +Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants +exposed on the API which are not implemented on GNU/Hurd. They would not +work at runtime anyway. + +.. + +.. bpo: 27025 +.. date: 9320 +.. nonce: ffzxpX +.. section: Library + +Generated names for Tkinter widgets are now more meanful and recognizirable. + +.. + +.. bpo: 25455 +.. date: 9319 +.. nonce: k10GoO +.. section: Library + +Fixed crashes in repr of recursive ElementTree.Element and functools.partial +objects. + +.. + +.. bpo: 27294 +.. date: 9318 +.. nonce: XPCURr +.. section: Library + +Improved repr for Tkinter event objects. + +.. + +.. bpo: 20508 +.. date: 9317 +.. nonce: 3NMbT2 +.. section: Library + +Improve exception message of IPv{4,6}Network.__getitem__. Patch by Gareth +Rees. + +.. + +.. bpo: 26556 +.. date: 9316 +.. nonce: v5j2uL +.. original section: Library +.. section: Security + +Update expat to 2.1.1, fixes CVE-2015-1283. + +.. + +.. bpo: 0 +.. date: 9315 +.. nonce: PHOAdg +.. original section: Library +.. section: Security + +Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. Reported by Team +Oststrom. + +.. + +.. bpo: 21386 +.. date: 9314 +.. nonce: DjV72U +.. section: Library + +Implement missing IPv4Address.is_global property. It was documented since +07a5610bae9d. Initial patch by Roger Luethi. + +.. + +.. bpo: 27029 +.. date: 9313 +.. nonce: dmycvw +.. section: Library + +Removed deprecated support of universal newlines mode from ZipFile.open(). + +.. + +.. bpo: 27030 +.. date: 9312 +.. nonce: p29J7m +.. section: Library + +Unknown escapes consisting of ``'\'`` and an ASCII letter in regular +expressions now are errors. The re.LOCALE flag now can be used only with +bytes patterns. + +.. + +.. bpo: 27186 +.. date: 9311 +.. nonce: UYiwoh +.. section: Library + +Add os.PathLike support to DirEntry (part of PEP 519). Initial patch by +Jelle Zijlstra. + +.. + +.. bpo: 20900 +.. date: 9310 +.. nonce: H5YQPR +.. section: Library + +distutils register command now decodes HTTP responses correctly. Initial +patch by ingrid. + +.. + +.. bpo: 27186 +.. date: 9309 +.. nonce: Xo4c_F +.. section: Library + +Add os.PathLike support to pathlib, removing its provisional status (part of +PEP 519). Initial patch by Dusty Phillips. + +.. + +.. bpo: 27186 +.. date: 9308 +.. nonce: ZD1wpp +.. section: Library + +Add support for os.PathLike objects to os.fsencode() and os.fsdecode() (part +of PEP 519). + +.. + +.. bpo: 27186 +.. date: 9307 +.. nonce: y7YRfj +.. section: Library + +Introduce os.PathLike and os.fspath() (part of PEP 519). + +.. + +.. bpo: 0 +.. date: 9306 +.. nonce: iYIeng +.. section: Library + +A new version of typing.py provides several new classes and features: + at overload outside stubs, Reversible, DefaultDict, Text, ContextManager, +Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of +the new features are not yet implemented in mypy or other static analyzers). +Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been +added (in fact they made it into 3.5.1 but were never mentioned). + +.. + +.. bpo: 25738 +.. date: 9305 +.. nonce: mED9w4 +.. section: Library + +Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message +body for 205 Reset Content. Also, don't send Content header fields in +responses that don't have a body. Patch by Susumu Koshiba. + +.. + +.. bpo: 21313 +.. date: 9304 +.. nonce: W30MBr +.. section: Library + +Fix the "platform" module to tolerate when sys.version contains truncated +build information. + +.. + +.. bpo: 26839 +.. date: 9303 +.. nonce: yVvy7R +.. original section: Library +.. section: Security + +On Linux, :func:`os.urandom` now calls ``getrandom()`` with +``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom +entropy pool is not initialized yet. Patch written by Colm Buckley. + +.. + +.. bpo: 23883 +.. date: 9302 +.. nonce: tsZUiM +.. section: Library + +Added missing APIs to __all__ to match the documented APIs for the following +modules: cgi, mailbox, mimetypes, plistlib and smtpd. Patches by Jacek +Ko?odziej. + +.. + +.. bpo: 27164 +.. date: 9301 +.. nonce: 6wmjx2 +.. section: Library + +In the zlib module, allow decompressing raw Deflate streams with a +predefined zdict. Based on patch by Xiang Zhang. + +.. + +.. bpo: 24291 +.. date: 9300 +.. nonce: Ac6HvL +.. section: Library + +Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the +client. Previously it could do partial writes and truncate data. Also, +wsgiref.handler.ServerHandler can now handle stdout doing partial writes, +but this is deprecated. + +.. + +.. bpo: 21272 +.. date: 9299 +.. nonce: unScIG +.. section: Library + +Use _sysconfigdata.py to initialize distutils.sysconfig. + +.. + +.. bpo: 19611 +.. date: 9298 +.. nonce: MT-Qga +.. section: Library + +:mod:`inspect` now reports the implicit ``.0`` parameters generated by the +compiler for comprehension and generator expression scopes as if they were +positional-only parameters called ``implicit0``. Patch by Jelle Zijlstra. + +.. + +.. bpo: 26809 +.. date: 9297 +.. nonce: ya7JMb +.. section: Library + +Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + +.. + +.. bpo: 26373 +.. date: 9296 +.. nonce: P6qz6o +.. section: Library + +subprocess.Popen.communicate now correctly ignores BrokenPipeError when the +child process dies before .communicate() is called in more/all +circumstances. + +.. + +.. bpo: 0 +.. date: 9295 +.. nonce: eKchPz +.. section: Library + +signal, socket, and ssl module IntEnum constant name lookups now return a +consistent name for values having multiple names. Ex: signal.Signals(6) now +refers to itself as signal.SIGALRM rather than flipping between that and +signal.SIGIOT based on the interpreter's hash randomization seed. + +.. + +.. bpo: 27167 +.. date: 9294 +.. nonce: orA_j0 +.. section: Library + +Clarify the subprocess.CalledProcessError error message text when the child +process died due to a signal. + +.. + +.. bpo: 25931 +.. date: 9293 +.. nonce: W7h6Am +.. section: Library + +Don't define socketserver.Forking* names on platforms such as Windows that +do not support os.fork(). + +.. + +.. bpo: 21776 +.. date: 9292 +.. nonce: 04eQfa +.. section: Library + +distutils.upload now correctly handles HTTPError. Initial patch by Claudiu +Popa. + +.. + +.. bpo: 26526 +.. date: 9291 +.. nonce: ScewjJ +.. section: Library + +Replace custom parse tree validation in the parser module with a simple DFA +validator. + +.. + +.. bpo: 27114 +.. date: 9290 +.. nonce: bGCuAM +.. section: Library + +Fix SSLContext._load_windows_store_certs fails with PermissionError + +.. + +.. bpo: 18383 +.. date: 9289 +.. nonce: jr-b0l +.. section: Library + +Avoid creating duplicate filters when using filterwarnings and simplefilter. +Based on patch by Alex Shkop. + +.. + +.. bpo: 23026 +.. date: 9288 +.. nonce: V2rgYX +.. section: Library + +winreg.QueryValueEx() now return an integer for REG_QWORD type. + +.. + +.. bpo: 26741 +.. date: 9287 +.. nonce: fsbb42 +.. section: Library + +subprocess.Popen destructor now emits a ResourceWarning warning if the child +process is still running. + +.. + +.. bpo: 27056 +.. date: 9286 +.. nonce: rk-BBL +.. section: Library + +Optimize pickle.load() and pickle.loads(), up to 10% faster to deserialize a +lot of small objects. + +.. + +.. bpo: 21271 +.. date: 9285 +.. nonce: bHIfFA +.. section: Library + +New keyword only parameters in reset_mock call. + +.. + +.. bpo: 5124 +.. date: 9284 +.. nonce: 4kwBvM +.. section: IDLE + +Paste with text selected now replaces the selection on X11. This matches how +paste works on Windows, Mac, most modern Linux apps, and ttk widgets. +Original patch by Serhiy Storchaka. + +.. + +.. bpo: 24750 +.. date: 9283 +.. nonce: wA-pc9 +.. section: IDLE + +Switch all scrollbars in IDLE to ttk versions. Where needed, minimal tests +are added to cover changes. + +.. + +.. bpo: 24759 +.. date: 9282 +.. nonce: 76HB4w +.. section: IDLE + +IDLE requires tk 8.5 and availability ttk widgets. Delete now unneeded tk +version tests and code for older versions. Add test for IDLE syntax +colorizoer. + +.. + +.. bpo: 27239 +.. date: 9281 +.. nonce: fToURh +.. section: IDLE + +idlelib.macosx.isXyzTk functions initialize as needed. + +.. + +.. bpo: 27262 +.. date: 9280 +.. nonce: t7ckly +.. section: IDLE + +move Aqua unbinding code, which enable context menus, to maxosx. + +.. + +.. bpo: 24759 +.. date: 9279 +.. nonce: ccmySu +.. section: IDLE + +Make clear in idlelib.idle_test.__init__ that the directory is a private +implementation of test.test_idle and tool for maintainers. + +.. + +.. bpo: 27196 +.. date: 9278 +.. nonce: 3yp8TF +.. section: IDLE + +Stop 'ThemeChanged' warnings when running IDLE tests. These persisted after +other warnings were suppressed in #20567. Apply Serhiy Storchaka's +update_idletasks solution to four test files. Record this additional advice +in idle_test/README.txt + +.. + +.. bpo: 20567 +.. date: 9277 +.. nonce: hhT32b +.. section: IDLE + +Revise idle_test/README.txt with advice about avoiding tk warning messages +from tests. Apply advice to several IDLE tests. + +.. + +.. bpo: 24225 +.. date: 9276 +.. nonce: NxQCka +.. section: IDLE + +Update idlelib/README.txt with new file names and event handlers. + +.. + +.. bpo: 27156 +.. date: 9275 +.. nonce: j1N9br +.. section: IDLE + +Remove obsolete code not used by IDLE. Replacements: 1. help.txt, replaced +by help.html, is out-of-date and should not be used. Its dedicated viewer +has be replaced by the html viewer in help.py. 2. ``import idlever; I = +idlever.IDLE_VERSION`` is the same as ``import sys; I = +version[:version.index(' ')]`` 3. After ``ob = +stackviewer.VariablesTreeItem(*args)``, ``ob.keys() == +list(ob.object.keys)``. 4. In macosc, runningAsOSXAPP == isAquaTk; +idCarbonAquaTk == isCarbonTk + +.. + +.. bpo: 27117 +.. date: 9274 +.. nonce: YrLPf4 +.. section: IDLE + +Make colorizer htest and turtledemo work with dark themes. Move code for +configuring text widget colors to a new function. + +.. + +.. bpo: 24225 +.. date: 9273 +.. nonce: RbyFuV +.. section: IDLE + +Rename many `idlelib/*.py` and `idle_test/test_*.py` files. Edit files to +replace old names with new names when the old name referred to the module +rather than the class it contained. See the issue and IDLE section in What's +New in 3.6 for more. + +.. + +.. bpo: 26673 +.. date: 9272 +.. nonce: dh0_Ij +.. section: IDLE + +When tk reports font size as 0, change to size 10. Such fonts on Linux +prevented the configuration dialog from opening. + +.. + +.. bpo: 21939 +.. date: 9271 +.. nonce: pWz-OK +.. section: IDLE + +Add test for IDLE's percolator. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 21676 +.. date: 9270 +.. nonce: hqy6Qh +.. section: IDLE + +Add test for IDLE's replace dialog. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 18410 +.. date: 9269 +.. nonce: DLSPZo +.. section: IDLE + +Add test for IDLE's search dialog. Original patch by Westley Mart?nez. + +.. + +.. bpo: 21703 +.. date: 9268 +.. nonce: bEU8sP +.. section: IDLE + +Add test for undo delegator. Patch mostly by Saimadhav Heblikar . + +.. + +.. bpo: 27044 +.. date: 9267 +.. nonce: 4y7tyM +.. section: IDLE + +Add ConfigDialog.remove_var_callbacks to stop memory leaks. + +.. + +.. bpo: 23977 +.. date: 9266 +.. nonce: miDjj8 +.. section: IDLE + +Add more asserts to test_delegator. + +.. + +.. bpo: 16484 +.. date: 9265 +.. nonce: ITzcGg +.. section: Documentation + +Change the default PYTHONDOCS URL to "https:", and fix the resulting links +to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi. + +.. + +.. bpo: 24136 +.. date: 9264 +.. nonce: MUK0zK +.. section: Documentation + +Document the new PEP 448 unpacking syntax of 3.5. + +.. + +.. bpo: 22558 +.. date: 9263 +.. nonce: Pk02YC +.. section: Documentation + +Add remaining doc links to source code for Python-coded modules. Patch by +Yoni Lavi. + +.. + +.. bpo: 25285 +.. date: 9262 +.. nonce: 6CxIBo +.. section: Tests + +regrtest now uses subprocesses when the -j1 command line option is used: +each test file runs in a fresh child process. Before, the -j1 option was +ignored. + +.. + +.. bpo: 25285 +.. date: 9261 +.. nonce: ENYqUQ +.. section: Tests + +Tools/buildbot/test.bat script now uses -j1 by default to run each test file +in fresh child process. + +.. + +.. bpo: 27064 +.. date: 9260 +.. nonce: xeY1WF +.. section: Windows + +The py.exe launcher now defaults to Python 3. The Windows launcher +``py.exe`` no longer prefers an installed Python 2 version over Python 3 by +default when used interactively. + +.. + +.. bpo: 27229 +.. date: 9259 +.. nonce: C2NDch +.. section: Build + +Fix the cross-compiling pgen rule for in-tree builds. Patch by Xavier de +Gaye. + +.. + +.. bpo: 26930 +.. date: 9258 +.. nonce: Sqz2O3 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2h. + +.. + +.. bpo: 17500 +.. date: 9257 +.. nonce: QTZbRV +.. section: Windows + +Remove unused and outdated icons. (See also: +https://github.com/python/pythondotorg/issues/945) + +.. + +.. bpo: 27186 +.. date: 9256 +.. nonce: Ll8R-t +.. section: C API + +Add the PyOS_FSPath() function (part of PEP 519). + +.. + +.. bpo: 26282 +.. date: 9255 +.. nonce: Rp-R6L +.. section: C API + +PyArg_ParseTupleAndKeywords() now supports positional-only parameters. + +.. + +.. bpo: 26282 +.. date: 9254 +.. nonce: DRRV-- +.. section: Tools/Demos + +Argument Clinic now supports positional-only and keyword parameters in the +same function. diff --git a/Misc/NEWS.d/3.6.0a3.rst b/Misc/NEWS.d/3.6.0a3.rst new file mode 100644 index 00000000000..251e6aa0e12 --- /dev/null +++ b/Misc/NEWS.d/3.6.0a3.rst @@ -0,0 +1,537 @@ +.. bpo: 27473 +.. date: 9385 +.. nonce: _nOtTA +.. release date: 2016-07-11 +.. section: Core and Builtins + +Fixed possible integer overflow in bytes and bytearray concatenations. +Patch by Xiang Zhang. + +.. + +.. bpo: 23034 +.. date: 9384 +.. nonce: GWaUqn +.. section: Core and Builtins + +The output of a special Python build with defined COUNT_ALLOCS, +SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can +be re-enabled using the "-X showalloccount" option. It now outputs to +stderr instead of stdout. + +.. + +.. bpo: 27443 +.. date: 9383 +.. nonce: 87ZwZ1 +.. section: Core and Builtins + +__length_hint__() of bytearray iterators no longer return a negative integer +for a resized bytearray. + +.. + +.. bpo: 27007 +.. date: 9382 +.. nonce: Gg8Um4 +.. section: Core and Builtins + +The fromhex() class methods of bytes and bytearray subclasses now return an +instance of corresponding subclass. + +.. + +.. bpo: 26844 +.. date: 9381 +.. nonce: I0wdnY +.. section: Library + +Fix error message for imp.find_module() to refer to 'path' instead of +'name'. Patch by Lev Maximov. + +.. + +.. bpo: 23804 +.. date: 9380 +.. nonce: ipFvxc +.. section: Library + +Fix SSL zero-length recv() calls to not block and not raise an error about +unclean EOF. + +.. + +.. bpo: 27466 +.. date: 9379 +.. nonce: C_3a8E +.. section: Library + +Change time format returned by http.cookie.time2netscape, confirming the +netscape cookie format and making it consistent with documentation. + +.. + +.. bpo: 21708 +.. date: 9378 +.. nonce: RpPYiv +.. section: Library + +Deprecated dbm.dumb behavior that differs from common dbm behavior: creating +a database in 'r' and 'w' modes and modifying a database in 'r' mode. + +.. + +.. bpo: 26721 +.. date: 9377 +.. nonce: L37Y7r +.. section: Library + +Change the socketserver.StreamRequestHandler.wfile attribute to implement +BufferedIOBase. In particular, the write() method no longer does partial +writes. + +.. + +.. bpo: 22115 +.. date: 9376 +.. nonce: vG5UQW +.. section: Library + +Added methods trace_add, trace_remove and trace_info in the tkinter.Variable +class. They replace old methods trace_variable, trace, trace_vdelete and +trace_vinfo that use obsolete Tcl commands and might not work in future +versions of Tcl. Fixed old tracing methods: trace_vdelete() with wrong mode +no longer break tracing, trace_vinfo() now always returns a list of pairs of +strings, tracing in the "u" mode now works. + +.. + +.. bpo: 26243 +.. date: 9375 +.. nonce: dBtlhI +.. section: Library + +Only the level argument to zlib.compress() is keyword argument now. The +first argument is positional-only. + +.. + +.. bpo: 27038 +.. date: 9374 +.. nonce: yGMV4h +.. section: Library + +Expose the DirEntry type as os.DirEntry. Code patch by Jelle Zijlstra. + +.. + +.. bpo: 27186 +.. date: 9373 +.. nonce: OtorpF +.. section: Library + +Update os.fspath()/PyOS_FSPath() to check the return value of __fspath__() +to be either str or bytes. + +.. + +.. bpo: 18726 +.. date: 9372 +.. nonce: eIXHIl +.. section: Library + +All optional parameters of the dump(), dumps(), load() and loads() functions +and JSONEncoder and JSONDecoder class constructors in the json module are +now keyword-only. + +.. + +.. bpo: 27319 +.. date: 9371 +.. nonce: vDl2zm +.. section: Library + +Methods selection_set(), selection_add(), selection_remove() and +selection_toggle() of ttk.TreeView now allow passing multiple items as +multiple arguments instead of passing them as a tuple. Deprecated +undocumented ability of calling the selection() method with arguments. + +.. + +.. bpo: 27079 +.. date: 9370 +.. nonce: c7d0Ym +.. section: Library + +Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +.. + +.. bpo: 27294 +.. date: 9369 +.. nonce: 0WSp9y +.. section: Library + +Numerical state in the repr for Tkinter event objects is now represented as +a combination of known flags. + +.. + +.. bpo: 27177 +.. date: 9368 +.. nonce: U6jRnd +.. section: Library + +Match objects in the re module now support index-like objects as group +indices. Based on patches by Jeroen Demeyer and Xiang Zhang. + +.. + +.. bpo: 26754 +.. date: 9367 +.. nonce: J3n0QW +.. section: Library + +Some functions (compile() etc) accepted a filename argument encoded as an +iterable of integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 26536 +.. date: 9366 +.. nonce: DgLWm- +.. section: Library + +socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. + +.. + +.. bpo: 27048 +.. date: 9365 +.. nonce: EVe-Bk +.. section: Library + +Prevents distutils failing on Windows when environment variables contain +non-ASCII characters + +.. + +.. bpo: 27330 +.. date: 9364 +.. nonce: GJaFCV +.. section: Library + +Fixed possible leaks in the ctypes module. + +.. + +.. bpo: 27238 +.. date: 9363 +.. nonce: Q6v6Qv +.. section: Library + +Got rid of bare excepts in the turtle module. Original patch by Jelle +Zijlstra. + +.. + +.. bpo: 27122 +.. date: 9362 +.. nonce: 06t7zN +.. section: Library + +When an exception is raised within the context being managed by a +contextlib.ExitStack() and one of the exit stack generators catches and +raises it in a chain, do not re-raise the original exception when exiting, +let the new chained one through. This avoids the PEP 479 bug described in +issue25782. + +.. + +.. bpo: 27278 +.. date: 9361 +.. nonce: y_HkGw +.. original section: Library +.. section: Security + +Fix os.urandom() implementation using getrandom() on Linux. Truncate size +to INT_MAX and loop until we collected enough random bytes, instead of +casting a directly Py_ssize_t to int. + +.. + +.. bpo: 16864 +.. date: 9360 +.. nonce: W7tJDa +.. section: Library + +sqlite3.Cursor.lastrowid now supports REPLACE statement. Initial patch by +Alex LordThorsen. + +.. + +.. bpo: 26386 +.. date: 9359 +.. nonce: 9L3Ut4 +.. section: Library + +Fixed ttk.TreeView selection operations with item id's containing spaces. + +.. + +.. bpo: 8637 +.. date: 9358 +.. nonce: lHiUSA +.. section: Library + +Honor a pager set by the env var MANPAGER (in preference to one set by the +env var PAGER). + +.. + +.. bpo: 22636 +.. date: 9357 +.. nonce: 3fQW_g +.. original section: Library +.. section: Security + +Avoid shell injection problems with ctypes.util.find_library(). + +.. + +.. bpo: 16182 +.. date: 9356 +.. nonce: RgFXyr +.. section: Library + +Fix various functions in the "readline" module to use the locale encoding, +and fix get_begidx() and get_endidx() to return code point indexes. + +.. + +.. bpo: 27392 +.. date: 9355 +.. nonce: obfni7 +.. section: Library + +Add loop.connect_accepted_socket(). Patch by Jim Fulton. + +.. + +.. bpo: 27477 +.. date: 9354 +.. nonce: iEuL-9 +.. section: IDLE + +IDLE search dialogs now use ttk widgets. + +.. + +.. bpo: 27173 +.. date: 9353 +.. nonce: M-fYaV +.. section: IDLE + +Add 'IDLE Modern Unix' to the built-in key sets. Make the default key set +depend on the platform. Add tests for the changes to the config module. + +.. + +.. bpo: 27452 +.. date: 9352 +.. nonce: dLxZ8W +.. section: IDLE + +make command line "idle-test> python test_help.py" work. __file__ is +relative when python is started in the file's directory. + +.. + +.. bpo: 27452 +.. date: 9351 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 27380 +.. date: 9350 +.. nonce: Q39r9U +.. section: IDLE + +IDLE: add query.py with base Query dialog and ttk widgets. Module had +subclasses SectionName, ModuleName, and HelpSource, which are used to get +information from users by configdialog and file =>Load Module. Each subclass +has itw own validity checks. Using ModuleName allows users to edit bad +module names instead of starting over. Add tests and delete the two files +combined into the new one. + +.. + +.. bpo: 27372 +.. date: 9349 +.. nonce: k3Wj2V +.. section: IDLE + +Test_idle no longer changes the locale. + +.. + +.. bpo: 27365 +.. date: 9348 +.. nonce: y7ys_A +.. section: IDLE + +Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +.. + +.. bpo: 27245 +.. date: 9347 +.. nonce: u9aKO1 +.. section: IDLE + +IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE +was started from a console or by import, a cascade of warnings was emitted. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 24137 +.. date: 9346 +.. nonce: v8o-IT +.. section: IDLE + +Run IDLE, test_idle, and htest with tkinter default root disabled. Fix code +and tests that fail with this restriction. Fix htests to not create a +second and redundant root and mainloop. + +.. + +.. bpo: 27310 +.. date: 9345 +.. nonce: KiURpC +.. section: IDLE + +Fix IDLE.app failure to launch on OS X due to vestigial import. + +.. + +.. bpo: 26754 +.. date: 9344 +.. nonce: Qm_N79 +.. section: C API + +PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of +integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 28066 +.. date: 9343 +.. nonce: _3xImV +.. section: Build + +Fix the logic that searches build directories for generated include files +when building outside the source tree. + +.. + +.. bpo: 27442 +.. date: 9342 +.. nonce: S2M0cz +.. section: Build + +Expose the Android API level that python was built against, in +sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'. + +.. + +.. bpo: 27434 +.. date: 9341 +.. nonce: 4nRZmn +.. section: Build + +The interpreter that runs the cross-build, found in PATH, must now be of the +same feature version (e.g. 3.6) as the source being built. + +.. + +.. bpo: 26930 +.. date: 9340 +.. nonce: 9JUeSD +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2h. + +.. + +.. bpo: 23968 +.. date: 9339 +.. nonce: 7AuSK9 +.. section: Build + +Rename the platform directory from plat-$(MACHDEP) to +plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from +config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET). Install the +platform specifc _sysconfigdata module into the platform directory and +rename it to include the ABIFLAGS. + +.. + +.. bpo: 0 +.. date: 9338 +.. nonce: U46i2u +.. section: Build + +Don't use largefile support for GNU/Hurd. + +.. + +.. bpo: 27332 +.. date: 9337 +.. nonce: OuRZp9 +.. section: Tools/Demos + +Fixed the type of the first argument of module-level functions generated by +Argument Clinic. Patch by Petr Viktorin. + +.. + +.. bpo: 27418 +.. date: 9336 +.. nonce: W2m_8I +.. section: Tools/Demos + +Fixed Tools/importbench/importbench.py. + +.. + +.. bpo: 19489 +.. date: 9335 +.. nonce: jvzuO7 +.. section: Documentation + +Moved the search box from the sidebar to the header and footer of each page. +Patch by Ammar Askar. + +.. + +.. bpo: 27285 +.. date: 9334 +.. nonce: wZur0b +.. section: Documentation + +Update documentation to reflect the deprecation of ``pyvenv`` and normalize +on the term "virtual environment". Patch by Steve Piercy. + +.. + +.. bpo: 27027 +.. date: 9333 +.. nonce: 5oRSGL +.. section: Tests + +Added test.support.is_android that is True when this is an Android build. diff --git a/Misc/NEWS.d/3.6.0a4.rst b/Misc/NEWS.d/3.6.0a4.rst new file mode 100644 index 00000000000..e2480335c5d --- /dev/null +++ b/Misc/NEWS.d/3.6.0a4.rst @@ -0,0 +1,685 @@ +.. bpo: 27704 +.. date: 9455 +.. nonce: RUxzHf +.. release date: 2016-08-15 +.. section: Core and Builtins + +Optimized creating bytes and bytearray from byte-like objects and iterables. +Speed up to 3 times for short objects. Original patch by Naoki Inada. + +.. + +.. bpo: 26823 +.. date: 9454 +.. nonce: UWORiU +.. section: Core and Builtins + +Large sections of repeated lines in tracebacks are now abbreviated as +"[Previous line repeated {count} more times]" by the builtin traceback +rendering. Patch by Emanuel Barry. + +.. + +.. bpo: 27574 +.. date: 9453 +.. nonce: q73Tss +.. section: Core and Builtins + +Decreased an overhead of parsing keyword arguments in functions implemented +with using Argument Clinic. + +.. + +.. bpo: 22557 +.. date: 9452 +.. nonce: Hta2Rz +.. section: Core and Builtins + +Now importing already imported modules is up to 2.5 times faster. + +.. + +.. bpo: 17596 +.. date: 9451 +.. nonce: XgbA9V +.. section: Core and Builtins + +Include to help with Min GW building. + +.. + +.. bpo: 17599 +.. date: 9450 +.. nonce: noy7o1 +.. section: Core and Builtins + +On Windows, rename the privately defined REPARSE_DATA_BUFFER structure to +avoid conflicting with the definition from Min GW. + +.. + +.. bpo: 27507 +.. date: 9449 +.. nonce: 3pX0Be +.. section: Core and Builtins + +Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. + +.. + +.. bpo: 27581 +.. date: 9448 +.. nonce: KezjNt +.. section: Core and Builtins + +Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by +Xiang Zhang. + +.. + +.. bpo: 1621 +.. date: 9447 +.. nonce: _FZWTr +.. section: Core and Builtins + +Avoid signed integer overflow in list and tuple operations. Patch by Xiang +Zhang. + +.. + +.. bpo: 27419 +.. date: 9446 +.. nonce: YaGodL +.. section: Core and Builtins + +Standard __import__() no longer look up "__import__" in globals or builtins +for importing submodules or "from import". Fixed a crash if raise a warning +about unabling to resolve package from __spec__ or __package__. + +.. + +.. bpo: 27083 +.. date: 9445 +.. nonce: F4ZT1C +.. section: Core and Builtins + +Respect the PYTHONCASEOK environment variable under Windows. + +.. + +.. bpo: 27514 +.. date: 9444 +.. nonce: NLbwPG +.. section: Core and Builtins + +Make having too many statically nested blocks a SyntaxError instead of +SystemError. + +.. + +.. bpo: 27366 +.. date: 9443 +.. nonce: VrInsj +.. section: Core and Builtins + +Implemented PEP 487 (Simpler customization of class creation). Upon +subclassing, the __init_subclass__ classmethod is called on the base class. +Descriptors are initialized with __set_name__ after class creation. + +.. + +.. bpo: 26027 +.. date: 9442 +.. nonce: nfVMKM +.. section: Library + +Add PEP 519/__fspath__() support to the os and os.path modules. Includes +code from Jelle Zijlstra. (See also: bpo-27524) + +.. + +.. bpo: 27598 +.. date: 9441 +.. nonce: y7PtEV +.. section: Library + +Add Collections to collections.abc. Patch by Ivan Levkivskyi, docs by Neil +Girdhar. + +.. + +.. bpo: 25958 +.. date: 9440 +.. nonce: X-V4U1 +.. section: Library + +Support "anti-registration" of special methods from various ABCs, like +__hash__, __iter__ or __len__. All these (and several more) can be set to +None in an implementation class and the behavior will be as if the method is +not defined at all. (Previously, this mechanism existed only for __hash__, +to make mutable classes unhashable.) Code contributed by Andrew Barnert and +Ivan Levkivskyi. + +.. + +.. bpo: 16764 +.. date: 9439 +.. nonce: cPbNjL +.. section: Library + +Support keyword arguments to zlib.decompress(). Patch by Xiang Zhang. + +.. + +.. bpo: 27736 +.. date: 9438 +.. nonce: 8kMhpQ +.. section: Library + +Prevent segfault after interpreter re-initialization due to ref count +problem introduced in code for Issue #27038 in 3.6.0a3. Patch by Xiang +Zhang. + +.. + +.. bpo: 25628 +.. date: 9437 +.. nonce: UcQnHF +.. section: Library + +The *verbose* and *rename* parameters for collections.namedtuple are now +keyword-only. + +.. + +.. bpo: 12345 +.. date: 9436 +.. nonce: nbAEM8 +.. section: Library + +Add mathematical constant tau to math and cmath. See also PEP 628. + +.. + +.. bpo: 26823 +.. date: 9435 +.. nonce: HcO8tR +.. section: Library + +traceback.StackSummary.format now abbreviates large sections of repeated +lines as "[Previous line repeated {count} more times]" (this change then +further affects other traceback display operations in the module). Patch by +Emanuel Barry. + +.. + +.. bpo: 27664 +.. date: 9434 +.. nonce: 6DJPxw +.. section: Library + +Add to concurrent.futures.thread.ThreadPoolExecutor() the ability to specify +a thread name prefix. + +.. + +.. bpo: 27181 +.. date: 9433 +.. nonce: 8aw9TZ +.. section: Library + +Add geometric_mean and harmonic_mean to statistics module. + +.. + +.. bpo: 27573 +.. date: 9432 +.. nonce: B7XhTs +.. section: Library + +code.interact now prints an message when exiting. + +.. + +.. bpo: 6422 +.. date: 9431 +.. nonce: iBSc45 +.. section: Library + +Add autorange method to timeit.Timer objects. + +.. + +.. bpo: 27773 +.. date: 9430 +.. nonce: hMSSeX +.. section: Library + +Correct some memory management errors server_hostname in _ssl.wrap_socket(). + +.. + +.. bpo: 26750 +.. date: 9429 +.. nonce: OQn3fr +.. section: Library + +unittest.mock.create_autospec() now works properly for subclasses of +property() and other data descriptors. Removes the never publicly used, +never documented unittest.mock.DescriptorTypes tuple. + +.. + +.. bpo: 26754 +.. date: 9428 +.. nonce: XZqomf +.. section: Library + +Undocumented support of general bytes-like objects as path in compile() and +similar functions is now deprecated. + +.. + +.. bpo: 26800 +.. date: 9427 +.. nonce: QDcK8u +.. section: Library + +Undocumented support of general bytes-like objects as paths in os functions +is now deprecated. + +.. + +.. bpo: 26981 +.. date: 9426 +.. nonce: yhNTCf +.. section: Library + +Add _order_ compatibility shim to enum.Enum for Python 2/3 code bases. + +.. + +.. bpo: 27661 +.. date: 9425 +.. nonce: 3JZckO +.. section: Library + +Added tzinfo keyword argument to datetime.combine. + +.. + +.. bpo: 0 +.. date: 9424 +.. nonce: Ny9oPv +.. section: Library + +In the curses module, raise an error if window.getstr() or window.instr() is +passed a negative value. + +.. + +.. bpo: 27783 +.. date: 9423 +.. nonce: cR1jXH +.. section: Library + +Fix possible usage of uninitialized memory in operator.methodcaller. + +.. + +.. bpo: 27774 +.. date: 9422 +.. nonce: FDcik1 +.. section: Library + +Fix possible Py_DECREF on unowned object in _sre. + +.. + +.. bpo: 27760 +.. date: 9421 +.. nonce: gxMjp4 +.. section: Library + +Fix possible integer overflow in binascii.b2a_qp. + +.. + +.. bpo: 27758 +.. date: 9420 +.. nonce: 0NRV03 +.. section: Library + +Fix possible integer overflow in the _csv module for large record lengths. + +.. + +.. bpo: 27568 +.. date: 9419 +.. nonce: OnuO9s +.. section: Library + +Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the HTTP_PROXY variable +when REQUEST_METHOD environment is set, which indicates that the script is +in CGI mode. + +.. + +.. bpo: 7063 +.. date: 9418 +.. nonce: nXsVKB +.. section: Library + +Remove dead code from the "array" module's slice handling. Patch by Chuck. + +.. + +.. bpo: 27656 +.. date: 9417 +.. nonce: joTscM +.. section: Library + +Do not assume sched.h defines any SCHED_* constants. + +.. + +.. bpo: 27130 +.. date: 9416 +.. nonce: SUxwXZ +.. section: Library + +In the "zlib" module, fix handling of large buffers (typically 4 GiB) when +compressing and decompressing. Previously, inputs were limited to 4 GiB, +and compression and decompression operations did not properly handle results +of 4 GiB. + +.. + +.. bpo: 24773 +.. date: 9415 +.. nonce: IDW05R +.. section: Library + +Implemented PEP 495 (Local Time Disambiguation). + +.. + +.. bpo: 0 +.. date: 9414 +.. nonce: lOkwM8 +.. section: Library + +Expose the EPOLLEXCLUSIVE constant (when it is defined) in the select +module. + +.. + +.. bpo: 27567 +.. date: 9413 +.. nonce: bYOgyw +.. section: Library + +Expose the EPOLLRDHUP and POLLRDHUP constants in the select module. + +.. + +.. bpo: 1621 +.. date: 9412 +.. nonce: 0nclmI +.. section: Library + +Avoid signed int negation overflow in the "audioop" module. + +.. + +.. bpo: 27533 +.. date: 9411 +.. nonce: iDmKzV +.. section: Library + +Release GIL in nt._isdir + +.. + +.. bpo: 17711 +.. date: 9410 +.. nonce: 47AILJ +.. section: Library + +Fixed unpickling by the persistent ID with protocol 0. Original patch by +Alexandre Vassalotti. + +.. + +.. bpo: 27522 +.. date: 9409 +.. nonce: 8vVz_t +.. section: Library + +Avoid an unintentional reference cycle in email.feedparser. + +.. + +.. bpo: 27512 +.. date: 9408 +.. nonce: FaGwup +.. section: Library + +Fix a segfault when os.fspath() called an __fspath__() method that raised an +exception. Patch by Xiang Zhang. + +.. + +.. bpo: 27714 +.. date: 9407 +.. nonce: bUEDsI +.. section: IDLE + +text_textview and test_autocomplete now pass when re-run in the same +process. This occurs when test_idle fails when run with the -w option but +without -jn. Fix warning from test_config. + +.. + +.. bpo: 27621 +.. date: 9406 +.. nonce: BcpOPU +.. section: IDLE + +Put query response validation error messages in the query box itself instead +of in a separate massagebox. Redo tests to match. Add Mac OSX refinements. +Original patch by Mark Roseman. + +.. + +.. bpo: 27620 +.. date: 9405 +.. nonce: TXRR6x +.. section: IDLE + +Escape key now closes Query box as cancelled. + +.. + +.. bpo: 27609 +.. date: 9404 +.. nonce: MbTuKa +.. section: IDLE + +IDLE: tab after initial whitespace should tab, not autocomplete. This fixes +problem with writing docstrings at least twice indented. + +.. + +.. bpo: 27609 +.. date: 9403 +.. nonce: OBYgv_ +.. section: IDLE + +Explicitly return None when there are also non-None returns. In a few cases, +reverse a condition and eliminate a return. + +.. + +.. bpo: 25507 +.. date: 9402 +.. nonce: lxf68d +.. section: IDLE + +IDLE no longer runs buggy code because of its tkinter imports. Users must +include the same imports required to run directly in Python. + +.. + +.. bpo: 27173 +.. date: 9401 +.. nonce: M-fYaV +.. section: IDLE + +Add 'IDLE Modern Unix' to the built-in key sets. Make the default key set +depend on the platform. Add tests for the changes to the config module. + +.. + +.. bpo: 27452 +.. date: 9400 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 25805 +.. date: 9399 +.. nonce: 9SVxXQ +.. section: Tests + +Skip a test in test_pkgutil as needed that doesn't work when ``__name__ == +__main__``. Patch by SilentGhost. + +.. + +.. bpo: 27472 +.. date: 9398 +.. nonce: NS3L93 +.. section: Tests + +Add test.support.unix_shell as the path to the default shell. + +.. + +.. bpo: 27369 +.. date: 9397 +.. nonce: LG7U2D +.. section: Tests + +In test_pyexpat, avoid testing an error message detail that changed in Expat +2.2.0. + +.. + +.. bpo: 27594 +.. date: 9396 +.. nonce: w3F57B +.. section: Tests + +Prevent assertion error when running test_ast with coverage enabled: ensure +code object has a valid first line number. Patch suggested by Ivan +Levkivskyi. + +.. + +.. bpo: 27647 +.. date: 9395 +.. nonce: -1HUR6 +.. section: Windows + +Update bundled Tcl/Tk to 8.6.6. + +.. + +.. bpo: 27610 +.. date: 9394 +.. nonce: O0o0mB +.. section: Windows + +Adds PEP 514 metadata to Windows installer + +.. + +.. bpo: 27469 +.. date: 9393 +.. nonce: 0GwDkX +.. section: Windows + +Adds a shell extension to the launcher so that drag and drop works +correctly. + +.. + +.. bpo: 27309 +.. date: 9392 +.. nonce: chiOo6 +.. section: Windows + +Enables proper Windows styles in python[w].exe manifest. + +.. + +.. bpo: 27713 +.. date: 9391 +.. nonce: _3DgXG +.. section: Build + +Suppress spurious build warnings when updating importlib's bootstrap files. +Patch by Xiang Zhang + +.. + +.. bpo: 25825 +.. date: 9390 +.. nonce: MLbdVU +.. section: Build + +Correct the references to Modules/python.exp, which is required on AIX. The +references were accidentally changed in 3.5.0a1. + +.. + +.. bpo: 27453 +.. date: 9389 +.. nonce: Pb5DBi +.. section: Build + +CPP invocation in configure must use CPPFLAGS. Patch by Chi Hsuan Yen. + +.. + +.. bpo: 27641 +.. date: 9388 +.. nonce: eGzgCk +.. section: Build + +The configure script now inserts comments into the makefile to prevent the +pgen and _freeze_importlib executables from being cross- compiled. + +.. + +.. bpo: 26662 +.. date: 9387 +.. nonce: XkwRxM +.. section: Build + +Set PYTHON_FOR_GEN in configure as the Python program to be used for file +generation during the build. + +.. + +.. bpo: 10910 +.. date: 9386 +.. nonce: ZdRayb +.. section: Build + +Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD +version checks for the original ctype UTF-8 workaround. diff --git a/Misc/NEWS.d/3.6.0b1.rst b/Misc/NEWS.d/3.6.0b1.rst new file mode 100644 index 00000000000..655f6f749e4 --- /dev/null +++ b/Misc/NEWS.d/3.6.0b1.rst @@ -0,0 +1,1608 @@ +.. bpo: 23722 +.. date: 9619 +.. nonce: C-8boi +.. release date: 2016-09-12 +.. section: Core and Builtins + +The __class__ cell used by zero-argument super() is now initialized from +type.__new__ rather than __build_class__, so class methods relying on that +will now work correctly when called from metaclass methods during class +creation. Patch by Martin Teichmann. + +.. + +.. bpo: 25221 +.. date: 9618 +.. nonce: 9YbOxB +.. section: Core and Builtins + +Fix corrupted result from PyLong_FromLong(0) when Python is compiled with +NSMALLPOSINTS = 0. + +.. + +.. bpo: 27080 +.. date: 9617 +.. nonce: Te4Tjb +.. section: Core and Builtins + +Implement formatting support for PEP 515. Initial patch by Chris Angelico. + +.. + +.. bpo: 27199 +.. date: 9616 +.. nonce: GheADD +.. section: Core and Builtins + +In tarfile, expose copyfileobj bufsize to improve throughput. Patch by Jason +Fried. + +.. + +.. bpo: 27948 +.. date: 9615 +.. nonce: Rpw5nq +.. section: Core and Builtins + +In f-strings, only allow backslashes inside the braces (where the +expressions are). This is a breaking change from the 3.6 alpha releases, +where backslashes are allowed anywhere in an f-string. Also, require that +expressions inside f-strings be enclosed within literal braces, and not +escapes like ``f'\x7b"hi"\x7d'``. + +.. + +.. bpo: 28046 +.. date: 9614 +.. nonce: liHxFW +.. section: Core and Builtins + +Remove platform-specific directories from sys.path. + +.. + +.. bpo: 28071 +.. date: 9613 +.. nonce: PffE44 +.. section: Core and Builtins + +Add early-out for differencing from an empty set. + +.. + +.. bpo: 25758 +.. date: 9612 +.. nonce: yR-YTD +.. section: Core and Builtins + +Prevents zipimport from unnecessarily encoding a filename (patch by Eryk +Sun) + +.. + +.. bpo: 25856 +.. date: 9611 +.. nonce: neCvXl +.. section: Core and Builtins + +The __module__ attribute of extension classes and functions now is interned. +This leads to more compact pickle data with protocol 4. + +.. + +.. bpo: 27213 +.. date: 9610 +.. nonce: VCfkkp +.. section: Core and Builtins + +Rework CALL_FUNCTION* opcodes to produce shorter and more efficient +bytecode. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by +Serhiy Storchaka and Victor Stinner. + +.. + +.. bpo: 26331 +.. date: 9609 +.. nonce: TdJp8_ +.. section: Core and Builtins + +Implement tokenizing support for PEP 515. Patch by Georg Brandl. + +.. + +.. bpo: 27999 +.. date: 9608 +.. nonce: 8aacQj +.. section: Core and Builtins + +Make "global after use" a SyntaxError, and ditto for nonlocal. Patch by Ivan +Levkivskyi. + +.. + +.. bpo: 28003 +.. date: 9607 +.. nonce: noeoav +.. section: Core and Builtins + +Implement PEP 525 -- Asynchronous Generators. + +.. + +.. bpo: 27985 +.. date: 9606 +.. nonce: 0ayJ5k +.. section: Core and Builtins + +Implement PEP 526 -- Syntax for Variable Annotations. Patch by Ivan +Levkivskyi. + +.. + +.. bpo: 26058 +.. date: 9605 +.. nonce: UR_ojv +.. section: Core and Builtins + +Add a new private version to the builtin dict type, incremented at each +dictionary creation and at each dictionary change. Implementation of the PEP +509. + +.. + +.. bpo: 27364 +.. date: 9604 +.. nonce: 8u_LoD +.. section: Core and Builtins + +A backslash-character pair that is not a valid escape sequence now generates +a DeprecationWarning. Patch by Emanuel Barry. + +.. + +.. bpo: 27350 +.. date: 9603 +.. nonce: aABzcL +.. section: Core and Builtins + +`dict` implementation is changed like PyPy. It is more compact and preserves +insertion order. (Concept developed by Raymond Hettinger and patch by Inada +Naoki.) + +.. + +.. bpo: 27911 +.. date: 9602 +.. nonce: 1eaHRd +.. section: Core and Builtins + +Remove unnecessary error checks in ``exec_builtin_or_dynamic()``. + +.. + +.. bpo: 27078 +.. date: 9601 +.. nonce: ZevPQR +.. section: Core and Builtins + +Added BUILD_STRING opcode. Optimized f-strings evaluation. + +.. + +.. bpo: 17884 +.. date: 9600 +.. nonce: wGy0dr +.. section: Core and Builtins + +Python now requires systems with inttypes.h and stdint.h + +.. + +.. bpo: 27961 +.. date: 9599 +.. nonce: EYS8oe +.. section: Core and Builtins + +Require platforms to support ``long long``. Python hasn't compiled without +``long long`` for years, so this is basically a formality. + +.. + +.. bpo: 27355 +.. date: 9598 +.. nonce: qdIpxm +.. section: Core and Builtins + +Removed support for Windows CE. It was never finished, and Windows CE is no +longer a relevant platform for Python. + +.. + +.. bpo: 0 +.. date: 9597 +.. nonce: rdhhVw +.. section: Core and Builtins + +Implement PEP 523. + +.. + +.. bpo: 27870 +.. date: 9596 +.. nonce: Y0u34u +.. section: Core and Builtins + +A left shift of zero by a large integer no longer attempts to allocate large +amounts of memory. + +.. + +.. bpo: 25402 +.. date: 9595 +.. nonce: naeRHq +.. section: Core and Builtins + +In int-to-decimal-string conversion, improve the estimate of the +intermediate memory required, and remove an unnecessarily strict overflow +check. Patch by Serhiy Storchaka. + +.. + +.. bpo: 27214 +.. date: 9594 +.. nonce: CDh8S4 +.. section: Core and Builtins + +In long_invert, be more careful about modifying object returned by long_add, +and remove an unnecessary check for small longs. Thanks Oren Milman for +analysis and patch. + +.. + +.. bpo: 27506 +.. date: 9593 +.. nonce: eK87PI +.. section: Core and Builtins + +Support passing the bytes/bytearray.translate() "delete" argument by +keyword. + +.. + +.. bpo: 27812 +.. date: 9592 +.. nonce: sidcs8 +.. section: Core and Builtins + +Properly clear out a generator's frame's backreference to the generator to +prevent crashes in frame.clear(). + +.. + +.. bpo: 27811 +.. date: 9591 +.. nonce: T4AuBo +.. section: Core and Builtins + +Fix a crash when a coroutine that has not been awaited is finalized with +warnings-as-errors enabled. + +.. + +.. bpo: 27587 +.. date: 9590 +.. nonce: mbavY2 +.. section: Core and Builtins + +Fix another issue found by PVS-Studio: Null pointer check after use of 'def' +in _PyState_AddModule(). Initial patch by Christian Heimes. + +.. + +.. bpo: 27792 +.. date: 9589 +.. nonce: Np6_Hl +.. section: Core and Builtins + +The modulo operation applied to ``bool`` and other ``int`` subclasses now +always returns an ``int``. Previously the return type depended on the input +values. Patch by Xiang Zhang. + +.. + +.. bpo: 26984 +.. date: 9588 +.. nonce: 7--80J +.. section: Core and Builtins + +int() now always returns an instance of exact int. + +.. + +.. bpo: 25604 +.. date: 9587 +.. nonce: UkeHGy +.. section: Core and Builtins + +Fix a minor bug in integer true division; this bug could potentially have +caused off-by-one-ulp results on platforms with unreliable ldexp +implementations. + +.. + +.. bpo: 24254 +.. date: 9586 +.. nonce: 368r1U +.. section: Core and Builtins + +Make class definition namespace ordered by default. + +.. + +.. bpo: 27662 +.. date: 9585 +.. nonce: a8cBpq +.. section: Core and Builtins + +Fix an overflow check in ``List_New``: the original code was checking +against ``Py_SIZE_MAX`` instead of the correct upper bound of +``Py_SSIZE_T_MAX``. Patch by Xiang Zhang. + +.. + +.. bpo: 27782 +.. date: 9584 +.. nonce: C8OBQD +.. section: Core and Builtins + +Multi-phase extension module import now correctly allows the ``m_methods`` +field to be used to add module level functions to instances of non-module +types returned from ``Py_create_mod``. Patch by Xiang Zhang. + +.. + +.. bpo: 27936 +.. date: 9583 +.. nonce: AdOann +.. section: Core and Builtins + +The round() function accepted a second None argument for some types but not +for others. Fixed the inconsistency by accepting None for all numeric +types. + +.. + +.. bpo: 27487 +.. date: 9582 +.. nonce: jeTQNr +.. section: Core and Builtins + +Warn if a submodule argument to "python -m" or runpy.run_module() is found +in sys.modules after parent packages are imported, but before the submodule +is executed. + +.. + +.. bpo: 27157 +.. date: 9581 +.. nonce: Wf_eFE +.. section: Core and Builtins + +Make only type() itself accept the one-argument form. Patch by Eryk Sun and +Emanuel Barry. + +.. + +.. bpo: 27558 +.. date: 9580 +.. nonce: VmltMh +.. section: Core and Builtins + +Fix a SystemError in the implementation of "raise" statement. In a brand new +thread, raise a RuntimeError since there is no active exception to reraise. +Patch written by Xiang Zhang. + +.. + +.. bpo: 28008 +.. date: 9579 +.. nonce: 0DdIrA +.. section: Core and Builtins + +Implement PEP 530 -- asynchronous comprehensions. + +.. + +.. bpo: 27942 +.. date: 9578 +.. nonce: wCAkW5 +.. section: Core and Builtins + +Fix memory leak in codeobject.c + +.. + +.. bpo: 28732 +.. date: 9577 +.. nonce: xkG8k7 +.. section: Library + +Fix crash in os.spawnv() with no elements in args + +.. + +.. bpo: 28485 +.. date: 9576 +.. nonce: WuKqKh +.. section: Library + +Always raise ValueError for negative compileall.compile_dir(workers=...) +parameter, even when multithreading is unavailable. + +.. + +.. bpo: 28037 +.. date: 9575 +.. nonce: -3u7zq +.. section: Library + +Use sqlite3_get_autocommit() instead of setting Connection->inTransaction +manually. + +.. + +.. bpo: 25283 +.. date: 9574 +.. nonce: qwQDX2 +.. section: Library + +Attributes tm_gmtoff and tm_zone are now available on all platforms in the +return values of time.localtime() and time.gmtime(). + +.. + +.. bpo: 24454 +.. date: 9573 +.. nonce: pUTKOA +.. section: Library + +Regular expression match object groups are now accessible using __getitem__. +"mo[x]" is equivalent to "mo.group(x)". + +.. + +.. bpo: 10740 +.. date: 9572 +.. nonce: 8iGFan +.. section: Library + +sqlite3 no longer implicitly commit an open transaction before DDL +statements. + +.. + +.. bpo: 17941 +.. date: 9571 +.. nonce: E9rm_o +.. section: Library + +Add a *module* parameter to collections.namedtuple(). + +.. + +.. bpo: 22493 +.. date: 9570 +.. nonce: yDfUrj +.. section: Library + +Inline flags now should be used only at the start of the regular expression. +Deprecation warning is emitted if uses them in the middle of the regular +expression. + +.. + +.. bpo: 26885 +.. date: 9569 +.. nonce: TJ779X +.. section: Library + +xmlrpc now supports unmarshalling additional data types used by Apache XML- +RPC implementation for numerics and None. + +.. + +.. bpo: 28070 +.. date: 9568 +.. nonce: Kot8Hu +.. section: Library + +Fixed parsing inline verbose flag in regular expressions. + +.. + +.. bpo: 19500 +.. date: 9567 +.. nonce: H7q5im +.. section: Library + +Add client-side SSL session resumption to the ssl module. + +.. + +.. bpo: 28022 +.. date: 9566 +.. nonce: 08kTMg +.. section: Library + +Deprecate ssl-related arguments in favor of SSLContext. The deprecation +include manual creation of SSLSocket and certfile/keyfile (or similar) in +ftplib, httplib, imaplib, smtplib, poplib and urllib. + +.. + +.. bpo: 28043 +.. date: 9565 +.. nonce: 588Oy3 +.. section: Library + +SSLContext has improved default settings: OP_NO_SSLv2, OP_NO_SSLv3, +OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, +OP_SINGLE_ECDH_USE and HIGH ciphers without MD5. + +.. + +.. bpo: 24693 +.. date: 9564 +.. nonce: a63Shp +.. section: Library + +Changed some RuntimeError's in the zipfile module to more appropriate types. +Improved some error messages and debugging output. + +.. + +.. bpo: 17909 +.. date: 9563 +.. nonce: SMNkt6 +.. section: Library + +``json.load`` and ``json.loads`` now support binary input encoded as UTF-8, +UTF-16 or UTF-32. Patch by Serhiy Storchaka. + +.. + +.. bpo: 27137 +.. date: 9562 +.. nonce: frjG8W +.. section: Library + +the pure Python fallback implementation of ``functools.partial`` now matches +the behaviour of its accelerated C counterpart for subclassing, pickling and +text representation purposes. Patch by Emanuel Barry and Serhiy Storchaka. + +.. + +.. bpo: 0 +.. date: 9561 +.. nonce: 81jNns +.. section: Library + +Fix possible integer overflows and crashes in the mmap module with unusual +usage patterns. + +.. + +.. bpo: 1703178 +.. date: 9560 +.. nonce: meb49K +.. section: Library + +Fix the ability to pass the --link-objects option to the distutils build_ext +command. + +.. + +.. bpo: 28019 +.. date: 9559 +.. nonce: KUhBaS +.. section: Library + +itertools.count() no longer rounds non-integer step in range between 1.0 and +2.0 to 1. + +.. + +.. bpo: 18401 +.. date: 9558 +.. nonce: _12WDV +.. section: Library + +Pdb now supports the 'readrc' keyword argument to control whether .pdbrc +files should be read. Patch by Martin Matusiak and Sam Kimbrel. + +.. + +.. bpo: 25969 +.. date: 9557 +.. nonce: qSPkl- +.. section: Library + +Update the lib2to3 grammar to handle the unpacking generalizations added in +3.5. + +.. + +.. bpo: 14977 +.. date: 9556 +.. nonce: 4MvALg +.. section: Library + +mailcap now respects the order of the lines in the mailcap files ("first +match"), as required by RFC 1542. Patch by Michael Lazar. + +.. + +.. bpo: 28082 +.. date: 9555 +.. nonce: EICw4d +.. section: Library + +Convert re flag constants to IntFlag. + +.. + +.. bpo: 28025 +.. date: 9554 +.. nonce: YxcZHY +.. section: Library + +Convert all ssl module constants to IntEnum and IntFlags. SSLContext +properties now return flags and enums. + +.. + +.. bpo: 23591 +.. date: 9553 +.. nonce: 7gSXAN +.. section: Library + +Add Flag, IntFlag, and auto() to enum module. + +.. + +.. bpo: 433028 +.. date: 9552 +.. nonce: yGjT0q +.. section: Library + +Added support of modifier spans in regular expressions. + +.. + +.. bpo: 24594 +.. date: 9551 +.. nonce: 9CnFVS +.. section: Library + +Validates persist parameter when opening MSI database + +.. + +.. bpo: 17582 +.. date: 9550 +.. nonce: MXEHxQ +.. section: Library + +xml.etree.ElementTree nows preserves whitespaces in attributes (Patch by +Duane Griffin. Reviewed and approved by Stefan Behnel.) + +.. + +.. bpo: 28047 +.. date: 9549 +.. nonce: pDu3Fm +.. section: Library + +Fixed calculation of line length used for the base64 CTE in the new email +policies. + +.. + +.. bpo: 27576 +.. date: 9548 +.. nonce: tqZxYv +.. section: Library + +Fix call order in OrderedDict.__init__(). + +.. + +.. bpo: 0 +.. date: 9547 +.. nonce: cxHuUo +.. section: Library + +email.generator.DecodedGenerator now supports the policy keyword. + +.. + +.. bpo: 28027 +.. date: 9546 +.. nonce: v39s1z +.. section: Library + +Remove undocumented modules from ``Lib/plat-*``: IN, CDROM, DLFCN, TYPES, +CDIO, and STROPTS. + +.. + +.. bpo: 27445 +.. date: 9545 +.. nonce: wOG0C0 +.. section: Library + +Don't pass str(_charset) to MIMEText.set_payload(). Patch by Claude Paroz. + +.. + +.. bpo: 24277 +.. date: 9544 +.. nonce: OgDA28 +.. section: Library + +The new email API is no longer provisional, and the docs have been +reorganized and rewritten to emphasize the new API. + +.. + +.. bpo: 22450 +.. date: 9543 +.. nonce: T3Sn_J +.. section: Library + +urllib now includes an ``Accept: */*`` header among the default headers. +This makes the results of REST API requests more consistent and predictable +especially when proxy servers are involved. + +.. + +.. bpo: 0 +.. date: 9542 +.. nonce: PVZStR +.. section: Library + +lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between +runs given the same Grammar.txt input regardless of the hash randomization +setting. + +.. + +.. bpo: 28005 +.. date: 9541 +.. nonce: oJLK1w +.. section: Library + +Allow ImportErrors in encoding implementation to propagate. + +.. + +.. bpo: 26667 +.. date: 9540 +.. nonce: hWs9wA +.. section: Library + +Support path-like objects in importlib.util. + +.. + +.. bpo: 27570 +.. date: 9539 +.. nonce: pU0Zie +.. section: Library + +Avoid zero-length memcpy() etc calls with null source pointers in the +"ctypes" and "array" modules. + +.. + +.. bpo: 22233 +.. date: 9538 +.. nonce: uXSN0R +.. section: Library + +Break email header lines *only* on the RFC specified CR and LF characters, +not on arbitrary unicode line breaks. This also fixes a bug in HTTP header +parsing. + +.. + +.. bpo: 27331 +.. date: 9537 +.. nonce: akOxfh +.. section: Library + +The email.mime classes now all accept an optional policy keyword. + +.. + +.. bpo: 27988 +.. date: 9536 +.. nonce: VfMzZH +.. section: Library + +Fix email iter_attachments incorrect mutation of payload list. + +.. + +.. bpo: 16113 +.. date: 9535 +.. nonce: jyKRxs +.. section: Library + +Add SHA-3 and SHAKE support to hashlib module. + +.. + +.. bpo: 0 +.. date: 9534 +.. nonce: j7npJi +.. section: Library + +Eliminate a tautological-pointer-compare warning in _scproxy.c. + +.. + +.. bpo: 27776 +.. date: 9533 +.. nonce: dOJcUU +.. section: Library + +The :func:`os.urandom` function does now block on Linux 3.17 and newer until +the system urandom entropy pool is initialized to increase the security. +This change is part of the :pep:`524`. + +.. + +.. bpo: 27778 +.. date: 9532 +.. nonce: gvbf3F +.. section: Library + +Expose the Linux ``getrandom()`` syscall as a new :func:`os.getrandom` +function. This change is part of the :pep:`524`. + +.. + +.. bpo: 27691 +.. date: 9531 +.. nonce: TMYF5_ +.. section: Library + +Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 +certs. + +.. + +.. bpo: 18844 +.. date: 9530 +.. nonce: OZnLOi +.. section: Library + +Add random.choices(). + +.. + +.. bpo: 25761 +.. date: 9529 +.. nonce: qd--Ta +.. section: Library + +Improved error reporting about truncated pickle data in C implementation of +unpickler. UnpicklingError is now raised instead of AttributeError and +ValueError in some cases. + +.. + +.. bpo: 26798 +.. date: 9528 +.. nonce: he58yl +.. section: Library + +Add BLAKE2 (blake2b and blake2s) to hashlib. + +.. + +.. bpo: 26032 +.. date: 9527 +.. nonce: v5ByZW +.. section: Library + +Optimized globbing in pathlib by using os.scandir(); it is now about 1.5--4 +times faster. + +.. + +.. bpo: 25596 +.. date: 9526 +.. nonce: TFtyjC +.. section: Library + +Optimized glob() and iglob() functions in the glob module; they are now +about 3--6 times faster. + +.. + +.. bpo: 27928 +.. date: 9525 +.. nonce: vG2f6q +.. section: Library + +Add scrypt (password-based key derivation function) to hashlib module +(requires OpenSSL 1.1.0). + +.. + +.. bpo: 27850 +.. date: 9524 +.. nonce: kIVQ0m +.. section: Library + +Remove 3DES from ssl module's default cipher list to counter measure sweet32 +attack (CVE-2016-2183). + +.. + +.. bpo: 27766 +.. date: 9523 +.. nonce: WI70Tc +.. section: Library + +Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL +1.1.0 or LibreSSL). + +.. + +.. bpo: 25387 +.. date: 9522 +.. nonce: -wsV59 +.. section: Library + +Check return value of winsound.MessageBeep. + +.. + +.. bpo: 27866 +.. date: 9521 +.. nonce: FM3-BZ +.. section: Library + +Add SSLContext.get_ciphers() method to get a list of all enabled ciphers. + +.. + +.. bpo: 27744 +.. date: 9520 +.. nonce: 2cVMpG +.. section: Library + +Add AF_ALG (Linux Kernel crypto) to socket module. + +.. + +.. bpo: 26470 +.. date: 9519 +.. nonce: QGu_wo +.. section: Library + +Port ssl and hashlib module to OpenSSL 1.1.0. + +.. + +.. bpo: 11620 +.. date: 9518 +.. nonce: JyL-Po +.. section: Library + +Fix support for SND_MEMORY in winsound.PlaySound. Based on a patch by Tim +Lesher. + +.. + +.. bpo: 11734 +.. date: 9517 +.. nonce: AQoy-q +.. section: Library + +Add support for IEEE 754 half-precision floats to the struct module. Based +on a patch by Eli Stevens. + +.. + +.. bpo: 27919 +.. date: 9516 +.. nonce: NRqNEW +.. section: Library + +Deprecated ``extra_path`` distribution option in distutils packaging. + +.. + +.. bpo: 23229 +.. date: 9515 +.. nonce: gXhSFh +.. section: Library + +Add new ``cmath`` constants: ``cmath.inf`` and ``cmath.nan`` to match +``math.inf`` and ``math.nan``, and also ``cmath.infj`` and ``cmath.nanj`` to +match the format used by complex repr. + +.. + +.. bpo: 27842 +.. date: 9514 +.. nonce: qlhp0- +.. section: Library + +The csv.DictReader now returns rows of type OrderedDict. (Contributed by +Steve Holden.) + +.. + +.. bpo: 0 +.. date: 9513 +.. nonce: 6TjEgz +.. section: Library + +Remove support for passing a file descriptor to os.access. It never worked +but previously didn't raise. + +.. + +.. bpo: 12885 +.. date: 9512 +.. nonce: r-IV1g +.. section: Library + +Fix error when distutils encounters symlink. + +.. + +.. bpo: 27881 +.. date: 9511 +.. nonce: fkETd9 +.. section: Library + +Fixed possible bugs when setting sqlite3.Connection.isolation_level. Based +on patch by Xiang Zhang. + +.. + +.. bpo: 27861 +.. date: 9510 +.. nonce: DBYuo9 +.. section: Library + +Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a +cursor. Patch by Xiang Zhang. + +.. + +.. bpo: 19884 +.. date: 9509 +.. nonce: MO8AWH +.. section: Library + +Avoid spurious output on OS X with Gnu Readline. + +.. + +.. bpo: 27706 +.. date: 9508 +.. nonce: ZY67yu +.. section: Library + +Restore deterministic behavior of random.Random().seed() for string seeds +using seeding version 1. Allows sequences of calls to random() to exactly +match those obtained in Python 2. Patch by Nofar Schnider. + +.. + +.. bpo: 10513 +.. date: 9507 +.. nonce: tQIQD_ +.. section: Library + +Fix a regression in Connection.commit(). Statements should not be reset +after a commit. + +.. + +.. bpo: 12319 +.. date: 9506 +.. nonce: Wc4oUu +.. section: Library + +Chunked transfer encoding support added to http.client.HTTPConnection +requests. The urllib.request.AbstractHTTPHandler class does not enforce a +Content-Length header any more. If a HTTP request has a file or iterable +body, but no Content-Length header, the library now falls back to use +chunked transfer- encoding. + +.. + +.. bpo: 0 +.. date: 9505 +.. nonce: cYraeH +.. section: Library + +A new version of typing.py from https://github.com/python/typing: - +Collection (only for 3.6) (Issue #27598) - Add FrozenSet to __all__ +(upstream #261) - fix crash in _get_type_vars() (upstream #259) - Remove the +dict constraint in ForwardRef._eval_type (upstream #252) + +.. + +.. bpo: 27832 +.. date: 9504 +.. nonce: hxh6_h +.. section: Library + +Make ``_normalize`` parameter to ``Fraction`` constuctor keyword-only, so +that ``Fraction(2, 3, 4)`` now raises ``TypeError``. + +.. + +.. bpo: 27539 +.. date: 9503 +.. nonce: S4L1cq +.. section: Library + +Fix unnormalised ``Fraction.__pow__`` result in the case of negative +exponent and negative base. + +.. + +.. bpo: 21718 +.. date: 9502 +.. nonce: FUJd-7 +.. section: Library + +cursor.description is now available for queries using CTEs. + +.. + +.. bpo: 27819 +.. date: 9501 +.. nonce: -A_u1x +.. section: Library + +In distutils sdists, simply produce the "gztar" (gzipped tar format) +distributions on all platforms unless "formats" is supplied. + +.. + +.. bpo: 2466 +.. date: 9500 +.. nonce: VRNlkg +.. section: Library + +posixpath.ismount now correctly recognizes mount points which the user does +not have permission to access. + +.. + +.. bpo: 9998 +.. date: 9499 +.. nonce: SNIoPr +.. section: Library + +On Linux, ctypes.util.find_library now looks in LD_LIBRARY_PATH for shared +libraries. + +.. + +.. bpo: 27573 +.. date: 9498 +.. nonce: yuXLnW +.. section: Library + +exit message for code.interact is now configurable. + +.. + +.. bpo: 27930 +.. date: 9497 +.. nonce: BkOfSi +.. section: Library + +Improved behaviour of logging.handlers.QueueListener. Thanks to Paulo +Andrade and Petr Viktorin for the analysis and patch. + +.. + +.. bpo: 6766 +.. date: 9496 +.. nonce: _zO4cV +.. section: Library + +Distributed reference counting added to multiprocessing to support nesting +of shared values / proxy objects. + +.. + +.. bpo: 21201 +.. date: 9495 +.. nonce: wLCKiA +.. section: Library + +Improves readability of multiprocessing error message. Thanks to Wojciech +Walczak for patch. + +.. + +.. bpo: 0 +.. date: 9494 +.. nonce: hgCs-W +.. section: Library + +asyncio: Add set_protocol / get_protocol to Transports. + +.. + +.. bpo: 27456 +.. date: 9493 +.. nonce: lI_IE7 +.. section: Library + +asyncio: Set TCP_NODELAY by default. + +.. + +.. bpo: 15308 +.. date: 9492 +.. nonce: zZxn8m +.. section: IDLE + +Add 'interrupt execution' (^C) to Shell menu. Patch by Roger Serwy, updated +by Bayard Randel. + +.. + +.. bpo: 27922 +.. date: 9491 +.. nonce: UEtEv9 +.. section: IDLE + +Stop IDLE tests from 'flashing' gui widgets on the screen. + +.. + +.. bpo: 27891 +.. date: 9490 +.. nonce: 7W5cAj +.. section: IDLE + +Consistently group and sort imports within idlelib modules. + +.. + +.. bpo: 17642 +.. date: 9489 +.. nonce: B0BNOB +.. section: IDLE + +add larger font sizes for classroom projection. + +.. + +.. bpo: 0 +.. date: 9488 +.. nonce: zWZs6o +.. section: IDLE + +Add version to title of IDLE help window. + +.. + +.. bpo: 25564 +.. date: 9487 +.. nonce: GN0p14 +.. section: IDLE + +In section on IDLE -- console differences, mention that using exec means +that __builtins__ is defined for each statement. + +.. + +.. bpo: 27821 +.. date: 9486 +.. nonce: Vzr42u +.. section: IDLE + +Fix 3.6.0a3 regression that prevented custom key sets from being selected +when no custom theme was defined. + +.. + +.. bpo: 26900 +.. date: 9485 +.. nonce: 0erSIc +.. section: C API + +Excluded underscored names and other private API from limited API. + +.. + +.. bpo: 26027 +.. date: 9484 +.. nonce: 5uVb7n +.. section: C API + +Add support for path-like objects in PyUnicode_FSConverter() & +PyUnicode_FSDecoder(). + +.. + +.. bpo: 27427 +.. date: 9483 +.. nonce: OGhkYQ +.. section: Tests + +Additional tests for the math module. Patch by Francisco Couzo. + +.. + +.. bpo: 27953 +.. date: 9482 +.. nonce: oP3nuf +.. section: Tests + +Skip math and cmath tests that fail on OS X 10.4 due to a poor libm +implementation of tan. + +.. + +.. bpo: 26040 +.. date: 9481 +.. nonce: RvSU5I +.. section: Tests + +Improve test_math and test_cmath coverage and rigour. Patch by Jeff Allen. + +.. + +.. bpo: 27787 +.. date: 9480 +.. nonce: kf0YAt +.. section: Tests + +Call gc.collect() before checking each test for "dangling threads", since +the dangling threads are weak references. + +.. + +.. bpo: 27566 +.. date: 9479 +.. nonce: xDWjEb +.. section: Build + +Fix clean target in freeze makefile (patch by Lisa Roach) + +.. + +.. bpo: 27705 +.. date: 9478 +.. nonce: 8C2Ms3 +.. section: Build + +Update message in validate_ucrtbase.py + +.. + +.. bpo: 27976 +.. date: 9477 +.. nonce: z0CT-3 +.. section: Build + +Deprecate building _ctypes with the bundled copy of libffi on non-OSX UNIX +platforms. + +.. + +.. bpo: 27983 +.. date: 9476 +.. nonce: jL_1n8 +.. section: Build + +Cause lack of llvm-profdata tool when using clang as required for PGO +linking to be a configure time error rather than make time when --with- +optimizations is enabled. Also improve our ability to find the llvm- +profdata tool on MacOS and some Linuxes. + +.. + +.. bpo: 21590 +.. date: 9475 +.. nonce: haPolL +.. section: Build + +Support for DTrace and SystemTap probes. + +.. + +.. bpo: 26307 +.. date: 9474 +.. nonce: Puk2rd +.. section: Build + +The profile-opt build now applies PGO to the built-in modules. + +.. + +.. bpo: 26359 +.. date: 9473 +.. nonce: uxKCqR +.. section: Build + +Add the --with-optimizations flag to turn on LTO and PGO build support when +available. + +.. + +.. bpo: 27917 +.. date: 9472 +.. nonce: 8V2esX +.. section: Build + +Set platform triplets for Android builds. + +.. + +.. bpo: 25825 +.. date: 9471 +.. nonce: PwGiUI +.. section: Build + +Update references to the $(LIBPL) installation path on AIX. This path was +changed in 3.2a4. + +.. + +.. bpo: 0 +.. date: 9470 +.. nonce: G27B6T +.. section: Build + +Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2. + +.. + +.. bpo: 21122 +.. date: 9469 +.. nonce: 98ovv8 +.. section: Build + +Fix LTO builds on OS X. + +.. + +.. bpo: 17128 +.. date: 9468 +.. nonce: jd3Cll +.. section: Build + +Build OS X installer with a private copy of OpenSSL. Also provide a sample +Install Certificates command script to install a set of root certificates +from the third-party certifi module. + +.. + +.. bpo: 27952 +.. date: 9467 +.. nonce: WX9Ufc +.. section: Tools/Demos + +Get Tools/scripts/fixcid.py working with Python 3 and the current "re" +module, avoid invalid Python backslash escapes, and fix a bug parsing +escaped C quote signs. + +.. + +.. bpo: 28065 +.. date: 9466 +.. nonce: TUW63o +.. section: Windows + +Update xz dependency to 5.2.2 and build it from source. + +.. + +.. bpo: 25144 +.. date: 9465 +.. nonce: iUha52 +.. section: Windows + +Ensures TargetDir is set before continuing with custom install. + +.. + +.. bpo: 1602 +.. date: 9464 +.. nonce: 5Kowx0 +.. section: Windows + +Windows console doesn't input or print Unicode (PEP 528) + +.. + +.. bpo: 27781 +.. date: 9463 +.. nonce: 21eQH2 +.. section: Windows + +Change file system encoding on Windows to UTF-8 (PEP 529) + +.. + +.. bpo: 27731 +.. date: 9462 +.. nonce: U2HSrC +.. section: Windows + +Opt-out of MAX_PATH on Windows 10 + +.. + +.. bpo: 6135 +.. date: 9461 +.. nonce: pACuPJ +.. section: Windows + +Adds encoding and errors parameters to subprocess. + +.. + +.. bpo: 27959 +.. date: 9460 +.. nonce: JamSoC +.. section: Windows + +Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup. + +.. + +.. bpo: 27982 +.. date: 9459 +.. nonce: xrUa9R +.. section: Windows + +The functions of the winsound module now accept keyword arguments. + +.. + +.. bpo: 20366 +.. date: 9458 +.. nonce: s6b-ut +.. section: Windows + +Build full text search support into SQLite on Windows. + +.. + +.. bpo: 27756 +.. date: 9457 +.. nonce: PDAoGy +.. section: Windows + +Adds new icons for Python files and processes on Windows. Designs by Cherry +Wang. + +.. + +.. bpo: 27883 +.. date: 9456 +.. nonce: vyOnxj +.. section: Windows + +Update sqlite to 3.14.1.0 on Windows. diff --git a/Misc/NEWS.d/3.6.0b2.rst b/Misc/NEWS.d/3.6.0b2.rst new file mode 100644 index 00000000000..ebf4a96e635 --- /dev/null +++ b/Misc/NEWS.d/3.6.0b2.rst @@ -0,0 +1,840 @@ +.. bpo: 28183 +.. date: 9707 +.. nonce: MJZeNd +.. release date: 2016-10-10 +.. section: Core and Builtins + +Optimize and cleanup dict iteration. + +.. + +.. bpo: 26081 +.. date: 9706 +.. nonce: _x5vjl +.. section: Core and Builtins + +Added C implementation of asyncio.Future. Original patch by Yury Selivanov. + +.. + +.. bpo: 28379 +.. date: 9705 +.. nonce: DuXlco +.. section: Core and Builtins + +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. + +.. + +.. bpo: 28376 +.. date: 9704 +.. nonce: oPD-5D +.. section: Core and Builtins + +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. + +.. + +.. bpo: 28376 +.. date: 9703 +.. nonce: YEy-uG +.. section: Core and Builtins + +Creating instances of range_iterator by calling range_iterator type now is +deprecated. Patch by Oren Milman. + +.. + +.. bpo: 28376 +.. date: 9702 +.. nonce: fLeHM2 +.. section: Core and Builtins + +The constructor of range_iterator now checks that step is not 0. Patch by +Oren Milman. + +.. + +.. bpo: 26906 +.. date: 9701 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 9700 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 9699 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28201 +.. date: 9698 +.. nonce: GWUxAy +.. section: Core and Builtins + +Dict reduces possibility of 2nd conflict in hash table when hashes have same +lower bits. + +.. + +.. bpo: 28350 +.. date: 9697 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 26617 +.. date: 9696 +.. nonce: Gh5LvN +.. section: Core and Builtins + +Fix crash when GC runs during weakref callbacks. + +.. + +.. bpo: 27942 +.. date: 9695 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 21578 +.. date: 9694 +.. nonce: GI1bhj +.. section: Core and Builtins + +Fixed misleading error message when ImportError called with invalid keyword +args. + +.. + +.. bpo: 28203 +.. date: 9693 +.. nonce: LRn5vp +.. section: Core and Builtins + +Fix incorrect type in complex(1.0, {2:3}) error message. Patch by Soumya +Sharma. + +.. + +.. bpo: 28086 +.. date: 9692 +.. nonce: JsQPMQ +.. section: Core and Builtins + +Single var-positional argument of tuple subtype was passed unscathed to the +C-defined function. Now it is converted to exact tuple. + +.. + +.. bpo: 28214 +.. date: 9691 +.. nonce: zQF8Em +.. section: Core and Builtins + +Now __set_name__ is looked up on the class instead of the instance. + +.. + +.. bpo: 27955 +.. date: 9690 +.. nonce: HC4pZ4 +.. section: Core and Builtins + +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. + +.. + +.. bpo: 28192 +.. date: 9689 +.. nonce: eR6stU +.. section: Core and Builtins + +Don't import readline in isolated mode. + +.. + +.. bpo: 0 +.. date: 9688 +.. nonce: 9EbOiD +.. section: Core and Builtins + +Upgrade internal unicode databases to Unicode version 9.0.0. + +.. + +.. bpo: 28131 +.. date: 9687 +.. nonce: owq0wW +.. section: Core and Builtins + +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. + +.. + +.. bpo: 28126 +.. date: 9686 +.. nonce: Qf6-uQ +.. section: Core and Builtins + +Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize +memcpy(). + +.. + +.. bpo: 28120 +.. date: 9685 +.. nonce: e5xc1i +.. section: Core and Builtins + +Fix dict.pop() for splitted dictionary when trying to remove a "pending key" +(Not yet inserted in split-table). Patch by Xiang Zhang. + +.. + +.. bpo: 26182 +.. date: 9684 +.. nonce: jYlqTO +.. section: Core and Builtins + +Raise DeprecationWarning when async and await keywords are used as +variable/attribute/class/function name. + +.. + +.. bpo: 27998 +.. date: 9683 +.. nonce: CPhy4H +.. section: Library + +Fixed bytes path support in os.scandir() on Windows. Patch by Eryk Sun. + +.. + +.. bpo: 28317 +.. date: 9682 +.. nonce: LgHleA +.. section: Library + +The disassembler now decodes FORMAT_VALUE argument. + +.. + +.. bpo: 26293 +.. date: 9681 +.. nonce: 2mjvwX +.. section: Library + +Fixed writing ZIP files that starts not from the start of the file. Offsets +in ZIP file now are relative to the start of the archive in conforming to +the specification. + +.. + +.. bpo: 28380 +.. date: 9680 +.. nonce: jKPMzH +.. section: Library + +unittest.mock Mock autospec functions now properly support assert_called, +assert_not_called, and assert_called_once. + +.. + +.. bpo: 27181 +.. date: 9679 +.. nonce: SQyDpC +.. section: Library + +remove statistics.geometric_mean and defer until 3.7. + +.. + +.. bpo: 28229 +.. date: 9678 +.. nonce: BKAxcS +.. section: Library + +lzma module now supports pathlib. + +.. + +.. bpo: 28321 +.. date: 9677 +.. nonce: bQ-IIX +.. section: Library + +Fixed writing non-BMP characters with binary format in plistlib. + +.. + +.. bpo: 28225 +.. date: 9676 +.. nonce: 6N28nu +.. section: Library + +bz2 module now supports pathlib. Initial patch by Ethan Furman. + +.. + +.. bpo: 28227 +.. date: 9675 +.. nonce: 7lUz8i +.. section: Library + +gzip now supports pathlib. Patch by Ethan Furman. + +.. + +.. bpo: 27358 +.. date: 9674 +.. nonce: t288Iv +.. section: Library + +Optimized merging var-keyword arguments and improved error message when +passing a non-mapping as a var-keyword argument. + +.. + +.. bpo: 28257 +.. date: 9673 +.. nonce: SVD_IH +.. section: Library + +Improved error message when passing a non-iterable as a var-positional +argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. + +.. + +.. bpo: 28322 +.. date: 9672 +.. nonce: l9hzap +.. section: Library + +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. + +.. + +.. bpo: 28228 +.. date: 9671 +.. nonce: 1qBwdM +.. section: Library + +imghdr now supports pathlib. + +.. + +.. bpo: 28226 +.. date: 9670 +.. nonce: nMXiwU +.. section: Library + +compileall now supports pathlib. + +.. + +.. bpo: 28314 +.. date: 9669 +.. nonce: N7YrkN +.. section: Library + +Fix function declaration (C flags) for the getiterator() method of +xml.etree.ElementTree.Element. + +.. + +.. bpo: 28148 +.. date: 9668 +.. nonce: Flzndx +.. section: Library + +Stop using localtime() and gmtime() in the time module. + +Introduced platform independent _PyTime_localtime API that is similar to +POSIX localtime_r, but available on all platforms. Patch by Ed Schouten. + +.. + +.. bpo: 28253 +.. date: 9667 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 28275 +.. date: 9666 +.. nonce: EhWIsz +.. section: Library + +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. + +.. + +.. bpo: 27897 +.. date: 9665 +.. nonce: I0Ppmx +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. + +.. + +.. bpo: 18844 +.. date: 9664 +.. nonce: fQsEdn +.. section: Library + +random.choices() now has k as a keyword-only argument to improve the +readability of common cases and come into line with the signature used in +other languages. + +.. + +.. bpo: 18893 +.. date: 9663 +.. nonce: osiX5c +.. section: Library + +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. + +.. + +.. bpo: 27611 +.. date: 9662 +.. nonce: A_ArH_ +.. section: Library + +Fixed support of default root window in the tkinter.tix module. Added the +master parameter in the DisplayStyle constructor. + +.. + +.. bpo: 27348 +.. date: 9661 +.. nonce: tDx7Vw +.. section: Library + +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. + +.. + +.. bpo: 25651 +.. date: 9660 +.. nonce: 3UhyPo +.. section: Library + +Allow falsy values to be used for msg parameter of subTest(). + +.. + +.. bpo: 27778 +.. date: 9659 +.. nonce: Yyo1aP +.. section: Library + +Fix a memory leak in os.getrandom() when the getrandom() is interrupted by a +signal and a signal handler raises a Python exception. + +.. + +.. bpo: 28200 +.. date: 9658 +.. nonce: 4IEbr7 +.. section: Library + +Fix memory leak on Windows in the os module (fix path_converter() function). + +.. + +.. bpo: 25400 +.. date: 9657 +.. nonce: d9Qn0E +.. section: Library + +RobotFileParser now correctly returns default values for crawl_delay and +request_rate. Initial patch by Peter Wirtz. + +.. + +.. bpo: 27932 +.. date: 9656 +.. nonce: mtgl-6 +.. section: Library + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 0 +.. date: 9655 +.. nonce: iPpjqX +.. section: Library + +Fix UnboundLocalError in socket._sendfile_use_sendfile. + +.. + +.. bpo: 28075 +.. date: 9654 +.. nonce: aLiUs9 +.. section: Library + +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. + +.. + +.. bpo: 22493 +.. date: 9653 +.. nonce: Mv_hZf +.. section: Library + +Warning message emitted by using inline flags in the middle of regular +expression now contains a (truncated) regex pattern. Patch by Tim Graham. + +.. + +.. bpo: 25270 +.. date: 9652 +.. nonce: jrZruM +.. section: Library + +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. + +.. + +.. bpo: 28181 +.. date: 9651 +.. nonce: NGc4Yv +.. section: Library + +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +.. + +.. bpo: 25895 +.. date: 9650 +.. nonce: j92qoQ +.. section: Library + +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. + +.. + +.. bpo: 28114 +.. date: 9649 +.. nonce: gmFXsA +.. section: Library + +Fix a crash in parse_envlist() when env contains byte strings. Patch by Eryk +Sun. + +.. + +.. bpo: 27599 +.. date: 9648 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 27906 +.. date: 9647 +.. nonce: TBBXrv +.. section: Library + +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. + +.. + +.. bpo: 28174 +.. date: 9646 +.. nonce: CV1UdI +.. section: Library + +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. + +.. + +.. bpo: 26654 +.. date: 9645 +.. nonce: XtzTE9 +.. section: Library + +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. + +.. + +.. bpo: 26909 +.. date: 9644 +.. nonce: ASiakT +.. section: Library + +Fix slow pipes IO in asyncio. Patch by INADA Naoki. + +.. + +.. bpo: 28176 +.. date: 9643 +.. nonce: sU8R6L +.. section: Library + +Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +.. + +.. bpo: 27759 +.. date: 9642 +.. nonce: qpMDGq +.. section: Library + +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. + +.. + +.. bpo: 28368 +.. date: 9641 +.. nonce: fGl9y4 +.. section: Library + +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. + +.. + +.. bpo: 28369 +.. date: 9640 +.. nonce: 8DTANe +.. section: Library + +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. + +.. + +.. bpo: 28370 +.. date: 9639 +.. nonce: 18jBuZ +.. section: Library + +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. + +.. + +.. bpo: 28371 +.. date: 9638 +.. nonce: U9Zqdk +.. section: Library + +Deprecate passing asyncio.Handles to run_in_executor. + +.. + +.. bpo: 28372 +.. date: 9637 +.. nonce: njcIPk +.. section: Library + +Fix asyncio to support formatting of non-python coroutines. + +.. + +.. bpo: 28399 +.. date: 9636 +.. nonce: QKIqRX +.. section: Library + +Remove UNIX socket from FS before binding. Patch by ????????? ????. + +.. + +.. bpo: 27972 +.. date: 9635 +.. nonce: ZK-GFm +.. section: Library + +Prohibit Tasks to await on themselves. + +.. + +.. bpo: 28402 +.. date: 9634 +.. nonce: v9zETJ +.. section: Windows + +Adds signed catalog files for stdlib on Windows. + +.. + +.. bpo: 28333 +.. date: 9633 +.. nonce: KnpeO4 +.. section: Windows + +Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun) + +.. + +.. bpo: 28251 +.. date: 9632 +.. nonce: tR_AFs +.. section: Windows + +Improvements to help manuals on Windows. + +.. + +.. bpo: 28110 +.. date: 9631 +.. nonce: cnkP5F +.. section: Windows + +launcher.msi has different product codes between 32-bit and 64-bit + +.. + +.. bpo: 28161 +.. date: 9630 +.. nonce: hF91LI +.. section: Windows + +Opening CON for write access fails + +.. + +.. bpo: 28162 +.. date: 9629 +.. nonce: 3FHPVD +.. section: Windows + +WindowsConsoleIO readall() fails if first line starts with Ctrl+Z + +.. + +.. bpo: 28163 +.. date: 9628 +.. nonce: -DUgJw +.. section: Windows + +WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle + +.. + +.. bpo: 28164 +.. date: 9627 +.. nonce: 5MfN0J +.. section: Windows + +_PyIO_get_console_type fails for various paths + +.. + +.. bpo: 28137 +.. date: 9626 +.. nonce: C1uvzY +.. section: Windows + +Renames Windows path file to ._pth + +.. + +.. bpo: 28138 +.. date: 9625 +.. nonce: pNdv64 +.. section: Windows + +Windows ._pth file should allow import site + +.. + +.. bpo: 28426 +.. date: 9624 +.. nonce: zPwvbI +.. section: C API + +Deprecated undocumented functions PyUnicode_AsEncodedObject(), +PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and +PyUnicode_AsEncodedUnicode(). + +.. + +.. bpo: 28258 +.. date: 9623 +.. nonce: iKtAHd +.. section: Build + +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 9622 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 15819 +.. date: 9621 +.. nonce: QVDr3E +.. section: Build + +Remove redundant include search directory option for building outside the +source tree. + +.. + +.. bpo: 28217 +.. date: 9620 +.. nonce: Y37OKV +.. section: Tests + +Adds _testconsole module to test console input. diff --git a/Misc/NEWS.d/3.6.0b3.rst b/Misc/NEWS.d/3.6.0b3.rst new file mode 100644 index 00000000000..4233708aedb --- /dev/null +++ b/Misc/NEWS.d/3.6.0b3.rst @@ -0,0 +1,355 @@ +.. bpo: 28128 +.. date: 9744 +.. nonce: Lc2sFu +.. release date: 2016-10-31 +.. section: Core and Builtins + +Deprecation warning for invalid str and byte escape sequences now prints +better information about where the error occurs. Patch by Serhiy Storchaka +and Eric Smith. + +.. + +.. bpo: 28509 +.. date: 9743 +.. nonce: _Fa4Uq +.. section: Core and Builtins + +dict.update() no longer allocate unnecessary large memory. + +.. + +.. bpo: 28426 +.. date: 9742 +.. nonce: E_quyK +.. section: Core and Builtins + +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. + +.. + +.. bpo: 28517 +.. date: 9741 +.. nonce: ExPkm9 +.. section: Core and Builtins + +Fixed of-by-one error in the peephole optimizer that caused keeping +unreachable code. + +.. + +.. bpo: 28214 +.. date: 9740 +.. nonce: 6ECJox +.. section: Core and Builtins + +Improved exception reporting for problematic __set_name__ attributes. + +.. + +.. bpo: 23782 +.. date: 9739 +.. nonce: lonDzj +.. section: Core and Builtins + +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). + +.. + +.. bpo: 28471 +.. date: 9738 +.. nonce: Vd5pv7 +.. section: Core and Builtins + +Fix "Python memory allocator called without holding the GIL" crash in +socket.setblocking. + +.. + +.. bpo: 27517 +.. date: 9737 +.. nonce: 1CYM8A +.. section: Library + +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. + +.. + +.. bpo: 28549 +.. date: 9736 +.. nonce: ShnM2y +.. section: Library + +Fixed segfault in curses's addch() with ncurses6. + +.. + +.. bpo: 28449 +.. date: 9735 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 23262 +.. date: 9734 +.. nonce: 6EVB7N +.. section: Library + +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. + +.. + +.. bpo: 27939 +.. date: 9733 +.. nonce: mTfADV +.. section: Library + +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. + +.. + +.. bpo: 18844 +.. date: 9732 +.. nonce: oif1-H +.. section: Library + +The various ways of specifying weights for random.choices() now produce the +same result sequences. + +.. + +.. bpo: 28255 +.. date: 9731 +.. nonce: _ZH4wm +.. section: Library + +calendar.TextCalendar().prmonth() no longer prints a space at the start of +new line after printing a month's calendar. Patch by Xiang Zhang. + +.. + +.. bpo: 20491 +.. date: 9730 +.. nonce: ObgnQ2 +.. section: Library + +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. + +.. + +.. bpo: 28353 +.. date: 9729 +.. nonce: sKGbLL +.. section: Library + +os.fwalk() no longer fails on broken links. + +.. + +.. bpo: 28430 +.. date: 9728 +.. nonce: 4MiEYT +.. section: Library + +Fix iterator of C implemented asyncio.Future doesn't accept non-None value +is passed to it.send(val). + +.. + +.. bpo: 27025 +.. date: 9727 +.. nonce: foAViS +.. section: Library + +Generated names for Tkinter widgets now start by the "!" prefix for +readability. + +.. + +.. bpo: 25464 +.. date: 9726 +.. nonce: HDUTCu +.. section: Library + +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. + +.. + +.. bpo: 28488 +.. date: 9725 +.. nonce: TgO112 +.. section: Library + +shutil.make_archive() no longer adds entry "./" to ZIP archive. + +.. + +.. bpo: 25953 +.. date: 9724 +.. nonce: EKKJAQ +.. section: Library + +re.sub() now raises an error for invalid numerical group reference in +replacement template even if the pattern is not found in the string. Error +message for invalid group reference now includes the group index and the +position of the reference. Based on patch by SilentGhost. + +.. + +.. bpo: 18219 +.. date: 9723 +.. nonce: 1ANQN1 +.. section: Library + +Optimize csv.DictWriter for large number of columns. Patch by Mariatta +Wijaya. + +.. + +.. bpo: 28448 +.. date: 9722 +.. nonce: 5bduWe +.. section: Library + +Fix C implemented asyncio.Future didn't work on Windows. + +.. + +.. bpo: 28480 +.. date: 9721 +.. nonce: 9lHw6m +.. section: Library + +Fix error building socket module when multithreading is disabled. + +.. + +.. bpo: 24452 +.. date: 9720 +.. nonce: m9Kyg3 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. + +.. + +.. bpo: 20766 +.. date: 9719 +.. nonce: 4kvCzx +.. section: Library + +Fix references leaked by pdb in the handling of SIGINT handlers. + +.. + +.. bpo: 28492 +.. date: 9718 +.. nonce: pFRLQE +.. section: Library + +Fix how StopIteration exception is raised in _asyncio.Future. + +.. + +.. bpo: 28500 +.. date: 9717 +.. nonce: NINKzZ +.. section: Library + +Fix asyncio to handle async gens GC from another thread. + +.. + +.. bpo: 26923 +.. date: 9716 +.. nonce: 8dh3AV +.. section: Library + +Fix asyncio.Gather to refuse being cancelled once all children are done. +Patch by Johannes Ebke. + +.. + +.. bpo: 26796 +.. date: 9715 +.. nonce: TZyAfJ +.. section: Library + +Don't configure the number of workers for default threadpool executor. +Initial patch by Hans Lawrenz. + +.. + +.. bpo: 28544 +.. date: 9714 +.. nonce: KD1oFP +.. section: Library + +Implement asyncio.Task in C. + +.. + +.. bpo: 28522 +.. date: 9713 +.. nonce: XHMQa7 +.. section: Windows + +Fixes mishandled buffer reallocation in getpathp.c + +.. + +.. bpo: 28444 +.. date: 9712 +.. nonce: zkc9nT +.. section: Build + +Fix missing extensions modules when cross compiling. + +.. + +.. bpo: 28208 +.. date: 9711 +.. nonce: DtoP1i +.. section: Build + +Update Windows build and OS X installers to use SQLite 3.14.2. + +.. + +.. bpo: 28248 +.. date: 9710 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 26944 +.. date: 9709 +.. nonce: ChZ_BO +.. section: Tests + +Fix test_posix for Android where 'id -G' is entirely wrong or missing the +effective gid. + +.. + +.. bpo: 28409 +.. date: 9708 +.. nonce: Q2IlxJ +.. section: Tests + +regrtest: fix the parser of command line arguments. diff --git a/Misc/NEWS.d/3.6.0b4.rst b/Misc/NEWS.d/3.6.0b4.rst new file mode 100644 index 00000000000..c725ffd44b2 --- /dev/null +++ b/Misc/NEWS.d/3.6.0b4.rst @@ -0,0 +1,327 @@ +.. bpo: 28532 +.. date: 9778 +.. nonce: KEYJny +.. release date: 2016-11-21 +.. section: Core and Builtins + +Show sys.version when -V option is supplied twice. + +.. + +.. bpo: 27100 +.. date: 9777 +.. nonce: poVjXq +.. section: Core and Builtins + +The with-statement now checks for __enter__ before it checks for __exit__. +This gives less confusing error messages when both methods are missing. +Patch by Jonathan Ellington. + +.. + +.. bpo: 28746 +.. date: 9776 +.. nonce: r5MXdB +.. section: Core and Builtins + +Fix the set_inheritable() file descriptor method on platforms that do not +have the ioctl FIOCLEX and FIONCLEX commands. + +.. + +.. bpo: 26920 +.. date: 9775 +.. nonce: 1URwGb +.. section: Core and Builtins + +Fix not getting the locale's charset upon initializing the interpreter, on +platforms that do not have langinfo. + +.. + +.. bpo: 28648 +.. date: 9774 +.. nonce: z7B52W +.. section: Core and Builtins + +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. + +.. + +.. bpo: 19398 +.. date: 9773 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 28665 +.. date: 9772 +.. nonce: v4nx86 +.. section: Core and Builtins + +Improve speed of the STORE_DEREF opcode by 40%. + +.. + +.. bpo: 28583 +.. date: 9771 +.. nonce: F-QAx1 +.. section: Core and Builtins + +PyDict_SetDefault didn't combine split table when needed. Patch by Xiang +Zhang. + +.. + +.. bpo: 27243 +.. date: 9770 +.. nonce: 61E6K5 +.. section: Core and Builtins + +Change PendingDeprecationWarning -> DeprecationWarning. As it was agreed in +the issue, __aiter__ returning an awaitable should result in +PendingDeprecationWarning in 3.5 and in DeprecationWarning in 3.6. + +.. + +.. bpo: 26182 +.. date: 9769 +.. nonce: a8JXK2 +.. section: Core and Builtins + +Fix a refleak in code that raises DeprecationWarning. + +.. + +.. bpo: 28721 +.. date: 9768 +.. nonce: BO9BUF +.. section: Core and Builtins + +Fix asynchronous generators aclose() and athrow() to handle +StopAsyncIteration propagation properly. + +.. + +.. bpo: 28752 +.. date: 9767 +.. nonce: Q-4oRE +.. section: Library + +Restored the __reduce__() methods of datetime objects. + +.. + +.. bpo: 28727 +.. date: 9766 +.. nonce: ubZP_b +.. section: Library + +Regular expression patterns, _sre.SRE_Pattern objects created by +re.compile(), become comparable (only x==y and x!=y operators). This change +should fix the issue #18383: don't duplicate warning filters when the +warnings module is reloaded (thing usually only done in unit tests). + +.. + +.. bpo: 20572 +.. date: 9765 +.. nonce: lGXaH9 +.. section: Library + +The subprocess.Popen.wait method's undocumented endtime parameter now raises +a DeprecationWarning. + +.. + +.. bpo: 25659 +.. date: 9764 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 19717 +.. date: 9763 +.. nonce: HXCAIz +.. section: Library + +Makes Path.resolve() succeed on paths that do not exist. Patch by Vajrasky +Kok + +.. + +.. bpo: 28563 +.. date: 9762 +.. nonce: iweEiw +.. section: Library + +Fixed possible DoS and arbitrary code execution when handle plural form +selections in the gettext module. The expression parser now supports exact +syntax supported by GNU gettext. + +.. + +.. bpo: 28387 +.. date: 9761 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 28600 +.. date: 9760 +.. nonce: wMVrjN +.. section: Library + +Optimize loop.call_soon. + +.. + +.. bpo: 28613 +.. date: 9759 +.. nonce: sqUPrv +.. section: Library + +Fix get_event_loop() return the current loop if called from +coroutines/callbacks. + +.. + +.. bpo: 28634 +.. date: 9758 +.. nonce: YlRydz +.. section: Library + +Fix asyncio.isfuture() to support unittest.Mock. + +.. + +.. bpo: 26081 +.. date: 9757 +.. nonce: 2Y8-a9 +.. section: Library + +Fix refleak in _asyncio.Future.__iter__().throw. + +.. + +.. bpo: 28639 +.. date: 9756 +.. nonce: WUPo1o +.. section: Library + +Fix inspect.isawaitable to always return bool Patch by Justin Mayfield. + +.. + +.. bpo: 28652 +.. date: 9755 +.. nonce: f5M8FG +.. section: Library + +Make loop methods reject socket kinds they do not support. + +.. + +.. bpo: 28653 +.. date: 9754 +.. nonce: S5bA9i +.. section: Library + +Fix a refleak in functools.lru_cache. + +.. + +.. bpo: 28703 +.. date: 9753 +.. nonce: CRLTJc +.. section: Library + +Fix asyncio.iscoroutinefunction to handle Mock objects. + +.. + +.. bpo: 28704 +.. date: 9752 +.. nonce: EFWBII +.. section: Library + +Fix create_unix_server to support Path-like objects (PEP 519). + +.. + +.. bpo: 28720 +.. date: 9751 +.. nonce: Fsz-Lf +.. section: Library + +Add collections.abc.AsyncGenerator. + +.. + +.. bpo: 28513 +.. date: 9750 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 28666 +.. date: 9749 +.. nonce: RtTk-4 +.. section: Tests + +Now test.support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 9748 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 10656 +.. date: 9747 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 9746 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28676 +.. date: 9745 +.. nonce: Wxf6Ds +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. diff --git a/Misc/NEWS.d/3.6.0rc1.rst b/Misc/NEWS.d/3.6.0rc1.rst new file mode 100644 index 00000000000..17220ca6df6 --- /dev/null +++ b/Misc/NEWS.d/3.6.0rc1.rst @@ -0,0 +1,122 @@ +.. bpo: 23722 +.. date: 9790 +.. nonce: e8BH5h +.. release date: 2016-12-06 +.. section: Core and Builtins + +Rather than silently producing a class that doesn't support zero-argument +``super()`` in methods, failing to pass the new ``__classcell__`` namespace +entry up to ``type.__new__`` now results in a ``DeprecationWarning`` and a +class that supports zero-argument ``super()``. + +.. + +.. bpo: 28797 +.. date: 9789 +.. nonce: _A0_Z5 +.. section: Core and Builtins + +Modifying the class __dict__ inside the __set_name__ method of a descriptor +that is used inside that class no longer prevents calling the __set_name__ +method of other descriptors. + +.. + +.. bpo: 28782 +.. date: 9788 +.. nonce: foJV_E +.. section: Core and Builtins + +Fix a bug in the implementation ``yield from`` when checking if the next +instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). + +.. + +.. bpo: 27030 +.. date: 9787 +.. nonce: 88FOrz +.. section: Library + +Unknown escapes in re.sub() replacement template are allowed again. But +they still are deprecated and will be disabled in 3.7. + +.. + +.. bpo: 28835 +.. date: 9786 +.. nonce: Fv7Dr1 +.. section: Library + +Fix a regression introduced in warnings.catch_warnings(): call +warnings.showwarning() if it was overriden inside the context manager. + +.. + +.. bpo: 27172 +.. date: 9785 +.. nonce: mVKfLT +.. section: Library + +To assist with upgrades from 2.7, the previously documented deprecation of +``inspect.getfullargspec()`` has been reversed. This decision may be +revisited again after the Python 2.7 branch is no longer officially +supported. + +.. + +.. bpo: 26273 +.. date: 9784 +.. nonce: ilNIWN +.. section: Library + +Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and +:data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by +Omar Sandoval. + +.. + +.. bpo: 24142 +.. date: 9783 +.. nonce: IrZnFs +.. section: Library + +Reading a corrupt config file left configparser in an invalid state. +Original patch by Florian H?ch. + +.. + +.. bpo: 28843 +.. date: 9782 +.. nonce: O7M0LE +.. section: Library + +Fix asyncio C Task to handle exceptions __traceback__. + +.. + +.. bpo: 28808 +.. date: 9781 +.. nonce: A03X6r +.. section: C API + +PyUnicode_CompareWithASCIIString() now never raises exceptions. + +.. + +.. bpo: 23722 +.. date: 9780 +.. nonce: 6HX6fk +.. section: Documentation + +The data model reference and the porting section in the What's New guide now +cover the additional ``__classcell__`` handling needed for custom +metaclasses to fully support PEP 487 and zero-argument ``super()``. + +.. + +.. bpo: 28023 +.. date: 9779 +.. nonce: 4gzSGp +.. section: Tools/Demos + +Fix python-gdb.py didn't support new dict implementation. diff --git a/Misc/NEWS.d/3.6.0rc2.rst b/Misc/NEWS.d/3.6.0rc2.rst new file mode 100644 index 00000000000..4a78694167e --- /dev/null +++ b/Misc/NEWS.d/3.6.0rc2.rst @@ -0,0 +1,45 @@ +.. bpo: 28147 +.. date: 9795 +.. nonce: CnK_xf +.. release date: 2016-12-16 +.. section: Core and Builtins + +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. Patch written by INADA Naoki. + +.. + +.. bpo: 28990 +.. date: 9794 +.. nonce: m8xRMJ +.. section: Core and Builtins + +Fix asyncio SSL hanging if connection is closed before handshake is +completed. (Patch by HoHo-Ho) + +.. + +.. bpo: 28770 +.. date: 9793 +.. nonce: N9GQsz +.. section: Tools/Demos + +Fix python-gdb.py for fastcalls. + +.. + +.. bpo: 28896 +.. date: 9792 +.. nonce: ymAbmH +.. section: Windows + +Deprecate WindowsRegistryFinder. + +.. + +.. bpo: 28898 +.. date: 9791 +.. nonce: YGUd_i +.. section: Build + +Prevent gdb build errors due to HAVE_LONG_LONG redefinition. diff --git a/Misc/NEWS.d/3.6.1.rst b/Misc/NEWS.d/3.6.1.rst new file mode 100644 index 00000000000..a7bf84ef4ad --- /dev/null +++ b/Misc/NEWS.d/3.6.1.rst @@ -0,0 +1,31 @@ +.. bpo: 29723 +.. date: 9895 +.. nonce: M5omgP +.. release date: 2017-03-21 +.. section: Core and Builtins + +The ``sys.path[0]`` initialization change for bpo-29139 caused a regression +by revealing an inconsistency in how sys.path is initialized when executing +``__main__`` from a zipfile, directory, or other import location. The +interpreter now consistently avoids ever adding the import location's parent +directory to ``sys.path``, and ensures no other ``sys.path`` entries are +inadvertently modified when inserting the import location named on the +command line. + +.. + +.. bpo: 27593 +.. date: 9894 +.. nonce: nk7Etn +.. section: Build + +fix format of git information used in sys.version + +.. + +.. bpo: 0 +.. date: 9893 +.. nonce: usKKNQ +.. section: Build + +Fix incompatible comment in python.h diff --git a/Misc/NEWS.d/3.6.1rc1.rst b/Misc/NEWS.d/3.6.1rc1.rst new file mode 100644 index 00000000000..9137df6c143 --- /dev/null +++ b/Misc/NEWS.d/3.6.1rc1.rst @@ -0,0 +1,940 @@ +.. bpo: 28893 +.. date: 9892 +.. nonce: WTKnpj +.. release date: 2017-03-04 +.. section: Core and Builtins + +Set correct __cause__ for errors about invalid awaitables returned from +__aiter__ and __anext__. + +.. + +.. bpo: 29683 +.. date: 9891 +.. nonce: G5iS-P +.. section: Core and Builtins + +Fixes to memory allocation in _PyCode_SetExtra. Patch by Brian Coleman. + +.. + +.. bpo: 29684 +.. date: 9890 +.. nonce: wTgEoh +.. section: Core and Builtins + +Fix minor regression of PyEval_CallObjectWithKeywords. It should raise +TypeError when kwargs is not a dict. But it might cause segv when args=NULL +and kwargs is not a dict. + +.. + +.. bpo: 28598 +.. date: 9889 +.. nonce: QxbzQn +.. section: Core and Builtins + +Support __rmod__ for subclasses of str being called before str.__mod__. +Patch by Martijn Pieters. + +.. + +.. bpo: 29607 +.. date: 9888 +.. nonce: 7NvBA1 +.. section: Core and Builtins + +Fix stack_effect computation for CALL_FUNCTION_EX. Patch by Matthieu +Dartiailh. + +.. + +.. bpo: 29602 +.. date: 9887 +.. nonce: qyyskC +.. section: Core and Builtins + +Fix incorrect handling of signed zeros in complex constructor for complex +subclasses and for inputs having a __complex__ method. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 29347 +.. date: 9886 +.. nonce: 1RPPGN +.. section: Core and Builtins + +Fixed possibly dereferencing undefined pointers when creating weakref +objects. + +.. + +.. bpo: 29438 +.. date: 9885 +.. nonce: IKxD6I +.. section: Core and Builtins + +Fixed use-after-free problem in key sharing dict. + +.. + +.. bpo: 29319 +.. date: 9884 +.. nonce: KLDUZf +.. section: Core and Builtins + +Prevent RunMainFromImporter overwriting sys.path[0]. + +.. + +.. bpo: 29337 +.. date: 9883 +.. nonce: bjX8AE +.. section: Core and Builtins + +Fixed possible BytesWarning when compare the code objects. Warnings could be +emitted at compile time. + +.. + +.. bpo: 29327 +.. date: 9882 +.. nonce: XXQarW +.. section: Core and Builtins + +Fixed a crash when pass the iterable keyword argument to sorted(). + +.. + +.. bpo: 29034 +.. date: 9881 +.. nonce: 7-uEDT +.. section: Core and Builtins + +Fix memory leak and use-after-free in os module (path_converter). + +.. + +.. bpo: 29159 +.. date: 9880 +.. nonce: gEn_kP +.. section: Core and Builtins + +Fix regression in bytes(x) when x.__index__() raises Exception. + +.. + +.. bpo: 28932 +.. date: 9879 +.. nonce: QnLx8A +.. section: Core and Builtins + +Do not include if it does not exist. + +.. + +.. bpo: 25677 +.. date: 9878 +.. nonce: RWhZrb +.. section: Core and Builtins + +Correct the positioning of the syntax error caret for indented blocks. +Based on patch by Michael Layzell. + +.. + +.. bpo: 29000 +.. date: 9877 +.. nonce: K6wQ-3 +.. section: Core and Builtins + +Fixed bytes formatting of octals with zero padding in alternate form. + +.. + +.. bpo: 26919 +.. date: 9876 +.. nonce: Cm7MSa +.. section: Core and Builtins + +On Android, operating system data is now always encoded/decoded to/from +UTF-8, instead of the locale encoding to avoid inconsistencies with +os.fsencode() and os.fsdecode() which are already using UTF-8. + +.. + +.. bpo: 28991 +.. date: 9875 +.. nonce: lGA0FK +.. section: Core and Builtins + +functools.lru_cache() was susceptible to an obscure reentrancy bug +triggerable by a monkey-patched len() function. + +.. + +.. bpo: 28739 +.. date: 9874 +.. nonce: w1fvhk +.. section: Core and Builtins + +f-string expressions are no longer accepted as docstrings and by +ast.literal_eval() even if they do not include expressions. + +.. + +.. bpo: 28512 +.. date: 9873 +.. nonce: i-pv6d +.. section: Core and Builtins + +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +.. + +.. bpo: 28918 +.. date: 9872 +.. nonce: SFVuPz +.. section: Core and Builtins + +Fix the cross compilation of xxlimited when Python has been built with +Py_DEBUG defined. + +.. + +.. bpo: 28731 +.. date: 9871 +.. nonce: oNF59u +.. section: Core and Builtins + +Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of +dict literal with constant keys up to 30%. + +.. + +.. bpo: 29169 +.. date: 9870 +.. nonce: 8ypApm +.. section: Library + +Update zlib to 1.2.11. + +.. + +.. bpo: 29623 +.. date: 9869 +.. nonce: D3-NP2 +.. section: Library + +Allow use of path-like object as a single argument in ConfigParser.read(). +Patch by David Ellis. + +.. + +.. bpo: 28963 +.. date: 9868 +.. nonce: tPl8dq +.. section: Library + +Fix out of bound iteration in asyncio.Future.remove_done_callback +implemented in C. + +.. + +.. bpo: 29704 +.. date: 9867 +.. nonce: r-kWqv +.. section: Library + +asyncio.subprocess.SubprocessStreamProtocol no longer closes before all +pipes are closed. + +.. + +.. bpo: 29271 +.. date: 9866 +.. nonce: y8Vj2v +.. section: Library + +Fix Task.current_task and Task.all_tasks implemented in C to accept None +argument as their pure Python implementation. + +.. + +.. bpo: 29703 +.. date: 9865 +.. nonce: ZdsPCR +.. section: Library + +Fix asyncio to support instantiation of new event loops in child processes. + +.. + +.. bpo: 29376 +.. date: 9864 +.. nonce: rrJhJy +.. section: Library + +Fix assertion error in threading._DummyThread.is_alive(). + +.. + +.. bpo: 28624 +.. date: 9863 +.. nonce: 43TJib +.. section: Library + +Add a test that checks that cwd parameter of Popen() accepts PathLike +objects. Patch by Sayan Chowdhury. + +.. + +.. bpo: 28518 +.. date: 9862 +.. nonce: o-Q2Nw +.. section: Library + +Start a transaction implicitly before a DML statement. Patch by Aviv +Palivoda. + +.. + +.. bpo: 29532 +.. date: 9861 +.. nonce: YCwVQn +.. section: Library + +Altering a kwarg dictionary passed to functools.partial() no longer affects +a partial object after creation. + +.. + +.. bpo: 29110 +.. date: 9860 +.. nonce: wmE-_T +.. section: Library + +Fix file object leak in aifc.open() when file is given as a filesystem path +and is not in valid AIFF format. Patch by Anthony Zhang. + +.. + +.. bpo: 28556 +.. date: 9859 +.. nonce: p6967e +.. section: Library + +Various updates to typing module: typing.Counter, typing.ChainMap, improved +ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, Manuel +Krebber, and ?ukasz Langa. + +.. + +.. bpo: 29100 +.. date: 9858 +.. nonce: LAAERS +.. section: Library + +Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check +minimum and maximum years. + +.. + +.. bpo: 29519 +.. date: 9857 +.. nonce: oGGgZ4 +.. section: Library + +Fix weakref spewing exceptions during interpreter shutdown when used with a +rare combination of multiprocessing and custom codecs. + +.. + +.. bpo: 29416 +.. date: 9856 +.. nonce: KJGyI_ +.. section: Library + +Prevent infinite loop in pathlib.Path.mkdir + +.. + +.. bpo: 29444 +.. date: 9855 +.. nonce: cEwgmk +.. section: Library + +Fixed out-of-bounds buffer access in the group() method of the match object. +Based on patch by WGH. + +.. + +.. bpo: 29335 +.. date: 9854 +.. nonce: _KC7IK +.. section: Library + +Fix subprocess.Popen.wait() when the child process has exited to a stopped +instead of terminated state (ex: when under ptrace). + +.. + +.. bpo: 29290 +.. date: 9853 +.. nonce: XBqptF +.. section: Library + +Fix a regression in argparse that help messages would wrap at non-breaking +spaces. + +.. + +.. bpo: 28735 +.. date: 9852 +.. nonce: admHLO +.. section: Library + +Fixed the comparison of mock.MagickMock with mock.ANY. + +.. + +.. bpo: 29316 +.. date: 9851 +.. nonce: OeOQw5 +.. section: Library + +Restore the provisional status of typing module, add corresponding note to +documentation. Patch by Ivan L. + +.. + +.. bpo: 29219 +.. date: 9850 +.. nonce: kxui7t +.. section: Library + +Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances. + +.. + +.. bpo: 29011 +.. date: 9849 +.. nonce: MI5f2R +.. section: Library + +Fix an important omission by adding Deque to the typing module. + +.. + +.. bpo: 28969 +.. date: 9848 +.. nonce: j3HJYO +.. section: Library + +Fixed race condition in C implementation of functools.lru_cache. KeyError +could be raised when cached function with full cache was simultaneously +called from differen threads with the same uncached arguments. + +.. + +.. bpo: 29142 +.. date: 9847 +.. nonce: xo6kAv +.. section: Library + +In urllib.request, suffixes in no_proxy environment variable with leading +dots could match related hostnames again (e.g. .b.c matches a.b.c). Patch by +Milan Oberkirch. + +.. + +.. bpo: 28961 +.. date: 9846 +.. nonce: Rt93vg +.. section: Library + +Fix unittest.mock._Call helper: don't ignore the name parameter anymore. +Patch written by Jiajun Huang. + +.. + +.. bpo: 29203 +.. date: 9845 +.. nonce: kN5S6v +.. section: Library + +functools.lru_cache() now respects PEP 468 and preserves the order of +keyword arguments. f(a=1, b=2) is now cached separately from f(b=2, a=1) +since both calls could potentially give different results. + +.. + +.. bpo: 15812 +.. date: 9844 +.. nonce: R1U-Ec +.. section: Library + +inspect.getframeinfo() now correctly shows the first line of a context. +Patch by Sam Breese. + +.. + +.. bpo: 29094 +.. date: 9843 +.. nonce: 460ZQo +.. section: Library + +Offsets in a ZIP file created with extern file object and modes "w" and "x" +now are relative to the start of the file. + +.. + +.. bpo: 29085 +.. date: 9842 +.. nonce: bm3gkx +.. section: Library + +Allow random.Random.seed() to use high quality OS randomness rather than the +pid and time. + +.. + +.. bpo: 29061 +.. date: 9841 +.. nonce: YKq0Ba +.. section: Library + +Fixed bug in secrets.randbelow() which would hang when given a negative +input. Patch by Brendan Donegan. + +.. + +.. bpo: 29079 +.. date: 9840 +.. nonce: g4YLix +.. section: Library + +Prevent infinite loop in pathlib.resolve() on Windows + +.. + +.. bpo: 13051 +.. date: 9839 +.. nonce: YzC1Te +.. section: Library + +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. + +.. + +.. bpo: 29119 +.. date: 9838 +.. nonce: Ov69fr +.. section: Library + +Fix weakrefs in the pure python version of collections.OrderedDict +move_to_end() method. Contributed by Andra Bogildea. + +.. + +.. bpo: 9770 +.. date: 9837 +.. nonce: WJJnwP +.. section: Library + +curses.ascii predicates now work correctly with negative integers. + +.. + +.. bpo: 28427 +.. date: 9836 +.. nonce: vUd-va +.. section: Library + +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. + +.. + +.. bpo: 28923 +.. date: 9835 +.. nonce: naVULD +.. section: Library + +Remove editor artifacts from Tix.py. + +.. + +.. bpo: 29055 +.. date: 9834 +.. nonce: -r_9jc +.. section: Library + +Neaten-up empty population error on random.choice() by suppressing the +upstream exception. + +.. + +.. bpo: 28871 +.. date: 9833 +.. nonce: cPMXCJ +.. section: Library + +Fixed a crash when deallocate deep ElementTree. + +.. + +.. bpo: 19542 +.. date: 9832 +.. nonce: 5tCkaK +.. section: Library + +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. + +.. + +.. bpo: 20191 +.. date: 9831 +.. nonce: Q7uZCS +.. section: Library + +Fixed a crash in resource.prlimit() when passing a sequence that doesn't own +its elements as limits. + +.. + +.. bpo: 28779 +.. date: 9830 +.. nonce: t-mjED +.. section: Library + +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. + +.. + +.. bpo: 28847 +.. date: 9829 +.. nonce: J7d3nG +.. section: Library + +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. + +.. + +.. bpo: 26937 +.. date: 9828 +.. nonce: c9kgiA +.. section: Library + +The chown() method of the tarfile.TarFile class does not fail now when the +grp module cannot be imported, as for example on Android platforms. + +.. + +.. bpo: 29071 +.. date: 9827 +.. nonce: FCOpJn +.. section: IDLE + +IDLE colors f-string prefixes (but not invalid ur prefixes). + +.. + +.. bpo: 28572 +.. date: 9826 +.. nonce: 1_duKY +.. section: IDLE + +Add 10% to coverage of IDLE's test_configdialog. Update and augment +description of the configuration system. + +.. + +.. bpo: 29579 +.. date: 9825 +.. nonce: Ih-G2Q +.. section: Windows + +Removes readme.txt from the installer + +.. + +.. bpo: 29326 +.. date: 9824 +.. nonce: 4qDQzs +.. section: Windows + +Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) + +.. + +.. bpo: 28164 +.. date: 9823 +.. nonce: h4CFX8 +.. section: Windows + +Correctly handle special console filenames (patch by Eryk Sun) + +.. + +.. bpo: 29409 +.. date: 9822 +.. nonce: bhvrJ2 +.. section: Windows + +Implement PEP 529 for io.FileIO (Patch by Eryk Sun) + +.. + +.. bpo: 29392 +.. date: 9821 +.. nonce: OtqS5t +.. section: Windows + +Prevent crash when passing invalid arguments into msvcrt module. + +.. + +.. bpo: 25778 +.. date: 9820 +.. nonce: 8uKJ82 +.. section: Windows + +winreg does not truncate string correctly (Patch by Eryk Sun) + +.. + +.. bpo: 28896 +.. date: 9819 +.. nonce: VMi9w0 +.. section: Windows + +Deprecate WindowsRegistryFinder and disable it by default. + +.. + +.. bpo: 27867 +.. date: 9818 +.. nonce: UC5ohc +.. section: C API + +Function PySlice_GetIndicesEx() is replaced with a macro if Py_LIMITED_API +is not set or set to the value between 0x03050400 and 0x03060000 (not +including) or 0x03060100 or higher. + +.. + +.. bpo: 29083 +.. date: 9817 +.. nonce: tGTjr_ +.. section: C API + +Fixed the declaration of some public API functions. PyArg_VaParse() and +PyArg_VaParseTupleAndKeywords() were not available in limited API. +PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() +were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is +defined. + +.. + +.. bpo: 29058 +.. date: 9816 +.. nonce: 0wNVP8 +.. section: C API + +All stable API extensions added after Python 3.2 are now available only when +Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python +version supporting this API. + +.. + +.. bpo: 28929 +.. date: 9815 +.. nonce: Md7kb0 +.. section: Documentation + +Link the documentation to its source file on GitHub. + +.. + +.. bpo: 25008 +.. date: 9814 +.. nonce: CeIzyU +.. section: Documentation + +Document smtpd.py as effectively deprecated and add a pointer to aiosmtpd, a +third-party asyncio-based replacement. + +.. + +.. bpo: 26355 +.. date: 9813 +.. nonce: SDq_8Y +.. section: Documentation + +Add canonical header link on each page to corresponding major version of the +documentation. Patch by Matthias Bussonnier. + +.. + +.. bpo: 29349 +.. date: 9812 +.. nonce: PjSo-t +.. section: Documentation + +Fix Python 2 syntax in code for building the documentation. + +.. + +.. bpo: 28087 +.. date: 9811 +.. nonce: m8dc4R +.. section: Tests + +Skip test_asyncore and test_eintr poll failures on macOS. Skip some tests of +select.poll when running on macOS due to unresolved issues with the +underlying system poll function on some macOS versions. + +.. + +.. bpo: 29571 +.. date: 9810 +.. nonce: r6Dixr +.. section: Tests + +to match the behaviour of the ``re.LOCALE`` flag, test_re.test_locale_flag +now uses ``locale.getpreferredencoding(False)`` to determine the candidate +encoding for the test regex (allowing it to correctly skip the test when the +default locale encoding is a multi-byte encoding) + +.. + +.. bpo: 28950 +.. date: 9809 +.. nonce: 1W8Glo +.. section: Tests + +Disallow -j0 to be combined with -T/-l in regrtest command line arguments. + +.. + +.. bpo: 28683 +.. date: 9808 +.. nonce: Fp-Hdq +.. section: Tests + +Fix the tests that bind() a unix socket and raise PermissionError on Android +for a non-root user. + +.. + +.. bpo: 26939 +.. date: 9807 +.. nonce: 7j_W5R +.. section: Tests + +Add the support.setswitchinterval() function to fix test_functools hanging +on the Android armv7 qemu emulator. + +.. + +.. bpo: 27593 +.. date: 9806 +.. nonce: v87xEr +.. section: Build + +sys.version and the platform module python_build(), python_branch(), and +python_revision() functions now use git information rather than hg when +building from a repo. + +.. + +.. bpo: 29572 +.. date: 9805 +.. nonce: iZ1XKK +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2k. + +.. + +.. bpo: 26851 +.. date: 9804 +.. nonce: R5243g +.. section: Build + +Set Android compilation and link flags. + +.. + +.. bpo: 28768 +.. date: 9803 +.. nonce: b9_a6E +.. section: Build + +Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto + +.. + +.. bpo: 29080 +.. date: 9802 +.. nonce: b3qLQT +.. section: Build + +Removes hard dependency on hg.exe from PCBuild/build.bat + +.. + +.. bpo: 23903 +.. date: 9801 +.. nonce: JXJ889 +.. section: Build + +Added missed names to PC/python3.def. + +.. + +.. bpo: 28762 +.. date: 9800 +.. nonce: Ru0YN_ +.. section: Build + +lockf() is available on Android API level 24, but the F_LOCK macro is not +defined in android-ndk-r13. + +.. + +.. bpo: 28538 +.. date: 9799 +.. nonce: FqtN7v +.. section: Build + +Fix the compilation error that occurs because if_nameindex() is available on +Android API level 24, but the if_nameindex structure is not defined. + +.. + +.. bpo: 20211 +.. date: 9798 +.. nonce: gpNptI +.. section: Build + +Do not add the directory for installing C header files and the directory for +installing object code libraries to the cross compilation search paths. +Original patch by Thomas Petazzoni. + +.. + +.. bpo: 28849 +.. date: 9797 +.. nonce: AzRRF5 +.. section: Build + +Do not define sys.implementation._multiarch on Android. diff --git a/Misc/NEWS.d/3.6.2.rst b/Misc/NEWS.d/3.6.2.rst new file mode 100644 index 00000000000..dba43d146df --- /dev/null +++ b/Misc/NEWS.d/3.6.2.rst @@ -0,0 +1,7 @@ +.. bpo: 0 +.. date: 9993 +.. no changes: True +.. nonce: F9ENBV +.. release date: 2017-07-17 + +No changes since release candidate 2 diff --git a/Misc/NEWS.d/3.6.2rc1.rst b/Misc/NEWS.d/3.6.2rc1.rst new file mode 100644 index 00000000000..4ec0f9789fe --- /dev/null +++ b/Misc/NEWS.d/3.6.2rc1.rst @@ -0,0 +1,942 @@ +.. bpo: 30682 +.. date: 9989 +.. nonce: zZm88E +.. release date: 2017-06-17 +.. section: Core and Builtins + +Removed a too-strict assertion that failed for certain f-strings, such as +eval("f'\\\n'") and eval("f'\\\r'"). + +.. + +.. bpo: 30604 +.. date: 9988 +.. nonce: W47hPY +.. section: Core and Builtins + +Move co_extra_freefuncs to not be per-thread to avoid crashes + +.. + +.. bpo: 29104 +.. date: 9987 +.. nonce: u26yCx +.. section: Core and Builtins + +Fixed parsing backslashes in f-strings. + +.. + +.. bpo: 27945 +.. date: 9986 +.. nonce: p29r3O +.. section: Core and Builtins + +Fixed various segfaults with dict when input collections are mutated during +searching, inserting or comparing. Based on patches by Duane Griffin and +Tim Mitchell. + +.. + +.. bpo: 25794 +.. date: 9985 +.. nonce: xfPwqm +.. section: Core and Builtins + +Fixed type.__setattr__() and type.__delattr__() for non-interned attribute +names. Based on patch by Eryk Sun. + +.. + +.. bpo: 30039 +.. date: 9984 +.. nonce: e0u4DG +.. section: Core and Builtins + +If a KeyboardInterrupt happens when the interpreter is in the middle of +resuming a chain of nested 'yield from' or 'await' calls, it's now correctly +delivered to the innermost frame. + +.. + +.. bpo: 12414 +.. date: 9983 +.. nonce: T9ix8O +.. section: Core and Builtins + +sys.getsizeof() on a code object now returns the sizes which includes the +code struct and sizes of objects which it references. Patch by Dong-hee Na. + +.. + +.. bpo: 29949 +.. date: 9982 +.. nonce: DevGPS +.. section: Core and Builtins + +Fix memory usage regression of set and frozenset object. + +.. + +.. bpo: 29935 +.. date: 9981 +.. nonce: vgjdJo +.. section: Core and Builtins + +Fixed error messages in the index() method of tuple, list and deque when +pass indices of wrong type. + +.. + +.. bpo: 29859 +.. date: 9980 +.. nonce: Z1MLcA +.. section: Core and Builtins + +Show correct error messages when any of the pthread_* calls in +thread_pthread.h fails. + +.. + +.. bpo: 28876 +.. date: 9979 +.. nonce: cU-sGT +.. section: Core and Builtins + +``bool(range)`` works even if ``len(range)`` raises :exc:`OverflowError`. + +.. + +.. bpo: 29600 +.. date: 9978 +.. nonce: 77wQ6C +.. section: Core and Builtins + +Fix wrapping coroutine return values in StopIteration. + +.. + +.. bpo: 28856 +.. date: 9977 +.. nonce: AFRmo4 +.. section: Core and Builtins + +Fix an oversight that %b format for bytes should support objects follow the +buffer protocol. + +.. + +.. bpo: 29714 +.. date: 9976 +.. nonce: z-BhVd +.. section: Core and Builtins + +Fix a regression that bytes format may fail when containing zero bytes +inside. + +.. + +.. bpo: 29478 +.. date: 9975 +.. nonce: rTQ-qy +.. section: Core and Builtins + +If max_line_length=None is specified while using the Compat32 policy, it is +no longer ignored. Patch by Mircea Cosbuc. + +.. + +.. bpo: 30616 +.. date: 9974 +.. nonce: I2mDTz +.. section: Library + +Functional API of enum allows to create empty enums. Patched by Dong-hee Na + +.. + +.. bpo: 30038 +.. date: 9973 +.. nonce: vb4DWk +.. section: Library + +Fix race condition between signal delivery and wakeup file descriptor. +Patch by Nathaniel Smith. + +.. + +.. bpo: 23894 +.. date: 9972 +.. nonce: k2pADV +.. section: Library + +lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. + +.. + +.. bpo: 23890 +.. date: 9971 +.. nonce: GCFAAZ +.. section: Library + +unittest.TestCase.assertRaises() now manually breaks a reference cycle to +not keep objects alive longer than expected. + +.. + +.. bpo: 30149 +.. date: 9970 +.. nonce: hE649r +.. section: Library + +inspect.signature() now supports callables with variable-argument parameters +wrapped with partialmethod. Patch by Dong-hee Na. + +.. + +.. bpo: 30645 +.. date: 9969 +.. nonce: oYzbbW +.. section: Library + +Fix path calculation in imp.load_package(), fixing it for cases when a +package is only shipped with bytecodes. Patch by Alexandru Ardelean. + +.. + +.. bpo: 29931 +.. date: 9968 +.. nonce: tfcTwK +.. section: Library + +Fixed comparison check for ipaddress.ip_interface objects. Patch by Sanjay +Sundaresan. + +.. + +.. bpo: 30605 +.. date: 9967 +.. nonce: XqGz1r +.. section: Library + +re.compile() no longer raises a BytesWarning when compiling a bytes instance +with misplaced inline modifier. Patch by Roy Williams. + +.. + +.. bpo: 29591 +.. date: 9966 +.. nonce: ExKblw +.. original section: Library +.. section: Security + +Update expat copy from 2.1.1 to 2.2.0 to get fixes of CVE-2016-0718 and +CVE-2016-4472. See https://sourceforge.net/p/expat/bugs/537/ for more +information. + +.. + +.. bpo: 24484 +.. date: 9965 +.. nonce: fNS32j +.. section: Library + +Avoid race condition in multiprocessing cleanup (#2159) + +.. + +.. bpo: 28994 +.. date: 9964 +.. nonce: 9vzun1 +.. section: Library + +The traceback no longer displayed for SystemExit raised in a callback +registered by atexit. + +.. + +.. bpo: 30508 +.. date: 9963 +.. nonce: wNWRS2 +.. section: Library + +Don't log exceptions if Task/Future "cancel()" method was called. + +.. + +.. bpo: 28556 +.. date: 9962 +.. nonce: mESP7G +.. section: Library + +Updates to typing module: Add generic AsyncContextManager, add support for +ContextManager on all versions. Original PRs by Jelle Zijlstra and Ivan +Levkivskyi + +.. + +.. bpo: 29870 +.. date: 9961 +.. nonce: p960Ih +.. section: Library + +Fix ssl sockets leaks when connection is aborted in asyncio/ssl +implementation. Patch by Micha?l Sgha?er. + +.. + +.. bpo: 29743 +.. date: 9960 +.. nonce: en2P4s +.. section: Library + +Closing transport during handshake process leaks open socket. Patch by +Nikolay Kim + +.. + +.. bpo: 27585 +.. date: 9959 +.. nonce: 0Ugqqu +.. section: Library + +Fix waiter cancellation in asyncio.Lock. Patch by Mathieu Sornay. + +.. + +.. bpo: 30418 +.. date: 9958 +.. nonce: EwISQm +.. section: Library + +On Windows, subprocess.Popen.communicate() now also ignore EINVAL on +stdin.write() if the child process is still running but closed the pipe. + +.. + +.. bpo: 29822 +.. date: 9957 +.. nonce: G7dX13 +.. section: Library + +inspect.isabstract() now works during __init_subclass__. Patch by Nate +Soares. + +.. + +.. bpo: 29581 +.. date: 9956 +.. nonce: gHCrxP +.. section: Library + +ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base classes to +use keyword parameters in __init_subclass__. Patch by Nate Soares. + +.. + +.. bpo: 30557 +.. date: 9955 +.. nonce: uykrLf +.. section: Library + +faulthandler now correctly filters and displays exception codes on Windows + +.. + +.. bpo: 30378 +.. date: 9954 +.. nonce: R_19_5 +.. section: Library + +Fix the problem that logging.handlers.SysLogHandler cannot handle IPv6 +addresses. + +.. + +.. bpo: 29960 +.. date: 9953 +.. nonce: g0wr3r +.. section: Library + +Preserve generator state when _random.Random.setstate() raises an exception. +Patch by Bryan Olson. + +.. + +.. bpo: 30414 +.. date: 9952 +.. nonce: jGl1Lb +.. section: Library + +multiprocessing.Queue._feed background running thread do not break from main +loop on exception. + +.. + +.. bpo: 30003 +.. date: 9951 +.. nonce: BOl9HE +.. section: Library + +Fix handling escape characters in HZ codec. Based on patch by Ma Lin. + +.. + +.. bpo: 30301 +.. date: 9950 +.. nonce: ywOkjN +.. section: Library + +Fix AttributeError when using SimpleQueue.empty() under *spawn* and +*forkserver* start methods. + +.. + +.. bpo: 30329 +.. date: 9949 +.. nonce: EuT36N +.. section: Library + +imaplib and poplib now catch the Windows socket WSAEINVAL error (code 10022) +on shutdown(SHUT_RDWR): An invalid operation was attempted. This error +occurs sometimes on SSL connections. + +.. + +.. bpo: 30375 +.. date: 9948 +.. nonce: 9c8qM7 +.. section: Library + +Warnings emitted when compile a regular expression now always point to the +line in the user code. Previously they could point into inners of the re +module if emitted from inside of groups or conditionals. + +.. + +.. bpo: 30048 +.. date: 9947 +.. nonce: ELRx8R +.. section: Library + +Fixed ``Task.cancel()`` can be ignored when the task is running coroutine +and the coroutine returned without any more ``await``. + +.. + +.. bpo: 30266 +.. date: 9946 +.. nonce: YJzHAH +.. section: Library + +contextlib.AbstractContextManager now supports anti-registration by setting +__enter__ = None or __exit__ = None, following the pattern introduced in +bpo-25958. Patch by Jelle Zijlstra. + +.. + +.. bpo: 30298 +.. date: 9945 +.. nonce: ZN-bWo +.. section: Library + +Weaken the condition of deprecation warnings for inline modifiers. Now +allowed several subsequential inline modifiers at the start of the pattern +(e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments now are +allowed before and between inline modifiers (e.g. ``'(?x) (?i) (?s)...'``). + +.. + +.. bpo: 29990 +.. date: 9944 +.. nonce: HWV6KE +.. section: Library + +Fix range checking in GB18030 decoder. Original patch by Ma Lin. + +.. + +.. bpo: 26293 +.. date: 9943 +.. nonce: wig0YG +.. section: Library + +Change resulted because of zipfile breakage. (See also: bpo-29094) + +.. + +.. bpo: 30243 +.. date: 9942 +.. nonce: RHQt0v +.. section: Library + +Removed the __init__ methods of _json's scanner and encoder. Misusing them +could cause memory leaks or crashes. Now scanner and encoder objects are +completely initialized in the __new__ methods. + +.. + +.. bpo: 30185 +.. date: 9941 +.. nonce: Tiu1n8 +.. section: Library + +Avoid KeyboardInterrupt tracebacks in forkserver helper process when Ctrl-C +is received. + +.. + +.. bpo: 28556 +.. date: 9940 +.. nonce: 51gjbP +.. section: Library + +Various updates to typing module: add typing.NoReturn type, use +WrapperDescriptorType, minor bug-fixes. Original PRs by Jim Fasarakis- +Hilliard and Ivan Levkivskyi. + +.. + +.. bpo: 30205 +.. date: 9939 +.. nonce: BsxO34 +.. section: Library + +Fix getsockname() for unbound AF_UNIX sockets on Linux. + +.. + +.. bpo: 30070 +.. date: 9938 +.. nonce: XM_B41 +.. section: Library + +Fixed leaks and crashes in errors handling in the parser module. + +.. + +.. bpo: 30061 +.. date: 9937 +.. nonce: 2w_dX9 +.. section: Library + +Fixed crashes in IOBase methods __next__() and readlines() when readline() +or __next__() respectively return non-sizeable object. Fixed possible other +errors caused by not checking results of PyObject_Size(), PySequence_Size(), +or PyMapping_Size(). + +.. + +.. bpo: 30017 +.. date: 9936 +.. nonce: cKBuhU +.. section: Library + +Allowed calling the close() method of the zip entry writer object multiple +times. Writing to a closed writer now always produces a ValueError. + +.. + +.. bpo: 30068 +.. date: 9935 +.. nonce: n4q47r +.. section: Library + +_io._IOBase.readlines will check if it's closed first when hint is present. + +.. + +.. bpo: 29694 +.. date: 9934 +.. nonce: LWKxb1 +.. section: Library + +Fixed race condition in pathlib mkdir with flags parents=True. Patch by +Armin Rigo. + +.. + +.. bpo: 29692 +.. date: 9933 +.. nonce: oyWrAE +.. section: Library + +Fixed arbitrary unchaining of RuntimeError exceptions in +contextlib.contextmanager. Patch by Siddharth Velankar. + +.. + +.. bpo: 29998 +.. date: 9932 +.. nonce: poeIKD +.. section: Library + +Pickling and copying ImportError now preserves name and path attributes. + +.. + +.. bpo: 29953 +.. date: 9931 +.. nonce: Q1hSt- +.. section: Library + +Fixed memory leaks in the replace() method of datetime and time objects when +pass out of bound fold argument. + +.. + +.. bpo: 29942 +.. date: 9930 +.. nonce: CsGNuT +.. section: Library + +Fix a crash in itertools.chain.from_iterable when encountering long runs of +empty iterables. + +.. + +.. bpo: 27863 +.. date: 9929 +.. nonce: pPYHHI +.. section: Library + +Fixed multiple crashes in ElementTree caused by race conditions and wrong +types. + +.. + +.. bpo: 28699 +.. date: 9928 +.. nonce: wZztZP +.. section: Library + +Fixed a bug in pools in multiprocessing.pool that raising an exception at +the very first of an iterable may swallow the exception or make the program +hang. Patch by Davin Potts and Xiang Zhang. + +.. + +.. bpo: 25803 +.. date: 9927 +.. nonce: CPDR0W +.. section: Library + +Avoid incorrect errors raised by Path.mkdir(exist_ok=True) when the OS gives +priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 29861 +.. date: 9926 +.. nonce: t2ZoRK +.. section: Library + +Release references to tasks, their arguments and their results as soon as +they are finished in multiprocessing.Pool. + +.. + +.. bpo: 29884 +.. date: 9925 +.. nonce: kWXR8W +.. section: Library + +faulthandler: Restore the old sigaltstack during teardown. Patch by +Christophe Zeitouny. + +.. + +.. bpo: 25455 +.. date: 9924 +.. nonce: ZsahHN +.. section: Library + +Fixed crashes in repr of recursive buffered file-like objects. + +.. + +.. bpo: 29800 +.. date: 9923 +.. nonce: d2xASa +.. section: Library + +Fix crashes in partial.__repr__ if the keys of partial.keywords are not +strings. Patch by Michael Seifert. + +.. + +.. bpo: 29742 +.. date: 9922 +.. nonce: 8hqfEO +.. section: Library + +get_extra_info() raises exception if get called on closed ssl transport. +Patch by Nikolay Kim. + +.. + +.. bpo: 8256 +.. date: 9921 +.. nonce: jAwGQH +.. section: Library + +Fixed possible failing or crashing input() if attributes "encoding" or +"errors" of sys.stdin or sys.stdout are not set or are not strings. + +.. + +.. bpo: 28298 +.. date: 9920 +.. nonce: xfm84U +.. section: Library + +Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big intables +(objects that have __int__) as elements. Patch by Oren Milman. + +.. + +.. bpo: 28231 +.. date: 9919 +.. nonce: MG1X09 +.. section: Library + +The zipfile module now accepts path-like objects for external paths. + +.. + +.. bpo: 26915 +.. date: 9918 +.. nonce: qShJZO +.. section: Library + +index() and count() methods of collections.abc.Sequence now check identity +before checking equality when do comparisons. + +.. + +.. bpo: 29615 +.. date: 9917 +.. nonce: OpFKzg +.. section: Library + +SimpleXMLRPCDispatcher no longer chains KeyError (or any other exception) to +exception(s) raised in the dispatched methods. Patch by Petr Motejlek. + +.. + +.. bpo: 30177 +.. date: 9916 +.. nonce: JGIJNL +.. section: Library + +path.resolve(strict=False) no longer cuts the path after the first element +not present in the filesystem. Patch by Antoine Pietri. + +.. + +.. bpo: 15786 +.. date: 9915 +.. nonce: _XRbaR +.. section: IDLE + +Fix several problems with IDLE's autocompletion box. The following should +now work: clicking on selection box items; using the scrollbar; selecting an +item by hitting Return. Hangs on MacOSX should no longer happen. Patch by +Louie Lu. + +.. + +.. bpo: 25514 +.. date: 9914 +.. nonce: 882pXa +.. section: IDLE + +Add doc subsubsection about IDLE failure to start. Popup no-connection +message directs users to this section. + +.. + +.. bpo: 30642 +.. date: 9913 +.. nonce: 3Zujzt +.. section: IDLE + +Fix reference leaks in IDLE tests. Patches by Louie Lu and Terry Jan Reedy. + +.. + +.. bpo: 30495 +.. date: 9912 +.. nonce: I3i5vL +.. section: IDLE + +Add docstrings for textview.py and use PEP8 names. Patches by Cheryl Sabella +and Terry Jan Reedy. + +.. + +.. bpo: 30290 +.. date: 9911 +.. nonce: fZ3kod +.. section: IDLE + +Help-about: use pep8 names and add tests. Increase coverage to 100%. Patches +by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. + +.. + +.. bpo: 30303 +.. date: 9910 +.. nonce: 2L2F-4 +.. section: IDLE + +Add _utest option to textview; add new tests. Increase coverage to 100%. +Patches by Louie Lu and Terry Jan Reedy. + +.. + +.. bpo: 27867 +.. date: 9909 +.. nonce: B46BRE +.. section: C API + +Function PySlice_GetIndicesEx() no longer replaced with a macro if +Py_LIMITED_API is not set. + +.. + +.. bpo: 29941 +.. date: 9908 +.. nonce: ylh45A +.. section: Build + +Add ``--with-assertions`` configure flag to explicitly enable C ``assert()`` +checks. Defaults to off. ``--with-pydebug`` implies ``--with-assertions``. + +.. + +.. bpo: 28787 +.. date: 9907 +.. nonce: vhH_6a +.. section: Build + +Fix out-of-tree builds of Python when configured with ``--with--dtrace``. + +.. + +.. bpo: 29243 +.. date: 9906 +.. nonce: WDK4hT +.. section: Build + +Prevent unnecessary rebuilding of Python during ``make test``, ``make +install`` and some other make targets when configured with ``--enable- +optimizations``. + +.. + +.. bpo: 23404 +.. date: 9905 +.. nonce: PdYVWg +.. section: Build + +Don't regenerate generated files based on file modification time anymore: +the action is now explicit. Replace ``make touch`` with ``make regen-all``. + +.. + +.. bpo: 29643 +.. date: 9904 +.. nonce: 4WLIJQ +.. section: Build + +Fix ``--enable-optimization`` didn't work. + +.. + +.. bpo: 30176 +.. date: 9903 +.. nonce: VivmCg +.. section: Documentation + +Add missing attribute related constants in curses documentation. + +.. + +.. bpo: 30052 +.. date: 9902 +.. nonce: TpmpaF +.. section: Documentation + +the link targets for :func:`bytes` and :func:`bytearray` are now their +respective type definitions, rather than the corresponding builtin function +entries. Use :ref:`bytes ` and :ref:`bytearray ` +to reference the latter. + +In order to ensure this and future cross-reference updates are applied +automatically, the daily documentation builds now disable the default output +caching features in Sphinx. + +.. + +.. bpo: 26985 +.. date: 9901 +.. nonce: NB5_9S +.. section: Documentation + +Add missing info of code object in inspect documentation. + +.. + +.. bpo: 29367 +.. date: 9900 +.. nonce: 4dOKL0 +.. section: Tools/Demos + +python-gdb.py now supports also ``method-wrapper`` (``wrapperobject``) +objects. + +.. + +.. bpo: 30357 +.. date: 9899 +.. nonce: n4CPEa +.. section: Tests + +test_thread: setUp() now uses support.threading_setup() and +support.threading_cleanup() to wait until threads complete to avoid random +side effects on following tests. Initial patch written by Grzegorz Grzywacz. + +.. + +.. bpo: 30197 +.. date: 9898 +.. nonce: c5wRfu +.. section: Tests + +Enhanced functions swap_attr() and swap_item() in the test.support module. +They now work when delete replaced attribute or item inside the with +statement. The old value of the attribute or item (or None if it doesn't +exist) now will be assigned to the target of the "as" clause, if there is +one. + +.. + +.. bpo: 30687 +.. date: 9897 +.. nonce: 8mqHnu +.. section: Windows + +Locate msbuild.exe on Windows when building rather than vcvarsall.bat + +.. + +.. bpo: 30450 +.. date: 9896 +.. nonce: qsaK8y +.. section: Windows + +The build process on Windows no longer depends on Subversion, instead +pulling external code from GitHub via a Python script. If Python 3.6 is not +found on the system (via ``py -3.6``), NuGet is used to download a copy of +32-bit Python. diff --git a/Misc/NEWS.d/3.6.2rc2.rst b/Misc/NEWS.d/3.6.2rc2.rst new file mode 100644 index 00000000000..4fdfabd0e31 --- /dev/null +++ b/Misc/NEWS.d/3.6.2rc2.rst @@ -0,0 +1,39 @@ +.. bpo: 30730 +.. date: 9992 +.. nonce: rJsyTH +.. original section: Library +.. release date: 2017-07-07 +.. section: Security + +Prevent environment variables injection in subprocess on Windows. Prevent +passing other environment variables and command arguments. + +.. + +.. bpo: 30694 +.. date: 9991 +.. nonce: WkMWM_ +.. original section: Library +.. section: Security + +Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security +vulnerabilities including: CVE-2017-9233 (External entity infinite loop +DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix +regression bugs from 2.2.0's fix to CVE-2016-0718) and CVE-2012-0876 +(Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os- +specific entropy sources like getrandom) doesn't impact Python, since Python +already gets entropy from the OS to set the expat secret using +``XML_SetHashSalt()``. + +.. + +.. bpo: 30500 +.. date: 9990 +.. nonce: 1VG7R- +.. original section: Library +.. section: Security + +Fix urllib.parse.splithost() to correctly parse fragments. For example, +``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the +``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an +authentification (``login at host``). diff --git a/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst b/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst new file mode 100644 index 00000000000..0114fee02a4 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst @@ -0,0 +1,2 @@ +``print`` now shows expected input in custom error message when used as a +Python 2 statement. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst b/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst new file mode 100644 index 00000000000..8d63a46cbde --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst @@ -0,0 +1 @@ +Fixed a race condition when import a submodule from a package. diff --git a/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst b/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst new file mode 100644 index 00000000000..3ecd404373b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst @@ -0,0 +1,2 @@ +Make sure the 'Missing parentheses' syntax error message is only applied to +SyntaxError, not to subclasses. Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst b/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst new file mode 100644 index 00000000000..f4f1b277c18 --- /dev/null +++ b/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst @@ -0,0 +1,2 @@ +Fixed the lgettext() family of functions in the gettext module. They now +always return bytes. diff --git a/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst b/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst new file mode 100644 index 00000000000..94803bb5f1d --- /dev/null +++ b/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst @@ -0,0 +1,2 @@ +Prohibited the '=' character in environment variable names in +``os.putenv()`` and ``os.spawn*()``. diff --git a/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst b/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst new file mode 100644 index 00000000000..862c114aef8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst @@ -0,0 +1,2 @@ +os.listdir() and os.scandir() now emit bytes names when called with bytes- +like argument. From webhook-mailer at python.org Mon Sep 4 15:19:28 2017 From: webhook-mailer at python.org (Barry Warsaw) Date: Mon, 04 Sep 2017 19:19:28 -0000 Subject: [Python-checkins] Use a team to maintain the email related packages. (#3290) Message-ID: https://github.com/python/cpython/commit/1a589a604f49be81f8d932391bdfab9438d18f9d commit: 1a589a604f49be81f8d932391bdfab9438d18f9d branch: master author: Barry Warsaw committer: GitHub date: 2017-09-04T15:19:26-04:00 summary: Use a team to maintain the email related packages. (#3290) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6cda5a0f767..a318a2f0bee 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -24,11 +24,11 @@ Python/bootstrap_hash.c @python/crypto-team # Email and related -**/*mail* @bitdancer -**/*smtp* @bitdancer -**/*mime* @bitdancer -**/*imap* @bitdancer -**/*poplib* @bitdancer +**/*mail* @python/email-team +**/*smtp* @python/email-team +**/*mime* @python/email-team +**/*imap* @python/email-team +**/*poplib* @python/email-team # subprocess **/*subprocess* @gpshead From webhook-mailer at python.org Mon Sep 4 15:31:18 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 04 Sep 2017 19:31:18 -0000 Subject: [Python-checkins] Add references to modules I am responsible for (#3291) Message-ID: https://github.com/python/cpython/commit/f58e6e276849e43d96ba59fecadf5bf8f39f92a9 commit: f58e6e276849e43d96ba59fecadf5bf8f39f92a9 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T12:31:15-07:00 summary: Add references to modules I am responsible for (#3291) files: M .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a318a2f0bee..28ca17e7e93 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -40,3 +40,12 @@ Python/bootstrap_hash.c @python/crypto-team # Windows installer packages /Tools/msi/ @python/windows-team /Tools/nuget/ @python/windows-team + +**/*itertools* @rhettinger +**/*collections* @rhettinger +**/*random* @rhettinger +**/*queue* @rhettinger +**/*bisect* @rhettinger +**/*heapq* @rhettinger +**/*functools* @ncoghlan @rhettinger +**/*decimal* @rhettinger @skrah From webhook-mailer at python.org Mon Sep 4 16:17:29 2017 From: webhook-mailer at python.org (R. David Murray) Date: Mon, 04 Sep 2017 20:17:29 -0000 Subject: [Python-checkins] Clarify nature of parse_args 'args' argument. (#3292) Message-ID: https://github.com/python/cpython/commit/0c7983e4adf9604d0ac93757a45d14be06c27696 commit: 0c7983e4adf9604d0ac93757a45d14be06c27696 branch: master author: R. David Murray committer: GitHub date: 2017-09-04T16:17:26-04:00 summary: Clarify nature of parse_args 'args' argument. (#3292) Patch by Paul.j3. Includes an unrelated but useful addition to the optparse porting section. files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 45303048174..a16aa1081d8 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -898,6 +898,8 @@ values are: usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +.. _`argparse.REMAINDER`: + * ``argparse.REMAINDER``. All the remaining command-line arguments are gathered into a list. This is commonly useful for command line utilities that dispatch to other command line utilities:: @@ -1324,8 +1326,11 @@ The parse_args() method created and how they are assigned. See the documentation for :meth:`add_argument` for details. - By default, the argument strings are taken from :data:`sys.argv`, and a new empty - :class:`Namespace` object is created for the attributes. + * args_ - List of strings to parse. The default is taken from + :data:`sys.argv`. + + * namespace_ - An object to take the attributes. The default is a new empty + :class:`Namespace` object. Option value syntax @@ -1467,6 +1472,7 @@ unambiguous (the prefix matches a unique option):: An error is produced for arguments that could produce more than one options. This feature can be disabled by setting :ref:`allow_abbrev` to ``False``. +.. _args: Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^ @@ -1488,6 +1494,7 @@ interactive prompt:: >>> parser.parse_args(['1', '2', '3', '4', '--sum']) Namespace(accumulate=, integers=[1, 2, 3, 4]) +.. _namespace: The Namespace object ^^^^^^^^^^^^^^^^^^^^ @@ -2008,7 +2015,12 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`: * Replace ``(options, args) = parser.parse_args()`` with ``args = parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls for the positional arguments. Keep in mind that what was previously - called ``options``, now in :mod:`argparse` context is called ``args``. + called ``options``, now in the :mod:`argparse` context is called ``args``. + +* Replace :meth:`optparse.OptionParser.disable_interspersed_args` + by setting ``nargs`` of a positional argument to `argparse.REMAINDER`_, or + use :meth:`~ArgumentParser.parse_known_args` to collect unparsed argument + strings in a separate list. * Replace callback actions and the ``callback_*`` keyword arguments with ``type`` or ``action`` arguments. From webhook-mailer at python.org Mon Sep 4 16:26:03 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 20:26:03 -0000 Subject: [Python-checkins] bpo-25674: remove sha256.tbs-internet.com ssl test (#3297) Message-ID: https://github.com/python/cpython/commit/002d64039b60c1a9289f981fe73a5cf91d082136 commit: 002d64039b60c1a9289f981fe73a5cf91d082136 branch: master author: Christian Heimes committer: GitHub date: 2017-09-04T22:26:01+02:00 summary: bpo-25674: remove sha256.tbs-internet.com ssl test (#3297) Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst D Lib/test/sha256.pem M Lib/test/test_ssl.py diff --git a/Lib/test/sha256.pem b/Lib/test/sha256.pem deleted file mode 100644 index d3db4b85c0a..00000000000 --- a/Lib/test/sha256.pem +++ /dev/null @@ -1,128 +0,0 @@ -# Certificate chain for https://sha256.tbs-internet.com - 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com - i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC ------BEGIN CERTIFICATE----- -MIIGXDCCBUSgAwIBAgIRAKpVmHgg9nfCodAVwcP4siwwDQYJKoZIhvcNAQELBQAw -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMB4XDTEyMDEwNDAwMDAwMFoXDTE0MDIxNzIzNTk1OVowgcsxCzAJBgNV -BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV -BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM -VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS -c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0 -LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKQIX/zdJcyxty0m -PM1XQSoSSifueS3AVcgqMsaIKS/u+rYzsv4hQ/qA6vLn5m5/ewUcZDj7zdi6rBVf -PaVNXJ6YinLX0tkaW8TEjeVuZG5yksGZlhCt1CJ1Ho9XLiLaP4uJ7MCoNUntpJ+E -LfrOdgsIj91kPmwjDJeztVcQCvKzhjVJA/KxdInc0JvOATn7rpaSmQI5bvIjufgo -qVsTPwVFzuUYULXBk7KxRT7MiEqnd5HvviNh0285QC478zl3v0I0Fb5El4yD3p49 -IthcRnxzMKc0UhU5ogi0SbONyBfm/mzONVfSxpM+MlyvZmJqrbuuLoEDzJD+t8PU -xSuzgbcCAwEAAaOCAj4wggI6MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMB0GA1UdDgQWBBT/qTGYdaj+f61c2IRFL/B1eEsM8DAOBgNVHQ8BAf8EBAMC -BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG -CisGAQQBgjcKAwMGCWCGSAGG+EIEATBLBgNVHSAERDBCMEAGCisGAQQB5TcCBAEw -MjAwBggrBgEFBQcCARYkaHR0cHM6Ly93d3cudGJzLWludGVybmV0LmNvbS9DQS9D -UFM0MG0GA1UdHwRmMGQwMqAwoC6GLGh0dHA6Ly9jcmwudGJzLWludGVybmV0LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMC6gLKAqhihodHRwOi8vY3JsLnRicy14NTA5LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMIGmBggrBgEFBQcBAQSBmTCBljA4BggrBgEFBQcw -AoYsaHR0cDovL2NydC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQVNHQy5jcnQw -NAYIKwYBBQUHMAKGKGh0dHA6Ly9jcnQudGJzLXg1MDkuY29tL1RCU1g1MDlDQVNH -Qy5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLnRicy14NTA5LmNvbTA/BgNV -HREEODA2ghdzaGEyNTYudGJzLWludGVybmV0LmNvbYIbd3d3LnNoYTI1Ni50YnMt -aW50ZXJuZXQuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA0pOuL8QvAa5yksTbGShzX -ABApagunUGoEydv4YJT1MXy9tTp7DrWaozZSlsqBxrYAXP1d9r2fuKbEniYHxaQ0 -UYaf1VSIlDo1yuC8wE7wxbHDIpQ/E5KAyxiaJ8obtDhFstWAPAH+UoGXq0kj2teN -21sFQ5dXgA95nldvVFsFhrRUNB6xXAcaj0VZFhttI0ZfQZmQwEI/P+N9Jr40OGun -aa+Dn0TMeUH4U20YntfLbu2nDcJcYfyurm+8/0Tr4HznLnedXu9pCPYj0TaddrgT -XO0oFiyy7qGaY6+qKh71yD64Y3ycCJ/HR9Wm39mjZYc9ezYwT4noP6r7Lk8YO7/q ------END CERTIFICATE----- - 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC - i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk -ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF -eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6 -rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0 -9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ -ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk -owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G -Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk -9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ -MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3 -AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk -ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k -by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw -cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV -VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B -ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN -AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232 -euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY -1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98 -RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz -8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV -v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E= ------END CERTIFICATE----- - 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT -AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0 -ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB -IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05 -4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6 -2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh -alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv -u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW -xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p -XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd -tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX -BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov -L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN -AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO -rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd -FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM -+bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI -3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb -+M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g= ------END CERTIFICATE----- - 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG -EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD -VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu -dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 -E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ -D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK -4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq -lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW -bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB -o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT -MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js -LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr -BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB -AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj -j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH -KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv -2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 -mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 5e143f95e39..5916a2bcf16 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1803,34 +1803,6 @@ def test_get_server_certificate_ipv6(self): _test_get_server_certificate(self, 'ipv6.google.com', 443) _test_get_server_certificate_fail(self, 'ipv6.google.com', 443) - def test_algorithms(self): - # Issue #8484: all algorithms should be available when verifying a - # certificate. - # SHA256 was added in OpenSSL 0.9.8 - if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15): - self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION) - # sha256.tbs-internet.com needs SNI to use the correct certificate - if not ssl.HAS_SNI: - self.skipTest("SNI needed for this test") - # https://sha2.hboeck.de/ was used until 2011-01-08 (no route to host) - remote = ("sha256.tbs-internet.com", 443) - sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem") - with support.transient_internet("sha256.tbs-internet.com"): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.load_verify_locations(sha256_cert) - s = ctx.wrap_socket(socket.socket(socket.AF_INET), - server_hostname="sha256.tbs-internet.com") - try: - s.connect(remote) - if support.verbose: - sys.stdout.write("\nCipher with %r is %r\n" % - (remote, s.cipher())) - sys.stdout.write("Certificate is:\n%s\n" % - pprint.pformat(s.getpeercert())) - finally: - s.close() - def _test_get_server_certificate(test, host, port, cert=None): pem = ssl.get_server_certificate((host, port)) diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst new file mode 100644 index 00000000000..383d1b43615 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst @@ -0,0 +1 @@ +Remove sha256.tbs-internet.com ssl test From webhook-mailer at python.org Mon Sep 4 16:30:25 2017 From: webhook-mailer at python.org (larryhastings) Date: Mon, 04 Sep 2017 20:30:25 -0000 Subject: [Python-checkins] Blurbify master branch. (#3298) Message-ID: https://github.com/python/cpython/commit/f9f17346d722b6f073a048b41ec0d6adf336d1d2 commit: f9f17346d722b6f073a048b41ec0d6adf336d1d2 branch: master author: larryhastings committer: GitHub date: 2017-09-04T13:30:19-07:00 summary: Blurbify master branch. (#3298) Blurbify master branch. files: A Misc/NEWS.d/3.5.0.rst A Misc/NEWS.d/3.5.0a1.rst A Misc/NEWS.d/3.5.0a2.rst A Misc/NEWS.d/3.5.0a3.rst A Misc/NEWS.d/3.5.0a4.rst A Misc/NEWS.d/3.5.0b1.rst A Misc/NEWS.d/3.5.0b2.rst A Misc/NEWS.d/3.5.0b3.rst A Misc/NEWS.d/3.5.0b4.rst A Misc/NEWS.d/3.5.0rc1.rst A Misc/NEWS.d/3.5.0rc2.rst A Misc/NEWS.d/3.5.0rc3.rst A Misc/NEWS.d/3.5.0rc4.rst A Misc/NEWS.d/3.5.1.rst A Misc/NEWS.d/3.5.1rc1.rst A Misc/NEWS.d/3.5.2.rst A Misc/NEWS.d/3.5.2rc1.rst A Misc/NEWS.d/3.5.3.rst A Misc/NEWS.d/3.5.3rc1.rst A Misc/NEWS.d/3.6.0.rst A Misc/NEWS.d/3.6.0a1.rst A Misc/NEWS.d/3.6.0a2.rst A Misc/NEWS.d/3.6.0a3.rst A Misc/NEWS.d/3.6.0a4.rst A Misc/NEWS.d/3.6.0b1.rst A Misc/NEWS.d/3.6.0b2.rst A Misc/NEWS.d/3.6.0b3.rst A Misc/NEWS.d/3.6.0b4.rst A Misc/NEWS.d/3.6.0rc1.rst A Misc/NEWS.d/3.6.0rc2.rst A Misc/NEWS.d/3.6.1rc1.rst A Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst A Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst A Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst A Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst A Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst A Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst A Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst A Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst A Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst A Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst A Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst A Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst A Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst A Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst A Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst A Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst A Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst A Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst A Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst A Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst A Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst A Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst A Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst A Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst A Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst A Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst A Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst A Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst A Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst A Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst A Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst A Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst A Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst A Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst A Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst A Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst A Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst A Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst A Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst A Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst A Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst A Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst A Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst A Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst A Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst A Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst A Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst A Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst A Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst A Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst A Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst A Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst A Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst A Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst A Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst A Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst A Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst A Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst A Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst A Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst A Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst A Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst A Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst A Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst A Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst A Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst A Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst A Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst A Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst A Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst A Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst A Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst A Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst A Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst A Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst A Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst A Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst A Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst A Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst A Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst A Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst A Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst A Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst A Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst A Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst A Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst A Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst A Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst A Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst A Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst A Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst A Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst A Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst A Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst A Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst A Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst A Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst A Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst A Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst A Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst A Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst A Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst A Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst A Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst A Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst A Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst A Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst A Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst A Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst A Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst A Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst A Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst A Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst A Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst A Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst A Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst A Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst A Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst A Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst A Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst A Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst A Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst A Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst A Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst A Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst A Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst A Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst A Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst A Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst A Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst A Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst A Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst A Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst A Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst A Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst A Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst A Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst A Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst A Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst A Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst A Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst A Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst A Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst A Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst A Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst A Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst A Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst A Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst A Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst A Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst A Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst A Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst A Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst A Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst A Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst A Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst A Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst A Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst A Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst A Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst A Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst A Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst A Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst A Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst A Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst A Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst A Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst A Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst A Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst A Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst A Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst A Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst A Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst A Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst A Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst A Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst A Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst A Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst A Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst A Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst A Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst A Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst A Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst A Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst A Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst A Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst A Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst A Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst A Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst A Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst A Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst A Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst A Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst A Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst A Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst A Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst A Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst A Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst A Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst A Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst A Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst A Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst A Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst A Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst A Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst A Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst A Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst A Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst A Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst A Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst A Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst A Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst A Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst A Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst A Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst A Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst A Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst A Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst A Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst A Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst A Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst A Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst A Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst A Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst A Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst A Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst A Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst A Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst A Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst A Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst A Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst A Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst A Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst A Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst A Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst A Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst A Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst A Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst A Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst A Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst A Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst A Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst A Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst A Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst A Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst A Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst A Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst A Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst A Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst A Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst A Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst A Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst A Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst A Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst A Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst A Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst A Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst A Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst A Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst A Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst A Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst A Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst A Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst A Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst A Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst A Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst A Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst A Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst A Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst A Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst A Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst A Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst A Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst A Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst A Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst A Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst A Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst A Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst A Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst A Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst A Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst A Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst A Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst A Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst A Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst A Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst A Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst A Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst A Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst A Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst A Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst A Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst A Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst A Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst A Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst A Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst A Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst A Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst A Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst A Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst A Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst A Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst A Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst A Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst A Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst A Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst A Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst A Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst A Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst A Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst A Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst A Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst A Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst A Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst A Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst A Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst A Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst A Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst A Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst A Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst A Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst A Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst A Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst A Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst A Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst A Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst A Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst A Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst A Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst A Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst A Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst A Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst A Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst A Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst A Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst A Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst A Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst A Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst A Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst A Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst A Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst A Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst A Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst A Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst A Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst A Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst A Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst A Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst A Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst A Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst A Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst A Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst A Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst A Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst A Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst A Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst A Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst A Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst A Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst A Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst A Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst A Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst A Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst A Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst A Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst A Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst A Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst A Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst A Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst A Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst A Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst A Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst A Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst A Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst A Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst A Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst A Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst A Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst A Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst A Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst A Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst A Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst A Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst A Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst A Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst A Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst A Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst A Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst A Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst A Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst A Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst A Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst A Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst A Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst A Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst A Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst A Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst A Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst A Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst A Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst A Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst A Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst A Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst A Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst A Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst A Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst A Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst A Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst A Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst A Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst A Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst A Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst A Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst A Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst A Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst A Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst A Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst A Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst A Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst A Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst A Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst A Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst A Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst A Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst A Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst A Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst A Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst A Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst A Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst A Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst A Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst A Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst A Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst A Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst A Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst A Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst A Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst A Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst A Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst A Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst A Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst A Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst A Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst A Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst A Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst A Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst A Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst A Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst A Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst A Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst A Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst A Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst A Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst A Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst A Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst A Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst A Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst A Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst A Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst A Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst A Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst A Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst A Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst A Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst A Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst A Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst A Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst A Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst A Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst A Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst D Misc/NEWS M Doc/tools/susp-ignored.csv diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index c0c95d0fea1..393dc6b96b4 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -325,9 +325,6 @@ whatsnew/3.5,,:warning,'WARNING:root:warning\n' whatsnew/3.5,,::,>>> addr6 = ipaddress.IPv6Address('::1') whatsnew/3.5,,:root,ERROR:root:exception whatsnew/3.5,,:exception,ERROR:root:exception -whatsnew/changelog,,:version,import sys; I = version[:version.index(' ')] -whatsnew/changelog,,:end,str[start:end] library/binascii,,`,'`' library/uu,,`,'`' whatsnew/3.7,,`,'`' -whatsnew/changelog,,`,'`' diff --git a/Misc/NEWS b/Misc/NEWS deleted file mode 100644 index 9927e3490f9..00000000000 --- a/Misc/NEWS +++ /dev/null @@ -1,9805 +0,0 @@ -+++++++++++ -Python News -+++++++++++ - -What's New in Python 3.7.0 alpha 1? -=================================== - -*Release date: XXXX-XX-XX* - -Core and Builtins ------------------ - -- bpo-31161: Make sure the 'Missing parentheses' syntax error message is - only applied to SyntaxError, not to subclasses. Patch by Martijn Pieters. - -- bpo-30814: Fixed a race condition when import a submodule from a package. - -- bpo-30736: The internal unicodedata database has been upgraded to Unicode - 10.0. - -- bpo-30604: Move co_extra_freefuncs from per-thread to per-interpreter to - avoid crashes. - -- bpo-30597: ``print`` now shows expected input in custom error message when - used as a Python 2 statement. Patch by Sanyam Khurana. - -- bpo-30682: Removed a too-strict assertion that failed for certain f-strings, - such as eval("f'\\\n'") and eval("f'\\\r'"). - -- bpo-30501: The compiler now produces more optimal code for complex condition - expressions in the "if", "while" and "assert" statement, the "if" expression, - and generator expressions and comprehensions. - -- bpo-28180: Implement PEP 538 (legacy C locale coercion). This means that when - a suitable coercion target locale is available, both the core interpreter and - locale-aware C extensions will assume the use of UTF-8 as the default text - encoding, rather than ASCII. - -- bpo-30486: Allows setting cell values for __closure__. Patch by Lisa Roach. - -- bpo-30537: itertools.islice now accepts integer-like objects (having - an __index__ method) as start, stop, and slice arguments - -- bpo-25324: Tokens needed for parsing in Python moved to C. ``COMMENT``, - ``NL`` and ``ENCODING``. This way the tokens and tok_names in the token - module don't get changed when you import the tokenize module. - -- bpo-29104: Fixed parsing backslashes in f-strings. - -- bpo-27945: Fixed various segfaults with dict when input collections are - mutated during searching, inserting or comparing. Based on patches by - Duane Griffin and Tim Mitchell. - -- bpo-25794: Fixed type.__setattr__() and type.__delattr__() for - non-interned attribute names. Based on patch by Eryk Sun. - -- bpo-30039: If a KeyboardInterrupt happens when the interpreter is in - the middle of resuming a chain of nested 'yield from' or 'await' - calls, it's now correctly delivered to the innermost frame. - -- bpo-28974: ``object.__format__(x, '')`` is now equivalent to ``str(x)`` - rather than ``format(str(self), '')``. - -- bpo-30024: Circular imports involving absolute imports with binding - a submodule to a name are now supported. - -- bpo-12414: sys.getsizeof() on a code object now returns the sizes - which includes the code struct and sizes of objects which it references. - Patch by Dong-hee Na. - -- bpo-29839: len() now raises ValueError rather than OverflowError if - __len__() returned a large negative integer. - -- bpo-11913: README.rst is now included in the list of distutils standard - READMEs and therefore included in source distributions. - -- bpo-29914: Fixed default implementations of __reduce__ and __reduce_ex__(). - object.__reduce__() no longer takes arguments, object.__reduce_ex__() now - requires one argument. - -- bpo-29949: Fix memory usage regression of set and frozenset object. - -- bpo-29935: Fixed error messages in the index() method of tuple, list and deque - when pass indices of wrong type. - -- bpo-29816: Shift operation now has less opportunity to raise OverflowError. - ValueError always is raised rather than OverflowError for negative counts. - Shifting zero with non-negative count always returns zero. - -- bpo-24821: Fixed the slowing down to 25 times in the searching of some - unlucky Unicode characters. - -- bpo-29102: Add a unique ID to PyInterpreterState. This makes it easier - to identify each subinterpreter. - -- bpo-29894: The deprecation warning is emitted if __complex__ returns an - instance of a strict subclass of complex. In a future versions of Python - this can be an error. - -- bpo-29859: Show correct error messages when any of the pthread_* calls in - thread_pthread.h fails. - -- bpo-29849: Fix a memory leak when an ImportError is raised during from import. - -- bpo-28856: Fix an oversight that %b format for bytes should support objects - follow the buffer protocol. - -- bpo-29723: The ``sys.path[0]`` initialization change for bpo-29139 caused a - regression by revealing an inconsistency in how sys.path is initialized when - executing ``__main__`` from a zipfile, directory, or other import location. - The interpreter now consistently avoids ever adding the import location's - parent directory to ``sys.path``, and ensures no other ``sys.path`` entries - are inadvertently modified when inserting the import location named on the - command line. - -- bpo-29568: Escaped percent "%%" in the format string for classic string - formatting no longer allows any characters between two percents. - -- bpo-29714: Fix a regression that bytes format may fail when containing zero - bytes inside. - -- bpo-29695: bool(), float(), list() and tuple() no longer take keyword arguments. - The first argument of int() can now be passes only as positional argument. - -- bpo-28893: Set correct __cause__ for errors about invalid awaitables - returned from __aiter__ and __anext__. - -- bpo-28876: ``bool(range)`` works even if ``len(range)`` - raises :exc:`OverflowError`. - -- bpo-29683: Fixes to memory allocation in _PyCode_SetExtra. Patch by - Brian Coleman. - -- bpo-29684: Fix minor regression of PyEval_CallObjectWithKeywords. - It should raise TypeError when kwargs is not a dict. But it might - cause segv when args=NULL and kwargs is not a dict. - -- bpo-28598: Support __rmod__ for subclasses of str being called before - str.__mod__. Patch by Martijn Pieters. - -- bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX. - Patch by Matthieu Dartiailh. - -- bpo-29602: Fix incorrect handling of signed zeros in complex constructor for - complex subclasses and for inputs having a __complex__ method. Patch - by Serhiy Storchaka. - -- bpo-29347: Fixed possibly dereferencing undefined pointers - when creating weakref objects. - -- bpo-29463: Add ``docstring`` field to Module, ClassDef, FunctionDef, - and AsyncFunctionDef ast nodes. docstring is not first stmt in their body - anymore. It affects ``co_firstlineno`` and ``co_lnotab`` of code object - for module and class. - -- bpo-29438: Fixed use-after-free problem in key sharing dict. - -- bpo-29546: Set the 'path' and 'name' attribute on ImportError for ``from ... import ...``. - -- bpo-29546: Improve from-import error message with location - -- bpo-29478: If max_line_length=None is specified while using the Compat32 policy, - it is no longer ignored. Patch by Mircea Cosbuc. - -- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. - -- Issue #29337: Fixed possible BytesWarning when compare the code objects. - Warnings could be emitted at compile time. - -- Issue #29327: Fixed a crash when pass the iterable keyword argument to - sorted(). - -- Issue #29034: Fix memory leak and use-after-free in os module (path_converter). - -- Issue #29159: Fix regression in bytes(x) when x.__index__() raises Exception. - -- Issue #29049: Call _PyObject_GC_TRACK() lazily when calling Python function. - Calling function is up to 5% faster. - -- Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII - whitespace, not only spaces. Patch by Robert Xiao. - -- Issue #28932: Do not include if it does not exist. - -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. - -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate - form. - -- Issue #18896: Python function can now have more than 255 parameters. - collections.namedtuple() now supports tuples with more than 255 elements. - -- Issue #28596: The preferred encoding is UTF-8 on Android. Patch written by - Chi Hsuan Yen. - -- bpo-22257: Clean up interpreter startup (see PEP 432). - -- Issue #26919: On Android, operating system data is now always encoded/decoded - to/from UTF-8, instead of the locale encoding to avoid inconsistencies with - os.fsencode() and os.fsdecode() which are already using UTF-8. - -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy - bug triggerable by a monkey-patched len() function. - -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. Patch written by INADA - Naoki. - -- Issue #28739: f-string expressions are no longer accepted as docstrings and - by ast.literal_eval() even if they do not include expressions. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28918: Fix the cross compilation of xxlimited when Python has been - built with Py_DEBUG defined. - -- Issue #23722: Rather than silently producing a class that doesn't support - zero-argument ``super()`` in methods, failing to pass the new - ``__classcell__`` namespace entry up to ``type.__new__`` now results in a - ``DeprecationWarning`` and a class that supports zero-argument ``super()``. - -- Issue #28797: Modifying the class __dict__ inside the __set_name__ method of - a descriptor that is used inside that class no longer prevents calling the - __set_name__ method of other descriptors. - -- Issue #28799: Remove the ``PyEval_GetCallStats()`` function and deprecate - the untested and undocumented ``sys.callstats()`` function. Remove the - ``CALL_PROFILE`` special build: use the :func:`sys.setprofile` function, - :mod:`cProfile` or :mod:`profile` to profile function calls. - -- Issue #12844: More than 255 arguments can now be passed to a function. - -- Issue #28782: Fix a bug in the implementation ``yield from`` when checking - if the next instruction is YIELD_FROM. Regression introduced by WORDCODE - (issue #26647). - -- Issue #28774: Fix error position of the unicode error in ASCII and Latin1 - encoders when a string returned by the error handler contains multiple - non-encodable characters (non-ASCII for the ASCII codec, characters out - of the U+0000-U+00FF range for Latin1). - -- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. - Improve speed of dict literal with constant keys up to 30%. - -- Issue #28532: Show sys.version when -V option is supplied twice. - -- Issue #27100: The with-statement now checks for __enter__ before it - checks for __exit__. This gives less confusing error messages when - both methods are missing. Patch by Jonathan Ellington. - -- Issue #28746: Fix the set_inheritable() file descriptor method on platforms - that do not have the ioctl FIOCLEX and FIONCLEX commands. - -- Issue #26920: Fix not getting the locale's charset upon initializing the - interpreter, on platforms that do not have langinfo. - -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X - when decode astral characters. Patch by Xiang Zhang. - -- Issue #28665: Improve speed of the STORE_DEREF opcode by 40%. - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #28621: Sped up converting int to float by reusing faster bits counting - implementation. Patch by Adrian Wielgosik. - -- Issue #28580: Optimize iterating split table values. - Patch by Xiang Zhang. - -- Issue #28583: PyDict_SetDefault didn't combine split table when needed. - Patch by Xiang Zhang. - -- Issue #28128: Deprecation warning for invalid str and byte escape - sequences now prints better information about where the error - occurs. Patch by Serhiy Storchaka and Eric Smith. - -- Issue #28509: dict.update() no longer allocate unnecessary large memory. - -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug - build. - -- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused - keeping unreachable code. - -- Issue #28214: Improved exception reporting for problematic __set_name__ - attributes. - -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception - loss in PyTraceBack_Here(). - -- Issue #28183: Optimize and cleanup dict iteration. - -- Issue #26081: Added C implementation of asyncio.Future. - Original patch by Yury Selivanov. - -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). - Patch by Xiang Zhang. - -- Issue #28376: The type of long range iterator is now registered as Iterator. - Patch by Oren Milman. - -- Issue #28376: Creating instances of range_iterator by calling range_iterator - type now is disallowed. Calling iter() on range instance is the only way. - Patch by Oren Milman. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28201: Dict reduces possibility of 2nd conflict in hash table when - hashes have same lower bits. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #26617: Fix crash when GC runs during weakref callbacks. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #28289: ImportError.__init__ now resets not specified attributes. - -- Issue #21578: Fixed misleading error message when ImportError called with - invalid keyword args. - -- Issue #28203: Fix incorrect type in complex(1.0, {2:3}) error message. - Patch by Soumya Sharma. - -- Issue #28086: Single var-positional argument of tuple subtype was passed - unscathed to the C-defined function. Now it is converted to exact tuple. - -- Issue #28214: Now __set_name__ is looked up on the class instead of the - instance. - -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() - syscall fails with EPERM, for example when blocked by SECCOMP. - -- Issue #28192: Don't import readline in isolated mode. - -- Issue #27441: Remove some redundant assignments to ob_size in longobject.c. - Thanks Oren Milman. - -- Issue #27222: Clean up redundant code in long_rshift function. Thanks - Oren Milman. - -- Upgrade internal unicode databases to Unicode version 9.0.0. - -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport - should use the same optimization level as the interpreter. - -- Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly - optimize memcpy(). - -- Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a - "pending key" (Not yet inserted in split-table). Patch by Xiang Zhang. - -- Issue #26182: Raise DeprecationWarning when async and await keywords are - used as variable/attribute/class/function name. - -- Issue #26182: Fix a refleak in code that raises DeprecationWarning. - -- Issue #28721: Fix asynchronous generators aclose() and athrow() to - handle StopAsyncIteration propagation properly. - -- Issue #26110: Speed-up method calls: add LOAD_METHOD and CALL_METHOD - opcodes. - -Extension Modules ------------------ - -- Issue #29169: Update zlib to 1.2.11. - -Library -------- - -- bpo-30119: ftplib.FTP.putline() now throws ValueError on commands that contains - CR or LF. Patch by Dong-hee Na. - -- bpo-30879: os.listdir() and os.scandir() now emit bytes names when called - with bytes-like argument. - -- bpo-30746: Prohibited the '=' character in environment variable names in - ``os.putenv()`` and ``os.spawn*()``. - -- bpo-30664: The description of a unittest subtest now preserves the order of - keyword arguments of TestCase.subTest(). - -- [Security] bpo-30730: Prevent environment variables injection in subprocess on - Windows. Prevent passing other environment variables and command arguments. - -- bpo-21071: struct.Struct.format type is now :class:`str` instead of - :class:`bytes`. - -- bpo-29212: Fix concurrent.futures.thread.ThreadPoolExecutor threads to have - a non repr() based thread name by default when no thread_name_prefix is - supplied. They will now identify themselves as "ThreadPoolExecutor-y_n". - -- [Security] bpo-30694: Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes - of multiple security vulnerabilities including: CVE-2017-9233 (External - entity infinite loop DoS), CVE-2016-9063 (Integer overflow, re-fix), - CVE-2016-0718 (Fix regression bugs from 2.2.0's fix to CVE-2016-0718) - and CVE-2012-0876 (Counter hash flooding with SipHash). - Note: the CVE-2016-5300 (Use os-specific entropy sources like getrandom) - doesn't impact Python, since Python already gets entropy from the OS to set - the expat secret using ``XML_SetHashSalt()``. - -- bpo-29755: Fixed the lgettext() family of functions in the gettext module. - They now always return bytes. - -- [Security] bpo-30500: Fix urllib.parse.splithost() to correctly parse - fragments. For example, ``splithost('//127.0.0.1#@evil.com/')`` now - correctly returns the ``127.0.0.1`` host, instead of treating ``@evil.com`` - as the host in an authentification (``login at host``). - -- bpo-30616: Functional API of enum allows to create empty enums. - Patched by Dong-hee Na - -- bpo-30038: Fix race condition between signal delivery and wakeup file - descriptor. Patch by Nathaniel Smith. - -- bpo-23894: lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. - -- [Security] bpo-29591: Update expat copy from 2.1.1 to 2.2.0 to get fixes - of CVE-2016-0718 and CVE-2016-4472. See - https://sourceforge.net/p/expat/bugs/537/ for more information. - -- bpo-24744: pkgutil.walk_packages function now raises ValueError if *path* - is a string. Patch by Sanyam Khurana. - -- bpo-24484: Avoid race condition in multiprocessing cleanup. - -- bpo-30589: Fix multiprocessing.Process.exitcode to return the opposite - of the signal number when the process is killed by a signal (instead - of 255) when using the "forkserver" method. - -- bpo-28994: The traceback no longer displayed for SystemExit raised in - a callback registered by atexit. - -- bpo-30508: Don't log exceptions if Task/Future "cancel()" method was - called. - -- bpo-30645: Fix path calculation in `imp.load_package()`, fixing it for - cases when a package is only shipped with bytecodes. Patch by - Alexandru Ardelean. - -- bpo-11822: The dis.dis() function now is able to disassemble nested - code objects. - -- bpo-30624: selectors does not take KeyboardInterrupt and SystemExit into - account, leaving a fd in a bad state in case of error. Patch by Giampaolo - Rodola'. - -- bpo-30595: multiprocessing.Queue.get() with a timeout now polls its reader in - non-blocking mode if it succeeded to acquire the lock but the acquire took - longer than the timeout. - -- bpo-28556: Updates to typing module: Add generic AsyncContextManager, add - support for ContextManager on all versions. Original PRs by Jelle Zijlstra - and Ivan Levkivskyi - -- bpo-30605: re.compile() no longer raises a BytesWarning when compiling a - bytes instance with misplaced inline modifier. Patch by Roy Williams. - -- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl - implementation. Patch by Micha?l Sgha?er. - -- bpo-29743: Closing transport during handshake process leaks open socket. - Patch by Nikolay Kim - -- bpo-27585: Fix waiter cancellation in asyncio.Lock. - Patch by Mathieu Sornay. - -- bpo-30014: modify() method of poll(), epoll() and devpoll() based classes of - selectors module is around 10% faster. Patch by Giampaolo Rodola'. - -- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL - on stdin.write() if the child process is still running but closed the pipe. - -- bpo-30463: Addded empty __slots__ to abc.ABC. This allows subclassers - to deny __dict__ and __weakref__ creation. Patch by Aaron Hall. - -- bpo-30520: Loggers are now pickleable. - -- bpo-30557: faulthandler now correctly filters and displays exception codes - on Windows - -- bpo-30526: Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through - attribute. - -- bpo-30245: Fix possible overflow when organize struct.pack_into - error message. Patch by Yuan Liu. - -- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot - handle IPv6 addresses. - -- bpo-16500: Allow registering at-fork handlers. - -- bpo-30470: Deprecate invalid ctypes call protection on Windows. Patch by - Mariatta Wijaya. - -- bpo-30414: multiprocessing.Queue._feed background running - thread do not break from main loop on exception. - -- bpo-30003: Fix handling escape characters in HZ codec. Based on patch - by Ma Lin. - -- bpo-30149: inspect.signature() now supports callables with - variable-argument parameters wrapped with partialmethod. - Patch by Dong-hee Na. - -- bpo-30436: importlib.find_spec() raises ModuleNotFoundError instead of - AttributeError if the specified parent module is not a package - (i.e. lacks a __path__ attribute). - -- bpo-30301: Fix AttributeError when using SimpleQueue.empty() under - *spawn* and *forkserver* start methods. - -- bpo-30375: Warnings emitted when compile a regular expression now always - point to the line in the user code. Previously they could point into inners - of the re module if emitted from inside of groups or conditionals. - -- bpo-30329: imaplib and poplib now catch the Windows socket WSAEINVAL error - (code 10022) on shutdown(SHUT_RDWR): An invalid operation was attempted. - This error occurs sometimes on SSL connections. - -- bpo-29196: Removed previously deprecated in Python 2.4 classes Plist, Dict - and _InternalDict in the plistlib module. Dict values in the result of - functions readPlist() and readPlistFromBytes() are now normal dicts. You - no longer can use attribute access to access items of these dictionaries. - -- bpo-9850: The :mod:`macpath` is now deprecated and will be removed - in Python 3.8. - -- bpo-30299: Compiling regular expression in debug mode on CPython now displays - the compiled bytecode in human readable form. - -- bpo-30048: Fixed ``Task.cancel()`` can be ignored when the task is - running coroutine and the coroutine returned without any more ``await``. - -- bpo-30266: contextlib.AbstractContextManager now supports anti-registration - by setting __enter__ = None or __exit__ = None, following the pattern - introduced in bpo-25958. Patch by Jelle Zijlstra. - -- bpo-30340: Enhanced regular expressions optimization. This increased - the performance of matching some patterns up to 25 times. - -- bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. - Now allowed several subsequential inline modifiers at the start of the - pattern (e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments - now are allowed before and between inline modifiers (e.g. - ``'(?x) (?i) (?s)...'``). - -- bpo-30285: Optimized case-insensitive matching and searching of regular - expressions. - -- bpo-29990: Fix range checking in GB18030 decoder. Original patch by Ma Lin. - -- bpo-29979: rewrite cgi.parse_multipart, reusing the FieldStorage class and - making its results consistent with those of FieldStorage for - multipart/form-data requests. Patch by Pierre Quentel. - -- bpo-30243: Removed the __init__ methods of _json's scanner and encoder. - Misusing them could cause memory leaks or crashes. Now scanner and encoder - objects are completely initialized in the __new__ methods. - -- bpo-30215: Compiled regular expression objects with the re.LOCALE flag no - longer depend on the locale at compile time. Only the locale at matching - time affects the result of matching. - -- bpo-30185: Avoid KeyboardInterrupt tracebacks in forkserver helper process - when Ctrl-C is received. - -- bpo-30103: binascii.b2a_uu() and uu.encode() now support using ``'`'`` - as zero instead of space. - -- bpo-28556: Various updates to typing module: add typing.NoReturn type, use - WrapperDescriptorType, minor bug-fixes. Original PRs by - Jim Fasarakis-Hilliard and Ivan Levkivskyi. - -- bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux. - -- bpo-30228: The seek() and tell() methods of io.FileIO now set the internal - seekable attribute to avoid one syscall on open() (in buffered or text mode). - -- bpo-30190: unittest's assertAlmostEqual and assertNotAlmostEqual provide a - better message in case of failure which includes the difference between - left and right arguments. (patch by Giampaolo Rodola') - -- bpo-30101: Add support for curses.A_ITALIC. - -- bpo-29822: inspect.isabstract() now works during __init_subclass__. Patch - by Nate Soares. - -- bpo-29960: Preserve generator state when _random.Random.setstate() - raises an exception. Patch by Bryan Olson. - -- bpo-30070: Fixed leaks and crashes in errors handling in the parser module. - -- bpo-22352: Column widths in the output of dis.dis() are now adjusted for - large line numbers and instruction offsets. - -- bpo-30061: Fixed crashes in IOBase methods __next__() and readlines() when - readline() or __next__() respectively return non-sizeable object. - Fixed possible other errors caused by not checking results of PyObject_Size(), - PySequence_Size(), or PyMapping_Size(). - -- bpo-30218: Fix PathLike support for shutil.unpack_archive. Patch by Jelle - Zijlstra. - -- bpo-10076: Compiled regular expression and match objects in the re module - now support copy.copy() and copy.deepcopy() (they are considered atomic). - -- bpo-30068: _io._IOBase.readlines will check if it's closed first when - hint is present. - -- bpo-29694: Fixed race condition in pathlib mkdir with flags - parents=True. Patch by Armin Rigo. - -- bpo-29692: Fixed arbitrary unchaining of RuntimeError exceptions in - contextlib.contextmanager. Patch by Siddharth Velankar. - -- bpo-26187: Test that sqlite3 trace callback is not called multiple - times when schema is changing. Indirectly fixed by switching to - use sqlite3_prepare_v2() in bpo-9303. Patch by Aviv Palivoda. - -- bpo-30017: Allowed calling the close() method of the zip entry writer object - multiple times. Writing to a closed writer now always produces a ValueError. - -- bpo-29998: Pickling and copying ImportError now preserves name and path - attributes. - -- bpo-29995: re.escape() now escapes only regex special characters. - -- bpo-29962: Add math.remainder operation, implementing remainder - as specified in IEEE 754. - -- bpo-29649: Improve struct.pack_into() exception messages for problems - with the buffer size and offset. Patch by Andrew Nester. - -- bpo-29654: Support If-Modified-Since HTTP header (browser cache). Patch - by Pierre Quentel. - -- bpo-29931: Fixed comparison check for ipaddress.ip_interface objects. - Patch by Sanjay Sundaresan. - -- bpo-29953: Fixed memory leaks in the replace() method of datetime and time - objects when pass out of bound fold argument. - -- bpo-29942: Fix a crash in itertools.chain.from_iterable when encountering - long runs of empty iterables. - -- bpo-10030: Sped up reading encrypted ZIP files by 2 times. - -- bpo-29204: Element.getiterator() and the html parameter of XMLParser() were - deprecated only in the documentation (since Python 3.2 and 3.4 correspondintly). - Now using them emits a deprecation warning. - -- bpo-27863: Fixed multiple crashes in ElementTree caused by race conditions - and wrong types. - -- bpo-25996: Added support of file descriptors in os.scandir() on Unix. - os.fwalk() is sped up by 2 times by using os.scandir(). - -- bpo-28699: Fixed a bug in pools in multiprocessing.pool that raising an - exception at the very first of an iterable may swallow the exception or - make the program hang. Patch by Davin Potts and Xiang Zhang. - -- bpo-23890: unittest.TestCase.assertRaises() now manually breaks a reference - cycle to not keep objects alive longer than expected. - -- bpo-29901: The zipapp module now supports general path-like objects, not - just pathlib.Path. - -- bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- bpo-29861: Release references to tasks, their arguments and their results - as soon as they are finished in multiprocessing.Pool. - -- bpo-19930: The mode argument of os.makedirs() no longer affects the file - permission bits of newly-created intermediate-level directories. - -- bpo-29884: faulthandler: Restore the old sigaltstack during teardown. - Patch by Christophe Zeitouny. - -- bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. - -- bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords - are not strings. Patch by Michael Seifert. - -- bpo-8256: Fixed possible failing or crashing input() if attributes "encoding" - or "errors" of sys.stdin or sys.stdout are not set or are not strings. - -- bpo-28692: Using non-integer value for selecting a plural form in gettext is - now deprecated. - -- bpo-26121: Use C library implementation for math functions erf() and erfc(). - -- bpo-29619: os.stat() and os.DirEntry.inode() now convert inode (st_ino) using - unsigned integers. - -- bpo-28298: Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big - intables (objects that have __int__) as elements. - -- bpo-29645: Speed up importing the webbrowser module. webbrowser.register() - is now thread-safe. - -- bpo-28231: The zipfile module now accepts path-like objects for external - paths. - -- bpo-26915: index() and count() methods of collections.abc.Sequence now - check identity before checking equality when do comparisons. - -- bpo-28682: Added support for bytes paths in os.fwalk(). - -- bpo-29728: Add new :data:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constant. - Patch by Nathaniel J. Smith. - -- bpo-29623: Allow use of path-like object as a single argument in - ConfigParser.read(). Patch by David Ellis. - -- bpo-9303: Migrate sqlite3 module to _v2 API. Patch by Aviv Palivoda. - -- bpo-28963: Fix out of bound iteration in asyncio.Future.remove_done_callback - implemented in C. - -- bpo-29704: asyncio.subprocess.SubprocessStreamProtocol no longer closes before - all pipes are closed. - -- bpo-29271: Fix Task.current_task and Task.all_tasks implemented in C - to accept None argument as their pure Python implementation. - -- bpo-29703: Fix asyncio to support instantiation of new event loops - in child processes. - -- bpo-29615: SimpleXMLRPCDispatcher no longer chains KeyError (or any other - exception) to exception(s) raised in the dispatched methods. - Patch by Petr Motejlek. - -- bpo-7769: Method register_function() of xmlrpc.server.SimpleXMLRPCDispatcher - and its subclasses can now be used as a decorator. - -- bpo-29376: Fix assertion error in threading._DummyThread.is_alive(). - -- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts - PathLike objects. Patch by Sayan Chowdhury. - -- bpo-28518: Start a transaction implicitly before a DML statement. - Patch by Aviv Palivoda. - -- bpo-29742: get_extra_info() raises exception if get called on closed ssl transport. - Patch by Nikolay Kim. - -- Issue #16285: urrlib.parse.quote is now based on RFC 3986 and hence includes - '~' in the set of characters that is not quoted by default. Patch by - Christian Theune and Ratnadeep Debnath. - -- bpo-29532: Altering a kwarg dictionary passed to functools.partial() - no longer affects a partial object after creation. - -- bpo-29110: Fix file object leak in aifc.open() when file is given as a - filesystem path and is not in valid AIFF format. Patch by Anthony Zhang. - -- bpo-22807: Add uuid.SafeUUID and uuid.UUID.is_safe to relay information from - the platform about whether generated UUIDs are generated with a - multiprocessing safe method. - -- bpo-29576: Improve some deprecations in importlib. Some deprecated methods - now emit DeprecationWarnings and have better descriptive messages. - -- bpo-29534: Fixed different behaviour of Decimal.from_float() - for _decimal and _pydecimal. Thanks Andrew Nester. - -- bpo-10379: locale.format_string now supports the 'monetary' keyword argument, - and locale.format is deprecated. - -- bpo-29851: importlib.reload() now raises ModuleNotFoundError if the - module lacks a spec. - -- Issue #28556: Various updates to typing module: typing.Counter, typing.ChainMap, - improved ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, - Manuel Krebber, and ?ukasz Langa. - -- Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python - 3.6.0: check minimum and maximum years. - -- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir - -- Issue #29444: Fixed out-of-bounds buffer access in the group() method of - the match object. Based on patch by WGH. - -- Issue #29377: Add WrapperDescriptorType, MethodWrapperType, and - MethodDescriptorType built-in types to types module. - Original patch by Manuel Krebber. - -- Issue #29218: Unused install_misc command is now removed. It has been - documented as unused since 2000. Patch by Eric N. Vander Weele. - -- Issue #29368: The extend() method is now called instead of the append() - method when unpickle collections.deque and other list-like objects. - This can speed up unpickling to 2 times. - -- Issue #29338: The help of a builtin or extension class now includes the - constructor signature if __text_signature__ is provided for the class. - -- Issue #29335: Fix subprocess.Popen.wait() when the child process has - exited to a stopped instead of terminated state (ex: when under ptrace). - -- Issue #29290: Fix a regression in argparse that help messages would wrap at - non-breaking spaces. - -- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY. - -- Issue #29197: Removed deprecated function ntpath.splitunc(). - -- Issue #29210: Removed support of deprecated argument "exclude" in - tarfile.TarFile.add(). - -- Issue #29219: Fixed infinite recursion in the repr of uninitialized - ctypes.CDLL instances. - -- Issue #29192: Removed deprecated features in the http.cookies module. - -- Issue #29193: A format string argument for string.Formatter.format() - is now positional-only. - -- Issue #29195: Removed support of deprecated undocumented keyword arguments - in methods of regular expression objects. - -- Issue #28969: Fixed race condition in C implementation of functools.lru_cache. - KeyError could be raised when cached function with full cache was - simultaneously called from differen threads with the same uncached arguments. - -- Issue #20804: The unittest.mock.sentinel attributes now preserve their - identity when they are copied or pickled. - -- Issue #29142: In urllib.request, suffixes in no_proxy environment variable with - leading dots could match related hostnames again (e.g. .b.c matches a.b.c). - Patch by Milan Oberkirch. - -- Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter - anymore. Patch written by Jiajun Huang. - -- Issue #15812: inspect.getframeinfo() now correctly shows the first line of - a context. Patch by Sam Breese. - -- Issue #28985: Update authorizer constants in sqlite3 module. - Patch by Dingyuan Wang. - -- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows - -- Issue #13051: Fixed recursion errors in large or resized - curses.textpad.Textbox. Based on patch by Tycho Andersen. - -- Issue #9770: curses.ascii predicates now work correctly with negative - integers. - -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. - -- Issue #28923: Remove editor artifacts from Tix.py. - -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #20191: Fixed a crash in resource.prlimit() when passing a sequence that - doesn't own its elements as limits. - -- Issue #16255: subprocess.Popen uses /system/bin/sh on Android as the shell, - instead of /bin/sh. - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #26937: The chown() method of the tarfile.TarFile class does not fail - now when the grp module cannot be imported, as for example on Android - platforms. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. A deprecation warning is now - emitted if the index file is missed and recreated in the 'r' and 'w' modes - (will be an error in future Python releases). - -- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in - re.sub() replacement templates regular expressions now are errors. - -- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): - call warnings.showwarning() if it was overridden inside the context manager. - -- Issue #27172: To assist with upgrades from 2.7, the previously documented - deprecation of ``inspect.getfullargspec()`` has been reversed. This decision - may be revisited again after the Python 2.7 branch is no longer officially - supported. - -- Issue #28740: Add sys.getandroidapilevel(): return the build time API version - of Android as an integer. Function only available on Android. - -- Issue #26273: Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and - :data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by - Omar Sandoval. - -- Issue #28752: Restored the __reduce__() methods of datetime objects. - -- Issue #28727: Regular expression patterns, _sre.SRE_Pattern objects created - by re.compile(), become comparable (only x==y and x!=y operators). This - change should fix the issue #18383: don't duplicate warning filters when the - warnings module is reloaded (thing usually only done in unit tests). - -- Issue #20572: Remove the subprocess.Popen.wait endtime parameter. It was - deprecated in 3.4 and undocumented prior to that. - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #28548: In the "http.server" module, parse the protocol version if - possible, to avoid using HTTP 0.9 in some error responses. - -- Issue #19717: Makes Path.resolve() succeed on paths that do not exist. - Patch by Vajrasky Kok - -- Issue #28563: Fixed possible DoS and arbitrary code execution when handle - plural form selections in the gettext module. The expression parser now - supports exact syntax supported by GNU gettext. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if - given empty data twice. Patch by Benjamin Fogle. - -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived - browsers. Based on patch by Oleg Broytman. - -- Issue #24241: The webbrowser in an X environment now prefers using the - default browser directly. Also, the webbrowser register() function now has - a documented 'preferred' argument, to specify browsers to be returned by - get() with no arguments. Patch by David Steele - -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused - by representing the scale as float value internally in Tk. tkinter.IntVar - now works if float value is set to underlying Tk variable. - -- Issue #28255: calendar.TextCalendar.prweek() no longer prints a space after - a weeks's calendar. calendar.TextCalendar.pryear() no longer prints redundant - newline after a year's calendar. Based on patch by Xiang Zhang. - -- Issue #28255: calendar.TextCalendar.prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. - -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. - Based on patch by Kaarle Ritvanen. - -- Issue #28353: os.fwalk() no longer fails on broken links. - -- Issue #28430: Fix iterator of C implemented asyncio.Future doesn't accept - non-None value is passed to it.send(val). - -- Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix - for readability. - -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. - -- Issue #25953: re.sub() now raises an error for invalid numerical group - reference in replacement template even if the pattern is not found in - the string. Error message for invalid group reference now includes the - group index and the position of the reference. - Based on patch by SilentGhost. - -- Issue #28469: timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead - of 1, 10, 100,... for autoranging. - -- Issue #28115: Command-line interface of the zipfile module now uses argparse. - Added support of long options. - -- Issue #18219: Optimize csv.DictWriter for large number of columns. - Patch by Mariatta Wijaya. - -- Issue #28448: Fix C implemented asyncio.Future didn't work on Windows. - -- Issue #23214: In the "io" module, the argument to BufferedReader and - BytesIO's read1() methods is now optional and can be -1, matching the - BufferedIOBase specification. - -- Issue #28480: Fix error building socket module when multithreading is - disabled. - -- Issue #28240: timeit: remove ``-c/--clock`` and ``-t/--time`` command line - options which were deprecated since Python 3.3. - -- Issue #28240: timeit now repeats the benchmarks 5 times instead of only 3 - to make benchmarks more reliable. - -- Issue #28240: timeit autorange now uses a single loop iteration if the - benchmark takes less than 10 seconds, instead of 10 iterations. - "python3 -m timeit -s 'import time' 'time.sleep(1)'" now takes 4 seconds - instead of 40 seconds. - -- Distutils.sdist now looks for README and setup.py files with case - sensitivity. This behavior matches that found in Setuptools 6.0 and - later. See `setuptools 100 - `_ for rationale. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. Patch by - Ned Batchelder. - -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - handlers. - -- Issue #27998: Fixed bytes path support in os.scandir() on Windows. - Patch by Eryk Sun. - -- Issue #28317: The disassembler now decodes FORMAT_VALUE argument. - -- Issue #28380: unittest.mock Mock autospec functions now properly support - assert_called, assert_not_called, and assert_called_once. - -- Issue #28229: lzma module now supports pathlib. - -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. - -- Issue #28225: bz2 module now supports pathlib. Initial patch by Ethan Furman. - -- Issue #28227: gzip now supports pathlib. Patch by Ethan Furman. - -- Issue #28332: Deprecated silent truncations in socket.htons and socket.ntohs. - Original patch by Oren Milman. - -- Issue #27358: Optimized merging var-keyword arguments and improved error - message when passing a non-mapping as a var-keyword argument. - -- Issue #28257: Improved error message when passing a non-iterable as - a var-positional argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. - -- Issue #28322: Fixed possible crashes when unpickle itertools objects from - incorrect pickle data. Based on patch by John Leitch. - -- Issue #28228: imghdr now supports pathlib. - -- Issue #28226: compileall now supports pathlib. - -- Issue #28314: Fix function declaration (C flags) for the getiterator() method - of xml.etree.ElementTree.Element. - -- Issue #28148: Stop using localtime() and gmtime() in the time - module. - - Introduced platform independent _PyTime_localtime API that is - similar to POSIX localtime_r, but available on all platforms. Patch - by Ed Schouten. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Patch by Xiang Zhang. - -- Issue #18844: random.choices() now has k as a keyword-only argument - to improve the readability of common cases and come into line - with the signature used in other languages. - -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. - Patch by Madison May. - -- Issue #27611: Fixed support of default root window in the tkinter.tix module. - Added the master parameter in the DisplayStyle constructor. - -- Issue #27348: In the traceback module, restore the formatting of exception - messages like "Exception: None". This fixes a regression introduced in - 3.5a2. - -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). - -- Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is - interrupted by a signal and a signal handler raises a Python exception. - -- Issue #28200: Fix memory leak on Windows in the os module (fix - path_converter() function). - -- Issue #25400: RobotFileParser now correctly returns default values for - crawl_delay and request_rate. Initial patch by Peter Wirtz. - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Fix UnboundLocalError in socket._sendfile_use_sendfile. - -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of - os.stat(). Patch by Eryk Sun. - -- Issue #22493: Warning message emitted by using inline flags in the middle of - regular expression now contains a (truncated) regex pattern. - Patch by Tim Graham. - -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. - -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. - -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. - -- Issue #28114: Fix a crash in parse_envlist() when env contains byte strings. - Patch by Eryk Sun. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. - -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. - -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. - -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. - -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. - -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. - Patch by Mark Williams. - -- Issue #28325: Remove vestigial MacOS 9 macurl2path module and its tests. - -- Issue #28368: Refuse monitoring processes if the child watcher has - no loop attached. - Patch by Vincent Michel. - -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. - -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by ????????? ????. - -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. - -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. - -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by ????????? ????. - -- Issue #27972: Prohibit Tasks to await on themselves. - -- Issue #24142: Reading a corrupt config file left configparser in an - invalid state. Original patch by Florian H?ch. - -- Issue #29581: ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base - classes to use keyword parameters in __init_subclass__. Patch by Nate Soares. - -- Issue #25532: inspect.unwrap() will now only try to unwrap an object - sys.getrecursionlimit() times, to protect against objects which create a new - object on every attribute access. - -- bpo-30177: path.resolve(strict=False) no longer cuts the path after the first - element not present in the filesystem. Patch by Antoine Pietri. - -IDLE ----- - -- bpo-15786: Fix several problems with IDLE's autocompletion box. - The following should now work: clicking on selection box items; - using the scrollbar; selecting an item by hitting Return. - Hangs on MacOSX should no longer happen. Patch by Louie Lu. - -- bpo-25514: Add doc subsubsection about IDLE failure to start. - Popup no-connection message directs users to this section. - -- bpo-30642: Fix reference leaks in IDLE tests. - Patches by Louie Lu and Terry Jan Reedy. - -- bpo-30495: Add docstrings for textview.py and use PEP8 names. - Patches by Cheryl Sabella and Terry Jan Reedy. - -- bpo-30290: Help-about: use pep8 names and add tests. - Increase coverage to 100%. - Patches by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. - -- bpo-30303: Add _utest option to textview; add new tests. - Increase coverage to 100%. - Patches by Louie Lu and Terry Jan Reedy. - -- Issue #29071: IDLE colors f-string prefixes (but not invalid ur prefixes). - -- Issue #28572: Add 10% to coverage of IDLE's test_configdialog. - Update and augment description of the configuration system. - -Windows -------- - -- bpo-30450: The build process on Windows no longer depends on Subversion, - instead pulling external code from GitHub via a Python script. If Python 3.6 - is not found on the system (via ``py -3.6``), NuGet is used to download a - copy of 32-bit Python. - -- bpo-29579: Removes readme.txt from the installer. - -- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - -- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default - -- Issue #28522: Fixes mishandled buffer reallocation in getpathp.c - -- Issue #28402: Adds signed catalog files for stdlib on Windows. - -- Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by - Eryk Sun) - -- Issue #28251: Improvements to help manuals on Windows. - -- Issue #28110: launcher.msi has different product codes between 32-bit and - 64-bit - -- Issue #28161: Opening CON for write access fails - -- Issue #28162: WindowsConsoleIO readall() fails if first line starts with - Ctrl+Z - -- Issue #28163: WindowsConsoleIO fileno() passes wrong flags to - _open_osfhandle - -- Issue #28164: _PyIO_get_console_type fails for various paths - -- Issue #28137: Renames Windows path file to ._pth - -- Issue #28138: Windows ._pth file should allow import site - -C API ------ - -- bpo-30708: PyUnicode_AsWideCharString() now raises a ValueError if the - second argument is NULL and the wchar_t\* string contains null - characters. - -- bpo-16500: Deprecate PyOS_AfterFork() and add PyOS_BeforeFork(), - PyOS_AfterFork_Parent() and PyOS_AfterFork_Child(). - -- bpo-6532: The type of results of PyThread_start_new_thread() and - PyThread_get_thread_ident(), and the id parameter of - PyThreadState_SetAsyncExc() changed from "long" to "unsigned long". - -- Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with - a macro if Py_LIMITED_API is not set or set to the value between 0x03050400 - and 0x03060000 (not including) or 0x03060100 or higher. Added functions - PySlice_Unpack() and PySlice_AdjustIndices(). - -- Issue #29083: Fixed the declaration of some public API functions. - PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in - limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and - Py_BuildValue() were not available in limited API of version < 3.3 when - PY_SSIZE_T_CLEAN is defined. - -- Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8() - is now of type ``const char *`` rather of ``char *``. - -- Issue #29058: All stable API extensions added after Python 3.2 are now - available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of - the minimum Python version supporting this API. - -- Issue #28822: The index parameters *start* and *end* of PyUnicode_FindChar() - are now adjusted to behave like ``str[start:end]``. - -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - -- Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef, - PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of - type ``const char *`` rather of ``char *``. - -- Issue #28748: Private variable _Py_PackageContext is now of type ``const char *`` - rather of ``char *``. - -- Issue #19569: Compiler warnings are now emitted if use most of deprecated - functions. - -- Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(), - PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and - PyUnicode_AsEncodedUnicode(). - -Documentation -------------- - -- bpo-30176: Add missing attribute related constants in curses documentation. - -- Issue #30052: the link targets for :func:`bytes` and - :func:`bytearray` are now their respective type definitions, rather - than the corresponding builtin function entries. Use :ref:`bytes ` - and :ref:`bytearray ` to reference the latter. - - In order to ensure this and future cross-reference updates are applied - automatically, the daily documentation builds now disable the default - output caching features in Sphinx. - -- bpo-26985: Add missing info of code object in inspect documentation. - -- bpo-19824, bpo-20314, bpo-12518: Improve the documentation for, and links - to, template strings by emphasizing their utility for internationalization, - and by clarifying some usage constraints. - -- bpo-28929: Link the documentation to its source file on GitHub. - -- bpo-25008: Document smtpd.py as effectively deprecated and add a pointer to - aiosmtpd, a third-party asyncio-based replacement. - -- Issue #26355: Add canonical header link on each page to corresponding major - version of the documentation. Patch by Matthias Bussonnier. - -- Issue #29349: Fix Python 2 syntax in code for building the documentation. - -- Issue #23722: The data model reference and the porting section in the - 3.6 What's New guide now cover the additional ``__classcell__`` handling - needed for custom metaclasses to fully support PEP 487 and zero-argument - ``super()``. - -- Issue #28513: Documented command-line interface of zipfile. - -Build ------ - -- bpo-30687: Locate msbuild.exe on Windows when building rather than - vcvarsall.bat - -- bpo-20210: Support the *disabled* marker in Setup files. Extension modules - listed after this marker are not built at all, neither by the Makefile nor by - setup.py. - -- bpo-29941: Add ``--with-assertions`` configure flag to explicitly enable - C ``assert()`` checks. Defaults to off. ``--with-pydebug`` implies - ``--with-assertions``. - -- bpo-28787: Fix out-of-tree builds of Python when configured with - ``--with--dtrace``. - -- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, - ``make install`` and some other make targets when configured with - ``--enable-optimizations``. - -- bpo-23404: Don't regenerate generated files based on file modification time - anymore: the action is now explicit. Replace ``make touch`` with - ``make regen-all``. - -- bpo-29643: Fix ``--enable-optimization`` didn't work. - -- bpo-27593: sys.version and the platform module python_build(), - python_branch(), and python_revision() functions now use - git information rather than hg when building from a repo. - -- bpo-29572: Update Windows build and OS X installers to use OpenSSL 1.0.2k. - -- Issue #27659: Prohibit implicit C function declarations: use - -Werror=implicit-function-declaration when possible (GCC and Clang, but it - depends on the compiler version). Patch written by Chi Hsuan Yen. - -- Issue #29384: Remove old Be OS helper scripts. - -- Issue #26851: Set Android compilation and link flags. - -- Issue #28768: Fix implicit declaration of function _setmode. Patch by - Masayuki Yamamoto - -- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - -- Issue #23903: Added missed names to PC/python3.def. - -- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK - macro is not defined in android-ndk-r13. - -- Issue #28538: Fix the compilation error that occurs because if_nameindex() is - available on Android API level 24, but the if_nameindex structure is not - defined. - -- Issue #20211: Do not add the directory for installing C header files and the - directory for installing object code libraries to the cross compilation - search paths. Original patch by Thomas Petazzoni. - -- Issue #28849: Do not define sys.implementation._multiarch on Android. - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28444: Fix missing extensions modules when cross compiling. - -- Issue #28208: Update Windows build and OS X installers to use SQLite 3.14.2. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -- Issue #21124: Fix building the _struct module on Cygwin by passing ``NULL`` - instead of ``&PyType_Type`` to PyVarObject_HEAD_INIT. Patch by Masayuki - Yamamoto. - -- Issue #13756: Fix building extensions modules on Cygwin. Patch by Roumen - Petrov, based on original patch by Jason Tishler. - -- Issue #21085: Add configure check for siginfo_t.si_band, which Cygwin does - not provide. Patch by Masayuki Yamamoto with review and rebase by Erik Bray. - -- Issue #28258: Fixed build with Estonian locale (python-config and distclean - targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #27979: A full copy of libffi is no longer bundled for use when - building _ctypes on non-OSX UNIX platforms. An installed copy of libffi is - now required when building _ctypes on such platforms. - -- Issue #15819: Remove redundant include search directory option for building - outside the source tree. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Patch by Gareth Rees. - -Tools/Demos ------------ - -- bpo-29748: Added the slice index converter in Argument Clinic. - -- bpo-24037: Argument Clinic now uses the converter `bool(accept={int})` rather - than `int` for semantical booleans. This avoids repeating the default - value for Python and C and will help in converting to `bool` in future. - -- Issue #29367: python-gdb.py now supports also ``method-wrapper`` - (``wrapperobject``) objects. - -- Issue #28023: Fix python-gdb.py didn't support new dict implementation. - -- Issue #15369: The pybench and pystone microbenchmark have been removed from - Tools. Please use the new Python benchmark suite - https://github.com/python/performance which is more reliable and includes a - portable version of pybench working on Python 2 and Python 3. - -- Issue #28102: The zipfile module CLI now prints usage to stderr. - Patch by Stephen J. Turnbull. - -Tests ------ - -* bpo-30357: test_thread: setUp() now uses support.threading_setup() and - support.threading_cleanup() to wait until threads complete to avoid - random side effects on following tests. Initial patch written by Grzegorz - Grzywacz. - -- bpo-30197: Enhanced functions swap_attr() and swap_item() in the - test.support module. They now work when delete replaced attribute or item - inside the with statement. The old value of the attribute or item (or None - if it doesn't exist) now will be assigned to the target of the "as" clause, - if there is one. - -- Issue #24932: Use proper command line parsing in _testembed - -- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest - command line arguments. - -- Issue #28683: Fix the tests that bind() a unix socket and raise - PermissionError on Android for a non-root user. - - - Issue #26936: Fix the test_socket failures on Android - getservbyname(), - getservbyport() and getaddrinfo() are broken on some Android API levels. - -- Issue #28666: Now test.support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or - missing the effective gid. - -- Issue #28409: regrtest: fix the parser of command line arguments. - -- Issue #28217: Adds _testconsole module to test console input. - -- Issue #26939: Add the support.setswitchinterval() function to fix - test_functools hanging on the Android armv7 qemu emulator. - - -What's New in Python 3.6.1 release candidate 1? -=============================================== - -*Release date: XXXX-XX-XX* - -Core and Builtins ------------------ - -- Issue #28932: Do not include if it does not exist. - -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. - -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate - form. - -- Issue #26919: On Android, operating system data is now always encoded/decoded - to/from UTF-8, instead of the locale encoding to avoid inconsistencies with - os.fsencode() and os.fsdecode() which are already using UTF-8. - -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy - bug triggerable by a monkey-patched len() function. - -- Issue #28739: f-string expressions are no longer accepted as docstrings and - by ast.literal_eval() even if they do not include expressions. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28918: Fix the cross compilation of xxlimited when Python has been - built with Py_DEBUG defined. - -- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. - Improve speed of dict literal with constant keys up to 30%. - -Library -------- - -- Issue #29085: Allow random.Random.seed() to use high quality OS randomness - rather than the pid and time. - -- Issue #28923: Remove editor artifacts from Tix.py. - -- Issue #29055: Neaten-up empty population error on random.choice() - by suppressing the upstream exception. - -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #20191: Fixed a crash in resource.prlimit() when passing a sequence that - doesn't own its elements as limits. - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. - -- Issue #26937: The chown() method of the tarfile.TarFile class does not fail - now when the grp module cannot be imported, as for example on Android - platforms. - -Windows -------- - -- Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) - -- Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) - -- Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) - -- Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. - -- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - -- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. - -Documentation -------------- - -- Issue #29349: Fix Python 2 syntax in code for building the documentation. - -Tests ------ - -- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest - command line arguments. - -- Issue #28683: Fix the tests that bind() a unix socket and raise - PermissionError on Android for a non-root user. - -- Issue #26939: Add the support.setswitchinterval() function to fix - test_functools hanging on the Android armv7 qemu emulator. - -Build ------ - -- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK - macro is not defined in android-ndk-r13. - -- Issue #28538: Fix the compilation error that occurs because if_nameindex() is - available on Android API level 24, but the if_nameindex structure is not - defined. - -- Issue #20211: Do not add the directory for installing C header files and the - directory for installing object code libraries to the cross compilation - search paths. Original patch by Thomas Petazzoni. - -- Issue #28849: Do not define sys.implementation._multiarch on Android. - - -What's New in Python 3.6.0? -=========================== - -*Release date: 2016-12-23* - -- No changes since release candidate 2 - - -What's New in Python 3.6.0 release candidate 2? -=============================================== - -*Release date: 2016-12-16* - -Core and Builtins ------------------ - -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. Patch written by INADA - Naoki. - -- Issue #28990: Fix asyncio SSL hanging if connection is closed before - handshake is completed. (Patch by HoHo-Ho) - -Tools/Demos ------------ - -- Issue #28770: Fix python-gdb.py for fastcalls. - -Windows -------- - -- Issue #28896: Deprecate WindowsRegistryFinder. - -Build ------ - -- Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. - - -What's New in Python 3.6.0 release candidate 1? -=============================================== - -*Release date: 2016-12-06* - -Core and Builtins ------------------ - -- Issue #23722: Rather than silently producing a class that doesn't support - zero-argument ``super()`` in methods, failing to pass the new - ``__classcell__`` namespace entry up to ``type.__new__`` now results in a - ``DeprecationWarning`` and a class that supports zero-argument ``super()``. - -- Issue #28797: Modifying the class __dict__ inside the __set_name__ method of - a descriptor that is used inside that class no longer prevents calling the - __set_name__ method of other descriptors. - -- Issue #28782: Fix a bug in the implementation ``yield from`` when checking - if the next instruction is YIELD_FROM. Regression introduced by WORDCODE - (issue #26647). - -Library -------- - -- Issue #27030: Unknown escapes in re.sub() replacement template are allowed - again. But they still are deprecated and will be disabled in 3.7. - -- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): - call warnings.showwarning() if it was overridden inside the context manager. - -- Issue #27172: To assist with upgrades from 2.7, the previously documented - deprecation of ``inspect.getfullargspec()`` has been reversed. This decision - may be revisited again after the Python 2.7 branch is no longer officially - supported. - -- Issue #26273: Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and - :data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by - Omar Sandoval. - -- Issue #24142: Reading a corrupt config file left configparser in an - invalid state. Original patch by Florian H?ch. - -- Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. - -C API ------ - -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - -Documentation -------------- - -- Issue #23722: The data model reference and the porting section in the What's - New guide now cover the additional ``__classcell__`` handling needed for - custom metaclasses to fully support PEP 487 and zero-argument ``super()``. - -Tools/Demos ------------ - -- Issue #28023: Fix python-gdb.py didn't support new dict implementation. - - -What's New in Python 3.6.0 beta 4? -================================== - -*Release date: 2016-11-21* - -Core and Builtins ------------------ - -- Issue #28532: Show sys.version when -V option is supplied twice. - -- Issue #27100: The with-statement now checks for __enter__ before it - checks for __exit__. This gives less confusing error messages when - both methods are missing. Patch by Jonathan Ellington. - -- Issue #28746: Fix the set_inheritable() file descriptor method on platforms - that do not have the ioctl FIOCLEX and FIONCLEX commands. - -- Issue #26920: Fix not getting the locale's charset upon initializing the - interpreter, on platforms that do not have langinfo. - -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X - when decode astral characters. Patch by Xiang Zhang. - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #28665: Improve speed of the STORE_DEREF opcode by 40%. - -- Issue #28583: PyDict_SetDefault didn't combine split table when needed. - Patch by Xiang Zhang. - -- Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning. - As it was agreed in the issue, __aiter__ returning an awaitable - should result in PendingDeprecationWarning in 3.5 and in - DeprecationWarning in 3.6. - -- Issue #26182: Fix a refleak in code that raises DeprecationWarning. - -- Issue #28721: Fix asynchronous generators aclose() and athrow() to - handle StopAsyncIteration propagation properly. - -Library -------- - -- Issue #28752: Restored the __reduce__() methods of datetime objects. - -- Issue #28727: Regular expression patterns, _sre.SRE_Pattern objects created - by re.compile(), become comparable (only x==y and x!=y operators). This - change should fix the issue #18383: don't duplicate warning filters when the - warnings module is reloaded (thing usually only done in unit tests). - -- Issue #20572: The subprocess.Popen.wait method's undocumented - endtime parameter now raises a DeprecationWarning. - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #19717: Makes Path.resolve() succeed on paths that do not exist. - Patch by Vajrasky Kok - -- Issue #28563: Fixed possible DoS and arbitrary code execution when handle - plural form selections in the gettext module. The expression parser now - supports exact syntax supported by GNU gettext. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #28600: Optimize loop.call_soon. - -- Issue #28613: Fix get_event_loop() return the current loop if - called from coroutines/callbacks. - -- Issue #28634: Fix asyncio.isfuture() to support unittest.Mock. - -- Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. - -- Issue #28639: Fix inspect.isawaitable to always return bool - Patch by Justin Mayfield. - -- Issue #28652: Make loop methods reject socket kinds they do not support. - -- Issue #28653: Fix a refleak in functools.lru_cache. - -- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. - -- Issue #28704: Fix create_unix_server to support Path-like objects - (PEP 519). - -- Issue #28720: Add collections.abc.AsyncGenerator. - -Documentation -------------- - -- Issue #28513: Documented command-line interface of zipfile. - -Tests ------ - -- Issue #28666: Now test.support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -Build ------ - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Patch by Gareth Rees. - - -What's New in Python 3.6.0 beta 3? -================================== - -*Release date: 2016-10-31* - -Core and Builtins ------------------ - -- Issue #28128: Deprecation warning for invalid str and byte escape - sequences now prints better information about where the error - occurs. Patch by Serhiy Storchaka and Eric Smith. - -- Issue #28509: dict.update() no longer allocate unnecessary large memory. - -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug - build. - -- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused - keeping unreachable code. - -- Issue #28214: Improved exception reporting for problematic __set_name__ - attributes. - -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception - loss in PyTraceBack_Here(). - -- Issue #28471: Fix "Python memory allocator called without holding the GIL" - crash in socket.setblocking. - -Library -------- - -- Issue #26128: Added keyword-only arguments support for - subprocess.STARTUPINFO - -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if - given empty data twice. Patch by Benjamin Fogle. - -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived - browsers. Based on patch by Oleg Broytman. - -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused - by representing the scale as float value internally in Tk. tkinter.IntVar - now works if float value is set to underlying Tk variable. - -- Issue #18844: The various ways of specifying weights for random.choices() - now produce the same result sequences. - -- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. - -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. - Based on patch by Kaarle Ritvanen. - -- Issue #28353: os.fwalk() no longer fails on broken links. - -- Issue #28430: Fix iterator of C implemented asyncio.Future doesn't accept - non-None value is passed to it.send(val). - -- Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix - for readability. - -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. - -- Issue #25953: re.sub() now raises an error for invalid numerical group - reference in replacement template even if the pattern is not found in - the string. Error message for invalid group reference now includes the - group index and the position of the reference. - Based on patch by SilentGhost. - -- Issue #18219: Optimize csv.DictWriter for large number of columns. - Patch by Mariatta Wijaya. - -- Issue #28448: Fix C implemented asyncio.Future didn't work on Windows. - -- Issue #28480: Fix error building socket module when multithreading is - disabled. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. - -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - handlers. - -- Issue #28492: Fix how StopIteration exception is raised in _asyncio.Future. - -- Issue #28500: Fix asyncio to handle async gens GC from another thread. - -- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all - children are done. - Patch by Johannes Ebke. - -- Issue #26796: Don't configure the number of workers for default - threadpool executor. - Initial patch by Hans Lawrenz. - -- Issue #28544: Implement asyncio.Task in C. - -Windows -------- - -- Issue #28522: Fixes mishandled buffer reallocation in getpathp.c - -Build ------ - -- Issue #28444: Fix missing extensions modules when cross compiling. - -- Issue #28208: Update Windows build and OS X installers to use SQLite 3.14.2. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -Tests ------ - -- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or - missing the effective gid. - -- Issue #28409: regrtest: fix the parser of command line arguments. - - -What's New in Python 3.6.0 beta 2? -================================== - -*Release date: 2016-10-10* - -Core and Builtins ------------------ - -- Issue #28183: Optimize and cleanup dict iteration. - -- Issue #26081: Added C implementation of asyncio.Future. - Original patch by Yury Selivanov. - -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). - Patch by Xiang Zhang. - -- Issue #28376: The type of long range iterator is now registered as Iterator. - Patch by Oren Milman. - -- Issue #28376: Creating instances of range_iterator by calling range_iterator - type now is deprecated. Patch by Oren Milman. - -- Issue #28376: The constructor of range_iterator now checks that step is not 0. - Patch by Oren Milman. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28201: Dict reduces possibility of 2nd conflict in hash table when - hashes have same lower bits. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #26617: Fix crash when GC runs during weakref callbacks. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #21578: Fixed misleading error message when ImportError called with - invalid keyword args. - -- Issue #28203: Fix incorrect type in complex(1.0, {2:3}) error message. - Patch by Soumya Sharma. - -- Issue #28086: Single var-positional argument of tuple subtype was passed - unscathed to the C-defined function. Now it is converted to exact tuple. - -- Issue #28214: Now __set_name__ is looked up on the class instead of the - instance. - -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() - syscall fails with EPERM, for example when blocked by SECCOMP. - -- Issue #28192: Don't import readline in isolated mode. - -- Upgrade internal unicode databases to Unicode version 9.0.0. - -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport - should use the same optimization level as the interpreter. - -- Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly - optimize memcpy(). - -- Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a - "pending key" (Not yet inserted in split-table). Patch by Xiang Zhang. - -- Issue #26182: Raise DeprecationWarning when async and await keywords are - used as variable/attribute/class/function name. - -Library -------- - -- Issue #27998: Fixed bytes path support in os.scandir() on Windows. - Patch by Eryk Sun. - -- Issue #28317: The disassembler now decodes FORMAT_VALUE argument. - -- Issue #26293: Fixed writing ZIP files that starts not from the start of the - file. Offsets in ZIP file now are relative to the start of the archive in - conforming to the specification. - -- Issue #28380: unittest.mock Mock autospec functions now properly support - assert_called, assert_not_called, and assert_called_once. - -- Issue #27181 remove statistics.geometric_mean and defer until 3.7. - -- Issue #28229: lzma module now supports pathlib. - -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. - -- Issue #28225: bz2 module now supports pathlib. Initial patch by Ethan Furman. - -- Issue #28227: gzip now supports pathlib. Patch by Ethan Furman. - -- Issue #27358: Optimized merging var-keyword arguments and improved error - message when passing a non-mapping as a var-keyword argument. - -- Issue #28257: Improved error message when passing a non-iterable as - a var-positional argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. - -- Issue #28322: Fixed possible crashes when unpickle itertools objects from - incorrect pickle data. Based on patch by John Leitch. - -- Issue #28228: imghdr now supports pathlib. - -- Issue #28226: compileall now supports pathlib. - -- Issue #28314: Fix function declaration (C flags) for the getiterator() method - of xml.etree.ElementTree.Element. - -- Issue #28148: Stop using localtime() and gmtime() in the time - module. - - Introduced platform independent _PyTime_localtime API that is - similar to POSIX localtime_r, but available on all platforms. Patch - by Ed Schouten. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Patch by Xiang Zhang. - -- Issue #18844: random.choices() now has k as a keyword-only argument - to improve the readability of common cases and come into line - with the signature used in other languages. - -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. - Patch by Madison May. - -- Issue #27611: Fixed support of default root window in the tkinter.tix module. - Added the master parameter in the DisplayStyle constructor. - -- Issue #27348: In the traceback module, restore the formatting of exception - messages like "Exception: None". This fixes a regression introduced in - 3.5a2. - -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). - -- Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is - interrupted by a signal and a signal handler raises a Python exception. - -- Issue #28200: Fix memory leak on Windows in the os module (fix - path_converter() function). - -- Issue #25400: RobotFileParser now correctly returns default values for - crawl_delay and request_rate. Initial patch by Peter Wirtz. - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Fix UnboundLocalError in socket._sendfile_use_sendfile. - -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of - os.stat(). Patch by Eryk Sun. - -- Issue #22493: Warning message emitted by using inline flags in the middle of - regular expression now contains a (truncated) regex pattern. - Patch by Tim Graham. - -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. - -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. - -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. - -- Issue #28114: Fix a crash in parse_envlist() when env contains byte strings. - Patch by Eryk Sun. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. - -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. - -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. - -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. - -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. - -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. - Patch by Mark Williams. - -- Issue #28368: Refuse monitoring processes if the child watcher has no - loop attached. - Patch by Vincent Michel. - -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. - -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by ????????? ????. - -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. - -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. - -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by ????????? ????. - -- Issue #27972: Prohibit Tasks to await on themselves. - -Windows -------- - -- Issue #28402: Adds signed catalog files for stdlib on Windows. - -- Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by - Eryk Sun) - -- Issue #28251: Improvements to help manuals on Windows. - -- Issue #28110: launcher.msi has different product codes between 32-bit and - 64-bit - -- Issue #28161: Opening CON for write access fails - -- Issue #28162: WindowsConsoleIO readall() fails if first line starts with - Ctrl+Z - -- Issue #28163: WindowsConsoleIO fileno() passes wrong flags to - _open_osfhandle - -- Issue #28164: _PyIO_get_console_type fails for various paths - -- Issue #28137: Renames Windows path file to ._pth - -- Issue #28138: Windows ._pth file should allow import site - -C API ------ - -- Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(), - PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and - PyUnicode_AsEncodedUnicode(). - -Build ------ - -- Issue #28258: Fixed build with Estonian locale (python-config and distclean - targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #15819: Remove redundant include search directory option for building - outside the source tree. - -Tests ------ - -- Issue #28217: Adds _testconsole module to test console input. - - -What's New in Python 3.6.0 beta 1? -================================== - -*Release date: 2016-09-12* - -Core and Builtins ------------------ - -- Issue #23722: The __class__ cell used by zero-argument super() is now - initialized from type.__new__ rather than __build_class__, so class methods - relying on that will now work correctly when called from metaclass methods - during class creation. Patch by Martin Teichmann. - -- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when Python - is compiled with NSMALLPOSINTS = 0. - -- Issue #27080: Implement formatting support for PEP 515. Initial patch - by Chris Angelico. - -- Issue #27199: In tarfile, expose copyfileobj bufsize to improve throughput. - Patch by Jason Fried. - -- Issue #27948: In f-strings, only allow backslashes inside the braces - (where the expressions are). This is a breaking change from the 3.6 - alpha releases, where backslashes are allowed anywhere in an - f-string. Also, require that expressions inside f-strings be - enclosed within literal braces, and not escapes like - ``f'\x7b"hi"\x7d'``. - -- Issue #28046: Remove platform-specific directories from sys.path. - -- Issue #28071: Add early-out for differencing from an empty set. - -- Issue #25758: Prevents zipimport from unnecessarily encoding a filename - (patch by Eryk Sun) - -- Issue #25856: The __module__ attribute of extension classes and functions - now is interned. This leads to more compact pickle data with protocol 4. - -- Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more - efficient bytecode. Patch by Demur Rumed, design by Serhiy Storchaka, - reviewed by Serhiy Storchaka and Victor Stinner. - -- Issue #26331: Implement tokenizing support for PEP 515. Patch by Georg Brandl. - -- Issue #27999: Make "global after use" a SyntaxError, and ditto for nonlocal. - Patch by Ivan Levkivskyi. - -- Issue #28003: Implement PEP 525 -- Asynchronous Generators. - -- Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations. - Patch by Ivan Levkivskyi. - -- Issue #26058: Add a new private version to the builtin dict type, incremented - at each dictionary creation and at each dictionary change. Implementation of - the PEP 509. - -- Issue #27364: A backslash-character pair that is not a valid escape sequence - now generates a DeprecationWarning. Patch by Emanuel Barry. - -- Issue #27350: `dict` implementation is changed like PyPy. It is more compact - and preserves insertion order. - (Concept developed by Raymond Hettinger and patch by Inada Naoki.) - -- Issue #27911: Remove unnecessary error checks in - ``exec_builtin_or_dynamic()``. - -- Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation. - -- Issue #17884: Python now requires systems with inttypes.h and stdint.h - -- Issue #27961: Require platforms to support ``long long``. Python hasn't - compiled without ``long long`` for years, so this is basically a formality. - -- Issue #27355: Removed support for Windows CE. It was never finished, - and Windows CE is no longer a relevant platform for Python. - -- Implement PEP 523. - -- Issue #27870: A left shift of zero by a large integer no longer attempts - to allocate large amounts of memory. - -- Issue #25402: In int-to-decimal-string conversion, improve the estimate - of the intermediate memory required, and remove an unnecessarily strict - overflow check. Patch by Serhiy Storchaka. - -- Issue #27214: In long_invert, be more careful about modifying object - returned by long_add, and remove an unnecessary check for small longs. - Thanks Oren Milman for analysis and patch. - -- Issue #27506: Support passing the bytes/bytearray.translate() "delete" - argument by keyword. - -- Issue #27812: Properly clear out a generator's frame's backreference to the - generator to prevent crashes in frame.clear(). - -- Issue #27811: Fix a crash when a coroutine that has not been awaited is - finalized with warnings-as-errors enabled. - -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check - after use of 'def' in _PyState_AddModule(). - Initial patch by Christian Heimes. - -- Issue #27792: The modulo operation applied to ``bool`` and other - ``int`` subclasses now always returns an ``int``. Previously - the return type depended on the input values. Patch by Xiang Zhang. - -- Issue #26984: int() now always returns an instance of exact int. - -- Issue #25604: Fix a minor bug in integer true division; this bug could - potentially have caused off-by-one-ulp results on platforms with - unreliable ldexp implementations. - -- Issue #24254: Make class definition namespace ordered by default. - -- Issue #27662: Fix an overflow check in ``List_New``: the original code was - checking against ``Py_SIZE_MAX`` instead of the correct upper bound of - ``Py_SSIZE_T_MAX``. Patch by Xiang Zhang. - -- Issue #27782: Multi-phase extension module import now correctly allows the - ``m_methods`` field to be used to add module level functions to instances - of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang. - -- Issue #27936: The round() function accepted a second None argument - for some types but not for others. Fixed the inconsistency by - accepting None for all numeric types. - -- Issue #27487: Warn if a submodule argument to "python -m" or - runpy.run_module() is found in sys.modules after parent packages are - imported, but before the submodule is executed. - -- Issue #27157: Make only type() itself accept the one-argument form. - Patch by Eryk Sun and Emanuel Barry. - -- Issue #27558: Fix a SystemError in the implementation of "raise" statement. - In a brand new thread, raise a RuntimeError since there is no active - exception to reraise. Patch written by Xiang Zhang. - -- Issue #28008: Implement PEP 530 -- asynchronous comprehensions. - -- Issue #27942: Fix memory leak in codeobject.c - -Library -------- - -- Issue #28732: Fix crash in os.spawnv() with no elements in args - -- Issue #28485: Always raise ValueError for negative - compileall.compile_dir(workers=...) parameter, even when multithreading is - unavailable. - -- Issue #28037: Use sqlite3_get_autocommit() instead of setting - Connection->inTransaction manually. - -- Issue #25283: Attributes tm_gmtoff and tm_zone are now available on - all platforms in the return values of time.localtime() and - time.gmtime(). - -- Issue #24454: Regular expression match object groups are now - accessible using __getitem__. "mo[x]" is equivalent to - "mo.group(x)". - -- Issue #10740: sqlite3 no longer implicitly commit an open transaction - before DDL statements. - -- Issue #17941: Add a *module* parameter to collections.namedtuple(). - -- Issue #22493: Inline flags now should be used only at the start of the - regular expression. Deprecation warning is emitted if uses them in the - middle of the regular expression. - -- Issue #26885: xmlrpc now supports unmarshalling additional data types used - by Apache XML-RPC implementation for numerics and None. - -- Issue #28070: Fixed parsing inline verbose flag in regular expressions. - -- Issue #19500: Add client-side SSL session resumption to the ssl module. - -- Issue #28022: Deprecate ssl-related arguments in favor of SSLContext. The - deprecation include manual creation of SSLSocket and certfile/keyfile - (or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib. - -- Issue #28043: SSLContext has improved default settings: OP_NO_SSLv2, - OP_NO_SSLv3, OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, - OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE and HIGH ciphers without MD5. - -- Issue #24693: Changed some RuntimeError's in the zipfile module to more - appropriate types. Improved some error messages and debugging output. - -- Issue #17909: ``json.load`` and ``json.loads`` now support binary input - encoded as UTF-8, UTF-16 or UTF-32. Patch by Serhiy Storchaka. - -- Issue #27137: the pure Python fallback implementation of ``functools.partial`` - now matches the behaviour of its accelerated C counterpart for subclassing, - pickling and text representation purposes. Patch by Emanuel Barry and - Serhiy Storchaka. - -- Fix possible integer overflows and crashes in the mmap module with unusual - usage patterns. - -- Issue #1703178: Fix the ability to pass the --link-objects option to the - distutils build_ext command. - -- Issue #28019: itertools.count() no longer rounds non-integer step in range - between 1.0 and 2.0 to 1. - -- Issue #18401: Pdb now supports the 'readrc' keyword argument to control - whether .pdbrc files should be read. Patch by Martin Matusiak and - Sam Kimbrel. - -- Issue #25969: Update the lib2to3 grammar to handle the unpacking - generalizations added in 3.5. - -- Issue #14977: mailcap now respects the order of the lines in the mailcap - files ("first match"), as required by RFC 1542. Patch by Michael Lazar. - -- Issue #28082: Convert re flag constants to IntFlag. - -- Issue #28025: Convert all ssl module constants to IntEnum and IntFlags. - SSLContext properties now return flags and enums. - -- Issue #23591: Add Flag, IntFlag, and auto() to enum module. - -- Issue #433028: Added support of modifier spans in regular expressions. - -- Issue #24594: Validates persist parameter when opening MSI database - -- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes - (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.) - -- Issue #28047: Fixed calculation of line length used for the base64 CTE - in the new email policies. - -- Issue #27576: Fix call order in OrderedDict.__init__(). - -- email.generator.DecodedGenerator now supports the policy keyword. - -- Issue #28027: Remove undocumented modules from ``Lib/plat-*``: IN, CDROM, - DLFCN, TYPES, CDIO, and STROPTS. - -- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). - Patch by Claude Paroz. - -- Issue #24277: The new email API is no longer provisional, and the docs - have been reorganized and rewritten to emphasize the new API. - -- Issue #22450: urllib now includes an ``Accept: */*`` header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. - -- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file - between runs given the same Grammar.txt input regardless of the hash - randomization setting. - -- Issue #28005: Allow ImportErrors in encoding implementation to propagate. - -- Issue #26667: Support path-like objects in importlib.util. - -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. - -- Issue #22233: Break email header lines *only* on the RFC specified CR and LF - characters, not on arbitrary unicode line breaks. This also fixes a bug in - HTTP header parsing. - -- Issue #27331: The email.mime classes now all accept an optional policy keyword. - -- Issue #27988: Fix email iter_attachments incorrect mutation of payload list. - -- Issue #16113: Add SHA-3 and SHAKE support to hashlib module. - -- Eliminate a tautological-pointer-compare warning in _scproxy.c. - -- Issue #27776: The :func:`os.urandom` function does now block on Linux 3.17 - and newer until the system urandom entropy pool is initialized to increase - the security. This change is part of the :pep:`524`. - -- Issue #27778: Expose the Linux ``getrandom()`` syscall as a new - :func:`os.getrandom` function. This change is part of the :pep:`524`. - -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name - fields in X.509 certs. - -- Issue #18844: Add random.choices(). - -- Issue #25761: Improved error reporting about truncated pickle data in - C implementation of unpickler. UnpicklingError is now raised instead of - AttributeError and ValueError in some cases. - -- Issue #26798: Add BLAKE2 (blake2b and blake2s) to hashlib. - -- Issue #26032: Optimized globbing in pathlib by using os.scandir(); it is now - about 1.5--4 times faster. - -- Issue #25596: Optimized glob() and iglob() functions in the - glob module; they are now about 3--6 times faster. - -- Issue #27928: Add scrypt (password-based key derivation function) to - hashlib module (requires OpenSSL 1.1.0). - -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter - measure sweet32 attack (CVE-2016-2183). - -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. - (Required OpenSSL 1.1.0 or LibreSSL). - -- Issue #25387: Check return value of winsound.MessageBeep. - -- Issue #27866: Add SSLContext.get_ciphers() method to get a list of all - enabled ciphers. - -- Issue #27744: Add AF_ALG (Linux Kernel crypto) to socket module. - -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. - -- Issue #11620: Fix support for SND_MEMORY in winsound.PlaySound. Based on a - patch by Tim Lesher. - -- Issue #11734: Add support for IEEE 754 half-precision floats to the - struct module. Based on a patch by Eli Stevens. - -- Issue #27919: Deprecated ``extra_path`` distribution option in distutils - packaging. - -- Issue #23229: Add new ``cmath`` constants: ``cmath.inf`` and ``cmath.nan`` to - match ``math.inf`` and ``math.nan``, and also ``cmath.infj`` and - ``cmath.nanj`` to match the format used by complex repr. - -- Issue #27842: The csv.DictReader now returns rows of type OrderedDict. - (Contributed by Steve Holden.) - -- Remove support for passing a file descriptor to os.access. It never worked but - previously didn't raise. - -- Issue #12885: Fix error when distutils encounters symlink. - -- Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. - Based on patch by Xiang Zhang. - -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory - creates not a cursor. Patch by Xiang Zhang. - -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. - -- Issue #27706: Restore deterministic behavior of random.Random().seed() - for string seeds using seeding version 1. Allows sequences of calls - to random() to exactly match those obtained in Python 2. - Patch by Nofar Schnider. - -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. - -- Issue #12319: Chunked transfer encoding support added to - http.client.HTTPConnection requests. The - urllib.request.AbstractHTTPHandler class does not enforce a Content-Length - header any more. If a HTTP request has a file or iterable body, but no - Content-Length header, the library now falls back to use chunked transfer- - encoding. - -- A new version of typing.py from https://github.com/python/typing: - - Collection (only for 3.6) (Issue #27598) - - Add FrozenSet to __all__ (upstream #261) - - fix crash in _get_type_vars() (upstream #259) - - Remove the dict constraint in ForwardRef._eval_type (upstream #252) - -- Issue #27832: Make ``_normalize`` parameter to ``Fraction`` constuctor - keyword-only, so that ``Fraction(2, 3, 4)`` now raises ``TypeError``. - -- Issue #27539: Fix unnormalised ``Fraction.__pow__`` result in the case - of negative exponent and negative base. - -- Issue #21718: cursor.description is now available for queries using CTEs. - -- Issue #27819: In distutils sdists, simply produce the "gztar" (gzipped tar - format) distributions on all platforms unless "formats" is supplied. - -- Issue #2466: posixpath.ismount now correctly recognizes mount points which - the user does not have permission to access. - -- Issue #9998: On Linux, ctypes.util.find_library now looks in LD_LIBRARY_PATH - for shared libraries. - -- Issue #27573: exit message for code.interact is now configurable. - -- Issue #27930: Improved behaviour of logging.handlers.QueueListener. - Thanks to Paulo Andrade and Petr Viktorin for the analysis and patch. - -- Issue #6766: Distributed reference counting added to multiprocessing - to support nesting of shared values / proxy objects. - -- Issue #21201: Improves readability of multiprocessing error message. Thanks - to Wojciech Walczak for patch. - -- asyncio: Add set_protocol / get_protocol to Transports. - -- Issue #27456: asyncio: Set TCP_NODELAY by default. - -IDLE ----- - -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. - -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - -- Issue #27891: Consistently group and sort imports within idlelib modules. - -- Issue #17642: add larger font sizes for classroom projection. - -- Add version to title of IDLE help window. - -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. - -- Issue #27821: Fix 3.6.0a3 regression that prevented custom key sets - from being selected when no custom theme was defined. - -C API ------ - -- Issue #26900: Excluded underscored names and other private API from limited API. - -- Issue #26027: Add support for path-like objects in PyUnicode_FSConverter() & - PyUnicode_FSDecoder(). - -Tests ------ - -- Issue #27427: Additional tests for the math module. Patch by Francisco Couzo. - -- Issue #27953: Skip math and cmath tests that fail on OS X 10.4 due to a - poor libm implementation of tan. - -- Issue #26040: Improve test_math and test_cmath coverage and rigour. Patch by - Jeff Allen. - -- Issue #27787: Call gc.collect() before checking each test for "dangling - threads", since the dangling threads are weak references. - -Build ------ - -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) - -- Issue #27705: Update message in validate_ucrtbase.py - -- Issue #27976: Deprecate building _ctypes with the bundled copy of libffi on - non-OSX UNIX platforms. - -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. - -- Issue #21590: Support for DTrace and SystemTap probes. - -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. - -- Issue #26359: Add the --with-optimizations flag to turn on LTO and PGO build - support when available. - -- Issue #27917: Set platform triplets for Android builds. - -- Issue #25825: Update references to the $(LIBPL) installation path on AIX. - This path was changed in 3.2a4. - -- Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2. - -- Issue #21122: Fix LTO builds on OS X. - -- Issue #17128: Build OS X installer with a private copy of OpenSSL. - Also provide a sample Install Certificates command script to install a - set of root certificates from the third-party certifi module. - -Tools/Demos ------------ - -- Issue #27952: Get Tools/scripts/fixcid.py working with Python 3 and the - current "re" module, avoid invalid Python backslash escapes, and fix a bug - parsing escaped C quote signs. - -Windows -------- - -- Issue #28065: Update xz dependency to 5.2.2 and build it from source. - -- Issue #25144: Ensures TargetDir is set before continuing with custom - install. - -- Issue #1602: Windows console doesn't input or print Unicode (PEP 528) - -- Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) - -- Issue #27731: Opt-out of MAX_PATH on Windows 10 - -- Issue #6135: Adds encoding and errors parameters to subprocess. - -- Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to - codec lookup. - -- Issue #27982: The functions of the winsound module now accept keyword - arguments. - -- Issue #20366: Build full text search support into SQLite on Windows. - -- Issue #27756: Adds new icons for Python files and processes on Windows. - Designs by Cherry Wang. - -- Issue #27883: Update sqlite to 3.14.1.0 on Windows. - - -What's New in Python 3.6.0 alpha 4? -=================================== - -*Release date: 2016-08-15* - -Core and Builtins ------------------ - -- Issue #27704: Optimized creating bytes and bytearray from byte-like objects - and iterables. Speed up to 3 times for short objects. Original patch by - Naoki Inada. - -- Issue #26823: Large sections of repeated lines in tracebacks are now - abbreviated as "[Previous line repeated {count} more times]" by the builtin - traceback rendering. Patch by Emanuel Barry. - -- Issue #27574: Decreased an overhead of parsing keyword arguments in functions - implemented with using Argument Clinic. - -- Issue #22557: Now importing already imported modules is up to 2.5 times - faster. - -- Issue #17596: Include to help with Min GW building. - -- Issue #17599: On Windows, rename the privately defined REPARSE_DATA_BUFFER - structure to avoid conflicting with the definition from Min GW. - -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by - Xiang Zhang. - -- Issue #27581: Don't rely on wrapping for overflow check in - PySequence_Tuple(). Patch by Xiang Zhang. - -- Issue #1621: Avoid signed integer overflow in list and tuple operations. - Patch by Xiang Zhang. - -- Issue #27419: Standard __import__() no longer look up "__import__" in globals - or builtins for importing submodules or "from import". Fixed a crash if - raise a warning about unabling to resolve package from __spec__ or - __package__. - -- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows. - -- Issue #27514: Make having too many statically nested blocks a SyntaxError - instead of SystemError. - -- Issue #27366: Implemented PEP 487 (Simpler customization of class creation). - Upon subclassing, the __init_subclass__ classmethod is called on the base - class. Descriptors are initialized with __set_name__ after class creation. - -Library -------- - -- Issue #26027, #27524: Add PEP 519/__fspath__() support to the os and os.path - modules. Includes code from Jelle Zijlstra. - -- Issue #27598: Add Collections to collections.abc. - Patch by Ivan Levkivskyi, docs by Neil Girdhar. - -- Issue #25958: Support "anti-registration" of special methods from - various ABCs, like __hash__, __iter__ or __len__. All these (and - several more) can be set to None in an implementation class and the - behavior will be as if the method is not defined at all. - (Previously, this mechanism existed only for __hash__, to make - mutable classes unhashable.) Code contributed by Andrew Barnert and - Ivan Levkivskyi. - -- Issue #16764: Support keyword arguments to zlib.decompress(). Patch by - Xiang Zhang. - -- Issue #27736: Prevent segfault after interpreter re-initialization due - to ref count problem introduced in code for Issue #27038 in 3.6.0a3. - Patch by Xiang Zhang. - -- Issue #25628: The *verbose* and *rename* parameters for - collections.namedtuple are now keyword-only. - -- Issue #12345: Add mathematical constant tau to math and cmath. See also - PEP 628. - -- Issue #26823: traceback.StackSummary.format now abbreviates large sections of - repeated lines as "[Previous line repeated {count} more times]" (this change - then further affects other traceback display operations in the module). Patch - by Emanuel Barry. - -- Issue #27664: Add to concurrent.futures.thread.ThreadPoolExecutor() - the ability to specify a thread name prefix. - -- Issue #27181: Add geometric_mean and harmonic_mean to statistics module. - -- Issue #27573: code.interact now prints an message when exiting. - -- Issue #6422: Add autorange method to timeit.Timer objects. - -- Issue #27773: Correct some memory management errors server_hostname in - _ssl.wrap_socket(). - -- Issue #26750: unittest.mock.create_autospec() now works properly for - subclasses of property() and other data descriptors. Removes the never - publicly used, never documented unittest.mock.DescriptorTypes tuple. - -- Issue #26754: Undocumented support of general bytes-like objects - as path in compile() and similar functions is now deprecated. - -- Issue #26800: Undocumented support of general bytes-like objects - as paths in os functions is now deprecated. - -- Issue #26981: Add _order_ compatibility shim to enum.Enum for - Python 2/3 code bases. - -- Issue #27661: Added tzinfo keyword argument to datetime.combine. - -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. - -- Issue #27783: Fix possible usage of uninitialized memory in - operator.methodcaller. - -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. - -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - -- Issue #27758: Fix possible integer overflow in the _csv module for large - record lengths. - -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. - -- Issue #7063: Remove dead code from the "array" module's slice handling. - Patch by Chuck. - -- Issue #27656: Do not assume sched.h defines any SCHED_* constants. - -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 4 GiB) when compressing and decompressing. Previously, inputs - were limited to 4 GiB, and compression and decompression operations did not - properly handle results of 4 GiB. - -- Issue #24773: Implemented PEP 495 (Local Time Disambiguation). - -- Expose the EPOLLEXCLUSIVE constant (when it is defined) in the select module. - -- Issue #27567: Expose the EPOLLRDHUP and POLLRDHUP constants in the select - module. - -- Issue #1621: Avoid signed int negation overflow in the "audioop" module. - -- Issue #27533: Release GIL in nt._isdir - -- Issue #17711: Fixed unpickling by the persistent ID with protocol 0. - Original patch by Alexandre Vassalotti. - -- Issue #27522: Avoid an unintentional reference cycle in email.feedparser. - -- Issue #27512: Fix a segfault when os.fspath() called an __fspath__() method - that raised an exception. Patch by Xiang Zhang. - -IDLE ----- - -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. - -- Issue #27621: Put query response validation error messages in the query - box itself instead of in a separate massagebox. Redo tests to match. - Add Mac OSX refinements. Original patch by Mark Roseman. - -- Issue #27620: Escape key now closes Query box as cancelled. - -- Issue #27609: IDLE: tab after initial whitespace should tab, not - autocomplete. This fixes problem with writing docstrings at least - twice indented. - -- Issue #27609: Explicitly return None when there are also non-None - returns. In a few cases, reverse a condition and eliminate a return. - -- Issue #25507: IDLE no longer runs buggy code because of its tkinter imports. - Users must include the same imports required to run directly in Python. - -- Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets. - Make the default key set depend on the platform. - Add tests for the changes to the config module. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -Tests ------ - -- Issue #25805: Skip a test in test_pkgutil as needed that doesn't work when - ``__name__ == __main__``. Patch by SilentGhost. - -- Issue #27472: Add test.support.unix_shell as the path to the default shell. - -- Issue #27369: In test_pyexpat, avoid testing an error message detail that - changed in Expat 2.2.0. - -- Issue #27594: Prevent assertion error when running test_ast with coverage - enabled: ensure code object has a valid first line number. - Patch suggested by Ivan Levkivskyi. - -Windows -------- - -- Issue #27647: Update bundled Tcl/Tk to 8.6.6. - -- Issue #27610: Adds PEP 514 metadata to Windows installer - -- Issue #27469: Adds a shell extension to the launcher so that drag and drop - works correctly. - -- Issue #27309: Enables proper Windows styles in python[w].exe manifest. - -Build ------ - -- Issue #27713: Suppress spurious build warnings when updating importlib's - bootstrap files. Patch by Xiang Zhang - -- Issue #25825: Correct the references to Modules/python.exp, which is - required on AIX. The references were accidentally changed in 3.5.0a1. - -- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Chi Hsuan Yen. - -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen and _freeze_importlib executables from being cross- - compiled. - -- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be - used for file generation during the build. - -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. - - -What's New in Python 3.6.0 alpha 3? -=================================== - -*Release date: 2016-07-11* - -Core and Builtins ------------------ - -- Issue #27473: Fixed possible integer overflow in bytes and bytearray - concatenations. Patch by Xiang Zhang. - -- Issue #23034: The output of a special Python build with defined COUNT_ALLOCS, - SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can - be re-enabled using the "-X showalloccount" option. It now outputs to stderr - instead of stdout. - -- Issue #27443: __length_hint__() of bytearray iterators no longer return a - negative integer for a resized bytearray. - -- Issue #27007: The fromhex() class methods of bytes and bytearray subclasses - now return an instance of corresponding subclass. - -Library -------- - -- Issue #26844: Fix error message for imp.find_module() to refer to 'path' - instead of 'name'. Patch by Lev Maximov. - -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. - -- Issue #27466: Change time format returned by http.cookie.time2netscape, - confirming the netscape cookie format and making it consistent with - documentation. - -- Issue #21708: Deprecated dbm.dumb behavior that differs from common dbm - behavior: creating a database in 'r' and 'w' modes and modifying a database - in 'r' mode. - -- Issue #26721: Change the socketserver.StreamRequestHandler.wfile attribute - to implement BufferedIOBase. In particular, the write() method no longer - does partial writes. - -- Issue #22115: Added methods trace_add, trace_remove and trace_info in the - tkinter.Variable class. They replace old methods trace_variable, trace, - trace_vdelete and trace_vinfo that use obsolete Tcl commands and might - not work in future versions of Tcl. Fixed old tracing methods: - trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now - always returns a list of pairs of strings, tracing in the "u" mode now works. - -- Issue #26243: Only the level argument to zlib.compress() is keyword argument - now. The first argument is positional-only. - -- Issue #27038: Expose the DirEntry type as os.DirEntry. Code patch by - Jelle Zijlstra. - -- Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return value of - __fspath__() to be either str or bytes. - -- Issue #18726: All optional parameters of the dump(), dumps(), - load() and loads() functions and JSONEncoder and JSONDecoder class - constructors in the json module are now keyword-only. - -- Issue #27319: Methods selection_set(), selection_add(), selection_remove() - and selection_toggle() of ttk.TreeView now allow passing multiple items as - multiple arguments instead of passing them as a tuple. Deprecated - undocumented ability of calling the selection() method with arguments. - -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - -- Issue #27294: Numerical state in the repr for Tkinter event objects is now - represented as a combination of known flags. - -- Issue #27177: Match objects in the re module now support index-like objects - as group indices. Based on patches by Jeroen Demeyer and Xiang Zhang. - -- Issue #26754: Some functions (compile() etc) accepted a filename argument - encoded as an iterable of integers. Now only strings and byte-like objects - are accepted. - -- Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by - Daniel Stokes. - -- Issue #27048: Prevents distutils failing on Windows when environment - variables contain non-ASCII characters - -- Issue #27330: Fixed possible leaks in the ctypes module. - -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch - by Jelle Zijlstra. - -- Issue #27122: When an exception is raised within the context being managed - by a contextlib.ExitStack() and one of the exit stack generators - catches and raises it in a chain, do not re-raise the original exception - when exiting, let the new chained one through. This avoids the PEP 479 - bug described in issue25782. - -- [Security] Issue #27278: Fix os.urandom() implementation using getrandom() on - Linux. Truncate size to INT_MAX and loop until we collected enough random - bytes, instead of casting a directly Py_ssize_t to int. - -- Issue #16864: sqlite3.Cursor.lastrowid now supports REPLACE statement. - Initial patch by Alex LordThorsen. - -- Issue #26386: Fixed ttk.TreeView selection operations with item id's - containing spaces. - -- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to - one set by the env var PAGER). - -- [Security] Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). - -- Issue #16182: Fix various functions in the "readline" module to use the - locale encoding, and fix get_begidx() and get_endidx() to return code point - indexes. - -- Issue #27392: Add loop.connect_accepted_socket(). - Patch by Jim Fulton. - -IDLE ----- - -- Issue #27477: IDLE search dialogs now use ttk widgets. - -- Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets. - Make the default key set depend on the platform. - Add tests for the changes to the config module. - -- Issue #27452: make command line "idle-test> python test_help.py" work. - __file__ is relative when python is started in the file's directory. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -- Issue #27380: IDLE: add query.py with base Query dialog and ttk widgets. - Module had subclasses SectionName, ModuleName, and HelpSource, which are - used to get information from users by configdialog and file =>Load Module. - Each subclass has itw own validity checks. Using ModuleName allows users - to edit bad module names instead of starting over. - Add tests and delete the two files combined into the new one. - -- Issue #27372: Test_idle no longer changes the locale. - -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. - -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. - Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. - -- Issue #24137: Run IDLE, test_idle, and htest with tkinter default root - disabled. Fix code and tests that fail with this restriction. Fix htests to - not create a second and redundant root and mainloop. - -- Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. - -C API ------ - -- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as - an iterable of integers. Now only strings and byte-like objects are accepted. - -Build ------ - -- Issue #28066: Fix the logic that searches build directories for generated - include files when building outside the source tree. - -- Issue #27442: Expose the Android API level that python was built against, in - sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'. - -- Issue #27434: The interpreter that runs the cross-build, found in PATH, must - now be of the same feature version (e.g. 3.6) as the source being built. - -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. - -- Issue #23968: Rename the platform directory from plat-$(MACHDEP) to - plat-$(PLATFORM_TRIPLET). - Rename the config directory (LIBPL) from config-$(LDVERSION) to - config-$(LDVERSION)-$(PLATFORM_TRIPLET). - Install the platform specifc _sysconfigdata module into the platform - directory and rename it to include the ABIFLAGS. - -- Don't use largefile support for GNU/Hurd. - -Tools/Demos ------------ - -- Issue #27332: Fixed the type of the first argument of module-level functions - generated by Argument Clinic. Patch by Petr Viktorin. - -- Issue #27418: Fixed Tools/importbench/importbench.py. - -Documentation -------------- - -- Issue #19489: Moved the search box from the sidebar to the header and footer - of each page. Patch by Ammar Askar. - -- Issue #27285: Update documentation to reflect the deprecation of ``pyvenv`` - and normalize on the term "virtual environment". Patch by Steve Piercy. - -Tests ------ - -- Issue #27027: Added test.support.is_android that is True when this is an - Android build. - - -What's New in Python 3.6.0 alpha 2? -=================================== - -*Release date: 2016-06-13* - -Core and Builtins ------------------ - -- Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. - Patch by Demur Rumed. - -- Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. - Patch by Dave Sawyer. - -- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling - function with generalized unpacking (PEP 448) and conflicting keyword names - could cause undefined behavior. - -- Issue #27140: Added BUILD_CONST_KEY_MAP opcode. - -- Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519). - -- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a - negative number without setting an exception. - -- Issue #26983: float() now always return an instance of exact float. - The deprecation warning is emitted if __float__ returns an instance of - a strict subclass of float. In a future versions of Python this can - be an error. - -- Issue #27097: Python interpreter is now about 7% faster due to optimized - instruction decoding. Based on patch by Demur Rumed. - -- Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode. - Patch by Demur Rumed. - -- Issue #23275: Allow assigning to an empty target list in round brackets: - () = iterable. - -- Issue #27243: Update the __aiter__ protocol: instead of returning - an awaitable that resolves to an asynchronous iterator, the asynchronous - iterator should be returned directly. Doing the former will trigger a - PendingDeprecationWarning. - - -Library -------- - -- Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants - exposed on the API which are not implemented on GNU/Hurd. They would not - work at runtime anyway. - -- Issue #27025: Generated names for Tkinter widgets are now more meanful - and recognizirable. - -- Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and - functools.partial objects. - -- Issue #27294: Improved repr for Tkinter event objects. - -- Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. - Patch by Gareth Rees. - -- [Security] Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - -- [Security] Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. - Reported by Team Oststrom. - -- Issue #21386: Implement missing IPv4Address.is_global property. It was - documented since 07a5610bae9d. Initial patch by Roger Luethi. - -- Issue #27029: Removed deprecated support of universal newlines mode from - ZipFile.open(). - -- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in - regular expressions now are errors. The re.LOCALE flag now can be used - only with bytes patterns. - -- Issue #27186: Add os.PathLike support to DirEntry (part of PEP 519). - Initial patch by Jelle Zijlstra. - -- Issue #20900: distutils register command now decodes HTTP responses - correctly. Initial patch by ingrid. - -- Issue #27186: Add os.PathLike support to pathlib, removing its provisional - status (part of PEP 519). Initial patch by Dusty Phillips. - -- Issue #27186: Add support for os.PathLike objects to os.fsencode() and - os.fsdecode() (part of PEP 519). - -- Issue #27186: Introduce os.PathLike and os.fspath() (part of PEP 519). - -- A new version of typing.py provides several new classes and - features: @overload outside stubs, Reversible, DefaultDict, Text, - ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug - fixes (note that some of the new features are not yet implemented in - mypy or other static analyzers). Also classes for PEP 492 - (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact - they made it into 3.5.1 but were never mentioned). - -- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from - sending a message body for 205 Reset Content. Also, don't send Content - header fields in responses that don't have a body. Patch by Susumu - Koshiba. - -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. - -- [Security] Issue #26839: On Linux, :func:`os.urandom` now calls - ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading - ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch - written by Colm Buckley. - -- Issue #23883: Added missing APIs to __all__ to match the documented APIs - for the following modules: cgi, mailbox, mimetypes, plistlib and smtpd. - Patches by Jacek Ko?odziej. - -- Issue #27164: In the zlib module, allow decompressing raw Deflate streams - with a predefined zdict. Based on patch by Xiang Zhang. - -- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely - write data to the client. Previously it could do partial writes and - truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout - doing partial writes, but this is deprecated. - -- Issue #21272: Use _sysconfigdata.py to initialize distutils.sysconfig. - -- Issue #19611: :mod:`inspect` now reports the implicit ``.0`` parameters - generated by the compiler for comprehension and generator expression scopes - as if they were positional-only parameters called ``implicit0``. - Patch by Jelle Zijlstra. - -- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - -- Issue #26373: subprocess.Popen.communicate now correctly ignores - BrokenPipeError when the child process dies before .communicate() - is called in more/all circumstances. - -- signal, socket, and ssl module IntEnum constant name lookups now return a - consistent name for values having multiple names. Ex: signal.Signals(6) - now refers to itself as signal.SIGALRM rather than flipping between that - and signal.SIGIOT based on the interpreter's hash randomization seed. - -- Issue #27167: Clarify the subprocess.CalledProcessError error message text - when the child process died due to a signal. - -- Issue #25931: Don't define socketserver.Forking* names on platforms such - as Windows that do not support os.fork(). - -- Issue #21776: distutils.upload now correctly handles HTTPError. - Initial patch by Claudiu Popa. - -- Issue #26526: Replace custom parse tree validation in the parser - module with a simple DFA validator. - -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with - PermissionError - -- Issue #18383: Avoid creating duplicate filters when using filterwarnings - and simplefilter. Based on patch by Alex Shkop. - -- Issue #23026: winreg.QueryValueEx() now return an integer for REG_QWORD type. - -- Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning - if the child process is still running. - -- Issue #27056: Optimize pickle.load() and pickle.loads(), up to 10% faster - to deserialize a lot of small objects. - -- Issue #21271: New keyword only parameters in reset_mock call. - -IDLE ----- - -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. - -- Issue #24750: Switch all scrollbars in IDLE to ttk versions. - Where needed, minimal tests are added to cover changes. - -- Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. - Delete now unneeded tk version tests and code for older versions. - Add test for IDLE syntax colorizoer. - -- Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. - -- Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. - -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. - -- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. - These persisted after other warnings were suppressed in #20567. - Apply Serhiy Storchaka's update_idletasks solution to four test files. - Record this additional advice in idle_test/README.txt - -- Issue #20567: Revise idle_test/README.txt with advice about avoiding - tk warning messages from tests. Apply advice to several IDLE tests. - -- Issue #24225: Update idlelib/README.txt with new file names - and event handlers. - -- Issue #27156: Remove obsolete code not used by IDLE. Replacements: - 1. help.txt, replaced by help.html, is out-of-date and should not be used. - Its dedicated viewer has be replaced by the html viewer in help.py. - 2. ``import idlever; I = idlever.IDLE_VERSION`` is the same as - ``import sys; I = version[:version.index(' ')]`` - 3. After ``ob = stackviewer.VariablesTreeItem(*args)``, - ``ob.keys() == list(ob.object.keys)``. - 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk - -- Issue #27117: Make colorizer htest and turtledemo work with dark themes. - Move code for configuring text widget colors to a new function. - -- Issue #24225: Rename many `idlelib/*.py` and `idle_test/test_*.py` files. - Edit files to replace old names with new names when the old name - referred to the module rather than the class it contained. - See the issue and IDLE section in What's New in 3.6 for more. - -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. - -- Issue #21939: Add test for IDLE's percolator. - Original patch by Saimadhav Heblikar. - -- Issue #21676: Add test for IDLE's replace dialog. - Original patch by Saimadhav Heblikar. - -- Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. - -- Issue #21703: Add test for undo delegator. Patch mostly by - Saimadhav Heblikar . - -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. - -- Issue #23977: Add more asserts to test_delegator. - -Documentation -------------- - -- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the - resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik - Nadikuditi. - -- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - -- Issue #22558: Add remaining doc links to source code for Python-coded modules. - Patch by Yoni Lavi. - -Tests ------ - -- Issue #25285: regrtest now uses subprocesses when the -j1 command line option - is used: each test file runs in a fresh child process. Before, the -j1 option - was ignored. - -- Issue #25285: Tools/buildbot/test.bat script now uses -j1 by default to run - each test file in fresh child process. - -Windows -------- - -- Issue #27064: The py.exe launcher now defaults to Python 3. - The Windows launcher ``py.exe`` no longer prefers an installed - Python 2 version over Python 3 by default when used interactively. - -Build ------ - -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. - -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. - -Misc ----- - -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. - -C API ------ - -- Issue #27186: Add the PyOS_FSPath() function (part of PEP 519). - -- Issue #26282: PyArg_ParseTupleAndKeywords() now supports positional-only - parameters. - -Tools/Demos ------------ - -- Issue #26282: Argument Clinic now supports positional-only and keyword - parameters in the same function. - - -What's New in Python 3.6.0 alpha 1? -=================================== - -Release date: 2016-05-16 - -Core and Builtins ------------------ - -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. - -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" - format unit. - -- Issue #26991: Fix possible refleak when creating a function with annotations. - -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Based on - patch by Joe Jevnik. - -- Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. - -- Issue #27005: Optimized the float.fromhex() class method for exact float. - It is now 2 times faster. - -- Issue #18531: Single var-keyword argument of dict subtype was passed - unscathed to the C-defined function. Now it is converted to exact dict. - -- Issue #26811: gc.get_objects() no longer contains a broken tuple with NULL - pointer. - -- Issue #20120: Use RawConfigParser for .pypirc parsing, - removing support for interpolation unintentionally added - with move to Python 3. Behavior no longer does any - interpolation in .pypirc files, matching behavior in Python - 2.7 and Setuptools 19.0. - -- Issue #26249: Memory functions of the :c:func:`PyMem_Malloc` domain - (:c:data:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc allocator ` - rather than system :c:func:`malloc`. Applications calling - :c:func:`PyMem_Malloc` without holding the GIL can now crash: use - ``PYTHONMALLOC=debug`` environment variable to validate the usage of memory - allocators in your application. - -- Issue #26802: Optimize function calls only using unpacking like - ``func(*tuple)`` (no other positional argument, no keyword): avoid copying - the tuple. Patch written by Joe Jevnik. - -- Issue #26659: Make the builtin slice type support cycle collection. - -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. - NOTE: A direct call of super.__init__ is not endorsed! - -- Issue #27138: Fix the doc comment for FileFinder.find_spec(). - -- Issue #27147: Mention PEP 420 in the importlib docs. - -- Issue #25339: PYTHONIOENCODING now has priority over locale in setting the - error handler for stdin and stdout. - -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of str, bytes, - bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding - views and os.scandir() iterator. - -- Issue #26574: Optimize ``bytes.replace(b'', b'.')`` and - ``bytearray.replace(b'', b'.')``. Patch written by Josh Snider. - -- Issue #26581: If coding cookie is specified multiple times on a line in - Python source code file, only the first one is taken to account. - -- Issue #19711: Add tests for reloading namespace packages. - -- Issue #21099: Switch applicable importlib tests to use PEP 451 API. - -- Issue #26563: Debug hooks on Python memory allocators now raise a fatal - error if functions of the :c:func:`PyMem_Malloc` family are called without - holding the GIL. - -- Issue #26564: On error, the debug hooks on Python memory allocators now use - the :mod:`tracemalloc` module to get the traceback where a memory block was - allocated. - -- Issue #26558: The debug hooks on Python memory allocator - :c:func:`PyObject_Malloc` now detect when functions are called without - holding the GIL. - -- Issue #26516: Add :envvar:`PYTHONMALLOC` environment variable to set the - Python memory allocators and/or install debug hooks. - -- Issue #26516: The :c:func:`PyMem_SetupDebugHooks` function can now also be - used on Python compiled in release mode. - -- Issue #26516: The :envvar:`PYTHONMALLOCSTATS` environment variable can now - also be used on Python compiled in release mode. It now has no effect if - set to an empty string. - -- Issue #26516: In debug mode, debug hooks are now also installed on Python - memory allocators when Python is configured without pymalloc. - -- Issue #26464: Fix str.translate() when string is ASCII and first replacements - removes character, but next replacement uses a non-ASCII character or a - string longer than 1 character. Regression introduced in Python 3.5.0. - -- Issue #22836: Ensure exception reports from PyErr_Display() and - PyErr_WriteUnraisable() are sensible even when formatting them produces - secondary errors. This affects the reports produced by - sys.__excepthook__() and when __del__() raises an exception. - -- Issue #26302: Correct behavior to reject comma as a legal character for - cookie names. - -- Issue #26136: Upgrade the warning when a generator raises StopIteration - from PendingDeprecationWarning to DeprecationWarning. Patch by Anish - Shah. - -- Issue #26204: The compiler now ignores all constant statements: bytes, str, - int, float, complex, name constants (None, False, True), Ellipsis - and ast.Constant; not only str and int. For example, ``1.0`` is now ignored - in ``def f(): 1.0``. - -- Issue #4806: Avoid masking the original TypeError exception when using star - (``*``) unpacking in function calls. Based on patch by Hagen F?rstenau and - Daniel Urban. - -- Issue #26146: Add a new kind of AST node: ``ast.Constant``. It can be used - by external AST optimizers, but the compiler does not emit directly such - node. - -- Issue #23601: Sped-up allocation of dict key objects by using Python's - small object allocator. (Contributed by Julian Taylor.) - -- Issue #18018: Import raises ImportError instead of SystemError if a relative - import is attempted without a known parent package. - -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and ``1.0`` - are equal. - -- Issue #26107: The format of the ``co_lnotab`` attribute of code objects - changes to support negative line number delta. - -- Issue #26154: Add a new private _PyThreadState_UncheckedGet() function to get - the current Python thread state, but don't issue a fatal error if it is NULL. - This new function must be used instead of accessing directly the - _PyThreadState_Current variable. The variable is no more exposed since - Python 3.5.1 to hide the exact implementation of atomic C types, to avoid - compiler issues. - -- Issue #25791: If __package__ != __spec__.parent or if neither __package__ or - __spec__ are defined then ImportWarning is raised. - -- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in - _PyObject_GetState() due to regressions observed in Cython-based projects. - -- Issue #25961: Disallowed null characters in the type name. - -- Issue #25973: Fix segfault when an invalid nonlocal statement binds a name - starting with two underscores. - -- Issue #22995: Instances of extension types with a state that aren't - subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. - -- Issue #20440: Massive replacing unsafe attribute setting code with special - macro Py_SETREF. - -- Issue #25766: Special method __bytes__() now works in str subclasses. - -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. - This allows sys.getsize() to work correctly with their subclasses with - __slots__ defined. - -- Issue #25709: Fixed problem with in-place string concatenation and utf-8 - cache. - -- Issue #5319: New Py_FinalizeEx() API allowing Python to set an exit status - of 120 on failure to flush buffered streams. - -- Issue #25485: telnetlib.Telnet is now a context manager. - -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside - __getattr__. - -- Issue #24731: Fixed crash on converting objects with special methods - __bytes__, __trunc__, and __float__ returning instances of subclasses of - bytes, int, and float to subclasses of bytes, int, and float correspondingly. - -- Issue #25630: Fix a possible segfault during argument parsing in functions - that accept filesystem paths. - -- Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess - internals regarding how fds_to_pass were passed to the child. The bug had - no actual impact as subprocess.py already avoided it. - -- Issue #25388: Fixed tokenizer crash when processing undecodable source code - with a null byte. - -- Issue #25462: The hash of the key now is calculated only once in most - operations in C implementation of OrderedDict. - -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now - rejects builtin types with not defined __new__. - -- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() - and eval() are passed bytes-like objects. These objects are not - necessarily terminated by a null byte, but the functions assumed they were. - -- Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node - when compiling AST from Python objects. - -- Issue #24726: Fixed a crash and leaking NULL in repr() of OrderedDict that - was mutated by direct calls of dict methods. - -- Issue #25449: Iterating OrderedDict with keys with unstable hash now raises - KeyError in C implementations as well as in Python implementation. - -- Issue #25395: Fixed crash when highly nested OrderedDict structures were - garbage collected. - -- Issue #25401: Optimize bytes.fromhex() and bytearray.fromhex(): they are now - between 2x and 3.5x faster. - -- Issue #25399: Optimize bytearray % args using the new private _PyBytesWriter - API. Formatting is now between 2.5 and 5 times faster. - -- Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new - recursion limit is too low depending at the current recursion depth. Modify - also the "lower-water mark" formula to make it monotonic. This mark is used - to decide when the overflowed flag of the thread state is reset. - -- Issue #24402: Fix input() to prompt to the redirected stdout when - sys.stdout.fileno() fails. - -- Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API. - Formatting is now up to 2 times faster. - -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. - -- Issue #25301: The UTF-8 decoder is now up to 15 times as fast for error - handlers: ``ignore``, ``replace`` and ``surrogateescape``. - -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. - -- Issue #25267: The UTF-8 encoder is now up to 75 times as fast for error - handlers: ``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``. - Patch co-written with Serhiy Storchaka. - -- Issue #25280: Import trace messages emitted in verbose (-v) mode are no - longer formatted twice. - -- Issue #25227: Optimize ASCII and latin1 encoders with the ``surrogateescape`` - error handler: the encoders are now up to 3 times as fast. Initial patch - written by Serhiy Storchaka. - -- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the - getrandom() function instead of the getentropy() function. The getentropy() - function is blocking to generate very good quality entropy, os.urandom() - doesn't need such high-quality entropy. - -- Issue #9232: Modify Python's grammar to allow trailing commas in the - argument list of a function declaration. For example, "def f(\*, a = - 3,): pass" is now legal. Patch from Mark Dickinson. - -- Issue #24965: Implement PEP 498 "Literal String Interpolation". This - allows you to embed expressions inside f-strings, which are - converted to normal strings at run time. Given x=3, then - f'value={x}' == 'value=3'. Patch by Eric V. Smith. - -- Issue #26478: Fix semantic bugs when using binary operators with dictionary - views and tuples. - -- Issue #26171: Fix possible integer overflow and heap corruption in - zipimporter.get_data(). - -- Issue #25660: Fix TAB key behaviour in REPL with readline. - -- Issue #26288: Optimize PyLong_AsDouble. - -- Issues #26289 and #26315: Optimize floor and modulo division for - single-digit longs. Microbenchmarks show 2-2.5x improvement. Built-in - 'divmod' function is now also ~10% faster. - -- Issue #25887: Raise a RuntimeError when a coroutine object is awaited - more than once. - -Library -------- - -- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by - SELinux and fails with EACCESS. The function now falls back to fcntl(). - Patch written by Micha? Bednarski. - -- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! - -- Issue #27031: Removed dummy methods in Tkinter widget classes: tk_menuBar() - and tk_bindForTraversal(). - -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Original fix by J?n Janech. - -- Issue #17214: The "urllib.request" module now percent-encodes non-ASCII - bytes found in redirect target URLs. Some servers send Location header - fields with non-ASCII bytes, but "http.client" requires the request target - to be ASCII-encodable, otherwise a UnicodeEncodeError is raised. Based on - patch by Christian Heimes. - -- Issue #27033: The default value of the decode_data parameter for - smtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to False. - -- Issue #27034: Removed deprecated class asynchat.fifo. - -- Issue #26870: Added readline.set_auto_history(), which can stop entries - being automatically added to the history list. Based on patch by Tyler - Crompton. - -- Issue #26039: zipfile.ZipFile.open() can now be used to write data into a ZIP - file, as well as for extracting data. Patch by Thomas Kluyver. - -- Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch - contributed by Chi Hsuan Yen. - -- Issue #22274: In the subprocess module, allow stderr to be redirected to - stdout even when stdout is not redirected. Patch by Akira Li. - -- Issue #26807: mock_open 'files' no longer error on readline at end of file. - Patch from Yolanda Robla. - -- Issue #25745: Fixed leaking a userptr in curses panel destructor. - -- Issue #26977: Removed unnecessary, and ignored, call to sum of squares helper - in statistics.pvariance. - -- Issue #26002: Use bisect in statistics.median instead of a linear search. - Patch by Upendra Kuma. - -- Issue #25974: Make use of new Decimal.as_integer_ratio() method in statistics - module. Patch by Stefan Krah. - -- Issue #26996: Add secrets module as described in PEP 506. - -- Issue #26881: The modulefinder module now supports extended opcode arguments. - -- Issue #23815: Fixed crashes related to directly created instances of types in - _tkinter and curses.panel modules. - -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. - Patch by Georg Brandl. - -- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags - instead of silently return incorrect result. - -- Issue #26915: The __contains__ methods in the collections ABCs now check - for identity before checking equality. This better matches the behavior - of the concrete classes, allows sensible handling of NaNs, and makes it - easier to reason about container invariants. - -- Issue #26711: Fixed the comparison of plistlib.Data with other types. - -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. - -- Issue #26864: In urllib.request, change the proxy bypass host checking - against no_proxy to be case-insensitive, and to not match unrelated host - names that happen to have a bypassed hostname as a suffix. Patch by Xiang - Zhang. - -- Issue #24902: Print server URL on http.server startup. Initial patch by - Felix Kaiser. - -- Issue #25788: fileinput.hook_encoded() now supports an "errors" argument - for passing to open. Original patch by Joseph Hackman. - -- Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by - Xiang Zhang. - -- Issue #26804: urllib.request will prefer lower_case proxy environment - variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter - Jansen. - -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items (like bytes in the -b mode). This affects assertListEqual() - and assertTupleEqual(). - -- Issue #26041: Remove "will be removed in Python 3.7" from deprecation - messages of platform.dist() and platform.linux_distribution(). - Patch by Kumaripaba Miyurusara Athukorala. - -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer - silently ignore keyword arguments. - -- Issue #26733: Disassembling a class now disassembles class and static methods. - Patch by Xiang Zhang. - -- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch - :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel - Barry. - -- Issue #24838: tarfile's ustar and gnu formats now correctly calculate name - and link field limits for multibyte character encodings like utf-8. - -- [Security] Issue #26657: Fix directory traversal vulnerability with - http.server on Windows. This fixes a regression that was introduced in - 3.3.4rc1 and 3.4.0rc1. Based on patch by Philipp Hagemeister. - -- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by - Anthony Sottile. - -- Issue #26782: Add STARTUPINFO to subprocess.__all__ on Windows. - -- Issue #26404: Add context manager to socketserver. Patch by Aviv Palivoda. - -- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading - more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of - 1024 bytes per call. - -- Issue #26585: Eliminate http.server._quote_html() and use - html.escape(quote=False). Patch by Xiang Zhang. - -- Issue #26685: Raise OSError if closing a socket fails. - -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. - -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. - -- Issue #26587: the site module now allows .pth files to specify files to be - added to sys.path (e.g. zip files). - -- Issue #25609: Introduce contextlib.AbstractContextManager and - typing.ContextManager. - -- Issue #26709: Fixed Y2038 problem in loading binary PLists. - -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our - own SIGWINCH handler. Patch by Eric Price. - -- Issue #25951: Change SSLSocket.sendall() to return None, as explicitly - documented for plain socket objects. Patch by Aviv Palivoda. - -- Issue #26586: In http.server, respond with "413 Request header fields too - large" if there are too many header fields to parse, rather than killing - the connection and raising an unhandled exception. Patch by Xiang Zhang. - -- Issue #26676: Added missing XMLPullParser to ElementTree.__all__. - -- Issue #22854: Change BufferedReader.writable() and - BufferedWriter.readable() to always return False. - -- Issue #26492: Exhausted iterator of array.array now conforms with the behavior - of iterators of other mutable sequences: it lefts exhausted even if iterated - array is extended. - -- Issue #26641: doctest.DocFileTest and doctest.testfile() now support - packages (module splitted into multiple directories) for the package - parameter. - -- Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of - tuple (changeset 3603bae63c13 only works for classes) so we need to - implement __ne__ ourselves. Patch by Andrew Plummer. - -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). - -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes - instead of up to 1024. - -- Issue #26616: Fixed a bug in datetime.astimezone() method. - -- Issue #26637: The :mod:`importlib` module now emits an :exc:`ImportError` - rather than a :exc:`TypeError` if :func:`__import__` is tried during the - Python shutdown process but :data:`sys.path` is already cleared (set to - ``None``). - -- Issue #21925: :func:`warnings.formatwarning` now catches exceptions when - calling :func:`linecache.getline` and - :func:`tracemalloc.get_object_traceback` to be able to log - :exc:`ResourceWarning` emitted late during the Python shutdown process. - -- Issue #23848: On Windows, faulthandler.enable() now also installs an - exception handler to dump the traceback of all Python threads on any Windows - exception, not only on UNIX signals (SIGSEGV, SIGFPE, SIGABRT). - -- Issue #26530: Add C functions :c:func:`_PyTraceMalloc_Track` and - :c:func:`_PyTraceMalloc_Untrack` to track memory blocks using the - :mod:`tracemalloc` module. Add :c:func:`_PyTraceMalloc_GetTraceback` to get - the traceback of an object. - -- Issue #26588: The _tracemalloc now supports tracing memory allocations of - multiple address spaces (domains). - -- Issue #24266: Ctrl+C during Readline history search now cancels the search - mode when compiled with Readline 7. - -- Issue #26590: Implement a safe finalizer for the _socket.socket type. It now - releases the GIL to close the socket. - -- Issue #18787: spwd.getspnam() now raises a PermissionError if the user - doesn't have privileges. - -- Issue #26560: Avoid potential ValueError in BaseHandler.start_response. - Initial patch by Peter Inglesby. - -- Issue #26567: Add a new function :c:func:`PyErr_ResourceWarning` function to - pass the destroyed object. Add a *source* attribute to - :class:`warnings.WarningMessage`. Add warnings._showwarnmsg() which uses - tracemalloc to get the traceback where source object was allocated. - -- [Security] Issue #26313: ssl.py _load_windows_store_certs fails if windows - cert store is empty. Patch by Baji. - -- Issue #26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` - to support importing packages. - -- Issue #26499: Account for remaining Content-Length in - HTTPResponse.readline() and read1(). Based on patch by Silent Ghost. - Also document that HTTPResponse now supports these methods. - -- Issue #25320: Handle sockets in directories unittest discovery is scanning. - Patch from Victor van den Elzen. - -- Issue #16181: cookiejar.http2time() now returns None if year is higher than - datetime.MAXYEAR. - -- Issue #26513: Fixes platform module detection of Windows Server - -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by - Tam?s Bence Gedai. - -- Issue #26323: Add Mock.assert_called() and Mock.assert_called_once() - methods to unittest.mock. Patch written by Amit Saha. - -- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise - NotImplementedError instead of ImportError. - -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. - -- Issue #15068: Got rid of excessive buffering in fileinput. - The bufsize parameter is now deprecated and ignored. - -- Issue #19475: Added an optional argument timespec to the datetime - isoformat() method to choose the precision of the time component. - -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu - Dupuy. - -- Issue #26167: Minimized overhead in copy.copy() and copy.deepcopy(). - Optimized copying and deepcopying bytearrays, NotImplemented, slices, - short lists, tuples, dicts, sets. - -- Issue #25718: Fixed pickling and copying the accumulate() iterator with - total is None. - -- Issue #26475: Fixed debugging output for regular expressions with the (?x) - flag. - -- Issue #26482: Allowed pickling recursive dequeues. - -- Issue #26335: Make mmap.write() return the number of bytes written like - other write methods. Patch by Jakub Stasiak. - -- Issue #26457: Fixed the subnets() methods in IP network classes for the case - when resulting prefix length is equal to maximal prefix length. - Based on patch by Xiang Zhang. - -- Issue #26385: Remove the file if the internal open() call in - NamedTemporaryFile() fails. Patch by Silent Ghost. - -- Issue #26402: Fix XML-RPC client to retry when the server shuts down a - persistent connection. This was a regression related to the new - http.client.RemoteDisconnected exception in 3.5.0a4. - -- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with - adobe=True. Patch by Swati Jaiswal. - -- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader. - -- Issue #26367: importlib.__import__() raises ImportError like - builtins.__import__() when ``level`` is specified but without an accompanying - package specified. - -- Issue #26309: In the "socketserver" module, shut down the request (closing - the connected socket) when verify_request() returns false. Patch by Aviv - Palivoda. - -- Issue #23430: Change the socketserver module to only catch exceptions - raised from a request handler that are derived from Exception (instead of - BaseException). Therefore SystemExit and KeyboardInterrupt no longer - trigger the handle_error() method, and will now to stop a single-threaded - server. - -- [Security] Issue #25939: On Windows open the cert store readonly in - ssl.enum_certificates. - -- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. - -- Issue #25994: Added the close() method and the support of the context manager - protocol for the os.scandir() iterator. - -- Issue #23992: multiprocessing: make MapResult not fail-fast upon exception. - -- Issue #26243: Support keyword arguments to zlib.compress(). Patch by Aviv - Palivoda. - -- Issue #26117: The os.scandir() iterator now closes file descriptor not only - when the iteration is finished, but when it was failed with error. - -- Issue #25949: __dict__ for an OrderedDict instance is now created only when - needed. - -- Issue #25911: Restored support of bytes paths in os.walk() on Windows. - -- Issue #26045: Add UTF-8 suggestion to error message when posting a - non-Latin-1 string with http.client. - -- Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir(). - Patch by Thomas Kluyver. - -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. - -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. - -- Issue #26202: copy.deepcopy() now correctly copies range() objects with - non-atomic attributes. - -- Issue #23076: Path.glob() now raises a ValueError if it's called with an - invalid pattern. Patch by Thomas Nyberg. - -- Issue #19883: Fixed possible integer overflows in zipimport. - -- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and - gethostbyname_ex() functions of the socket module now decode the hostname - from the ANSI code page rather than UTF-8. - -- Issue #26099: The site module now writes an error into stderr if - sitecustomize module can be imported but executing the module raise an - ImportError. Same change for usercustomize. - -- Issue #26147: xmlrpc now works with strings not encodable with used - non-UTF-8 encoding. - -- Issue #25935: Garbage collector now breaks reference loops with OrderedDict. - -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). - -- Issue #26013: Added compatibility with broken protocol 2 pickles created - in old Python 3 versions (3.4.3 and lower). - -- Issue #26129: Deprecated accepting non-integers in grp.getgrgid(). - -- Issue #25850: Use cross-compilation by default for 64-bit Windows. - -- Issue #25822: Add docstrings to the fields of urllib.parse results. - Patch contributed by Swati Jaiswal. - -- Issue #22642: Convert trace module option parsing mechanism to argparse. - Patch contributed by SilentGhost. - -- Issue #24705: Fix sysconfig._parse_makefile not expanding ${} vars - appearing before $() vars. - -- Issue #26069: Remove the deprecated apis in the trace module. - -- Issue #22138: Fix mock.patch behavior when patching descriptors. Restore - original values after patching. Patch contributed by Sean McCully. - -- Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode - option if it is safe to do so. - -- Issue #26012: Don't traverse into symlinks for ``**`` pattern in - pathlib.Path.[r]glob(). - -- Issue #24120: Ignore PermissionError when traversing a tree with - pathlib.Path.[r]glob(). Patch by Ulrich Petri. - -- Issue #21815: Accept ] characters in the data portion of imap responses, - in order to handle the flags with square brackets accepted and produced - by servers such as gmail. - -- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a - buffer attribute (restores backward compatibility). - -- Issue #25971: Optimized creating Fractions from floats by 2 times and from - Decimals by 3 times. - -- Issue #25802: Document as deprecated the remaining implementations of - importlib.abc.Loader.load_module(). - -- Issue #25928: Add Decimal.as_integer_ratio(). - -- Issue #25447: Copying the lru_cache() wrapper object now always works, - independently from the type of the wrapped object (by returning the original - object unchanged). - -- Issue #25768: Have the functions in compileall return booleans instead of - ints and add proper documentation and tests for the return values. - -- Issue #24103: Fixed possible use after free in ElementTree.XMLPullParser. - -- Issue #25860: os.fwalk() no longer skips remaining directories when error - occurs. Original patch by Samson Lee. - -- Issue #25914: Fixed and simplified OrderedDict.__sizeof__. - -- Issue #25869: Optimized deepcopying ElementTree; it is now 20 times faster. - -- Issue #25873: Optimized iterating ElementTree. Iterating elements - Element.iter() is now 40% faster, iterating text Element.itertext() - is now up to 2.5 times faster. - -- Issue #25902: Fixed various refcount issues in ElementTree iteration. - -- Issue #22227: The TarFile iterator is reimplemented using generator. - This implementation is simpler that using class. - -- Issue #25638: Optimized ElementTree.iterparse(); it is now 2x faster. - Optimized ElementTree parsing; it is now 10% faster. - -- Issue #25761: Improved detecting errors in broken pickle data. - -- Issue #25717: Restore the previous behaviour of tolerating most fstat() - errors when opening files. This was a regression in 3.5a1, and stopped - anonymous temporary files from working in special cases. - -- Issue #24903: Fix regression in number of arguments compileall accepts when - '-d' is specified. The check on the number of arguments has been dropped - completely as it never worked correctly anyway. - -- Issue #25764: In the subprocess module, preserve any exception caused by - fork() failure when preexec_fn is used. - -- Issue #25771: Tweak the exception message for importlib.util.resolve_name() - when 'package' isn't specified but necessary. - -- Issue #6478: _strptime's regexp cache now is reset after changing timezone - with time.tzset(). - -- Issue #14285: When executing a package with the "python -m package" option, - and package initialization fails, a proper traceback is now reported. The - "runpy" module now lets exceptions from package initialization pass back to - the caller, rather than raising ImportError. - -- Issue #19771: Also in runpy and the "-m" option, omit the irrelevant - message ". . . is a package and cannot be directly executed" if the package - could not even be initialized (e.g. due to a bad ``*.pyc`` file). - -- Issue #25177: Fixed problem with the mean of very small and very large - numbers. As a side effect, statistics.mean and statistics.variance should - be significantly faster. - -- Issue #25718: Fixed copying object with state with boolean value is false. - -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. - -- Issue #7990: dir() on ElementTree.Element now lists properties: "tag", - "text", "tail" and "attrib". Original patch by Santoso Wijaya. - -- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling - invalid data including tuple instructions. - -- Issue #25663: In the Readline completer, avoid listing duplicate global - names, and search the global namespace before searching builtins. - -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. - -- Issue #23914: Fixed SystemError raised by unpickler on broken pickle data. - -- Issue #25691: Fixed crash on deleting ElementTree.Element attributes. - -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory - entries. Patch by Dingyuan Wang. - -- Issue #25626: Change three zlib functions to accept sizes that fit in - Py_ssize_t, but internally cap those sizes to UINT_MAX. This resolves a - regression in 3.5 where GzipFile.read() failed to read chunks larger than 2 - or 4 GiB. The change affects the zlib.Decompress.decompress() max_length - parameter, the zlib.decompress() bufsize parameter, and the - zlib.Decompress.flush() length parameter. - -- Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- Issue #25593: Change semantics of EventLoop.stop() in asyncio. - -- Issue #6973: When we know a subprocess.Popen process has died, do - not allow the send_signal(), terminate(), or kill() methods to do - anything as they could potentially signal a different process. - -- Issue #23883: Added missing APIs to __all__ to match the documented APIs - for the following modules: calendar, csv, enum, fileinput, ftplib, logging, - optparse, tarfile, threading and wave. Also added a - test.support.check__all__() helper. Patches by Jacek Ko?odziej, Mauro - S. M. Rodrigues and Joel Taddei. - -- Issue #25590: In the Readline completer, only call getattr() once per - attribute. Also complete names of attributes such as properties and slots - which are listed by dir() but not yet created on an instance. - -- Issue #25498: Fix a crash when garbage-collecting ctypes objects created - by wrapping a memoryview. This was a regression made in 3.5a1. Based - on patch by Eryksun. - -- Issue #25584: Added "escape" to the __all__ list in the glob module. - -- Issue #25584: Fixed recursive glob() with patterns starting with ``**``. - -- Issue #25446: Fix regression in smtplib's AUTH LOGIN support. - -- Issue #18010: Fix the pydoc web server's module search function to handle - exceptions from importing packages. - -- Issue #25554: Got rid of circular references in regular expression parsing. - -- Issue #18973: Command-line interface of the calendar module now uses argparse - instead of optparse. - -- Issue #25510: fileinput.FileInput.readline() now returns b'' instead of '' - at the end if the FileInput was opened with binary mode. - Patch by Ryosuke Ito. - -- Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. - Original patch by John Mark Vandenberg. - -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. - -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. - -- Issue #25447: The lru_cache() wrapper objects now can be copied and pickled - (by returning the original object unchanged). - -- Issue #25390: typing: Don't crash on Union[str, Pattern]. - -- Issue #25441: asyncio: Raise error from drain() when socket is closed. - -- Issue #25410: Cleaned up and fixed minor bugs in C implementation of - OrderedDict. - -- Issue #25411: Improved Unicode support in SMTPHandler through better use of - the email package. Thanks to user simon04 for the patch. - -- Move the imp module from a PendingDeprecationWarning to DeprecationWarning. - -- Issue #25407: Remove mentions of the formatter module being removed in - Python 3.6. - -- Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() - that caused segmentation fault or hang in iterating after moving several - items to the start of ordered dict. - -- Issue #25382: pickletools.dis() now outputs implicit memo index for the - MEMOIZE opcode. - -- Issue #25357: Add an optional newline paramer to binascii.b2a_base64(). - base64.b64encode() uses it to avoid a memory copy. - -- Issue #24164: Objects that need calling ``__new__`` with keyword arguments, - can now be pickled using pickle protocols older than protocol version 4. - -- Issue #25364: zipfile now works in threads disabled builds. - -- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both - decode_data and enable_SMTPUTF8 are set to true. - -- Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate - extensions. Patch by Nikolay Bogoychev. - -- Issue #25316: distutils raises OSError instead of DistutilsPlatformError - when MSVC is not installed. - -- Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in - pickletools.opcodes. - -- Issue #23972: Updates asyncio datagram create method allowing reuseport - and reuseaddr socket options to be set prior to binding the socket. - Mirroring the existing asyncio create_server method the reuseaddr option - for datagram sockets defaults to True if the O/S is 'posix' (except if the - platform is Cygwin). Patch by Chris Laws. - -- Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you - submit a coroutine to a loop from another thread, returning a - concurrent.futures.Future. By Vincent Michel. - -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the - first question mark (?) rather than the last. Patch from Xiang Zhang. - -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. - -- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not - supported. Check if it is supported, it may not be supported on OpenBSD for - example. - -- Issue #23600: Default implementation of tzinfo.fromutc() was returning - wrong results in some cases. - -- Issue #25203: Failed readline.set_completer_delims() no longer left the - module in inconsistent state. - -- Issue #25011: rlcompleter now omits private and special attribute names unless - the prefix starts with underscores. - -- Issue #25209: rlcompleter now can add a space or a colon after completed - keyword. - -- Issue #22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'. - -- Issue #23517: fromtimestamp() and utcfromtimestamp() methods of - datetime.datetime now round microseconds to nearest with ties going to - nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding - towards -Infinity (ROUND_FLOOR). - -- Issue #23552: Timeit now warns when there is substantial (4x) variance - between best and worst times. Patch from Serhiy Storchaka. - -- Issue #24633: site-packages/README -> README.txt. - -- Issue #24879: help() and pydoc can now list named tuple fields in the - order they were defined rather than alphabetically. The ordering is - determined by the _fields attribute if present. - -- Issue #24874: Improve speed of itertools.cycle() and make its - pickle more compact. - -- Fix crash in itertools.cycle.__setstate__() when the first argument wasn't - a list. - -- Issue #20059: urllib.parse raises ValueError on all invalid ports. - Patch by Martin Panter. - -- Issue #24360: Improve __repr__ of argparse.Namespace() for invalid - identifiers. Patch by Matthias Bussonnier. - -- Issue #23426: run_setup was broken in distutils. - Patch from Alexander Belopolsky. - -- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. - -- Issue #2091: open() accepted a 'U' mode string containing '+', but 'U' can - only be used with 'r'. Patch from Jeff Balogh and John O'Connor. - -- Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence. - -- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. - Patch from Nicola Palumbo and Laurent De Buyst. - -- Issue #24426: Fast searching optimization in regular expressions now works - for patterns that starts with capturing groups. Fast searching optimization - now can't be disabled at compile time. - -- Issue #23661: unittest.mock side_effects can now be exceptions again. This - was a regression vs Python 3.4. Patch from Ignacio Rossi - -- Issue #13248: Remove deprecated inspect.getmoduleinfo function. - -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). - -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating - ssl.SSLContext. - -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). - -- Issue #25471: Sockets returned from accept() shouldn't appear to be - nonblocking. - -- Issue #25319: When threading.Event is reinitialized, the underlying condition - should use a regular lock rather than a recursive lock. - -- Skip getaddrinfo if host is already resolved. - Patch by A. Jesse Jiryu Davis. - -- Issue #26050: Add asyncio.StreamReader.readuntil() method. - Patch by ???? ?????????. - -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. - -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on - current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. - -- Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. - Patch by Jack O'Connor. - -- Issue #27040: Add loop.get_exception_handler method - -- Issue #27041: asyncio: Add loop.create_future method - -IDLE ----- - -- Issue #20640: Add tests for idlelib.configHelpSourceEdit. - Patch by Saimadhav Heblikar. - -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. - -- Issue #25507: fix incorrect change in IOBinding that prevented printing. - Augment IOBinding htest to include all major IOBinding functions. - -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. - -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. - -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the - debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. - -- Change 'The program' to 'Your program' in an IDLE 'kill program?' message - to make it clearer that the program referred to is the currently running - user program, not IDLE itself. - -- Issue #24750: Improve the appearance of the IDLE editor window status bar. - Patch by Mark Roseman. - -- Issue #25313: Change the handling of new built-in text color themes to better - address the compatibility problem introduced by the addition of IDLE Dark. - Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. - -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences - dialog rather than a separate dialog. The former tabs are now a sorted - list. Patch by Mark Roseman. - -- Issue #22726: Re-activate the config dialog help button with some content - about the other buttons and the new IDLE Dark theme. - -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. - -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. - 'IDLE' now means 'Integrated Development and Learning Environment'. - -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. - -- Issue #24972: Inactive selection background now matches active selection - background, as configured by users, on all systems. Found items are now - always highlighted on Windows. Initial patch by Mark Roseman. - -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. - -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. - -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. - -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. - -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. - -- Issue #25225: Condense and rewrite Idle doc section on text colors. - -- Issue #21995: Explain some differences between IDLE and console Python. - -- Issue #22820: Explain need for *print* when running file from Idle editor. - -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. - -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. - -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Rose Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - -Documentation -------------- - -- Issue #26736: Used HTTPS for external links in the documentation if possible. - -- Issue #6953: Rework the Readline module documentation to group related - functions together, and add more details such as what underlying Readline - functions and variables are accessed. - -- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. - -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "_thread" modules. Patch from Mattip. - -- Issue #26014: Update 3.x packaging documentation: - * "See also" links to the new docs are now provided in the legacy pages - * links to setuptools documentation have been updated - -Tests ------ - -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. - -- Issue #26295: When using "python3 -m test --testdir=TESTDIR", regrtest - doesn't add "test." prefix to test module names. - -- Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) - was untested. - -- Issue #26015: Added new tests for pickling iterators of mutable sequences. - -- Issue #26325: Added test.support.check_no_resource_warning() to check that - no ResourceWarning is emitted. - -- Issue #25940: Changed test_ssl to use its internal local server more. This - avoids relying on svn.python.org, which recently changed root certificate. - -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. - -- Issue #25449: Added tests for OrderedDict subclasses. - -- Issue #25188: Add -P/--pgo to test.regrtest to suppress error output when - running the test suite for the purposes of a PGO build. Initial patch by - Alecsandru Patrascu. - -- Issue #22806: Add ``python -m test --list-tests`` command to list tests. - -- Issue #18174: ``python -m test --huntrleaks ...`` now also checks for leak of - file descriptors. Patch written by Richard Oudkerk. - -- Issue #25260: Fix ``python -m test --coverage`` on Windows. Remove the - list of ignored directories. - -- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. - -- Issue #26583: Skip test_timestamp_overflow in test_import if bytecode - files cannot be written. - -Build ------ - -- Issue #21277: Don't try to link _ctypes with a ffi_convenience library. - -- Issue #26884: Fix linking extension modules for cross builds. - Patch by Xavier de Gaye. - -- Issue #26932: Fixed support of RTLD_* constants defined as enum values, - not via macros (in particular on Android). Patch by Chi Hsuan Yen. - -- Issue #22359: Disable the rules for running _freeze_importlib and pgen when - cross-compiling. The output of these programs is normally saved with the - source code anyway, and is still regenerated when doing a native build. - Patch by Xavier de Gaye. - -- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, - except on Mac OS X. Patch written by Chi Hsuan Yen. - -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. - -- Issue #26624: Adds validation of ucrtbase[d].dll version with warning - for old versions. - -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a - lower-level check for st_blocks in struct stat. - -- Issue #26079: Fixing the build output folder for tix-8.4.3.6. Patch by - Bjoern Thiel. - -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to - ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The - old ``PCbuild\build_pgo.bat`` script is removed. - -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. - -- Issue #25696: Fix installation of Python on UNIX with make -j9. - -- Issue #24986: It is now possible to build Python on Windows without errors - when external libraries are not available. - -- Issue #24421: Compile Modules/_math.c once, before building extensions. - Previously it could fail to compile properly if the math and cmath builds - were concurrent. - -- Issue #26465: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2g. - -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. - -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. - -- Issue #24324: Do not enable unreachable code warnings when using - gcc as the option does not work correctly in older versions of gcc - and has been silently removed as of gcc-4.5. - -Windows -------- - -- Issue #27053: Updates make_zip.py to correctly generate library ZIP file. - -- Issue #26268: Update the prepare_ssl.py script to handle OpenSSL releases - that don't include the contents of the include directory (that is, 1.0.2e - and later). - -- Issue #26071: bdist_wininst created binaries fail to start and find - 32bit Python - -- Issue #26073: Update the list of magic numbers in launcher - -- Issue #26065: Excludes venv from library when generating embeddable - distro. - -- Issue #25022: Removed very outdated PC/example_nt/ directory. - -Tools/Demos ------------ - -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas - Ilsche. - -- Issue #26271: Fix the Freeze tool to properly use flags passed through - configure. Patch by Daniel Shaulov. - -- Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py. - Patch by Guo Ci Teo. - -- Issue #26316: Fix variable name typo in Argument Clinic. - -- Issue #25440: Fix output of python-config --extension-suffix. - -- Issue #25154: The pyvenv script has been deprecated in favour of - `python3 -m venv`. - -C API ------ - -- Issue #26312: SystemError is now raised in all programming bugs with using - PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some - programming bugs. - -- Issue #26198: ValueError is now raised instead of TypeError on buffer - overflow in parsing "es#" and "et#" format units. SystemError is now raised - instead of TypeError on programmical error in parsing format string. - - -What's New in Python 3.5.3? -=========================== - -Release date: 2017-01-17 - -There were no code changes between 3.5.3rc1 and 3.5.3 final. - - -What's New in Python 3.5.3 release candidate 1? -=============================================== - -Release date: 2017-01-02 - -Core and Builtins ------------------ - -- Issue #29073: bytearray formatting no longer truncates on first null byte. - -- Issue #28932: Do not include if it does not exist. - -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. - -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. - -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate - form. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy - bug caused by a monkey-patched len() function. - -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X - when decode astral characters. Patch by Xiang Zhang. - -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. - -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug - build. - -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception - loss in PyTraceBack_Here(). - -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). - Patch by Xiang Zhang. - -- Issue #28376: The type of long range iterator is now registered as Iterator. - Patch by Oren Milman. - -- Issue #28376: The constructor of range_iterator now checks that step is not 0. - Patch by Oren Milman. - -- Issue #26906: Resolving special methods of uninitialized type now causes - implicit initialization of the type instead of a fail. - -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. - -- Issue #24098: Fixed possible crash when AST is changed in process of - compiling it. - -- Issue #28350: String constants with null character no longer interned. - -- Issue #26617: Fix crash when GC runs during weakref callbacks. - -- Issue #27942: String constants now interned recursively in tuples and frozensets. - -- Issue #21578: Fixed misleading error message when ImportError called with - invalid keyword args. - -- Issue #28203: Fix incorrect type in error message from - ``complex(1.0, {2:3})``. Patch by Soumya Sharma. - -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() - syscall fails with EPERM, for example when blocked by SECCOMP. - -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport - should use the same optimization level as the interpreter. - -- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when - Python is compiled with NSMALLPOSINTS = 0. - -- Issue #25758: Prevents zipimport from unnecessarily encoding a filename - (patch by Eryk Sun) - -- Issue #28189: dictitems_contains no longer swallows compare errors. - (Patch by Xiang Zhang) - -- Issue #27812: Properly clear out a generator's frame's backreference to the - generator to prevent crashes in frame.clear(). - -- Issue #27811: Fix a crash when a coroutine that has not been awaited is - finalized with warnings-as-errors enabled. - -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check - after use of 'def' in _PyState_AddModule(). - Initial patch by Christian Heimes. - -- Issue #26020: set literal evaluation order did not match documented behaviour. - -- Issue #27782: Multi-phase extension module import now correctly allows the - ``m_methods`` field to be used to add module level functions to instances - of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang. - -- Issue #27936: The round() function accepted a second None argument - for some types but not for others. Fixed the inconsistency by - accepting None for all numeric types. - -- Issue #27487: Warn if a submodule argument to "python -m" or - runpy.run_module() is found in sys.modules after parent packages are - imported, but before the submodule is executed. - -- Issue #27558: Fix a SystemError in the implementation of "raise" statement. - In a brand new thread, raise a RuntimeError since there is no active - exception to reraise. Patch written by Xiang Zhang. - -- Issue #27419: Standard __import__() no longer look up "__import__" in globals - or builtins for importing submodules or "from import". Fixed handling an - error of non-string package name. - -- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows. - -- Issue #27514: Make having too many statically nested blocks a SyntaxError - instead of SystemError. - -- Issue #27473: Fixed possible integer overflow in bytes and bytearray - concatenations. Patch by Xiang Zhang. - -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by - Xiang Zhang. - -- Issue #27581: Don't rely on wrapping for overflow check in - PySequence_Tuple(). Patch by Xiang Zhang. - -- Issue #27443: __length_hint__() of bytearray iterators no longer return a - negative integer for a resized bytearray. - -- Issue #27942: Fix memory leak in codeobject.c - -Library -------- - -- Issue #15812: inspect.getframeinfo() now correctly shows the first line of - a context. Patch by Sam Breese. - -- Issue #29094: Offsets in a ZIP file created with extern file object and modes - "w" and "x" now are relative to the start of the file. - -- Issue #13051: Fixed recursion errors in large or resized - curses.textpad.Textbox. Based on patch by Tycho Andersen. - -- Issue #29119: Fix weakrefs in the pure python version of - collections.OrderedDict move_to_end() method. - Contributed by Andra Bogildea. - -- Issue #9770: curses.ascii predicates now work correctly with negative - integers. - -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. - -- Issue #28923: Remove editor artifacts from Tix.py. - -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. - -- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that - doesn't own its elements as limits. - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. - -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and - from_buffer_copy() methods on abstract classes like Array. - -- Issue #28732: Fix crash in os.spawnv() with no elements in args - -- Issue #28485: Always raise ValueError for negative - compileall.compile_dir(workers=...) parameter, even when multithreading is - unavailable. - -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. - -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if - given empty data twice. Patch by Benjamin Fogle. - -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. - -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. - -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived - browsers. Based on patch by Oleg Broytman. - -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused - by representing the scale as float value internally in Tk. tkinter.IntVar - now works if float value is set to underlying Tk variable. - -- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. - -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. - Based on patch by Kaarle Ritvanen. - -- Issue #28353: os.fwalk() no longer fails on broken links. - -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. - -- Issue #28488: shutil.make_archive() no longer add entry "./" to ZIP archive. - -- Issue #24452: Make webbrowser support Chrome on Mac OS X. - -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT - handlers. - -- Issue #26293: Fixed writing ZIP files that starts not from the start of the - file. Offsets in ZIP file now are relative to the start of the archive in - conforming to the specification. - -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. - -- Issue #28322: Fixed possible crashes when unpickle itertools objects from - incorrect pickle data. Based on patch by John Leitch. - -- Fix possible integer overflows and crashes in the mmap module with unusual - usage patterns. - -- Issue #1703178: Fix the ability to pass the --link-objects option to the - distutils build_ext command. - -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. - - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date - under/overflow. - -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. - -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() - if pass invalid string-like object as a name. Patch by Xiang Zhang. - -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. - Patch by Madison May. - -- Issue #27611: Fixed support of default root window in the tkinter.tix module. - -- Issue #27348: In the traceback module, restore the formatting of exception - messages like "Exception: None". This fixes a regression introduced in - 3.5a2. - -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). - -- Issue #27932: Prevent memory leak in win32_ver(). - -- Fix UnboundLocalError in socket._sendfile_use_sendfile. - -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of - os.stat(). Patch by Eryk Sun. - -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. - -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. - -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. - -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). - -- Issue #19003:m email.generator now replaces only ``\r`` and/or ``\n`` line - endings, per the RFC, instead of all unicode line endings. - -- Issue #28019: itertools.count() no longer rounds non-integer step in range - between 1.0 and 2.0 to 1. - -- Issue #25969: Update the lib2to3 grammar to handle the unpacking - generalizations added in 3.5. - -- Issue #14977: mailcap now respects the order of the lines in the mailcap - files ("first match"), as required by RFC 1542. Patch by Michael Lazar. - -- Issue #24594: Validates persist parameter when opening MSI database - -- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes - (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.) - -- Issue #28047: Fixed calculation of line length used for the base64 CTE - in the new email policies. - -- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). - Patch by Claude Paroz. - -- Issue #22450: urllib now includes an ``Accept: */*`` header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. - -- lib2to3.pgen3.driver.load_grammar() now creates a stable cache file - between runs given the same Grammar.txt input regardless of the hash - randomization setting. - -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. - -- Issue #22233: Break email header lines *only* on the RFC specified CR and LF - characters, not on arbitrary unicode line breaks. This also fixes a bug in - HTTP header parsing. - -- Issue #27988: Fix email iter_attachments incorrect mutation of payload list. - -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name - fields in X.509 certs. - -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter - measure sweet32 attack (CVE-2016-2183). - -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. - (Required OpenSSL 1.1.0 or LibreSSL). - -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. - -- Remove support for passing a file descriptor to os.access. It never worked but - previously didn't raise. - -- Issue #12885: Fix error when distutils encounters symlink. - -- Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. - Based on patch by Xiang Zhang. - -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory - creates not a cursor. Patch by Xiang Zhang. - -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. - -- Issue #27706: Restore deterministic behavior of random.Random().seed() - for string seeds using seeding version 1. Allows sequences of calls - to random() to exactly match those obtained in Python 2. - Patch by Nofar Schnider. - -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. - -- A new version of typing.py from https://github.com/python/typing: - - Collection (only for 3.6) (Issue #27598) - - Add FrozenSet to __all__ (upstream #261) - - fix crash in _get_type_vars() (upstream #259) - - Remove the dict constraint in ForwardRef._eval_type (upstream #252) - -- Issue #27539: Fix unnormalised ``Fraction.__pow__`` result in the case - of negative exponent and negative base. - -- Issue #21718: cursor.description is now available for queries using CTEs. - -- Issue #2466: posixpath.ismount now correctly recognizes mount points which - the user does not have permission to access. - -- Issue #27773: Correct some memory management errors server_hostname in - _ssl.wrap_socket(). - -- Issue #26750: unittest.mock.create_autospec() now works properly for - subclasses of property() and other data descriptors. - -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. - -- Issue #27783: Fix possible usage of uninitialized memory in - operator.methodcaller. - -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. - -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - -- Issue #27758: Fix possible integer overflow in the _csv module for large - record lengths. - -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. - -- Issue #27656: Do not assume sched.h defines any SCHED_* constants. - -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 4 GiB) when compressing and decompressing. Previously, inputs - were limited to 4 GiB, and compression and decompression operations did not - properly handle results of 4 GiB. - -- Issue #27533: Release GIL in nt._isdir - -- Issue #17711: Fixed unpickling by the persistent ID with protocol 0. - Original patch by Alexandre Vassalotti. - -- Issue #27522: Avoid an unintentional reference cycle in email.feedparser. - -- Issue #26844: Fix error message for imp.find_module() to refer to 'path' - instead of 'name'. Patch by Lev Maximov. - -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. - -- Issue #27466: Change time format returned by http.cookie.time2netscape, - confirming the netscape cookie format and making it consistent with - documentation. - -- Issue #26664: Fix activate.fish by removing mis-use of ``$``. - -- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong - mode no longer break tracing, trace_vinfo() now always returns a list of - pairs of strings, tracing in the "u" mode now works. - -- Fix a scoping issue in importlib.util.LazyLoader which triggered an - UnboundLocalError when lazy-loading a module that was already put into - sys.modules. - -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - -- Issue #26754: Some functions (compile() etc) accepted a filename argument - encoded as an iterable of integers. Now only strings and byte-like objects - are accepted. - -- Issue #27048: Prevents distutils failing on Windows when environment - variables contain non-ASCII characters - -- Issue #27330: Fixed possible leaks in the ctypes module. - -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch - by Jelle Zijlstra. - -- Issue #27122: When an exception is raised within the context being managed - by a contextlib.ExitStack() and one of the exit stack generators - catches and raises it in a chain, do not re-raise the original exception - when exiting, let the new chained one through. This avoids the PEP 479 - bug described in issue25782. - -- [Security] Issue #27278: Fix os.urandom() implementation using getrandom() on - Linux. Truncate size to INT_MAX and loop until we collected enough random - bytes, instead of casting a directly Py_ssize_t to int. - -- Issue #26386: Fixed ttk.TreeView selection operations with item id's - containing spaces. - -- [Security] Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). - -- Issue #16182: Fix various functions in the "readline" module to use the - locale encoding, and fix get_begidx() and get_endidx() to return code point - indexes. - -- Issue #27392: Add loop.connect_accepted_socket(). - Patch by Jim Fulton. - -- Issue #27930: Improved behaviour of logging.handlers.QueueListener. - Thanks to Paulo Andrade and Petr Viktorin for the analysis and patch. - -- Issue #21201: Improves readability of multiprocessing error message. Thanks - to Wojciech Walczak for patch. - -- Issue #27456: asyncio: Set TCP_NODELAY by default. - -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. - -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. - -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. - -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. - -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. - -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. - Patch by Mark Williams. - -- Issue #28368: Refuse monitoring processes if the child watcher has - no loop attached. - Patch by Vincent Michel. - -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. - -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by ????????? ????. - -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. - -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. - -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by ????????? ????. - -- Issue #27972: Prohibit Tasks to await on themselves. - -- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all - children are done. - Patch by Johannes Ebke. - -- Issue #26796: Don't configure the number of workers for default - threadpool executor. - Initial patch by Hans Lawrenz. - -- Issue #28600: Optimize loop.call_soon(). - -- Issue #28613: Fix get_event_loop() return the current loop if - called from coroutines/callbacks. - -- Issue #28639: Fix inspect.isawaitable to always return bool - Patch by Justin Mayfield. - -- Issue #28652: Make loop methods reject socket kinds they do not support. - -- Issue #28653: Fix a refleak in functools.lru_cache. - -- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. - -- Issue #24142: Reading a corrupt config file left the parser in an - invalid state. Original patch by Florian H?ch. - -- Issue #28990: Fix SSL hanging if connection is closed before handshake - completed. - (Patch by HoHo-Ho) - -IDLE ----- - -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. - -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - -- Add version to title of IDLE help window. - -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. - -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. - -- Issue #25507: IDLE no longer runs buggy code because of its tkinter imports. - Users must include the same imports required to run directly in Python. - -- Issue #27452: add line counter and crc to IDLE configHandler test dump. - -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. - -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. - Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. - -C API ------ - -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - -- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as - an iterable of integers. Now only strings and bytes-like objects are accepted. - -Documentation -------------- - -- Issue #28513: Documented command-line interface of zipfile. - -Tests ------ - -- Issue #28950: Disallow -j0 to be combined with -T/-l/-M in regrtest - command line arguments. - -- Issue #28666: Now test.support.rmtree is able to remove unwritable or - unreadable directories. - -- Issue #23839: Various caches now are cleared before running every test file. - -- Issue #28409: regrtest: fix the parser of command line arguments. - -- Issue #27787: Call gc.collect() before checking each test for "dangling - threads", since the dangling threads are weak references. - -- Issue #27369: In test_pyexpat, avoid testing an error message detail that - changed in Expat 2.2.0. - -Tools/Demos ------------ - -- Issue #27952: Get Tools/scripts/fixcid.py working with Python 3 and the - current "re" module, avoid invalid Python backslash escapes, and fix a bug - parsing escaped C quote signs. - -- Issue #27332: Fixed the type of the first argument of module-level functions - generated by Argument Clinic. Patch by Petr Viktorin. - -- Issue #27418: Fixed Tools/importbench/importbench.py. - -Windows -------- - -- Issue #28251: Improvements to help manuals on Windows. - -- Issue #28110: launcher.msi has different product codes between 32-bit and - 64-bit - -- Issue #25144: Ensures TargetDir is set before continuing with custom - install. - -- Issue #27469: Adds a shell extension to the launcher so that drag and drop - works correctly. - -- Issue #27309: Enabled proper Windows styles in python[w].exe manifest. - -Build ------ - -- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - -- Issue #23903: Added missed names to PC/python3.def. - -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and - Michael Haubenwallner. - -- Issue #26359: Rename --with-optimiations to --enable-optimizations. - -- Issue #28444: Fix missing extensions modules when cross compiling. - -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. - -- Issue #28258: Fixed build with Estonian locale (python-config and distclean - targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. - -- Issue #28066: Fix the logic that searches build directories for generated - include files when building outside the source tree. - -- Issue #15819: Remove redundant include search directory option for building - outside the source tree. - -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) - -- Issue #27705: Update message in validate_ucrtbase.py - -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. - -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. - -- Issue #26359: Add the --with-optimizations configure flag. - -- Issue #27713: Suppress spurious build warnings when updating importlib's - bootstrap files. Patch by Xiang Zhang - -- Issue #25825: Correct the references to Modules/python.exp and ld_so_aix, - which are required on AIX. This updates references to an installation path - that was changed in 3.2a4, and undoes changed references to the build tree - that were made in 3.5.0a1. - -- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Chi Hsuan Yen. - -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen and _freeze_importlib executables from being cross- - compiled. - -- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be - used for file generation during the build. - -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. - -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. - Patch by Gareth Rees. - - -What's New in Python 3.5.2? -=========================== - -Release date: 2016-06-26 - -Core and Builtins ------------------ - -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. - -Tests ------ - -- Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. - -IDLE ----- - -- Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. - - -What's New in Python 3.5.2 release candidate 1? -=============================================== - -Release date: 2016-06-12 - -Core and Builtins ------------------ - -- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a - negative number without setting an exception. - -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. - -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" - format unit. - -- Issue #26991: Fix possible refleak when creating a function with annotations. - -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by - Joe Jevnik. - -- Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. - -- Issue #26811: gc.get_objects() no longer contains a broken tuple with NULL - pointer. - -- Issue #20120: Use RawConfigParser for .pypirc parsing, - removing support for interpolation unintentionally added - with move to Python 3. Behavior no longer does any - interpolation in .pypirc files, matching behavior in Python - 2.7 and Setuptools 19.0. - -- Issue #26659: Make the builtin slice type support cycle collection. - -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. - NOTE: A direct call of super.__init__ is not endorsed! - -- Issue #25339: PYTHONIOENCODING now has priority over locale in setting the - error handler for stdin and stdout. - -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of str, bytes, - bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding - views and os.scandir() iterator. - -- Issue #26581: If coding cookie is specified multiple times on a line in - Python source code file, only the first one is taken to account. - -- Issue #26464: Fix str.translate() when string is ASCII and first replacements - removes character, but next replacement uses a non-ASCII character or a - string longer than 1 character. Regression introduced in Python 3.5.0. - -- Issue #22836: Ensure exception reports from PyErr_Display() and - PyErr_WriteUnraisable() are sensible even when formatting them produces - secondary errors. This affects the reports produced by - sys.__excepthook__() and when __del__() raises an exception. - -- Issue #26302: Correct behavior to reject comma as a legal character for - cookie names. - -- Issue #4806: Avoid masking the original TypeError exception when using star - (``*``) unpacking in function calls. Based on patch by Hagen F?rstenau and - Daniel Urban. - -- Issue #27138: Fix the doc comment for FileFinder.find_spec(). - -- Issue #26154: Add a new private _PyThreadState_UncheckedGet() function to get - the current Python thread state, but don't issue a fatal error if it is NULL. - This new function must be used instead of accessing directly the - _PyThreadState_Current variable. The variable is no more exposed since - Python 3.5.1 to hide the exact implementation of atomic C types, to avoid - compiler issues. - -- Issue #26194: Deque.insert() gave odd results for bounded deques that had - reached their maximum size. Now an IndexError will be raised when attempting - to insert into a full deque. - -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` - are equal. - -- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in - _PyObject_GetState() due to regressions observed in Cython-based projects. - -- Issue #25961: Disallowed null characters in the type name. - -- Issue #25973: Fix segfault when an invalid nonlocal statement binds a name - starting with two underscores. - -- Issue #22995: Instances of extension types with a state that aren't - subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. - -- Issue #20440: Massive replacing unsafe attribute setting code with special - macro Py_SETREF. - -- Issue #25766: Special method __bytes__() now works in str subclasses. - -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. - This allows sys.getsize() to work correctly with their subclasses with - __slots__ defined. - -- Issue #25709: Fixed problem with in-place string concatenation and utf-8 - cache. - -- Issue #27147: Mention PEP 420 in the importlib docs. - -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside - __getattr__. - -- Issue #24731: Fixed crash on converting objects with special methods - __bytes__, __trunc__, and __float__ returning instances of subclasses of - bytes, int, and float to subclasses of bytes, int, and float correspondingly. - -- Issue #26478: Fix semantic bugs when using binary operators with dictionary - views and tuples. - -- Issue #26171: Fix possible integer overflow and heap corruption in - zipimporter.get_data(). - -- Issue #25660: Fix TAB key behaviour in REPL with readline. - -- Issue #25887: Raise a RuntimeError when a coroutine object is awaited - more than once. - -- Issue #27243: Update the __aiter__ protocol: instead of returning - an awaitable that resolves to an asynchronous iterator, the asynchronous - iterator should be returned directly. Doing the former will trigger a - PendingDeprecationWarning. - - -Library -------- - -- [Security] Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - -- [Security] Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. - Reported by Team Oststrom - -- Issue #21386: Implement missing IPv4Address.is_global property. It was - documented since 07a5610bae9d. Initial patch by Roger Luethi. - -- Issue #20900: distutils register command now decodes HTTP responses - correctly. Initial patch by ingrid. - -- A new version of typing.py provides several new classes and - features: @overload outside stubs, Reversible, DefaultDict, Text, - ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug - fixes (note that some of the new features are not yet implemented in - mypy or other static analyzers). Also classes for PEP 492 - (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact - they made it into 3.5.1 but were never mentioned). - -- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from - sending a message body for 205 Reset Content. Also, don't send Content - header fields in responses that don't have a body. Patch by Susumu - Koshiba. - -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. - -- [Security] Issue #26839: On Linux, :func:`os.urandom` now calls - ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading - ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch - written by Colm Buckley. - -- Issue #27164: In the zlib module, allow decompressing raw Deflate streams - with a predefined zdict. Based on patch by Xiang Zhang. - -- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely - write data to the client. Previously it could do partial writes and - truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout - doing partial writes, but this is deprecated. - -- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - -- Issue #26373: subprocess.Popen.communicate now correctly ignores - BrokenPipeError when the child process dies before .communicate() - is called in more/all circumstances. - -- Issue #21776: distutils.upload now correctly handles HTTPError. - Initial patch by Claudiu Popa. - -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with - PermissionError - -- Issue #18383: Avoid creating duplicate filters when using filterwarnings - and simplefilter. Based on patch by Alex Shkop. - -- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by - SELinux and fails with EACCESS. The function now falls back to fcntl(). - Patch written by Micha? Bednarski. - -- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! - -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Original fix by J?n Janech. - -- Issue #17214: The "urllib.request" module now percent-encodes non-ASCII - bytes found in redirect target URLs. Some servers send Location header - fields with non-ASCII bytes, but "http.client" requires the request target - to be ASCII-encodable, otherwise a UnicodeEncodeError is raised. Based on - patch by Christian Heimes. - -- Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch - contributed by Chi Hsuan Yen. - -- Issue #22274: In the subprocess module, allow stderr to be redirected to - stdout even when stdout is not redirected. Patch by Akira Li. - -- Issue #26807: mock_open 'files' no longer error on readline at end of file. - Patch from Yolanda Robla. - -- Issue #25745: Fixed leaking a userptr in curses panel destructor. - -- Issue #26977: Removed unnecessary, and ignored, call to sum of squares helper - in statistics.pvariance. - -- Issue #26881: The modulefinder module now supports extended opcode arguments. - -- Issue #23815: Fixed crashes related to directly created instances of types in - _tkinter and curses.panel modules. - -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. - Patch by Georg Brandl. - -- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags - instead of silently return incorrect result. - -- Issue #26711: Fixed the comparison of plistlib.Data with other types. - -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. - - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. - -- Issue #26864: In urllib.request, change the proxy bypass host checking - against no_proxy to be case-insensitive, and to not match unrelated host - names that happen to have a bypassed hostname as a suffix. Patch by Xiang - Zhang. - -- Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by - Xiang Zhang. - -- Issue #26804: urllib.request will prefer lower_case proxy environment - variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter - Jansen. - -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items (like bytes in the -b mode). This affects assertListEqual() - and assertTupleEqual(). - -- Issue #26041: Remove "will be removed in Python 3.7" from deprecation - messages of platform.dist() and platform.linux_distribution(). - Patch by Kumaripaba Miyurusara Athukorala. - -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer - silently ignore keyword arguments. - -- Issue #26733: Disassembling a class now disassembles class and static methods. - Patch by Xiang Zhang. - -- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch - :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel - Barry. - -- Issue #24838: tarfile's ustar and gnu formats now correctly calculate name - and link field limits for multibyte character encodings like utf-8. - -- [Security] Issue #26657: Fix directory traversal vulnerability with - http.server on Windows. This fixes a regression that was introduced in - 3.3.4rc1 and 3.4.0rc1. Based on patch by Philipp Hagemeister. - -- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by - Anthony Sottile. - -- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading - more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of - 1024 bytes per call. - -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. - -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. - -- Issue #26709: Fixed Y2038 problem in loading binary PLists. - -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our - own SIGWINCH handler. Patch by Eric Price. - -- Issue #26586: In http.server, respond with "413 Request header fields too - large" if there are too many header fields to parse, rather than killing - the connection and raising an unhandled exception. Patch by Xiang Zhang. - -- Issue #22854: Change BufferedReader.writable() and - BufferedWriter.readable() to always return False. - -- Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of - tuple (changeset 3603bae63c13 only works for classes) so we need to - implement __ne__ ourselves. Patch by Andrew Plummer. - -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). - -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes - instead of up to 1024. - -- Issue #26616: Fixed a bug in datetime.astimezone() method. - -- Issue #21925: :func:`warnings.formatwarning` now catches exceptions on - ``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` emitted - late during the Python shutdown process. - -- Issue #24266: Ctrl+C during Readline history search now cancels the search - mode when compiled with Readline 7. - -- Issue #26560: Avoid potential ValueError in BaseHandler.start_response. - Initial patch by Peter Inglesby. - -- [Security] Issue #26313: ssl.py _load_windows_store_certs fails if windows - cert store is empty. Patch by Baji. - -- Issue #26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` - to support importing packages. - -- Issue #26499: Account for remaining Content-Length in - HTTPResponse.readline() and read1(). Based on patch by Silent Ghost. - Also document that HTTPResponse now supports these methods. - -- Issue #25320: Handle sockets in directories unittest discovery is scanning. - Patch from Victor van den Elzen. - -- Issue #16181: cookiejar.http2time() now returns None if year is higher than - datetime.MAXYEAR. - -- Issue #26513: Fixes platform module detection of Windows Server - -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by - Tam?s Bence Gedai. - -- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise - NotImplementedError instead of ImportError. - -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. - -- Issue #15068: Got rid of excessive buffering in the fileinput module. - The bufsize parameter is no longer used. - -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu - Dupuy. - -- Issue #25718: Fixed pickling and copying the accumulate() iterator with - total is None. - -- Issue #26475: Fixed debugging output for regular expressions with the (?x) - flag. - -- Issue #26457: Fixed the subnets() methods in IP network classes for the case - when resulting prefix length is equal to maximal prefix length. - Based on patch by Xiang Zhang. - -- Issue #26385: Remove the file if the internal open() call in - NamedTemporaryFile() fails. Patch by Silent Ghost. - -- Issue #26402: Fix XML-RPC client to retry when the server shuts down a - persistent connection. This was a regression related to the new - http.client.RemoteDisconnected exception in 3.5.0a4. - -- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with - adobe=True. Patch by Swati Jaiswal. - -- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader. - -- Issue #26367: importlib.__import__() raises SystemError like - builtins.__import__() when ``level`` is specified but without an accompanying - package specified. - -- Issue #26309: In the "socketserver" module, shut down the request (closing - the connected socket) when verify_request() returns false. Patch by Aviv - Palivoda. - -- [Security] Issue #25939: On Windows open the cert store readonly in - ssl.enum_certificates. - -- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. - -- Issue #26117: The os.scandir() iterator now closes file descriptor not only - when the iteration is finished, but when it was failed with error. - -- Issue #25911: Restored support of bytes paths in os.walk() on Windows. - -- Issue #26045: Add UTF-8 suggestion to error message when posting a - non-Latin-1 string with http.client. - -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. - -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. - -- Issue #26202: copy.deepcopy() now correctly copies range() objects with - non-atomic attributes. - -- Issue #23076: Path.glob() now raises a ValueError if it's called with an - invalid pattern. Patch by Thomas Nyberg. - -- Issue #19883: Fixed possible integer overflows in zipimport. - -- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and - gethostbyname_ex() functions of the socket module now decode the hostname - from the ANSI code page rather than UTF-8. - -- Issue #26147: xmlrpc now works with strings not encodable with used - non-UTF-8 encoding. - -- Issue #25935: Garbage collector now breaks reference loops with OrderedDict. - -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). - -- Issue #26013: Added compatibility with broken protocol 2 pickles created - in old Python 3 versions (3.4.3 and lower). - -- Issue #25850: Use cross-compilation by default for 64-bit Windows. - -- Issue #17633: Improve zipimport's support for namespace packages. - -- Issue #24705: Fix sysconfig._parse_makefile not expanding ${} vars - appearing before $() vars. - -- Issue #22138: Fix mock.patch behavior when patching descriptors. Restore - original values after patching. Patch contributed by Sean McCully. - -- Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode - option if it is safe to do so. - -- Issue #26012: Don't traverse into symlinks for ``**`` pattern in - pathlib.Path.[r]glob(). - -- Issue #24120: Ignore PermissionError when traversing a tree with - pathlib.Path.[r]glob(). Patch by Ulrich Petri. - -- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a - buffer attribute (restores backward compatibility). - -- Issue #25447: Copying the lru_cache() wrapper object now always works, - independedly from the type of the wrapped object (by returning the original - object unchanged). - -- Issue #24103: Fixed possible use after free in ElementTree.XMLPullParser. - -- Issue #25860: os.fwalk() no longer skips remaining directories when error - occurs. Original patch by Samson Lee. - -- Issue #25914: Fixed and simplified OrderedDict.__sizeof__. - -- Issue #25902: Fixed various refcount issues in ElementTree iteration. - -- Issue #25717: Restore the previous behaviour of tolerating most fstat() - errors when opening files. This was a regression in 3.5a1, and stopped - anonymous temporary files from working in special cases. - -- Issue #24903: Fix regression in number of arguments compileall accepts when - '-d' is specified. The check on the number of arguments has been dropped - completely as it never worked correctly anyway. - -- Issue #25764: In the subprocess module, preserve any exception caused by - fork() failure when preexec_fn is used. - -- Issue #6478: _strptime's regexp cache now is reset after changing timezone - with time.tzset(). - -- Issue #14285: When executing a package with the "python -m package" option, - and package initialization fails, a proper traceback is now reported. The - "runpy" module now lets exceptions from package initialization pass back to - the caller, rather than raising ImportError. - -- Issue #19771: Also in runpy and the "-m" option, omit the irrelevant - message ". . . is a package and cannot be directly executed" if the package - could not even be initialized (e.g. due to a bad ``*.pyc`` file). - -- Issue #25177: Fixed problem with the mean of very small and very large - numbers. As a side effect, statistics.mean and statistics.variance should - be significantly faster. - -- Issue #25718: Fixed copying object with state with boolean value is false. - -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. - -- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling - invalid data including tuple instructions. - -- Issue #25663: In the Readline completer, avoid listing duplicate global - names, and search the global namespace before searching builtins. - -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. - -- Issue #23914: Fixed SystemError raised by unpickler on broken pickle data. - -- Issue #25691: Fixed crash on deleting ElementTree.Element attributes. - -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory - entries. Patch by Dingyuan Wang. - -- Skip getaddrinfo if host is already resolved. - Patch by A. Jesse Jiryu Davis. - -- Issue #26050: Add asyncio.StreamReader.readuntil() method. - Patch by ???? ?????????. - -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. - -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on - current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. - -- Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. - Patch by Jack O'Connor. - -- Issue #27040: Add loop.get_exception_handler method - -- Issue #27041: asyncio: Add loop.create_future method - -- Issue #27223: asyncio: Fix _read_ready and _write_ready to respect - _conn_lost. - Patch by ?ukasz Langa. - -- Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait. - Patch by David Coles. - -IDLE ----- - -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. - -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. - -- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. - These persisted after other warnings were suppressed in #20567. - Apply Serhiy Storchaka's update_idletasks solution to four test files. - Record this additional advice in idle_test/README.txt - -- Issue #20567: Revise idle_test/README.txt with advice about avoiding - tk warning messages from tests. Apply advice to several IDLE tests. - -- Issue #27117: Make colorizer htest and turtledemo work with dark themes. - Move code for configuring text widget colors to a new function. - -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. - -- Issue #21939: Add test for IDLE's percolator. - Original patch by Saimadhav Heblikar. - -- Issue #21676: Add test for IDLE's replace dialog. - Original patch by Saimadhav Heblikar. - -- Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. - -- Issue #21703: Add test for IDLE's undo delegator. - Original patch by Saimadhav Heblikar . - -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. - -- Issue #23977: Add more asserts to test_delegator. - -- Issue #20640: Add tests for idlelib.configHelpSourceEdit. - Patch by Saimadhav Heblikar. - -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. - -- Issue #25507: fix incorrect change in IOBinding that prevented printing. - Augment IOBinding htest to include all major IOBinding functions. - -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. - -Documentation -------------- - -- Issue #19489: Moved the search box from the sidebar to the header and footer - of each page. Patch by Ammar Askar. - -- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - -- Issue #26736: Used HTTPS for external links in the documentation if possible. - -- Issue #6953: Rework the Readline module documentation to group related - functions together, and add more details such as what underlying Readline - functions and variables are accessed. - -- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. - -- Issue #25500: Fix documentation to not claim that __import__ is searched for - in the global scope. - -- Issue #26014: Update 3.x packaging documentation: - * "See also" links to the new docs are now provided in the legacy pages - * links to setuptools documentation have been updated - -Tests ------ - -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. - -- Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) - was untested. - -- Issue #26015: Added new tests for pickling iterators of mutable sequences. - -- Issue #26325: Added test.support.check_no_resource_warning() to check that - no ResourceWarning is emitted. - -- Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This - avoids relying on svn.python.org, which recently changed root certificate. - -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. - -- Issue #26583: Skip test_timestamp_overflow in test_import if bytecode - files cannot be written. - -Build ------ - -- Issue #26884: Fix linking extension modules for cross builds. - Patch by Xavier de Gaye. - -- Issue #22359: Disable the rules for running _freeze_importlib and pgen when - cross-compiling. The output of these programs is normally saved with the - source code anyway, and is still regenerated when doing a native build. - Patch by Xavier de Gaye. - -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. - -- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, - except on Mac OS X. Patch written by Xavier de Gaye. - -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. - -- Issue #26624: Adds validation of ucrtbase[d].dll version with warning - for old versions. - -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a - lower-level check for st_blocks in struct stat. - -- Issue #26079: Fixing the build output folder for tix-8.4.3.6. Patch by - Bjoern Thiel. - -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - -- Issue #24421: Compile Modules/_math.c once, before building extensions. - Previously it could fail to compile properly if the math and cmath builds - were concurrent. - -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to - ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The - old ``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls - ``PCbuild\build.bat --pgo %*``. - -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. - -- Issue #25696: Fix installation of Python on UNIX with make -j9. - -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. - -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. - -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. - -- Issue #24324: Do not enable unreachable code warnings when using - gcc as the option does not work correctly in older versions of gcc - and has been silently removed as of gcc-4.5. - -Windows -------- - -- Issue #27053: Updates make_zip.py to correctly generate library ZIP file. - -- Issue #26268: Update the prepare_ssl.py script to handle OpenSSL releases - that don't include the contents of the include directory (that is, 1.0.2e - and later). - -- Issue #26071: bdist_wininst created binaries fail to start and find - 32bit Python - -- Issue #26073: Update the list of magic numbers in launcher - -- Issue #26065: Excludes venv from library when generating embeddable - distro. - -Tools/Demos ------------ - -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas - Ilsche. - -- Issue #26271: Fix the Freeze tool to properly use flags passed through - configure. Patch by Daniel Shaulov. - -- Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py. - Patch by Guo Ci Teo. - -- Issue #26316: Fix variable name typo in Argument Clinic. - -Misc ----- - -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. - - -What's New in Python 3.5.1 final? -================================= - -Release date: 2015-12-06 - -Core and Builtins ------------------ - -- Issue #25709: Fixed problem with in-place string concatenation and - utf-8 cache. - -Windows -------- - -- Issue #25715: Python 3.5.1 installer shows wrong upgrade path and incorrect - logic for launcher detection. - - -What's New in Python 3.5.1 release candidate 1? -=============================================== - -Release date: 2015-11-22 - -Core and Builtins ------------------ - -- Issue #25630: Fix a possible segfault during argument parsing in functions - that accept filesystem paths. - -- Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess - internals regarding how fds_to_pass were passed to the child. The bug had - no actual impact as subprocess.py already avoided it. - -- Issue #25388: Fixed tokenizer crash when processing undecodable source code - with a null byte. - -- Issue #25462: The hash of the key now is calculated only once in most - operations in C implementation of OrderedDict. - -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now - rejects builtin types with not defined __new__. - -- Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node - when compiling AST from Python objects. - -- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() - and eval() are passed bytes-like objects. These objects are not - necessarily terminated by a null byte, but the functions assumed they were. - -- Issue #24726: Fixed a crash and leaking NULL in repr() of OrderedDict that - was mutated by direct calls of dict methods. - -- Issue #25449: Iterating OrderedDict with keys with unstable hash now raises - KeyError in C implementations as well as in Python implementation. - -- Issue #25395: Fixed crash when highly nested OrderedDict structures were - garbage collected. - -- Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new - recursion limit is too low depending at the current recursion depth. Modify - also the "lower-water mark" formula to make it monotonic. This mark is used - to decide when the overflowed flag of the thread state is reset. - -- Issue #24402: Fix input() to prompt to the redirected stdout when - sys.stdout.fileno() fails. - -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. - -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. - -- Issue #25280: Import trace messages emitted in verbose (-v) mode are no - longer formatted twice. - -- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the - getrandom() function instead of the getentropy() function. The getentropy() - function is blocking to generate very good quality entropy, os.urandom() - doesn't need such high-quality entropy. - -- Issue #25182: The stdprinter (used as sys.stderr before the io module is - imported at startup) now uses the backslashreplace error handler. - -- Issue #25131: Make the line number and column offset of set/dict literals and - comprehensions correspond to the opening brace. - -- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public - Python.h header to fix a compilation error with OpenMP. PyThreadState_GET() - becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies. - -Library -------- - -- Issue #25626: Change three zlib functions to accept sizes that fit in - Py_ssize_t, but internally cap those sizes to UINT_MAX. This resolves a - regression in 3.5 where GzipFile.read() failed to read chunks larger than 2 - or 4 GiB. The change affects the zlib.Decompress.decompress() max_length - parameter, the zlib.decompress() bufsize parameter, and the - zlib.Decompress.flush() length parameter. - -- Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) - when the OS gives priority to errors such as EACCES over EEXIST. - -- Issue #25593: Change semantics of EventLoop.stop() in asyncio. - -- Issue #6973: When we know a subprocess.Popen process has died, do - not allow the send_signal(), terminate(), or kill() methods to do - anything as they could potentially signal a different process. - -- Issue #25590: In the Readline completer, only call getattr() once per - attribute. - -- Issue #25498: Fix a crash when garbage-collecting ctypes objects created - by wrapping a memoryview. This was a regression made in 3.5a1. Based - on patch by Eryksun. - -- Issue #25584: Added "escape" to the __all__ list in the glob module. - -- Issue #25584: Fixed recursive glob() with patterns starting with ``**``. - -- Issue #25446: Fix regression in smtplib's AUTH LOGIN support. - -- Issue #18010: Fix the pydoc web server's module search function to handle - exceptions from importing packages. - -- Issue #25554: Got rid of circular references in regular expression parsing. - -- Issue #25510: fileinput.FileInput.readline() now returns b'' instead of '' - at the end if the FileInput was opened with binary mode. - Patch by Ryosuke Ito. - -- Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. - Original patch by John Mark Vandenberg. - -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. - -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. - -- Issue #25447: The lru_cache() wrapper objects now can be copied and pickled - (by returning the original object unchanged). - -- Issue #25390: typing: Don't crash on Union[str, Pattern]. - -- Issue #25441: asyncio: Raise error from drain() when socket is closed. - -- Issue #25410: Cleaned up and fixed minor bugs in C implementation of - OrderedDict. - -- Issue #25411: Improved Unicode support in SMTPHandler through better use of - the email package. Thanks to user simon04 for the patch. - -- Issue #25407: Remove mentions of the formatter module being removed in - Python 3.6. - -- Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() - that caused segmentation fault or hang in iterating after moving several - items to the start of ordered dict. - -- Issue #25364: zipfile now works in threads disabled builds. - -- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both - decode_data and enable_SMTPUTF8 are set to true. - -- Issue #25316: distutils raises OSError instead of DistutilsPlatformError - when MSVC is not installed. - -- Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in - pickletools.opcodes. - -- Issue #23972: Updates asyncio datagram create method allowing reuseport - and reuseaddr socket options to be set prior to binding the socket. - Mirroring the existing asyncio create_server method the reuseaddr option - for datagram sockets defaults to True if the O/S is 'posix' (except if the - platform is Cygwin). Patch by Chris Laws. - -- Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you - submit a coroutine to a loop from another thread, returning a - concurrent.futures.Future. By Vincent Michel. - -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the - first question mark (?) rather than the last. Patch from Xiang Zhang. - -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. - -- Issue #24483: C implementation of functools.lru_cache() now calculates key's - hash only once. - -- Issue #22958: Constructor and update method of weakref.WeakValueDictionary - now accept the self and the dict keyword arguments. - -- Issue #22609: Constructor of collections.UserDict now accepts the self keyword - argument. - -- Issue #25111: Fixed comparison of traceback.FrameSummary. - -- Issue #25262: Added support for BINBYTES8 opcode in Python implementation of - unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 - opcodes no longer silently ignored on 32-bit platforms in C implementation. - -- Issue #25034: Fix string.Formatter problem with auto-numbering and - nested format_specs. Patch by Anthon van der Neut. - -- Issue #25233: Rewrite the guts of asyncio.Queue and - asyncio.Semaphore to be more understandable and correct. - -- Issue #25203: Failed readline.set_completer_delims() no longer left the - module in inconsistent state. - -- Issue #23600: Default implementation of tzinfo.fromutc() was returning - wrong results in some cases. - -- Issue #23329: Allow the ssl module to be built with older versions of - LibreSSL. - -- Prevent overflow in _Unpickler_Read. - -- Issue #25047: The XML encoding declaration written by Element Tree now - respects the letter case given by the user. This restores the ability to - write encoding names in uppercase like "UTF-8", which worked in Python 2. - -- Issue #25135: Make deque_clear() safer by emptying the deque before clearing. - This helps avoid possible reentrancy issues. - -- Issue #19143: platform module now reads Windows version from kernel32.dll to - avoid compatibility shims. - -- Issue #25092: Fix datetime.strftime() failure when errno was already set to - EINVAL. - -- Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods - of datetime.datetime: microseconds are now rounded to nearest with ties - going to nearest even integer (ROUND_HALF_EVEN), instead of being rounding - towards minus infinity (ROUND_FLOOR). It's important that these methods use - the same rounding mode than datetime.timedelta to keep the property: - (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t). - It also the rounding mode used by round(float) for example. - -- Issue #25155: Fix datetime.datetime.now() and datetime.datetime.utcnow() on - Windows to support date after year 2038. It was a regression introduced in - Python 3.5.0. - -- Issue #25108: Omitted internal frames in traceback functions print_stack(), - format_stack(), and extract_stack() called without arguments. - -- Issue #25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows. - -- Issue #24684: socket.socket.getaddrinfo() now calls - PyUnicode_AsEncodedString() instead of calling the encode() method of the - host, to handle correctly custom string with an encode() method which doesn't - return a byte string. The encoder of the IDNA codec is now called directly - instead of calling the encode() method of the string. - -- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode. - -- Issue #24857: Comparing call_args to a long sequence now correctly returns a - boolean result instead of raising an exception. Patch by A Kaptur. - -- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even - when convert_charrefs is True. - -- Issue #24982: shutil.make_archive() with the "zip" format now adds entries - for directories (including empty directories) in ZIP file. - -- Issue #25019: Fixed a crash caused by setting non-string key of expat parser. - Based on patch by John Leitch. - -- Issue #16180: Exit pdb if file has syntax error, instead of trapping user - in an infinite loop. Patch by Xavier de Gaye. - -- Issue #24891: Fix a race condition at Python startup if the file descriptor - of stdin (0), stdout (1) or stderr (2) is closed while Python is creating - sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set - to None if the creation of the object failed, instead of raising an OSError - exception. Initial patch written by Marco Paolini. - -- Issue #24992: Fix error handling and a race condition (related to garbage - collection) in collections.OrderedDict constructor. - -- Issue #24881: Fixed setting binary mode in Python implementation of FileIO - on Windows and Cygwin. Patch from Akira Li. - -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). - -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating - ssl.SSLContext. - -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). - -- Issue #25471: Sockets returned from accept() shouldn't appear to be - nonblocking. - -- Issue #25319: When threading.Event is reinitialized, the underlying condition - should use a regular lock rather than a recursive lock. - -- Issue #21112: Fix regression in unittest.expectedFailure on subclasses. - Patch from Berker Peksag. - -- Issue #24764: cgi.FieldStorage.read_multi() now ignores the Content-Length - header in part headers. Patch written by Peter Landry and reviewed by Pierre - Quentel. - -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. - -- Issue #24774: Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. - -- Issue #21159: Improve message in configparser.InterpolationMissingOptionError. - Patch from ?ukasz Langa. - -- Issue #20362: Honour TestCase.longMessage correctly in assertRegex. - Patch from Ilia Kurenkov. - -- Issue #23572: Fixed functools.singledispatch on classes with falsy - metaclasses. Patch by Ethan Furman. - -- asyncio: ensure_future() now accepts awaitable objects. - -IDLE ----- - -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. - -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the - debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. - -- Change 'The program' to 'Your program' in an IDLE 'kill program?' message - to make it clearer that the program referred to is the currently running - user program, not IDLE itself. - -- Issue #24750: Improve the appearance of the IDLE editor window status bar. - Patch by Mark Roseman. - -- Issue #25313: Change the handling of new built-in text color themes to better - address the compatibility problem introduced by the addition of IDLE Dark. - Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. - -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences - dialog rather than a separate dialog. The former tabs are now a sorted - list. Patch by Mark Roseman. - -- Issue #22726: Re-activate the config dialog help button with some content - about the other buttons and the new IDLE Dark theme. - -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. - -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. - 'IDLE' now means 'Integrated Development and Learning Environment'. - -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. - -- Issue #24972: Inactive selection background now matches active selection - background, as configured by users, on all systems. Found items are now - always highlighted on Windows. Initial patch by Mark Roseman. - -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. - -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. - -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. - -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. - -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. - -- Issue #25225: Condense and rewrite Idle doc section on text colors. - -- Issue #21995: Explain some differences between IDLE and console Python. - -- Issue #22820: Explain need for *print* when running file from Idle editor. - -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. - -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. - -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Mark Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - -Documentation -------------- - -- Issue #22558: Add remaining doc links to source code for Python-coded modules. - Patch by Yoni Lavi. - -- Issue #12067: Rewrite Comparisons section in the Expressions chapter of the - language reference. Some of the details of comparing mixed types were - incorrect or ambiguous. NotImplemented is only relevant at a lower level - than the Expressions chapter. Added details of comparing range() objects, - and default behaviour and consistency suggestions for user-defined classes. - Patch from Andy Maier. - -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "_thread" modules. Patch from Mattip. - -- Issue #23725: Overhaul tempfile docs. Note deprecated status of mktemp. - Patch from Zbigniew J?drzejewski-Szmek. - -- Issue #24808: Update the types of some PyTypeObject fields. Patch by - Joseph Weston. - -- Issue #22812: Fix unittest discovery examples. - Patch from Pam McA'Nulty. - -Tests ------ - -- Issue #25449: Added tests for OrderedDict subclasses. - -- Issue #25099: Make test_compileall not fail when an entry on sys.path cannot - be written to (commonly seen in administrative installs on Windows). - -- Issue #23919: Prevents assert dialogs appearing in the test suite. - -- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. - -Build ------ - -- Issue #24915: Add LLVM support for PGO builds and use the test suite to - generate the profile data. Initial patch by Alecsandru Patrascu of Intel. - -- Issue #24910: Windows MSIs now have unique display names. - -- Issue #24986: It is now possible to build Python on Windows without errors - when external libraries are not available. - -Windows -------- - -- Issue #25450: Updates shortcuts to start Python in installation directory. - -- Issue #25164: Changes default all-users install directory to match per-user - directory. - -- Issue #25143: Improves installer error messages for unsupported platforms. - -- Issue #25163: Display correct directory in installer when using non-default - settings. - -- Issue #25361: Disables use of SSE2 instructions in Windows 32-bit build - -- Issue #25089: Adds logging to installer for case where launcher is not - selected on upgrade. - -- Issue #25165: Windows uninstallation should not remove launcher if other - versions remain - -- Issue #25112: py.exe launcher is missing icons - -- Issue #25102: Windows installer does not precompile for -O or -OO. - -- Issue #25081: Makes Back button in installer go back to upgrade page when - upgrading. - -- Issue #25091: Increases font size of the installer. - -- Issue #25126: Clarifies that the non-web installer will download some - components. - -- Issue #25213: Restores requestedExecutionLevel to manifest to disable - UAC virtualization. - -- Issue #25022: Removed very outdated PC/example_nt/ directory. - -Tools/Demos ------------ - -- Issue #25440: Fix output of python-config --extension-suffix. - - -What's New in Python 3.5.0 final? -================================= - -Release date: 2015-09-13 - -Build ------ - -- Issue #25071: Windows installer should not require TargetDir - parameter when installing quietly. - - -What's New in Python 3.5.0 release candidate 4? -=============================================== - -Release date: 2015-09-09 - -Library -------- - -- Issue #25029: Fixes MemoryError in test_strptime. - -Build ------ - -- Issue #25027: Reverts partial-static build options and adds - vcruntime140.dll to Windows installation. - - -What's New in Python 3.5.0 release candidate 3? -=============================================== - -Release date: 2015-09-07 - -Core and Builtins ------------------ - -- Issue #24305: Prevent import subsystem stack frames from being counted - by the warnings.warn(stacklevel=) parameter. - -- Issue #24912: Prevent __class__ assignment to immutable built-in objects. - -- Issue #24975: Fix AST compilation for PEP 448 syntax. - -Library -------- - -- Issue #24917: time_strftime() buffer over-read. - -- Issue #24748: To resolve a compatibility problem found with py2exe and - pywin32, imp.load_dynamic() once again ignores previously loaded modules - to support Python modules replacing themselves with extension modules. - Patch by Petr Viktorin. - -- Issue #24635: Fixed a bug in typing.py where isinstance([], typing.Iterable) - would return True once, then False on subsequent calls. - -- Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is - set beyond size. Based on patch by John Leitch. - -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. - - -What's New in Python 3.5.0 release candidate 2? -=============================================== - -Release date: 2015-08-25 - -Core and Builtins ------------------ - -- Issue #24769: Interpreter now starts properly when dynamic loading - is disabled. Patch by Petr Viktorin. - -- Issue #21167: NAN operations are now handled correctly when python is - compiled with ICC even if -fp-model strict is not specified. - -- Issue #24492: A "package" lacking a __name__ attribute when trying to perform - a ``from .. import ...`` statement will trigger an ImportError instead of an - AttributeError. - -Library -------- - -- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk. - -- Issue #24839: platform._syscmd_ver raises DeprecationWarning - -- Issue #24867: Fix Task.get_stack() for 'async def' coroutines - - -What's New in Python 3.5.0 release candidate 1? -=============================================== - -Release date: 2015-08-09 - -Core and Builtins ------------------ - -- Issue #24667: Resize odict in all cases that the underlying dict resizes. - -Library -------- - -- Issue #24824: Signatures of codecs.encode() and codecs.decode() now are - compatible with pydoc. - -- Issue #24634: Importing uuid should not try to load libc on Windows - -- Issue #24798: _msvccompiler.py doesn't properly support manifests - -- Issue #4395: Better testing and documentation of binary operators. - Patch by Martin Panter. - -- Issue #23973: Update typing.py from GitHub repo. - -- Issue #23004: mock_open() now reads binary data correctly when the type of - read_data is bytes. Initial patch by Aaron Hill. - -- Issue #23888: Handle fractional time in cookie expiry. Patch by ssh. - -- Issue #23652: Make it possible to compile the select module against the - libc headers from the Linux Standard Base, which do not include some - EPOLL macros. Patch by Matt Frank. - -- Issue #22932: Fix timezones in email.utils.formatdate. - Patch from Dmitry Shachnev. - -- Issue #23779: imaplib raises TypeError if authenticator tries to abort. - Patch from Craig Holmquist. - -- Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch - written by Matthieu Gautier. - -- Issue #23254: Document how to close the TCPServer listening socket. - Patch from Martin Panter. - -- Issue #19450: Update Windows and OS X installer builds to use SQLite 3.8.11. - -- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella. - -- Issue #24791: Fix grammar regression for call syntax: 'g(\*a or b)'. - -IDLE ----- - -- Issue #23672: Allow Idle to edit and run files with astral chars in name. - Patch by Mohd Sanad Zaki Rizvi. - -- Issue #24745: Idle editor default font. Switch from Courier to - platform-sensitive TkFixedFont. This should not affect current customized - font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg - and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. - -- Issue #21192: Idle editor. When a file is run, put its name in the restart bar. - Do not print false prompts. Original patch by Adnan Umer. - -- Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy. - -Documentation -------------- - -- Issue #24129: Clarify the reference documentation for name resolution. - This includes removing the assumption that readers will be familiar with the - name resolution scheme Python used prior to the introduction of lexical - scoping for function namespaces. Patch by Ivan Levkivskyi. - -- Issue #20769: Improve reload() docs. Patch by Dorian Pula. - -- Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. - -- Issue #24729: Correct IO tutorial to match implementation regarding - encoding parameter to open function. - -Tests ------ - -- Issue #24751: When running regrtest with the ``-w`` command line option, - a test run is no longer marked as a failure if all tests succeed when - re-run. - - -What's New in Python 3.5.0 beta 4? -================================== - -Release date: 2015-07-26 - -Core and Builtins ------------------ - -- Issue #23573: Restored optimization of bytes.rfind() and bytearray.rfind() - for single-byte argument on Linux. - -- Issue #24569: Make PEP 448 dictionary evaluation more consistent. - -- Issue #24583: Fix crash when set is mutated while being updated. - -- Issue #24407: Fix crash when dict is mutated while being updated. - -- Issue #24619: New approach for tokenizing async/await. As a consequence, - it is now possible to have one-line 'async def foo(): await ..' functions. - -- Issue #24687: Plug refleak on SyntaxError in function parameters - annotations. - -- Issue #15944: memoryview: Allow arbitrary formats when casting to bytes. - Patch by Martin Panter. - -Library -------- - -- Issue #23441: rcompleter now prints a tab character instead of displaying - possible completions for an empty word. Initial patch by Martin Sekera. - -- Issue #24683: Fixed crashes in _json functions called with arguments of - inappropriate type. - -- Issue #21697: shutil.copytree() now correctly handles symbolic links that - point to directories. Patch by Eduardo Seabra and Thomas Kluyver. - -- Issue #14373: Fixed segmentation fault when gc.collect() is called during - constructing lru_cache (C implementation). - -- Issue #24695: Fix a regression in traceback.print_exception(). If - exc_traceback is None we shouldn't print a traceback header like described - in the documentation. - -- Issue #24620: Random.setstate() now validates the value of state last element. - -- Issue #22485: Fixed an issue that caused `inspect.getsource` to return - incorrect results on nested functions. - -- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero. - -- Issue #24580: Symbolic group references to open group in re patterns now are - explicitly forbidden as well as numeric group references. - -- Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes. - -- Issue #24631: Fixed regression in the timeit module with multiline setup. - -- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. - Patch from Nicola Palumbo and Laurent De Buyst. - -- Issue #23661: unittest.mock side_effects can now be exceptions again. This - was a regression vs Python 3.4. Patch from Ignacio Rossi - -- Issue #24608: chunk.Chunk.read() now always returns bytes, not str. - -- Issue #18684: Fixed reading out of the buffer in the re module. - -- Issue #24259: tarfile now raises a ReadError if an archive is truncated - inside a data segment. - -- Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional - initial-response argument to the SMTP AUTH command. - -- Issue #24669: Fix inspect.getsource() for 'async def' functions. - Patch by Kai Groner. - -- Issue #24688: ast.get_docstring() for 'async def' functions. - -Build ------ - -- Issue #24603: Update Windows builds and OS X 10.5 installer to use OpenSSL - 1.0.2d. - - -What's New in Python 3.5.0 beta 3? -================================== - -Release date: 2015-07-05 - -Core and Builtins ------------------ - -- Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray - object now always allocates place for trailing null byte and it's buffer now - is always null-terminated. - -- Upgrade to Unicode 8.0.0. - -- Issue #24345: Add Py_tp_finalize slot for the stable ABI. - -- Issue #24400: Introduce a distinct type for PEP 492 coroutines; add - types.CoroutineType, inspect.getcoroutinestate, inspect.getcoroutinelocals; - coroutines no longer use CO_GENERATOR flag; sys.set_coroutine_wrapper - works only for 'async def' coroutines; inspect.iscoroutine no longer - uses collections.abc.Coroutine, it's intended to test for pure 'async def' - coroutines only; add new opcode: GET_YIELD_FROM_ITER; fix generators wrapper - used in types.coroutine to be instance of collections.abc.Generator; - collections.abc.Awaitable and collections.abc.Coroutine can no longer - be used to detect generator-based coroutines--use inspect.isawaitable - instead. - -- Issue #24450: Add gi_yieldfrom to generators and cr_await to coroutines. - Contributed by Benno Leslie and Yury Selivanov. - -- Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. - -Library -------- - -- Issue #21750: mock_open.read_data can now be read from each instance, as it - could in Python 3.3. - -- Issue #24552: Fix use after free in an error case of the _pickle module. - -- Issue #24514: tarfile now tolerates number fields consisting of only - whitespace. - -- Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree. - A deprecation warning no longer issued by XMLParser subclass with default - doctype() method. Direct call of doctype() now issues a warning. Parser's - doctype() now is not called if target's doctype() is called. Based on patch - by Martin Panter. - -- Issue #20387: Restore semantic round-trip correctness in tokenize/untokenize - for tab-indented blocks. - -- Issue #24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() - functions of the audioop module. - -- Issue #24336: The contextmanager decorator now works with functions with - keyword arguments called "func" and "self". Patch by Martin Panter. - -- Issue #24522: Fix possible integer overflow in json accelerator module. - -- Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). - -- Issue #24408: Fixed AttributeError in measure() and metrics() methods of - tkinter.Font. - -- Issue #14373: C implementation of functools.lru_cache() now can be used with - methods. - -- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. - -- Issue #24348: Drop superfluous incref/decref. - -- Issue #24359: Check for changed OrderedDict size during iteration. - -- Issue #24368: Support keyword arguments in OrderedDict methods. - -- Issue #24362: Simplify the C OrderedDict fast nodes resize logic. - -- Issue #24377: Fix a ref leak in OrderedDict.__repr__. - -- Issue #24369: Defend against key-changes during iteration. - -Tests ------ - -- Issue #24373: _testmultiphase and xxlimited now use tp_traverse and - tp_finalize to avoid reference leaks encountered when combining tp_dealloc - with PyType_FromSpec (see issue #16690 for details) - -Documentation -------------- - -- Issue #24458: Update documentation to cover multi-phase initialization for - extension modules (PEP 489). Patch by Petr Viktorin. - -- Issue #24351: Clarify what is meant by "identifier" in the context of - string.Template instances. - -Build ------ - -- Issue #24432: Update Windows builds and OS X 10.5 installer to use OpenSSL - 1.0.2c. - - -What's New in Python 3.5.0 beta 2? -================================== - -Release date: 2015-05-31 - -Core and Builtins ------------------ - -- Issue #24284: The startswith and endswith methods of the str class no longer - return True when finding the empty string and the indexes are completely out - of range. - -- Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(), - PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() - to check for and handle errors correctly. - -- Issue #24328: Fix importing one character extension modules. - -- Issue #11205: In dictionary displays, evaluate the key before the value. - -- Issue #24285: Fixed regression that prevented importing extension modules - from inside packages. Patch by Petr Viktorin. - -Library -------- - -- Issue #23247: Fix a crash in the StreamWriter.reset() of CJK codecs. - -- Issue #24270: Add math.isclose() and cmath.isclose() functions as per PEP 485. - Contributed by Chris Barker and Tal Einat. - -- Issue #5633: Fixed timeit when the statement is a string and the setup is not. - -- Issue #24326: Fixed audioop.ratecv() with non-default weightB argument. - Original patch by David Moore. - -- Issue #16991: Add a C implementation of OrderedDict. - -- Issue #23934: Fix inspect.signature to fail correctly for builtin types - lacking signature information. Initial patch by James Powell. - - -What's New in Python 3.5.0 beta 1? -================================== - -Release date: 2015-05-24 - -Core and Builtins ------------------ - -- Issue #24276: Fixed optimization of property descriptor getter. - -- Issue #24268: PEP 489: Multi-phase extension module initialization. - Patch by Petr Viktorin. - -- Issue #23955: Add pyvenv.cfg option to suppress registry/environment - lookup for generating sys.path on Windows. - -- Issue #24257: Fixed system error in the comparison of faked - types.SimpleNamespace. - -- Issue #22939: Fixed integer overflow in iterator object. Patch by - Clement Rouault. - -- Issue #23985: Fix a possible buffer overrun when deleting a slice from - the front of a bytearray and then appending some other bytes data. - -- Issue #24102: Fixed exception type checking in standard error handlers. - -- Issue #15027: The UTF-32 encoder is now 3x to 7x faster. - -- Issue #23290: Optimize set_merge() for cases where the target is empty. - (Contributed by Serhiy Storchaka.) - -- Issue #2292: PEP 448: Additional Unpacking Generalizations. - -- Issue #24096: Make warnings.warn_explicit more robust against mutation of the - warnings.filters list. - -- Issue #23996: Avoid a crash when a delegated generator raises an - unnormalized StopIteration exception. Patch by Stefan Behnel. - -- Issue #23910: Optimize property() getter calls. Patch by Joe Jevnik. - -- Issue #23911: Move path-based importlib bootstrap code to a separate - frozen module. - -- Issue #24192: Fix namespace package imports. - -- Issue #24022: Fix tokenizer crash when processing undecodable source code. - -- Issue #9951: Added a hex() method to bytes, bytearray, and memoryview. - -- Issue #22906: PEP 479: Change StopIteration handling inside generators. - -- Issue #24017: PEP 492: Coroutines with async and await syntax. - -Library -------- - -- Issue #14373: Added C implementation of functools.lru_cache(). Based on - patches by Matt Joiner and Alexey Kachayev. - -- Issue #24230: The tempfile module now accepts bytes for prefix, suffix and dir - parameters and returns bytes in such situations (matching the os module APIs). - -- Issue #22189: collections.UserString now supports __getnewargs__(), - __rmod__(), casefold(), format_map(), isprintable(), and maketrans(). - Patch by Joe Jevnik. - -- Issue #24244: Prevents termination when an invalid format string is - encountered on Windows in strftime. - -- Issue #23973: PEP 484: Add the typing module. - -- Issue #23086: The collections.abc.Sequence() abstract base class added - *start* and *stop* parameters to the index() mixin. - Patch by Devin Jeanpierre. - -- Issue #20035: Replaced the ``tkinter._fix`` module used for setting up the - Tcl/Tk environment on Windows with a private function in the ``_tkinter`` - module that makes no permanent changes to the environment. - -- Issue #24257: Fixed segmentation fault in sqlite3.Row constructor with faked - cursor type. - -- Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and - assertWarnsRegex() assertments now check the type of the first argument - to prevent possible user error. Based on patch by Daniel Wagner-Hall. - -- Issue #9858: Add missing method stubs to _io.RawIOBase. Patch by Laura - Rupprecht. - -- Issue #22955: attrgetter, itemgetter and methodcaller objects in the operator - module now support pickling. Added readable and evaluable repr for these - objects. Based on patch by Josh Rosenberg. - -- Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again - when a directory with the chosen name already exists on Windows as well as - on Unix. tempfile.mkstemp() now fails early if parent directory is not - valid (not exists or is a file) on Windows. - -- Issue #23780: Improved error message in os.path.join() with single argument. - -- Issue #6598: Increased time precision and random number range in - email.utils.make_msgid() to strengthen the uniqueness of the message ID. - -- Issue #24091: Fixed various crashes in corner cases in C implementation of - ElementTree. - -- Issue #21931: msilib.FCICreate() now raises TypeError in the case of a bad - argument instead of a ValueError with a bogus FCI error number. - Patch by Jeffrey Armstrong. - -- Issue #13866: *quote_via* argument added to urllib.parse.urlencode. - -- Issue #20098: New mangle_from policy option for email, default True - for compat32, but False for all other policies. - -- Issue #24211: The email library now supports RFC 6532: it can generate - headers using utf-8 instead of encoded words. - -- Issue #16314: Added support for the LZMA compression in distutils. - -- Issue #21804: poplib now supports RFC 6856 (UTF8). - -- Issue #18682: Optimized pprint functions for builtin scalar types. - -- Issue #22027: smtplib now supports RFC 6531 (SMTPUTF8). - -- Issue #23488: Random generator objects now consume 2x less memory on 64-bit. - -- Issue #1322: platform.dist() and platform.linux_distribution() functions are - now deprecated. Initial patch by Vajrasky Kok. - -- Issue #22486: Added the math.gcd() function. The fractions.gcd() function - now is deprecated. Based on patch by Mark Dickinson. - -- Issue #24064: Property() docstrings are now writeable. - (Patch by Berker Peksag.) - -- Issue #22681: Added support for the koi8_t encoding. - -- Issue #22682: Added support for the kz1048 encoding. - -- Issue #23796: peek and read1 methods of BufferedReader now raise ValueError - if they called on a closed object. Patch by John Hergenroeder. - -- Issue #21795: smtpd now supports the 8BITMIME extension whenever - the new *decode_data* constructor argument is set to False. - -- Issue #24155: optimize heapq.heapify() for better cache performance - when heapifying large lists. - -- Issue #21800: imaplib now supports RFC 5161 (enable), RFC 6855 - (utf8/internationalized email) and automatically encodes non-ASCII - usernames and passwords to UTF8. - -- Issue #20274: When calling a _sqlite.Connection, it now complains if passed - any keyword arguments. Previously it silently ignored them. - -- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three - METH_VARARGS methods on _sqlite.Connection. - -- Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and - assertWarnsRegex() checks now emits a deprecation warning when callable is - None or keyword arguments except msg is passed in the context manager mode. - -- Issue #24018: Add a collections.abc.Generator abstract base class. - Contributed by Stefan Behnel. - -- Issue #23880: Tkinter's getint() and getdouble() now support Tcl_Obj. - Tkinter's getdouble() now supports any numbers (in particular int). - -- Issue #22619: Added negative limit support in the traceback module. - Based on patch by Dmitry Kazakov. - -- Issue #24094: Fix possible crash in json.encode with poorly behaved dict - subclasses. - -- Issue #9246: On POSIX, os.getcwd() now supports paths longer than 1025 bytes. - Patch written by William Orr. - -- Issue #17445: add difflib.diff_bytes() to support comparison of - byte strings (fixes a regression from Python 2). - -- Issue #23917: Fall back to sequential compilation when ProcessPoolExecutor - doesn't exist. Patch by Claudiu Popa. - -- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. - -- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't - increment unfinished tasks (this bug was introduced when - JoinableQueue was merged with Queue). - -- Issue #23908: os functions now reject paths with embedded null character - on Windows instead of silently truncating them. - -- Issue #23728: binascii.crc_hqx() could return an integer outside of the range - 0-0xffff for empty data. - -- Issue #23887: urllib.error.HTTPError now has a proper repr() representation. - Patch by Berker Peksag. - -- asyncio: New event loop APIs: set_task_factory() and get_task_factory(). - -- asyncio: async() function is deprecated in favour of ensure_future(). - -- Issue #24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore - support new 'async with' syntax. Contributed by Yury Selivanov. - -- Issue #24179: Support 'async for' for asyncio.StreamReader. - Contributed by Yury Selivanov. - -- Issue #24184: Add AsyncIterator and AsyncIterable ABCs to - collections.abc. Contributed by Yury Selivanov. - -- Issue #22547: Implement informative __repr__ for inspect.BoundArguments. - Contributed by Yury Selivanov. - -- Issue #24190: Implement inspect.BoundArgument.apply_defaults() method. - Contributed by Yury Selivanov. - -- Issue #20691: Add 'follow_wrapped' argument to - inspect.Signature.from_callable() and inspect.signature(). - Contributed by Yury Selivanov. - -- Issue #24248: Deprecate inspect.Signature.from_function() and - inspect.Signature.from_builtin(). - -- Issue #23898: Fix inspect.classify_class_attrs() to support attributes - with overloaded __eq__ and __bool__. Patch by Mike Bayer. - -- Issue #24298: Fix inspect.signature() to correctly unwrap wrappers - around bound methods. - -IDLE ----- - -- Issue #23184: remove unused names and imports in idlelib. - Initial patch by Al Sweigart. - -Tests ------ - -- Issue #21520: test_zipfile no longer fails if the word 'bad' appears - anywhere in the name of the current directory. - -- Issue #9517: Move script_helper into the support package. - Patch by Christie Wilson. - -Documentation -------------- - -- Issue #22155: Add File Handlers subsection with createfilehandler to tkinter - doc. Remove obsolete example from FAQ. Patch by Martin Panter. - -- Issue #24029: Document the name binding behavior for submodule imports. - -- Issue #24077: Fix typo in man page for -I command option: -s, not -S - -Tools/Demos ------------ - -- Issue #24000: Improved Argument Clinic's mapping of converters to legacy - "format units". Updated the documentation to match. - -- Issue #24001: Argument Clinic converters now use accept={type} - instead of types={'type'} to specify the types the converter accepts. - -- Issue #23330: h2py now supports arbitrary filenames in #include. - -- Issue #24031: make patchcheck now supports git checkouts, too. - - -What's New in Python 3.5.0 alpha 4? -=================================== - -Release date: 2015-04-19 - -Core and Builtins ------------------ - -- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include - the architecture triplet in the extension name, to make it easy to test builds - for different ABIs in the same working tree. Under OS X, the extension name - now includes PEP 3149-style information. - -- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES. - Patch courtesy of Joe Jevnik. - -- Issue #23731: Implement PEP 488: removal of .pyo files. - -- Issue #23726: Don't enable GC for user subclasses of non-GC types that - don't add any new fields. Patch by Eugene Toder. - -- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted - while it is holding a lock to a buffered I/O object, and the main thread - tries to use the same I/O object (typically stdout or stderr). A fatal - error is emitted instead. - -- Issue #22977: Fixed formatting Windows error messages on Wine. - Patch by Martin Panter. - -- Issue #23466: %c, %o, %x, and %X in bytes formatting now raise TypeError on - non-integer input. - -- Issue #24044: Fix possible null pointer dereference in list.sort in out of - memory conditions. - -- Issue #21354: PyCFunction_New function is exposed by python DLL again. - -Library -------- - -- Issue #23840: tokenize.open() now closes the temporary binary file on error - to fix a resource warning. - -- Issue #16914: new debuglevel 2 in smtplib adds timestamps to debug output. - -- Issue #7159: urllib.request now supports sending auth credentials - automatically after the first 401. This enhancement is a superset of the - enhancement from issue #19494 and supersedes that change. - -- Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a. - Patch by Demian Brecht. - -- Issue #4254: Adds _curses.update_lines_cols(). Patch by Arnon Yaari - -- Issue #19933: Provide default argument for ndigits in round. Patch by - Vajrasky Kok. - -- Issue #23193: Add a numeric_owner parameter to - tarfile.TarFile.extract and tarfile.TarFile.extractall. Patch by - Michael Vogt and Eric Smith. - -- Issue #23342: Add a subprocess.run() function than returns a CalledProcess - instance for a more consistent API than the existing call* functions. - -- Issue #21217: inspect.getsourcelines() now tries to compute the start and end - lines from the code object, fixing an issue when a lambda function is used as - decorator argument. Patch by Thomas Ballinger and Allison Kaptur. - -- Issue #24521: Fix possible integer overflows in the pickle module. - -- Issue #22931: Allow '[' and ']' in cookie values. - -- The keywords attribute of functools.partial is now always a dictionary. - -- Issue #23811: Add missing newline to the PyCompileError error message. - Patch by Alex Shkop. - -- Issue #21116: Avoid blowing memory when allocating a multiprocessing shared - array that's larger than 50% of the available RAM. Patch by M?d?ric Boquien. - -- Issue #22982: Improve BOM handling when seeking to multiple positions of - a writable text file. - -- Issue #23464: Removed deprecated asyncio JoinableQueue. - -- Issue #23529: Limit the size of decompressed data when reading from - GzipFile, BZ2File or LZMAFile. This defeats denial of service attacks - using compressed bombs (i.e. compressed payloads which decompress to a huge - size). Patch by Martin Panter and Nikolaus Rath. - -- Issue #21859: Added Python implementation of io.FileIO. - -- Issue #23865: close() methods in multiple modules now are idempotent and more - robust at shutdown. If they need to release multiple resources, all are - released even if errors occur. - -- Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not - available. Patch by Davin Potts. - -- Issue #10838: The subprocess now module includes SubprocessError and - TimeoutError in its list of exported names for the users wild enough - to use ``from subprocess import *``. - -- Issue #23411: Added DefragResult, ParseResult, SplitResult, DefragResultBytes, - ParseResultBytes, and SplitResultBytes to urllib.parse.__all__. - Patch by Martin Panter. - -- Issue #23881: urllib.request.ftpwrapper constructor now closes the socket if - the FTP connection failed to fix a ResourceWarning. - -- Issue #23853: :meth:`socket.socket.sendall` does no more reset the socket - timeout each time data is sent successfully. The socket timeout is now the - maximum total duration to send all data. - -- Issue #22721: An order of multiline pprint output of set or dict containing - orderable and non-orderable elements no longer depends on iteration order of - set or dict. - -- Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always - returns bool. tkinter.BooleanVar now validates input values (accepted bool, - int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns bool. - -- Issue #10590: xml.sax.parseString() now supports string argument. - -- Issue #23338: Fixed formatting ctypes error messages on Cygwin. - Patch by Makoto Kato. - -- Issue #15582: inspect.getdoc() now follows inheritance chains. - -- Issue #2175: SAX parsers now support a character stream of InputSource object. - -- Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and - arbitrary precision integers added in Tcl 8.5. - -- Issue #23834: Fix socket.sendto(), use the C Py_ssize_t type to store the - result of sendto() instead of the C int type. - -- Issue #23618: :meth:`socket.socket.connect` now waits until the connection - completes instead of raising :exc:`InterruptedError` if the connection is - interrupted by signals, signal handlers don't raise an exception and the - socket is blocking or has a timeout. :meth:`socket.socket.connect` still - raise :exc:`InterruptedError` for non-blocking sockets. - -- Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. - -- Issue #23836: Fix the faulthandler module to handle reentrant calls to - its signal handlers. - -- Issue #23838: linecache now clears the cache and returns an empty result on - MemoryError. - -- Issue #10395: Added os.path.commonpath(). Implemented in posixpath and ntpath. - Based on patch by Rafik Draoui. - -- Issue #23611: Serializing more "lookupable" objects (such as unbound methods - or nested classes) now are supported with pickle protocols < 4. - -- Issue #13583: sqlite3.Row now supports slice indexing. - -- Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings. Fixed - ambigious reverse mappings. Added many new mappings. Import mapping is no - longer applied to modules already mapped with full name mapping. - -- Issue #23485: select.select() is now retried automatically with the - recomputed timeout when interrupted by a signal, except if the signal handler - raises an exception. This change is part of the PEP 475. - -- Issue #23752: When built from an existing file descriptor, io.FileIO() now - only calls fstat() once. Before fstat() was called twice, which was not - necessary. - -- Issue #23704: collections.deque() objects now support __add__, __mul__, and - __imul__(). - -- Issue #23171: csv.Writer.writerow() now supports arbitrary iterables. - -- Issue #23745: The new email header parser now handles duplicate MIME - parameter names without error, similar to how get_param behaves. - -- Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus - infinity (-inf) instead of rounding towards zero. - -- Issue #23310: Fix MagicMock's initializer to work with __methods__, just - like configure_mock(). Patch by Kasia Jachim. - -Build ------ - -- Issue #23817: FreeBSD now uses "1.0" in the SOVERSION as other operating - systems, instead of just "1". - -- Issue #23501: Argument Clinic now generates code into separate files by default. - -Tests ------ - -- Issue #23799: Added test.support.start_threads() for running and - cleaning up multiple threads. - -- Issue #22390: test.regrtest now emits a warning if temporary files or - directories are left after running a test. - -Tools/Demos ------------ - -- Issue #18128: pygettext now uses standard +NNNN format in the - POT-Creation-Date header. - -- Issue #23935: Argument Clinic's understanding of format units - accepting bytes, bytearrays, and buffers is now consistent with - both the documentation and the implementation. - -- Issue #23944: Argument Clinic now wraps long impl prototypes at column 78. - -- Issue #20586: Argument Clinic now ensures that functions without docstrings - have signatures. - -- Issue #23492: Argument Clinic now generates argument parsing code with - PyArg_Parse instead of PyArg_ParseTuple if possible. - -- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef" - (empty) definition of the methoddef macro: it's only generated once, even - if Argument Clinic processes the same symbol multiple times, and it's emitted - at the end of all processing rather than immediately after the first use. - -C API ------ - -- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error - - -What's New in Python 3.5.0 alpha 3? -=================================== - -Release date: 2015-03-28 - -Core and Builtins ------------------ - -- Issue #23573: Increased performance of string search operations (str.find, - str.index, str.count, the in operator, str.split, str.partition) with - arguments of different kinds (UCS1, UCS2, UCS4). - -- Issue #23753: Python doesn't support anymore platforms without stat() or - fstat(), these functions are always required. - -- Issue #23681: The -b option now affects comparisons of bytes with int. - -- Issue #23632: Memoryviews now allow tuple indexing (including for - multi-dimensional memoryviews). - -- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet. - -- Issue #23629: Fix the default __sizeof__ implementation for variable-sized - objects. - -Library -------- - -- Issue #14260: The groupindex attribute of regular expression pattern object - now is non-modifiable mapping. - -- Issue #23792: Ignore KeyboardInterrupt when the pydoc pager is active. - This mimics the behavior of the standard unix pagers, and prevents - pipepager from shutting down while the pager itself is still running. - -- Issue #23775: pprint() of OrderedDict now outputs the same representation - as repr(). - -- Issue #23765: Removed IsBadStringPtr calls in ctypes - -- Issue #22364: Improved some re error messages using regex for hints. - -- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. - -- Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive - creation) mode. - -- Issue #21802: The reader in BufferedRWPair now is closed even when closing - writer failed in BufferedRWPair.close(). - -- Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. - -- Issue #23671: string.Template now allows specifying the "self" parameter as - a keyword argument. string.Formatter now allows specifying the "self" and - the "format_string" parameters as keyword arguments. - -- Issue #23502: The pprint module now supports mapping proxies. - -- Issue #17530: pprint now wraps long bytes objects and bytearrays. - -- Issue #22687: Fixed some corner cases in breaking words in tetxtwrap. - Got rid of quadratic complexity in breaking long words. - -- Issue #4727: The copy module now uses pickle protocol 4 (PEP 3154) and - supports copying of instances of classes whose __new__ method takes - keyword-only arguments. - -- Issue #23491: Added a zipapp module to support creating executable zip - file archives of Python code. Registered ".pyz" and ".pyzw" extensions - on Windows for these archives (PEP 441). - -- Issue #23657: Avoid explicit checks for str in zipapp, adding support - for pathlib.Path objects as arguments. - -- Issue #23688: Added support of arbitrary bytes-like objects and avoided - unnecessary copying of memoryview in gzip.GzipFile.write(). - Original patch by Wolfgang Maier. - -- Issue #23252: Added support for writing ZIP files to unseekable streams. - -- Issue #23647: Increase impalib's MAXLINE to accommodate modern mailbox sizes. - -- Issue #23539: If body is None, http.client.HTTPConnection.request now sets - Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors from - some web servers. - -- Issue #22351: The nntplib.NNTP constructor no longer leaves the connection - and socket open until the garbage collector cleans them up. Patch by - Martin Panter. - -- Issue #23704: collections.deque() objects now support methods for index(), - insert(), and copy(). This allows deques to be registered as a - MutableSequence and it improves their substitutability for lists. - -- Issue #23715: :func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are - now retried when interrupted by a signal not in the *sigset* parameter, if - the signal handler does not raise an exception. signal.sigtimedwait() - recomputes the timeout with a monotonic clock when it is retried. - -- Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and - codecs, that accepted only read-only bytes-like object now accept writable - bytes-like object too. - -- Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now - retried with the recomputed delay, except if the signal handler raises an - exception (PEP 475). - -- Issue #23136: _strptime now uniformly handles all days in week 0, including - Dec 30 of previous year. Based on patch by Jim Carroll. - -- Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to - NamedTemporaryFile instance. Patch by Bohuslav Kabrda. - -- Issue #22903: The fake test case created by unittest.loader when it fails - importing a test module is now picklable. - -- Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall if - available, syscall introduced in the Linux kernel 3.17. It is more reliable - and more secure, because it avoids the need of a file descriptor and waits - until the kernel has enough entropy. - -- Issue #2211: Updated the implementation of the http.cookies.Morsel class. - Setting attributes key, value and coded_value directly now is deprecated. - update() and setdefault() now transform and check keys. Comparing for - equality now takes into account attributes key, value and coded_value. - copy() now returns a Morsel, not a dict. repr() now contains all attributes. - Optimized checking keys and quoting values. Added new tests. - Original patch by Demian Brecht. - -- Issue #18983: Allow selection of output units in timeit. - Patch by Julian Gindi. - -- Issue #23631: Fix traceback.format_list when a traceback has been mutated. - -- Issue #23568: Add rdivmod support to MagicMock() objects. - Patch by H?kan L?vdahl. - -- Issue #2052: Add charset parameter to HtmlDiff.make_file(). - -- Issue #23668: Support os.truncate and os.ftruncate on Windows. - -- Issue #23138: Fixed parsing cookies with absent keys or values in cookiejar. - Patch by Demian Brecht. - -- Issue #23051: multiprocessing.Pool methods imap() and imap_unordered() now - handle exceptions raised by an iterator. Patch by Alon Diamant and Davin - Potts. - -- Issue #23581: Add matmul support to MagicMock. Patch by H?kan L?vdahl. - -- Issue #23566: enable(), register(), dump_traceback() and - dump_traceback_later() functions of faulthandler now accept file - descriptors. Patch by Wei Wu. - -- Issue #22928: Disabled HTTP header injections in http.client. - Original patch by Demian Brecht. - -- Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with - imp.reload(). Patch by Thomas Kluyver. - -- Issue #23605: os.walk() now calls os.scandir() instead of os.listdir(). - The usage of os.scandir() reduces the number of calls to os.stat(). - Initial patch written by Ben Hoyt. - -Build ------ - -- Issue #23585: make patchcheck will ensure the interpreter is built. - -Tests ------ - -- Issue #23583: Added tests for standard IO streams in IDLE. - -- Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. - -Tools/Demos ------------ - -- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better - compatible with regular files (in particular it now supports the context - management protocol). - - -What's New in Python 3.5 alpha 2? -================================= - -Release date: 2015-03-09 - -Core and Builtins ------------------ - -- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError - if a function returns a result and raises an exception. The SystemError is - chained to the previous exception. - -Library -------- - -- Issue #22524: New os.scandir() function, part of the PEP 471: "os.scandir() - function -- a better and faster directory iterator". Patch written by Ben - Hoyt. - -- Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address. - -- Issue #21793: BaseHTTPRequestHandler again logs response code as numeric, - not as stringified enum. Patch by Demian Brecht. - -- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST - flag on certificate stores when it is available. - -- Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the - SSL layer but the underlying connection hasn't been closed. - -- Issue #23504: Added an __all__ to the types module. - -- Issue #23563: Optimized utility functions in urllib.parse. - -- Issue #7830: Flatten nested functools.partial. - -- Issue #20204: Added the __module__ attribute to _tkinter classes. - -- Issue #19980: Improved help() for non-recognized strings. help('') now - shows the help on str. help('help') now shows the help on help(). - Original patch by Mark Lawrence. - -- Issue #23521: Corrected pure python implementation of timedelta division. - - * Eliminated OverflowError from ``timedelta * float`` for some floats; - * Corrected rounding in timedlta true division. - -- Issue #21619: Popen objects no longer leave a zombie after exit in the with - statement if the pipe was broken. Patch by Martin Panter. - -- Issue #22936: Make it possible to show local variables in tracebacks for - both the traceback module and unittest. - -- Issue #15955: Add an option to limit the output size in bz2.decompress(). - Patch by Nikolaus Rath. - -- Issue #6639: Module-level turtle functions no longer raise TclError after - closing the window. - -- Issues #814253, #9179: Group references and conditional group references now - work in lookbehind assertions in regular expressions. - -- Issue #23215: Multibyte codecs with custom error handlers that ignores errors - consumed too much memory and raised SystemError or MemoryError. - Original patch by Aleksi Torhamo. - -- Issue #5700: io.FileIO() called flush() after closing the file. - flush() was not called in close() if closefd=False. - -- Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding - differs from file system encoding (e.g. on Mac OS). - -- Issue #23481: Remove RC4 from the SSL module's default cipher list. - -- Issue #21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty - docstrings. - -- Issue #22885: Fixed arbitrary code execution vulnerability in the dbm.dumb - module. Original patch by Claudiu Popa. - -- Issue #23239: ssl.match_hostname() now supports matching of IP addresses. - -- Issue #23146: Fix mishandling of absolute Windows paths with forward - slashes in pathlib. - -- Issue #23096: Pickle representation of floats with protocol 0 now is the same - for both Python and C implementations. - -- Issue #19105: pprint now more efficiently uses free space at the right. - -- Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. Patch by - Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson. - -- Issue #21717: tarfile.open() now supports 'x' (exclusive creation) mode. - -- Issue #23344: marshal.dumps() is now 20-25% faster on average. - -- Issue #20416: marshal.dumps() with protocols 3 and 4 is now 40-50% faster on - average. - -- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h. - -- Issue #23367: Fix possible overflows in the unicodedata module. - -- Issue #23361: Fix possible overflow in Windows subprocess creation code. - -- logging.handlers.QueueListener now takes a respect_handler_level keyword - argument which, if set to True, will pass messages to handlers taking handler - levels into account. - -- Issue #19705: turtledemo now has a visual sorting algorithm demo. Original - patch from Jason Yeo. - -- Issue #23801: Fix issue where cgi.FieldStorage did not always ignore the - entire preamble to a multipart body. - -Build ------ - -- Issue #23445: pydebug builds now use "gcc -Og" where possible, to make - the resulting executable faster. - -- Issue #23686: Update OS X 10.5 installer build to use OpenSSL 1.0.2a. - -C API ------ - -- Issue #20204: Deprecation warning is now raised for builtin types without the - __module__ attribute. - -Windows -------- - -- Issue #23465: Implement PEP 486 - Make the Python Launcher aware of virtual - environments. Patch by Paul Moore. - -- Issue #23437: Make user scripts directory versioned on Windows. Patch by Paul - Moore. - - -What's New in Python 3.5 alpha 1? -================================= - -Release date: 2015-02-08 - -Core and Builtins ------------------ - -- Issue #23285: PEP 475 - EINTR handling. - -- Issue #22735: Fix many edge cases (including crashes) involving custom mro() - implementations. - -- Issue #22896: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() - and PyObject_AsWriteBuffer(). - -- Issue #21295: Revert some changes (issue #16795) to AST line numbers and - column offsets that constituted a regression. - -- Issue #22986: Allow changing an object's __class__ between a dynamic type and - static type in some cases. - -- Issue #15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and - PyUnicode_EncodeCodePage() now raise an exception if the object is not a - Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on - platforms other than Windows. Patch written by Campbell Barton. - -- Issue #21408: The default __ne__() now returns NotImplemented if __eq__() - returned NotImplemented. Original patch by Martin Panter. - -- Issue #23321: Fixed a crash in str.decode() when error handler returned - replacment string longer than mailformed input data. - -- Issue #22286: The "backslashreplace" error handlers now works with - decoding and translating. - -- Issue #23253: Delay-load ShellExecute[AW] in os.startfile for reduced - startup overhead on Windows. - -- Issue #22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for - atomic memory access if available. Patch written by Vitor de Lima and Gustavo - Temple. - -- Issue #20284: %-interpolation (aka printf) formatting added for bytes and - bytearray. - -- Issue #23048: Fix jumping out of an infinite while loop in the pdb. - -- Issue #20335: bytes constructor now raises TypeError when encoding or errors - is specified with non-string argument. Based on patch by Renaud Blanch. - -- Issue #22834: If the current working directory ends up being set to a - non-existent directory then import will no longer raise FileNotFoundError. - -- Issue #22869: Move the interpreter startup & shutdown code to a new - dedicated pylifecycle.c module - -- Issue #22847: Improve method cache efficiency. - -- Issue #22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff - bytes on a 32-bit platform. - -- Issue #22653: Fix an assertion failure in debug mode when doing a reentrant - dict insertion in debug mode. - -- Issue #22643: Fix integer overflow in Unicode case operations (upper, lower, - title, swapcase, casefold). - -- Issue #17636: Circular imports involving relative imports are now - supported. - -- Issue #22604: Fix assertion error in debug mode when dividing a complex - number by (nan+0j). - -- Issue #21052: Do not raise ImportWarning when sys.path_hooks or sys.meta_path - are set to None. - -- Issue #16518: Use 'bytes-like object required' in error messages that - previously used the far more cryptic "'x' does not support the buffer - protocol. - -- Issue #22470: Fixed integer overflow issues in "backslashreplace", - "xmlcharrefreplace", and "surrogatepass" error handlers. - -- Issue #22540: speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the - common case that the second argument has metaclass `type`. - -- Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` - but accepting a `va_list` argument. - -- Issue #22520: Fix overflow checking when generating the repr of a unicode - object. - -- Issue #22519: Fix overflow checking in PyBytes_Repr. - -- Issue #22518: Fix integer overflow issues in latin-1 encoding. - -- Issue #16324: _charset parameter of MIMEText now also accepts - email.charset.Charset instances. Initial patch by Claude Paroz. - -- Issue #1764286: Fix inspect.getsource() to support decorated functions. - Patch by Claudiu Popa. - -- Issue #18554: os.__all__ includes posix functions. - -- Issue #21391: Use os.path.abspath in the shutil module. - -- Issue #11471: avoid generating a JUMP_FORWARD instruction at the end of - an if-block if there is no else-clause. Original patch by Eugene Toder. - -- Issue #22215: Now ValueError is raised instead of TypeError when str or bytes - argument contains not permitted null character or byte. - -- Issue #22258: Fix the internal function set_inheritable() on Illumos. - This platform exposes the function ``ioctl(FIOCLEX)``, but calling it fails - with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() - now falls back to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``). - -- Issue #21389: Displaying the __qualname__ of the underlying function in the - repr of a bound method. - -- Issue #22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM - and returns -1 (error) on integer overflow. - -- Issue #20184: Argument Clinic based signature introspection added for - 30 of the builtin functions. - -- Issue #22116: C functions and methods (of the 'builtin_function_or_method' - type) can now be weakref'ed. Patch by Wei Wu. - -- Issue #22077: Improve index error messages for bytearrays, bytes, lists, - and tuples by adding 'or slices'. Added ', not ' for bytearrays. - Original patch by Claudiu Popa. - -- Issue #20179: Apply Argument Clinic to bytes and bytearray. - Patch by Tal Einat. - -- Issue #22082: Clear interned strings in slotdefs. - -- Upgrade Unicode database to Unicode 7.0.0. - -- Issue #21897: Fix a crash with the f_locals attribute with closure - variables when frame.clear() has been called. - -- Issue #21205: Add a new ``__qualname__`` attribute to generator, the - qualified name, and use it in the representation of a generator - (``repr(gen)``). The default name of the generator (``__name__`` attribute) - is now get from the function instead of the code. Use ``gen.gi_code.co_name`` - to get the name of the code. - -- Issue #21669: With the aid of heuristics in SyntaxError.__init__, the - parser now attempts to generate more meaningful (or at least more search - engine friendly) error messages when "exec" and "print" are used as - statements. - -- Issue #21642: In the conditional if-else expression, allow an integer written - with no space between itself and the ``else`` keyword (e.g. ``True if 42else - False``) to be valid syntax. - -- Issue #21523: Fix over-pessimistic computation of the stack effect of - some opcodes in the compiler. This also fixes a quadratic compilation - time issue noticeable when compiling code with a large number of "and" - and "or" operators. - -- Issue #21418: Fix a crash in the builtin function super() when called without - argument and without current frame (ex: embedded Python). - -- Issue #21425: Fix flushing of standard streams in the interactive - interpreter. - -- Issue #21435: In rare cases, when running finalizers on objects in cyclic - trash a bad pointer dereference could occur due to a subtle flaw in - internal iteration logic. - -- Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the - first argument has a reference count of 1. Patch by Nikolaus Rath. - -- Issue #20355: -W command line options now have higher priority than the - PYTHONWARNINGS environment variable. Patch by Arfrever. - -- Issue #21274: Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. - -- Issue #20904: Support setting FPU precision on m68k. - -- Issue #21209: Fix sending tuples to custom generator objects with the yield - from syntax. - -- Issue #21193: pow(a, b, c) now raises ValueError rather than TypeError when b - is negative. Patch by Josh Rosenberg. - -- PEP 465 and Issue #21176: Add the '@' operator for matrix multiplication. - -- Issue #21134: Fix segfault when str is called on an uninitialized - UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object. - -- Issue #19537: Fix PyUnicode_DATA() alignment under m68k. Patch by - Andreas Schwab. - -- Issue #20929: Add a type cast to avoid shifting a negative number. - -- Issue #20731: Properly position in source code files even if they - are opened in text mode. Patch by Serhiy Storchaka. - -- Issue #20637: Key-sharing now also works for instance dictionaries of - subclasses. Patch by Peter Ingebretson. - -- Issue #8297: Attributes missing from modules now include the module name - in the error text. Original patch by ysj.ray. - -- Issue #19995: %c, %o, %x, and %X now raise TypeError on non-integer input. - -- Issue #19655: The ASDL parser - used by the build process to generate code for - managing the Python AST in C - was rewritten. The new parser is self contained - and does not require to carry long the spark.py parser-generator library; - spark.py was removed from the source base. - -- Issue #12546: Allow ``\x00`` to be used as a fill character when using str, int, - float, and complex __format__ methods. - -- Issue #20480: Add ipaddress.reverse_pointer. Patch by Leon Weber. - -- Issue #13598: Modify string.Formatter to support auto-numbering of - replacement fields. It now matches the behavior of str.format() in - this regard. Patches by Phil Elson and Ramchandra Apte. - -- Issue #8931: Make alternate formatting ('#') for type 'c' raise an - exception. In versions prior to 3.5, '#' with 'c' had no effect. Now - specifying it is an error. Patch by Torsten Landschoff. - -- Issue #23165: Perform overflow checks before allocating memory in the - _Py_char2wchar function. - -Library -------- - -- Issue #23399: pyvenv creates relative symlinks where possible. - -- Issue #20289: cgi.FieldStorage() now supports the context management - protocol. - -- Issue #13128: Print response headers for CONNECT requests when debuglevel - > 0. Patch by Demian Brecht. - -- Issue #15381: Optimized io.BytesIO to make less allocations and copyings. - -- Issue #22818: Splitting on a pattern that could match an empty string now - raises a warning. Patterns that can only match empty strings are now - rejected. - -- Issue #23099: Closing io.BytesIO with exported buffer is rejected now to - prevent corrupting exported buffer. - -- Issue #23326: Removed __ne__ implementations. Since fixing default __ne__ - implementation in issue #21408 they are redundant. - -- Issue #23363: Fix possible overflow in itertools.permutations. - -- Issue #23364: Fix possible overflow in itertools.product. - -- Issue #23366: Fixed possible integer overflow in itertools.combinations. - -- Issue #23369: Fixed possible integer overflow in - _json.encode_basestring_ascii. - -- Issue #23353: Fix the exception handling of generators in - PyEval_EvalFrameEx(). At entry, save or swap the exception state even if - PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception state - is now always restored or swapped, not only if why is WHY_YIELD or - WHY_RETURN. Patch co-written with Antoine Pitrou. - -- Issue #14099: Restored support of writing ZIP files to tellable but - non-seekable streams. - -- Issue #14099: Writing to ZipFile and reading multiple ZipExtFiles is - threadsafe now. - -- Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError. - -- Issue #18518: timeit now rejects statements which can't be compiled outside - a function or a loop (e.g. "return" or "break"). - -- Issue #23094: Fixed readline with frames in Python implementation of pickle. - -- Issue #23268: Fixed bugs in the comparison of ipaddress classes. - -- Issue #21408: Removed incorrect implementations of __ne__() which didn't - returned NotImplemented if __eq__() returned NotImplemented. The default - __ne__() now works correctly. - -- Issue #19996: :class:`email.feedparser.FeedParser` now handles (malformed) - headers with no key rather than assuming the body has started. - -- Issue #20188: Support Application-Layer Protocol Negotiation (ALPN) in the ssl - module. - -- Issue #23133: Pickling of ipaddress objects now produces more compact and - portable representation. - -- Issue #23248: Update ssl error codes from latest OpenSSL git master. - -- Issue #23266: Much faster implementation of ipaddress.collapse_addresses() - when there are many non-consecutive addresses. - -- Issue #23098: 64-bit dev_t is now supported in the os module. - -- Issue #21817: When an exception is raised in a task submitted to a - ProcessPoolExecutor, the remote traceback is now displayed in the - parent process. Patch by Claudiu Popa. - -- Issue #15955: Add an option to limit output size when decompressing LZMA - data. Patch by Nikolaus Rath and Martin Panter. - -- Issue #23250: In the http.cookies module, capitalize "HttpOnly" and "Secure" - as they are written in the standard. - -- Issue #23063: In the disutils' check command, fix parsing of reST with code or - code-block directives. - -- Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a - RuntimeError if the selector is closed. And selectors.BaseSelector.close() - now clears its internal reference to the selector mapping to break a - reference cycle. Initial patch written by Martin Richard. - -- Issue #17911: Provide a way to seed the linecache for a PEP-302 module - without actually loading the code. - -- Issue #17911: Provide a new object API for traceback, including the ability - to not lookup lines at all until the traceback is actually rendered, without - any trace of the original objects being kept alive. - -- Issue #19777: Provide a home() classmethod on Path objects. Contributed - by Victor Salgado and Mayank Tripathi. - -- Issue #23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the - default case of ``ensure_ascii=True``. Patch by Naoki Inada. - -- Issue #23185: Add math.inf and math.nan constants. - -- Issue #23186: Add ssl.SSLObject.shared_ciphers() and - ssl.SSLSocket.shared_ciphers() to fetch the client's list ciphers sent at - handshake. - -- Issue #23143: Remove compatibility with OpenSSLs older than 0.9.8. - -- Issue #23132: Improve performance and introspection support of comparison - methods created by functool.total_ordering. - -- Issue #19776: Add an expanduser() method on Path objects. - -- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and - fragment when it redirects to add a trailing slash. - -- Issue #21793: Added http.HTTPStatus enums (i.e. HTTPStatus.OK, - HTTPStatus.NOT_FOUND). Patch by Demian Brecht. - -- Issue #23093: In the io, module allow more operations to work on detached - streams. - -- Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol - version. - -- Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), - instead of reading /dev/urandom, to get pseudo-random bytes. - -- Issue #19104: pprint now produces evaluable output for wrapped strings. - -- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. - -- Issue #22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX - opcode if possible. - -- Issue #15513: Added a __sizeof__ implementation for pickle classes. - -- Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can - produce more compact result and no longer produces invalid output if input - data contains MEMOIZE opcodes together with PUT or BINPUT opcodes. - -- Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port - value in the host header was set to "None". Patch by Demian Brecht. - -- Issue #23016: A warning no longer produces an AttributeError when the program - is run with pythonw.exe. - -- Issue #21775: shutil.copytree(): fix crash when copying to VFAT. An exception - handler assumed that OSError objects always have a 'winerror' attribute. - That is not the case, so the exception handler itself raised AttributeError - when run on Linux (and, presumably, any other non-Windows OS). - Patch by Greg Ward. - -- Issue #1218234: Fix inspect.getsource() to load updated source of - reloaded module. Initial patch by Berker Peksag. - -- Issue #21740: Support wrapped callables in doctest. Patch by Claudiu Popa. - -- Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no - FD is registered. - -- Issue #22959: In the constructor of http.client.HTTPSConnection, prefer the - context's check_hostname attribute over the *check_hostname* parameter. - -- Issue #22696: Add function :func:`sys.is_finalizing` to know about - interpreter shutdown. - -- Issue #16043: Add a default limit for the amount of data xmlrpclib.gzip_decode - will return. This resolves CVE-2013-1753. - -- Issue #14099: ZipFile.open() no longer reopen the underlying file. Objects - returned by ZipFile.open() can now operate independently of the ZipFile even - if the ZipFile was created by passing in a file-like object as the first - argument to the constructor. - -- Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is - asked to compile a source file containing multiple dots in the source file - name. - -- Issue #21971: Update turtledemo doc and add module to the index. - -- Issue #21032: Fixed socket leak if HTTPConnection.getresponse() fails. - Original patch by Martin Panter. - -- Issue #22407: Deprecated the use of re.LOCALE flag with str patterns or - re.ASCII. It was newer worked. - -- Issue #22902: The "ip" command is now used on Linux to determine MAC address - in uuid.getnode(). Pach by Bruno Cauet. - -- Issue #22960: Add a context argument to xmlrpclib.ServerProxy constructor. - -- Issue #22389: Add contextlib.redirect_stderr(). - -- Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The - availability of the function is checked during the compilation. Patch written - by Bernard Spil. - -- Issue #22915: SAX parser now supports files opened with file descriptor or - bytes path. - -- Issue #22609: Constructors and update methods of mapping classes in the - collections module now accept the self keyword argument. - -- Issue #22940: Add readline.append_history_file. - -- Issue #19676: Added the "namereplace" error handler. - -- Issue #22788: Add *context* parameter to logging.handlers.HTTPHandler. - -- Issue #22921: Allow SSLContext to take the *hostname* parameter even if - OpenSSL doesn't support SNI. - -- Issue #22894: TestCase.subTest() would cause the test suite to be stopped - when in failfast mode, even in the absence of failures. - -- Issue #22796: HTTP cookie parsing is now stricter, in order to protect - against potential injection attacks. - -- Issue #22370: Windows detection in pathlib is now more robust. - -- Issue #22841: Reject coroutines in asyncio add_signal_handler(). - Patch by Ludovic.Gasc. - -- Issue #19494: Added urllib.request.HTTPBasicPriorAuthHandler. Patch by - Matej Cepl. - -- Issue #22578: Added attributes to the re.error class. - -- Issue #22849: Fix possible double free in the io.TextIOWrapper constructor. - -- Issue #12728: Different Unicode characters having the same uppercase but - different lowercase are now matched in case-insensitive regular expressions. - -- Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian - platforms. - -- Issue #21650: Add an `--sort-keys` option to json.tool CLI. - -- Issue #22824: Updated reprlib output format for sets to use set literals. - Patch contributed by Berker Peksag. - -- Issue #22824: Updated reprlib output format for arrays to display empty - arrays without an unnecessary empty list. Suggested by Serhiy Storchaka. - -- Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x. - Based on patch by Martin Panter. - -- Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat. - Based on patch by Aivars Kalv?ns. - -- Issue #22769: Fixed ttk.Treeview.tag_has() when called without arguments. - -- Issue #22417: Verify certificates by default in httplib (PEP 476). - -- Issue #22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2 - and above. Patch by Tim Graham. - -- Issue #22776: Brought excluded code into the scope of a try block in - SysLogHandler.emit(). - -- Issue #22665: Add missing get_terminal_size and SameFileError to - shutil.__all__. - -- Issue #6623: Remove deprecated Netrc class in the ftplib module. Patch by - Matt Chaput. - -- Issue #17381: Fixed handling of case-insensitive ranges in regular - expressions. - -- Issue #22410: Module level functions in the re module now cache compiled - locale-dependent regular expressions taking into account the locale. - -- Issue #22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) - now return False when the underlying stat call raises NotADirectoryError. - -- Issue #8876: distutils now falls back to copying files when hard linking - doesn't work. This allows use with special filesystems such as VirtualBox - shared folders. - -- Issue #22217: Implemented reprs of classes in the zipfile module. - -- Issue #22457: Honour load_tests in the start_dir of discovery. - -- Issue #18216: gettext now raises an error when a .mo file has an - unsupported major version number. Patch by Aaron Hill. - -- Issue #13918: Provide a locale.delocalize() function which can remove - locale-specific number formatting from a string representing a number, - without then converting it to a specific type. Patch by C?dric Krier. - -- Issue #22676: Make the pickling of global objects which don't have a - __module__ attribute less slow. - -- Issue #18853: Fixed ResourceWarning in shlex.__nain__. - -- Issue #9351: Defaults set with set_defaults on an argparse subparser - are no longer ignored when also set on the parent parser. - -- Issue #7559: unittest test loading ImportErrors are reported as import errors - with their import exception rather than as attribute errors after the import - has already failed. - -- Issue #19746: Make it possible to examine the errors from unittest - discovery without executing the test suite. The new `errors` attribute - on TestLoader exposes these non-fatal errors encountered during discovery. - -- Issue #21991: Make email.headerregistry's header 'params' attributes - be read-only (MappingProxyType). Previously the dictionary was modifiable - but a new one was created on each access of the attribute. - -- Issue #22638: SSLv3 is now disabled throughout the standard library. - It can still be enabled by instantiating a SSLContext manually. - -- Issue #22641: In asyncio, the default SSL context for client connections - is now created using ssl.create_default_context(), for stronger security. - -- Issue #17401: Include closefd in io.FileIO repr. - -- Issue #21338: Add silent mode for compileall. quiet parameters of - compile_{dir, file, path} functions now have a multilevel value. Also, - -q option of the CLI now have a multilevel value. Patch by Thomas Kluyver. - -- Issue #20152: Convert the array and cmath modules to Argument Clinic. - -- Issue #18643: Add socket.socketpair() on Windows. - -- Issue #22435: Fix a file descriptor leak when socketserver bind fails. - -- Issue #13096: Fixed segfault in CTypes POINTER handling of large - values. - -- Issue #11694: Raise ConversionError in xdrlib as documented. Patch - by Filip Gruszczy?ski and Claudiu Popa. - -- Issue #19380: Optimized parsing of regular expressions. - -- Issue #1519638: Now unmatched groups are replaced with empty strings in re.sub() - and re.subn(). - -- Issue #18615: sndhdr.what/whathdr now return a namedtuple. - -- Issue #22462: Fix pyexpat's creation of a dummy frame to make it - appear in exception tracebacks. - -- Issue #21965: Add support for in-memory SSL to the ssl module. Patch - by Geert Jansen. - -- Issue #21173: Fix len() on a WeakKeyDictionary when .clear() was called - with an iterator alive. - -- Issue #11866: Eliminated race condition in the computation of names - for new threads. - -- Issue #21905: Avoid RuntimeError in pickle.whichmodule() when sys.modules - is mutated while iterating. Patch by Olivier Grisel. - -- Issue #11271: concurrent.futures.Executor.map() now takes a *chunksize* - argument to allow batching of tasks in child processes and improve - performance of ProcessPoolExecutor. Patch by Dan O'Reilly. - -- Issue #21883: os.path.join() and os.path.relpath() now raise a TypeError with - more helpful error message for unsupported or mismatched types of arguments. - -- Issue #22219: The zipfile module CLI now adds entries for directories - (including empty directories) in ZIP file. - -- Issue #22449: In the ssl.SSLContext.load_default_certs, consult the - environmental variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. - -- Issue #22508: The email.__version__ variable has been removed; the email - code is no longer shipped separately from the stdlib, and __version__ - hasn't been updated in several releases. - -- Issue #20076: Added non derived UTF-8 aliases to locale aliases table. - -- Issue #20079: Added locales supported in glibc 2.18 to locale alias table. - -- Issue #20218: Added convenience methods read_text/write_text and read_bytes/ - write_bytes to pathlib.Path objects. - -- Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor - os.posix_fallocate() because their prototypes in system headers are wrong. - -- Issue #22517: When an io.BufferedRWPair object is deallocated, clear its - weakrefs. - -- Issue #22437: Number of capturing groups in regular expression is no longer - limited by 100. - -- Issue #17442: InteractiveInterpreter now displays the full chained traceback - in its showtraceback method, to match the built in interactive interpreter. - -- Issue #23392: Added tests for marshal C API that works with FILE*. - - -- Issue #10510: distutils register and upload methods now use HTML standards - compliant CRLF line endings. - -- Issue #9850: Fixed macpath.join() for empty first component. Patch by - Oleg Oshmyan. - -- Issue #5309: distutils' build and build_ext commands now accept a ``-j`` - option to enable parallel building of extension modules. - -- Issue #22448: Improve canceled timer handles cleanup to prevent - unbound memory usage. Patch by Joshua Moore-Oliva. - -- Issue #22427: TemporaryDirectory no longer attempts to clean up twice when - used in the with statement in generator. - -- Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in - regular expressions. - -- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS - directory attributes. - -- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory - records if allowZip64 is false. - -- Issue #22278: Fix urljoin problem with relative urls, a regression observed - after changes to issue22118 were submitted. - -- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re - module. Removed trailing spaces in debugging output. - -- Issue #22423: Unhandled exception in thread no longer causes unhandled - AttributeError when sys.stderr is None. - -- Issue #21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects - line buffering, rather than block buffering. Patch by Akira Li. - -- Issue #21091: Fix API bug: email.message.EmailMessage.is_attachment is now - a method. - -- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the - correct result when the header has parameters as well as a value. - -- Issue #22247: Add NNTPError to nntplib.__all__. - -- Issue #22366: urllib.request.urlopen will accept a context object - (SSLContext) as an argument which will then be used for HTTPS connection. - Patch by Alex Gaynor. - -- Issue #4180: The warnings registries are now reset when the filters - are modified. - -- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to - 65536 bytes and send a 414 error code for higher lengths. Patch contributed - by Devin Cook. - -- Lax cookie parsing in http.cookies could be a security issue when combined - with non-standard cookie handling in some Web browsers. Reported by - Sergey Bobrov. - -- Issue #20537: logging methods now accept an exception instance as well as a - Boolean value or exception tuple. Thanks to Yury Selivanov for the patch. - -- Issue #22384: An exception in Tkinter callback no longer crashes the program - when it is run with pythonw.exe. - -- Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X. - -- Issue #21147: sqlite3 now raises an exception if the request contains a null - character instead of truncating it. Based on patch by Victor Stinner. - -- Issue #13968: The glob module now supports recursive search in - subdirectories using the ``**`` pattern. - -- Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with - empty string or tuple argument. - -- Issue #21951: Tkinter now most likely raises MemoryError instead of crash - if the memory allocation fails. - -- Issue #22338: Fix a crash in the json module on memory allocation failure. - -- Issue #12410: imaplib.IMAP4 now supports the context management protocol. - Original patch by Tarek Ziad?. - -- Issue #21270: We now override tuple methods in mock.call objects so that - they can be used as normal call attributes. - -- Issue #16662: load_tests() is now unconditionally run when it is present in - a package's __init__.py. TestLoader.loadTestsFromModule() still accepts - use_load_tests, but it is deprecated and ignored. A new keyword-only - attribute `pattern` is added and documented. Patch given by Robert Collins, - tweaked by Barry Warsaw. - -- Issue #22226: First letter no longer is stripped from the "status" key in - the result of Treeview.heading(). - -- Issue #19524: Fixed resource leak in the HTTP connection when an invalid - response is received. Patch by Martin Panter. - -- Issue #20421: Add a .version() method to SSL sockets exposing the actual - protocol version in use. - -- Issue #19546: configparser exceptions no longer expose implementation details. - Chained KeyErrors are removed, which leads to cleaner tracebacks. Patch by - Claudiu Popa. - -- Issue #22051: turtledemo no longer reloads examples to re-run them. - Initialization of variables and gui setup should be done in main(), - which is called each time a demo is run, but not on import. - -- Issue #21933: Turtledemo users can change the code font size with a menu - selection or control(command) '-' or '+' or control-mousewheel. - Original patch by Lita Cho. - -- Issue #21597: The separator between the turtledemo text pane and the drawing - canvas can now be grabbed and dragged with a mouse. The code text pane can - be widened to easily view or copy the full width of the text. The canvas - can be widened on small screens. Original patches by Jan Kanis and Lita Cho. - -- Issue #18132: Turtledemo buttons no longer disappear when the window is - shrunk. Original patches by Jan Kanis and Lita Cho. - -- Issue #22043: time.monotonic() is now always available. - ``threading.Lock.acquire()``, ``threading.RLock.acquire()`` and socket - operations now use a monotonic clock, instead of the system clock, when a - timeout is used. - -- Issue #21527: Add a default number of workers to ThreadPoolExecutor equal - to 5 times the number of CPUs. Patch by Claudiu Popa. - -- Issue #22216: smtplib now resets its state more completely after a quit. The - most obvious consequence of the previous behavior was a STARTTLS failure - during a connect/starttls/quit/connect/starttls sequence. - -- Issue #22098: ctypes' BigEndianStructure and LittleEndianStructure now - define an empty __slots__ so that subclasses don't always get an instance - dict. Patch by Claudiu Popa. - -- Issue #22185: Fix an occasional RuntimeError in threading.Condition.wait() - caused by mutation of the waiters queue without holding the lock. Patch - by Doug Zongker. - -- Issue #22287: On UNIX, _PyTime_gettimeofday() now uses - clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now - depends on the librt library on Solaris and on Linux (only with glibc older - than 2.17). - -- Issue #22182: Use e.args to unpack exceptions correctly in - distutils.file_util.move_file. Patch by Claudiu Popa. - -- The webbrowser module now uses subprocess's start_new_session=True rather - than a potentially risky preexec_fn=os.setsid call. - -- Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file - descriptor is in blocking mode. - -- Issue #16808: inspect.stack() now returns a named tuple instead of a tuple. - Patch by Daniel Shahaf. - -- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode. - -- Issue #2527: Add a *globals* argument to timeit functions, in order to - override the globals namespace in which the timed code is executed. - Patch by Ben Roberts. - -- Issue #22118: Switch urllib.parse to use RFC 3986 semantics for the - resolution of relative URLs, rather than RFCs 1808 and 2396. - Patch by Demian Brecht. - -- Issue #21549: Added the "members" parameter to TarFile.list(). - -- Issue #19628: Allow compileall recursion depth to be specified with a -r - option. - -- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. - -- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter. - -- Issue #22165: SimpleHTTPRequestHandler now supports undecodable file names. - -- Issue #15381: Optimized line reading in io.BytesIO. - -- Issue #8797: Raise HTTPError on failed Basic Authentication immediately. - Initial patch by Sam Bull. - -- Issue #20729: Restored the use of lazy iterkeys()/itervalues()/iteritems() - in the mailbox module. - -- Issue #21448: Changed FeedParser feed() to avoid O(N**2) behavior when - parsing long line. Original patch by Raymond Hettinger. - -- Issue #22184: The functools LRU Cache decorator factory now gives an earlier - and clearer error message when the user forgets the required parameters. - -- Issue #17923: glob() patterns ending with a slash no longer match non-dirs on - AIX. Based on patch by Delhallt. - -- Issue #21725: Added support for RFC 6531 (SMTPUTF8) in smtpd. - -- Issue #22176: Update the ctypes module's libffi to v3.1. This release - adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian - architectures. - -- Issue #5411: Added support for the "xztar" format in the shutil module. - -- Issue #21121: Don't force 3rd party C extensions to be built with - -Werror=declaration-after-statement. - -- Issue #21975: Fixed crash when using uninitialized sqlite3.Row (in particular - when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the - __new__() method. - -- Issue #20170: Convert posixmodule to use Argument Clinic. - -- Issue #21539: Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic - `mkdir -p` and `os.makedirs()` functionality. When true, ignore - FileExistsErrors. Patch by Berker Peksag. - -- Issue #22127: Bypass IDNA for pure-ASCII host names in the socket module - (in particular for numeric IPs). - -- Issue #21047: set the default value for the *convert_charrefs* argument - of HTMLParser to True. Patch by Berker Peksag. - -- Add an __all__ to html.entities. - -- Issue #15114: the strict mode and argument of HTMLParser, HTMLParser.error, - and the HTMLParserError exception have been removed. - -- Issue #22085: Dropped support of Tk 8.3 in Tkinter. - -- Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk. - In particular this allows initializing images from binary data. - -- Issue #22003: When initialized from a bytes object, io.BytesIO() now - defers making a copy until it is mutated, improving performance and - memory use on some use cases. Patch by David Wilson. - -- Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets. - A side effect is that Python depends to the WinSock library. - -- Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get - and set the blocking mode of a file descriptor (False if the O_NONBLOCK flag - is set, True otherwise). These functions are not available on Windows. - -- Issue #17172: Make turtledemo start as active on OS X even when run with - subprocess. Patch by Lita Cho. - -- Issue #21704: Fix build error for _multiprocessing when semaphores - are not available. Patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #20173: Convert sha1, sha256, sha512 and md5 to ArgumentClinic. - Patch by Vajrasky Kok. - -- Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError - on closed socket. repr(socket.socket) already works fine. - -- Issue #22033: Reprs of most Python implemened classes now contain actual - class name instead of hardcoded one. - -- Issue #21947: The dis module can now disassemble generator-iterator - objects based on their gi_code attribute. Patch by Clement Rouault. - -- Issue #16133: The asynchat.async_chat.handle_read() method now ignores - BlockingIOError exceptions. - -- Issue #22044: Fixed premature DECREF in call_tzinfo_method. - Patch by Tom Flanagan. - -- Issue #19884: readline: Disable the meta modifier key if stdout is not - a terminal to not write the ANSI sequence ``"\033[1034h"`` into stdout. This - sequence is used on some terminal (ex: TERM=xterm-256color") to enable - support of 8 bit characters. - -- Issue #4350: Removed a number of out-of-dated and non-working for a long time - Tkinter methods. - -- Issue #6167: Scrollbar.activate() now returns the name of active element if - the argument is not specified. Scrollbar.set() now always accepts only 2 - arguments. - -- Issue #15275: Clean up and speed up the ntpath module. - -- Issue #21888: plistlib's load() and loads() now work if the fmt parameter is - specified. - -- Issue #22032: __qualname__ instead of __name__ is now always used to format - fully qualified class names of Python implemented classes. - -- Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix - when contain an id in form " at 0x...". - -- Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a - ValueError on ``fstat()`` failure. - -- Issue #21044: tarfile.open() now handles fileobj with an integer 'name' - attribute. Based on patch by Antoine Pietri. - -- Issue #21966: Respect -q command-line option when code module is ran. - -- Issue #19076: Don't pass the redundant 'file' argument to self.error(). - -- Issue #16382: Improve exception message of warnings.warn() for bad - category. Initial patch by Phil Elson. - -- Issue #21932: os.read() now uses a :c:func:`Py_ssize_t` type instead of - :c:type:`int` for the size to support reading more than 2 GB at once. On - Windows, the size is truncted to INT_MAX. As any call to os.read(), the OS - may read less bytes than the number of requested bytes. - -- Issue #21942: Fixed source file viewing in pydoc's server mode on Windows. - -- Issue #11259: asynchat.async_chat().set_terminator() now raises a ValueError - if the number of received bytes is negative. - -- Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't - get a bytes string - -- Issue #21707: Add missing kwonlyargcount argument to - ModuleFinder.replace_paths_in_code(). - -- Issue #20639: calling Path.with_suffix('') allows removing the suffix - again. Patch by July Tikhonov. - -- Issue #21714: Disallow the construction of invalid paths using - Path.with_name(). Original patch by Antony Lee. - -- Issue #15014: Added 'auth' method to smtplib to make implementing auth - mechanisms simpler, and used it internally in the login method. - -- Issue #21151: Fixed a segfault in the winreg module when ``None`` is passed - as a ``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. - -- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before, - it ignored I/O errors if at least the first C call read() succeed. - -- Issue #5800: headers parameter of wsgiref.headers.Headers is now optional. - Initial patch by Pablo Torres Navarrete and SilentGhost. - -- Issue #21781: ssl.RAND_add() now supports strings longer than 2 GB. - -- Issue #21679: Prevent extraneous fstat() calls during open(). Patch by - Bohuslav Kabrda. - -- Issue #21863: cProfile now displays the module name of C extension functions, - in addition to their own name. - -- Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper - object is destroyed. The destructor now closes the file if needed. The - close() method can now be called twice: the second call does nothing. - -- Issue #21858: Better handling of Python exceptions in the sqlite3 module. - -- Issue #21476: Make sure the email.parser.BytesParser TextIOWrapper is - discarded after parsing, so the input file isn't unexpectedly closed. - -- Issue #20295: imghdr now recognizes OpenEXR format images. - -- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure - files closing. Patch by Claudiu Popa. - -- Issue #21491: socketserver: Fix a race condition in child processes reaping. - -- Issue #21719: Added the ``st_file_attributes`` field to os.stat_result on - Windows. - -- Issue #21832: Require named tuple inputs to be exact strings. - -- Issue #21722: The distutils "upload" command now exits with a non-zero - return code when uploading fails. Patch by Martin Dengler. - -- Issue #21723: asyncio.Queue: support any type of number (ex: float) for the - maximum size. Patch written by Vajrasky Kok. - -- Issue #21711: support for "site-python" directories has now been removed - from the site module (it was deprecated in 3.4). - -- Issue #17552: new socket.sendfile() method allowing a file to be sent over a - socket by using high-performance os.sendfile() on UNIX. - Patch by Giampaolo Rodola'. - -- Issue #18039: dbm.dump.open() now always creates a new database when the - flag has the value 'n'. Patch by Claudiu Popa. - -- Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoop. - run_forever() and run_until_complete() methods of asyncio.BaseEventLoop now - raise an exception if the event loop was closed. - -- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths - before checking for a CGI script at that path. - -- Issue #21310: Fixed possible resource leak in failed open(). - -- Issue #21256: Printout of keyword args should be in deterministic order in - a mock function call. This will help to write better doctests. - -- Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. - -- Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a - valid file. - -- Issue #21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. - -- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods - that use 'self' in the example code is generated correctly. - -- Issue #21463: In urllib.request, fix pruning of the FTP cache. - -- Issue #21618: The subprocess module could fail to close open fds that were - inherited by the calling process and already higher than POSIX resource - limits would otherwise allow. On systems with a functioning /proc/self/fd - or /dev/fd interface the max is now ignored and all fds are closed. - -- Issue #20383: Introduce importlib.util.module_from_spec() as the preferred way - to create a new module. - -- Issue #21552: Fixed possible integer overflow of too long string lengths in - the tkinter module on 64-bit platforms. - -- Issue #14315: The zipfile module now ignores extra fields in the central - directory that are too short to be parsed instead of letting a struct.unpack - error bubble up as this "bad data" appears in many real world zip files in - the wild and is ignored by other zip tools. - -- Issue #13742: Added "key" and "reverse" parameters to heapq.merge(). - (First draft of patch contributed by Simon Sapin.) - -- Issue #21402: tkinter.ttk now works when default root window is not set. - -- Issue #3015: _tkinter.create() now creates tkapp object with wantobject=1 by - default. - -- Issue #10203: sqlite3.Row now truly supports sequence protocol. In particular - it supports reverse() and negative indices. Original patch by Claudiu Popa. - -- Issue #18807: If copying (no symlinks) specified for a venv, then the python - interpreter aliases (python, python3) are now created by copying rather than - symlinking. - -- Issue #20197: Added support for the WebP image type in the imghdr module. - Patch by Fabrice Aneche and Claudiu Popa. - -- Issue #21513: Speedup some properties of IP addresses (IPv4Address, - IPv6Address) such as .is_private or .is_multicast. - -- Issue #21137: Improve the repr for threading.Lock() and its variants - by showing the "locked" or "unlocked" status. Patch by Berker Peksag. - -- Issue #21538: The plistlib module now supports loading of binary plist files - when reference or offset size is not a power of two. - -- Issue #21455: Add a default backlog to socket.listen(). - -- Issue #21525: Most Tkinter methods which accepted tuples now accept lists too. - -- Issue #22166: With the assistance of a new internal _codecs._forget_codec - helping function, test_codecs now clears the encoding caches to avoid the - appearance of a reference leak - -- Issue #22236: Tkinter tests now don't reuse default root window. New root - window is created for every test class. - -- Issue #10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial - shape. - -- Issue #20826: Optimize ipaddress.collapse_addresses(). - -- Issue #21487: Optimize ipaddress.summarize_address_range() and - ipaddress.{IPv4Network,IPv6Network}.subnets(). - -- Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and - ipaddress.IPv6Network. - -- Issue #13916: Disallowed the surrogatepass error handler for non UTF-\* - encodings. - -- Issue #20998: Fixed re.fullmatch() of repeated single character pattern - with ignore case. Original patch by Matthew Barnett. - -- Issue #21075: fileinput.FileInput now reads bytes from standard stream if - binary mode is specified. Patch by Sam Kimbrel. - -- Issue #19775: Add a samefile() method to pathlib Path objects. Initial - patch by Vajrasky Kok. - -- Issue #21226: Set up modules properly in PyImport_ExecCodeModuleObject - (and friends). - -- Issue #21398: Fix a unicode error in the pydoc pager when the documentation - contains characters not encodable to the stdout encoding. - -- Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept - an (address, netmask) tuple argument, so as to easily construct network - objects from existing addresses. - -- Issue #21156: importlib.abc.InspectLoader.source_to_code() is now a - staticmethod. - -- Issue #21424: Simplified and optimized heaqp.nlargest() and nmsmallest() - to make fewer tuple comparisons. - -- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a - flush() on the underlying binary stream. Patch by akira. - -- Issue #18314: Unlink now removes junctions on Windows. Patch by Kim Gr?sman - -- Issue #21088: Bugfix for curses.window.addch() regression in 3.4.0. - In porting to Argument Clinic, the first two arguments were reversed. - -- Issue #21407: _decimal: The module now supports function signatures. - -- Issue #10650: Remove the non-standard 'watchexp' parameter from the - Decimal.quantize() method in the Python version. It had never been - present in the C version. - -- Issue #21469: Reduced the risk of false positives in robotparser by - checking to make sure that robots.txt has been read or does not exist - prior to returning True in can_fetch(). - -- Issue #19414: Have the OrderedDict mark deleted links as unusable. - This gives an early failure if the link is deleted during iteration. - -- Issue #21421: Add __slots__ to the MappingViews ABC. - Patch by Josh Rosenberg. - -- Issue #21101: Eliminate double hashing in the C speed-up code for - collections.Counter(). - -- Issue #21321: itertools.islice() now releases the reference to the source - iterator when the slice is exhausted. Patch by Anton Afanasyev. - -- Issue #21057: TextIOWrapper now allows the underlying binary stream's - read() or read1() method to return an arbitrary bytes-like object - (such as a memoryview). Patch by Nikolaus Rath. - -- Issue #20951: SSLSocket.send() now raises either SSLWantReadError or - SSLWantWriteError on a non-blocking socket if the operation would block. - Previously, it would return 0. Patch by Nikolaus Rath. - -- Issue #13248: removed previously deprecated asyncore.dispatcher __getattr__ - cheap inheritance hack. - -- Issue #9815: assertRaises now tries to clear references to local variables - in the exception's traceback. - -- Issue #19940: ssl.cert_time_to_seconds() now interprets the given time - string in the UTC timezone (as specified in RFC 5280), not the local - timezone. - -- Issue #13204: Calling sys.flags.__new__ would crash the interpreter, - now it raises a TypeError. - -- Issue #19385: Make operations on a closed dbm.dumb database always raise the - same exception. - -- Issue #21207: Detect when the os.urandom cached fd has been closed or - replaced, and open it anew. - -- Issue #21291: subprocess's Popen.wait() is now thread safe so that - multiple threads may be calling wait() or poll() on a Popen instance - at the same time without losing the Popen.returncode value. - -- Issue #21127: Path objects can now be instantiated from str subclass - instances (such as ``numpy.str_``). - -- Issue #15002: urllib.response object to use _TemporaryFileWrapper (and - _TemporaryFileCloser) facility. Provides a better way to handle file - descriptor close. Patch contributed by Christian Theune. - -- Issue #12220: mindom now raises a custom ValueError indicating it doesn't - support spaces in URIs instead of letting a 'split' ValueError bubble up. - -- Issue #21068: The ssl.PROTOCOL* constants are now enum members. - -- Issue #21276: posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. - -- Issue #21262: New method assert_not_called for Mock. - It raises AssertionError if the mock has been called. - -- Issue #21238: New keyword argument `unsafe` to Mock. It raises - `AttributeError` incase of an attribute startswith assert or assret. - -- Issue #20896: ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not - PROTOCOL_SSLv3, for maximum compatibility. - -- Issue #21239: patch.stopall() didn't work deterministically when the same - name was patched more than once. - -- Issue #21203: Updated fileConfig and dictConfig to remove inconsistencies. - Thanks to Jure Koren for the patch. - -- Issue #21222: Passing name keyword argument to mock.create_autospec now - works. - -- Issue #21197: Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. - -- Issue #17498: Some SMTP servers disconnect after certain errors, violating - strict RFC conformance. Instead of losing the error code when we issue the - subsequent RSET, smtplib now returns the error code and defers raising the - SMTPServerDisconnected error until the next command is issued. - -- Issue #17826: setting an iterable side_effect on a mock function created by - create_autospec now works. Patch by Kushal Das. - -- Issue #7776: Fix ``Host:`` header and reconnection when using - http.client.HTTPConnection.set_tunnel(). Patch by Nikolaus Rath. - -- Issue #20968: unittest.mock.MagicMock now supports division. - Patch by Johannes Baiter. - -- Issue #21529 (CVE-2014-4616): Fix arbitrary memory access in - JSONDecoder.raw_decode with a negative second parameter. Bug reported by Guido - Vranken. - -- Issue #21169: getpass now handles non-ascii characters that the - input stream encoding cannot encode by re-encoding using the - replace error handler. - -- Issue #21171: Fixed undocumented filter API of the rot13 codec. - Patch by Berker Peksag. - -- Issue #20539: Improved math.factorial error message for large positive inputs - and changed exception type (OverflowError -> ValueError) for large negative - inputs. - -- Issue #21172: isinstance check relaxed from dict to collections.Mapping. - -- Issue #21155: asyncio.EventLoop.create_unix_server() now raises a ValueError - if path and sock are specified at the same time. - -- Issue #21136: Avoid unnecessary normalization of Fractions resulting from - power and other operations. Patch by Raymond Hettinger. - -- Issue #17621: Introduce importlib.util.LazyLoader. - -- Issue #21076: signal module constants were turned into enums. - Patch by Giampaolo Rodola'. - -- Issue #20636: Improved the repr of Tkinter widgets. - -- Issue #19505: The items, keys, and values views of OrderedDict now support - reverse iteration using reversed(). - -- Issue #21149: Improved thread-safety in logging cleanup during interpreter - shutdown. Thanks to Devin Jeanpierre for the patch. - -- Issue #21058: Fix a leak of file descriptor in - :func:`tempfile.NamedTemporaryFile`, close the file descriptor if - :func:`io.open` fails - -- Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing. - -- Issue #21013: Enhance ssl.create_default_context() when used for server side - sockets to provide better security by default. - -- Issue #20145: `assertRaisesRegex` and `assertWarnsRegex` now raise a - TypeError if the second argument is not a string or compiled regex. - -- Issue #20633: Replace relative import by absolute import. - -- Issue #20980: Stop wrapping exception when using ThreadPool. - -- Issue #21082: In os.makedirs, do not set the process-wide umask. Note this - changes behavior of makedirs when exist_ok=True. - -- Issue #20990: Fix issues found by pyflakes for multiprocessing. - -- Issue #21015: SSL contexts will now automatically select an elliptic - curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise - default to "prime256v1". - -- Issue #21000: Improve the command-line interface of json.tool. - -- Issue #20995: Enhance default ciphers used by the ssl module to enable - better security and prioritize perfect forward secrecy. - -- Issue #20884: Don't assume that __file__ is defined on importlib.__init__. - -- Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests. - -- Issue #20627: xmlrpc.client.ServerProxy is now a context manager. - -- Issue #19165: The formatter module now raises DeprecationWarning instead of - PendingDeprecationWarning. - -- Issue #13936: Remove the ability of datetime.time instances to be considered - false in boolean contexts. - -- Issue #18931: selectors module now supports /dev/poll on Solaris. - Patch by Giampaolo Rodola'. - -- Issue #19977: When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), - :py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the - ``surrogateescape`` error handler, instead of the ``strict`` error handler. - -- Issue #20574: Implement incremental decoder for cp65001 code (Windows code - page 65001, Microsoft UTF-8). - -- Issue #20879: Delay the initialization of encoding and decoding tables for - base32, ascii85 and base85 codecs in the base64 module, and delay the - initialization of the unquote_to_bytes() table of the urllib.parse module, to - not waste memory if these modules are not used. - -- Issue #19157: Include the broadcast address in the usuable hosts for IPv6 - in ipaddress. - -- Issue #11599: When an external command (e.g. compiler) fails, distutils now - prints out the whole command line (instead of just the command name) if the - environment variable DISTUTILS_DEBUG is set. - -- Issue #4931: distutils should not produce unhelpful "error: None" messages - anymore. distutils.util.grok_environment_error is kept but doc-deprecated. - -- Issue #20875: Prevent possible gzip "'read' is not defined" NameError. - Patch by Claudiu Popa. - -- Issue #11558: ``email.message.Message.attach`` now returns a more - useful error message if ``attach`` is called on a message for which - ``is_multipart`` is False. - -- Issue #20283: RE pattern methods now accept the string keyword parameters - as documented. The pattern and source keyword parameters are left as - deprecated aliases. - -- Issue #20778: Fix modulefinder to work with bytecode-only modules. - -- Issue #20791: copy.copy() now doesn't make a copy when the input is - a bytes object. Initial patch by Peter Otten. - -- Issue #19748: On AIX, time.mktime() now raises an OverflowError for year - outsize range [1902; 2037]. - -- Issue #19573: inspect.signature: Use enum for parameter kind constants. - -- Issue #20726: inspect.signature: Make Signature and Parameter picklable. - -- Issue #17373: Add inspect.Signature.from_callable method. - -- Issue #20378: Improve repr of inspect.Signature and inspect.Parameter. - -- Issue #20816: Fix inspect.getcallargs() to raise correct TypeError for - missing keyword-only arguments. Patch by Jeremiah Lowin. - -- Issue #20817: Fix inspect.getcallargs() to fail correctly if more - than 3 arguments are missing. Patch by Jeremiah Lowin. - -- Issue #6676: Ensure a meaningful exception is raised when attempting - to parse more than one XML document per pyexpat xmlparser instance. - (Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with - suggested wording by David Gutteridge) - -- Issue #21117: Fix inspect.signature to better support functools.partial. - Due to the specifics of functools.partial implementation, - positional-or-keyword arguments passed as keyword arguments become - keyword-only. - -- Issue #20334: inspect.Signature and inspect.Parameter are now hashable. - Thanks to Antony Lee for bug reports and suggestions. - -- Issue #15916: doctest.DocTestSuite returns an empty unittest.TestSuite instead - of raising ValueError if it finds no tests - -- Issue #21209: Fix asyncio.tasks.CoroWrapper to workaround a bug - in yield-from implementation in CPythons prior to 3.4.1. - -- asyncio: Add gi_{frame,running,code} properties to CoroWrapper - (upstream issue #163). - -- Issue #21311: Avoid exception in _osx_support with non-standard compiler - configurations. Patch by John Szakmeister. - -- Issue #11571: Ensure that the turtle window becomes the topmost window - when launched on OS X. - -- Issue #21801: Validate that __signature__ is None or an instance of Signature. - -- Issue #21923: Prevent AttributeError in distutils.sysconfig.customize_compiler - due to possible uninitialized _config_vars. - -- Issue #21323: Fix http.server to again handle scripts in CGI subdirectories, - broken by the fix for security issue #19435. Patch by Zach Byrne. - -- Issue #22733: Fix ffi_prep_args not zero-extending argument values correctly - on 64-bit Windows. - -- Issue #23302: Default to TCP_NODELAY=1 upon establishing an HTTPConnection. - Removed use of hard-coded MSS as it's an optimization that's no longer needed - with Nagle disabled. - -IDLE ----- - -- Issue #20577: Configuration of the max line length for the FormatParagraph - extension has been moved from the General tab of the Idle preferences dialog - to the FormatParagraph tab of the Config Extensions dialog. - Patch by Tal Einat. - -- Issue #16893: Update Idle doc chapter to match current Idle and add new - information. - -- Issue #3068: Add Idle extension configuration dialog to Options menu. - Changes are written to HOME/.idlerc/config-extensions.cfg. - Original patch by Tal Einat. - -- Issue #16233: A module browser (File : Class Browser, Alt+C) requires an - editor window with a filename. When Class Browser is requested otherwise, - from a shell, output window, or 'Untitled' editor, Idle no longer displays - an error box. It now pops up an Open Module box (Alt+M). If a valid name - is entered and a module is opened, a corresponding browser is also opened. - -- Issue #4832: Save As to type Python files automatically adds .py to the - name you enter (even if your system does not display it). Some systems - automatically add .txt when type is Text files. - -- Issue #21986: Code objects are not normally pickled by the pickle module. - To match this, they are no longer pickled when running under Idle. - -- Issue #17390: Adjust Editor window title; remove 'Python', - move version to end. - -- Issue #14105: Idle debugger breakpoints no longer disappear - when inserting or deleting lines. - -- Issue #17172: Turtledemo can now be run from Idle. - Currently, the entry is on the Help menu, but it may move to Run. - Patch by Ramchandra Apt and Lita Cho. - -- Issue #21765: Add support for non-ascii identifiers to HyperParser. - -- Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav - Heblikar. - -- Issue #18592: Add unittest for SearchDialogBase. Patch by Phil Webster. - -- Issue #21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar. - -- Issue #21686: add unittest for HyperParser. Original patch by Saimadhav - Heblikar. - -- Issue #12387: Add missing upper(lower)case versions of default Windows key - bindings for Idle so Caps Lock does not disable them. Patch by Roger Serwy. - -- Issue #21695: Closing a Find-in-files output window while the search is - still in progress no longer closes Idle. - -- Issue #18910: Add unittest for textView. Patch by Phil Webster. - -- Issue #18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar. - -- Issue #18409: Add unittest for AutoComplete. Patch by Phil Webster. - -- Issue #21477: htest.py - Improve framework, complete set of tests. - Patches by Saimadhav Heblikar - -- Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin - consolidating and improving human-validated tests of Idle. Change other files - as needed to work with htest. Running the module as __main__ runs all tests. - -- Issue #21139: Change default paragraph width to 72, the PEP 8 recommendation. - -- Issue #21284: Paragraph reformat test passes after user changes reformat width. - -- Issue #17654: Ensure IDLE menus are customized properly on OS X for - non-framework builds and for all variants of Tk. - -- Issue #23180: Rename IDLE "Windows" menu item to "Window". - Patch by Al Sweigart. - -Build ------ - -- Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure - script. - -- Issue #22935: Allow the ssl module to be compiled if openssl doesn't support - SSL 3. - -- Issue #22592: Drop support of the Borland C compiler to build Python. The - distutils module still supports it to build extensions. - -- Issue #22591: Drop support of MS-DOS, especially of the DJGPP compiler - (MS-DOS port of GCC). - -- Issue #16537: Check whether self.extensions is empty in setup.py. Patch by - Jonathan Hosmer. - -- Issue #22359: Remove incorrect uses of recursive make. Patch by Jonas - Wagner. - -- Issue #21958: Define HAVE_ROUND when building with Visual Studio 2013 and - above. Patch by Zachary Turner. - -- Issue #18093: the programs that embed the CPython runtime are now in a - separate "Programs" directory, rather than being kept in the Modules - directory. - -- Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/ - now display special message when and only when there are failures. - -- Issue #21141: The Windows build process no longer attempts to find Perl, - instead relying on OpenSSL source being configured and ready to build. The - ``PCbuild\build_ssl.py`` script has been re-written and re-named to - ``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source - for both 32 and 64 bit platforms. OpenSSL sources obtained from - svn.python.org will always be pre-configured and ready to build. - -- Issue #21037: Add a build option to enable AddressSanitizer support. - -- Issue #19962: The Windows build process now creates "python.bat" in the - root of the source tree, which passes all arguments through to the most - recently built interpreter. - -- Issue #21285: Refactor and fix curses configure check to always search - in a ncursesw directory. - -- Issue #15234: For BerkelyDB and Sqlite, only add the found library and - include directories if they aren't already being searched. This avoids - an explicit runtime library dependency. - -- Issue #17861: Tools/scripts/generate_opcode_h.py automatically regenerates - Include/opcode.h from Lib/opcode.py if the latter gets any change. - -- Issue #20644: OS X installer build support for documentation build changes - in 3.4.1: assume externally supplied sphinx-build is available in /usr/bin. - -- Issue #20022: Eliminate use of deprecated bundlebuilder in OS X builds. - -- Issue #15968: Incorporated Tcl, Tk, and Tix builds into the Windows build - solution. - -- Issue #17095: Fix Modules/Setup *shared* support. - -- Issue #21811: Anticipated fixes to support OS X versions > 10.9. - -- Issue #21166: Prevent possible segfaults and other random failures of - python --generate-posix-vars in pybuilddir.txt build target. - -- Issue #18096: Fix library order returned by python-config. - -- Issue #17219: Add library build dir for Python extension cross-builds. - -- Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), - which will be used for the official release. - -- Issue #21236: Build _msi.pyd with cabinet.lib instead of fci.lib - -- Issue #17128: Use private version of OpenSSL for OS X 10.5+ installer. - -C API ------ - -- Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo(), - bytearray_getbuffer(), bytesiobuf_getbuffer() and array_buffer_getbuf(). - All functions now raise BufferError in that case. - -- Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity - tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation - flag. Previously the function reported false negatives for corner cases. - -- Issue #22079: PyType_Ready() now checks that statically allocated type has - no dynamically allocated bases. - -- Issue #22453: Removed non-documented macro PyObject_REPR(). - -- Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, - rename ``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document - these functions. - -- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), - PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) is now using - ``calloc()`` instead of ``malloc()`` for large objects which is faster and - use less memory. - -- Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to - match what importlib does; this affects _frozen_importlib as well as any - module loaded using imp.init_frozen(). - -Documentation -------------- - -- Issue #19548: Update the codecs module documentation to better cover the - distinction between text encodings and other codecs, together with other - clarifications. Patch by Martin Panter. - -- Issue #22394: Doc/Makefile now supports ``make venv PYTHON=../python`` to - create a venv for generating the documentation, e.g., - ``make html PYTHON=venv/bin/python3``. - -- Issue #21514: The documentation of the json module now refers to new JSON RFC - 7159 instead of obsoleted RFC 4627. - -- Issue #21777: The binary sequence methods on bytes and bytearray are now - documented explicitly, rather than assuming users will be able to derive - the expected behaviour from the behaviour of the corresponding str methods. - -- Issue #6916: undocument deprecated asynchat.fifo class. - -- Issue #17386: Expanded functionality of the ``Doc/make.bat`` script to make - it much more comparable to ``Doc/Makefile``. - -- Issue #21312: Update the thread_foobar.h template file to include newer - threading APIs. Patch by Jack McCracken. - -- Issue #21043: Remove the recommendation for specific CA organizations and to - mention the ability to load the OS certificates. - -- Issue #20765: Add missing documentation for PurePath.with_name() and - PurePath.with_suffix(). - -- Issue #19407: New package installation and distribution guides based on - the Python Packaging Authority tools. Existing guides have been retained - as legacy links from the distutils docs, as they still contain some - required reference material for tool developers that isn't recorded - anywhere else. - -- Issue #19697: Document cases where __main__.__spec__ is None. - -Tests ------ - -- Issue #18982: Add tests for CLI of the calendar module. - -- Issue #19548: Added some additional checks to test_codecs to ensure that - statements in the updated documentation remain accurate. Patch by Martin - Panter. - -- Issue #22838: All test_re tests now work with unittest test discovery. - -- Issue #22173: Update lib2to3 tests to use unittest test discovery. - -- Issue #16000: Convert test_curses to use unittest. - -- Issue #21456: Skip two tests in test_urllib2net.py if _ssl module not - present. Patch by Remi Pointel. - -- Issue #20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier - de Gaye. - -- Issue #22060: test_ctypes has been somewhat cleaned up and simplified; it - now uses unittest test discovery to find its tests. - -- Issue #22104: regrtest.py no longer holds a reference to the suite of tests - loaded from test modules that don't define test_main(). - -- Issue #22111: Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. - -- Issue #22002: Added ``load_package_tests`` function to test.support and used - it to implement/augment test discovery in test_asyncio, test_email, - test_importlib, test_json, and test_tools. - -- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks - to William Orr. - -- Issue #21918: Converted test_tools from a module to a package containing - separate test files for each tested script. - -- Issue #9554: Use modern unittest features in test_argparse. Initial patch by - Denver Coneybeare and Radu Voicilas. - -- Issue #20155: Changed HTTP method names in failing tests in test_httpservers - so that packet filtering software (specifically Windows Base Filtering Engine) - does not interfere with the transaction semantics expected by the tests. - -- Issue #19493: Refactored the ctypes test package to skip tests explicitly - rather than silently. - -- Issue #18492: All resources are now allowed when tests are not run by - regrtest.py. - -- Issue #21634: Fix pystone micro-benchmark: use floor division instead of true - division to benchmark integers instead of floating point numbers. Set pystone - version to 1.2. Patch written by Lennart Regebro. - -- Issue #21605: Added tests for Tkinter images. - -- Issue #21493: Added test for ntpath.expanduser(). Original patch by - Claudiu Popa. - -- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok. - -- Issue #21522: Added Tkinter tests for Listbox.itemconfigure(), - PanedWindow.paneconfigure(), and Menu.entryconfigure(). - -- Issue #17756: Fix test_code test when run from the installed location. - -- Issue #17752: Fix distutils tests when run from the installed location. - -- Issue #18604: Consolidated checks for GUI availability. All platforms now - at least check whether Tk can be instantiated when the GUI resource is - requested. - -- Issue #21275: Fix a socket test on KFreeBSD. - -- Issue #21223: Pass test_site/test_startup_imports when some of the extensions - are built as builtins. - -- Issue #20635: Added tests for Tk geometry managers. - -- Add test case for freeze. - -- Issue #20743: Fix a reference leak in test_tcl. - -- Issue #21097: Move test_namespace_pkgs into test_importlib. - -- Issue #21503: Use test_both() consistently in test_importlib. - -- Issue #20939: Avoid various network test failures due to new - redirect of http://www.python.org/ to https://www.python.org: - use http://www.example.com instead. - -- Issue #20668: asyncio tests no longer rely on tests.txt file. - (Patch by Vajrasky Kok) - -- Issue #21093: Prevent failures of ctypes test_macholib on OS X if a - copy of libz exists in $HOME/lib or /usr/local/lib. - -- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests. - -- Issue #23211: Workaround test_logging failure on some OS X 10.6 systems. - -- Issue #23345: Prevent test_ssl failures with large OpenSSL patch level - values (like 0.9.8zc). - -Tools/Demos ------------ - -- Issue #22314: pydoc now works when the LINES environment variable is set. - -- Issue #22615: Argument Clinic now supports the "type" argument for the - int converter. This permits using the int converter with enums and - typedefs. - -- Issue #20076: The makelocalealias.py script no longer ignores UTF-8 mapping. - -- Issue #20079: The makelocalealias.py script now can parse the SUPPORTED file - from glibc sources and supports command line options for source paths. - -- Issue #22201: Command-line interface of the zipfile module now correctly - extracts ZIP files with directory entries. Patch by Ryan Wilson. - -- Issue #22120: For functions using an unsigned integer return converter, - Argument Clinic now generates a cast to that type for the comparison - to -1 in the generated code. (This suppresses a compilation warning.) - -- Issue #18974: Tools/scripts/diff.py now uses argparse instead of optparse. - -- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3. - Patch by Zachary Ware. - -- Issue #21629: Fix Argument Clinic's "--converters" feature. - -- Add support for ``yield from`` to 2to3. - -- Add support for the PEP 465 matrix multiplication operator to 2to3. - -- Issue #16047: Fix module exception list and __file__ handling in freeze. - Patch by Meador Inge. - -- Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge. - -- Issue #20535: PYTHONWARNING no longer affects the run_tests.py script. - Patch by Arfrever Frehtes Taifersar Arahesis. - -Windows -------- - -- Issue #23260: Update Windows installer - -- The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible - result of this change is the addition of new native file dialogs when - running on Windows Vista or newer. See Tcl/Tk's TIP 432 for more - information. Also, this version of Tcl/Tk includes support for Windows 10. - -- Issue #17896: The Windows build scripts now expect external library sources - to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``. - -- Issue #17717: The Windows build scripts now use a copy of NASM pulled from - svn.python.org to build OpenSSL. - -- Issue #21907: Improved the batch scripts provided for building Python. - -- Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j. - -- Issue #10747: Use versioned labels in the Windows start menu. - Patch by Olive Kilburn. - -- Issue #22980: .pyd files with a version and platform tag (for example, - ".cp35-win32.pyd") will now be loaded in preference to those without tags. - - -**(For information about older versions, consult the HISTORY file.)** diff --git a/Misc/NEWS.d/3.5.0.rst b/Misc/NEWS.d/3.5.0.rst new file mode 100644 index 00000000000..59575d1f2bc --- /dev/null +++ b/Misc/NEWS.d/3.5.0.rst @@ -0,0 +1,8 @@ +.. bpo: 25071 +.. date: 7965 +.. nonce: EwjXl1 +.. release date: 2015-09-13 +.. section: Build + +Windows installer should not require TargetDir parameter when installing +quietly. diff --git a/Misc/NEWS.d/3.5.0a1.rst b/Misc/NEWS.d/3.5.0a1.rst new file mode 100644 index 00000000000..bc835442b6f --- /dev/null +++ b/Misc/NEWS.d/3.5.0a1.rst @@ -0,0 +1,5869 @@ +.. bpo: 23285 +.. date: 7608 +.. nonce: bJJA8B +.. release date: 2015-02-08 +.. section: Core and Builtins + +PEP 475 - EINTR handling. + +.. + +.. bpo: 22735 +.. date: 7607 +.. nonce: mFEX9n +.. section: Core and Builtins + +Fix many edge cases (including crashes) involving custom mro() +implementations. + +.. + +.. bpo: 22896 +.. date: 7606 +.. nonce: xSDAHK +.. section: Core and Builtins + +Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and +PyObject_AsWriteBuffer(). + +.. + +.. bpo: 21295 +.. date: 7605 +.. nonce: LYq9nF +.. section: Core and Builtins + +Revert some changes (issue #16795) to AST line numbers and column offsets +that constituted a regression. + +.. + +.. bpo: 22986 +.. date: 7604 +.. nonce: yay2Lv +.. section: Core and Builtins + +Allow changing an object's __class__ between a dynamic type and static type +in some cases. + +.. + +.. bpo: 15859 +.. date: 7603 +.. nonce: Fs5mE2 +.. section: Core and Builtins + +PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and +PyUnicode_EncodeCodePage() now raise an exception if the object is not a +Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on +platforms other than Windows. Patch written by Campbell Barton. + +.. + +.. bpo: 21408 +.. date: 7602 +.. nonce: Lz6P3P +.. section: Core and Builtins + +The default __ne__() now returns NotImplemented if __eq__() returned +NotImplemented. Original patch by Martin Panter. + +.. + +.. bpo: 23321 +.. date: 7601 +.. nonce: HQelge +.. section: Core and Builtins + +Fixed a crash in str.decode() when error handler returned replacment string +longer than mailformed input data. + +.. + +.. bpo: 22286 +.. date: 7600 +.. nonce: l6Qyy1 +.. section: Core and Builtins + +The "backslashreplace" error handlers now works with decoding and +translating. + +.. + +.. bpo: 23253 +.. date: 7599 +.. nonce: p4B1H- +.. section: Core and Builtins + +Delay-load ShellExecute[AW] in os.startfile for reduced startup overhead on +Windows. + +.. + +.. bpo: 22038 +.. date: 7598 +.. nonce: BMZUHx +.. section: Core and Builtins + +pyatomic.h now uses stdatomic.h or GCC built-in functions for atomic memory +access if available. Patch written by Vitor de Lima and Gustavo Temple. + +.. + +.. bpo: 20284 +.. date: 7597 +.. nonce: CH8wpD +.. section: Core and Builtins + +%-interpolation (aka printf) formatting added for bytes and bytearray. + +.. + +.. bpo: 23048 +.. date: 7596 +.. nonce: X5BUd3 +.. section: Core and Builtins + +Fix jumping out of an infinite while loop in the pdb. + +.. + +.. bpo: 20335 +.. date: 7595 +.. nonce: YcAPOs +.. section: Core and Builtins + +bytes constructor now raises TypeError when encoding or errors is specified +with non-string argument. Based on patch by Renaud Blanch. + +.. + +.. bpo: 22834 +.. date: 7594 +.. nonce: N1kAXN +.. section: Core and Builtins + +If the current working directory ends up being set to a non-existent +directory then import will no longer raise FileNotFoundError. + +.. + +.. bpo: 22869 +.. date: 7593 +.. nonce: rAWg-V +.. section: Core and Builtins + +Move the interpreter startup & shutdown code to a new dedicated +pylifecycle.c module + +.. + +.. bpo: 22847 +.. date: 7592 +.. nonce: 6baj9f +.. section: Core and Builtins + +Improve method cache efficiency. + +.. + +.. bpo: 22335 +.. date: 7591 +.. nonce: DWsXiy +.. section: Core and Builtins + +Fix crash when trying to enlarge a bytearray to 0x7fffffff bytes on a 32-bit +platform. + +.. + +.. bpo: 22653 +.. date: 7590 +.. nonce: pCNlpv +.. section: Core and Builtins + +Fix an assertion failure in debug mode when doing a reentrant dict insertion +in debug mode. + +.. + +.. bpo: 22643 +.. date: 7589 +.. nonce: xv8xev +.. section: Core and Builtins + +Fix integer overflow in Unicode case operations (upper, lower, title, +swapcase, casefold). + +.. + +.. bpo: 17636 +.. date: 7588 +.. nonce: wiqnhw +.. section: Core and Builtins + +Circular imports involving relative imports are now supported. + +.. + +.. bpo: 22604 +.. date: 7587 +.. nonce: yii-It +.. section: Core and Builtins + +Fix assertion error in debug mode when dividing a complex number by +(nan+0j). + +.. + +.. bpo: 21052 +.. date: 7586 +.. nonce: -sf3tp +.. section: Core and Builtins + +Do not raise ImportWarning when sys.path_hooks or sys.meta_path are set to +None. + +.. + +.. bpo: 16518 +.. date: 7585 +.. nonce: UADwcN +.. section: Core and Builtins + +Use 'bytes-like object required' in error messages that previously used the +far more cryptic "'x' does not support the buffer protocol. + +.. + +.. bpo: 22470 +.. date: 7584 +.. nonce: igrgN2 +.. section: Core and Builtins + +Fixed integer overflow issues in "backslashreplace", "xmlcharrefreplace", +and "surrogatepass" error handlers. + +.. + +.. bpo: 22540 +.. date: 7583 +.. nonce: FM72m- +.. section: Core and Builtins + +speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the common case +that the second argument has metaclass `type`. + +.. + +.. bpo: 18711 +.. date: 7582 +.. nonce: ds5wQa +.. section: Core and Builtins + +Add a new `PyErr_FormatV` function, similar to `PyErr_Format` but accepting +a `va_list` argument. + +.. + +.. bpo: 22520 +.. date: 7581 +.. nonce: ZPJXSq +.. section: Core and Builtins + +Fix overflow checking when generating the repr of a unicode object. + +.. + +.. bpo: 22519 +.. date: 7580 +.. nonce: xvJVg0 +.. section: Core and Builtins + +Fix overflow checking in PyBytes_Repr. + +.. + +.. bpo: 22518 +.. date: 7579 +.. nonce: C9T6ed +.. section: Core and Builtins + +Fix integer overflow issues in latin-1 encoding. + +.. + +.. bpo: 16324 +.. date: 7578 +.. nonce: YfrBNz +.. section: Core and Builtins + +_charset parameter of MIMEText now also accepts email.charset.Charset +instances. Initial patch by Claude Paroz. + +.. + +.. bpo: 1764286 +.. date: 7577 +.. nonce: L4seL2 +.. section: Core and Builtins + +Fix inspect.getsource() to support decorated functions. Patch by Claudiu +Popa. + +.. + +.. bpo: 18554 +.. date: 7576 +.. nonce: hxnaui +.. section: Core and Builtins + +os.__all__ includes posix functions. + +.. + +.. bpo: 21391 +.. date: 7575 +.. nonce: 3jntPd +.. section: Core and Builtins + +Use os.path.abspath in the shutil module. + +.. + +.. bpo: 11471 +.. date: 7574 +.. nonce: Uu752F +.. section: Core and Builtins + +avoid generating a JUMP_FORWARD instruction at the end of an if-block if +there is no else-clause. Original patch by Eugene Toder. + +.. + +.. bpo: 22215 +.. date: 7573 +.. nonce: IBFi6H +.. section: Core and Builtins + +Now ValueError is raised instead of TypeError when str or bytes argument +contains not permitted null character or byte. + +.. + +.. bpo: 22258 +.. date: 7572 +.. nonce: 4FszMt +.. section: Core and Builtins + +Fix the internal function set_inheritable() on Illumos. This platform +exposes the function ``ioctl(FIOCLEX)``, but calling it fails with errno is +ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls back +to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``). + +.. + +.. bpo: 21389 +.. date: 7571 +.. nonce: dnWZBn +.. section: Core and Builtins + +Displaying the __qualname__ of the underlying function in the repr of a +bound method. + +.. + +.. bpo: 22206 +.. date: 7570 +.. nonce: 0i_ihB +.. section: Core and Builtins + +Using pthread, PyThread_create_key() now sets errno to ENOMEM and returns -1 +(error) on integer overflow. + +.. + +.. bpo: 20184 +.. date: 7569 +.. nonce: bb3uHY +.. section: Core and Builtins + +Argument Clinic based signature introspection added for 30 of the builtin +functions. + +.. + +.. bpo: 22116 +.. date: 7568 +.. nonce: auVmIt +.. section: Core and Builtins + +C functions and methods (of the 'builtin_function_or_method' type) can now +be weakref'ed. Patch by Wei Wu. + +.. + +.. bpo: 22077 +.. date: 7567 +.. nonce: KZUDR- +.. section: Core and Builtins + +Improve index error messages for bytearrays, bytes, lists, and tuples by +adding 'or slices'. Added ', not ' for bytearrays. Original patch +by Claudiu Popa. + +.. + +.. bpo: 20179 +.. date: 7566 +.. nonce: Nvhffc +.. section: Core and Builtins + +Apply Argument Clinic to bytes and bytearray. Patch by Tal Einat. + +.. + +.. bpo: 22082 +.. date: 7565 +.. nonce: 6X8Qmg +.. section: Core and Builtins + +Clear interned strings in slotdefs. + +.. + +.. bpo: 0 +.. date: 7564 +.. nonce: tuMnCc +.. section: Core and Builtins + +Upgrade Unicode database to Unicode 7.0.0. + +.. + +.. bpo: 21897 +.. date: 7563 +.. nonce: kiOGHe +.. section: Core and Builtins + +Fix a crash with the f_locals attribute with closure variables when +frame.clear() has been called. + +.. + +.. bpo: 21205 +.. date: 7562 +.. nonce: wZsx1K +.. section: Core and Builtins + +Add a new ``__qualname__`` attribute to generator, the qualified name, and +use it in the representation of a generator (``repr(gen)``). The default +name of the generator (``__name__`` attribute) is now get from the function +instead of the code. Use ``gen.gi_code.co_name`` to get the name of the +code. + +.. + +.. bpo: 21669 +.. date: 7561 +.. nonce: DFDrBA +.. section: Core and Builtins + +With the aid of heuristics in SyntaxError.__init__, the parser now attempts +to generate more meaningful (or at least more search engine friendly) error +messages when "exec" and "print" are used as statements. + +.. + +.. bpo: 21642 +.. date: 7560 +.. nonce: -lWoKz +.. section: Core and Builtins + +In the conditional if-else expression, allow an integer written with no +space between itself and the ``else`` keyword (e.g. ``True if 42else +False``) to be valid syntax. + +.. + +.. bpo: 21523 +.. date: 7559 +.. nonce: f_PPYO +.. section: Core and Builtins + +Fix over-pessimistic computation of the stack effect of some opcodes in the +compiler. This also fixes a quadratic compilation time issue noticeable +when compiling code with a large number of "and" and "or" operators. + +.. + +.. bpo: 21418 +.. date: 7558 +.. nonce: z9jp1_ +.. section: Core and Builtins + +Fix a crash in the builtin function super() when called without argument and +without current frame (ex: embedded Python). + +.. + +.. bpo: 21425 +.. date: 7557 +.. nonce: i3Teb8 +.. section: Core and Builtins + +Fix flushing of standard streams in the interactive interpreter. + +.. + +.. bpo: 21435 +.. date: 7556 +.. nonce: ZojVOT +.. section: Core and Builtins + +In rare cases, when running finalizers on objects in cyclic trash a bad +pointer dereference could occur due to a subtle flaw in internal iteration +logic. + +.. + +.. bpo: 21377 +.. date: 7555 +.. nonce: OawYfl +.. section: Core and Builtins + +PyBytes_Concat() now tries to concatenate in-place when the first argument +has a reference count of 1. Patch by Nikolaus Rath. + +.. + +.. bpo: 20355 +.. date: 7554 +.. nonce: OrCNkZ +.. section: Core and Builtins + +-W command line options now have higher priority than the PYTHONWARNINGS +environment variable. Patch by Arfrever. + +.. + +.. bpo: 21274 +.. date: 7553 +.. nonce: fVGfwq +.. section: Core and Builtins + +Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. + +.. + +.. bpo: 20904 +.. date: 7552 +.. nonce: fAGdj2 +.. section: Core and Builtins + +Support setting FPU precision on m68k. + +.. + +.. bpo: 21209 +.. date: 7551 +.. nonce: nMljFr +.. section: Core and Builtins + +Fix sending tuples to custom generator objects with the yield from syntax. + +.. + +.. bpo: 21193 +.. date: 7550 +.. nonce: Dg98Oo +.. section: Core and Builtins + +pow(a, b, c) now raises ValueError rather than TypeError when b is negative. +Patch by Josh Rosenberg. + +.. + +.. bpo: 21176 +.. date: 7549 +.. nonce: mitDhW +.. section: Core and Builtins + +PEP 465: Add the '@' operator for matrix multiplication. + +.. + +.. bpo: 21134 +.. date: 7548 +.. nonce: ZL4SKo +.. section: Core and Builtins + +Fix segfault when str is called on an uninitialized UnicodeEncodeError, +UnicodeDecodeError, or UnicodeTranslateError object. + +.. + +.. bpo: 19537 +.. date: 7547 +.. nonce: AkuC_J +.. section: Core and Builtins + +Fix PyUnicode_DATA() alignment under m68k. Patch by Andreas Schwab. + +.. + +.. bpo: 20929 +.. date: 7546 +.. nonce: 9NlUR7 +.. section: Core and Builtins + +Add a type cast to avoid shifting a negative number. + +.. + +.. bpo: 20731 +.. date: 7545 +.. nonce: _03SZg +.. section: Core and Builtins + +Properly position in source code files even if they are opened in text mode. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 20637 +.. date: 7544 +.. nonce: ppYU0o +.. section: Core and Builtins + +Key-sharing now also works for instance dictionaries of subclasses. Patch +by Peter Ingebretson. + +.. + +.. bpo: 8297 +.. date: 7543 +.. nonce: _XdGON +.. section: Core and Builtins + +Attributes missing from modules now include the module name in the error +text. Original patch by ysj.ray. + +.. + +.. bpo: 19995 +.. date: 7542 +.. nonce: mnHEzX +.. section: Core and Builtins + +%c, %o, %x, and %X now raise TypeError on non-integer input. + +.. + +.. bpo: 19655 +.. date: 7541 +.. nonce: JgVdes +.. section: Core and Builtins + +The ASDL parser - used by the build process to generate code for managing +the Python AST in C - was rewritten. The new parser is self contained and +does not require to carry long the spark.py parser-generator library; +spark.py was removed from the source base. + +.. + +.. bpo: 12546 +.. date: 7540 +.. nonce: 09naZ9 +.. section: Core and Builtins + +Allow ``\x00`` to be used as a fill character when using str, int, float, +and complex __format__ methods. + +.. + +.. bpo: 20480 +.. date: 7539 +.. nonce: TIYPLo +.. section: Core and Builtins + +Add ipaddress.reverse_pointer. Patch by Leon Weber. + +.. + +.. bpo: 13598 +.. date: 7538 +.. nonce: GJelrw +.. section: Core and Builtins + +Modify string.Formatter to support auto-numbering of replacement fields. It +now matches the behavior of str.format() in this regard. Patches by Phil +Elson and Ramchandra Apte. + +.. + +.. bpo: 8931 +.. date: 7537 +.. nonce: M05x4f +.. section: Core and Builtins + +Make alternate formatting ('#') for type 'c' raise an exception. In versions +prior to 3.5, '#' with 'c' had no effect. Now specifying it is an error. +Patch by Torsten Landschoff. + +.. + +.. bpo: 23165 +.. date: 7536 +.. nonce: lk8uCE +.. section: Core and Builtins + +Perform overflow checks before allocating memory in the _Py_char2wchar +function. + +.. + +.. bpo: 23399 +.. date: 7535 +.. nonce: hXMYgA +.. section: Library + +pyvenv creates relative symlinks where possible. + +.. + +.. bpo: 20289 +.. date: 7534 +.. nonce: nio1N- +.. section: Library + +cgi.FieldStorage() now supports the context management protocol. + +.. + +.. bpo: 13128 +.. date: 7533 +.. nonce: vqEcsy +.. section: Library + +Print response headers for CONNECT requests when debuglevel > 0. Patch by +Demian Brecht. + +.. + +.. bpo: 15381 +.. date: 7532 +.. nonce: Xv-wu8 +.. section: Library + +Optimized io.BytesIO to make less allocations and copyings. + +.. + +.. bpo: 22818 +.. date: 7531 +.. nonce: NYdAc9 +.. section: Library + +Splitting on a pattern that could match an empty string now raises a +warning. Patterns that can only match empty strings are now rejected. + +.. + +.. bpo: 23099 +.. date: 7530 +.. nonce: ZASrUo +.. section: Library + +Closing io.BytesIO with exported buffer is rejected now to prevent +corrupting exported buffer. + +.. + +.. bpo: 23326 +.. date: 7529 +.. nonce: 8VzlZD +.. section: Library + +Removed __ne__ implementations. Since fixing default __ne__ implementation +in issue #21408 they are redundant. + +.. + +.. bpo: 23363 +.. date: 7528 +.. nonce: -koaol +.. section: Library + +Fix possible overflow in itertools.permutations. + +.. + +.. bpo: 23364 +.. date: 7527 +.. nonce: 3yBV-6 +.. section: Library + +Fix possible overflow in itertools.product. + +.. + +.. bpo: 23366 +.. date: 7526 +.. nonce: tyAfm8 +.. section: Library + +Fixed possible integer overflow in itertools.combinations. + +.. + +.. bpo: 23369 +.. date: 7525 +.. nonce: nqChyE +.. section: Library + +Fixed possible integer overflow in _json.encode_basestring_ascii. + +.. + +.. bpo: 23353 +.. date: 7524 +.. nonce: Iytkpc +.. section: Library + +Fix the exception handling of generators in PyEval_EvalFrameEx(). At entry, +save or swap the exception state even if PyEval_EvalFrameEx() is called with +throwflag=0. At exit, the exception state is now always restored or swapped, +not only if why is WHY_YIELD or WHY_RETURN. Patch co-written with Antoine +Pitrou. + +.. + +.. bpo: 14099 +.. date: 7523 +.. nonce: t9-HVE +.. section: Library + +Restored support of writing ZIP files to tellable but non-seekable streams. + +.. + +.. bpo: 14099 +.. date: 7522 +.. nonce: Myxxww +.. section: Library + +Writing to ZipFile and reading multiple ZipExtFiles is threadsafe now. + +.. + +.. bpo: 19361 +.. date: 7521 +.. nonce: 2mvrV3 +.. section: Library + +JSON decoder now raises JSONDecodeError instead of ValueError. + +.. + +.. bpo: 18518 +.. date: 7520 +.. nonce: JXgicC +.. section: Library + +timeit now rejects statements which can't be compiled outside a function or +a loop (e.g. "return" or "break"). + +.. + +.. bpo: 23094 +.. date: 7519 +.. nonce: -8AXSi +.. section: Library + +Fixed readline with frames in Python implementation of pickle. + +.. + +.. bpo: 23268 +.. date: 7518 +.. nonce: ATtRa5 +.. section: Library + +Fixed bugs in the comparison of ipaddress classes. + +.. + +.. bpo: 21408 +.. date: 7517 +.. nonce: 0rI6tx +.. section: Library + +Removed incorrect implementations of __ne__() which didn't returned +NotImplemented if __eq__() returned NotImplemented. The default __ne__() +now works correctly. + +.. + +.. bpo: 19996 +.. date: 7516 +.. nonce: 2-SiMf +.. section: Library + +:class:`email.feedparser.FeedParser` now handles (malformed) headers with no +key rather than assuming the body has started. + +.. + +.. bpo: 20188 +.. date: 7515 +.. nonce: xocY-2 +.. section: Library + +Support Application-Layer Protocol Negotiation (ALPN) in the ssl module. + +.. + +.. bpo: 23133 +.. date: 7514 +.. nonce: 8p2Wnl +.. section: Library + +Pickling of ipaddress objects now produces more compact and portable +representation. + +.. + +.. bpo: 23248 +.. date: 7513 +.. nonce: FjcyCP +.. section: Library + +Update ssl error codes from latest OpenSSL git master. + +.. + +.. bpo: 23266 +.. date: 7512 +.. nonce: Mo7alR +.. section: Library + +Much faster implementation of ipaddress.collapse_addresses() when there are +many non-consecutive addresses. + +.. + +.. bpo: 23098 +.. date: 7511 +.. nonce: 7VwF3K +.. section: Library + +64-bit dev_t is now supported in the os module. + +.. + +.. bpo: 21817 +.. date: 7510 +.. nonce: xYUW-9 +.. section: Library + +When an exception is raised in a task submitted to a ProcessPoolExecutor, +the remote traceback is now displayed in the parent process. Patch by +Claudiu Popa. + +.. + +.. bpo: 15955 +.. date: 7509 +.. nonce: uvpBL4 +.. section: Library + +Add an option to limit output size when decompressing LZMA data. Patch by +Nikolaus Rath and Martin Panter. + +.. + +.. bpo: 23250 +.. date: 7508 +.. nonce: qNGAUf +.. section: Library + +In the http.cookies module, capitalize "HttpOnly" and "Secure" as they are +written in the standard. + +.. + +.. bpo: 23063 +.. date: 7507 +.. nonce: 9-UJRs +.. section: Library + +In the disutils' check command, fix parsing of reST with code or code-block +directives. + +.. + +.. bpo: 23209 +.. date: 7506 +.. nonce: I0bCCH +.. section: Library + +selectors.BaseSelector.get_key() now raises a RuntimeError if the selector +is closed. And selectors.BaseSelector.close() now clears its internal +reference to the selector mapping to break a reference cycle. Initial patch +written by Martin Richard. (See also: bpo-23225) + +.. + +.. bpo: 17911 +.. date: 7505 +.. nonce: yg65Iu +.. section: Library + +Provide a way to seed the linecache for a PEP-302 module without actually +loading the code. + +.. + +.. bpo: 17911 +.. date: 7504 +.. nonce: qeTePa +.. section: Library + +Provide a new object API for traceback, including the ability to not lookup +lines at all until the traceback is actually rendered, without any trace of +the original objects being kept alive. + +.. + +.. bpo: 19777 +.. date: 7503 +.. nonce: H_NDIA +.. section: Library + +Provide a home() classmethod on Path objects. Contributed by Victor Salgado +and Mayank Tripathi. + +.. + +.. bpo: 23206 +.. date: 7502 +.. nonce: xSiYwq +.. section: Library + +Make ``json.dumps(..., ensure_ascii=False)`` as fast as the default case of +``ensure_ascii=True``. Patch by Naoki Inada. + +.. + +.. bpo: 23185 +.. date: 7501 +.. nonce: KHyoSO +.. section: Library + +Add math.inf and math.nan constants. + +.. + +.. bpo: 23186 +.. date: 7500 +.. nonce: KzWLP2 +.. section: Library + +Add ssl.SSLObject.shared_ciphers() and ssl.SSLSocket.shared_ciphers() to +fetch the client's list ciphers sent at handshake. + +.. + +.. bpo: 23143 +.. date: 7499 +.. nonce: AWxJXV +.. section: Library + +Remove compatibility with OpenSSLs older than 0.9.8. + +.. + +.. bpo: 23132 +.. date: 7498 +.. nonce: pbQcut +.. section: Library + +Improve performance and introspection support of comparison methods created +by functool.total_ordering. + +.. + +.. bpo: 19776 +.. date: 7497 +.. nonce: BxNgxd +.. section: Library + +Add an expanduser() method on Path objects. + +.. + +.. bpo: 23112 +.. date: 7496 +.. nonce: dZGf82 +.. section: Library + +Fix SimpleHTTPServer to correctly carry the query string and fragment when +it redirects to add a trailing slash. + +.. + +.. bpo: 21793 +.. date: 7495 +.. nonce: T1kQBL +.. section: Library + +Added http.HTTPStatus enums (i.e. HTTPStatus.OK, HTTPStatus.NOT_FOUND). +Patch by Demian Brecht. + +.. + +.. bpo: 23093 +.. date: 7494 +.. nonce: cP7OqD +.. section: Library + +In the io, module allow more operations to work on detached streams. + +.. + +.. bpo: 23111 +.. date: 7493 +.. nonce: A34IA4 +.. section: Library + +In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol version. + +.. + +.. bpo: 22585 +.. date: 7492 +.. nonce: F4BkNo +.. section: Library + +On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), instead of +reading /dev/urandom, to get pseudo-random bytes. + +.. + +.. bpo: 19104 +.. date: 7491 +.. nonce: _eIThy +.. section: Library + +pprint now produces evaluable output for wrapped strings. + +.. + +.. bpo: 23071 +.. date: 7490 +.. nonce: 3BSqF7 +.. section: Library + +Added missing names to codecs.__all__. Patch by Martin Panter. + +.. + +.. bpo: 22783 +.. date: 7489 +.. nonce: OfYxBd +.. section: Library + +Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX opcode if +possible. + +.. + +.. bpo: 15513 +.. date: 7488 +.. nonce: 7yVnRE +.. section: Library + +Added a __sizeof__ implementation for pickle classes. + +.. + +.. bpo: 19858 +.. date: 7487 +.. nonce: cqOlIt +.. section: Library + +pickletools.optimize() now aware of the MEMOIZE opcode, can produce more +compact result and no longer produces invalid output if input data contains +MEMOIZE opcodes together with PUT or BINPUT opcodes. + +.. + +.. bpo: 22095 +.. date: 7486 +.. nonce: iISzxM +.. section: Library + +Fixed HTTPConnection.set_tunnel with default port. The port value in the +host header was set to "None". Patch by Demian Brecht. + +.. + +.. bpo: 23016 +.. date: 7485 +.. nonce: LyrPd_ +.. section: Library + +A warning no longer produces an AttributeError when the program is run with +pythonw.exe. + +.. + +.. bpo: 21775 +.. date: 7484 +.. nonce: ELR_Al +.. section: Library + +shutil.copytree(): fix crash when copying to VFAT. An exception handler +assumed that OSError objects always have a 'winerror' attribute. That is not +the case, so the exception handler itself raised AttributeError when run on +Linux (and, presumably, any other non-Windows OS). Patch by Greg Ward. + +.. + +.. bpo: 1218234 +.. date: 7483 +.. nonce: 4GcoQK +.. section: Library + +Fix inspect.getsource() to load updated source of reloaded module. Initial +patch by Berker Peksag. + +.. + +.. bpo: 21740 +.. date: 7482 +.. nonce: TtAApO +.. section: Library + +Support wrapped callables in doctest. Patch by Claudiu Popa. + +.. + +.. bpo: 23009 +.. date: 7481 +.. nonce: -sW7gk +.. section: Library + +Make sure selectors.EpollSelecrtor.select() works when no FD is registered. + +.. + +.. bpo: 22959 +.. date: 7480 +.. nonce: Vxt3EP +.. section: Library + +In the constructor of http.client.HTTPSConnection, prefer the context's +check_hostname attribute over the *check_hostname* parameter. + +.. + +.. bpo: 22696 +.. date: 7479 +.. nonce: pvdcxs +.. section: Library + +Add function :func:`sys.is_finalizing` to know about interpreter shutdown. + +.. + +.. bpo: 16043 +.. date: 7478 +.. nonce: TGIC7t +.. section: Library + +Add a default limit for the amount of data xmlrpclib.gzip_decode will +return. This resolves CVE-2013-1753. + +.. + +.. bpo: 14099 +.. date: 7477 +.. nonce: GJ5meQ +.. section: Library + +ZipFile.open() no longer reopen the underlying file. Objects returned by +ZipFile.open() can now operate independently of the ZipFile even if the +ZipFile was created by passing in a file-like object as the first argument +to the constructor. + +.. + +.. bpo: 22966 +.. date: 7476 +.. nonce: zIxDrT +.. section: Library + +Fix __pycache__ pyc file name clobber when pyc_compile is asked to compile a +source file containing multiple dots in the source file name. + +.. + +.. bpo: 21971 +.. date: 7475 +.. nonce: XlTc22 +.. section: Library + +Update turtledemo doc and add module to the index. + +.. + +.. bpo: 21032 +.. date: 7474 +.. nonce: wxT_41 +.. section: Library + +Fixed socket leak if HTTPConnection.getresponse() fails. Original patch by +Martin Panter. + +.. + +.. bpo: 22407 +.. date: 7473 +.. nonce: CWi1wX +.. section: Library + +Deprecated the use of re.LOCALE flag with str patterns or re.ASCII. It was +newer worked. + +.. + +.. bpo: 22902 +.. date: 7472 +.. nonce: ZqXriA +.. section: Library + +The "ip" command is now used on Linux to determine MAC address in +uuid.getnode(). Pach by Bruno Cauet. + +.. + +.. bpo: 22960 +.. date: 7471 +.. nonce: 2VDILT +.. section: Library + +Add a context argument to xmlrpclib.ServerProxy constructor. + +.. + +.. bpo: 22389 +.. date: 7470 +.. nonce: 82DuwD +.. section: Library + +Add contextlib.redirect_stderr(). + +.. + +.. bpo: 21356 +.. date: 7469 +.. nonce: 8NY75J +.. section: Library + +Make ssl.RAND_egd() optional to support LibreSSL. The availability of the +function is checked during the compilation. Patch written by Bernard Spil. + +.. + +.. bpo: 22915 +.. date: 7468 +.. nonce: 709UAo +.. section: Library + +SAX parser now supports files opened with file descriptor or bytes path. + +.. + +.. bpo: 22609 +.. date: 7467 +.. nonce: mmLoeb +.. section: Library + +Constructors and update methods of mapping classes in the collections module +now accept the self keyword argument. + +.. + +.. bpo: 22940 +.. date: 7466 +.. nonce: SP99Nf +.. section: Library + +Add readline.append_history_file. + +.. + +.. bpo: 19676 +.. date: 7465 +.. nonce: Wijwr8 +.. section: Library + +Added the "namereplace" error handler. + +.. + +.. bpo: 22788 +.. date: 7464 +.. nonce: vofL9e +.. section: Library + +Add *context* parameter to logging.handlers.HTTPHandler. + +.. + +.. bpo: 22921 +.. date: 7463 +.. nonce: a4wx1C +.. section: Library + +Allow SSLContext to take the *hostname* parameter even if OpenSSL doesn't +support SNI. + +.. + +.. bpo: 22894 +.. date: 7462 +.. nonce: 4AkwPA +.. section: Library + +TestCase.subTest() would cause the test suite to be stopped when in failfast +mode, even in the absence of failures. + +.. + +.. bpo: 22796 +.. date: 7461 +.. nonce: _pFPFA +.. section: Library + +HTTP cookie parsing is now stricter, in order to protect against potential +injection attacks. + +.. + +.. bpo: 22370 +.. date: 7460 +.. nonce: j4y21u +.. section: Library + +Windows detection in pathlib is now more robust. + +.. + +.. bpo: 22841 +.. date: 7459 +.. nonce: 8wpk7T +.. section: Library + +Reject coroutines in asyncio add_signal_handler(). Patch by Ludovic.Gasc. + +.. + +.. bpo: 19494 +.. date: 7458 +.. nonce: 7O5O8k +.. section: Library + +Added urllib.request.HTTPBasicPriorAuthHandler. Patch by Matej Cepl. + +.. + +.. bpo: 22578 +.. date: 7457 +.. nonce: 6XZ0Jf +.. section: Library + +Added attributes to the re.error class. + +.. + +.. bpo: 22849 +.. date: 7456 +.. nonce: AqBPyj +.. section: Library + +Fix possible double free in the io.TextIOWrapper constructor. + +.. + +.. bpo: 12728 +.. date: 7455 +.. nonce: rHZmXO +.. section: Library + +Different Unicode characters having the same uppercase but different +lowercase are now matched in case-insensitive regular expressions. + +.. + +.. bpo: 22821 +.. date: 7454 +.. nonce: 30cQ-U +.. section: Library + +Fixed fcntl() with integer argument on 64-bit big-endian platforms. + +.. + +.. bpo: 21650 +.. date: 7453 +.. nonce: 62MLqr +.. section: Library + +Add an `--sort-keys` option to json.tool CLI. + +.. + +.. bpo: 22824 +.. date: 7452 +.. nonce: d5Txvr +.. section: Library + +Updated reprlib output format for sets to use set literals. Patch +contributed by Berker Peksag. + +.. + +.. bpo: 22824 +.. date: 7451 +.. nonce: H_r9uH +.. section: Library + +Updated reprlib output format for arrays to display empty arrays without an +unnecessary empty list. Suggested by Serhiy Storchaka. + +.. + +.. bpo: 22406 +.. date: 7450 +.. nonce: sPlVbI +.. section: Library + +Fixed the uu_codec codec incorrectly ported to 3.x. Based on patch by Martin +Panter. + +.. + +.. bpo: 17293 +.. date: 7449 +.. nonce: Hk06bO +.. section: Library + +uuid.getnode() now determines MAC address on AIX using netstat. Based on +patch by Aivars Kalv?ns. + +.. + +.. bpo: 22769 +.. date: 7448 +.. nonce: PunnvQ +.. section: Library + +Fixed ttk.Treeview.tag_has() when called without arguments. + +.. + +.. bpo: 22417 +.. date: 7447 +.. nonce: To4b7U +.. section: Library + +Verify certificates by default in httplib (PEP 476). + +.. + +.. bpo: 22775 +.. date: 7446 +.. nonce: V5aCUz +.. section: Library + +Fixed unpickling of http.cookies.SimpleCookie with protocol 2 and above. +Patch by Tim Graham. + +.. + +.. bpo: 22776 +.. date: 7445 +.. nonce: xNcRse +.. section: Library + +Brought excluded code into the scope of a try block in SysLogHandler.emit(). + +.. + +.. bpo: 22665 +.. date: 7444 +.. nonce: j6Jlp8 +.. section: Library + +Add missing get_terminal_size and SameFileError to shutil.__all__. + +.. + +.. bpo: 6623 +.. date: 7443 +.. nonce: 6LOidS +.. section: Library + +Remove deprecated Netrc class in the ftplib module. Patch by Matt Chaput. + +.. + +.. bpo: 17381 +.. date: 7442 +.. nonce: 4J5yv7 +.. section: Library + +Fixed handling of case-insensitive ranges in regular expressions. + +.. + +.. bpo: 22410 +.. date: 7441 +.. nonce: 99YFdd +.. section: Library + +Module level functions in the re module now cache compiled locale-dependent +regular expressions taking into account the locale. + +.. + +.. bpo: 22759 +.. date: 7440 +.. nonce: BJPdiL +.. section: Library + +Query methods on pathlib.Path() (exists(), is_dir(), etc.) now return False +when the underlying stat call raises NotADirectoryError. + +.. + +.. bpo: 8876 +.. date: 7439 +.. nonce: A83Av4 +.. section: Library + +distutils now falls back to copying files when hard linking doesn't work. +This allows use with special filesystems such as VirtualBox shared folders. + +.. + +.. bpo: 22217 +.. date: 7438 +.. nonce: nXzGur +.. section: Library + +Implemented reprs of classes in the zipfile module. + +.. + +.. bpo: 22457 +.. date: 7437 +.. nonce: Xd2Mk- +.. section: Library + +Honour load_tests in the start_dir of discovery. + +.. + +.. bpo: 18216 +.. date: 7436 +.. nonce: trTZw4 +.. section: Library + +gettext now raises an error when a .mo file has an unsupported major version +number. Patch by Aaron Hill. + +.. + +.. bpo: 13918 +.. date: 7435 +.. nonce: -OnUhD +.. section: Library + +Provide a locale.delocalize() function which can remove locale-specific +number formatting from a string representing a number, without then +converting it to a specific type. Patch by C?dric Krier. + +.. + +.. bpo: 22676 +.. date: 7434 +.. nonce: d2v8QM +.. section: Library + +Make the pickling of global objects which don't have a __module__ attribute +less slow. + +.. + +.. bpo: 18853 +.. date: 7433 +.. nonce: 76DrPD +.. section: Library + +Fixed ResourceWarning in shlex.__nain__. + +.. + +.. bpo: 9351 +.. date: 7432 +.. nonce: u5UI-6 +.. section: Library + +Defaults set with set_defaults on an argparse subparser are no longer +ignored when also set on the parent parser. + +.. + +.. bpo: 7559 +.. date: 7431 +.. nonce: QG35ZP +.. section: Library + +unittest test loading ImportErrors are reported as import errors with their +import exception rather than as attribute errors after the import has +already failed. + +.. + +.. bpo: 19746 +.. date: 7430 +.. nonce: S1dg1K +.. section: Library + +Make it possible to examine the errors from unittest discovery without +executing the test suite. The new `errors` attribute on TestLoader exposes +these non-fatal errors encountered during discovery. + +.. + +.. bpo: 21991 +.. date: 7429 +.. nonce: Mkm0IN +.. section: Library + +Make email.headerregistry's header 'params' attributes be read-only +(MappingProxyType). Previously the dictionary was modifiable but a new one +was created on each access of the attribute. + +.. + +.. bpo: 22638 +.. date: 7428 +.. nonce: Ur73gJ +.. section: Library + +SSLv3 is now disabled throughout the standard library. It can still be +enabled by instantiating a SSLContext manually. + +.. + +.. bpo: 22641 +.. date: 7427 +.. nonce: m0ldtl +.. section: Library + +In asyncio, the default SSL context for client connections is now created +using ssl.create_default_context(), for stronger security. + +.. + +.. bpo: 17401 +.. date: 7426 +.. nonce: SZd19P +.. section: Library + +Include closefd in io.FileIO repr. + +.. + +.. bpo: 21338 +.. date: 7425 +.. nonce: evDyHD +.. section: Library + +Add silent mode for compileall. quiet parameters of compile_{dir, file, +path} functions now have a multilevel value. Also, -q option of the CLI now +have a multilevel value. Patch by Thomas Kluyver. + +.. + +.. bpo: 20152 +.. date: 7424 +.. nonce: 9_o92A +.. section: Library + +Convert the array and cmath modules to Argument Clinic. + +.. + +.. bpo: 18643 +.. date: 7423 +.. nonce: 6Qdc0J +.. section: Library + +Add socket.socketpair() on Windows. + +.. + +.. bpo: 22435 +.. date: 7422 +.. nonce: s2U7Zm +.. section: Library + +Fix a file descriptor leak when socketserver bind fails. + +.. + +.. bpo: 13096 +.. date: 7421 +.. nonce: rsailB +.. section: Library + +Fixed segfault in CTypes POINTER handling of large values. + +.. + +.. bpo: 11694 +.. date: 7420 +.. nonce: JuDrch +.. section: Library + +Raise ConversionError in xdrlib as documented. Patch by Filip Gruszczy?ski +and Claudiu Popa. + +.. + +.. bpo: 19380 +.. date: 7419 +.. nonce: nqgoRQ +.. section: Library + +Optimized parsing of regular expressions. + +.. + +.. bpo: 1519638 +.. date: 7418 +.. nonce: 2pbuog +.. section: Library + +Now unmatched groups are replaced with empty strings in re.sub() and +re.subn(). + +.. + +.. bpo: 18615 +.. date: 7417 +.. nonce: 65TxnY +.. section: Library + +sndhdr.what/whathdr now return a namedtuple. + +.. + +.. bpo: 22462 +.. date: 7416 +.. nonce: 1h4Kpr +.. section: Library + +Fix pyexpat's creation of a dummy frame to make it appear in exception +tracebacks. + +.. + +.. bpo: 21965 +.. date: 7415 +.. nonce: n_jnXs +.. section: Library + +Add support for in-memory SSL to the ssl module. Patch by Geert Jansen. + +.. + +.. bpo: 21173 +.. date: 7414 +.. nonce: egkbEx +.. section: Library + +Fix len() on a WeakKeyDictionary when .clear() was called with an iterator +alive. + +.. + +.. bpo: 11866 +.. date: 7413 +.. nonce: xrvbIC +.. section: Library + +Eliminated race condition in the computation of names for new threads. + +.. + +.. bpo: 21905 +.. date: 7412 +.. nonce: coKyRo +.. section: Library + +Avoid RuntimeError in pickle.whichmodule() when sys.modules is mutated while +iterating. Patch by Olivier Grisel. + +.. + +.. bpo: 11271 +.. date: 7411 +.. nonce: ZYiJru +.. section: Library + +concurrent.futures.Executor.map() now takes a *chunksize* argument to allow +batching of tasks in child processes and improve performance of +ProcessPoolExecutor. Patch by Dan O'Reilly. + +.. + +.. bpo: 21883 +.. date: 7410 +.. nonce: qpuQu6 +.. section: Library + +os.path.join() and os.path.relpath() now raise a TypeError with more helpful +error message for unsupported or mismatched types of arguments. + +.. + +.. bpo: 22219 +.. date: 7409 +.. nonce: l9Enh9 +.. section: Library + +The zipfile module CLI now adds entries for directories (including empty +directories) in ZIP file. + +.. + +.. bpo: 22449 +.. date: 7408 +.. nonce: nFW_Fl +.. section: Library + +In the ssl.SSLContext.load_default_certs, consult the environmental +variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. + +.. + +.. bpo: 22508 +.. date: 7407 +.. nonce: 2LbnGQ +.. section: Library + +The email.__version__ variable has been removed; the email code is no longer +shipped separately from the stdlib, and __version__ hasn't been updated in +several releases. + +.. + +.. bpo: 20076 +.. date: 7406 +.. nonce: -7OIVB +.. section: Library + +Added non derived UTF-8 aliases to locale aliases table. + +.. + +.. bpo: 20079 +.. date: 7405 +.. nonce: qM949O +.. section: Library + +Added locales supported in glibc 2.18 to locale alias table. + +.. + +.. bpo: 20218 +.. date: 7404 +.. nonce: CMgOyE +.. section: Library + +Added convenience methods read_text/write_text and read_bytes/ write_bytes +to pathlib.Path objects. + +.. + +.. bpo: 22396 +.. date: 7403 +.. nonce: cQSizA +.. section: Library + +On 32-bit AIX platform, don't expose os.posix_fadvise() nor +os.posix_fallocate() because their prototypes in system headers are wrong. + +.. + +.. bpo: 22517 +.. date: 7402 +.. nonce: qT6-aB +.. section: Library + +When an io.BufferedRWPair object is deallocated, clear its weakrefs. + +.. + +.. bpo: 22437 +.. date: 7401 +.. nonce: MRVnmQ +.. section: Library + +Number of capturing groups in regular expression is no longer limited by +100. + +.. + +.. bpo: 17442 +.. date: 7400 +.. nonce: rnc87D +.. section: Library + +InteractiveInterpreter now displays the full chained traceback in its +showtraceback method, to match the built in interactive interpreter. + +.. + +.. bpo: 23392 +.. date: 7399 +.. nonce: Pe7_WK +.. section: Library + +Added tests for marshal C API that works with FILE*. + +.. + +.. bpo: 10510 +.. date: 7398 +.. nonce: N-ntcD +.. section: Library + +distutils register and upload methods now use HTML standards compliant CRLF +line endings. + +.. + +.. bpo: 9850 +.. date: 7397 +.. nonce: D-UnVi +.. section: Library + +Fixed macpath.join() for empty first component. Patch by Oleg Oshmyan. + +.. + +.. bpo: 5309 +.. date: 7396 +.. nonce: pVMmQ8 +.. section: Library + +distutils' build and build_ext commands now accept a ``-j`` option to enable +parallel building of extension modules. + +.. + +.. bpo: 22448 +.. date: 7395 +.. nonce: fAapvE +.. section: Library + +Improve canceled timer handles cleanup to prevent unbound memory usage. +Patch by Joshua Moore-Oliva. + +.. + +.. bpo: 22427 +.. date: 7394 +.. nonce: TZ5S_u +.. section: Library + +TemporaryDirectory no longer attempts to clean up twice when used in the +with statement in generator. + +.. + +.. bpo: 22362 +.. date: 7393 +.. nonce: xIBThN +.. section: Library + +Forbidden ambiguous octal escapes out of range 0-0o377 in regular +expressions. + +.. + +.. bpo: 20912 +.. date: 7392 +.. nonce: cAq3mZ +.. section: Library + +Now directories added to ZIP file have correct Unix and MS-DOS directory +attributes. + +.. + +.. bpo: 21866 +.. date: 7391 +.. nonce: hSc4wM +.. section: Library + +ZipFile.close() no longer writes ZIP64 central directory records if +allowZip64 is false. + +.. + +.. bpo: 22278 +.. date: 7390 +.. nonce: abqBXZ +.. section: Library + +Fix urljoin problem with relative urls, a regression observed after changes +to issue22118 were submitted. + +.. + +.. bpo: 22415 +.. date: 7389 +.. nonce: xJLAvI +.. section: Library + +Fixed debugging output of the GROUPREF_EXISTS opcode in the re module. +Removed trailing spaces in debugging output. + +.. + +.. bpo: 22423 +.. date: 7388 +.. nonce: Rtb4oT +.. section: Library + +Unhandled exception in thread no longer causes unhandled AttributeError when +sys.stderr is None. + +.. + +.. bpo: 21332 +.. date: 7387 +.. nonce: Gwxwlr +.. section: Library + +Ensure that ``bufsize=1`` in subprocess.Popen() selects line buffering, +rather than block buffering. Patch by Akira Li. + +.. + +.. bpo: 21091 +.. date: 7386 +.. nonce: M5hAtT +.. section: Library + +Fix API bug: email.message.EmailMessage.is_attachment is now a method. + +.. + +.. bpo: 21079 +.. date: 7385 +.. nonce: czVcL8 +.. section: Library + +Fix email.message.EmailMessage.is_attachment to return the correct result +when the header has parameters as well as a value. + +.. + +.. bpo: 22247 +.. date: 7384 +.. nonce: sGIpR3 +.. section: Library + +Add NNTPError to nntplib.__all__. + +.. + +.. bpo: 22366 +.. date: 7383 +.. nonce: Dd1eFj +.. section: Library + +urllib.request.urlopen will accept a context object (SSLContext) as an +argument which will then be used for HTTPS connection. Patch by Alex Gaynor. + +.. + +.. bpo: 4180 +.. date: 7382 +.. nonce: QBx0JK +.. section: Library + +The warnings registries are now reset when the filters are modified. + +.. + +.. bpo: 22419 +.. date: 7381 +.. nonce: FqH4aC +.. section: Library + +Limit the length of incoming HTTP request in wsgiref server to 65536 bytes +and send a 414 error code for higher lengths. Patch contributed by Devin +Cook. + +.. + +.. bpo: 0 +.. date: 7380 +.. nonce: y7r3O2 +.. section: Library + +Lax cookie parsing in http.cookies could be a security issue when combined +with non-standard cookie handling in some Web browsers. Reported by Sergey +Bobrov. + +.. + +.. bpo: 20537 +.. date: 7379 +.. nonce: E0CE54 +.. section: Library + +logging methods now accept an exception instance as well as a Boolean value +or exception tuple. Thanks to Yury Selivanov for the patch. + +.. + +.. bpo: 22384 +.. date: 7378 +.. nonce: -Nl4He +.. section: Library + +An exception in Tkinter callback no longer crashes the program when it is +run with pythonw.exe. + +.. + +.. bpo: 22168 +.. date: 7377 +.. nonce: vLeKWC +.. section: Library + +Prevent turtle AttributeError with non-default Canvas on OS X. + +.. + +.. bpo: 21147 +.. date: 7376 +.. nonce: w9DE17 +.. section: Library + +sqlite3 now raises an exception if the request contains a null character +instead of truncating it. Based on patch by Victor Stinner. + +.. + +.. bpo: 13968 +.. date: 7375 +.. nonce: 1okGqm +.. section: Library + +The glob module now supports recursive search in subdirectories using the +``**`` pattern. + +.. + +.. bpo: 21951 +.. date: 7374 +.. nonce: 3vS4LK +.. section: Library + +Fixed a crash in Tkinter on AIX when called Tcl command with empty string or +tuple argument. + +.. + +.. bpo: 21951 +.. date: 7373 +.. nonce: _CCC4v +.. section: Library + +Tkinter now most likely raises MemoryError instead of crash if the memory +allocation fails. + +.. + +.. bpo: 22338 +.. date: 7372 +.. nonce: rKlCMz +.. section: Library + +Fix a crash in the json module on memory allocation failure. + +.. + +.. bpo: 12410 +.. date: 7371 +.. nonce: oFf-cB +.. section: Library + +imaplib.IMAP4 now supports the context management protocol. Original patch +by Tarek Ziad?. + +.. + +.. bpo: 21270 +.. date: 7370 +.. nonce: qMBaY- +.. section: Library + +We now override tuple methods in mock.call objects so that they can be used +as normal call attributes. + +.. + +.. bpo: 16662 +.. date: 7369 +.. nonce: Nghn-Y +.. section: Library + +load_tests() is now unconditionally run when it is present in a package's +__init__.py. TestLoader.loadTestsFromModule() still accepts use_load_tests, +but it is deprecated and ignored. A new keyword-only attribute `pattern` is +added and documented. Patch given by Robert Collins, tweaked by Barry +Warsaw. + +.. + +.. bpo: 22226 +.. date: 7368 +.. nonce: T1ZMPY +.. section: Library + +First letter no longer is stripped from the "status" key in the result of +Treeview.heading(). + +.. + +.. bpo: 19524 +.. date: 7367 +.. nonce: EQJjlF +.. section: Library + +Fixed resource leak in the HTTP connection when an invalid response is +received. Patch by Martin Panter. + +.. + +.. bpo: 20421 +.. date: 7366 +.. nonce: iR0S1s +.. section: Library + +Add a .version() method to SSL sockets exposing the actual protocol version +in use. + +.. + +.. bpo: 19546 +.. date: 7365 +.. nonce: 8VdYBK +.. section: Library + +configparser exceptions no longer expose implementation details. Chained +KeyErrors are removed, which leads to cleaner tracebacks. Patch by Claudiu +Popa. + +.. + +.. bpo: 22051 +.. date: 7364 +.. nonce: cUjFqL +.. section: Library + +turtledemo no longer reloads examples to re-run them. Initialization of +variables and gui setup should be done in main(), which is called each time +a demo is run, but not on import. + +.. + +.. bpo: 21933 +.. date: 7363 +.. nonce: IhMjN1 +.. section: Library + +Turtledemo users can change the code font size with a menu selection or +control(command) '-' or '+' or control-mousewheel. Original patch by Lita +Cho. + +.. + +.. bpo: 21597 +.. date: 7362 +.. nonce: aPTCWJ +.. section: Library + +The separator between the turtledemo text pane and the drawing canvas can +now be grabbed and dragged with a mouse. The code text pane can be widened +to easily view or copy the full width of the text. The canvas can be +widened on small screens. Original patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 18132 +.. date: 7361 +.. nonce: 2R2nwM +.. section: Library + +Turtledemo buttons no longer disappear when the window is shrunk. Original +patches by Jan Kanis and Lita Cho. + +.. + +.. bpo: 22043 +.. date: 7360 +.. nonce: Q6RvGL +.. section: Library + +time.monotonic() is now always available. ``threading.Lock.acquire()``, +``threading.RLock.acquire()`` and socket operations now use a monotonic +clock, instead of the system clock, when a timeout is used. + +.. + +.. bpo: 21527 +.. date: 7359 +.. nonce: N5WPxr +.. section: Library + +Add a default number of workers to ThreadPoolExecutor equal to 5 times the +number of CPUs. Patch by Claudiu Popa. + +.. + +.. bpo: 22216 +.. date: 7358 +.. nonce: Cmalu6 +.. section: Library + +smtplib now resets its state more completely after a quit. The most obvious +consequence of the previous behavior was a STARTTLS failure during a +connect/starttls/quit/connect/starttls sequence. + +.. + +.. bpo: 22098 +.. date: 7357 +.. nonce: 5JYiQN +.. section: Library + +ctypes' BigEndianStructure and LittleEndianStructure now define an empty +__slots__ so that subclasses don't always get an instance dict. Patch by +Claudiu Popa. + +.. + +.. bpo: 22185 +.. date: 7356 +.. nonce: 1SCCIK +.. section: Library + +Fix an occasional RuntimeError in threading.Condition.wait() caused by +mutation of the waiters queue without holding the lock. Patch by Doug +Zongker. + +.. + +.. bpo: 22287 +.. date: 7355 +.. nonce: awH2AI +.. section: Library + +On UNIX, _PyTime_gettimeofday() now uses clock_gettime(CLOCK_REALTIME) if +available. As a side effect, Python now depends on the librt library on +Solaris and on Linux (only with glibc older than 2.17). + +.. + +.. bpo: 22182 +.. date: 7354 +.. nonce: 5EG1Bc +.. section: Library + +Use e.args to unpack exceptions correctly in distutils.file_util.move_file. +Patch by Claudiu Popa. + +.. + +.. bpo: 0 +.. date: 7353 +.. nonce: zBfe8J +.. section: Library + +The webbrowser module now uses subprocess's start_new_session=True rather +than a potentially risky preexec_fn=os.setsid call. + +.. + +.. bpo: 22042 +.. date: 7352 +.. nonce: WZvb8s +.. section: Library + +signal.set_wakeup_fd(fd) now raises an exception if the file descriptor is +in blocking mode. + +.. + +.. bpo: 16808 +.. date: 7351 +.. nonce: kPy_5U +.. section: Library + +inspect.stack() now returns a named tuple instead of a tuple. Patch by +Daniel Shahaf. + +.. + +.. bpo: 22236 +.. date: 7350 +.. nonce: 1utXkg +.. section: Library + +Fixed Tkinter images copying operations in NoDefaultRoot mode. + +.. + +.. bpo: 2527 +.. date: 7349 +.. nonce: fR2GS6 +.. section: Library + +Add a *globals* argument to timeit functions, in order to override the +globals namespace in which the timed code is executed. Patch by Ben Roberts. + +.. + +.. bpo: 22118 +.. date: 7348 +.. nonce: 3gdkOF +.. section: Library + +Switch urllib.parse to use RFC 3986 semantics for the resolution of relative +URLs, rather than RFCs 1808 and 2396. Patch by Demian Brecht. + +.. + +.. bpo: 21549 +.. date: 7347 +.. nonce: i1LVvg +.. section: Library + +Added the "members" parameter to TarFile.list(). + +.. + +.. bpo: 19628 +.. date: 7346 +.. nonce: ssQVP8 +.. section: Library + +Allow compileall recursion depth to be specified with a -r option. + +.. + +.. bpo: 15696 +.. date: 7345 +.. nonce: PTwXYJ +.. section: Library + +Add a __sizeof__ implementation for mmap objects on Windows. + +.. + +.. bpo: 22068 +.. date: 7344 +.. nonce: wCdaW0 +.. section: Library + +Avoided reference loops with Variables and Fonts in Tkinter. + +.. + +.. bpo: 22165 +.. date: 7343 +.. nonce: J1np4o +.. section: Library + +SimpleHTTPRequestHandler now supports undecodable file names. + +.. + +.. bpo: 15381 +.. date: 7342 +.. nonce: Ia8pf6 +.. section: Library + +Optimized line reading in io.BytesIO. + +.. + +.. bpo: 8797 +.. date: 7341 +.. nonce: aJcIPu +.. section: Library + +Raise HTTPError on failed Basic Authentication immediately. Initial patch by +Sam Bull. + +.. + +.. bpo: 20729 +.. date: 7340 +.. nonce: I-1Lap +.. section: Library + +Restored the use of lazy iterkeys()/itervalues()/iteritems() in the mailbox +module. + +.. + +.. bpo: 21448 +.. date: 7339 +.. nonce: THJSYB +.. section: Library + +Changed FeedParser feed() to avoid O(N**2) behavior when parsing long line. +Original patch by Raymond Hettinger. + +.. + +.. bpo: 22184 +.. date: 7338 +.. nonce: UCbSOt +.. section: Library + +The functools LRU Cache decorator factory now gives an earlier and clearer +error message when the user forgets the required parameters. + +.. + +.. bpo: 17923 +.. date: 7337 +.. nonce: YI_QjG +.. section: Library + +glob() patterns ending with a slash no longer match non-dirs on AIX. Based +on patch by Delhallt. + +.. + +.. bpo: 21725 +.. date: 7336 +.. nonce: eIu-2N +.. section: Library + +Added support for RFC 6531 (SMTPUTF8) in smtpd. + +.. + +.. bpo: 22176 +.. date: 7335 +.. nonce: rgbRyg +.. section: Library + +Update the ctypes module's libffi to v3.1. This release adds support for +the Linux AArch64 and POWERPC ELF ABIv2 little endian architectures. + +.. + +.. bpo: 5411 +.. date: 7334 +.. nonce: 5Utapn +.. section: Library + +Added support for the "xztar" format in the shutil module. + +.. + +.. bpo: 21121 +.. date: 7333 +.. nonce: ZLsRil +.. section: Library + +Don't force 3rd party C extensions to be built with -Werror=declaration- +after-statement. + +.. + +.. bpo: 21975 +.. date: 7332 +.. nonce: MI8ntO +.. section: Library + +Fixed crash when using uninitialized sqlite3.Row (in particular when +unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the +__new__() method. + +.. + +.. bpo: 20170 +.. date: 7331 +.. nonce: 8QfhN7 +.. section: Library + +Convert posixmodule to use Argument Clinic. + +.. + +.. bpo: 21539 +.. date: 7330 +.. nonce: YccmZF +.. section: Library + +Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic `mkdir -p` and +`os.makedirs()` functionality. When true, ignore FileExistsErrors. Patch +by Berker Peksag. + +.. + +.. bpo: 22127 +.. date: 7329 +.. nonce: 0l2OO5 +.. section: Library + +Bypass IDNA for pure-ASCII host names in the socket module (in particular +for numeric IPs). + +.. + +.. bpo: 21047 +.. date: 7328 +.. nonce: XfUQG3 +.. section: Library + +set the default value for the *convert_charrefs* argument of HTMLParser to +True. Patch by Berker Peksag. + +.. + +.. bpo: 0 +.. date: 7327 +.. nonce: 56bAnQ +.. section: Library + +Add an __all__ to html.entities. + +.. + +.. bpo: 15114 +.. date: 7326 +.. nonce: jXwseC +.. section: Library + +the strict mode and argument of HTMLParser, HTMLParser.error, and the +HTMLParserError exception have been removed. + +.. + +.. bpo: 22085 +.. date: 7325 +.. nonce: 3JM_Aw +.. section: Library + +Dropped support of Tk 8.3 in Tkinter. + +.. + +.. bpo: 21580 +.. date: 7324 +.. nonce: 3ssycS +.. section: Library + +Now Tkinter correctly handles bytes arguments passed to Tk. In particular +this allows initializing images from binary data. + +.. + +.. bpo: 22003 +.. date: 7323 +.. nonce: 4ZIDS1 +.. section: Library + +When initialized from a bytes object, io.BytesIO() now defers making a copy +until it is mutated, improving performance and memory use on some use cases. +Patch by David Wilson. + +.. + +.. bpo: 22018 +.. date: 7322 +.. nonce: 6ApxSH +.. section: Library + +On Windows, signal.set_wakeup_fd() now also supports sockets. A side effect +is that Python depends to the WinSock library. + +.. + +.. bpo: 22054 +.. date: 7321 +.. nonce: zp6Svw +.. section: Library + +Add os.get_blocking() and os.set_blocking() functions to get and set the +blocking mode of a file descriptor (False if the O_NONBLOCK flag is set, +True otherwise). These functions are not available on Windows. + +.. + +.. bpo: 17172 +.. date: 7320 +.. nonce: R_LI_2 +.. section: Library + +Make turtledemo start as active on OS X even when run with subprocess. +Patch by Lita Cho. + +.. + +.. bpo: 21704 +.. date: 7319 +.. nonce: gL3ikj +.. section: Library + +Fix build error for _multiprocessing when semaphores are not available. +Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 20173 +.. date: 7318 +.. nonce: FAL-4L +.. section: Library + +Convert sha1, sha256, sha512 and md5 to ArgumentClinic. Patch by Vajrasky +Kok. + +.. + +.. bpo: 0 +.. date: 7317 +.. nonce: G25tq3 +.. section: Library + +Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError on +closed socket. repr(socket.socket) already works fine. + +.. + +.. bpo: 22033 +.. date: 7316 +.. nonce: nkBNci +.. section: Library + +Reprs of most Python implemened classes now contain actual class name +instead of hardcoded one. + +.. + +.. bpo: 21947 +.. date: 7315 +.. nonce: mlisu- +.. section: Library + +The dis module can now disassemble generator-iterator objects based on their +gi_code attribute. Patch by Clement Rouault. + +.. + +.. bpo: 16133 +.. date: 7314 +.. nonce: tYuYQF +.. section: Library + +The asynchat.async_chat.handle_read() method now ignores BlockingIOError +exceptions. + +.. + +.. bpo: 22044 +.. date: 7313 +.. nonce: t09GRU +.. section: Library + +Fixed premature DECREF in call_tzinfo_method. Patch by Tom Flanagan. + +.. + +.. bpo: 19884 +.. date: 7312 +.. nonce: v73gSn +.. section: Library + +readline: Disable the meta modifier key if stdout is not a terminal to not +write the ANSI sequence ``"\033[1034h"`` into stdout. This sequence is used +on some terminal (ex: TERM=xterm-256color") to enable support of 8 bit +characters. + +.. + +.. bpo: 4350 +.. date: 7311 +.. nonce: nrTzJn +.. section: Library + +Removed a number of out-of-dated and non-working for a long time Tkinter +methods. + +.. + +.. bpo: 6167 +.. date: 7310 +.. nonce: n9dV_D +.. section: Library + +Scrollbar.activate() now returns the name of active element if the argument +is not specified. Scrollbar.set() now always accepts only 2 arguments. + +.. + +.. bpo: 15275 +.. date: 7309 +.. nonce: jk0tTI +.. section: Library + +Clean up and speed up the ntpath module. + +.. + +.. bpo: 21888 +.. date: 7308 +.. nonce: danlpz +.. section: Library + +plistlib's load() and loads() now work if the fmt parameter is specified. + +.. + +.. bpo: 22032 +.. date: 7307 +.. nonce: UklzQW +.. section: Library + +__qualname__ instead of __name__ is now always used to format fully +qualified class names of Python implemented classes. + +.. + +.. bpo: 22031 +.. date: 7306 +.. nonce: 9aazp1 +.. section: Library + +Reprs now always use hexadecimal format with the "0x" prefix when contain an +id in form " at 0x...". + +.. + +.. bpo: 22018 +.. date: 7305 +.. nonce: b_JTHH +.. section: Library + +signal.set_wakeup_fd() now raises an OSError instead of a ValueError on +``fstat()`` failure. + +.. + +.. bpo: 21044 +.. date: 7304 +.. nonce: 16xo9u +.. section: Library + +tarfile.open() now handles fileobj with an integer 'name' attribute. Based +on patch by Antoine Pietri. + +.. + +.. bpo: 21966 +.. date: 7303 +.. nonce: hHD9MK +.. section: Library + +Respect -q command-line option when code module is ran. + +.. + +.. bpo: 19076 +.. date: 7302 +.. nonce: xCoIai +.. section: Library + +Don't pass the redundant 'file' argument to self.error(). + +.. + +.. bpo: 16382 +.. date: 7301 +.. nonce: -XBK7z +.. section: Library + +Improve exception message of warnings.warn() for bad category. Initial patch +by Phil Elson. + +.. + +.. bpo: 21932 +.. date: 7300 +.. nonce: LK_5S1 +.. section: Library + +os.read() now uses a :c:func:`Py_ssize_t` type instead of :c:type:`int` for +the size to support reading more than 2 GB at once. On Windows, the size is +truncted to INT_MAX. As any call to os.read(), the OS may read less bytes +than the number of requested bytes. + +.. + +.. bpo: 21942 +.. date: 7299 +.. nonce: TLOS41 +.. section: Library + +Fixed source file viewing in pydoc's server mode on Windows. + +.. + +.. bpo: 11259 +.. date: 7298 +.. nonce: GxfYnE +.. section: Library + +asynchat.async_chat().set_terminator() now raises a ValueError if the number +of received bytes is negative. + +.. + +.. bpo: 12523 +.. date: 7297 +.. nonce: XBdAky +.. section: Library + +asynchat.async_chat.push() now raises a TypeError if it doesn't get a bytes +string + +.. + +.. bpo: 21707 +.. date: 7296 +.. nonce: rrY_wd +.. section: Library + +Add missing kwonlyargcount argument to ModuleFinder.replace_paths_in_code(). + +.. + +.. bpo: 20639 +.. date: 7295 +.. nonce: YdvOpp +.. section: Library + +calling Path.with_suffix('') allows removing the suffix again. Patch by +July Tikhonov. + +.. + +.. bpo: 21714 +.. date: 7294 +.. nonce: HhkGXW +.. section: Library + +Disallow the construction of invalid paths using Path.with_name(). Original +patch by Antony Lee. + +.. + +.. bpo: 15014 +.. date: 7293 +.. nonce: dB50zb +.. section: Library + +Added 'auth' method to smtplib to make implementing auth mechanisms simpler, +and used it internally in the login method. + +.. + +.. bpo: 21151 +.. date: 7292 +.. nonce: o7IuiD +.. section: Library + +Fixed a segfault in the winreg module when ``None`` is passed as a +``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. + +.. + +.. bpo: 21090 +.. date: 7291 +.. nonce: 20Ooif +.. section: Library + +io.FileIO.readall() does not ignore I/O errors anymore. Before, it ignored +I/O errors if at least the first C call read() succeed. + +.. + +.. bpo: 5800 +.. date: 7290 +.. nonce: ZJiLZP +.. section: Library + +headers parameter of wsgiref.headers.Headers is now optional. Initial patch +by Pablo Torres Navarrete and SilentGhost. + +.. + +.. bpo: 21781 +.. date: 7289 +.. nonce: u_oiv9 +.. section: Library + +ssl.RAND_add() now supports strings longer than 2 GB. + +.. + +.. bpo: 21679 +.. date: 7288 +.. nonce: CTVT9A +.. section: Library + +Prevent extraneous fstat() calls during open(). Patch by Bohuslav Kabrda. + +.. + +.. bpo: 21863 +.. date: 7287 +.. nonce: BzbwSL +.. section: Library + +cProfile now displays the module name of C extension functions, in addition +to their own name. + +.. + +.. bpo: 11453 +.. date: 7286 +.. nonce: 53Gr_R +.. section: Library + +asyncore: emit a ResourceWarning when an unclosed file_wrapper object is +destroyed. The destructor now closes the file if needed. The close() method +can now be called twice: the second call does nothing. + +.. + +.. bpo: 21858 +.. date: 7285 +.. nonce: 0hbFBG +.. section: Library + +Better handling of Python exceptions in the sqlite3 module. + +.. + +.. bpo: 21476 +.. date: 7284 +.. nonce: VN-5pW +.. section: Library + +Make sure the email.parser.BytesParser TextIOWrapper is discarded after +parsing, so the input file isn't unexpectedly closed. + +.. + +.. bpo: 20295 +.. date: 7283 +.. nonce: U1MPhw +.. section: Library + +imghdr now recognizes OpenEXR format images. + +.. + +.. bpo: 21729 +.. date: 7282 +.. nonce: dk7o_U +.. section: Library + +Used the "with" statement in the dbm.dumb module to ensure files closing. +Patch by Claudiu Popa. + +.. + +.. bpo: 21491 +.. date: 7281 +.. nonce: Zxmut- +.. section: Library + +socketserver: Fix a race condition in child processes reaping. + +.. + +.. bpo: 21719 +.. date: 7280 +.. nonce: DhQz3I +.. section: Library + +Added the ``st_file_attributes`` field to os.stat_result on Windows. + +.. + +.. bpo: 21832 +.. date: 7279 +.. nonce: PBA0Uu +.. section: Library + +Require named tuple inputs to be exact strings. + +.. + +.. bpo: 21722 +.. date: 7278 +.. nonce: WTHuRy +.. section: Library + +The distutils "upload" command now exits with a non-zero return code when +uploading fails. Patch by Martin Dengler. + +.. + +.. bpo: 21723 +.. date: 7277 +.. nonce: r86fwb +.. section: Library + +asyncio.Queue: support any type of number (ex: float) for the maximum size. +Patch written by Vajrasky Kok. + +.. + +.. bpo: 21711 +.. date: 7276 +.. nonce: JWPFQZ +.. section: Library + +support for "site-python" directories has now been removed from the site +module (it was deprecated in 3.4). + +.. + +.. bpo: 17552 +.. date: 7275 +.. nonce: NunErD +.. section: Library + +new socket.sendfile() method allowing a file to be sent over a socket by +using high-performance os.sendfile() on UNIX. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 18039 +.. date: 7274 +.. nonce: vC9hNy +.. section: Library + +dbm.dump.open() now always creates a new database when the flag has the +value 'n'. Patch by Claudiu Popa. + +.. + +.. bpo: 21326 +.. date: 7273 +.. nonce: Y6iW3s +.. section: Library + +Add a new is_closed() method to asyncio.BaseEventLoop. run_forever() and +run_until_complete() methods of asyncio.BaseEventLoop now raise an exception +if the event loop was closed. + +.. + +.. bpo: 21766 +.. date: 7272 +.. nonce: 0xk_xC +.. section: Library + +Prevent a security hole in CGIHTTPServer by URL unquoting paths before +checking for a CGI script at that path. + +.. + +.. bpo: 21310 +.. date: 7271 +.. nonce: 2mjByJ +.. section: Library + +Fixed possible resource leak in failed open(). + +.. + +.. bpo: 21256 +.. date: 7270 +.. nonce: dGq6cw +.. section: Library + +Printout of keyword args should be in deterministic order in a mock function +call. This will help to write better doctests. + +.. + +.. bpo: 21677 +.. date: 7269 +.. nonce: 58CDDD +.. section: Library + +Fixed chaining nonnormalized exceptions in io close() methods. + +.. + +.. bpo: 11709 +.. date: 7268 +.. nonce: JdObvL +.. section: Library + +Fix the pydoc.help function to not fail when sys.stdin is not a valid file. + +.. + +.. bpo: 21515 +.. date: 7267 +.. nonce: D9TLJF +.. section: Library + +tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. + +.. + +.. bpo: 13223 +.. date: 7266 +.. nonce: 9AzEbN +.. section: Library + +Fix pydoc.writedoc so that the HTML documentation for methods that use +'self' in the example code is generated correctly. + +.. + +.. bpo: 21463 +.. date: 7265 +.. nonce: 09PsgH +.. section: Library + +In urllib.request, fix pruning of the FTP cache. + +.. + +.. bpo: 21618 +.. date: 7264 +.. nonce: 3Z7WS3 +.. section: Library + +The subprocess module could fail to close open fds that were inherited by +the calling process and already higher than POSIX resource limits would +otherwise allow. On systems with a functioning /proc/self/fd or /dev/fd +interface the max is now ignored and all fds are closed. + +.. + +.. bpo: 20383 +.. date: 7263 +.. nonce: pSPFpW +.. section: Library + +Introduce importlib.util.module_from_spec() as the preferred way to create a +new module. + +.. + +.. bpo: 21552 +.. date: 7262 +.. nonce: uVy4tM +.. section: Library + +Fixed possible integer overflow of too long string lengths in the tkinter +module on 64-bit platforms. + +.. + +.. bpo: 14315 +.. date: 7261 +.. nonce: YzZzS8 +.. section: Library + +The zipfile module now ignores extra fields in the central directory that +are too short to be parsed instead of letting a struct.unpack error bubble +up as this "bad data" appears in many real world zip files in the wild and +is ignored by other zip tools. + +.. + +.. bpo: 13742 +.. date: 7260 +.. nonce: QJiVSC +.. section: Library + +Added "key" and "reverse" parameters to heapq.merge(). (First draft of patch +contributed by Simon Sapin.) + +.. + +.. bpo: 21402 +.. date: 7259 +.. nonce: 51vDXt +.. section: Library + +tkinter.ttk now works when default root window is not set. + +.. + +.. bpo: 3015 +.. date: 7258 +.. nonce: FE_PII +.. section: Library + +_tkinter.create() now creates tkapp object with wantobject=1 by default. + +.. + +.. bpo: 10203 +.. date: 7257 +.. nonce: zgr0hh +.. section: Library + +sqlite3.Row now truly supports sequence protocol. In particular it supports +reverse() and negative indices. Original patch by Claudiu Popa. + +.. + +.. bpo: 18807 +.. date: 7256 +.. nonce: XP7p8B +.. section: Library + +If copying (no symlinks) specified for a venv, then the python interpreter +aliases (python, python3) are now created by copying rather than symlinking. + +.. + +.. bpo: 20197 +.. date: 7255 +.. nonce: nYR9fq +.. section: Library + +Added support for the WebP image type in the imghdr module. Patch by Fabrice +Aneche and Claudiu Popa. + +.. + +.. bpo: 21513 +.. date: 7254 +.. nonce: ro4AOe +.. section: Library + +Speedup some properties of IP addresses (IPv4Address, IPv6Address) such as +.is_private or .is_multicast. + +.. + +.. bpo: 21137 +.. date: 7253 +.. nonce: wgHb_F +.. section: Library + +Improve the repr for threading.Lock() and its variants by showing the +"locked" or "unlocked" status. Patch by Berker Peksag. + +.. + +.. bpo: 21538 +.. date: 7252 +.. nonce: Q60FWA +.. section: Library + +The plistlib module now supports loading of binary plist files when +reference or offset size is not a power of two. + +.. + +.. bpo: 21455 +.. date: 7251 +.. nonce: 6-Uvv4 +.. section: Library + +Add a default backlog to socket.listen(). + +.. + +.. bpo: 21525 +.. date: 7250 +.. nonce: hAKOve +.. section: Library + +Most Tkinter methods which accepted tuples now accept lists too. + +.. + +.. bpo: 22166 +.. date: 7249 +.. nonce: sZYhmv +.. section: Library + +With the assistance of a new internal _codecs._forget_codec helping +function, test_codecs now clears the encoding caches to avoid the appearance +of a reference leak + +.. + +.. bpo: 22236 +.. date: 7248 +.. nonce: ginJSI +.. section: Library + +Tkinter tests now don't reuse default root window. New root window is +created for every test class. + +.. + +.. bpo: 10744 +.. date: 7247 +.. nonce: kfV0wm +.. section: Library + +Fix PEP 3118 format strings on ctypes objects with a nontrivial shape. + +.. + +.. bpo: 20826 +.. date: 7246 +.. nonce: 3rXqMC +.. section: Library + +Optimize ipaddress.collapse_addresses(). + +.. + +.. bpo: 21487 +.. date: 7245 +.. nonce: sX8YmK +.. section: Library + +Optimize ipaddress.summarize_address_range() and +ipaddress.{IPv4Network,IPv6Network}.subnets(). + +.. + +.. bpo: 21486 +.. date: 7244 +.. nonce: CeFKRP +.. section: Library + +Optimize parsing of netmasks in ipaddress.IPv4Network and +ipaddress.IPv6Network. + +.. + +.. bpo: 13916 +.. date: 7243 +.. nonce: D77YVH +.. section: Library + +Disallowed the surrogatepass error handler for non UTF-\* encodings. + +.. + +.. bpo: 20998 +.. date: 7242 +.. nonce: fkxpXI +.. section: Library + +Fixed re.fullmatch() of repeated single character pattern with ignore case. +Original patch by Matthew Barnett. + +.. + +.. bpo: 21075 +.. date: 7241 +.. nonce: f_hmEh +.. section: Library + +fileinput.FileInput now reads bytes from standard stream if binary mode is +specified. Patch by Sam Kimbrel. + +.. + +.. bpo: 19775 +.. date: 7240 +.. nonce: yxxD_R +.. section: Library + +Add a samefile() method to pathlib Path objects. Initial patch by Vajrasky +Kok. + +.. + +.. bpo: 21226 +.. date: 7239 +.. nonce: pzGmG1 +.. section: Library + +Set up modules properly in PyImport_ExecCodeModuleObject (and friends). + +.. + +.. bpo: 21398 +.. date: 7238 +.. nonce: guSBXt +.. section: Library + +Fix a unicode error in the pydoc pager when the documentation contains +characters not encodable to the stdout encoding. + +.. + +.. bpo: 16531 +.. date: 7237 +.. nonce: AhrY_v +.. section: Library + +ipaddress.IPv4Network and ipaddress.IPv6Network now accept an (address, +netmask) tuple argument, so as to easily construct network objects from +existing addresses. + +.. + +.. bpo: 21156 +.. date: 7236 +.. nonce: 3dmBEp +.. section: Library + +importlib.abc.InspectLoader.source_to_code() is now a staticmethod. + +.. + +.. bpo: 21424 +.. date: 7235 +.. nonce: 8CJBqW +.. section: Library + +Simplified and optimized heaqp.nlargest() and nmsmallest() to make fewer +tuple comparisons. + +.. + +.. bpo: 21396 +.. date: 7234 +.. nonce: cqO6DN +.. section: Library + +Fix TextIOWrapper(..., write_through=True) to not force a flush() on the +underlying binary stream. Patch by akira. + +.. + +.. bpo: 18314 +.. date: 7233 +.. nonce: NCd_KF +.. section: Library + +Unlink now removes junctions on Windows. Patch by Kim Gr?sman + +.. + +.. bpo: 21088 +.. date: 7232 +.. nonce: WOg7Xy +.. section: Library + +Bugfix for curses.window.addch() regression in 3.4.0. In porting to Argument +Clinic, the first two arguments were reversed. + +.. + +.. bpo: 21407 +.. date: 7231 +.. nonce: cZjFde +.. section: Library + +_decimal: The module now supports function signatures. + +.. + +.. bpo: 10650 +.. date: 7230 +.. nonce: HYT4Oe +.. section: Library + +Remove the non-standard 'watchexp' parameter from the Decimal.quantize() +method in the Python version. It had never been present in the C version. + +.. + +.. bpo: 21469 +.. date: 7229 +.. nonce: _fFGuq +.. section: Library + +Reduced the risk of false positives in robotparser by checking to make sure +that robots.txt has been read or does not exist prior to returning True in +can_fetch(). + +.. + +.. bpo: 19414 +.. date: 7228 +.. nonce: bAAw4D +.. section: Library + +Have the OrderedDict mark deleted links as unusable. This gives an early +failure if the link is deleted during iteration. + +.. + +.. bpo: 21421 +.. date: 7227 +.. nonce: 5AKAat +.. section: Library + +Add __slots__ to the MappingViews ABC. Patch by Josh Rosenberg. + +.. + +.. bpo: 21101 +.. date: 7226 +.. nonce: Lj-_P4 +.. section: Library + +Eliminate double hashing in the C speed-up code for collections.Counter(). + +.. + +.. bpo: 21321 +.. date: 7225 +.. nonce: wUkTON +.. section: Library + +itertools.islice() now releases the reference to the source iterator when +the slice is exhausted. Patch by Anton Afanasyev. + +.. + +.. bpo: 21057 +.. date: 7224 +.. nonce: 0TC4Xl +.. section: Library + +TextIOWrapper now allows the underlying binary stream's read() or read1() +method to return an arbitrary bytes-like object (such as a memoryview). +Patch by Nikolaus Rath. + +.. + +.. bpo: 20951 +.. date: 7223 +.. nonce: tF0dJi +.. section: Library + +SSLSocket.send() now raises either SSLWantReadError or SSLWantWriteError on +a non-blocking socket if the operation would block. Previously, it would +return 0. Patch by Nikolaus Rath. + +.. + +.. bpo: 13248 +.. date: 7222 +.. nonce: 7vtGj0 +.. section: Library + +removed previously deprecated asyncore.dispatcher __getattr__ cheap +inheritance hack. + +.. + +.. bpo: 9815 +.. date: 7221 +.. nonce: 52FPlI +.. section: Library + +assertRaises now tries to clear references to local variables in the +exception's traceback. + +.. + +.. bpo: 19940 +.. date: 7220 +.. nonce: 2qtBQ8 +.. section: Library + +ssl.cert_time_to_seconds() now interprets the given time string in the UTC +timezone (as specified in RFC 5280), not the local timezone. + +.. + +.. bpo: 13204 +.. date: 7219 +.. nonce: ZPKA5g +.. section: Library + +Calling sys.flags.__new__ would crash the interpreter, now it raises a +TypeError. + +.. + +.. bpo: 19385 +.. date: 7218 +.. nonce: PexO_g +.. section: Library + +Make operations on a closed dbm.dumb database always raise the same +exception. + +.. + +.. bpo: 21207 +.. date: 7217 +.. nonce: Hr72AB +.. section: Library + +Detect when the os.urandom cached fd has been closed or replaced, and open +it anew. + +.. + +.. bpo: 21291 +.. date: 7216 +.. nonce: 5sSLWN +.. section: Library + +subprocess's Popen.wait() is now thread safe so that multiple threads may be +calling wait() or poll() on a Popen instance at the same time without losing +the Popen.returncode value. + +.. + +.. bpo: 21127 +.. date: 7215 +.. nonce: A1aBjG +.. section: Library + +Path objects can now be instantiated from str subclass instances (such as +``numpy.str_``). + +.. + +.. bpo: 15002 +.. date: 7214 +.. nonce: qorYDe +.. section: Library + +urllib.response object to use _TemporaryFileWrapper (and +_TemporaryFileCloser) facility. Provides a better way to handle file +descriptor close. Patch contributed by Christian Theune. + +.. + +.. bpo: 12220 +.. date: 7213 +.. nonce: U25uE9 +.. section: Library + +mindom now raises a custom ValueError indicating it doesn't support spaces +in URIs instead of letting a 'split' ValueError bubble up. + +.. + +.. bpo: 21068 +.. date: 7212 +.. nonce: 9k6N9m +.. section: Library + +The ssl.PROTOCOL* constants are now enum members. + +.. + +.. bpo: 21276 +.. date: 7211 +.. nonce: JkfhvQ +.. section: Library + +posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. + +.. + +.. bpo: 21262 +.. date: 7210 +.. nonce: 1J5ylk +.. section: Library + +New method assert_not_called for Mock. It raises AssertionError if the mock +has been called. + +.. + +.. bpo: 21238 +.. date: 7209 +.. nonce: 5CDoox +.. section: Library + +New keyword argument `unsafe` to Mock. It raises `AttributeError` incase of +an attribute startswith assert or assret. + +.. + +.. bpo: 20896 +.. date: 7208 +.. nonce: oWwAb1 +.. section: Library + +ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not PROTOCOL_SSLv3, +for maximum compatibility. + +.. + +.. bpo: 21239 +.. date: 7207 +.. nonce: EalCNt +.. section: Library + +patch.stopall() didn't work deterministically when the same name was patched +more than once. + +.. + +.. bpo: 21203 +.. date: 7206 +.. nonce: 1IMs-Z +.. section: Library + +Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure +Koren for the patch. + +.. + +.. bpo: 21222 +.. date: 7205 +.. nonce: G6MQBP +.. section: Library + +Passing name keyword argument to mock.create_autospec now works. + +.. + +.. bpo: 21197 +.. date: 7204 +.. nonce: Gzfqdl +.. section: Library + +Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. + +.. + +.. bpo: 17498 +.. date: 7203 +.. nonce: LR9xyb +.. section: Library + +Some SMTP servers disconnect after certain errors, violating strict RFC +conformance. Instead of losing the error code when we issue the subsequent +RSET, smtplib now returns the error code and defers raising the +SMTPServerDisconnected error until the next command is issued. + +.. + +.. bpo: 17826 +.. date: 7202 +.. nonce: z0zMRV +.. section: Library + +setting an iterable side_effect on a mock function created by +create_autospec now works. Patch by Kushal Das. + +.. + +.. bpo: 7776 +.. date: 7201 +.. nonce: K5S2Pe +.. section: Library + +Fix ``Host:`` header and reconnection when using +http.client.HTTPConnection.set_tunnel(). Patch by Nikolaus Rath. + +.. + +.. bpo: 20968 +.. date: 7200 +.. nonce: 53Aagz +.. section: Library + +unittest.mock.MagicMock now supports division. Patch by Johannes Baiter. + +.. + +.. bpo: 21529 +.. date: 7199 +.. nonce: 57R_Fc +.. section: Library + +Fix arbitrary memory access in JSONDecoder.raw_decode with a negative second +parameter. Bug reported by Guido Vranken. (See also: CVE-2014-4616) + +.. + +.. bpo: 21169 +.. date: 7198 +.. nonce: KE7B0M +.. section: Library + +getpass now handles non-ascii characters that the input stream encoding +cannot encode by re-encoding using the replace error handler. + +.. + +.. bpo: 21171 +.. date: 7197 +.. nonce: iUbV9S +.. section: Library + +Fixed undocumented filter API of the rot13 codec. Patch by Berker Peksag. + +.. + +.. bpo: 20539 +.. date: 7196 +.. nonce: 62nbEb +.. section: Library + +Improved math.factorial error message for large positive inputs and changed +exception type (OverflowError -> ValueError) for large negative inputs. + +.. + +.. bpo: 21172 +.. date: 7195 +.. nonce: dQ7yY7 +.. section: Library + +isinstance check relaxed from dict to collections.Mapping. + +.. + +.. bpo: 21155 +.. date: 7194 +.. nonce: JSKEE7 +.. section: Library + +asyncio.EventLoop.create_unix_server() now raises a ValueError if path and +sock are specified at the same time. + +.. + +.. bpo: 21136 +.. date: 7193 +.. nonce: JZAKv3 +.. section: Library + +Avoid unnecessary normalization of Fractions resulting from power and other +operations. Patch by Raymond Hettinger. + +.. + +.. bpo: 17621 +.. date: 7192 +.. nonce: 1x0mvJ +.. section: Library + +Introduce importlib.util.LazyLoader. + +.. + +.. bpo: 21076 +.. date: 7191 +.. nonce: upxQc6 +.. section: Library + +signal module constants were turned into enums. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 20636 +.. date: 7190 +.. nonce: KGh-BD +.. section: Library + +Improved the repr of Tkinter widgets. + +.. + +.. bpo: 19505 +.. date: 7189 +.. nonce: VEtIE6 +.. section: Library + +The items, keys, and values views of OrderedDict now support reverse +iteration using reversed(). + +.. + +.. bpo: 21149 +.. date: 7188 +.. nonce: cnjwMR +.. section: Library + +Improved thread-safety in logging cleanup during interpreter shutdown. +Thanks to Devin Jeanpierre for the patch. + +.. + +.. bpo: 21058 +.. date: 7187 +.. nonce: IhluPP +.. section: Library + +Fix a leak of file descriptor in :func:`tempfile.NamedTemporaryFile`, close +the file descriptor if :func:`io.open` fails + +.. + +.. bpo: 21200 +.. date: 7186 +.. nonce: Kht8yD +.. section: Library + +Return None from pkgutil.get_loader() when __spec__ is missing. + +.. + +.. bpo: 21013 +.. date: 7185 +.. nonce: 3s8Ic0 +.. section: Library + +Enhance ssl.create_default_context() when used for server side sockets to +provide better security by default. + +.. + +.. bpo: 20145 +.. date: 7184 +.. nonce: FP5FY0 +.. section: Library + +`assertRaisesRegex` and `assertWarnsRegex` now raise a TypeError if the +second argument is not a string or compiled regex. + +.. + +.. bpo: 20633 +.. date: 7183 +.. nonce: 6kaPjT +.. section: Library + +Replace relative import by absolute import. + +.. + +.. bpo: 20980 +.. date: 7182 +.. nonce: cYszHY +.. section: Library + +Stop wrapping exception when using ThreadPool. + +.. + +.. bpo: 21082 +.. date: 7181 +.. nonce: GLzGlV +.. section: Library + +In os.makedirs, do not set the process-wide umask. Note this changes +behavior of makedirs when exist_ok=True. + +.. + +.. bpo: 20990 +.. date: 7180 +.. nonce: PBfjW3 +.. section: Library + +Fix issues found by pyflakes for multiprocessing. + +.. + +.. bpo: 21015 +.. date: 7179 +.. nonce: xnwWAH +.. section: Library + +SSL contexts will now automatically select an elliptic curve for ECDH key +exchange on OpenSSL 1.0.2 and later, and otherwise default to "prime256v1". + +.. + +.. bpo: 21000 +.. date: 7178 +.. nonce: JUyyVV +.. section: Library + +Improve the command-line interface of json.tool. + +.. + +.. bpo: 20995 +.. date: 7177 +.. nonce: KSORJT +.. section: Library + +Enhance default ciphers used by the ssl module to enable better security and +prioritize perfect forward secrecy. + +.. + +.. bpo: 20884 +.. date: 7176 +.. nonce: qNmub_ +.. section: Library + +Don't assume that __file__ is defined on importlib.__init__. + +.. + +.. bpo: 21499 +.. date: 7175 +.. nonce: wU4OBi +.. section: Library + +Ignore __builtins__ in several test_importlib.test_api tests. + +.. + +.. bpo: 20627 +.. date: 7174 +.. nonce: fgfQ1x +.. section: Library + +xmlrpc.client.ServerProxy is now a context manager. + +.. + +.. bpo: 19165 +.. date: 7173 +.. nonce: sAkUjU +.. section: Library + +The formatter module now raises DeprecationWarning instead of +PendingDeprecationWarning. + +.. + +.. bpo: 13936 +.. date: 7172 +.. nonce: _Q0Yog +.. section: Library + +Remove the ability of datetime.time instances to be considered false in +boolean contexts. + +.. + +.. bpo: 18931 +.. date: 7171 +.. nonce: mq4Mud +.. section: Library + +selectors module now supports /dev/poll on Solaris. Patch by Giampaolo +Rodola'. + +.. + +.. bpo: 19977 +.. date: 7170 +.. nonce: A-sQ_V +.. section: Library + +When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), +:py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the +``surrogateescape`` error handler, instead of the ``strict`` error handler. + +.. + +.. bpo: 20574 +.. date: 7169 +.. nonce: KaKqSs +.. section: Library + +Implement incremental decoder for cp65001 code (Windows code page 65001, +Microsoft UTF-8). + +.. + +.. bpo: 20879 +.. date: 7168 +.. nonce: myeYdq +.. section: Library + +Delay the initialization of encoding and decoding tables for base32, ascii85 +and base85 codecs in the base64 module, and delay the initialization of the +unquote_to_bytes() table of the urllib.parse module, to not waste memory if +these modules are not used. + +.. + +.. bpo: 19157 +.. date: 7167 +.. nonce: V1-XhC +.. section: Library + +Include the broadcast address in the usuable hosts for IPv6 in ipaddress. + +.. + +.. bpo: 11599 +.. date: 7166 +.. nonce: 9QOXf4 +.. section: Library + +When an external command (e.g. compiler) fails, distutils now prints out the +whole command line (instead of just the command name) if the environment +variable DISTUTILS_DEBUG is set. + +.. + +.. bpo: 4931 +.. date: 7165 +.. nonce: uF10hr +.. section: Library + +distutils should not produce unhelpful "error: None" messages anymore. +distutils.util.grok_environment_error is kept but doc-deprecated. + +.. + +.. bpo: 20875 +.. date: 7164 +.. nonce: IjfI5V +.. section: Library + +Prevent possible gzip "'read' is not defined" NameError. Patch by Claudiu +Popa. + +.. + +.. bpo: 11558 +.. date: 7163 +.. nonce: pxrsmq +.. section: Library + +``email.message.Message.attach`` now returns a more useful error message if +``attach`` is called on a message for which ``is_multipart`` is False. + +.. + +.. bpo: 20283 +.. date: 7162 +.. nonce: v0Vs9V +.. section: Library + +RE pattern methods now accept the string keyword parameters as documented. +The pattern and source keyword parameters are left as deprecated aliases. + +.. + +.. bpo: 20778 +.. date: 7161 +.. nonce: g_fAGI +.. section: Library + +Fix modulefinder to work with bytecode-only modules. + +.. + +.. bpo: 20791 +.. date: 7160 +.. nonce: n_zrkc +.. section: Library + +copy.copy() now doesn't make a copy when the input is a bytes object. +Initial patch by Peter Otten. + +.. + +.. bpo: 19748 +.. date: 7159 +.. nonce: kiA171 +.. section: Library + +On AIX, time.mktime() now raises an OverflowError for year outsize range +[1902; 2037]. + +.. + +.. bpo: 19573 +.. date: 7158 +.. nonce: QJvX_V +.. section: Library + +inspect.signature: Use enum for parameter kind constants. + +.. + +.. bpo: 20726 +.. date: 7157 +.. nonce: 0yfRDI +.. section: Library + +inspect.signature: Make Signature and Parameter picklable. + +.. + +.. bpo: 17373 +.. date: 7156 +.. nonce: ECwuJO +.. section: Library + +Add inspect.Signature.from_callable method. + +.. + +.. bpo: 20378 +.. date: 7155 +.. nonce: l9M3H- +.. section: Library + +Improve repr of inspect.Signature and inspect.Parameter. + +.. + +.. bpo: 20816 +.. date: 7154 +.. nonce: DFMEgN +.. section: Library + +Fix inspect.getcallargs() to raise correct TypeError for missing keyword- +only arguments. Patch by Jeremiah Lowin. + +.. + +.. bpo: 20817 +.. date: 7153 +.. nonce: O5XyZB +.. section: Library + +Fix inspect.getcallargs() to fail correctly if more than 3 arguments are +missing. Patch by Jeremiah Lowin. + +.. + +.. bpo: 6676 +.. date: 7152 +.. nonce: CJu5On +.. section: Library + +Ensure a meaningful exception is raised when attempting to parse more than +one XML document per pyexpat xmlparser instance. (Original patches by +Hirokazu Yamamoto and Amaury Forgeot d'Arc, with suggested wording by David +Gutteridge) + +.. + +.. bpo: 21117 +.. date: 7151 +.. nonce: hyH7EK +.. section: Library + +Fix inspect.signature to better support functools.partial. Due to the +specifics of functools.partial implementation, positional-or-keyword +arguments passed as keyword arguments become keyword-only. + +.. + +.. bpo: 20334 +.. date: 7150 +.. nonce: 0yFmfQ +.. section: Library + +inspect.Signature and inspect.Parameter are now hashable. Thanks to Antony +Lee for bug reports and suggestions. + +.. + +.. bpo: 15916 +.. date: 7149 +.. nonce: _vhKPn +.. section: Library + +doctest.DocTestSuite returns an empty unittest.TestSuite instead of raising +ValueError if it finds no tests + +.. + +.. bpo: 21209 +.. date: 7148 +.. nonce: wRE7Dn +.. section: Library + +Fix asyncio.tasks.CoroWrapper to workaround a bug in yield-from +implementation in CPythons prior to 3.4.1. + +.. + +.. bpo: 0 +.. date: 7147 +.. nonce: Q1I78Z +.. section: Library + +asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream +issue #163). + +.. + +.. bpo: 21311 +.. date: 7146 +.. nonce: JsDF8H +.. section: Library + +Avoid exception in _osx_support with non-standard compiler configurations. +Patch by John Szakmeister. + +.. + +.. bpo: 11571 +.. date: 7145 +.. nonce: RPeGNo +.. section: Library + +Ensure that the turtle window becomes the topmost window when launched on OS +X. + +.. + +.. bpo: 21801 +.. date: 7144 +.. nonce: rzfhYl +.. section: Library + +Validate that __signature__ is None or an instance of Signature. + +.. + +.. bpo: 21923 +.. date: 7143 +.. nonce: hXnoZa +.. section: Library + +Prevent AttributeError in distutils.sysconfig.customize_compiler due to +possible uninitialized _config_vars. + +.. + +.. bpo: 21323 +.. date: 7142 +.. nonce: quiWfl +.. section: Library + +Fix http.server to again handle scripts in CGI subdirectories, broken by the +fix for security issue #19435. Patch by Zach Byrne. + +.. + +.. bpo: 22733 +.. date: 7141 +.. nonce: 21gJBp +.. section: Library + +Fix ffi_prep_args not zero-extending argument values correctly on 64-bit +Windows. + +.. + +.. bpo: 23302 +.. date: 7140 +.. nonce: X2dabK +.. section: Library + +Default to TCP_NODELAY=1 upon establishing an HTTPConnection. Removed use of +hard-coded MSS as it's an optimization that's no longer needed with Nagle +disabled. + +.. + +.. bpo: 20577 +.. date: 7139 +.. nonce: Y71IMj +.. section: IDLE + +Configuration of the max line length for the FormatParagraph extension has +been moved from the General tab of the Idle preferences dialog to the +FormatParagraph tab of the Config Extensions dialog. Patch by Tal Einat. + +.. + +.. bpo: 16893 +.. date: 7138 +.. nonce: JfHAA4 +.. section: IDLE + +Update Idle doc chapter to match current Idle and add new information. + +.. + +.. bpo: 3068 +.. date: 7137 +.. nonce: TYjXTA +.. section: IDLE + +Add Idle extension configuration dialog to Options menu. Changes are written +to HOME/.idlerc/config-extensions.cfg. Original patch by Tal Einat. + +.. + +.. bpo: 16233 +.. date: 7136 +.. nonce: sOadNo +.. section: IDLE + +A module browser (File : Class Browser, Alt+C) requires an editor window +with a filename. When Class Browser is requested otherwise, from a shell, +output window, or 'Untitled' editor, Idle no longer displays an error box. +It now pops up an Open Module box (Alt+M). If a valid name is entered and a +module is opened, a corresponding browser is also opened. + +.. + +.. bpo: 4832 +.. date: 7135 +.. nonce: GRKi9M +.. section: IDLE + +Save As to type Python files automatically adds .py to the name you enter +(even if your system does not display it). Some systems automatically add +.txt when type is Text files. + +.. + +.. bpo: 21986 +.. date: 7134 +.. nonce: 04GUv2 +.. section: IDLE + +Code objects are not normally pickled by the pickle module. To match this, +they are no longer pickled when running under Idle. + +.. + +.. bpo: 17390 +.. date: 7133 +.. nonce: I4vHFh +.. section: IDLE + +Adjust Editor window title; remove 'Python', move version to end. + +.. + +.. bpo: 14105 +.. date: 7132 +.. nonce: -FZwYH +.. section: IDLE + +Idle debugger breakpoints no longer disappear when inserting or deleting +lines. + +.. + +.. bpo: 17172 +.. date: 7131 +.. nonce: R8jkU1 +.. section: IDLE + +Turtledemo can now be run from Idle. Currently, the entry is on the Help +menu, but it may move to Run. Patch by Ramchandra Apt and Lita Cho. + +.. + +.. bpo: 21765 +.. date: 7130 +.. nonce: JyiDbd +.. section: IDLE + +Add support for non-ascii identifiers to HyperParser. + +.. + +.. bpo: 21940 +.. date: 7129 +.. nonce: VlIRz7 +.. section: IDLE + +Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar. + +.. + +.. bpo: 18592 +.. date: 7128 +.. nonce: sMG-SZ +.. section: IDLE + +Add unittest for SearchDialogBase. Patch by Phil Webster. + +.. + +.. bpo: 21694 +.. date: 7127 +.. nonce: 1oLmRo +.. section: IDLE + +Add unittest for ParenMatch. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 21686 +.. date: 7126 +.. nonce: TAkFB0 +.. section: IDLE + +add unittest for HyperParser. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 12387 +.. date: 7125 +.. nonce: XO7Ozk +.. section: IDLE + +Add missing upper(lower)case versions of default Windows key bindings for +Idle so Caps Lock does not disable them. Patch by Roger Serwy. + +.. + +.. bpo: 21695 +.. date: 7124 +.. nonce: g-t0Tm +.. section: IDLE + +Closing a Find-in-files output window while the search is still in progress +no longer closes Idle. + +.. + +.. bpo: 18910 +.. date: 7123 +.. nonce: ke8lMK +.. section: IDLE + +Add unittest for textView. Patch by Phil Webster. + +.. + +.. bpo: 18292 +.. date: 7122 +.. nonce: ks_3wm +.. section: IDLE + +Add unittest for AutoExpand. Patch by Saihadhav Heblikar. + +.. + +.. bpo: 18409 +.. date: 7121 +.. nonce: 7fe-aK +.. section: IDLE + +Add unittest for AutoComplete. Patch by Phil Webster. + +.. + +.. bpo: 21477 +.. date: 7120 +.. nonce: 33NOe0 +.. section: IDLE + +htest.py - Improve framework, complete set of tests. Patches by Saimadhav +Heblikar + +.. + +.. bpo: 18104 +.. date: 7119 +.. nonce: 8Fj9Pf +.. section: IDLE + +Add idlelib/idle_test/htest.py with a few sample tests to begin +consolidating and improving human-validated tests of Idle. Change other +files as needed to work with htest. Running the module as __main__ runs all +tests. + +.. + +.. bpo: 21139 +.. date: 7118 +.. nonce: kqetng +.. section: IDLE + +Change default paragraph width to 72, the PEP 8 recommendation. + +.. + +.. bpo: 21284 +.. date: 7117 +.. nonce: KKJfmv +.. section: IDLE + +Paragraph reformat test passes after user changes reformat width. + +.. + +.. bpo: 17654 +.. date: 7116 +.. nonce: NbzhNS +.. section: IDLE + +Ensure IDLE menus are customized properly on OS X for non-framework builds +and for all variants of Tk. + +.. + +.. bpo: 23180 +.. date: 7115 +.. nonce: cE_89F +.. section: IDLE + +Rename IDLE "Windows" menu item to "Window". Patch by Al Sweigart. + +.. + +.. bpo: 15506 +.. date: 7114 +.. nonce: nh8KlR +.. section: Build + +Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure script. + +.. + +.. bpo: 22935 +.. date: 7113 +.. nonce: -vY3lc +.. section: Build + +Allow the ssl module to be compiled if openssl doesn't support SSL 3. + +.. + +.. bpo: 22592 +.. date: 7112 +.. nonce: O_IE9W +.. section: Build + +Drop support of the Borland C compiler to build Python. The distutils module +still supports it to build extensions. + +.. + +.. bpo: 22591 +.. date: 7111 +.. nonce: wwBlG8 +.. section: Build + +Drop support of MS-DOS, especially of the DJGPP compiler (MS-DOS port of +GCC). + +.. + +.. bpo: 16537 +.. date: 7110 +.. nonce: llFo71 +.. section: Build + +Check whether self.extensions is empty in setup.py. Patch by Jonathan +Hosmer. + +.. + +.. bpo: 22359 +.. date: 7109 +.. nonce: YYFOFG +.. section: Build + +Remove incorrect uses of recursive make. Patch by Jonas Wagner. + +.. + +.. bpo: 21958 +.. date: 7108 +.. nonce: 3rq4qR +.. section: Build + +Define HAVE_ROUND when building with Visual Studio 2013 and above. Patch by +Zachary Turner. + +.. + +.. bpo: 18093 +.. date: 7107 +.. nonce: gnZieo +.. section: Build + +the programs that embed the CPython runtime are now in a separate "Programs" +directory, rather than being kept in the Modules directory. + +.. + +.. bpo: 15759 +.. date: 7106 +.. nonce: iGLR6O +.. section: Build + +"make suspicious", "make linkcheck" and "make doctest" in Doc/ now display +special message when and only when there are failures. + +.. + +.. bpo: 21141 +.. date: 7105 +.. nonce: 669LzK +.. section: Build + +The Windows build process no longer attempts to find Perl, instead relying +on OpenSSL source being configured and ready to build. The +``PCbuild\build_ssl.py`` script has been re-written and re-named to +``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source for +both 32 and 64 bit platforms. OpenSSL sources obtained from svn.python.org +will always be pre-configured and ready to build. + +.. + +.. bpo: 21037 +.. date: 7104 +.. nonce: v1rZzo +.. section: Build + +Add a build option to enable AddressSanitizer support. + +.. + +.. bpo: 19962 +.. date: 7103 +.. nonce: HDlwsE +.. section: Build + +The Windows build process now creates "python.bat" in the root of the source +tree, which passes all arguments through to the most recently built +interpreter. + +.. + +.. bpo: 21285 +.. date: 7102 +.. nonce: cU9p2E +.. section: Build + +Refactor and fix curses configure check to always search in a ncursesw +directory. + +.. + +.. bpo: 15234 +.. date: 7101 +.. nonce: vlM720 +.. section: Build + +For BerkelyDB and Sqlite, only add the found library and include directories +if they aren't already being searched. This avoids an explicit runtime +library dependency. + +.. + +.. bpo: 17861 +.. date: 7100 +.. nonce: jCi44U +.. section: Build + +Tools/scripts/generate_opcode_h.py automatically regenerates +Include/opcode.h from Lib/opcode.py if the latter gets any change. + +.. + +.. bpo: 20644 +.. date: 7099 +.. nonce: aV0zq7 +.. section: Build + +OS X installer build support for documentation build changes in 3.4.1: +assume externally supplied sphinx-build is available in /usr/bin. + +.. + +.. bpo: 20022 +.. date: 7098 +.. nonce: EqSCTW +.. section: Build + +Eliminate use of deprecated bundlebuilder in OS X builds. + +.. + +.. bpo: 15968 +.. date: 7097 +.. nonce: vxUxHK +.. section: Build + +Incorporated Tcl, Tk, and Tix builds into the Windows build solution. + +.. + +.. bpo: 17095 +.. date: 7096 +.. nonce: -XEBIU +.. section: Build + +Fix Modules/Setup *shared* support. + +.. + +.. bpo: 21811 +.. date: 7095 +.. nonce: 3_Xyr- +.. section: Build + +Anticipated fixes to support OS X versions > 10.9. + +.. + +.. bpo: 21166 +.. date: 7094 +.. nonce: KAl7aO +.. section: Build + +Prevent possible segfaults and other random failures of python --generate- +posix-vars in pybuilddir.txt build target. + +.. + +.. bpo: 18096 +.. date: 7093 +.. nonce: ELyAUJ +.. section: Build + +Fix library order returned by python-config. + +.. + +.. bpo: 17219 +.. date: 7092 +.. nonce: q8ueQ0 +.. section: Build + +Add library build dir for Python extension cross-builds. + +.. + +.. bpo: 22919 +.. date: 7091 +.. nonce: 1XThL9 +.. section: Build + +Windows build updated to support VC 14.0 (Visual Studio 2015), which will be +used for the official release. + +.. + +.. bpo: 21236 +.. date: 7090 +.. nonce: 84LXxj +.. section: Build + +Build _msi.pyd with cabinet.lib instead of fci.lib + +.. + +.. bpo: 17128 +.. date: 7089 +.. nonce: U2biLA +.. section: Build + +Use private version of OpenSSL for OS X 10.5+ installer. + +.. + +.. bpo: 14203 +.. date: 7088 +.. nonce: 3hv0TX +.. section: C API + +Remove obsolete support for view==NULL in PyBuffer_FillInfo(), +bytearray_getbuffer(), bytesiobuf_getbuffer() and array_buffer_getbuf(). All +functions now raise BufferError in that case. + +.. + +.. bpo: 22445 +.. date: 7087 +.. nonce: s0AOAS +.. section: C API + +PyBuffer_IsContiguous() now implements precise contiguity tests, compatible +with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation flag. Previously the +function reported false negatives for corner cases. + +.. + +.. bpo: 22079 +.. date: 7086 +.. nonce: zhs2qM +.. section: C API + +PyType_Ready() now checks that statically allocated type has no dynamically +allocated bases. + +.. + +.. bpo: 22453 +.. date: 7085 +.. nonce: XoO4ns +.. section: C API + +Removed non-documented macro PyObject_REPR(). + +.. + +.. bpo: 18395 +.. date: 7084 +.. nonce: YC9B06 +.. section: C API + +Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename +``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these +functions. + +.. + +.. bpo: 21233 +.. date: 7083 +.. nonce: 98hZAt +.. section: C API + +Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), PyObject_Calloc(), +_PyObject_GC_Calloc(). bytes(int) is now using ``calloc()`` instead of +``malloc()`` for large objects which is faster and use less memory. + +.. + +.. bpo: 20942 +.. date: 7082 +.. nonce: qHLJ5- +.. section: C API + +PyImport_ImportFrozenModuleObject() no longer sets __file__ to match what +importlib does; this affects _frozen_importlib as well as any module loaded +using imp.init_frozen(). + +.. + +.. bpo: 19548 +.. date: 7081 +.. nonce: yOX8sS +.. section: Documentation + +Update the codecs module documentation to better cover the distinction +between text encodings and other codecs, together with other clarifications. +Patch by Martin Panter. + +.. + +.. bpo: 22394 +.. date: 7080 +.. nonce: 6bJywY +.. section: Documentation + +Doc/Makefile now supports ``make venv PYTHON=../python`` to create a venv +for generating the documentation, e.g., ``make html +PYTHON=venv/bin/python3``. + +.. + +.. bpo: 21514 +.. date: 7079 +.. nonce: 1H16T6 +.. section: Documentation + +The documentation of the json module now refers to new JSON RFC 7159 instead +of obsoleted RFC 4627. + +.. + +.. bpo: 21777 +.. date: 7078 +.. nonce: dtQCWV +.. section: Documentation + +The binary sequence methods on bytes and bytearray are now documented +explicitly, rather than assuming users will be able to derive the expected +behaviour from the behaviour of the corresponding str methods. + +.. + +.. bpo: 6916 +.. date: 7077 +.. nonce: 4sm3nE +.. section: Documentation + +undocument deprecated asynchat.fifo class. + +.. + +.. bpo: 17386 +.. date: 7076 +.. nonce: ivaGLb +.. section: Documentation + +Expanded functionality of the ``Doc/make.bat`` script to make it much more +comparable to ``Doc/Makefile``. + +.. + +.. bpo: 21312 +.. date: 7075 +.. nonce: 6IqcV4 +.. section: Documentation + +Update the thread_foobar.h template file to include newer threading APIs. +Patch by Jack McCracken. + +.. + +.. bpo: 21043 +.. date: 7074 +.. nonce: oEOC8O +.. section: Documentation + +Remove the recommendation for specific CA organizations and to mention the +ability to load the OS certificates. + +.. + +.. bpo: 20765 +.. date: 7073 +.. nonce: Rv3GgV +.. section: Documentation + +Add missing documentation for PurePath.with_name() and +PurePath.with_suffix(). + +.. + +.. bpo: 19407 +.. date: 7072 +.. nonce: mRyNnG +.. section: Documentation + +New package installation and distribution guides based on the Python +Packaging Authority tools. Existing guides have been retained as legacy +links from the distutils docs, as they still contain some required reference +material for tool developers that isn't recorded anywhere else. + +.. + +.. bpo: 19697 +.. date: 7071 +.. nonce: 2jMQBP +.. section: Documentation + +Document cases where __main__.__spec__ is None. + +.. + +.. bpo: 18982 +.. date: 7070 +.. nonce: TynSM6 +.. section: Tests + +Add tests for CLI of the calendar module. + +.. + +.. bpo: 19548 +.. date: 7069 +.. nonce: 25Kxq_ +.. section: Tests + +Added some additional checks to test_codecs to ensure that statements in the +updated documentation remain accurate. Patch by Martin Panter. + +.. + +.. bpo: 22838 +.. date: 7068 +.. nonce: VZBtZg +.. section: Tests + +All test_re tests now work with unittest test discovery. + +.. + +.. bpo: 22173 +.. date: 7067 +.. nonce: dxIIVx +.. section: Tests + +Update lib2to3 tests to use unittest test discovery. + +.. + +.. bpo: 16000 +.. date: 7066 +.. nonce: Y7O6TP +.. section: Tests + +Convert test_curses to use unittest. + +.. + +.. bpo: 21456 +.. date: 7065 +.. nonce: Axsw43 +.. section: Tests + +Skip two tests in test_urllib2net.py if _ssl module not present. Patch by +Remi Pointel. + +.. + +.. bpo: 20746 +.. date: 7064 +.. nonce: N2pzAY +.. section: Tests + +Fix test_pdb to run in refleak mode (-R). Patch by Xavier de Gaye. + +.. + +.. bpo: 22060 +.. date: 7063 +.. nonce: TduJNO +.. section: Tests + +test_ctypes has been somewhat cleaned up and simplified; it now uses +unittest test discovery to find its tests. + +.. + +.. bpo: 22104 +.. date: 7062 +.. nonce: -YYDup +.. section: Tests + +regrtest.py no longer holds a reference to the suite of tests loaded from +test modules that don't define test_main(). + +.. + +.. bpo: 22111 +.. date: 7061 +.. nonce: 0XlFAU +.. section: Tests + +Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. + +.. + +.. bpo: 22002 +.. date: 7060 +.. nonce: jpiaA2 +.. section: Tests + +Added ``load_package_tests`` function to test.support and used it to +implement/augment test discovery in test_asyncio, test_email, +test_importlib, test_json, and test_tools. + +.. + +.. bpo: 21976 +.. date: 7059 +.. nonce: Slq6se +.. section: Tests + +Fix test_ssl to accept LibreSSL version strings. Thanks to William Orr. + +.. + +.. bpo: 21918 +.. date: 7058 +.. nonce: QTFFSj +.. section: Tests + +Converted test_tools from a module to a package containing separate test +files for each tested script. + +.. + +.. bpo: 9554 +.. date: 7057 +.. nonce: VsP0Ve +.. section: Tests + +Use modern unittest features in test_argparse. Initial patch by Denver +Coneybeare and Radu Voicilas. + +.. + +.. bpo: 20155 +.. date: 7056 +.. nonce: nphzS3 +.. section: Tests + +Changed HTTP method names in failing tests in test_httpservers so that +packet filtering software (specifically Windows Base Filtering Engine) does +not interfere with the transaction semantics expected by the tests. + +.. + +.. bpo: 19493 +.. date: 7055 +.. nonce: SwbzLQ +.. section: Tests + +Refactored the ctypes test package to skip tests explicitly rather than +silently. + +.. + +.. bpo: 18492 +.. date: 7054 +.. nonce: ylPRU7 +.. section: Tests + +All resources are now allowed when tests are not run by regrtest.py. + +.. + +.. bpo: 21634 +.. date: 7053 +.. nonce: Eng06F +.. section: Tests + +Fix pystone micro-benchmark: use floor division instead of true division to +benchmark integers instead of floating point numbers. Set pystone version to +1.2. Patch written by Lennart Regebro. + +.. + +.. bpo: 21605 +.. date: 7052 +.. nonce: qsLV8d +.. section: Tests + +Added tests for Tkinter images. + +.. + +.. bpo: 21493 +.. date: 7051 +.. nonce: NqhRsy +.. section: Tests + +Added test for ntpath.expanduser(). Original patch by Claudiu Popa. + +.. + +.. bpo: 19925 +.. date: 7050 +.. nonce: dhMx08 +.. section: Tests + +Added tests for the spwd module. Original patch by Vajrasky Kok. + +.. + +.. bpo: 21522 +.. date: 7049 +.. nonce: b-VwFW +.. section: Tests + +Added Tkinter tests for Listbox.itemconfigure(), +PanedWindow.paneconfigure(), and Menu.entryconfigure(). + +.. + +.. bpo: 17756 +.. date: 7048 +.. nonce: LLfbfU +.. section: Tests + +Fix test_code test when run from the installed location. + +.. + +.. bpo: 17752 +.. date: 7047 +.. nonce: P8iG44 +.. section: Tests + +Fix distutils tests when run from the installed location. + +.. + +.. bpo: 18604 +.. date: 7046 +.. nonce: Q00Xrj +.. section: Tests + +Consolidated checks for GUI availability. All platforms now at least check +whether Tk can be instantiated when the GUI resource is requested. + +.. + +.. bpo: 21275 +.. date: 7045 +.. nonce: lI5FkX +.. section: Tests + +Fix a socket test on KFreeBSD. + +.. + +.. bpo: 21223 +.. date: 7044 +.. nonce: lMY6ka +.. section: Tests + +Pass test_site/test_startup_imports when some of the extensions are built as +builtins. + +.. + +.. bpo: 20635 +.. date: 7043 +.. nonce: mzWmoS +.. section: Tests + +Added tests for Tk geometry managers. + +.. + +.. bpo: 0 +.. date: 7042 +.. nonce: E5XNqr +.. section: Tests + +Add test case for freeze. + +.. + +.. bpo: 20743 +.. date: 7041 +.. nonce: hxZQUf +.. section: Tests + +Fix a reference leak in test_tcl. + +.. + +.. bpo: 21097 +.. date: 7040 +.. nonce: gsUesm +.. section: Tests + +Move test_namespace_pkgs into test_importlib. + +.. + +.. bpo: 21503 +.. date: 7039 +.. nonce: H9TPCg +.. section: Tests + +Use test_both() consistently in test_importlib. + +.. + +.. bpo: 20939 +.. date: 7038 +.. nonce: x3KQ35 +.. section: Tests + +Avoid various network test failures due to new redirect of +http://www.python.org/ to https://www.python.org: use http://www.example.com +instead. + +.. + +.. bpo: 20668 +.. date: 7037 +.. nonce: IWjOSC +.. section: Tests + +asyncio tests no longer rely on tests.txt file. (Patch by Vajrasky Kok) + +.. + +.. bpo: 21093 +.. date: 7036 +.. nonce: CcpRim +.. section: Tests + +Prevent failures of ctypes test_macholib on OS X if a copy of libz exists in +$HOME/lib or /usr/local/lib. + +.. + +.. bpo: 22770 +.. date: 7035 +.. nonce: FxAh91 +.. section: Tests + +Prevent some Tk segfaults on OS X when running gui tests. + +.. + +.. bpo: 23211 +.. date: 7034 +.. nonce: Bc-QfJ +.. section: Tests + +Workaround test_logging failure on some OS X 10.6 systems. + +.. + +.. bpo: 23345 +.. date: 7033 +.. nonce: HIGBKx +.. section: Tests + +Prevent test_ssl failures with large OpenSSL patch level values (like +0.9.8zc). + +.. + +.. bpo: 22314 +.. date: 7032 +.. nonce: ws6xsH +.. section: Tools/Demos + +pydoc now works when the LINES environment variable is set. + +.. + +.. bpo: 22615 +.. date: 7031 +.. nonce: My3DWN +.. section: Tools/Demos + +Argument Clinic now supports the "type" argument for the int converter. +This permits using the int converter with enums and typedefs. + +.. + +.. bpo: 20076 +.. date: 7030 +.. nonce: ZNuBrC +.. section: Tools/Demos + +The makelocalealias.py script no longer ignores UTF-8 mapping. + +.. + +.. bpo: 20079 +.. date: 7029 +.. nonce: ogPXcK +.. section: Tools/Demos + +The makelocalealias.py script now can parse the SUPPORTED file from glibc +sources and supports command line options for source paths. + +.. + +.. bpo: 22201 +.. date: 7028 +.. nonce: k1Awbh +.. section: Tools/Demos + +Command-line interface of the zipfile module now correctly extracts ZIP +files with directory entries. Patch by Ryan Wilson. + +.. + +.. bpo: 22120 +.. date: 7027 +.. nonce: KmBUj- +.. section: Tools/Demos + +For functions using an unsigned integer return converter, Argument Clinic +now generates a cast to that type for the comparison to -1 in the generated +code. (This suppresses a compilation warning.) + +.. + +.. bpo: 18974 +.. date: 7026 +.. nonce: I3DdAo +.. section: Tools/Demos + +Tools/scripts/diff.py now uses argparse instead of optparse. + +.. + +.. bpo: 21906 +.. date: 7025 +.. nonce: ZsKy9v +.. section: Tools/Demos + +Make Tools/scripts/md5sum.py work in Python 3. Patch by Zachary Ware. + +.. + +.. bpo: 21629 +.. date: 7024 +.. nonce: 9kZmQl +.. section: Tools/Demos + +Fix Argument Clinic's "--converters" feature. + +.. + +.. bpo: 0 +.. date: 7023 +.. nonce: _-ge-g +.. section: Tools/Demos + +Add support for ``yield from`` to 2to3. + +.. + +.. bpo: 0 +.. date: 7022 +.. nonce: dpFbyZ +.. section: Tools/Demos + +Add support for the PEP 465 matrix multiplication operator to 2to3. + +.. + +.. bpo: 16047 +.. date: 7021 +.. nonce: IsgTzm +.. section: Tools/Demos + +Fix module exception list and __file__ handling in freeze. Patch by Meador +Inge. + +.. + +.. bpo: 11824 +.. date: 7020 +.. nonce: OBWc3T +.. section: Tools/Demos + +Consider ABI tags in freeze. Patch by Meador Inge. + +.. + +.. bpo: 20535 +.. date: 7019 +.. nonce: 0qkvZZ +.. section: Tools/Demos + +PYTHONWARNING no longer affects the run_tests.py script. Patch by Arfrever +Frehtes Taifersar Arahesis. + +.. + +.. bpo: 23260 +.. date: 7018 +.. nonce: aZ5VLH +.. section: Windows + +Update Windows installer + +.. + +.. bpo: 0 +.. date: 7017 +.. nonce: _aEUNt +.. section: Windows + +The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible +result of this change is the addition of new native file dialogs when +running on Windows Vista or newer. See Tcl/Tk's TIP 432 for more +information. Also, this version of Tcl/Tk includes support for Windows 10. + +.. + +.. bpo: 17896 +.. date: 7016 +.. nonce: o79rHM +.. section: Windows + +The Windows build scripts now expect external library sources to be in +``PCbuild\..\externals`` rather than ``PCbuild\..\..``. + +.. + +.. bpo: 17717 +.. date: 7015 +.. nonce: y1zoye +.. section: Windows + +The Windows build scripts now use a copy of NASM pulled from svn.python.org +to build OpenSSL. + +.. + +.. bpo: 21907 +.. date: 7014 +.. nonce: jm1smN +.. section: Windows + +Improved the batch scripts provided for building Python. + +.. + +.. bpo: 22644 +.. date: 7013 +.. nonce: gosBki +.. section: Windows + +The bundled version of OpenSSL has been updated to 1.0.1j. + +.. + +.. bpo: 10747 +.. date: 7012 +.. nonce: LTWhLn +.. section: Windows + +Use versioned labels in the Windows start menu. Patch by Olive Kilburn. + +.. + +.. bpo: 22980 +.. date: 7011 +.. nonce: -UypE5 +.. section: Windows + +.pyd files with a version and platform tag (for example, ".cp35-win32.pyd") +will now be loaded in preference to those without tags. diff --git a/Misc/NEWS.d/3.5.0a2.rst b/Misc/NEWS.d/3.5.0a2.rst new file mode 100644 index 00000000000..ab0c671fa43 --- /dev/null +++ b/Misc/NEWS.d/3.5.0a2.rst @@ -0,0 +1,406 @@ +.. bpo: 23571 +.. date: 7650 +.. nonce: GTkAkq +.. release date: 2015-03-09 +.. section: Core and Builtins + +PyObject_Call() and PyCFunction_Call() now raise a SystemError if a function +returns a result and raises an exception. The SystemError is chained to the +previous exception. + +.. + +.. bpo: 22524 +.. date: 7649 +.. nonce: Ks6_2x +.. section: Library + +New os.scandir() function, part of the PEP 471: "os.scandir() function -- a +better and faster directory iterator". Patch written by Ben Hoyt. + +.. + +.. bpo: 23103 +.. date: 7648 +.. nonce: I3RLIV +.. section: Library + +Reduced the memory consumption of IPv4Address and IPv6Address. + +.. + +.. bpo: 21793 +.. date: 7647 +.. nonce: GQtYMM +.. section: Library + +BaseHTTPRequestHandler again logs response code as numeric, not as +stringified enum. Patch by Demian Brecht. + +.. + +.. bpo: 23476 +.. date: 7646 +.. nonce: 82QV9I +.. section: Library + +In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST flag on +certificate stores when it is available. + +.. + +.. bpo: 23576 +.. date: 7645 +.. nonce: 98F-PP +.. section: Library + +Avoid stalling in SSL reads when EOF has been reached in the SSL layer but +the underlying connection hasn't been closed. + +.. + +.. bpo: 23504 +.. date: 7644 +.. nonce: o31h5I +.. section: Library + +Added an __all__ to the types module. + +.. + +.. bpo: 23563 +.. date: 7643 +.. nonce: iQB-ba +.. section: Library + +Optimized utility functions in urllib.parse. + +.. + +.. bpo: 7830 +.. date: 7642 +.. nonce: irvPdC +.. section: Library + +Flatten nested functools.partial. + +.. + +.. bpo: 20204 +.. date: 7641 +.. nonce: DorA4b +.. section: Library + +Added the __module__ attribute to _tkinter classes. + +.. + +.. bpo: 19980 +.. date: 7640 +.. nonce: whwzL_ +.. section: Library + +Improved help() for non-recognized strings. help('') now shows the help on +str. help('help') now shows the help on help(). Original patch by Mark +Lawrence. + +.. + +.. bpo: 23521 +.. date: 7639 +.. nonce: HvwFfd +.. section: Library + +Corrected pure python implementation of timedelta division. + +Eliminated OverflowError from ``timedelta * float`` for some floats; +Corrected rounding in timedlta true division. + +.. + +.. bpo: 21619 +.. date: 7638 +.. nonce: uL0SZh +.. section: Library + +Popen objects no longer leave a zombie after exit in the with statement if +the pipe was broken. Patch by Martin Panter. + +.. + +.. bpo: 22936 +.. date: 7637 +.. nonce: JrhGYd +.. section: Library + +Make it possible to show local variables in tracebacks for both the +traceback module and unittest. + +.. + +.. bpo: 15955 +.. date: 7636 +.. nonce: _8nYPy +.. section: Library + +Add an option to limit the output size in bz2.decompress(). Patch by +Nikolaus Rath. + +.. + +.. bpo: 6639 +.. date: 7635 +.. nonce: rmjUmG +.. section: Library + +Module-level turtle functions no longer raise TclError after closing the +window. + +.. + +.. bpo: 814253 +.. date: 7634 +.. nonce: icZb-I +.. section: Library + +Group references and conditional group references now work in lookbehind +assertions in regular expressions. (See also: bpo-9179) + +.. + +.. bpo: 23215 +.. date: 7633 +.. nonce: VHVSVX +.. section: Library + +Multibyte codecs with custom error handlers that ignores errors consumed too +much memory and raised SystemError or MemoryError. Original patch by Aleksi +Torhamo. + +.. + +.. bpo: 5700 +.. date: 7632 +.. nonce: iA5yzL +.. section: Library + +io.FileIO() called flush() after closing the file. flush() was not called in +close() if closefd=False. + +.. + +.. bpo: 23374 +.. date: 7631 +.. nonce: 8A9LuZ +.. section: Library + +Fixed pydoc failure with non-ASCII files when stdout encoding differs from +file system encoding (e.g. on Mac OS). + +.. + +.. bpo: 23481 +.. date: 7630 +.. nonce: ZWwliG +.. section: Library + +Remove RC4 from the SSL module's default cipher list. + +.. + +.. bpo: 21548 +.. date: 7629 +.. nonce: CmO_Yh +.. section: Library + +Fix pydoc.synopsis() and pydoc.apropos() on modules with empty docstrings. + +.. + +.. bpo: 22885 +.. date: 7628 +.. nonce: p8FnYk +.. section: Library + +Fixed arbitrary code execution vulnerability in the dbm.dumb module. +Original patch by Claudiu Popa. + +.. + +.. bpo: 23239 +.. date: 7627 +.. nonce: PGUq7T +.. section: Library + +ssl.match_hostname() now supports matching of IP addresses. + +.. + +.. bpo: 23146 +.. date: 7626 +.. nonce: PW-O3u +.. section: Library + +Fix mishandling of absolute Windows paths with forward slashes in pathlib. + +.. + +.. bpo: 23096 +.. date: 7625 +.. nonce: Ftrmf3 +.. section: Library + +Pickle representation of floats with protocol 0 now is the same for both +Python and C implementations. + +.. + +.. bpo: 19105 +.. date: 7624 +.. nonce: ZK07Ff +.. section: Library + +pprint now more efficiently uses free space at the right. + +.. + +.. bpo: 14910 +.. date: 7623 +.. nonce: zueIhP +.. section: Library + +Add allow_abbrev parameter to argparse.ArgumentParser. Patch by Jonathan +Paugh, Steven Bethard, paul j3 and Daniel Eriksson. + +.. + +.. bpo: 21717 +.. date: 7622 +.. nonce: Knut81 +.. section: Library + +tarfile.open() now supports 'x' (exclusive creation) mode. + +.. + +.. bpo: 23344 +.. date: 7621 +.. nonce: ieu8C1 +.. section: Library + +marshal.dumps() is now 20-25% faster on average. + +.. + +.. bpo: 20416 +.. date: 7620 +.. nonce: cwEgkL +.. section: Library + +marshal.dumps() with protocols 3 and 4 is now 40-50% faster on average. + +.. + +.. bpo: 23421 +.. date: 7619 +.. nonce: eckzoV +.. section: Library + +Fixed compression in tarfile CLI. Patch by wdv4758h. + +.. + +.. bpo: 23367 +.. date: 7618 +.. nonce: kHnFiz +.. section: Library + +Fix possible overflows in the unicodedata module. + +.. + +.. bpo: 23361 +.. date: 7617 +.. nonce: I_w0-z +.. section: Library + +Fix possible overflow in Windows subprocess creation code. + +.. + +.. bpo: 0 +.. date: 7616 +.. nonce: sfmjTs +.. section: Library + +logging.handlers.QueueListener now takes a respect_handler_level keyword +argument which, if set to True, will pass messages to handlers taking +handler levels into account. + +.. + +.. bpo: 19705 +.. date: 7615 +.. nonce: WLzTRV +.. section: Library + +turtledemo now has a visual sorting algorithm demo. Original patch from +Jason Yeo. + +.. + +.. bpo: 23801 +.. date: 7614 +.. nonce: jyJK3z +.. section: Library + +Fix issue where cgi.FieldStorage did not always ignore the entire preamble +to a multipart body. + +.. + +.. bpo: 23445 +.. date: 7613 +.. nonce: 7fmkYO +.. section: Build + +pydebug builds now use "gcc -Og" where possible, to make the resulting +executable faster. + +.. + +.. bpo: 23686 +.. date: 7612 +.. nonce: B7jDXY +.. section: Build + +Update OS X 10.5 installer build to use OpenSSL 1.0.2a. + +.. + +.. bpo: 20204 +.. date: 7611 +.. nonce: M_jcNK +.. section: C API + +Deprecation warning is now raised for builtin types without the __module__ +attribute. + +.. + +.. bpo: 23465 +.. date: 7610 +.. nonce: qBauCy +.. section: Windows + +Implement PEP 486 - Make the Python Launcher aware of virtual environments. +Patch by Paul Moore. + +.. + +.. bpo: 23437 +.. date: 7609 +.. nonce: ro9X8r +.. section: Windows + +Make user scripts directory versioned on Windows. Patch by Paul Moore. diff --git a/Misc/NEWS.d/3.5.0a3.rst b/Misc/NEWS.d/3.5.0a3.rst new file mode 100644 index 00000000000..a096809951d --- /dev/null +++ b/Misc/NEWS.d/3.5.0a3.rst @@ -0,0 +1,518 @@ +.. bpo: 23573 +.. date: 7702 +.. nonce: ZpM4D- +.. release date: 2015-03-28 +.. section: Core and Builtins + +Increased performance of string search operations (str.find, str.index, +str.count, the in operator, str.split, str.partition) with arguments of +different kinds (UCS1, UCS2, UCS4). + +.. + +.. bpo: 23753 +.. date: 7701 +.. nonce: CREjLC +.. section: Core and Builtins + +Python doesn't support anymore platforms without stat() or fstat(), these +functions are always required. + +.. + +.. bpo: 23681 +.. date: 7700 +.. nonce: kh02TF +.. section: Core and Builtins + +The -b option now affects comparisons of bytes with int. + +.. + +.. bpo: 23632 +.. date: 7699 +.. nonce: UVdIZY +.. section: Core and Builtins + +Memoryviews now allow tuple indexing (including for multi-dimensional +memoryviews). + +.. + +.. bpo: 23192 +.. date: 7698 +.. nonce: QKqdow +.. section: Core and Builtins + +Fixed generator lambdas. Patch by Bruno Cauet. + +.. + +.. bpo: 23629 +.. date: 7697 +.. nonce: r9Mt2C +.. section: Core and Builtins + +Fix the default __sizeof__ implementation for variable-sized objects. + +.. + +.. bpo: 14260 +.. date: 7696 +.. nonce: b5M04V +.. section: Library + +The groupindex attribute of regular expression pattern object now is non- +modifiable mapping. + +.. + +.. bpo: 23792 +.. date: 7695 +.. nonce: Kfm9-f +.. section: Library + +Ignore KeyboardInterrupt when the pydoc pager is active. This mimics the +behavior of the standard unix pagers, and prevents pipepager from shutting +down while the pager itself is still running. + +.. + +.. bpo: 23775 +.. date: 7694 +.. nonce: xKGrSQ +.. section: Library + +pprint() of OrderedDict now outputs the same representation as repr(). + +.. + +.. bpo: 23765 +.. date: 7693 +.. nonce: 2ta_C4 +.. section: Library + +Removed IsBadStringPtr calls in ctypes + +.. + +.. bpo: 22364 +.. date: 7692 +.. nonce: ejtoKl +.. section: Library + +Improved some re error messages using regex for hints. + +.. + +.. bpo: 23742 +.. date: 7691 +.. nonce: _EkAIa +.. section: Library + +ntpath.expandvars() no longer loses unbalanced single quotes. + +.. + +.. bpo: 21717 +.. date: 7690 +.. nonce: pKndpx +.. section: Library + +The zipfile.ZipFile.open function now supports 'x' (exclusive creation) +mode. + +.. + +.. bpo: 21802 +.. date: 7689 +.. nonce: ygSM2A +.. section: Library + +The reader in BufferedRWPair now is closed even when closing writer failed +in BufferedRWPair.close(). + +.. + +.. bpo: 23622 +.. date: 7688 +.. nonce: 9-ZRqj +.. section: Library + +Unknown escapes in regular expressions that consist of ``'\'`` and ASCII +letter now raise a deprecation warning and will be forbidden in Python 3.6. + +.. + +.. bpo: 23671 +.. date: 7687 +.. nonce: zWPm-a +.. section: Library + +string.Template now allows specifying the "self" parameter as a keyword +argument. string.Formatter now allows specifying the "self" and the +"format_string" parameters as keyword arguments. + +.. + +.. bpo: 23502 +.. date: 7686 +.. nonce: AH20IQ +.. section: Library + +The pprint module now supports mapping proxies. + +.. + +.. bpo: 17530 +.. date: 7685 +.. nonce: PUp8rL +.. section: Library + +pprint now wraps long bytes objects and bytearrays. + +.. + +.. bpo: 22687 +.. date: 7684 +.. nonce: zEJPd9 +.. section: Library + +Fixed some corner cases in breaking words in tetxtwrap. Got rid of quadratic +complexity in breaking long words. + +.. + +.. bpo: 4727 +.. date: 7683 +.. nonce: iDQSpi +.. section: Library + +The copy module now uses pickle protocol 4 (PEP 3154) and supports copying +of instances of classes whose __new__ method takes keyword-only arguments. + +.. + +.. bpo: 23491 +.. date: 7682 +.. nonce: P_WKrt +.. section: Library + +Added a zipapp module to support creating executable zip file archives of +Python code. Registered ".pyz" and ".pyzw" extensions on Windows for these +archives (PEP 441). + +.. + +.. bpo: 23657 +.. date: 7681 +.. nonce: y1OaV- +.. section: Library + +Avoid explicit checks for str in zipapp, adding support for pathlib.Path +objects as arguments. + +.. + +.. bpo: 23688 +.. date: 7680 +.. nonce: d6LVy3 +.. section: Library + +Added support of arbitrary bytes-like objects and avoided unnecessary +copying of memoryview in gzip.GzipFile.write(). Original patch by Wolfgang +Maier. + +.. + +.. bpo: 23252 +.. date: 7679 +.. nonce: Goi18g +.. section: Library + +Added support for writing ZIP files to unseekable streams. + +.. + +.. bpo: 23647 +.. date: 7678 +.. nonce: pX2qrx +.. section: Library + +Increase impalib's MAXLINE to accommodate modern mailbox sizes. + +.. + +.. bpo: 23539 +.. date: 7677 +.. nonce: 5BVUim +.. section: Library + +If body is None, http.client.HTTPConnection.request now sets Content-Length +to 0 for PUT, POST, and PATCH headers to avoid 411 errors from some web +servers. + +.. + +.. bpo: 22351 +.. date: 7676 +.. nonce: agB8Y3 +.. section: Library + +The nntplib.NNTP constructor no longer leaves the connection and socket open +until the garbage collector cleans them up. Patch by Martin Panter. + +.. + +.. bpo: 23704 +.. date: 7675 +.. nonce: LTyyxL +.. section: Library + +collections.deque() objects now support methods for index(), insert(), and +copy(). This allows deques to be registered as a MutableSequence and it +improves their substitutability for lists. + +.. + +.. bpo: 23715 +.. date: 7674 +.. nonce: Yap3tU +.. section: Library + +:func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are now retried +when interrupted by a signal not in the *sigset* parameter, if the signal +handler does not raise an exception. signal.sigtimedwait() recomputes the +timeout with a monotonic clock when it is retried. + +.. + +.. bpo: 23001 +.. date: 7673 +.. nonce: YSFnam +.. section: Library + +Few functions in modules mmap, ossaudiodev, socket, ssl, and codecs, that +accepted only read-only bytes-like object now accept writable bytes-like +object too. + +.. + +.. bpo: 23646 +.. date: 7672 +.. nonce: Tljc1S +.. section: Library + +If time.sleep() is interrupted by a signal, the sleep is now retried with +the recomputed delay, except if the signal handler raises an exception (PEP +475). + +.. + +.. bpo: 23136 +.. date: 7671 +.. nonce: 1bnpnb +.. section: Library + +_strptime now uniformly handles all days in week 0, including Dec 30 of +previous year. Based on patch by Jim Carroll. + +.. + +.. bpo: 23700 +.. date: 7670 +.. nonce: VfnWwi +.. section: Library + +Iterator of NamedTemporaryFile now keeps a reference to NamedTemporaryFile +instance. Patch by Bohuslav Kabrda. + +.. + +.. bpo: 22903 +.. date: 7669 +.. nonce: 2GjTHY +.. section: Library + +The fake test case created by unittest.loader when it fails importing a test +module is now picklable. + +.. + +.. bpo: 22181 +.. date: 7668 +.. nonce: 7mnxea +.. section: Library + +On Linux, os.urandom() now uses the new getrandom() syscall if available, +syscall introduced in the Linux kernel 3.17. It is more reliable and more +secure, because it avoids the need of a file descriptor and waits until the +kernel has enough entropy. + +.. + +.. bpo: 2211 +.. date: 7667 +.. nonce: 17Iz5U +.. section: Library + +Updated the implementation of the http.cookies.Morsel class. Setting +attributes key, value and coded_value directly now is deprecated. update() +and setdefault() now transform and check keys. Comparing for equality now +takes into account attributes key, value and coded_value. copy() now returns +a Morsel, not a dict. repr() now contains all attributes. Optimized +checking keys and quoting values. Added new tests. Original patch by Demian +Brecht. + +.. + +.. bpo: 18983 +.. date: 7666 +.. nonce: vF4i2S +.. section: Library + +Allow selection of output units in timeit. Patch by Julian Gindi. + +.. + +.. bpo: 23631 +.. date: 7665 +.. nonce: GfSqNI +.. section: Library + +Fix traceback.format_list when a traceback has been mutated. + +.. + +.. bpo: 23568 +.. date: 7664 +.. nonce: ffzJc7 +.. section: Library + +Add rdivmod support to MagicMock() objects. Patch by H?kan L?vdahl. + +.. + +.. bpo: 2052 +.. date: 7663 +.. nonce: ujNgna +.. section: Library + +Add charset parameter to HtmlDiff.make_file(). + +.. + +.. bpo: 23668 +.. date: 7662 +.. nonce: nF_jnN +.. section: Library + +Support os.truncate and os.ftruncate on Windows. + +.. + +.. bpo: 23138 +.. date: 7661 +.. nonce: 4vMoMZ +.. section: Library + +Fixed parsing cookies with absent keys or values in cookiejar. Patch by +Demian Brecht. + +.. + +.. bpo: 23051 +.. date: 7660 +.. nonce: Vi5tCZ +.. section: Library + +multiprocessing.Pool methods imap() and imap_unordered() now handle +exceptions raised by an iterator. Patch by Alon Diamant and Davin Potts. + +.. + +.. bpo: 23581 +.. date: 7659 +.. nonce: D4Lknl +.. section: Library + +Add matmul support to MagicMock. Patch by H?kan L?vdahl. + +.. + +.. bpo: 23566 +.. date: 7658 +.. nonce: F6LSyk +.. section: Library + +enable(), register(), dump_traceback() and dump_traceback_later() functions +of faulthandler now accept file descriptors. Patch by Wei Wu. + +.. + +.. bpo: 22928 +.. date: 7657 +.. nonce: q2TmY0 +.. section: Library + +Disabled HTTP header injections in http.client. Original patch by Demian +Brecht. + +.. + +.. bpo: 23615 +.. date: 7656 +.. nonce: 5Kx9k5 +.. section: Library + +Modules bz2, tarfile and tokenize now can be reloaded with imp.reload(). +Patch by Thomas Kluyver. + +.. + +.. bpo: 23605 +.. date: 7655 +.. nonce: JUOA_X +.. section: Library + +os.walk() now calls os.scandir() instead of os.listdir(). The usage of +os.scandir() reduces the number of calls to os.stat(). Initial patch written +by Ben Hoyt. + +.. + +.. bpo: 23585 +.. date: 7654 +.. nonce: DTIIoI +.. section: Build + +make patchcheck will ensure the interpreter is built. + +.. + +.. bpo: 23583 +.. date: 7653 +.. nonce: bY8AbM +.. section: Tests + +Added tests for standard IO streams in IDLE. + +.. + +.. bpo: 22289 +.. date: 7652 +.. nonce: ybGcC- +.. section: Tests + +Prevent test_urllib2net failures due to ftp connection timeout. + +.. + +.. bpo: 22826 +.. date: 7651 +.. nonce: 3bcoDL +.. section: Tools/Demos + +The result of open() in Tools/freeze/bkfile.py is now better compatible with +regular files (in particular it now supports the context management +protocol). diff --git a/Misc/NEWS.d/3.5.0a4.rst b/Misc/NEWS.d/3.5.0a4.rst new file mode 100644 index 00000000000..50aa1aa88a8 --- /dev/null +++ b/Misc/NEWS.d/3.5.0a4.rst @@ -0,0 +1,665 @@ +.. bpo: 22980 +.. date: 7769 +.. nonce: Lu_y6y +.. release date: 2015-04-19 +.. section: Core and Builtins + +Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include the +architecture triplet in the extension name, to make it easy to test builds +for different ABIs in the same working tree. Under OS X, the extension name +now includes PEP 3149-style information. + +.. + +.. bpo: 22631 +.. date: 7768 +.. nonce: nTx_ZF +.. section: Core and Builtins + +Added Linux-specific socket constant CAN_RAW_FD_FRAMES. Patch courtesy of +Joe Jevnik. + +.. + +.. bpo: 23731 +.. date: 7767 +.. nonce: FOXb37 +.. section: Core and Builtins + +Implement PEP 488: removal of .pyo files. + +.. + +.. bpo: 23726 +.. date: 7766 +.. nonce: ZopTQ0 +.. section: Core and Builtins + +Don't enable GC for user subclasses of non-GC types that don't add any new +fields. Patch by Eugene Toder. + +.. + +.. bpo: 23309 +.. date: 7765 +.. nonce: Wfnsnz +.. section: Core and Builtins + +Avoid a deadlock at shutdown if a daemon thread is aborted while it is +holding a lock to a buffered I/O object, and the main thread tries to use +the same I/O object (typically stdout or stderr). A fatal error is emitted +instead. + +.. + +.. bpo: 22977 +.. date: 7764 +.. nonce: hutEse +.. section: Core and Builtins + +Fixed formatting Windows error messages on Wine. Patch by Martin Panter. + +.. + +.. bpo: 23466 +.. date: 7763 +.. nonce: KhMltK +.. section: Core and Builtins + +%c, %o, %x, and %X in bytes formatting now raise TypeError on non-integer +input. + +.. + +.. bpo: 24044 +.. date: 7762 +.. nonce: H7vb6- +.. section: Core and Builtins + +Fix possible null pointer dereference in list.sort in out of memory +conditions. + +.. + +.. bpo: 21354 +.. date: 7761 +.. nonce: ZZTe1E +.. section: Core and Builtins + +PyCFunction_New function is exposed by python DLL again. + +.. + +.. bpo: 23840 +.. date: 7760 +.. nonce: mtSbqO +.. section: Library + +tokenize.open() now closes the temporary binary file on error to fix a +resource warning. + +.. + +.. bpo: 16914 +.. date: 7759 +.. nonce: GrP2Jr +.. section: Library + +new debuglevel 2 in smtplib adds timestamps to debug output. + +.. + +.. bpo: 7159 +.. date: 7758 +.. nonce: KCgOUm +.. section: Library + +urllib.request now supports sending auth credentials automatically after the +first 401. This enhancement is a superset of the enhancement from issue +#19494 and supersedes that change. + +.. + +.. bpo: 23703 +.. date: 7757 +.. nonce: kYybxm +.. section: Library + +Fix a regression in urljoin() introduced in 901e4e52b20a. Patch by Demian +Brecht. + +.. + +.. bpo: 4254 +.. date: 7756 +.. nonce: eUC_2H +.. section: Library + +Adds _curses.update_lines_cols(). Patch by Arnon Yaari + +.. + +.. bpo: 19933 +.. date: 7755 +.. nonce: Qq8utk +.. section: Library + +Provide default argument for ndigits in round. Patch by Vajrasky Kok. + +.. + +.. bpo: 23193 +.. date: 7754 +.. nonce: n5ahcG +.. section: Library + +Add a numeric_owner parameter to tarfile.TarFile.extract and +tarfile.TarFile.extractall. Patch by Michael Vogt and Eric Smith. + +.. + +.. bpo: 23342 +.. date: 7753 +.. nonce: CbSzYI +.. section: Library + +Add a subprocess.run() function than returns a CalledProcess instance for a +more consistent API than the existing call* functions. + +.. + +.. bpo: 21217 +.. date: 7752 +.. nonce: TkFTlk +.. section: Library + +inspect.getsourcelines() now tries to compute the start and end lines from +the code object, fixing an issue when a lambda function is used as decorator +argument. Patch by Thomas Ballinger and Allison Kaptur. + +.. + +.. bpo: 24521 +.. date: 7751 +.. nonce: bn4U-y +.. section: Library + +Fix possible integer overflows in the pickle module. + +.. + +.. bpo: 22931 +.. date: 7750 +.. nonce: 4CuWYD +.. section: Library + +Allow '[' and ']' in cookie values. + +.. + +.. bpo: 0 +.. date: 7749 +.. nonce: fgX8Qe +.. section: Library + +The keywords attribute of functools.partial is now always a dictionary. + +.. + +.. bpo: 23811 +.. date: 7748 +.. nonce: B6tzf9 +.. section: Library + +Add missing newline to the PyCompileError error message. Patch by Alex +Shkop. + +.. + +.. bpo: 21116 +.. date: 7747 +.. nonce: Orft3K +.. section: Library + +Avoid blowing memory when allocating a multiprocessing shared array that's +larger than 50% of the available RAM. Patch by M?d?ric Boquien. + +.. + +.. bpo: 22982 +.. date: 7746 +.. nonce: xYmG62 +.. section: Library + +Improve BOM handling when seeking to multiple positions of a writable text +file. + +.. + +.. bpo: 23464 +.. date: 7745 +.. nonce: _XGkBk +.. section: Library + +Removed deprecated asyncio JoinableQueue. + +.. + +.. bpo: 23529 +.. date: 7744 +.. nonce: Hr7AHH +.. section: Library + +Limit the size of decompressed data when reading from GzipFile, BZ2File or +LZMAFile. This defeats denial of service attacks using compressed bombs +(i.e. compressed payloads which decompress to a huge size). Patch by Martin +Panter and Nikolaus Rath. + +.. + +.. bpo: 21859 +.. date: 7743 +.. nonce: GYrUNP +.. section: Library + +Added Python implementation of io.FileIO. + +.. + +.. bpo: 23865 +.. date: 7742 +.. nonce: PtSLgU +.. section: Library + +close() methods in multiple modules now are idempotent and more robust at +shutdown. If they need to release multiple resources, all are released even +if errors occur. + +.. + +.. bpo: 23400 +.. date: 7741 +.. nonce: JSh9Z3 +.. section: Library + +Raise same exception on both Python 2 and 3 if sem_open is not available. +Patch by Davin Potts. + +.. + +.. bpo: 10838 +.. date: 7740 +.. nonce: p9tSPC +.. section: Library + +The subprocess now module includes SubprocessError and TimeoutError in its +list of exported names for the users wild enough to use ``from subprocess +import *``. + +.. + +.. bpo: 23411 +.. date: 7739 +.. nonce: 0im3Qw +.. section: Library + +Added DefragResult, ParseResult, SplitResult, DefragResultBytes, +ParseResultBytes, and SplitResultBytes to urllib.parse.__all__. Patch by +Martin Panter. + +.. + +.. bpo: 23881 +.. date: 7738 +.. nonce: yZjl4b +.. section: Library + +urllib.request.ftpwrapper constructor now closes the socket if the FTP +connection failed to fix a ResourceWarning. + +.. + +.. bpo: 23853 +.. date: 7737 +.. nonce: mNY1eI +.. section: Library + +:meth:`socket.socket.sendall` does no more reset the socket timeout each +time data is sent successfully. The socket timeout is now the maximum total +duration to send all data. + +.. + +.. bpo: 22721 +.. date: 7736 +.. nonce: MVfBL9 +.. section: Library + +An order of multiline pprint output of set or dict containing orderable and +non-orderable elements no longer depends on iteration order of set or dict. + +.. + +.. bpo: 15133 +.. date: 7735 +.. nonce: C0QfV8 +.. section: Library + +_tkinter.tkapp.getboolean() now supports Tcl_Obj and always returns bool. +tkinter.BooleanVar now validates input values (accepted bool, int, str, and +Tcl_Obj). tkinter.BooleanVar.get() now always returns bool. + +.. + +.. bpo: 10590 +.. date: 7734 +.. nonce: nkxXfU +.. section: Library + +xml.sax.parseString() now supports string argument. + +.. + +.. bpo: 23338 +.. date: 7733 +.. nonce: ZYMGN1 +.. section: Library + +Fixed formatting ctypes error messages on Cygwin. Patch by Makoto Kato. + +.. + +.. bpo: 15582 +.. date: 7732 +.. nonce: 26wJNk +.. section: Library + +inspect.getdoc() now follows inheritance chains. + +.. + +.. bpo: 2175 +.. date: 7731 +.. nonce: cHiVOp +.. section: Library + +SAX parsers now support a character stream of InputSource object. + +.. + +.. bpo: 16840 +.. date: 7730 +.. nonce: kKIhPm +.. section: Library + +Tkinter now supports 64-bit integers added in Tcl 8.4 and arbitrary +precision integers added in Tcl 8.5. + +.. + +.. bpo: 23834 +.. date: 7729 +.. nonce: fX3TF4 +.. section: Library + +Fix socket.sendto(), use the C Py_ssize_t type to store the result of +sendto() instead of the C int type. + +.. + +.. bpo: 23618 +.. date: 7728 +.. nonce: Of_q5t +.. section: Library + +:meth:`socket.socket.connect` now waits until the connection completes +instead of raising :exc:`InterruptedError` if the connection is interrupted +by signals, signal handlers don't raise an exception and the socket is +blocking or has a timeout. :meth:`socket.socket.connect` still raise +:exc:`InterruptedError` for non-blocking sockets. + +.. + +.. bpo: 21526 +.. date: 7727 +.. nonce: QQEXrR +.. section: Library + +Tkinter now supports new boolean type in Tcl 8.5. + +.. + +.. bpo: 23836 +.. date: 7726 +.. nonce: zrEmlR +.. section: Library + +Fix the faulthandler module to handle reentrant calls to its signal +handlers. + +.. + +.. bpo: 23838 +.. date: 7725 +.. nonce: IX6FPX +.. section: Library + +linecache now clears the cache and returns an empty result on MemoryError. + +.. + +.. bpo: 10395 +.. date: 7724 +.. nonce: fi_lZp +.. section: Library + +Added os.path.commonpath(). Implemented in posixpath and ntpath. Based on +patch by Rafik Draoui. + +.. + +.. bpo: 23611 +.. date: 7723 +.. nonce: QkBJVB +.. section: Library + +Serializing more "lookupable" objects (such as unbound methods or nested +classes) now are supported with pickle protocols < 4. + +.. + +.. bpo: 13583 +.. date: 7722 +.. nonce: -MPBjZ +.. section: Library + +sqlite3.Row now supports slice indexing. + +.. + +.. bpo: 18473 +.. date: 7721 +.. nonce: 89RHm- +.. section: Library + +Fixed 2to3 and 3to2 compatible pickle mappings. Fixed ambigious reverse +mappings. Added many new mappings. Import mapping is no longer applied to +modules already mapped with full name mapping. + +.. + +.. bpo: 23485 +.. date: 7720 +.. nonce: kQWN6L +.. section: Library + +select.select() is now retried automatically with the recomputed timeout +when interrupted by a signal, except if the signal handler raises an +exception. This change is part of the PEP 475. + +.. + +.. bpo: 23752 +.. date: 7719 +.. nonce: 5fbVNb +.. section: Library + +When built from an existing file descriptor, io.FileIO() now only calls +fstat() once. Before fstat() was called twice, which was not necessary. + +.. + +.. bpo: 23704 +.. date: 7718 +.. nonce: Ggjvm8 +.. section: Library + +collections.deque() objects now support __add__, __mul__, and __imul__(). + +.. + +.. bpo: 23171 +.. date: 7717 +.. nonce: b6PBzM +.. section: Library + +csv.Writer.writerow() now supports arbitrary iterables. + +.. + +.. bpo: 23745 +.. date: 7716 +.. nonce: E00Bml +.. section: Library + +The new email header parser now handles duplicate MIME parameter names +without error, similar to how get_param behaves. + +.. + +.. bpo: 22117 +.. date: 7715 +.. nonce: bTO0xx +.. section: Library + +Fix os.utime(), it now rounds the timestamp towards minus infinity (-inf) +instead of rounding towards zero. + +.. + +.. bpo: 23310 +.. date: 7714 +.. nonce: GXmFMR +.. section: Library + +Fix MagicMock's initializer to work with __methods__, just like +configure_mock(). Patch by Kasia Jachim. + +.. + +.. bpo: 23817 +.. date: 7713 +.. nonce: DTmVan +.. section: Build + +FreeBSD now uses "1.0" in the SOVERSION as other operating systems, instead +of just "1". + +.. + +.. bpo: 23501 +.. date: 7712 +.. nonce: iz10e6 +.. section: Build + +Argument Clinic now generates code into separate files by default. + +.. + +.. bpo: 23799 +.. date: 7711 +.. nonce: XU2xDw +.. section: Tests + +Added test.support.start_threads() for running and cleaning up multiple +threads. + +.. + +.. bpo: 22390 +.. date: 7710 +.. nonce: UPVFnq +.. section: Tests + +test.regrtest now emits a warning if temporary files or directories are left +after running a test. + +.. + +.. bpo: 18128 +.. date: 7709 +.. nonce: lx2V5a +.. section: Tools/Demos + +pygettext now uses standard +NNNN format in the POT-Creation-Date header. + +.. + +.. bpo: 23935 +.. date: 7708 +.. nonce: JSYowT +.. section: Tools/Demos + +Argument Clinic's understanding of format units accepting bytes, bytearrays, +and buffers is now consistent with both the documentation and the +implementation. + +.. + +.. bpo: 23944 +.. date: 7707 +.. nonce: Q8ZL2s +.. section: Tools/Demos + +Argument Clinic now wraps long impl prototypes at column 78. + +.. + +.. bpo: 20586 +.. date: 7706 +.. nonce: 7BiEkx +.. section: Tools/Demos + +Argument Clinic now ensures that functions without docstrings have +signatures. + +.. + +.. bpo: 23492 +.. date: 7705 +.. nonce: kjIcQW +.. section: Tools/Demos + +Argument Clinic now generates argument parsing code with PyArg_Parse instead +of PyArg_ParseTuple if possible. + +.. + +.. bpo: 23500 +.. date: 7704 +.. nonce: H6_dX_ +.. section: Tools/Demos + +Argument Clinic is now smarter about generating the "#ifndef" (empty) +definition of the methoddef macro: it's only generated once, even if +Argument Clinic processes the same symbol multiple times, and it's emitted +at the end of all processing rather than immediately after the first use. + +.. + +.. bpo: 23998 +.. date: 7703 +.. nonce: z7mlLW +.. section: C API + +PyImport_ReInitLock() now checks for lock allocation error diff --git a/Misc/NEWS.d/3.5.0b1.rst b/Misc/NEWS.d/3.5.0b1.rst new file mode 100644 index 00000000000..e3c7ff7b07d --- /dev/null +++ b/Misc/NEWS.d/3.5.0b1.rst @@ -0,0 +1,848 @@ +.. bpo: 24276 +.. date: 7857 +.. nonce: awsxJJ +.. release date: 2015-05-24 +.. section: Core and Builtins + +Fixed optimization of property descriptor getter. + +.. + +.. bpo: 24268 +.. date: 7856 +.. nonce: nS7uea +.. section: Core and Builtins + +PEP 489: Multi-phase extension module initialization. Patch by Petr +Viktorin. + +.. + +.. bpo: 23955 +.. date: 7855 +.. nonce: hBHSaU +.. section: Core and Builtins + +Add pyvenv.cfg option to suppress registry/environment lookup for generating +sys.path on Windows. + +.. + +.. bpo: 24257 +.. date: 7854 +.. nonce: UBxshR +.. section: Core and Builtins + +Fixed system error in the comparison of faked types.SimpleNamespace. + +.. + +.. bpo: 22939 +.. date: 7853 +.. nonce: DWA9ls +.. section: Core and Builtins + +Fixed integer overflow in iterator object. Patch by Clement Rouault. + +.. + +.. bpo: 23985 +.. date: 7852 +.. nonce: eezPxO +.. section: Core and Builtins + +Fix a possible buffer overrun when deleting a slice from the front of a +bytearray and then appending some other bytes data. + +.. + +.. bpo: 24102 +.. date: 7851 +.. nonce: 9T6h3m +.. section: Core and Builtins + +Fixed exception type checking in standard error handlers. + +.. + +.. bpo: 15027 +.. date: 7850 +.. nonce: wi9sCd +.. section: Core and Builtins + +The UTF-32 encoder is now 3x to 7x faster. + +.. + +.. bpo: 23290 +.. date: 7849 +.. nonce: 57aqLU +.. section: Core and Builtins + +Optimize set_merge() for cases where the target is empty. (Contributed by +Serhiy Storchaka.) + +.. + +.. bpo: 2292 +.. date: 7848 +.. nonce: h4sibO +.. section: Core and Builtins + +PEP 448: Additional Unpacking Generalizations. + +.. + +.. bpo: 24096 +.. date: 7847 +.. nonce: a_Rap7 +.. section: Core and Builtins + +Make warnings.warn_explicit more robust against mutation of the +warnings.filters list. + +.. + +.. bpo: 23996 +.. date: 7846 +.. nonce: znqcT8 +.. section: Core and Builtins + +Avoid a crash when a delegated generator raises an unnormalized +StopIteration exception. Patch by Stefan Behnel. + +.. + +.. bpo: 23910 +.. date: 7845 +.. nonce: _gDzaj +.. section: Core and Builtins + +Optimize property() getter calls. Patch by Joe Jevnik. + +.. + +.. bpo: 23911 +.. date: 7844 +.. nonce: 0FnTHk +.. section: Core and Builtins + +Move path-based importlib bootstrap code to a separate frozen module. + +.. + +.. bpo: 24192 +.. date: 7843 +.. nonce: 6ZxJ_R +.. section: Core and Builtins + +Fix namespace package imports. + +.. + +.. bpo: 24022 +.. date: 7842 +.. nonce: 1l8YBm +.. section: Core and Builtins + +Fix tokenizer crash when processing undecodable source code. + +.. + +.. bpo: 9951 +.. date: 7841 +.. nonce: wGztNC +.. section: Core and Builtins + +Added a hex() method to bytes, bytearray, and memoryview. + +.. + +.. bpo: 22906 +.. date: 7840 +.. nonce: WN_kQ6 +.. section: Core and Builtins + +PEP 479: Change StopIteration handling inside generators. + +.. + +.. bpo: 24017 +.. date: 7839 +.. nonce: QJa1SC +.. section: Core and Builtins + +PEP 492: Coroutines with async and await syntax. + +.. + +.. bpo: 14373 +.. date: 7838 +.. nonce: 0sk6kE +.. section: Library + +Added C implementation of functools.lru_cache(). Based on patches by Matt +Joiner and Alexey Kachayev. + +.. + +.. bpo: 24230 +.. date: 7837 +.. nonce: b-kgme +.. section: Library + +The tempfile module now accepts bytes for prefix, suffix and dir parameters +and returns bytes in such situations (matching the os module APIs). + +.. + +.. bpo: 22189 +.. date: 7836 +.. nonce: 8epgat +.. section: Library + +collections.UserString now supports __getnewargs__(), __rmod__(), +casefold(), format_map(), isprintable(), and maketrans(). Patch by Joe +Jevnik. + +.. + +.. bpo: 24244 +.. date: 7835 +.. nonce: OKE_3R +.. section: Library + +Prevents termination when an invalid format string is encountered on Windows +in strftime. + +.. + +.. bpo: 23973 +.. date: 7834 +.. nonce: EK6awi +.. section: Library + +PEP 484: Add the typing module. + +.. + +.. bpo: 23086 +.. date: 7833 +.. nonce: Aix6Nv +.. section: Library + +The collections.abc.Sequence() abstract base class added *start* and *stop* +parameters to the index() mixin. Patch by Devin Jeanpierre. + +.. + +.. bpo: 20035 +.. date: 7832 +.. nonce: UNZzw6 +.. section: Library + +Replaced the ``tkinter._fix`` module used for setting up the Tcl/Tk +environment on Windows with a private function in the ``_tkinter`` module +that makes no permanent changes to the environment. + +.. + +.. bpo: 24257 +.. date: 7831 +.. nonce: L_efq0 +.. section: Library + +Fixed segmentation fault in sqlite3.Row constructor with faked cursor type. + +.. + +.. bpo: 15836 +.. date: 7830 +.. nonce: gU3Rmx +.. section: Library + +assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() +assertments now check the type of the first argument to prevent possible +user error. Based on patch by Daniel Wagner-Hall. + +.. + +.. bpo: 9858 +.. date: 7829 +.. nonce: uke9pa +.. section: Library + +Add missing method stubs to _io.RawIOBase. Patch by Laura Rupprecht. + +.. + +.. bpo: 22955 +.. date: 7828 +.. nonce: Jw_B9_ +.. section: Library + +attrgetter, itemgetter and methodcaller objects in the operator module now +support pickling. Added readable and evaluable repr for these objects. +Based on patch by Josh Rosenberg. + +.. + +.. bpo: 22107 +.. date: 7827 +.. nonce: 2F8k4W +.. section: Library + +tempfile.gettempdir() and tempfile.mkdtemp() now try again when a directory +with the chosen name already exists on Windows as well as on Unix. +tempfile.mkstemp() now fails early if parent directory is not valid (not +exists or is a file) on Windows. + +.. + +.. bpo: 23780 +.. date: 7826 +.. nonce: jFPVcN +.. section: Library + +Improved error message in os.path.join() with single argument. + +.. + +.. bpo: 6598 +.. date: 7825 +.. nonce: JdZNDt +.. section: Library + +Increased time precision and random number range in email.utils.make_msgid() +to strengthen the uniqueness of the message ID. + +.. + +.. bpo: 24091 +.. date: 7824 +.. nonce: Jw0-wj +.. section: Library + +Fixed various crashes in corner cases in C implementation of ElementTree. + +.. + +.. bpo: 21931 +.. date: 7823 +.. nonce: t6lGxY +.. section: Library + +msilib.FCICreate() now raises TypeError in the case of a bad argument +instead of a ValueError with a bogus FCI error number. Patch by Jeffrey +Armstrong. + +.. + +.. bpo: 13866 +.. date: 7822 +.. nonce: n5NAj0 +.. section: Library + +*quote_via* argument added to urllib.parse.urlencode. + +.. + +.. bpo: 20098 +.. date: 7821 +.. nonce: Y4otaf +.. section: Library + +New mangle_from policy option for email, default True for compat32, but +False for all other policies. + +.. + +.. bpo: 24211 +.. date: 7820 +.. nonce: j3Afpc +.. section: Library + +The email library now supports RFC 6532: it can generate headers using utf-8 +instead of encoded words. + +.. + +.. bpo: 16314 +.. date: 7819 +.. nonce: Xc4d1O +.. section: Library + +Added support for the LZMA compression in distutils. + +.. + +.. bpo: 21804 +.. date: 7818 +.. nonce: lEhTlc +.. section: Library + +poplib now supports RFC 6856 (UTF8). + +.. + +.. bpo: 18682 +.. date: 7817 +.. nonce: 6Pnfte +.. section: Library + +Optimized pprint functions for builtin scalar types. + +.. + +.. bpo: 22027 +.. date: 7816 +.. nonce: _aeUQS +.. section: Library + +smtplib now supports RFC 6531 (SMTPUTF8). + +.. + +.. bpo: 23488 +.. date: 7815 +.. nonce: 7gs3Cm +.. section: Library + +Random generator objects now consume 2x less memory on 64-bit. + +.. + +.. bpo: 1322 +.. date: 7814 +.. nonce: 495nFL +.. section: Library + +platform.dist() and platform.linux_distribution() functions are now +deprecated. Initial patch by Vajrasky Kok. + +.. + +.. bpo: 22486 +.. date: 7813 +.. nonce: Yxov5m +.. section: Library + +Added the math.gcd() function. The fractions.gcd() function now is +deprecated. Based on patch by Mark Dickinson. + +.. + +.. bpo: 24064 +.. date: 7812 +.. nonce: zXC7OL +.. section: Library + +Property() docstrings are now writeable. (Patch by Berker Peksag.) + +.. + +.. bpo: 22681 +.. date: 7811 +.. nonce: 2rIoA2 +.. section: Library + +Added support for the koi8_t encoding. + +.. + +.. bpo: 22682 +.. date: 7810 +.. nonce: cP4i3L +.. section: Library + +Added support for the kz1048 encoding. + +.. + +.. bpo: 23796 +.. date: 7809 +.. nonce: JJmUnc +.. section: Library + +peek and read1 methods of BufferedReader now raise ValueError if they called +on a closed object. Patch by John Hergenroeder. + +.. + +.. bpo: 21795 +.. date: 7808 +.. nonce: BDLMS4 +.. section: Library + +smtpd now supports the 8BITMIME extension whenever the new *decode_data* +constructor argument is set to False. + +.. + +.. bpo: 24155 +.. date: 7807 +.. nonce: FZx5c2 +.. section: Library + +optimize heapq.heapify() for better cache performance when heapifying large +lists. + +.. + +.. bpo: 21800 +.. date: 7806 +.. nonce: evGSKc +.. section: Library + +imaplib now supports RFC 5161 (enable), RFC 6855 (utf8/internationalized +email) and automatically encodes non-ASCII usernames and passwords to UTF8. + +.. + +.. bpo: 20274 +.. date: 7805 +.. nonce: uVHogg +.. section: Library + +When calling a _sqlite.Connection, it now complains if passed any keyword +arguments. Previously it silently ignored them. + +.. + +.. bpo: 20274 +.. date: 7804 +.. nonce: hBst4M +.. section: Library + +Remove ignored and erroneous "kwargs" parameters from three METH_VARARGS +methods on _sqlite.Connection. + +.. + +.. bpo: 24134 +.. date: 7803 +.. nonce: Ajw0S- +.. section: Library + +assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() +checks now emits a deprecation warning when callable is None or keyword +arguments except msg is passed in the context manager mode. + +.. + +.. bpo: 24018 +.. date: 7802 +.. nonce: hk7Rcn +.. section: Library + +Add a collections.abc.Generator abstract base class. Contributed by Stefan +Behnel. + +.. + +.. bpo: 23880 +.. date: 7801 +.. nonce: QtKupC +.. section: Library + +Tkinter's getint() and getdouble() now support Tcl_Obj. Tkinter's +getdouble() now supports any numbers (in particular int). + +.. + +.. bpo: 22619 +.. date: 7800 +.. nonce: 1gJEqV +.. section: Library + +Added negative limit support in the traceback module. Based on patch by +Dmitry Kazakov. + +.. + +.. bpo: 24094 +.. date: 7799 +.. nonce: 7T-u7k +.. section: Library + +Fix possible crash in json.encode with poorly behaved dict subclasses. + +.. + +.. bpo: 9246 +.. date: 7798 +.. nonce: oM-Ikk +.. section: Library + +On POSIX, os.getcwd() now supports paths longer than 1025 bytes. Patch +written by William Orr. + +.. + +.. bpo: 17445 +.. date: 7797 +.. nonce: Z-QYh5 +.. section: Library + +add difflib.diff_bytes() to support comparison of byte strings (fixes a +regression from Python 2). + +.. + +.. bpo: 23917 +.. date: 7796 +.. nonce: uMVPV7 +.. section: Library + +Fall back to sequential compilation when ProcessPoolExecutor doesn't exist. +Patch by Claudiu Popa. + +.. + +.. bpo: 23008 +.. date: 7795 +.. nonce: OZFCd- +.. section: Library + +Fixed resolving attributes with boolean value is False in pydoc. + +.. + +.. bpo: 0 +.. date: 7794 +.. nonce: 6tJNf2 +.. section: Library + +Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't increment +unfinished tasks (this bug was introduced when JoinableQueue was merged with +Queue). + +.. + +.. bpo: 23908 +.. date: 7793 +.. nonce: ATdNG- +.. section: Library + +os functions now reject paths with embedded null character on Windows +instead of silently truncating them. + +.. + +.. bpo: 23728 +.. date: 7792 +.. nonce: YBmQmV +.. section: Library + +binascii.crc_hqx() could return an integer outside of the range 0-0xffff for +empty data. + +.. + +.. bpo: 23887 +.. date: 7791 +.. nonce: _XpjPN +.. section: Library + +urllib.error.HTTPError now has a proper repr() representation. Patch by +Berker Peksag. + +.. + +.. bpo: 0 +.. date: 7790 +.. nonce: MjNdSC +.. section: Library + +asyncio: New event loop APIs: set_task_factory() and get_task_factory(). + +.. + +.. bpo: 0 +.. date: 7789 +.. nonce: rVcHXp +.. section: Library + +asyncio: async() function is deprecated in favour of ensure_future(). + +.. + +.. bpo: 24178 +.. date: 7788 +.. nonce: -enO4y +.. section: Library + +asyncio.Lock, Condition, Semaphore, and BoundedSemaphore support new 'async +with' syntax. Contributed by Yury Selivanov. + +.. + +.. bpo: 24179 +.. date: 7787 +.. nonce: wDy_WZ +.. section: Library + +Support 'async for' for asyncio.StreamReader. Contributed by Yury Selivanov. + +.. + +.. bpo: 24184 +.. date: 7786 +.. nonce: El74TU +.. section: Library + +Add AsyncIterator and AsyncIterable ABCs to collections.abc. Contributed by +Yury Selivanov. + +.. + +.. bpo: 22547 +.. date: 7785 +.. nonce: _ikCaj +.. section: Library + +Implement informative __repr__ for inspect.BoundArguments. Contributed by +Yury Selivanov. + +.. + +.. bpo: 24190 +.. date: 7784 +.. nonce: 1a3vWW +.. section: Library + +Implement inspect.BoundArgument.apply_defaults() method. Contributed by Yury +Selivanov. + +.. + +.. bpo: 20691 +.. date: 7783 +.. nonce: -raLyf +.. section: Library + +Add 'follow_wrapped' argument to inspect.Signature.from_callable() and +inspect.signature(). Contributed by Yury Selivanov. + +.. + +.. bpo: 24248 +.. date: 7782 +.. nonce: IxWooo +.. section: Library + +Deprecate inspect.Signature.from_function() and +inspect.Signature.from_builtin(). + +.. + +.. bpo: 23898 +.. date: 7781 +.. nonce: OSiZie +.. section: Library + +Fix inspect.classify_class_attrs() to support attributes with overloaded +__eq__ and __bool__. Patch by Mike Bayer. + +.. + +.. bpo: 24298 +.. date: 7780 +.. nonce: u_TaxI +.. section: Library + +Fix inspect.signature() to correctly unwrap wrappers around bound methods. + +.. + +.. bpo: 23184 +.. date: 7779 +.. nonce: G_Cp9v +.. section: IDLE + +remove unused names and imports in idlelib. Initial patch by Al Sweigart. + +.. + +.. bpo: 21520 +.. date: 7778 +.. nonce: FKtvmQ +.. section: Tests + +test_zipfile no longer fails if the word 'bad' appears anywhere in the name +of the current directory. + +.. + +.. bpo: 9517 +.. date: 7777 +.. nonce: W0Ag2V +.. section: Tests + +Move script_helper into the support package. Patch by Christie Wilson. + +.. + +.. bpo: 22155 +.. date: 7776 +.. nonce: 9EbOit +.. section: Documentation + +Add File Handlers subsection with createfilehandler to tkinter doc. Remove +obsolete example from FAQ. Patch by Martin Panter. + +.. + +.. bpo: 24029 +.. date: 7775 +.. nonce: M2Bnks +.. section: Documentation + +Document the name binding behavior for submodule imports. + +.. + +.. bpo: 24077 +.. date: 7774 +.. nonce: 2Og2j- +.. section: Documentation + +Fix typo in man page for -I command option: -s, not -S + +.. + +.. bpo: 24000 +.. date: 7773 +.. nonce: MJyXRr +.. section: Tools/Demos + +Improved Argument Clinic's mapping of converters to legacy "format units". +Updated the documentation to match. + +.. + +.. bpo: 24001 +.. date: 7772 +.. nonce: m74vst +.. section: Tools/Demos + +Argument Clinic converters now use accept={type} instead of types={'type'} +to specify the types the converter accepts. + +.. + +.. bpo: 23330 +.. date: 7771 +.. nonce: LTlKDp +.. section: Tools/Demos + +h2py now supports arbitrary filenames in #include. + +.. + +.. bpo: 24031 +.. date: 7770 +.. nonce: duGo88 +.. section: Tools/Demos + +make patchcheck now supports git checkouts, too. diff --git a/Misc/NEWS.d/3.5.0b2.rst b/Misc/NEWS.d/3.5.0b2.rst new file mode 100644 index 00000000000..230e68aa535 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b2.rst @@ -0,0 +1,104 @@ +.. bpo: 24284 +.. date: 7868 +.. nonce: NvtEnc +.. release date: 2015-05-31 +.. section: Core and Builtins + +The startswith and endswith methods of the str class no longer return True +when finding the empty string and the indexes are completely out of range. + +.. + +.. bpo: 24115 +.. date: 7867 +.. nonce: y9e_MO +.. section: Core and Builtins + +Update uses of PyObject_IsTrue(), PyObject_Not(), PyObject_IsInstance(), +PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle +errors correctly. + +.. + +.. bpo: 24328 +.. date: 7866 +.. nonce: 5gL8or +.. section: Core and Builtins + +Fix importing one character extension modules. + +.. + +.. bpo: 11205 +.. date: 7865 +.. nonce: bikrRP +.. section: Core and Builtins + +In dictionary displays, evaluate the key before the value. + +.. + +.. bpo: 24285 +.. date: 7864 +.. nonce: wvJumr +.. section: Core and Builtins + +Fixed regression that prevented importing extension modules from inside +packages. Patch by Petr Viktorin. + +.. + +.. bpo: 23247 +.. date: 7863 +.. nonce: nN-K74 +.. section: Library + +Fix a crash in the StreamWriter.reset() of CJK codecs. + +.. + +.. bpo: 24270 +.. date: 7862 +.. nonce: M2rJNs +.. section: Library + +Add math.isclose() and cmath.isclose() functions as per PEP 485. Contributed +by Chris Barker and Tal Einat. + +.. + +.. bpo: 5633 +.. date: 7861 +.. nonce: JNzKZq +.. section: Library + +Fixed timeit when the statement is a string and the setup is not. + +.. + +.. bpo: 24326 +.. date: 7860 +.. nonce: 4t_6Gy +.. section: Library + +Fixed audioop.ratecv() with non-default weightB argument. Original patch by +David Moore. + +.. + +.. bpo: 16991 +.. date: 7859 +.. nonce: 19_Zmj +.. section: Library + +Add a C implementation of OrderedDict. + +.. + +.. bpo: 23934 +.. date: 7858 +.. nonce: esb-45 +.. section: Library + +Fix inspect.signature to fail correctly for builtin types lacking signature +information. Initial patch by James Powell. diff --git a/Misc/NEWS.d/3.5.0b3.rst b/Misc/NEWS.d/3.5.0b3.rst new file mode 100644 index 00000000000..4081dd54876 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b3.rst @@ -0,0 +1,273 @@ +.. bpo: 24467 +.. date: 7896 +.. nonce: BAJ80- +.. release date: 2015-07-05 +.. section: Core and Builtins + +Fixed possible buffer over-read in bytearray. The bytearray object now +always allocates place for trailing null byte and it's buffer now is always +null-terminated. + +.. + +.. bpo: 0 +.. date: 7895 +.. nonce: 944IUY +.. section: Core and Builtins + +Upgrade to Unicode 8.0.0. + +.. + +.. bpo: 24345 +.. date: 7894 +.. nonce: fVcTaB +.. section: Core and Builtins + +Add Py_tp_finalize slot for the stable ABI. + +.. + +.. bpo: 24400 +.. date: 7893 +.. nonce: 2mNeD8 +.. section: Core and Builtins + +Introduce a distinct type for PEP 492 coroutines; add types.CoroutineType, +inspect.getcoroutinestate, inspect.getcoroutinelocals; coroutines no longer +use CO_GENERATOR flag; sys.set_coroutine_wrapper works only for 'async def' +coroutines; inspect.iscoroutine no longer uses collections.abc.Coroutine, +it's intended to test for pure 'async def' coroutines only; add new opcode: +GET_YIELD_FROM_ITER; fix generators wrapper used in types.coroutine to be +instance of collections.abc.Generator; collections.abc.Awaitable and +collections.abc.Coroutine can no longer be used to detect generator-based +coroutines--use inspect.isawaitable instead. + +.. + +.. bpo: 24450 +.. date: 7892 +.. nonce: lF0S5c +.. section: Core and Builtins + +Add gi_yieldfrom to generators and cr_await to coroutines. Contributed by +Benno Leslie and Yury Selivanov. + +.. + +.. bpo: 19235 +.. date: 7891 +.. nonce: 0kW4n5 +.. section: Core and Builtins + +Add new RecursionError exception. Patch by Georg Brandl. + +.. + +.. bpo: 21750 +.. date: 7890 +.. nonce: _Ycvgi +.. section: Library + +mock_open.read_data can now be read from each instance, as it could in +Python 3.3. + +.. + +.. bpo: 24552 +.. date: 7889 +.. nonce: VTO6sf +.. section: Library + +Fix use after free in an error case of the _pickle module. + +.. + +.. bpo: 24514 +.. date: 7888 +.. nonce: _xRb2r +.. section: Library + +tarfile now tolerates number fields consisting of only whitespace. + +.. + +.. bpo: 19176 +.. date: 7887 +.. nonce: 8V6nOK +.. section: Library + +Fixed doctype() related bugs in C implementation of ElementTree. A +deprecation warning no longer issued by XMLParser subclass with default +doctype() method. Direct call of doctype() now issues a warning. Parser's +doctype() now is not called if target's doctype() is called. Based on patch +by Martin Panter. + +.. + +.. bpo: 20387 +.. date: 7886 +.. nonce: aAbWbQ +.. section: Library + +Restore semantic round-trip correctness in tokenize/untokenize for tab- +indented blocks. + +.. + +.. bpo: 24456 +.. date: 7885 +.. nonce: yYSd2u +.. section: Library + +Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() functions of +the audioop module. + +.. + +.. bpo: 24336 +.. date: 7884 +.. nonce: 4a5y1m +.. section: Library + +The contextmanager decorator now works with functions with keyword arguments +called "func" and "self". Patch by Martin Panter. + +.. + +.. bpo: 24522 +.. date: 7883 +.. nonce: PkcqCA +.. section: Library + +Fix possible integer overflow in json accelerator module. + +.. + +.. bpo: 24489 +.. date: 7882 +.. nonce: GJnMcW +.. section: Library + +ensure a previously set C errno doesn't disturb cmath.polar(). + +.. + +.. bpo: 24408 +.. date: 7881 +.. nonce: vPb5UK +.. section: Library + +Fixed AttributeError in measure() and metrics() methods of tkinter.Font. + +.. + +.. bpo: 14373 +.. date: 7880 +.. nonce: CTYZ4J +.. section: Library + +C implementation of functools.lru_cache() now can be used with methods. + +.. + +.. bpo: 24347 +.. date: 7879 +.. nonce: CPPDb8 +.. section: Library + +Set KeyError if PyDict_GetItemWithError returns NULL. + +.. + +.. bpo: 24348 +.. date: 7878 +.. nonce: U11rhr +.. section: Library + +Drop superfluous incref/decref. + +.. + +.. bpo: 24359 +.. date: 7877 +.. nonce: -IRNG9 +.. section: Library + +Check for changed OrderedDict size during iteration. + +.. + +.. bpo: 24368 +.. date: 7876 +.. nonce: 550kDT +.. section: Library + +Support keyword arguments in OrderedDict methods. + +.. + +.. bpo: 24362 +.. date: 7875 +.. nonce: cHYce5 +.. section: Library + +Simplify the C OrderedDict fast nodes resize logic. + +.. + +.. bpo: 24377 +.. date: 7874 +.. nonce: Gp1Bqr +.. section: Library + +Fix a ref leak in OrderedDict.__repr__. + +.. + +.. bpo: 24369 +.. date: 7873 +.. nonce: qFl7lZ +.. section: Library + +Defend against key-changes during iteration. + +.. + +.. bpo: 24373 +.. date: 7872 +.. nonce: 6TL2XG +.. section: Tests + +_testmultiphase and xxlimited now use tp_traverse and tp_finalize to avoid +reference leaks encountered when combining tp_dealloc with PyType_FromSpec +(see issue #16690 for details) + +.. + +.. bpo: 24458 +.. date: 7871 +.. nonce: 1egApX +.. section: Documentation + +Update documentation to cover multi-phase initialization for extension +modules (PEP 489). Patch by Petr Viktorin. + +.. + +.. bpo: 24351 +.. date: 7870 +.. nonce: XeSVl5 +.. section: Documentation + +Clarify what is meant by "identifier" in the context of string.Template +instances. + +.. + +.. bpo: 24432 +.. date: 7869 +.. nonce: IvUSiN +.. section: Build + +Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2c. diff --git a/Misc/NEWS.d/3.5.0b4.rst b/Misc/NEWS.d/3.5.0b4.rst new file mode 100644 index 00000000000..436981c6fe9 --- /dev/null +++ b/Misc/NEWS.d/3.5.0b4.rst @@ -0,0 +1,255 @@ +.. bpo: 23573 +.. date: 7923 +.. nonce: HdJPs7 +.. release date: 2015-07-26 +.. section: Core and Builtins + +Restored optimization of bytes.rfind() and bytearray.rfind() for single-byte +argument on Linux. + +.. + +.. bpo: 24569 +.. date: 7922 +.. nonce: bqh6PQ +.. section: Core and Builtins + +Make PEP 448 dictionary evaluation more consistent. + +.. + +.. bpo: 24583 +.. date: 7921 +.. nonce: Ooq0Tn +.. section: Core and Builtins + +Fix crash when set is mutated while being updated. + +.. + +.. bpo: 24407 +.. date: 7920 +.. nonce: GmCBB3 +.. section: Core and Builtins + +Fix crash when dict is mutated while being updated. + +.. + +.. bpo: 24619 +.. date: 7919 +.. nonce: cnfZGo +.. section: Core and Builtins + +New approach for tokenizing async/await. As a consequence, it is now +possible to have one-line 'async def foo(): await ..' functions. + +.. + +.. bpo: 24687 +.. date: 7918 +.. nonce: 0UaXFe +.. section: Core and Builtins + +Plug refleak on SyntaxError in function parameters annotations. + +.. + +.. bpo: 15944 +.. date: 7917 +.. nonce: 4GuwqX +.. section: Core and Builtins + +memoryview: Allow arbitrary formats when casting to bytes. Patch by Martin +Panter. + +.. + +.. bpo: 23441 +.. date: 7916 +.. nonce: JXt2Yt +.. section: Library + +rcompleter now prints a tab character instead of displaying possible +completions for an empty word. Initial patch by Martin Sekera. + +.. + +.. bpo: 24683 +.. date: 7915 +.. nonce: aJdWEv +.. section: Library + +Fixed crashes in _json functions called with arguments of inappropriate +type. + +.. + +.. bpo: 21697 +.. date: 7914 +.. nonce: jpATha +.. section: Library + +shutil.copytree() now correctly handles symbolic links that point to +directories. Patch by Eduardo Seabra and Thomas Kluyver. + +.. + +.. bpo: 14373 +.. date: 7913 +.. nonce: Je0yDg +.. section: Library + +Fixed segmentation fault when gc.collect() is called during constructing +lru_cache (C implementation). + +.. + +.. bpo: 24695 +.. date: 7912 +.. nonce: QjZzFb +.. section: Library + +Fix a regression in traceback.print_exception(). If exc_traceback is None +we shouldn't print a traceback header like described in the documentation. + +.. + +.. bpo: 24620 +.. date: 7911 +.. nonce: rrnxB- +.. section: Library + +Random.setstate() now validates the value of state last element. + +.. + +.. bpo: 22485 +.. date: 7910 +.. nonce: HvJf6T +.. section: Library + +Fixed an issue that caused `inspect.getsource` to return incorrect results +on nested functions. + +.. + +.. bpo: 22153 +.. date: 7909 +.. nonce: 6n6yld +.. section: Library + +Improve unittest docs. Patch from Martin Panter and evilzero. + +.. + +.. bpo: 24580 +.. date: 7908 +.. nonce: AGi4Gm +.. section: Library + +Symbolic group references to open group in re patterns now are explicitly +forbidden as well as numeric group references. + +.. + +.. bpo: 24206 +.. date: 7907 +.. nonce: ffkVHH +.. section: Library + +Fixed __eq__ and __ne__ methods of inspect classes. + +.. + +.. bpo: 24631 +.. date: 7906 +.. nonce: uljPxM +.. section: Library + +Fixed regression in the timeit module with multiline setup. + +.. + +.. bpo: 18622 +.. date: 7905 +.. nonce: i6nCCW +.. section: Library + +unittest.mock.mock_open().reset_mock would recurse infinitely. Patch from +Nicola Palumbo and Laurent De Buyst. + +.. + +.. bpo: 23661 +.. date: 7904 +.. nonce: 5VHJmh +.. section: Library + +unittest.mock side_effects can now be exceptions again. This was a +regression vs Python 3.4. Patch from Ignacio Rossi + +.. + +.. bpo: 24608 +.. date: 7903 +.. nonce: 0TndL0 +.. section: Library + +chunk.Chunk.read() now always returns bytes, not str. + +.. + +.. bpo: 18684 +.. date: 7902 +.. nonce: S2es0F +.. section: Library + +Fixed reading out of the buffer in the re module. + +.. + +.. bpo: 24259 +.. date: 7901 +.. nonce: vMAi1A +.. section: Library + +tarfile now raises a ReadError if an archive is truncated inside a data +segment. + +.. + +.. bpo: 15014 +.. date: 7900 +.. nonce: hwXwCH +.. section: Library + +SMTP.auth() and SMTP.login() now support RFC 4954's optional initial- +response argument to the SMTP AUTH command. + +.. + +.. bpo: 24669 +.. date: 7899 +.. nonce: kFThK0 +.. section: Library + +Fix inspect.getsource() for 'async def' functions. Patch by Kai Groner. + +.. + +.. bpo: 24688 +.. date: 7898 +.. nonce: -yWfcO +.. section: Library + +ast.get_docstring() for 'async def' functions. + +.. + +.. bpo: 24603 +.. date: 7897 +.. nonce: PyHyF5 +.. section: Build + +Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2d. diff --git a/Misc/NEWS.d/3.5.0rc1.rst b/Misc/NEWS.d/3.5.0rc1.rst new file mode 100644 index 00000000000..8b93ea40a9d --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc1.rst @@ -0,0 +1,241 @@ +.. bpo: 24667 +.. date: 7948 +.. nonce: tdwszf +.. release date: 2015-08-09 +.. section: Core and Builtins + +Resize odict in all cases that the underlying dict resizes. + +.. + +.. bpo: 24824 +.. date: 7947 +.. nonce: Eoc4lq +.. section: Library + +Signatures of codecs.encode() and codecs.decode() now are compatible with +pydoc. + +.. + +.. bpo: 24634 +.. date: 7946 +.. nonce: 7bnVgr +.. section: Library + +Importing uuid should not try to load libc on Windows + +.. + +.. bpo: 24798 +.. date: 7945 +.. nonce: zDXL5R +.. section: Library + +_msvccompiler.py doesn't properly support manifests + +.. + +.. bpo: 4395 +.. date: 7944 +.. nonce: JpT0k7 +.. section: Library + +Better testing and documentation of binary operators. Patch by Martin +Panter. + +.. + +.. bpo: 23973 +.. date: 7943 +.. nonce: wT59Vh +.. section: Library + +Update typing.py from GitHub repo. + +.. + +.. bpo: 23004 +.. date: 7942 +.. nonce: xswcPm +.. section: Library + +mock_open() now reads binary data correctly when the type of read_data is +bytes. Initial patch by Aaron Hill. + +.. + +.. bpo: 23888 +.. date: 7941 +.. nonce: 7gw4oO +.. section: Library + +Handle fractional time in cookie expiry. Patch by ssh. + +.. + +.. bpo: 23652 +.. date: 7940 +.. nonce: DKQ_7t +.. section: Library + +Make it possible to compile the select module against the libc headers from +the Linux Standard Base, which do not include some EPOLL macros. Patch by +Matt Frank. + +.. + +.. bpo: 22932 +.. date: 7939 +.. nonce: mPclSJ +.. section: Library + +Fix timezones in email.utils.formatdate. Patch from Dmitry Shachnev. + +.. + +.. bpo: 23779 +.. date: 7938 +.. nonce: ET4JJP +.. section: Library + +imaplib raises TypeError if authenticator tries to abort. Patch from Craig +Holmquist. + +.. + +.. bpo: 23319 +.. date: 7937 +.. nonce: FXyUH- +.. section: Library + +Fix ctypes.BigEndianStructure, swap correctly bytes. Patch written by +Matthieu Gautier. + +.. + +.. bpo: 23254 +.. date: 7936 +.. nonce: zNiy1X +.. section: Library + +Document how to close the TCPServer listening socket. Patch from Martin +Panter. + +.. + +.. bpo: 19450 +.. date: 7935 +.. nonce: VG7T-L +.. section: Library + +Update Windows and OS X installer builds to use SQLite 3.8.11. + +.. + +.. bpo: 17527 +.. date: 7934 +.. nonce: ve9fyw +.. section: Library + +Add PATCH to wsgiref.validator. Patch from Luca Sbardella. + +.. + +.. bpo: 24791 +.. date: 7933 +.. nonce: Ok-3nA +.. section: Library + +Fix grammar regression for call syntax: 'g(\*a or b)'. + +.. + +.. bpo: 23672 +.. date: 7932 +.. nonce: 8td2se +.. section: IDLE + +Allow Idle to edit and run files with astral chars in name. Patch by Mohd +Sanad Zaki Rizvi. + +.. + +.. bpo: 24745 +.. date: 7931 +.. nonce: edbziT +.. section: IDLE + +Idle editor default font. Switch from Courier to platform-sensitive +TkFixedFont. This should not affect current customized font selections. If +there is a problem, edit $HOME/.idlerc/config-main.cfg and remove 'fontxxx' +entries from [Editor Window]. Patch by Mark Roseman. + +.. + +.. bpo: 21192 +.. date: 7930 +.. nonce: CdbipH +.. section: IDLE + +Idle editor. When a file is run, put its name in the restart bar. Do not +print false prompts. Original patch by Adnan Umer. + +.. + +.. bpo: 13884 +.. date: 7929 +.. nonce: vVcO1E +.. section: IDLE + +Idle menus. Remove tearoff lines. Patch by Roger Serwy. + +.. + +.. bpo: 24129 +.. date: 7928 +.. nonce: Imr54z +.. section: Documentation + +Clarify the reference documentation for name resolution. This includes +removing the assumption that readers will be familiar with the name +resolution scheme Python used prior to the introduction of lexical scoping +for function namespaces. Patch by Ivan Levkivskyi. + +.. + +.. bpo: 20769 +.. date: 7927 +.. nonce: ZUc9z9 +.. section: Documentation + +Improve reload() docs. Patch by Dorian Pula. + +.. + +.. bpo: 23589 +.. date: 7926 +.. nonce: rjU421 +.. section: Documentation + +Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. + +.. + +.. bpo: 24729 +.. date: 7925 +.. nonce: PH3A9p +.. section: Documentation + +Correct IO tutorial to match implementation regarding encoding parameter to +open function. + +.. + +.. bpo: 24751 +.. date: 7924 +.. nonce: pL2pbj +.. section: Tests + +When running regrtest with the ``-w`` command line option, a test run is no +longer marked as a failure if all tests succeed when re-run. diff --git a/Misc/NEWS.d/3.5.0rc2.rst b/Misc/NEWS.d/3.5.0rc2.rst new file mode 100644 index 00000000000..53f10eaeb6c --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc2.rst @@ -0,0 +1,56 @@ +.. bpo: 24769 +.. date: 7954 +.. nonce: XgRA0n +.. release date: 2015-08-25 +.. section: Core and Builtins + +Interpreter now starts properly when dynamic loading is disabled. Patch by +Petr Viktorin. + +.. + +.. bpo: 21167 +.. date: 7953 +.. nonce: uom-Dq +.. section: Core and Builtins + +NAN operations are now handled correctly when python is compiled with ICC +even if -fp-model strict is not specified. + +.. + +.. bpo: 24492 +.. date: 7952 +.. nonce: LKDAIu +.. section: Core and Builtins + +A "package" lacking a __name__ attribute when trying to perform a ``from .. +import ...`` statement will trigger an ImportError instead of an +AttributeError. + +.. + +.. bpo: 24847 +.. date: 7951 +.. nonce: SHiiO_ +.. section: Library + +Removes vcruntime140.dll dependency from Tcl/Tk. + +.. + +.. bpo: 24839 +.. date: 7950 +.. nonce: 7_iQZl +.. section: Library + +platform._syscmd_ver raises DeprecationWarning + +.. + +.. bpo: 24867 +.. date: 7949 +.. nonce: rxJIl7 +.. section: Library + +Fix Task.get_stack() for 'async def' coroutines diff --git a/Misc/NEWS.d/3.5.0rc3.rst b/Misc/NEWS.d/3.5.0rc3.rst new file mode 100644 index 00000000000..d49d2886b07 --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc3.rst @@ -0,0 +1,76 @@ +.. bpo: 24305 +.. date: 7962 +.. nonce: QeF4A8 +.. release date: 2015-09-07 +.. section: Core and Builtins + +Prevent import subsystem stack frames from being counted by the +warnings.warn(stacklevel=) parameter. + +.. + +.. bpo: 24912 +.. date: 7961 +.. nonce: ubSi5J +.. section: Core and Builtins + +Prevent __class__ assignment to immutable built-in objects. + +.. + +.. bpo: 24975 +.. date: 7960 +.. nonce: 2gLdfN +.. section: Core and Builtins + +Fix AST compilation for PEP 448 syntax. + +.. + +.. bpo: 24917 +.. date: 7959 +.. nonce: xaQocz +.. section: Library + +time_strftime() buffer over-read. + +.. + +.. bpo: 24748 +.. date: 7958 +.. nonce: 83NuO8 +.. section: Library + +To resolve a compatibility problem found with py2exe and pywin32, +imp.load_dynamic() once again ignores previously loaded modules to support +Python modules replacing themselves with extension modules. Patch by Petr +Viktorin. + +.. + +.. bpo: 24635 +.. date: 7957 +.. nonce: EiJPPf +.. section: Library + +Fixed a bug in typing.py where isinstance([], typing.Iterable) would return +True once, then False on subsequent calls. + +.. + +.. bpo: 24989 +.. date: 7956 +.. nonce: 9BJLiy +.. section: Library + +Fixed buffer overread in BytesIO.readline() if a position is set beyond +size. Based on patch by John Leitch. + +.. + +.. bpo: 24913 +.. date: 7955 +.. nonce: p2ZAJ4 +.. section: Library + +Fix overrun error in deque.index(). Found by John Leitch and Bryce Darling. diff --git a/Misc/NEWS.d/3.5.0rc4.rst b/Misc/NEWS.d/3.5.0rc4.rst new file mode 100644 index 00000000000..380000058b4 --- /dev/null +++ b/Misc/NEWS.d/3.5.0rc4.rst @@ -0,0 +1,17 @@ +.. bpo: 25029 +.. date: 7964 +.. nonce: Zf97rk +.. release date: 2015-09-09 +.. section: Library + +Fixes MemoryError in test_strptime. + +.. + +.. bpo: 25027 +.. date: 7963 +.. nonce: Zaib78 +.. section: Build + +Reverts partial-static build options and adds vcruntime140.dll to Windows +installation. diff --git a/Misc/NEWS.d/3.5.1.rst b/Misc/NEWS.d/3.5.1.rst new file mode 100644 index 00000000000..49f503a3766 --- /dev/null +++ b/Misc/NEWS.d/3.5.1.rst @@ -0,0 +1,17 @@ +.. bpo: 25709 +.. date: 8112 +.. nonce: OPX2TS +.. release date: 2015-12-06 +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 25715 +.. date: 8111 +.. nonce: 3LLYLj +.. section: Windows + +Python 3.5.1 installer shows wrong upgrade path and incorrect logic for +launcher detection. diff --git a/Misc/NEWS.d/3.5.1rc1.rst b/Misc/NEWS.d/3.5.1rc1.rst new file mode 100644 index 00000000000..87672566cca --- /dev/null +++ b/Misc/NEWS.d/3.5.1rc1.rst @@ -0,0 +1,1451 @@ +.. bpo: 25630 +.. date: 8110 +.. nonce: ZxzcoY +.. release date: 2015-11-22 +.. section: Core and Builtins + +Fix a possible segfault during argument parsing in functions that accept +filesystem paths. + +.. + +.. bpo: 23564 +.. date: 8109 +.. nonce: XHarGG +.. section: Core and Builtins + +Fixed a partially broken sanity check in the _posixsubprocess internals +regarding how fds_to_pass were passed to the child. The bug had no actual +impact as subprocess.py already avoided it. + +.. + +.. bpo: 25388 +.. date: 8108 +.. nonce: zm3uuQ +.. section: Core and Builtins + +Fixed tokenizer crash when processing undecodable source code with a null +byte. + +.. + +.. bpo: 25462 +.. date: 8107 +.. nonce: eXDzgO +.. section: Core and Builtins + +The hash of the key now is calculated only once in most operations in C +implementation of OrderedDict. + +.. + +.. bpo: 22995 +.. date: 8106 +.. nonce: 90kpuP +.. section: Core and Builtins + +Default implementation of __reduce__ and __reduce_ex__ now rejects builtin +types with not defined __new__. + +.. + +.. bpo: 25555 +.. date: 8105 +.. nonce: MUpG-j +.. section: Core and Builtins + +Fix parser and AST: fill lineno and col_offset of "arg" node when compiling +AST from Python objects. + +.. + +.. bpo: 24802 +.. date: 8104 +.. nonce: Qie066 +.. section: Core and Builtins + +Avoid buffer overreads when int(), float(), compile(), exec() and eval() are +passed bytes-like objects. These objects are not necessarily terminated by +a null byte, but the functions assumed they were. + +.. + +.. bpo: 24726 +.. date: 8103 +.. nonce: AHk4v2 +.. section: Core and Builtins + +Fixed a crash and leaking NULL in repr() of OrderedDict that was mutated by +direct calls of dict methods. + +.. + +.. bpo: 25449 +.. date: 8102 +.. nonce: VqTOFi +.. section: Core and Builtins + +Iterating OrderedDict with keys with unstable hash now raises KeyError in C +implementations as well as in Python implementation. + +.. + +.. bpo: 25395 +.. date: 8101 +.. nonce: htkE3W +.. section: Core and Builtins + +Fixed crash when highly nested OrderedDict structures were garbage +collected. + +.. + +.. bpo: 25274 +.. date: 8100 +.. nonce: QCGvAF +.. section: Core and Builtins + +sys.setrecursionlimit() now raises a RecursionError if the new recursion +limit is too low depending at the current recursion depth. Modify also the +"lower-water mark" formula to make it monotonic. This mark is used to decide +when the overflowed flag of the thread state is reset. + +.. + +.. bpo: 24402 +.. date: 8099 +.. nonce: MAgi3X +.. section: Core and Builtins + +Fix input() to prompt to the redirected stdout when sys.stdout.fileno() +fails. + +.. + +.. bpo: 24806 +.. date: 8098 +.. nonce: Nb0znT +.. section: Core and Builtins + +Prevent builtin types that are not allowed to be subclassed from being +subclassed through multiple inheritance. + +.. + +.. bpo: 24848 +.. date: 8097 +.. nonce: HlUSuy +.. section: Core and Builtins + +Fixed a number of bugs in UTF-7 decoding of misformed data. + +.. + +.. bpo: 25280 +.. date: 8096 +.. nonce: ivTMwd +.. section: Core and Builtins + +Import trace messages emitted in verbose (-v) mode are no longer formatted +twice. + +.. + +.. bpo: 25003 +.. date: 8095 +.. nonce: _ban92 +.. section: Core and Builtins + +On Solaris 11.3 or newer, os.urandom() now uses the getrandom() function +instead of the getentropy() function. The getentropy() function is blocking +to generate very good quality entropy, os.urandom() doesn't need such high- +quality entropy. + +.. + +.. bpo: 25182 +.. date: 8094 +.. nonce: gBDq-T +.. section: Core and Builtins + +The stdprinter (used as sys.stderr before the io module is imported at +startup) now uses the backslashreplace error handler. + +.. + +.. bpo: 25131 +.. date: 8093 +.. nonce: j5hH6a +.. section: Core and Builtins + +Make the line number and column offset of set/dict literals and +comprehensions correspond to the opening brace. + +.. + +.. bpo: 25150 +.. date: 8092 +.. nonce: 0Gh-Ty +.. section: Core and Builtins + +Hide the private _Py_atomic_xxx symbols from the public Python.h header to +fix a compilation error with OpenMP. PyThreadState_GET() becomes an alias to +PyThreadState_Get() to avoid ABI incompatibilies. + +.. + +.. bpo: 25626 +.. date: 8091 +.. nonce: TQ3fvb +.. section: Library + +Change three zlib functions to accept sizes that fit in Py_ssize_t, but +internally cap those sizes to UINT_MAX. This resolves a regression in 3.5 +where GzipFile.read() failed to read chunks larger than 2 or 4 GiB. The +change affects the zlib.Decompress.decompress() max_length parameter, the +zlib.decompress() bufsize parameter, and the zlib.Decompress.flush() length +parameter. + +.. + +.. bpo: 25583 +.. date: 8090 +.. nonce: Gk-cim +.. section: Library + +Avoid incorrect errors raised by os.makedirs(exist_ok=True) when the OS +gives priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 25593 +.. date: 8089 +.. nonce: 56uegI +.. section: Library + +Change semantics of EventLoop.stop() in asyncio. + +.. + +.. bpo: 6973 +.. date: 8088 +.. nonce: nl5cHt +.. section: Library + +When we know a subprocess.Popen process has died, do not allow the +send_signal(), terminate(), or kill() methods to do anything as they could +potentially signal a different process. + +.. + +.. bpo: 25590 +.. date: 8087 +.. nonce: aCt-yW +.. section: Library + +In the Readline completer, only call getattr() once per attribute. + +.. + +.. bpo: 25498 +.. date: 8086 +.. nonce: AvqEBl +.. section: Library + +Fix a crash when garbage-collecting ctypes objects created by wrapping a +memoryview. This was a regression made in 3.5a1. Based on patch by +Eryksun. + +.. + +.. bpo: 25584 +.. date: 8085 +.. nonce: 124mYw +.. section: Library + +Added "escape" to the __all__ list in the glob module. + +.. + +.. bpo: 25584 +.. date: 8084 +.. nonce: ZeWX0J +.. section: Library + +Fixed recursive glob() with patterns starting with ``**``. + +.. + +.. bpo: 25446 +.. date: 8083 +.. nonce: k1DByx +.. section: Library + +Fix regression in smtplib's AUTH LOGIN support. + +.. + +.. bpo: 18010 +.. date: 8082 +.. nonce: Azyf1C +.. section: Library + +Fix the pydoc web server's module search function to handle exceptions from +importing packages. + +.. + +.. bpo: 25554 +.. date: 8081 +.. nonce: UM9MlR +.. section: Library + +Got rid of circular references in regular expression parsing. + +.. + +.. bpo: 25510 +.. date: 8080 +.. nonce: 79g7LA +.. section: Library + +fileinput.FileInput.readline() now returns b'' instead of '' at the end if +the FileInput was opened with binary mode. Patch by Ryosuke Ito. + +.. + +.. bpo: 25503 +.. date: 8079 +.. nonce: Zea0Y7 +.. section: Library + +Fixed inspect.getdoc() for inherited docstrings of properties. Original +patch by John Mark Vandenberg. + +.. + +.. bpo: 25515 +.. date: 8078 +.. nonce: fQsyYG +.. section: Library + +Always use os.urandom as a source of randomness in uuid.uuid4. + +.. + +.. bpo: 21827 +.. date: 8077 +.. nonce: k2oreR +.. section: Library + +Fixed textwrap.dedent() for the case when largest common whitespace is a +substring of smallest leading whitespace. Based on patch by Robert Li. + +.. + +.. bpo: 25447 +.. date: 8076 +.. nonce: eDYc4t +.. section: Library + +The lru_cache() wrapper objects now can be copied and pickled (by returning +the original object unchanged). + +.. + +.. bpo: 25390 +.. date: 8075 +.. nonce: 6mSgRq +.. section: Library + +typing: Don't crash on Union[str, Pattern]. + +.. + +.. bpo: 25441 +.. date: 8074 +.. nonce: d7zph6 +.. section: Library + +asyncio: Raise error from drain() when socket is closed. + +.. + +.. bpo: 25410 +.. date: 8073 +.. nonce: QAs_3B +.. section: Library + +Cleaned up and fixed minor bugs in C implementation of OrderedDict. + +.. + +.. bpo: 25411 +.. date: 8072 +.. nonce: qsJTCb +.. section: Library + +Improved Unicode support in SMTPHandler through better use of the email +package. Thanks to user simon04 for the patch. + +.. + +.. bpo: 25407 +.. date: 8071 +.. nonce: ukNt1D +.. section: Library + +Remove mentions of the formatter module being removed in Python 3.6. + +.. + +.. bpo: 25406 +.. date: 8070 +.. nonce: 5MZKU_ +.. section: Library + +Fixed a bug in C implementation of OrderedDict.move_to_end() that caused +segmentation fault or hang in iterating after moving several items to the +start of ordered dict. + +.. + +.. bpo: 25364 +.. date: 8069 +.. nonce: u_1Wi6 +.. section: Library + +zipfile now works in threads disabled builds. + +.. + +.. bpo: 25328 +.. date: 8068 +.. nonce: Rja1Xg +.. section: Library + +smtpd's SMTPChannel now correctly raises a ValueError if both decode_data +and enable_SMTPUTF8 are set to true. + +.. + +.. bpo: 25316 +.. date: 8067 +.. nonce: dHQHWI +.. section: Library + +distutils raises OSError instead of DistutilsPlatformError when MSVC is not +installed. + +.. + +.. bpo: 25380 +.. date: 8066 +.. nonce: sKZ6-I +.. section: Library + +Fixed protocol for the STACK_GLOBAL opcode in pickletools.opcodes. + +.. + +.. bpo: 23972 +.. date: 8065 +.. nonce: s2g30g +.. section: Library + +Updates asyncio datagram create method allowing reuseport and reuseaddr +socket options to be set prior to binding the socket. Mirroring the existing +asyncio create_server method the reuseaddr option for datagram sockets +defaults to True if the O/S is 'posix' (except if the platform is Cygwin). +Patch by Chris Laws. + +.. + +.. bpo: 25304 +.. date: 8064 +.. nonce: CsmLyI +.. section: Library + +Add asyncio.run_coroutine_threadsafe(). This lets you submit a coroutine to +a loop from another thread, returning a concurrent.futures.Future. By +Vincent Michel. + +.. + +.. bpo: 25232 +.. date: 8063 +.. nonce: KhKjCE +.. section: Library + +Fix CGIRequestHandler to split the query from the URL at the first question +mark (?) rather than the last. Patch from Xiang Zhang. + +.. + +.. bpo: 24657 +.. date: 8062 +.. nonce: h2Ag7y +.. section: Library + +Prevent CGIRequestHandler from collapsing slashes in the query part of the +URL as if it were a path. Patch from Xiang Zhang. + +.. + +.. bpo: 24483 +.. date: 8061 +.. nonce: WPLGSJ +.. section: Library + +C implementation of functools.lru_cache() now calculates key's hash only +once. + +.. + +.. bpo: 22958 +.. date: 8060 +.. nonce: Ebu7Gl +.. section: Library + +Constructor and update method of weakref.WeakValueDictionary now accept the +self and the dict keyword arguments. + +.. + +.. bpo: 22609 +.. date: 8059 +.. nonce: fV7hdV +.. section: Library + +Constructor of collections.UserDict now accepts the self keyword argument. + +.. + +.. bpo: 25111 +.. date: 8058 +.. nonce: azL4qE +.. section: Library + +Fixed comparison of traceback.FrameSummary. + +.. + +.. bpo: 25262 +.. date: 8057 +.. nonce: pQS5cB +.. section: Library + +Added support for BINBYTES8 opcode in Python implementation of unpickler. +Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 opcodes no +longer silently ignored on 32-bit platforms in C implementation. + +.. + +.. bpo: 25034 +.. date: 8056 +.. nonce: eGvOIb +.. section: Library + +Fix string.Formatter problem with auto-numbering and nested format_specs. +Patch by Anthon van der Neut. + +.. + +.. bpo: 25233 +.. date: 8055 +.. nonce: EdZV9x +.. section: Library + +Rewrite the guts of asyncio.Queue and asyncio.Semaphore to be more +understandable and correct. + +.. + +.. bpo: 25203 +.. date: 8054 +.. nonce: IgDEbt +.. section: Library + +Failed readline.set_completer_delims() no longer left the module in +inconsistent state. + +.. + +.. bpo: 23600 +.. date: 8053 +.. nonce: 7J_RD5 +.. section: Library + +Default implementation of tzinfo.fromutc() was returning wrong results in +some cases. + +.. + +.. bpo: 23329 +.. date: 8052 +.. nonce: yccJBE +.. section: Library + +Allow the ssl module to be built with older versions of LibreSSL. + +.. + +.. bpo: 0 +.. date: 8051 +.. nonce: ww9QSm +.. section: Library + +Prevent overflow in _Unpickler_Read. + +.. + +.. bpo: 25047 +.. date: 8050 +.. nonce: kc8tqx +.. section: Library + +The XML encoding declaration written by Element Tree now respects the letter +case given by the user. This restores the ability to write encoding names in +uppercase like "UTF-8", which worked in Python 2. + +.. + +.. bpo: 25135 +.. date: 8049 +.. nonce: gVHNy- +.. section: Library + +Make deque_clear() safer by emptying the deque before clearing. This helps +avoid possible reentrancy issues. + +.. + +.. bpo: 19143 +.. date: 8048 +.. nonce: 76SBSO +.. section: Library + +platform module now reads Windows version from kernel32.dll to avoid +compatibility shims. + +.. + +.. bpo: 25092 +.. date: 8047 +.. nonce: fQ37Ac +.. section: Library + +Fix datetime.strftime() failure when errno was already set to EINVAL. + +.. + +.. bpo: 23517 +.. date: 8046 +.. nonce: 3ABmf1 +.. section: Library + +Fix rounding in fromtimestamp() and utcfromtimestamp() methods of +datetime.datetime: microseconds are now rounded to nearest with ties going +to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards +minus infinity (ROUND_FLOOR). It's important that these methods use the same +rounding mode than datetime.timedelta to keep the property: +(datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t). +It also the rounding mode used by round(float) for example. + +.. + +.. bpo: 25155 +.. date: 8045 +.. nonce: JiETzD +.. section: Library + +Fix datetime.datetime.now() and datetime.datetime.utcnow() on Windows to +support date after year 2038. It was a regression introduced in Python +3.5.0. + +.. + +.. bpo: 25108 +.. date: 8044 +.. nonce: zGPbgA +.. section: Library + +Omitted internal frames in traceback functions print_stack(), +format_stack(), and extract_stack() called without arguments. + +.. + +.. bpo: 25118 +.. date: 8043 +.. nonce: wGm1u6 +.. section: Library + +Fix a regression of Python 3.5.0 in os.waitpid() on Windows. + +.. + +.. bpo: 24684 +.. date: 8042 +.. nonce: t4T77O +.. section: Library + +socket.socket.getaddrinfo() now calls PyUnicode_AsEncodedString() instead of +calling the encode() method of the host, to handle correctly custom string +with an encode() method which doesn't return a byte string. The encoder of +the IDNA codec is now called directly instead of calling the encode() method +of the string. + +.. + +.. bpo: 25060 +.. date: 8041 +.. nonce: zLdvIk +.. section: Library + +Correctly compute stack usage of the BUILD_MAP opcode. + +.. + +.. bpo: 24857 +.. date: 8040 +.. nonce: PpJWZ9 +.. section: Library + +Comparing call_args to a long sequence now correctly returns a boolean +result instead of raising an exception. Patch by A Kaptur. + +.. + +.. bpo: 23144 +.. date: 8039 +.. nonce: cLf67X +.. section: Library + +Make sure that HTMLParser.feed() returns all the data, even when +convert_charrefs is True. + +.. + +.. bpo: 24982 +.. date: 8038 +.. nonce: sGMMAR +.. section: Library + +shutil.make_archive() with the "zip" format now adds entries for directories +(including empty directories) in ZIP file. + +.. + +.. bpo: 25019 +.. date: 8037 +.. nonce: JQJlOZ +.. section: Library + +Fixed a crash caused by setting non-string key of expat parser. Based on +patch by John Leitch. + +.. + +.. bpo: 16180 +.. date: 8036 +.. nonce: 6IUcNS +.. section: Library + +Exit pdb if file has syntax error, instead of trapping user in an infinite +loop. Patch by Xavier de Gaye. + +.. + +.. bpo: 24891 +.. date: 8035 +.. nonce: ddVmHS +.. section: Library + +Fix a race condition at Python startup if the file descriptor of stdin (0), +stdout (1) or stderr (2) is closed while Python is creating sys.stdin, +sys.stdout and sys.stderr objects. These attributes are now set to None if +the creation of the object failed, instead of raising an OSError exception. +Initial patch written by Marco Paolini. + +.. + +.. bpo: 24992 +.. date: 8034 +.. nonce: 5sqF74 +.. section: Library + +Fix error handling and a race condition (related to garbage collection) in +collections.OrderedDict constructor. + +.. + +.. bpo: 24881 +.. date: 8033 +.. nonce: ZoVZXu +.. section: Library + +Fixed setting binary mode in Python implementation of FileIO on Windows and +Cygwin. Patch from Akira Li. + +.. + +.. bpo: 25578 +.. date: 8032 +.. nonce: G6S-ft +.. section: Library + +Fix (another) memory leak in SSLSocket.getpeercer(). + +.. + +.. bpo: 25530 +.. date: 8031 +.. nonce: hDFkwu +.. section: Library + +Disable the vulnerable SSLv3 protocol by default when creating +ssl.SSLContext. + +.. + +.. bpo: 25569 +.. date: 8030 +.. nonce: CfvQjK +.. section: Library + +Fix memory leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 25471 +.. date: 8029 +.. nonce: T0A02M +.. section: Library + +Sockets returned from accept() shouldn't appear to be nonblocking. + +.. + +.. bpo: 25319 +.. date: 8028 +.. nonce: iyuglv +.. section: Library + +When threading.Event is reinitialized, the underlying condition should use a +regular lock rather than a recursive lock. + +.. + +.. bpo: 21112 +.. date: 8027 +.. nonce: vSFU1r +.. section: Library + +Fix regression in unittest.expectedFailure on subclasses. Patch from Berker +Peksag. + +.. + +.. bpo: 24764 +.. date: 8026 +.. nonce: QwFZ2S +.. section: Library + +cgi.FieldStorage.read_multi() now ignores the Content-Length header in part +headers. Patch written by Peter Landry and reviewed by Pierre Quentel. + +.. + +.. bpo: 24913 +.. date: 8025 +.. nonce: p2ZAJ4 +.. section: Library + +Fix overrun error in deque.index(). Found by John Leitch and Bryce Darling. + +.. + +.. bpo: 24774 +.. date: 8024 +.. nonce: xLbskG +.. section: Library + +Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. + +.. + +.. bpo: 21159 +.. date: 8023 +.. nonce: ochL5W +.. section: Library + +Improve message in configparser.InterpolationMissingOptionError. Patch from +?ukasz Langa. + +.. + +.. bpo: 20362 +.. date: 8022 +.. nonce: 5aP_Ri +.. section: Library + +Honour TestCase.longMessage correctly in assertRegex. Patch from Ilia +Kurenkov. + +.. + +.. bpo: 23572 +.. date: 8021 +.. nonce: QhQ9RD +.. section: Library + +Fixed functools.singledispatch on classes with falsy metaclasses. Patch by +Ethan Furman. + +.. + +.. bpo: 0 +.. date: 8020 +.. nonce: DO1sFa +.. section: Library + +asyncio: ensure_future() now accepts awaitable objects. + +.. + +.. bpo: 15348 +.. date: 8019 +.. nonce: d1Fg01 +.. section: IDLE + +Stop the debugger engine (normally in a user process) before closing the +debugger window (running in the IDLE process). This prevents the +RuntimeErrors that were being caught and ignored. + +.. + +.. bpo: 24455 +.. date: 8018 +.. nonce: x6YqtE +.. section: IDLE + +Prevent IDLE from hanging when a) closing the shell while the debugger is +active (15347); b) closing the debugger with the [X] button (15348); and c) +activating the debugger when already active (24455). The patch by Mark +Roseman does this by making two changes. 1. Suspend and resume the +gui.interaction method with the tcl vwait mechanism intended for this +purpose (instead of root.mainloop & .quit). 2. In gui.run, allow any +existing interaction to terminate first. + +.. + +.. bpo: 0 +.. date: 8017 +.. nonce: Yp9LRY +.. section: IDLE + +Change 'The program' to 'Your program' in an IDLE 'kill program?' message to +make it clearer that the program referred to is the currently running user +program, not IDLE itself. + +.. + +.. bpo: 24750 +.. date: 8016 +.. nonce: xgsi-K +.. section: IDLE + +Improve the appearance of the IDLE editor window status bar. Patch by Mark +Roseman. + +.. + +.. bpo: 25313 +.. date: 8015 +.. nonce: xMXHpO +.. section: IDLE + +Change the handling of new built-in text color themes to better address the +compatibility problem introduced by the addition of IDLE Dark. Consistently +use the revised idleConf.CurrentTheme everywhere in idlelib. + +.. + +.. bpo: 24782 +.. date: 8014 +.. nonce: RgIPYE +.. section: IDLE + +Extension configuration is now a tab in the IDLE Preferences dialog rather +than a separate dialog. The former tabs are now a sorted list. Patch by +Mark Roseman. + +.. + +.. bpo: 22726 +.. date: 8013 +.. nonce: x8T0dA +.. section: IDLE + +Re-activate the config dialog help button with some content about the other +buttons and the new IDLE Dark theme. + +.. + +.. bpo: 24820 +.. date: 8012 +.. nonce: TFPJhr +.. section: IDLE + +IDLE now has an 'IDLE Dark' built-in text color theme. It is more or less +IDLE Classic inverted, with a cobalt blue background. Strings, comments, +keywords, ... are still green, red, orange, ... . To use it with IDLEs +released before November 2015, hit the 'Save as New Custom Theme' button and +enter a new name, such as 'Custom Dark'. The custom theme will work with +any IDLE release, and can be modified. + +.. + +.. bpo: 25224 +.. date: 8011 +.. nonce: 5Llwo4 +.. section: IDLE + +README.txt is now an idlelib index for IDLE developers and curious users. +The previous user content is now in the IDLE doc chapter. 'IDLE' now means +'Integrated Development and Learning Environment'. + +.. + +.. bpo: 24820 +.. date: 8010 +.. nonce: ZUz9Fn +.. section: IDLE + +Users can now set breakpoint colors in Settings -> Custom Highlighting. +Original patch by Mark Roseman. + +.. + +.. bpo: 24972 +.. date: 8009 +.. nonce: uc0uNo +.. section: IDLE + +Inactive selection background now matches active selection background, as +configured by users, on all systems. Found items are now always highlighted +on Windows. Initial patch by Mark Roseman. + +.. + +.. bpo: 24570 +.. date: 8008 +.. nonce: s3EkNn +.. section: IDLE + +Idle: make calltip and completion boxes appear on Macs affected by a tk +regression. Initial patch by Mark Roseman. + +.. + +.. bpo: 24988 +.. date: 8007 +.. nonce: tXqq4T +.. section: IDLE + +Idle ScrolledList context menus (used in debugger) now work on Mac Aqua. +Patch by Mark Roseman. + +.. + +.. bpo: 24801 +.. date: 8006 +.. nonce: -bj_Ou +.. section: IDLE + +Make right-click for context menu work on Mac Aqua. Patch by Mark Roseman. + +.. + +.. bpo: 25173 +.. date: 8005 +.. nonce: EZzrPg +.. section: IDLE + +Associate tkinter messageboxes with a specific widget. For Mac OSX, make +them a 'sheet'. Patch by Mark Roseman. + +.. + +.. bpo: 25198 +.. date: 8004 +.. nonce: -j_BV7 +.. section: IDLE + +Enhance the initial html viewer now used for Idle Help. * Properly indent +fixed-pitch text (patch by Mark Roseman). * Give code snippet a very Sphinx- +like light blueish-gray background. * Re-use initial width and height set by +users for shell and editor. * When the Table of Contents (TOC) menu is used, +put the section header at the top of the screen. + +.. + +.. bpo: 25225 +.. date: 8003 +.. nonce: 9pvdq6 +.. section: IDLE + +Condense and rewrite Idle doc section on text colors. + +.. + +.. bpo: 21995 +.. date: 8002 +.. nonce: C5Rmzx +.. section: IDLE + +Explain some differences between IDLE and console Python. + +.. + +.. bpo: 22820 +.. date: 8001 +.. nonce: hix_8X +.. section: IDLE + +Explain need for *print* when running file from Idle editor. + +.. + +.. bpo: 25224 +.. date: 8000 +.. nonce: UVMYQq +.. section: IDLE + +Doc: augment Idle feature list and no-subprocess section. + +.. + +.. bpo: 25219 +.. date: 7999 +.. nonce: 8_9DYg +.. section: IDLE + +Update doc for Idle command line options. Some were missing and notes were +not correct. + +.. + +.. bpo: 24861 +.. date: 7998 +.. nonce: Ecg2yT +.. section: IDLE + +Most of idlelib is private and subject to change. Use idleib.idle.* to start +Idle. See idlelib.__init__.__doc__. + +.. + +.. bpo: 25199 +.. date: 7997 +.. nonce: ih7yY3 +.. section: IDLE + +Idle: add synchronization comments for future maintainers. + +.. + +.. bpo: 16893 +.. date: 7996 +.. nonce: bZtPgJ +.. section: IDLE + +Replace help.txt with help.html for Idle doc display. The new +idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks +better than help.txt and will better document Idle as released. The tkinter +html viewer that works for this file was written by Mark Roseman. The now +unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +.. + +.. bpo: 24199 +.. date: 7995 +.. nonce: VKnZEv +.. section: IDLE + +Deprecate unused idlelib.idlever with possible removal in 3.6. + +.. + +.. bpo: 24790 +.. date: 7994 +.. nonce: hD1hlj +.. section: IDLE + +Remove extraneous code (which also create 2 & 3 conflicts). + +.. + +.. bpo: 22558 +.. date: 7993 +.. nonce: Pk02YC +.. section: Documentation + +Add remaining doc links to source code for Python-coded modules. Patch by +Yoni Lavi. + +.. + +.. bpo: 12067 +.. date: 7992 +.. nonce: nLD2M- +.. section: Documentation + +Rewrite Comparisons section in the Expressions chapter of the language +reference. Some of the details of comparing mixed types were incorrect or +ambiguous. NotImplemented is only relevant at a lower level than the +Expressions chapter. Added details of comparing range() objects, and default +behaviour and consistency suggestions for user-defined classes. Patch from +Andy Maier. + +.. + +.. bpo: 24952 +.. date: 7991 +.. nonce: RHhFPE +.. section: Documentation + +Clarify the default size argument of stack_size() in the "threading" and +"_thread" modules. Patch from Mattip. + +.. + +.. bpo: 23725 +.. date: 7990 +.. nonce: 49TZ5f +.. section: Documentation + +Overhaul tempfile docs. Note deprecated status of mktemp. Patch from +Zbigniew J?drzejewski-Szmek. + +.. + +.. bpo: 24808 +.. date: 7989 +.. nonce: MGjc3F +.. section: Documentation + +Update the types of some PyTypeObject fields. Patch by Joseph Weston. + +.. + +.. bpo: 22812 +.. date: 7988 +.. nonce: kLCF0G +.. section: Documentation + +Fix unittest discovery examples. Patch from Pam McA'Nulty. + +.. + +.. bpo: 25449 +.. date: 7987 +.. nonce: MP6KNs +.. section: Tests + +Added tests for OrderedDict subclasses. + +.. + +.. bpo: 25099 +.. date: 7986 +.. nonce: tJQOWx +.. section: Tests + +Make test_compileall not fail when an entry on sys.path cannot be written to +(commonly seen in administrative installs on Windows). + +.. + +.. bpo: 23919 +.. date: 7985 +.. nonce: vJnjaq +.. section: Tests + +Prevents assert dialogs appearing in the test suite. + +.. + +.. bpo: 0 +.. date: 7984 +.. nonce: X-Bk5l +.. section: Tests + +``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass +along to regrtest.py. Previously there was a limit of 9. + +.. + +.. bpo: 24915 +.. date: 7983 +.. nonce: PgD3Cx +.. section: Build + +Add LLVM support for PGO builds and use the test suite to generate the +profile data. Initial patch by Alecsandru Patrascu of Intel. + +.. + +.. bpo: 24910 +.. date: 7982 +.. nonce: ZZdfl0 +.. section: Build + +Windows MSIs now have unique display names. + +.. + +.. bpo: 24986 +.. date: 7981 +.. nonce: 1WyXeU +.. section: Build + +It is now possible to build Python on Windows without errors when external +libraries are not available. + +.. + +.. bpo: 25450 +.. date: 7980 +.. nonce: X4xlWf +.. section: Windows + +Updates shortcuts to start Python in installation directory. + +.. + +.. bpo: 25164 +.. date: 7979 +.. nonce: FHVOOA +.. section: Windows + +Changes default all-users install directory to match per-user directory. + +.. + +.. bpo: 25143 +.. date: 7978 +.. nonce: hmxsia +.. section: Windows + +Improves installer error messages for unsupported platforms. + +.. + +.. bpo: 25163 +.. date: 7977 +.. nonce: uCRe8H +.. section: Windows + +Display correct directory in installer when using non-default settings. + +.. + +.. bpo: 25361 +.. date: 7976 +.. nonce: GETaSY +.. section: Windows + +Disables use of SSE2 instructions in Windows 32-bit build + +.. + +.. bpo: 25089 +.. date: 7975 +.. nonce: n_YJgw +.. section: Windows + +Adds logging to installer for case where launcher is not selected on +upgrade. + +.. + +.. bpo: 25165 +.. date: 7974 +.. nonce: aUTN1e +.. section: Windows + +Windows uninstallation should not remove launcher if other versions remain + +.. + +.. bpo: 25112 +.. date: 7973 +.. nonce: frdKij +.. section: Windows + +py.exe launcher is missing icons + +.. + +.. bpo: 25102 +.. date: 7972 +.. nonce: 6y6Akl +.. section: Windows + +Windows installer does not precompile for -O or -OO. + +.. + +.. bpo: 25081 +.. date: 7971 +.. nonce: dcRCTO +.. section: Windows + +Makes Back button in installer go back to upgrade page when upgrading. + +.. + +.. bpo: 25091 +.. date: 7970 +.. nonce: 1u-VKy +.. section: Windows + +Increases font size of the installer. + +.. + +.. bpo: 25126 +.. date: 7969 +.. nonce: ANx3DW +.. section: Windows + +Clarifies that the non-web installer will download some components. + +.. + +.. bpo: 25213 +.. date: 7968 +.. nonce: KGmXoe +.. section: Windows + +Restores requestedExecutionLevel to manifest to disable UAC virtualization. + +.. + +.. bpo: 25022 +.. date: 7967 +.. nonce: vAt_zr +.. section: Windows + +Removed very outdated PC/example_nt/ directory. + +.. + +.. bpo: 25440 +.. date: 7966 +.. nonce: 5xhyGr +.. section: Tools/Demos + +Fix output of python-config --extension-suffix. diff --git a/Misc/NEWS.d/3.5.2.rst b/Misc/NEWS.d/3.5.2.rst new file mode 100644 index 00000000000..b9c366e1a99 --- /dev/null +++ b/Misc/NEWS.d/3.5.2.rst @@ -0,0 +1,25 @@ +.. bpo: 26930 +.. date: 8336 +.. nonce: 9JUeSD +.. release date: 2016-06-26 +.. section: Core and Builtins + +Update Windows builds to use OpenSSL 1.0.2h. + +.. + +.. bpo: 26867 +.. date: 8335 +.. nonce: QPSyP5 +.. section: Tests + +Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. + +.. + +.. bpo: 27365 +.. date: 8334 +.. nonce: ipkJ_M +.. section: IDLE + +Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. diff --git a/Misc/NEWS.d/3.5.2rc1.rst b/Misc/NEWS.d/3.5.2rc1.rst new file mode 100644 index 00000000000..590fdba866d --- /dev/null +++ b/Misc/NEWS.d/3.5.2rc1.rst @@ -0,0 +1,2204 @@ +.. bpo: 27066 +.. date: 8333 +.. nonce: SNExZi +.. release date: 2016-06-12 +.. section: Core and Builtins + +Fixed SystemError if a custom opener (for open()) returns a negative number +without setting an exception. + +.. + +.. bpo: 20041 +.. date: 8332 +.. nonce: TypyGp +.. section: Core and Builtins + +Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. + +.. + +.. bpo: 26168 +.. date: 8331 +.. nonce: -nPBL6 +.. section: Core and Builtins + +Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. + +.. + +.. bpo: 26991 +.. date: 8330 +.. nonce: yWGNhz +.. section: Core and Builtins + +Fix possible refleak when creating a function with annotations. + +.. + +.. bpo: 27039 +.. date: 8329 +.. nonce: Zj7tV7 +.. section: Core and Builtins + +Fixed bytearray.remove() for values greater than 127. Patch by Joe Jevnik. + +.. + +.. bpo: 23640 +.. date: 8328 +.. nonce: kvNC4c +.. section: Core and Builtins + +int.from_bytes() no longer bypasses constructors for subclasses. + +.. + +.. bpo: 26811 +.. date: 8327 +.. nonce: oNzUWt +.. section: Core and Builtins + +gc.get_objects() no longer contains a broken tuple with NULL pointer. + +.. + +.. bpo: 20120 +.. date: 8326 +.. nonce: c-FZZc +.. section: Core and Builtins + +Use RawConfigParser for .pypirc parsing, removing support for interpolation +unintentionally added with move to Python 3. Behavior no longer does any +interpolation in .pypirc files, matching behavior in Python 2.7 and +Setuptools 19.0. + +.. + +.. bpo: 26659 +.. date: 8325 +.. nonce: 5PRa83 +.. section: Core and Builtins + +Make the builtin slice type support cycle collection. + +.. + +.. bpo: 26718 +.. date: 8324 +.. nonce: K5PQ8j +.. section: Core and Builtins + +super.__init__ no longer leaks memory if called multiple times. NOTE: A +direct call of super.__init__ is not endorsed! + +.. + +.. bpo: 25339 +.. date: 8323 +.. nonce: ZcaC2E +.. section: Core and Builtins + +PYTHONIOENCODING now has priority over locale in setting the error handler +for stdin and stdout. + +.. + +.. bpo: 26494 +.. date: 8322 +.. nonce: G6eXIi +.. section: Core and Builtins + +Fixed crash on iterating exhausting iterators. Affected classes are generic +sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, +frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator. + +.. + +.. bpo: 26581 +.. date: 8321 +.. nonce: yNA7nm +.. section: Core and Builtins + +If coding cookie is specified multiple times on a line in Python source code +file, only the first one is taken to account. + +.. + +.. bpo: 26464 +.. date: 8320 +.. nonce: 7BreGz +.. section: Core and Builtins + +Fix str.translate() when string is ASCII and first replacements removes +character, but next replacement uses a non-ASCII character or a string +longer than 1 character. Regression introduced in Python 3.5.0. + +.. + +.. bpo: 22836 +.. date: 8319 +.. nonce: cimt1y +.. section: Core and Builtins + +Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() +are sensible even when formatting them produces secondary errors. This +affects the reports produced by sys.__excepthook__() and when __del__() +raises an exception. + +.. + +.. bpo: 26302 +.. date: 8318 +.. nonce: UD9XQt +.. section: Core and Builtins + +Correct behavior to reject comma as a legal character for cookie names. + +.. + +.. bpo: 4806 +.. date: 8317 +.. nonce: i9m3hj +.. section: Core and Builtins + +Avoid masking the original TypeError exception when using star (``*``) +unpacking in function calls. Based on patch by Hagen F?rstenau and Daniel +Urban. + +.. + +.. bpo: 27138 +.. date: 8316 +.. nonce: ifYEro +.. section: Core and Builtins + +Fix the doc comment for FileFinder.find_spec(). + +.. + +.. bpo: 26154 +.. date: 8315 +.. nonce: MtnRAH +.. section: Core and Builtins + +Add a new private _PyThreadState_UncheckedGet() function to get the current +Python thread state, but don't issue a fatal error if it is NULL. This new +function must be used instead of accessing directly the +_PyThreadState_Current variable. The variable is no more exposed since +Python 3.5.1 to hide the exact implementation of atomic C types, to avoid +compiler issues. + +.. + +.. bpo: 26194 +.. date: 8314 +.. nonce: j9zand +.. section: Core and Builtins + +Deque.insert() gave odd results for bounded deques that had reached their +maximum size. Now an IndexError will be raised when attempting to insert +into a full deque. + +.. + +.. bpo: 25843 +.. date: 8313 +.. nonce: t2kGug +.. section: Core and Builtins + +When compiling code, don't merge constants if they are equal but have a +different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now +correctly compiled to two different functions: ``f1()`` returns ``1`` +(``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` +are equal. + +.. + +.. bpo: 22995 +.. date: 8312 +.. nonce: KYNKvs +.. section: Core and Builtins + +[UPDATE] Comment out the one of the pickleability tests in +_PyObject_GetState() due to regressions observed in Cython-based projects. + +.. + +.. bpo: 25961 +.. date: 8311 +.. nonce: Hdjjw0 +.. section: Core and Builtins + +Disallowed null characters in the type name. + +.. + +.. bpo: 25973 +.. date: 8310 +.. nonce: Ud__ZP +.. section: Core and Builtins + +Fix segfault when an invalid nonlocal statement binds a name starting with +two underscores. + +.. + +.. bpo: 22995 +.. date: 8309 +.. nonce: Wq0E86 +.. section: Core and Builtins + +Instances of extension types with a state that aren't subclasses of list or +dict and haven't implemented any pickle-related methods (__reduce__, +__reduce_ex__, __getnewargs__, __getnewargs_ex__, or __getstate__), can no +longer be pickled. Including memoryview. + +.. + +.. bpo: 20440 +.. date: 8308 +.. nonce: GCwOfH +.. section: Core and Builtins + +Massive replacing unsafe attribute setting code with special macro +Py_SETREF. + +.. + +.. bpo: 25766 +.. date: 8307 +.. nonce: jn93Yu +.. section: Core and Builtins + +Special method __bytes__() now works in str subclasses. + +.. + +.. bpo: 25421 +.. date: 8306 +.. nonce: c47YEL +.. section: Core and Builtins + +__sizeof__ methods of builtin types now use dynamic basic size. This allows +sys.getsize() to work correctly with their subclasses with __slots__ +defined. + +.. + +.. bpo: 25709 +.. date: 8305 +.. nonce: WwGm2k +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 27147 +.. date: 8304 +.. nonce: tCCgmH +.. section: Core and Builtins + +Mention PEP 420 in the importlib docs. + +.. + +.. bpo: 24097 +.. date: 8303 +.. nonce: Vt4E-i +.. section: Core and Builtins + +Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. + +.. + +.. bpo: 24731 +.. date: 8302 +.. nonce: h9-hnz +.. section: Core and Builtins + +Fixed crash on converting objects with special methods __bytes__, __trunc__, +and __float__ returning instances of subclasses of bytes, int, and float to +subclasses of bytes, int, and float correspondingly. + +.. + +.. bpo: 26478 +.. date: 8301 +.. nonce: n0dB8e +.. section: Core and Builtins + +Fix semantic bugs when using binary operators with dictionary views and +tuples. + +.. + +.. bpo: 26171 +.. date: 8300 +.. nonce: 8SaQEa +.. section: Core and Builtins + +Fix possible integer overflow and heap corruption in zipimporter.get_data(). + +.. + +.. bpo: 25660 +.. date: 8299 +.. nonce: 93DzBo +.. section: Core and Builtins + +Fix TAB key behaviour in REPL with readline. + +.. + +.. bpo: 25887 +.. date: 8298 +.. nonce: PtVIX7 +.. section: Core and Builtins + +Raise a RuntimeError when a coroutine object is awaited more than once. + +.. + +.. bpo: 27243 +.. date: 8297 +.. nonce: U36M4E +.. section: Core and Builtins + +Update the __aiter__ protocol: instead of returning an awaitable that +resolves to an asynchronous iterator, the asynchronous iterator should be +returned directly. Doing the former will trigger a +PendingDeprecationWarning. + +.. + +.. bpo: 26556 +.. date: 8296 +.. nonce: v5j2uL +.. original section: Library +.. section: Security + +Update expat to 2.1.1, fixes CVE-2015-1283. + +.. + +.. bpo: 0 +.. date: 8295 +.. nonce: E4ochz +.. original section: Library +.. section: Security + +Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. Reported by Team +Oststrom + +.. + +.. bpo: 21386 +.. date: 8294 +.. nonce: DjV72U +.. section: Library + +Implement missing IPv4Address.is_global property. It was documented since +07a5610bae9d. Initial patch by Roger Luethi. + +.. + +.. bpo: 20900 +.. date: 8293 +.. nonce: H5YQPR +.. section: Library + +distutils register command now decodes HTTP responses correctly. Initial +patch by ingrid. + +.. + +.. bpo: 0 +.. date: 8292 +.. nonce: iYIeng +.. section: Library + +A new version of typing.py provides several new classes and features: + at overload outside stubs, Reversible, DefaultDict, Text, ContextManager, +Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of +the new features are not yet implemented in mypy or other static analyzers). +Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been +added (in fact they made it into 3.5.1 but were never mentioned). + +.. + +.. bpo: 25738 +.. date: 8291 +.. nonce: mED9w4 +.. section: Library + +Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message +body for 205 Reset Content. Also, don't send Content header fields in +responses that don't have a body. Patch by Susumu Koshiba. + +.. + +.. bpo: 21313 +.. date: 8290 +.. nonce: W30MBr +.. section: Library + +Fix the "platform" module to tolerate when sys.version contains truncated +build information. + +.. + +.. bpo: 26839 +.. date: 8289 +.. nonce: yVvy7R +.. original section: Library +.. section: Security + +On Linux, :func:`os.urandom` now calls ``getrandom()`` with +``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom +entropy pool is not initialized yet. Patch written by Colm Buckley. + +.. + +.. bpo: 27164 +.. date: 8288 +.. nonce: 6wmjx2 +.. section: Library + +In the zlib module, allow decompressing raw Deflate streams with a +predefined zdict. Based on patch by Xiang Zhang. + +.. + +.. bpo: 24291 +.. date: 8287 +.. nonce: Ac6HvL +.. section: Library + +Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the +client. Previously it could do partial writes and truncate data. Also, +wsgiref.handler.ServerHandler can now handle stdout doing partial writes, +but this is deprecated. + +.. + +.. bpo: 26809 +.. date: 8286 +.. nonce: ya7JMb +.. section: Library + +Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + +.. + +.. bpo: 26373 +.. date: 8285 +.. nonce: P6qz6o +.. section: Library + +subprocess.Popen.communicate now correctly ignores BrokenPipeError when the +child process dies before .communicate() is called in more/all +circumstances. + +.. + +.. bpo: 21776 +.. date: 8284 +.. nonce: 04eQfa +.. section: Library + +distutils.upload now correctly handles HTTPError. Initial patch by Claudiu +Popa. + +.. + +.. bpo: 27114 +.. date: 8283 +.. nonce: bGCuAM +.. section: Library + +Fix SSLContext._load_windows_store_certs fails with PermissionError + +.. + +.. bpo: 18383 +.. date: 8282 +.. nonce: jr-b0l +.. section: Library + +Avoid creating duplicate filters when using filterwarnings and simplefilter. +Based on patch by Alex Shkop. + +.. + +.. bpo: 27057 +.. date: 8281 +.. nonce: YzTA_Q +.. section: Library + +Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails +with EACCESS. The function now falls back to fcntl(). Patch written by +Micha? Bednarski. + +.. + +.. bpo: 27014 +.. date: 8280 +.. nonce: ui7Khn +.. section: Library + +Fix infinite recursion using typing.py. Thanks to Kalle Tuure! + +.. + +.. bpo: 14132 +.. date: 8279 +.. nonce: 5wR9MN +.. section: Library + +Fix urllib.request redirect handling when the target only has a query +string. Original fix by J?n Janech. + +.. + +.. bpo: 17214 +.. date: 8278 +.. nonce: lUbZOV +.. section: Library + +The "urllib.request" module now percent-encodes non-ASCII bytes found in +redirect target URLs. Some servers send Location header fields with non- +ASCII bytes, but "http.client" requires the request target to be ASCII- +encodable, otherwise a UnicodeEncodeError is raised. Based on patch by +Christian Heimes. + +.. + +.. bpo: 26892 +.. date: 8277 +.. nonce: XIXb0h +.. section: Library + +Honor debuglevel flag in urllib.request.HTTPHandler. Patch contributed by +Chi Hsuan Yen. + +.. + +.. bpo: 22274 +.. date: 8276 +.. nonce: 0RHDMN +.. section: Library + +In the subprocess module, allow stderr to be redirected to stdout even when +stdout is not redirected. Patch by Akira Li. + +.. + +.. bpo: 26807 +.. date: 8275 +.. nonce: LXSPP6 +.. section: Library + +mock_open 'files' no longer error on readline at end of file. Patch from +Yolanda Robla. + +.. + +.. bpo: 25745 +.. date: 8274 +.. nonce: -n8acU +.. section: Library + +Fixed leaking a userptr in curses panel destructor. + +.. + +.. bpo: 26977 +.. date: 8273 +.. nonce: 5G4HtL +.. section: Library + +Removed unnecessary, and ignored, call to sum of squares helper in +statistics.pvariance. + +.. + +.. bpo: 26881 +.. date: 8272 +.. nonce: mdiq_L +.. section: Library + +The modulefinder module now supports extended opcode arguments. + +.. + +.. bpo: 23815 +.. date: 8271 +.. nonce: _krNe8 +.. section: Library + +Fixed crashes related to directly created instances of types in _tkinter and +curses.panel modules. + +.. + +.. bpo: 17765 +.. date: 8270 +.. nonce: hiSVS1 +.. section: Library + +weakref.ref() no longer silently ignores keyword arguments. Patch by Georg +Brandl. + +.. + +.. bpo: 26873 +.. date: 8269 +.. nonce: cYXRcH +.. section: Library + +xmlrpc now raises ResponseError on unsupported type tags instead of silently +return incorrect result. + +.. + +.. bpo: 26711 +.. date: 8268 +.. nonce: Eu85Qw +.. section: Library + +Fixed the comparison of plistlib.Data with other types. + +.. + +.. bpo: 24114 +.. date: 8267 +.. nonce: RMRMtM +.. section: Library + +Fix an uninitialized variable in `ctypes.util`. + +The bug only occurs on SunOS when the ctypes implementation searches for the +`crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. + +.. + +.. bpo: 26864 +.. date: 8266 +.. nonce: 1KgGds +.. section: Library + +In urllib.request, change the proxy bypass host checking against no_proxy to +be case-insensitive, and to not match unrelated host names that happen to +have a bypassed hostname as a suffix. Patch by Xiang Zhang. + +.. + +.. bpo: 26634 +.. date: 8265 +.. nonce: FZvsSb +.. section: Library + +recursive_repr() now sets __qualname__ of wrapper. Patch by Xiang Zhang. + +.. + +.. bpo: 26804 +.. date: 8264 +.. nonce: 9Orp-G +.. section: Library + +urllib.request will prefer lower_case proxy environment variables over +UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter Jansen. + +.. + +.. bpo: 26837 +.. date: 8263 +.. nonce: 2FXGsD +.. section: Library + +assertSequenceEqual() now correctly outputs non-stringified differing items +(like bytes in the -b mode). This affects assertListEqual() and +assertTupleEqual(). + +.. + +.. bpo: 26041 +.. date: 8262 +.. nonce: bVem-p +.. section: Library + +Remove "will be removed in Python 3.7" from deprecation messages of +platform.dist() and platform.linux_distribution(). Patch by Kumaripaba +Miyurusara Athukorala. + +.. + +.. bpo: 26822 +.. date: 8261 +.. nonce: rYSL4W +.. section: Library + +itemgetter, attrgetter and methodcaller objects no longer silently ignore +keyword arguments. + +.. + +.. bpo: 26733 +.. date: 8260 +.. nonce: YxaJmL +.. section: Library + +Disassembling a class now disassembles class and static methods. Patch by +Xiang Zhang. + +.. + +.. bpo: 26801 +.. date: 8259 +.. nonce: TQGY-7 +.. section: Library + +Fix error handling in :func:`shutil.get_terminal_size`, catch +:exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel +Barry. + +.. + +.. bpo: 24838 +.. date: 8258 +.. nonce: 3Pfx8T +.. section: Library + +tarfile's ustar and gnu formats now correctly calculate name and link field +limits for multibyte character encodings like utf-8. + +.. + +.. bpo: 26657 +.. date: 8257 +.. nonce: C_-XFg +.. original section: Library +.. section: Security + +Fix directory traversal vulnerability with http.server on Windows. This +fixes a regression that was introduced in 3.3.4rc1 and 3.4.0rc1. Based on +patch by Philipp Hagemeister. + +.. + +.. bpo: 26717 +.. date: 8256 +.. nonce: jngTdu +.. section: Library + +Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by Anthony Sottile. + +.. + +.. bpo: 26735 +.. date: 8255 +.. nonce: riSl3b +.. section: Library + +Fix :func:`os.urandom` on Solaris 11.3 and newer when reading more than +1,024 bytes: call ``getrandom()`` multiple times with a limit of 1024 bytes +per call. + +.. + +.. bpo: 16329 +.. date: 8254 +.. nonce: nuXD8W +.. section: Library + +Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 13952 +.. date: 8253 +.. nonce: SOoTVE +.. section: Library + +Add .csv to mimetypes.types_map. Patch by Geoff Wilson. + +.. + +.. bpo: 26709 +.. date: 8252 +.. nonce: luOPbP +.. section: Library + +Fixed Y2038 problem in loading binary PLists. + +.. + +.. bpo: 23735 +.. date: 8251 +.. nonce: Y5oQ9r +.. section: Library + +Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH +handler. Patch by Eric Price. + +.. + +.. bpo: 26586 +.. date: 8250 +.. nonce: V5pZNa +.. section: Library + +In http.server, respond with "413 Request header fields too large" if there +are too many header fields to parse, rather than killing the connection and +raising an unhandled exception. Patch by Xiang Zhang. + +.. + +.. bpo: 22854 +.. date: 8249 +.. nonce: K3rMEH +.. section: Library + +Change BufferedReader.writable() and BufferedWriter.readable() to always +return False. + +.. + +.. bpo: 25195 +.. date: 8248 +.. nonce: EOc4Po +.. section: Library + +Fix a regression in mock.MagicMock. _Call is a subclass of tuple (changeset +3603bae63c13 only works for classes) so we need to implement __ne__ +ourselves. Patch by Andrew Plummer. + +.. + +.. bpo: 26644 +.. date: 8247 +.. nonce: 7tt1tk +.. section: Library + +Raise ValueError rather than SystemError when a negative length is passed to +SSLSocket.recv() or read(). + +.. + +.. bpo: 23804 +.. date: 8246 +.. nonce: PP63Ff +.. section: Library + +Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to +1024. + +.. + +.. bpo: 26616 +.. date: 8245 +.. nonce: v3QwdD +.. section: Library + +Fixed a bug in datetime.astimezone() method. + +.. + +.. bpo: 21925 +.. date: 8244 +.. nonce: _fr69L +.. section: Library + +:func:`warnings.formatwarning` now catches exceptions on +``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` emitted +late during the Python shutdown process. + +.. + +.. bpo: 24266 +.. date: 8243 +.. nonce: YZgVyM +.. section: Library + +Ctrl+C during Readline history search now cancels the search mode when +compiled with Readline 7. + +.. + +.. bpo: 26560 +.. date: 8242 +.. nonce: A4WXNz +.. section: Library + +Avoid potential ValueError in BaseHandler.start_response. Initial patch by +Peter Inglesby. + +.. + +.. bpo: 26313 +.. date: 8241 +.. nonce: LjZAjy +.. original section: Library +.. section: Security + +ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch +by Baji. + +.. + +.. bpo: 26569 +.. date: 8240 +.. nonce: EX8vF1 +.. section: Library + +Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` to support +importing packages. + +.. + +.. bpo: 26499 +.. date: 8239 +.. nonce: NP08PI +.. section: Library + +Account for remaining Content-Length in HTTPResponse.readline() and read1(). +Based on patch by Silent Ghost. Also document that HTTPResponse now supports +these methods. + +.. + +.. bpo: 25320 +.. date: 8238 +.. nonce: V96LIy +.. section: Library + +Handle sockets in directories unittest discovery is scanning. Patch from +Victor van den Elzen. + +.. + +.. bpo: 16181 +.. date: 8237 +.. nonce: P7lLvo +.. section: Library + +cookiejar.http2time() now returns None if year is higher than +datetime.MAXYEAR. + +.. + +.. bpo: 26513 +.. date: 8236 +.. nonce: HoPepy +.. section: Library + +Fixes platform module detection of Windows Server + +.. + +.. bpo: 23718 +.. date: 8235 +.. nonce: AMPC0o +.. section: Library + +Fixed parsing time in week 0 before Jan 1. Original patch by Tam?s Bence +Gedai. + +.. + +.. bpo: 20589 +.. date: 8234 +.. nonce: NsQ_I1 +.. section: Library + +Invoking Path.owner() and Path.group() on Windows now raise +NotImplementedError instead of ImportError. + +.. + +.. bpo: 26177 +.. date: 8233 +.. nonce: HlSWer +.. section: Library + +Fixed the keys() method for Canvas and Scrollbar widgets. + +.. + +.. bpo: 15068 +.. date: 8232 +.. nonce: bcHtiw +.. section: Library + +Got rid of excessive buffering in the fileinput module. The bufsize +parameter is no longer used. + +.. + +.. bpo: 2202 +.. date: 8231 +.. nonce: dk9sd0 +.. section: Library + +Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls. +Initial patch by Mathieu Dupuy. + +.. + +.. bpo: 25718 +.. date: 8230 +.. nonce: 4EjZyv +.. section: Library + +Fixed pickling and copying the accumulate() iterator with total is None. + +.. + +.. bpo: 26475 +.. date: 8229 +.. nonce: JXVccY +.. section: Library + +Fixed debugging output for regular expressions with the (?x) flag. + +.. + +.. bpo: 26457 +.. date: 8228 +.. nonce: Xe6Clh +.. section: Library + +Fixed the subnets() methods in IP network classes for the case when +resulting prefix length is equal to maximal prefix length. Based on patch by +Xiang Zhang. + +.. + +.. bpo: 26385 +.. date: 8227 +.. nonce: 50bDXm +.. section: Library + +Remove the file if the internal open() call in NamedTemporaryFile() fails. +Patch by Silent Ghost. + +.. + +.. bpo: 26402 +.. date: 8226 +.. nonce: k7DVuU +.. section: Library + +Fix XML-RPC client to retry when the server shuts down a persistent +connection. This was a regression related to the new +http.client.RemoteDisconnected exception in 3.5.0a4. + +.. + +.. bpo: 25913 +.. date: 8225 +.. nonce: 5flb95 +.. section: Library + +Leading ``<~`` is optional now in base64.a85decode() with adobe=True. Patch +by Swati Jaiswal. + +.. + +.. bpo: 26186 +.. date: 8224 +.. nonce: R9rfiL +.. section: Library + +Remove an invalid type check in importlib.util.LazyLoader. + +.. + +.. bpo: 26367 +.. date: 8223 +.. nonce: ckpNeU +.. section: Library + +importlib.__import__() raises SystemError like builtins.__import__() when +``level`` is specified but without an accompanying package specified. + +.. + +.. bpo: 26309 +.. date: 8222 +.. nonce: ubEeiz +.. section: Library + +In the "socketserver" module, shut down the request (closing the connected +socket) when verify_request() returns false. Patch by Aviv Palivoda. + +.. + +.. bpo: 25939 +.. date: 8221 +.. nonce: X49Fqd +.. original section: Library +.. section: Security + +On Windows open the cert store readonly in ssl.enum_certificates. + +.. + +.. bpo: 25995 +.. date: 8220 +.. nonce: NfcimP +.. section: Library + +os.walk() no longer uses FDs proportional to the tree depth. + +.. + +.. bpo: 26117 +.. date: 8219 +.. nonce: ne6p11 +.. section: Library + +The os.scandir() iterator now closes file descriptor not only when the +iteration is finished, but when it was failed with error. + +.. + +.. bpo: 25911 +.. date: 8218 +.. nonce: d4Zadh +.. section: Library + +Restored support of bytes paths in os.walk() on Windows. + +.. + +.. bpo: 26045 +.. date: 8217 +.. nonce: WmzUrX +.. section: Library + +Add UTF-8 suggestion to error message when posting a non-Latin-1 string with +http.client. + +.. + +.. bpo: 12923 +.. date: 8216 +.. nonce: HPAu-B +.. section: Library + +Reset FancyURLopener's redirect counter even if there is an exception. +Based on patches by Brian Brazil and Daniel Rocco. + +.. + +.. bpo: 25945 +.. date: 8215 +.. nonce: guNgNM +.. section: Library + +Fixed a crash when unpickle the functools.partial object with wrong state. +Fixed a leak in failed functools.partial constructor. "args" and "keywords" +attributes of functools.partial have now always types tuple and dict +correspondingly. + +.. + +.. bpo: 26202 +.. date: 8214 +.. nonce: LPIXLg +.. section: Library + +copy.deepcopy() now correctly copies range() objects with non-atomic +attributes. + +.. + +.. bpo: 23076 +.. date: 8213 +.. nonce: 8rphoP +.. section: Library + +Path.glob() now raises a ValueError if it's called with an invalid pattern. +Patch by Thomas Nyberg. + +.. + +.. bpo: 19883 +.. date: 8212 +.. nonce: z9TsO6 +.. section: Library + +Fixed possible integer overflows in zipimport. + +.. + +.. bpo: 26227 +.. date: 8211 +.. nonce: Fe6oiB +.. section: Library + +On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions +of the socket module now decode the hostname from the ANSI code page rather +than UTF-8. + +.. + +.. bpo: 26147 +.. date: 8210 +.. nonce: i-Jc01 +.. section: Library + +xmlrpc now works with strings not encodable with used non-UTF-8 encoding. + +.. + +.. bpo: 25935 +.. date: 8209 +.. nonce: cyni91 +.. section: Library + +Garbage collector now breaks reference loops with OrderedDict. + +.. + +.. bpo: 16620 +.. date: 8208 +.. nonce: rxpn_Y +.. section: Library + +Fixed AttributeError in msilib.Directory.glob(). + +.. + +.. bpo: 26013 +.. date: 8207 +.. nonce: 93RKNz +.. section: Library + +Added compatibility with broken protocol 2 pickles created in old Python 3 +versions (3.4.3 and lower). + +.. + +.. bpo: 25850 +.. date: 8206 +.. nonce: jwFPxj +.. section: Library + +Use cross-compilation by default for 64-bit Windows. + +.. + +.. bpo: 17633 +.. date: 8205 +.. nonce: 9mpbUO +.. section: Library + +Improve zipimport's support for namespace packages. + +.. + +.. bpo: 24705 +.. date: 8204 +.. nonce: IZYwjR +.. section: Library + +Fix sysconfig._parse_makefile not expanding ${} vars appearing before $() +vars. + +.. + +.. bpo: 22138 +.. date: 8203 +.. nonce: nRNYkc +.. section: Library + +Fix mock.patch behavior when patching descriptors. Restore original values +after patching. Patch contributed by Sean McCully. + +.. + +.. bpo: 25672 +.. date: 8202 +.. nonce: fw9RJP +.. section: Library + +In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode option if it is +safe to do so. + +.. + +.. bpo: 26012 +.. date: 8201 +.. nonce: IFSXNm +.. section: Library + +Don't traverse into symlinks for ``**`` pattern in pathlib.Path.[r]glob(). + +.. + +.. bpo: 24120 +.. date: 8200 +.. nonce: Yiwa0h +.. section: Library + +Ignore PermissionError when traversing a tree with pathlib.Path.[r]glob(). +Patch by Ulrich Petri. + +.. + +.. bpo: 25447 +.. date: 8199 +.. nonce: -4m4xO +.. section: Library + +fileinput now uses sys.stdin as-is if it does not have a buffer attribute +(restores backward compatibility). + +.. + +.. bpo: 25447 +.. date: 8198 +.. nonce: AtHkWA +.. section: Library + +Copying the lru_cache() wrapper object now always works, independedly from +the type of the wrapped object (by returning the original object unchanged). + +.. + +.. bpo: 24103 +.. date: 8197 +.. nonce: WufqrQ +.. section: Library + +Fixed possible use after free in ElementTree.XMLPullParser. + +.. + +.. bpo: 25860 +.. date: 8196 +.. nonce: 0hActb +.. section: Library + +os.fwalk() no longer skips remaining directories when error occurs. +Original patch by Samson Lee. + +.. + +.. bpo: 25914 +.. date: 8195 +.. nonce: h0V61F +.. section: Library + +Fixed and simplified OrderedDict.__sizeof__. + +.. + +.. bpo: 25902 +.. date: 8194 +.. nonce: 6t2FmH +.. section: Library + +Fixed various refcount issues in ElementTree iteration. + +.. + +.. bpo: 25717 +.. date: 8193 +.. nonce: 0_xjaK +.. section: Library + +Restore the previous behaviour of tolerating most fstat() errors when +opening files. This was a regression in 3.5a1, and stopped anonymous +temporary files from working in special cases. + +.. + +.. bpo: 24903 +.. date: 8192 +.. nonce: 3LBdzb +.. section: Library + +Fix regression in number of arguments compileall accepts when '-d' is +specified. The check on the number of arguments has been dropped completely +as it never worked correctly anyway. + +.. + +.. bpo: 25764 +.. date: 8191 +.. nonce: 7WWG07 +.. section: Library + +In the subprocess module, preserve any exception caused by fork() failure +when preexec_fn is used. + +.. + +.. bpo: 6478 +.. date: 8190 +.. nonce: -Bi9Hb +.. section: Library + +_strptime's regexp cache now is reset after changing timezone with +time.tzset(). + +.. + +.. bpo: 14285 +.. date: 8189 +.. nonce: UyG8Hj +.. section: Library + +When executing a package with the "python -m package" option, and package +initialization fails, a proper traceback is now reported. The "runpy" +module now lets exceptions from package initialization pass back to the +caller, rather than raising ImportError. + +.. + +.. bpo: 19771 +.. date: 8188 +.. nonce: 5NG-bg +.. section: Library + +Also in runpy and the "-m" option, omit the irrelevant message ". . . is a +package and cannot be directly executed" if the package could not even be +initialized (e.g. due to a bad ``*.pyc`` file). + +.. + +.. bpo: 25177 +.. date: 8187 +.. nonce: aNR4Ha +.. section: Library + +Fixed problem with the mean of very small and very large numbers. As a side +effect, statistics.mean and statistics.variance should be significantly +faster. + +.. + +.. bpo: 25718 +.. date: 8186 +.. nonce: D9mHZF +.. section: Library + +Fixed copying object with state with boolean value is false. + +.. + +.. bpo: 10131 +.. date: 8185 +.. nonce: a7tptz +.. section: Library + +Fixed deep copying of minidom documents. Based on patch by Marian Ganisin. + +.. + +.. bpo: 25725 +.. date: 8184 +.. nonce: XIKv3R +.. section: Library + +Fixed a reference leak in pickle.loads() when unpickling invalid data +including tuple instructions. + +.. + +.. bpo: 25663 +.. date: 8183 +.. nonce: Ofwfqa +.. section: Library + +In the Readline completer, avoid listing duplicate global names, and search +the global namespace before searching builtins. + +.. + +.. bpo: 25688 +.. date: 8182 +.. nonce: 8P1HOv +.. section: Library + +Fixed file leak in ElementTree.iterparse() raising an error. + +.. + +.. bpo: 23914 +.. date: 8181 +.. nonce: 1sEz4J +.. section: Library + +Fixed SystemError raised by unpickler on broken pickle data. + +.. + +.. bpo: 25691 +.. date: 8180 +.. nonce: ZEaapY +.. section: Library + +Fixed crash on deleting ElementTree.Element attributes. + +.. + +.. bpo: 25624 +.. date: 8179 +.. nonce: ed-fM0 +.. section: Library + +ZipFile now always writes a ZIP_STORED header for directory entries. Patch +by Dingyuan Wang. + +.. + +.. bpo: 0 +.. date: 8178 +.. nonce: rtZyid +.. section: Library + +Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26050 +.. date: 8177 +.. nonce: sclyvk +.. section: Library + +Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. + +.. + +.. bpo: 25924 +.. date: 8176 +.. nonce: Uxr2vt +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on OS X versions +10.5 or higher. Original patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26406 +.. date: 8175 +.. nonce: ihvhF4 +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on current versions +of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26848 +.. date: 8174 +.. nonce: ChBOpQ +.. section: Library + +Fix asyncio/subprocess.communicate() to handle empty input. Patch by Jack +O'Connor. + +.. + +.. bpo: 27040 +.. date: 8173 +.. nonce: UASyCC +.. section: Library + +Add loop.get_exception_handler method + +.. + +.. bpo: 27041 +.. date: 8172 +.. nonce: p3893U +.. section: Library + +asyncio: Add loop.create_future method + +.. + +.. bpo: 27223 +.. date: 8171 +.. nonce: PRf4I6 +.. section: Library + +asyncio: Fix _read_ready and _write_ready to respect _conn_lost. Patch by +?ukasz Langa. + +.. + +.. bpo: 22970 +.. date: 8170 +.. nonce: WhdhyM +.. section: Library + +asyncio: Fix inconsistency cancelling Condition.wait. Patch by David Coles. + +.. + +.. bpo: 5124 +.. date: 8169 +.. nonce: 4kwBvM +.. section: IDLE + +Paste with text selected now replaces the selection on X11. This matches how +paste works on Windows, Mac, most modern Linux apps, and ttk widgets. +Original patch by Serhiy Storchaka. + +.. + +.. bpo: 24759 +.. date: 8168 +.. nonce: ccmySu +.. section: IDLE + +Make clear in idlelib.idle_test.__init__ that the directory is a private +implementation of test.test_idle and tool for maintainers. + +.. + +.. bpo: 27196 +.. date: 8167 +.. nonce: 3yp8TF +.. section: IDLE + +Stop 'ThemeChanged' warnings when running IDLE tests. These persisted after +other warnings were suppressed in #20567. Apply Serhiy Storchaka's +update_idletasks solution to four test files. Record this additional advice +in idle_test/README.txt + +.. + +.. bpo: 20567 +.. date: 8166 +.. nonce: hhT32b +.. section: IDLE + +Revise idle_test/README.txt with advice about avoiding tk warning messages +from tests. Apply advice to several IDLE tests. + +.. + +.. bpo: 27117 +.. date: 8165 +.. nonce: YrLPf4 +.. section: IDLE + +Make colorizer htest and turtledemo work with dark themes. Move code for +configuring text widget colors to a new function. + +.. + +.. bpo: 26673 +.. date: 8164 +.. nonce: dh0_Ij +.. section: IDLE + +When tk reports font size as 0, change to size 10. Such fonts on Linux +prevented the configuration dialog from opening. + +.. + +.. bpo: 21939 +.. date: 8163 +.. nonce: pWz-OK +.. section: IDLE + +Add test for IDLE's percolator. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 21676 +.. date: 8162 +.. nonce: hqy6Qh +.. section: IDLE + +Add test for IDLE's replace dialog. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 18410 +.. date: 8161 +.. nonce: DLSPZo +.. section: IDLE + +Add test for IDLE's search dialog. Original patch by Westley Mart?nez. + +.. + +.. bpo: 21703 +.. date: 8160 +.. nonce: BAZfDM +.. section: IDLE + +Add test for IDLE's undo delegator. Original patch by Saimadhav Heblikar . + +.. + +.. bpo: 27044 +.. date: 8159 +.. nonce: 4y7tyM +.. section: IDLE + +Add ConfigDialog.remove_var_callbacks to stop memory leaks. + +.. + +.. bpo: 23977 +.. date: 8158 +.. nonce: miDjj8 +.. section: IDLE + +Add more asserts to test_delegator. + +.. + +.. bpo: 20640 +.. date: 8157 +.. nonce: PmI-G8 +.. section: IDLE + +Add tests for idlelib.configHelpSourceEdit. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 0 +.. date: 8156 +.. nonce: _YJfG7 +.. section: IDLE + +In the 'IDLE-console differences' section of the IDLE doc, clarify how +running with IDLE affects sys.modules and the standard streams. + +.. + +.. bpo: 25507 +.. date: 8155 +.. nonce: i8bNpk +.. section: IDLE + +fix incorrect change in IOBinding that prevented printing. Augment IOBinding +htest to include all major IOBinding functions. + +.. + +.. bpo: 25905 +.. date: 8154 +.. nonce: FzNb3B +.. section: IDLE + +Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION MARK in +README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to +utf-8 and open it with 'utf-8'. + +.. + +.. bpo: 19489 +.. date: 8153 +.. nonce: jvzuO7 +.. section: Documentation + +Moved the search box from the sidebar to the header and footer of each page. +Patch by Ammar Askar. + +.. + +.. bpo: 24136 +.. date: 8152 +.. nonce: MUK0zK +.. section: Documentation + +Document the new PEP 448 unpacking syntax of 3.5. + +.. + +.. bpo: 26736 +.. date: 8151 +.. nonce: U_Hyqo +.. section: Documentation + +Used HTTPS for external links in the documentation if possible. + +.. + +.. bpo: 6953 +.. date: 8150 +.. nonce: Zk6rno +.. section: Documentation + +Rework the Readline module documentation to group related functions +together, and add more details such as what underlying Readline functions +and variables are accessed. + +.. + +.. bpo: 23606 +.. date: 8149 +.. nonce: 9MhIso +.. section: Documentation + +Adds note to ctypes documentation regarding cdll.msvcrt. + +.. + +.. bpo: 25500 +.. date: 8148 +.. nonce: AV47eF +.. section: Documentation + +Fix documentation to not claim that __import__ is searched for in the global +scope. + +.. + +.. bpo: 26014 +.. date: 8147 +.. nonce: ptdZ_I +.. section: Documentation + +Update 3.x packaging documentation: * "See also" links to the new docs are +now provided in the legacy pages * links to setuptools documentation have +been updated + +.. + +.. bpo: 21916 +.. date: 8146 +.. nonce: muwCyp +.. section: Tests + +Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle +Zijlstra. + +.. + +.. bpo: 26523 +.. date: 8145 +.. nonce: em_Uzt +.. section: Tests + +The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. + +.. + +.. bpo: 26015 +.. date: 8144 +.. nonce: p3oWK3 +.. section: Tests + +Added new tests for pickling iterators of mutable sequences. + +.. + +.. bpo: 26325 +.. date: 8143 +.. nonce: KOUc82 +.. section: Tests + +Added test.support.check_no_resource_warning() to check that no +ResourceWarning is emitted. + +.. + +.. bpo: 25940 +.. date: 8142 +.. nonce: PgiLVN +.. section: Tests + +Changed test_ssl to use self-signed.pythontest.net. This avoids relying on +svn.python.org, which recently changed root certificate. + +.. + +.. bpo: 25616 +.. date: 8141 +.. nonce: Qr-60p +.. section: Tests + +Tests for OrderedDict are extracted from test_collections into separate file +test_ordered_dict. + +.. + +.. bpo: 26583 +.. date: 8140 +.. nonce: Up7hTl +.. section: Tests + +Skip test_timestamp_overflow in test_import if bytecode files cannot be +written. + +.. + +.. bpo: 26884 +.. date: 8139 +.. nonce: O8-azL +.. section: Build + +Fix linking extension modules for cross builds. Patch by Xavier de Gaye. + +.. + +.. bpo: 22359 +.. date: 8138 +.. nonce: HDjM4s +.. section: Build + +Disable the rules for running _freeze_importlib and pgen when cross- +compiling. The output of these programs is normally saved with the source +code anyway, and is still regenerated when doing a native build. Patch by +Xavier de Gaye. + +.. + +.. bpo: 27229 +.. date: 8137 +.. nonce: C2NDch +.. section: Build + +Fix the cross-compiling pgen rule for in-tree builds. Patch by Xavier de +Gaye. + +.. + +.. bpo: 21668 +.. date: 8136 +.. nonce: 4sMAa1 +.. section: Build + +Link audioop, _datetime, _ctypes_test modules to libm, except on Mac OS X. +Patch written by Xavier de Gaye. + +.. + +.. bpo: 25702 +.. date: 8135 +.. nonce: ipxyJs +.. section: Build + +A --with-lto configure option has been added that will enable link time +optimizations at build time during a make profile-opt. Some compilers and +toolchains are known to not produce stable code when using LTO, be sure to +test things thoroughly before relying on it. It can provide a few % speed up +over profile-opt alone. + +.. + +.. bpo: 26624 +.. date: 8134 +.. nonce: 4fGrTl +.. section: Build + +Adds validation of ucrtbase[d].dll version with warning for old versions. + +.. + +.. bpo: 17603 +.. date: 8133 +.. nonce: 102DA- +.. section: Build + +Avoid error about nonexistant fileblocks.o file by using a lower-level check +for st_blocks in struct stat. + +.. + +.. bpo: 26079 +.. date: 8132 +.. nonce: mEzW0O +.. section: Build + +Fixing the build output folder for tix-8.4.3.6. Patch by Bjoern Thiel. + +.. + +.. bpo: 26465 +.. date: 8131 +.. nonce: _YR608 +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2g. + +.. + +.. bpo: 24421 +.. date: 8130 +.. nonce: 2zY7vM +.. section: Build + +Compile Modules/_math.c once, before building extensions. Previously it +could fail to compile properly if the math and cmath builds were concurrent. + +.. + +.. bpo: 25348 +.. date: 8129 +.. nonce: u6_BaQ +.. section: Build + +Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for +building with Profile-Guided Optimization. The old +``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls +``PCbuild\build.bat --pgo %*``. + +.. + +.. bpo: 25827 +.. date: 8128 +.. nonce: yg3DMM +.. section: Build + +Add support for building with ICC to ``configure``, including a new +``--with-icc`` flag. + +.. + +.. bpo: 25696 +.. date: 8127 +.. nonce: 2R_wIv +.. section: Build + +Fix installation of Python on UNIX with make -j9. + +.. + +.. bpo: 26930 +.. date: 8126 +.. nonce: Sqz2O3 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2h. + +.. + +.. bpo: 26268 +.. date: 8125 +.. nonce: I3-YLh +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2f. + +.. + +.. bpo: 25136 +.. date: 8124 +.. nonce: Vi-fmO +.. section: Build + +Support Apple Xcode 7's new textual SDK stub libraries. + +.. + +.. bpo: 24324 +.. date: 8123 +.. nonce: m6DZMx +.. section: Build + +Do not enable unreachable code warnings when using gcc as the option does +not work correctly in older versions of gcc and has been silently removed as +of gcc-4.5. + +.. + +.. bpo: 27053 +.. date: 8122 +.. nonce: 1IRbae +.. section: Windows + +Updates make_zip.py to correctly generate library ZIP file. + +.. + +.. bpo: 26268 +.. date: 8121 +.. nonce: Z-lJEh +.. section: Windows + +Update the prepare_ssl.py script to handle OpenSSL releases that don't +include the contents of the include directory (that is, 1.0.2e and later). + +.. + +.. bpo: 26071 +.. date: 8120 +.. nonce: wLxL2l +.. section: Windows + +bdist_wininst created binaries fail to start and find 32bit Python + +.. + +.. bpo: 26073 +.. date: 8119 +.. nonce: XwWgHp +.. section: Windows + +Update the list of magic numbers in launcher + +.. + +.. bpo: 26065 +.. date: 8118 +.. nonce: SkVLJp +.. section: Windows + +Excludes venv from library when generating embeddable distro. + +.. + +.. bpo: 26799 +.. date: 8117 +.. nonce: gK2VXX +.. section: Tools/Demos + +Fix python-gdb.py: don't get C types once when the Python code is loaded, +but get C types on demand. The C types can change if python-gdb.py is loaded +before the Python executable. Patch written by Thomas Ilsche. + +.. + +.. bpo: 26271 +.. date: 8116 +.. nonce: wg-rzr +.. section: Tools/Demos + +Fix the Freeze tool to properly use flags passed through configure. Patch by +Daniel Shaulov. + +.. + +.. bpo: 26489 +.. date: 8115 +.. nonce: rJ_U5S +.. section: Tools/Demos + +Add dictionary unpacking support to Tools/parser/unparse.py. Patch by Guo Ci +Teo. + +.. + +.. bpo: 26316 +.. date: 8114 +.. nonce: QJvVOi +.. section: Tools/Demos + +Fix variable name typo in Argument Clinic. + +.. + +.. bpo: 17500 +.. date: 8113 +.. nonce: QTZbRV +.. section: Windows + +Remove unused and outdated icons. (See also: +https://github.com/python/pythondotorg/issues/945) diff --git a/Misc/NEWS.d/3.5.3.rst b/Misc/NEWS.d/3.5.3.rst new file mode 100644 index 00000000000..da804dc92d4 --- /dev/null +++ b/Misc/NEWS.d/3.5.3.rst @@ -0,0 +1,7 @@ +.. bpo: 0 +.. date: 8559 +.. no changes: True +.. nonce: zYPqUK +.. release date: 2017-01-17 + +There were no code changes between 3.5.3rc1 and 3.5.3 final. diff --git a/Misc/NEWS.d/3.5.3rc1.rst b/Misc/NEWS.d/3.5.3rc1.rst new file mode 100644 index 00000000000..5c6859c8c1a --- /dev/null +++ b/Misc/NEWS.d/3.5.3rc1.rst @@ -0,0 +1,2164 @@ +.. bpo: 29073 +.. date: 8558 +.. nonce: EFpHQ7 +.. release date: 2017-01-02 +.. section: Core and Builtins + +bytearray formatting no longer truncates on first null byte. + +.. + +.. bpo: 28932 +.. date: 8557 +.. nonce: QnLx8A +.. section: Core and Builtins + +Do not include if it does not exist. + +.. + +.. bpo: 28147 +.. date: 8556 +.. nonce: EV4bm6 +.. section: Core and Builtins + +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. + +.. + +.. bpo: 25677 +.. date: 8555 +.. nonce: RWhZrb +.. section: Core and Builtins + +Correct the positioning of the syntax error caret for indented blocks. +Based on patch by Michael Layzell. + +.. + +.. bpo: 29000 +.. date: 8554 +.. nonce: K6wQ-3 +.. section: Core and Builtins + +Fixed bytes formatting of octals with zero padding in alternate form. + +.. + +.. bpo: 28512 +.. date: 8553 +.. nonce: i-pv6d +.. section: Core and Builtins + +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +.. + +.. bpo: 28991 +.. date: 8552 +.. nonce: -qOTxS +.. section: Core and Builtins + +functools.lru_cache() was susceptible to an obscure reentrancy bug caused by +a monkey-patched len() function. + +.. + +.. bpo: 28648 +.. date: 8551 +.. nonce: z7B52W +.. section: Core and Builtins + +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. + +.. + +.. bpo: 19398 +.. date: 8550 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 28426 +.. date: 8549 +.. nonce: E_quyK +.. section: Core and Builtins + +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. + +.. + +.. bpo: 23782 +.. date: 8548 +.. nonce: lonDzj +.. section: Core and Builtins + +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). + +.. + +.. bpo: 28379 +.. date: 8547 +.. nonce: DuXlco +.. section: Core and Builtins + +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. + +.. + +.. bpo: 28376 +.. date: 8546 +.. nonce: oPD-5D +.. section: Core and Builtins + +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. + +.. + +.. bpo: 28376 +.. date: 8545 +.. nonce: fLeHM2 +.. section: Core and Builtins + +The constructor of range_iterator now checks that step is not 0. Patch by +Oren Milman. + +.. + +.. bpo: 26906 +.. date: 8544 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 8543 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 8542 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28350 +.. date: 8541 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 26617 +.. date: 8540 +.. nonce: Gh5LvN +.. section: Core and Builtins + +Fix crash when GC runs during weakref callbacks. + +.. + +.. bpo: 27942 +.. date: 8539 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 21578 +.. date: 8538 +.. nonce: GI1bhj +.. section: Core and Builtins + +Fixed misleading error message when ImportError called with invalid keyword +args. + +.. + +.. bpo: 28203 +.. date: 8537 +.. nonce: kOgvtp +.. section: Core and Builtins + +Fix incorrect type in error message from ``complex(1.0, {2:3})``. Patch by +Soumya Sharma. + +.. + +.. bpo: 27955 +.. date: 8536 +.. nonce: HC4pZ4 +.. section: Core and Builtins + +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. + +.. + +.. bpo: 28131 +.. date: 8535 +.. nonce: owq0wW +.. section: Core and Builtins + +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. + +.. + +.. bpo: 25221 +.. date: 8534 +.. nonce: Zvkz9i +.. section: Core and Builtins + +Fix corrupted result from PyLong_FromLong(0) when Python is compiled with +NSMALLPOSINTS = 0. + +.. + +.. bpo: 25758 +.. date: 8533 +.. nonce: yR-YTD +.. section: Core and Builtins + +Prevents zipimport from unnecessarily encoding a filename (patch by Eryk +Sun) + +.. + +.. bpo: 28189 +.. date: 8532 +.. nonce: c_nbR_ +.. section: Core and Builtins + +dictitems_contains no longer swallows compare errors. (Patch by Xiang Zhang) + +.. + +.. bpo: 27812 +.. date: 8531 +.. nonce: sidcs8 +.. section: Core and Builtins + +Properly clear out a generator's frame's backreference to the generator to +prevent crashes in frame.clear(). + +.. + +.. bpo: 27811 +.. date: 8530 +.. nonce: T4AuBo +.. section: Core and Builtins + +Fix a crash when a coroutine that has not been awaited is finalized with +warnings-as-errors enabled. + +.. + +.. bpo: 27587 +.. date: 8529 +.. nonce: mbavY2 +.. section: Core and Builtins + +Fix another issue found by PVS-Studio: Null pointer check after use of 'def' +in _PyState_AddModule(). Initial patch by Christian Heimes. + +.. + +.. bpo: 26020 +.. date: 8528 +.. nonce: niLbLa +.. section: Core and Builtins + +set literal evaluation order did not match documented behaviour. + +.. + +.. bpo: 27782 +.. date: 8527 +.. nonce: C8OBQD +.. section: Core and Builtins + +Multi-phase extension module import now correctly allows the ``m_methods`` +field to be used to add module level functions to instances of non-module +types returned from ``Py_create_mod``. Patch by Xiang Zhang. + +.. + +.. bpo: 27936 +.. date: 8526 +.. nonce: AdOann +.. section: Core and Builtins + +The round() function accepted a second None argument for some types but not +for others. Fixed the inconsistency by accepting None for all numeric +types. + +.. + +.. bpo: 27487 +.. date: 8525 +.. nonce: jeTQNr +.. section: Core and Builtins + +Warn if a submodule argument to "python -m" or runpy.run_module() is found +in sys.modules after parent packages are imported, but before the submodule +is executed. + +.. + +.. bpo: 27558 +.. date: 8524 +.. nonce: VmltMh +.. section: Core and Builtins + +Fix a SystemError in the implementation of "raise" statement. In a brand new +thread, raise a RuntimeError since there is no active exception to reraise. +Patch written by Xiang Zhang. + +.. + +.. bpo: 27419 +.. date: 8523 +.. nonce: JZ94ju +.. section: Core and Builtins + +Standard __import__() no longer look up "__import__" in globals or builtins +for importing submodules or "from import". Fixed handling an error of non- +string package name. + +.. + +.. bpo: 27083 +.. date: 8522 +.. nonce: F4ZT1C +.. section: Core and Builtins + +Respect the PYTHONCASEOK environment variable under Windows. + +.. + +.. bpo: 27514 +.. date: 8521 +.. nonce: NLbwPG +.. section: Core and Builtins + +Make having too many statically nested blocks a SyntaxError instead of +SystemError. + +.. + +.. bpo: 27473 +.. date: 8520 +.. nonce: _nOtTA +.. section: Core and Builtins + +Fixed possible integer overflow in bytes and bytearray concatenations. +Patch by Xiang Zhang. + +.. + +.. bpo: 27507 +.. date: 8519 +.. nonce: 3pX0Be +.. section: Core and Builtins + +Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. + +.. + +.. bpo: 27581 +.. date: 8518 +.. nonce: KezjNt +.. section: Core and Builtins + +Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by +Xiang Zhang. + +.. + +.. bpo: 27443 +.. date: 8517 +.. nonce: 87ZwZ1 +.. section: Core and Builtins + +__length_hint__() of bytearray iterators no longer return a negative integer +for a resized bytearray. + +.. + +.. bpo: 27942 +.. date: 8516 +.. nonce: wCAkW5 +.. section: Core and Builtins + +Fix memory leak in codeobject.c + +.. + +.. bpo: 15812 +.. date: 8515 +.. nonce: R1U-Ec +.. section: Library + +inspect.getframeinfo() now correctly shows the first line of a context. +Patch by Sam Breese. + +.. + +.. bpo: 29094 +.. date: 8514 +.. nonce: 460ZQo +.. section: Library + +Offsets in a ZIP file created with extern file object and modes "w" and "x" +now are relative to the start of the file. + +.. + +.. bpo: 13051 +.. date: 8513 +.. nonce: YzC1Te +.. section: Library + +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. + +.. + +.. bpo: 29119 +.. date: 8512 +.. nonce: Ov69fr +.. section: Library + +Fix weakrefs in the pure python version of collections.OrderedDict +move_to_end() method. Contributed by Andra Bogildea. + +.. + +.. bpo: 9770 +.. date: 8511 +.. nonce: WJJnwP +.. section: Library + +curses.ascii predicates now work correctly with negative integers. + +.. + +.. bpo: 28427 +.. date: 8510 +.. nonce: vUd-va +.. section: Library + +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. + +.. + +.. bpo: 28923 +.. date: 8509 +.. nonce: naVULD +.. section: Library + +Remove editor artifacts from Tix.py. + +.. + +.. bpo: 28871 +.. date: 8508 +.. nonce: cPMXCJ +.. section: Library + +Fixed a crash when deallocate deep ElementTree. + +.. + +.. bpo: 19542 +.. date: 8507 +.. nonce: 5tCkaK +.. section: Library + +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. + +.. + +.. bpo: 20191 +.. date: 8506 +.. nonce: P_EZ7c +.. section: Library + +Fixed a crash in resource.prlimit() when pass a sequence that doesn't own +its elements as limits. + +.. + +.. bpo: 28779 +.. date: 8505 +.. nonce: t-mjED +.. section: Library + +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. + +.. + +.. bpo: 28847 +.. date: 8504 +.. nonce: J7d3nG +.. section: Library + +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. + +.. + +.. bpo: 25659 +.. date: 8503 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 28732 +.. date: 8502 +.. nonce: xkG8k7 +.. section: Library + +Fix crash in os.spawnv() with no elements in args + +.. + +.. bpo: 28485 +.. date: 8501 +.. nonce: WuKqKh +.. section: Library + +Always raise ValueError for negative compileall.compile_dir(workers=...) +parameter, even when multithreading is unavailable. + +.. + +.. bpo: 28387 +.. date: 8500 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 27517 +.. date: 8499 +.. nonce: 1CYM8A +.. section: Library + +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. + +.. + +.. bpo: 28549 +.. date: 8498 +.. nonce: ShnM2y +.. section: Library + +Fixed segfault in curses's addch() with ncurses6. + +.. + +.. bpo: 28449 +.. date: 8497 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 23262 +.. date: 8496 +.. nonce: 6EVB7N +.. section: Library + +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. + +.. + +.. bpo: 27939 +.. date: 8495 +.. nonce: mTfADV +.. section: Library + +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. + +.. + +.. bpo: 28255 +.. date: 8494 +.. nonce: _ZH4wm +.. section: Library + +calendar.TextCalendar().prmonth() no longer prints a space at the start of +new line after printing a month's calendar. Patch by Xiang Zhang. + +.. + +.. bpo: 20491 +.. date: 8493 +.. nonce: ObgnQ2 +.. section: Library + +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. + +.. + +.. bpo: 28353 +.. date: 8492 +.. nonce: sKGbLL +.. section: Library + +os.fwalk() no longer fails on broken links. + +.. + +.. bpo: 25464 +.. date: 8491 +.. nonce: HDUTCu +.. section: Library + +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. + +.. + +.. bpo: 28488 +.. date: 8490 +.. nonce: NlkjBM +.. section: Library + +shutil.make_archive() no longer add entry "./" to ZIP archive. + +.. + +.. bpo: 24452 +.. date: 8489 +.. nonce: m9Kyg3 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. + +.. + +.. bpo: 20766 +.. date: 8488 +.. nonce: 4kvCzx +.. section: Library + +Fix references leaked by pdb in the handling of SIGINT handlers. + +.. + +.. bpo: 26293 +.. date: 8487 +.. nonce: 2mjvwX +.. section: Library + +Fixed writing ZIP files that starts not from the start of the file. Offsets +in ZIP file now are relative to the start of the archive in conforming to +the specification. + +.. + +.. bpo: 28321 +.. date: 8486 +.. nonce: bQ-IIX +.. section: Library + +Fixed writing non-BMP characters with binary format in plistlib. + +.. + +.. bpo: 28322 +.. date: 8485 +.. nonce: l9hzap +.. section: Library + +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. + +.. + +.. bpo: 0 +.. date: 8484 +.. nonce: 81jNns +.. section: Library + +Fix possible integer overflows and crashes in the mmap module with unusual +usage patterns. + +.. + +.. bpo: 1703178 +.. date: 8483 +.. nonce: meb49K +.. section: Library + +Fix the ability to pass the --link-objects option to the distutils build_ext +command. + +.. + +.. bpo: 28253 +.. date: 8482 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 28275 +.. date: 8481 +.. nonce: EhWIsz +.. section: Library + +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. + +.. + +.. bpo: 27897 +.. date: 8480 +.. nonce: I0Ppmx +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. + +.. + +.. bpo: 18893 +.. date: 8479 +.. nonce: osiX5c +.. section: Library + +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. + +.. + +.. bpo: 27611 +.. date: 8478 +.. nonce: qL-UVQ +.. section: Library + +Fixed support of default root window in the tkinter.tix module. + +.. + +.. bpo: 27348 +.. date: 8477 +.. nonce: tDx7Vw +.. section: Library + +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. + +.. + +.. bpo: 25651 +.. date: 8476 +.. nonce: 3UhyPo +.. section: Library + +Allow falsy values to be used for msg parameter of subTest(). + +.. + +.. bpo: 27932 +.. date: 8475 +.. nonce: mtgl-6 +.. section: Library + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 0 +.. date: 8474 +.. nonce: iPpjqX +.. section: Library + +Fix UnboundLocalError in socket._sendfile_use_sendfile. + +.. + +.. bpo: 28075 +.. date: 8473 +.. nonce: aLiUs9 +.. section: Library + +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. + +.. + +.. bpo: 25270 +.. date: 8472 +.. nonce: jrZruM +.. section: Library + +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. + +.. + +.. bpo: 28181 +.. date: 8471 +.. nonce: NGc4Yv +.. section: Library + +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +.. + +.. bpo: 25895 +.. date: 8470 +.. nonce: j92qoQ +.. section: Library + +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. + +.. + +.. bpo: 27599 +.. date: 8469 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 19003 +.. date: 8468 +.. nonce: UUcK_F +.. section: Library + +m email.generator now replaces only ``\r`` and/or ``\n`` line endings, per +the RFC, instead of all unicode line endings. + +.. + +.. bpo: 28019 +.. date: 8467 +.. nonce: KUhBaS +.. section: Library + +itertools.count() no longer rounds non-integer step in range between 1.0 and +2.0 to 1. + +.. + +.. bpo: 25969 +.. date: 8466 +.. nonce: qSPkl- +.. section: Library + +Update the lib2to3 grammar to handle the unpacking generalizations added in +3.5. + +.. + +.. bpo: 14977 +.. date: 8465 +.. nonce: 4MvALg +.. section: Library + +mailcap now respects the order of the lines in the mailcap files ("first +match"), as required by RFC 1542. Patch by Michael Lazar. + +.. + +.. bpo: 24594 +.. date: 8464 +.. nonce: 9CnFVS +.. section: Library + +Validates persist parameter when opening MSI database + +.. + +.. bpo: 17582 +.. date: 8463 +.. nonce: MXEHxQ +.. section: Library + +xml.etree.ElementTree nows preserves whitespaces in attributes (Patch by +Duane Griffin. Reviewed and approved by Stefan Behnel.) + +.. + +.. bpo: 28047 +.. date: 8462 +.. nonce: pDu3Fm +.. section: Library + +Fixed calculation of line length used for the base64 CTE in the new email +policies. + +.. + +.. bpo: 27445 +.. date: 8461 +.. nonce: wOG0C0 +.. section: Library + +Don't pass str(_charset) to MIMEText.set_payload(). Patch by Claude Paroz. + +.. + +.. bpo: 22450 +.. date: 8460 +.. nonce: T3Sn_J +.. section: Library + +urllib now includes an ``Accept: */*`` header among the default headers. +This makes the results of REST API requests more consistent and predictable +especially when proxy servers are involved. + +.. + +.. bpo: 0 +.. date: 8459 +.. nonce: PVZStR +.. section: Library + +lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between +runs given the same Grammar.txt input regardless of the hash randomization +setting. + +.. + +.. bpo: 27570 +.. date: 8458 +.. nonce: pU0Zie +.. section: Library + +Avoid zero-length memcpy() etc calls with null source pointers in the +"ctypes" and "array" modules. + +.. + +.. bpo: 22233 +.. date: 8457 +.. nonce: uXSN0R +.. section: Library + +Break email header lines *only* on the RFC specified CR and LF characters, +not on arbitrary unicode line breaks. This also fixes a bug in HTTP header +parsing. + +.. + +.. bpo: 27988 +.. date: 8456 +.. nonce: VfMzZH +.. section: Library + +Fix email iter_attachments incorrect mutation of payload list. + +.. + +.. bpo: 27691 +.. date: 8455 +.. nonce: TMYF5_ +.. section: Library + +Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 +certs. + +.. + +.. bpo: 27850 +.. date: 8454 +.. nonce: kIVQ0m +.. section: Library + +Remove 3DES from ssl module's default cipher list to counter measure sweet32 +attack (CVE-2016-2183). + +.. + +.. bpo: 27766 +.. date: 8453 +.. nonce: WI70Tc +.. section: Library + +Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL +1.1.0 or LibreSSL). + +.. + +.. bpo: 26470 +.. date: 8452 +.. nonce: QGu_wo +.. section: Library + +Port ssl and hashlib module to OpenSSL 1.1.0. + +.. + +.. bpo: 0 +.. date: 8451 +.. nonce: 6TjEgz +.. section: Library + +Remove support for passing a file descriptor to os.access. It never worked +but previously didn't raise. + +.. + +.. bpo: 12885 +.. date: 8450 +.. nonce: r-IV1g +.. section: Library + +Fix error when distutils encounters symlink. + +.. + +.. bpo: 27881 +.. date: 8449 +.. nonce: fkETd9 +.. section: Library + +Fixed possible bugs when setting sqlite3.Connection.isolation_level. Based +on patch by Xiang Zhang. + +.. + +.. bpo: 27861 +.. date: 8448 +.. nonce: DBYuo9 +.. section: Library + +Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a +cursor. Patch by Xiang Zhang. + +.. + +.. bpo: 19884 +.. date: 8447 +.. nonce: MO8AWH +.. section: Library + +Avoid spurious output on OS X with Gnu Readline. + +.. + +.. bpo: 27706 +.. date: 8446 +.. nonce: ZY67yu +.. section: Library + +Restore deterministic behavior of random.Random().seed() for string seeds +using seeding version 1. Allows sequences of calls to random() to exactly +match those obtained in Python 2. Patch by Nofar Schnider. + +.. + +.. bpo: 10513 +.. date: 8445 +.. nonce: tQIQD_ +.. section: Library + +Fix a regression in Connection.commit(). Statements should not be reset +after a commit. + +.. + +.. bpo: 0 +.. date: 8444 +.. nonce: cYraeH +.. section: Library + +A new version of typing.py from https://github.com/python/typing: - +Collection (only for 3.6) (Issue #27598) - Add FrozenSet to __all__ +(upstream #261) - fix crash in _get_type_vars() (upstream #259) - Remove the +dict constraint in ForwardRef._eval_type (upstream #252) + +.. + +.. bpo: 27539 +.. date: 8443 +.. nonce: S4L1cq +.. section: Library + +Fix unnormalised ``Fraction.__pow__`` result in the case of negative +exponent and negative base. + +.. + +.. bpo: 21718 +.. date: 8442 +.. nonce: FUJd-7 +.. section: Library + +cursor.description is now available for queries using CTEs. + +.. + +.. bpo: 2466 +.. date: 8441 +.. nonce: VRNlkg +.. section: Library + +posixpath.ismount now correctly recognizes mount points which the user does +not have permission to access. + +.. + +.. bpo: 27773 +.. date: 8440 +.. nonce: hMSSeX +.. section: Library + +Correct some memory management errors server_hostname in _ssl.wrap_socket(). + +.. + +.. bpo: 26750 +.. date: 8439 +.. nonce: rv76vt +.. section: Library + +unittest.mock.create_autospec() now works properly for subclasses of +property() and other data descriptors. + +.. + +.. bpo: 0 +.. date: 8438 +.. nonce: Ny9oPv +.. section: Library + +In the curses module, raise an error if window.getstr() or window.instr() is +passed a negative value. + +.. + +.. bpo: 27783 +.. date: 8437 +.. nonce: cR1jXH +.. section: Library + +Fix possible usage of uninitialized memory in operator.methodcaller. + +.. + +.. bpo: 27774 +.. date: 8436 +.. nonce: FDcik1 +.. section: Library + +Fix possible Py_DECREF on unowned object in _sre. + +.. + +.. bpo: 27760 +.. date: 8435 +.. nonce: gxMjp4 +.. section: Library + +Fix possible integer overflow in binascii.b2a_qp. + +.. + +.. bpo: 27758 +.. date: 8434 +.. nonce: 0NRV03 +.. section: Library + +Fix possible integer overflow in the _csv module for large record lengths. + +.. + +.. bpo: 27568 +.. date: 8433 +.. nonce: OnuO9s +.. section: Library + +Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the HTTP_PROXY variable +when REQUEST_METHOD environment is set, which indicates that the script is +in CGI mode. + +.. + +.. bpo: 27656 +.. date: 8432 +.. nonce: joTscM +.. section: Library + +Do not assume sched.h defines any SCHED_* constants. + +.. + +.. bpo: 27130 +.. date: 8431 +.. nonce: SUxwXZ +.. section: Library + +In the "zlib" module, fix handling of large buffers (typically 4 GiB) when +compressing and decompressing. Previously, inputs were limited to 4 GiB, +and compression and decompression operations did not properly handle results +of 4 GiB. + +.. + +.. bpo: 27533 +.. date: 8430 +.. nonce: iDmKzV +.. section: Library + +Release GIL in nt._isdir + +.. + +.. bpo: 17711 +.. date: 8429 +.. nonce: 47AILJ +.. section: Library + +Fixed unpickling by the persistent ID with protocol 0. Original patch by +Alexandre Vassalotti. + +.. + +.. bpo: 27522 +.. date: 8428 +.. nonce: 8vVz_t +.. section: Library + +Avoid an unintentional reference cycle in email.feedparser. + +.. + +.. bpo: 26844 +.. date: 8427 +.. nonce: I0wdnY +.. section: Library + +Fix error message for imp.find_module() to refer to 'path' instead of +'name'. Patch by Lev Maximov. + +.. + +.. bpo: 23804 +.. date: 8426 +.. nonce: ipFvxc +.. section: Library + +Fix SSL zero-length recv() calls to not block and not raise an error about +unclean EOF. + +.. + +.. bpo: 27466 +.. date: 8425 +.. nonce: C_3a8E +.. section: Library + +Change time format returned by http.cookie.time2netscape, confirming the +netscape cookie format and making it consistent with documentation. + +.. + +.. bpo: 26664 +.. date: 8424 +.. nonce: OzsSzf +.. section: Library + +Fix activate.fish by removing mis-use of ``$``. + +.. + +.. bpo: 22115 +.. date: 8423 +.. nonce: apoFQ9 +.. section: Library + +Fixed tracing Tkinter variables: trace_vdelete() with wrong mode no longer +break tracing, trace_vinfo() now always returns a list of pairs of strings, +tracing in the "u" mode now works. + +.. + +.. bpo: 0 +.. date: 8422 +.. nonce: oZOeFE +.. section: Library + +Fix a scoping issue in importlib.util.LazyLoader which triggered an +UnboundLocalError when lazy-loading a module that was already put into +sys.modules. + +.. + +.. bpo: 27079 +.. date: 8421 +.. nonce: c7d0Ym +.. section: Library + +Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +.. + +.. bpo: 26754 +.. date: 8420 +.. nonce: J3n0QW +.. section: Library + +Some functions (compile() etc) accepted a filename argument encoded as an +iterable of integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 27048 +.. date: 8419 +.. nonce: EVe-Bk +.. section: Library + +Prevents distutils failing on Windows when environment variables contain +non-ASCII characters + +.. + +.. bpo: 27330 +.. date: 8418 +.. nonce: GJaFCV +.. section: Library + +Fixed possible leaks in the ctypes module. + +.. + +.. bpo: 27238 +.. date: 8417 +.. nonce: Q6v6Qv +.. section: Library + +Got rid of bare excepts in the turtle module. Original patch by Jelle +Zijlstra. + +.. + +.. bpo: 27122 +.. date: 8416 +.. nonce: 06t7zN +.. section: Library + +When an exception is raised within the context being managed by a +contextlib.ExitStack() and one of the exit stack generators catches and +raises it in a chain, do not re-raise the original exception when exiting, +let the new chained one through. This avoids the PEP 479 bug described in +issue25782. + +.. + +.. bpo: 27278 +.. date: 8415 +.. nonce: y_HkGw +.. original section: Library +.. section: Security + +Fix os.urandom() implementation using getrandom() on Linux. Truncate size +to INT_MAX and loop until we collected enough random bytes, instead of +casting a directly Py_ssize_t to int. + +.. + +.. bpo: 26386 +.. date: 8414 +.. nonce: 9L3Ut4 +.. section: Library + +Fixed ttk.TreeView selection operations with item id's containing spaces. + +.. + +.. bpo: 22636 +.. date: 8413 +.. nonce: 3fQW_g +.. original section: Library +.. section: Security + +Avoid shell injection problems with ctypes.util.find_library(). + +.. + +.. bpo: 16182 +.. date: 8412 +.. nonce: RgFXyr +.. section: Library + +Fix various functions in the "readline" module to use the locale encoding, +and fix get_begidx() and get_endidx() to return code point indexes. + +.. + +.. bpo: 27392 +.. date: 8411 +.. nonce: obfni7 +.. section: Library + +Add loop.connect_accepted_socket(). Patch by Jim Fulton. + +.. + +.. bpo: 27930 +.. date: 8410 +.. nonce: BkOfSi +.. section: Library + +Improved behaviour of logging.handlers.QueueListener. Thanks to Paulo +Andrade and Petr Viktorin for the analysis and patch. + +.. + +.. bpo: 21201 +.. date: 8409 +.. nonce: wLCKiA +.. section: Library + +Improves readability of multiprocessing error message. Thanks to Wojciech +Walczak for patch. + +.. + +.. bpo: 27456 +.. date: 8408 +.. nonce: lI_IE7 +.. section: Library + +asyncio: Set TCP_NODELAY by default. + +.. + +.. bpo: 27906 +.. date: 8407 +.. nonce: TBBXrv +.. section: Library + +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. + +.. + +.. bpo: 28174 +.. date: 8406 +.. nonce: CV1UdI +.. section: Library + +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. + +.. + +.. bpo: 26654 +.. date: 8405 +.. nonce: XtzTE9 +.. section: Library + +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. + +.. + +.. bpo: 26909 +.. date: 8404 +.. nonce: ASiakT +.. section: Library + +Fix slow pipes IO in asyncio. Patch by INADA Naoki. + +.. + +.. bpo: 28176 +.. date: 8403 +.. nonce: sU8R6L +.. section: Library + +Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +.. + +.. bpo: 27759 +.. date: 8402 +.. nonce: qpMDGq +.. section: Library + +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. + +.. + +.. bpo: 28368 +.. date: 8401 +.. nonce: n594X4 +.. section: Library + +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. + +.. + +.. bpo: 28369 +.. date: 8400 +.. nonce: 8DTANe +.. section: Library + +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. + +.. + +.. bpo: 28370 +.. date: 8399 +.. nonce: 18jBuZ +.. section: Library + +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. + +.. + +.. bpo: 28371 +.. date: 8398 +.. nonce: U9Zqdk +.. section: Library + +Deprecate passing asyncio.Handles to run_in_executor. + +.. + +.. bpo: 28372 +.. date: 8397 +.. nonce: njcIPk +.. section: Library + +Fix asyncio to support formatting of non-python coroutines. + +.. + +.. bpo: 28399 +.. date: 8396 +.. nonce: QKIqRX +.. section: Library + +Remove UNIX socket from FS before binding. Patch by ????????? ????. + +.. + +.. bpo: 27972 +.. date: 8395 +.. nonce: ZK-GFm +.. section: Library + +Prohibit Tasks to await on themselves. + +.. + +.. bpo: 26923 +.. date: 8394 +.. nonce: 8dh3AV +.. section: Library + +Fix asyncio.Gather to refuse being cancelled once all children are done. +Patch by Johannes Ebke. + +.. + +.. bpo: 26796 +.. date: 8393 +.. nonce: TZyAfJ +.. section: Library + +Don't configure the number of workers for default threadpool executor. +Initial patch by Hans Lawrenz. + +.. + +.. bpo: 28600 +.. date: 8392 +.. nonce: 2ThUQV +.. section: Library + +Optimize loop.call_soon(). + +.. + +.. bpo: 28613 +.. date: 8391 +.. nonce: sqUPrv +.. section: Library + +Fix get_event_loop() return the current loop if called from +coroutines/callbacks. + +.. + +.. bpo: 28639 +.. date: 8390 +.. nonce: WUPo1o +.. section: Library + +Fix inspect.isawaitable to always return bool Patch by Justin Mayfield. + +.. + +.. bpo: 28652 +.. date: 8389 +.. nonce: f5M8FG +.. section: Library + +Make loop methods reject socket kinds they do not support. + +.. + +.. bpo: 28653 +.. date: 8388 +.. nonce: S5bA9i +.. section: Library + +Fix a refleak in functools.lru_cache. + +.. + +.. bpo: 28703 +.. date: 8387 +.. nonce: CRLTJc +.. section: Library + +Fix asyncio.iscoroutinefunction to handle Mock objects. + +.. + +.. bpo: 24142 +.. date: 8386 +.. nonce: _BgogI +.. section: Library + +Reading a corrupt config file left the parser in an invalid state. Original +patch by Florian H?ch. + +.. + +.. bpo: 28990 +.. date: 8385 +.. nonce: W8tuYZ +.. section: Library + +Fix SSL hanging if connection is closed before handshake completed. (Patch +by HoHo-Ho) + +.. + +.. bpo: 15308 +.. date: 8384 +.. nonce: zZxn8m +.. section: IDLE + +Add 'interrupt execution' (^C) to Shell menu. Patch by Roger Serwy, updated +by Bayard Randel. + +.. + +.. bpo: 27922 +.. date: 8383 +.. nonce: UEtEv9 +.. section: IDLE + +Stop IDLE tests from 'flashing' gui widgets on the screen. + +.. + +.. bpo: 0 +.. date: 8382 +.. nonce: zWZs6o +.. section: IDLE + +Add version to title of IDLE help window. + +.. + +.. bpo: 25564 +.. date: 8381 +.. nonce: GN0p14 +.. section: IDLE + +In section on IDLE -- console differences, mention that using exec means +that __builtins__ is defined for each statement. + +.. + +.. bpo: 27714 +.. date: 8380 +.. nonce: bUEDsI +.. section: IDLE + +text_textview and test_autocomplete now pass when re-run in the same +process. This occurs when test_idle fails when run with the -w option but +without -jn. Fix warning from test_config. + +.. + +.. bpo: 25507 +.. date: 8379 +.. nonce: lxf68d +.. section: IDLE + +IDLE no longer runs buggy code because of its tkinter imports. Users must +include the same imports required to run directly in Python. + +.. + +.. bpo: 27452 +.. date: 8378 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 27365 +.. date: 8377 +.. nonce: y7ys_A +.. section: IDLE + +Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +.. + +.. bpo: 27245 +.. date: 8376 +.. nonce: u9aKO1 +.. section: IDLE + +IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE +was started from a console or by import, a cascade of warnings was emitted. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 28808 +.. date: 8375 +.. nonce: A03X6r +.. section: C API + +PyUnicode_CompareWithASCIIString() now never raises exceptions. + +.. + +.. bpo: 26754 +.. date: 8374 +.. nonce: j2czHF +.. section: C API + +PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of +integers. Now only strings and bytes-like objects are accepted. + +.. + +.. bpo: 28513 +.. date: 8373 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 28950 +.. date: 8372 +.. nonce: 9_vY6R +.. section: Tests + +Disallow -j0 to be combined with -T/-l/-M in regrtest command line +arguments. + +.. + +.. bpo: 28666 +.. date: 8371 +.. nonce: RtTk-4 +.. section: Tests + +Now test.support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 8370 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 28409 +.. date: 8369 +.. nonce: Q2IlxJ +.. section: Tests + +regrtest: fix the parser of command line arguments. + +.. + +.. bpo: 27787 +.. date: 8368 +.. nonce: kf0YAt +.. section: Tests + +Call gc.collect() before checking each test for "dangling threads", since +the dangling threads are weak references. + +.. + +.. bpo: 27369 +.. date: 8367 +.. nonce: LG7U2D +.. section: Tests + +In test_pyexpat, avoid testing an error message detail that changed in Expat +2.2.0. + +.. + +.. bpo: 27952 +.. date: 8366 +.. nonce: WX9Ufc +.. section: Tools/Demos + +Get Tools/scripts/fixcid.py working with Python 3 and the current "re" +module, avoid invalid Python backslash escapes, and fix a bug parsing +escaped C quote signs. + +.. + +.. bpo: 27332 +.. date: 8365 +.. nonce: OuRZp9 +.. section: Tools/Demos + +Fixed the type of the first argument of module-level functions generated by +Argument Clinic. Patch by Petr Viktorin. + +.. + +.. bpo: 27418 +.. date: 8364 +.. nonce: W2m_8I +.. section: Tools/Demos + +Fixed Tools/importbench/importbench.py. + +.. + +.. bpo: 28251 +.. date: 8363 +.. nonce: tR_AFs +.. section: Windows + +Improvements to help manuals on Windows. + +.. + +.. bpo: 28110 +.. date: 8362 +.. nonce: cnkP5F +.. section: Windows + +launcher.msi has different product codes between 32-bit and 64-bit + +.. + +.. bpo: 25144 +.. date: 8361 +.. nonce: iUha52 +.. section: Windows + +Ensures TargetDir is set before continuing with custom install. + +.. + +.. bpo: 27469 +.. date: 8360 +.. nonce: 0GwDkX +.. section: Windows + +Adds a shell extension to the launcher so that drag and drop works +correctly. + +.. + +.. bpo: 27309 +.. date: 8359 +.. nonce: 4DPjhF +.. section: Windows + +Enabled proper Windows styles in python[w].exe manifest. + +.. + +.. bpo: 29080 +.. date: 8358 +.. nonce: b3qLQT +.. section: Build + +Removes hard dependency on hg.exe from PCBuild/build.bat + +.. + +.. bpo: 23903 +.. date: 8357 +.. nonce: JXJ889 +.. section: Build + +Added missed names to PC/python3.def. + +.. + +.. bpo: 10656 +.. date: 8356 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 8355 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28444 +.. date: 8354 +.. nonce: zkc9nT +.. section: Build + +Fix missing extensions modules when cross compiling. + +.. + +.. bpo: 28248 +.. date: 8353 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 28258 +.. date: 8352 +.. nonce: iKtAHd +.. section: Build + +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 8351 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 28066 +.. date: 8350 +.. nonce: _3xImV +.. section: Build + +Fix the logic that searches build directories for generated include files +when building outside the source tree. + +.. + +.. bpo: 15819 +.. date: 8349 +.. nonce: QVDr3E +.. section: Build + +Remove redundant include search directory option for building outside the +source tree. + +.. + +.. bpo: 27566 +.. date: 8348 +.. nonce: xDWjEb +.. section: Build + +Fix clean target in freeze makefile (patch by Lisa Roach) + +.. + +.. bpo: 27705 +.. date: 8347 +.. nonce: 8C2Ms3 +.. section: Build + +Update message in validate_ucrtbase.py + +.. + +.. bpo: 27983 +.. date: 8346 +.. nonce: jL_1n8 +.. section: Build + +Cause lack of llvm-profdata tool when using clang as required for PGO +linking to be a configure time error rather than make time when --with- +optimizations is enabled. Also improve our ability to find the llvm- +profdata tool on MacOS and some Linuxes. + +.. + +.. bpo: 26307 +.. date: 8345 +.. nonce: Puk2rd +.. section: Build + +The profile-opt build now applies PGO to the built-in modules. + +.. + +.. bpo: 26359 +.. date: 8344 +.. nonce: WXBL-Y +.. section: Build + +Add the --with-optimizations configure flag. + +.. + +.. bpo: 27713 +.. date: 8343 +.. nonce: _3DgXG +.. section: Build + +Suppress spurious build warnings when updating importlib's bootstrap files. +Patch by Xiang Zhang + +.. + +.. bpo: 25825 +.. date: 8342 +.. nonce: JD8aRp +.. section: Build + +Correct the references to Modules/python.exp and ld_so_aix, which are +required on AIX. This updates references to an installation path that was +changed in 3.2a4, and undoes changed references to the build tree that were +made in 3.5.0a1. + +.. + +.. bpo: 27453 +.. date: 8341 +.. nonce: Pb5DBi +.. section: Build + +CPP invocation in configure must use CPPFLAGS. Patch by Chi Hsuan Yen. + +.. + +.. bpo: 27641 +.. date: 8340 +.. nonce: eGzgCk +.. section: Build + +The configure script now inserts comments into the makefile to prevent the +pgen and _freeze_importlib executables from being cross- compiled. + +.. + +.. bpo: 26662 +.. date: 8339 +.. nonce: XkwRxM +.. section: Build + +Set PYTHON_FOR_GEN in configure as the Python program to be used for file +generation during the build. + +.. + +.. bpo: 10910 +.. date: 8338 +.. nonce: ZdRayb +.. section: Build + +Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD +version checks for the original ctype UTF-8 workaround. + +.. + +.. bpo: 28676 +.. date: 8337 +.. nonce: Wxf6Ds +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. diff --git a/Misc/NEWS.d/3.6.0.rst b/Misc/NEWS.d/3.6.0.rst new file mode 100644 index 00000000000..25b2b70fbea --- /dev/null +++ b/Misc/NEWS.d/3.6.0.rst @@ -0,0 +1,7 @@ +.. bpo: 0 +.. date: 9497 +.. no changes: True +.. nonce: F9ENBV +.. release date: 2016-12-23 + +No changes since release candidate 2 diff --git a/Misc/NEWS.d/3.6.0a1.rst b/Misc/NEWS.d/3.6.0a1.rst new file mode 100644 index 00000000000..81e949202eb --- /dev/null +++ b/Misc/NEWS.d/3.6.0a1.rst @@ -0,0 +1,3941 @@ +.. bpo: 20041 +.. date: 8953 +.. nonce: TypyGp +.. release date: 2016-05-16 +.. section: Core and Builtins + +Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. + +.. + +.. bpo: 26168 +.. date: 8952 +.. nonce: -nPBL6 +.. section: Core and Builtins + +Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. + +.. + +.. bpo: 26991 +.. date: 8951 +.. nonce: yWGNhz +.. section: Core and Builtins + +Fix possible refleak when creating a function with annotations. + +.. + +.. bpo: 27039 +.. date: 8950 +.. nonce: oO-wLV +.. section: Core and Builtins + +Fixed bytearray.remove() for values greater than 127. Based on patch by Joe +Jevnik. + +.. + +.. bpo: 23640 +.. date: 8949 +.. nonce: kvNC4c +.. section: Core and Builtins + +int.from_bytes() no longer bypasses constructors for subclasses. + +.. + +.. bpo: 27005 +.. date: 8948 +.. nonce: ZtcJf- +.. section: Core and Builtins + +Optimized the float.fromhex() class method for exact float. It is now 2 +times faster. + +.. + +.. bpo: 18531 +.. date: 8947 +.. nonce: PkXgtO +.. section: Core and Builtins + +Single var-keyword argument of dict subtype was passed unscathed to the +C-defined function. Now it is converted to exact dict. + +.. + +.. bpo: 26811 +.. date: 8946 +.. nonce: oNzUWt +.. section: Core and Builtins + +gc.get_objects() no longer contains a broken tuple with NULL pointer. + +.. + +.. bpo: 20120 +.. date: 8945 +.. nonce: c-FZZc +.. section: Core and Builtins + +Use RawConfigParser for .pypirc parsing, removing support for interpolation +unintentionally added with move to Python 3. Behavior no longer does any +interpolation in .pypirc files, matching behavior in Python 2.7 and +Setuptools 19.0. + +.. + +.. bpo: 26249 +.. date: 8944 +.. nonce: ZbpWF3 +.. section: Core and Builtins + +Memory functions of the :c:func:`PyMem_Malloc` domain +(:c:data:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc allocator +` rather than system :c:func:`malloc`. Applications calling +:c:func:`PyMem_Malloc` without holding the GIL can now crash: use +``PYTHONMALLOC=debug`` environment variable to validate the usage of memory +allocators in your application. + +.. + +.. bpo: 26802 +.. date: 8943 +.. nonce: hWpU4v +.. section: Core and Builtins + +Optimize function calls only using unpacking like ``func(*tuple)`` (no other +positional argument, no keyword): avoid copying the tuple. Patch written by +Joe Jevnik. + +.. + +.. bpo: 26659 +.. date: 8942 +.. nonce: 5PRa83 +.. section: Core and Builtins + +Make the builtin slice type support cycle collection. + +.. + +.. bpo: 26718 +.. date: 8941 +.. nonce: K5PQ8j +.. section: Core and Builtins + +super.__init__ no longer leaks memory if called multiple times. NOTE: A +direct call of super.__init__ is not endorsed! + +.. + +.. bpo: 27138 +.. date: 8940 +.. nonce: ifYEro +.. section: Core and Builtins + +Fix the doc comment for FileFinder.find_spec(). + +.. + +.. bpo: 27147 +.. date: 8939 +.. nonce: tCCgmH +.. section: Core and Builtins + +Mention PEP 420 in the importlib docs. + +.. + +.. bpo: 25339 +.. date: 8938 +.. nonce: ZcaC2E +.. section: Core and Builtins + +PYTHONIOENCODING now has priority over locale in setting the error handler +for stdin and stdout. + +.. + +.. bpo: 26494 +.. date: 8937 +.. nonce: G6eXIi +.. section: Core and Builtins + +Fixed crash on iterating exhausting iterators. Affected classes are generic +sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, +frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator. + +.. + +.. bpo: 26574 +.. date: 8936 +.. nonce: D2YL_w +.. section: Core and Builtins + +Optimize ``bytes.replace(b'', b'.')`` and ``bytearray.replace(b'', b'.')``. +Patch written by Josh Snider. + +.. + +.. bpo: 26581 +.. date: 8935 +.. nonce: yNA7nm +.. section: Core and Builtins + +If coding cookie is specified multiple times on a line in Python source code +file, only the first one is taken to account. + +.. + +.. bpo: 19711 +.. date: 8934 +.. nonce: gDDPJE +.. section: Core and Builtins + +Add tests for reloading namespace packages. + +.. + +.. bpo: 21099 +.. date: 8933 +.. nonce: CuMWZJ +.. section: Core and Builtins + +Switch applicable importlib tests to use PEP 451 API. + +.. + +.. bpo: 26563 +.. date: 8932 +.. nonce: lyrB2Q +.. section: Core and Builtins + +Debug hooks on Python memory allocators now raise a fatal error if functions +of the :c:func:`PyMem_Malloc` family are called without holding the GIL. + +.. + +.. bpo: 26564 +.. date: 8931 +.. nonce: xeRXaz +.. section: Core and Builtins + +On error, the debug hooks on Python memory allocators now use the +:mod:`tracemalloc` module to get the traceback where a memory block was +allocated. + +.. + +.. bpo: 26558 +.. date: 8930 +.. nonce: s05jz7 +.. section: Core and Builtins + +The debug hooks on Python memory allocator :c:func:`PyObject_Malloc` now +detect when functions are called without holding the GIL. + +.. + +.. bpo: 26516 +.. date: 8929 +.. nonce: OjekqZ +.. section: Core and Builtins + +Add :envvar:`PYTHONMALLOC` environment variable to set the Python memory +allocators and/or install debug hooks. + +.. + +.. bpo: 26516 +.. date: 8928 +.. nonce: chNJuF +.. section: Core and Builtins + +The :c:func:`PyMem_SetupDebugHooks` function can now also be used on Python +compiled in release mode. + +.. + +.. bpo: 26516 +.. date: 8927 +.. nonce: q7fu1f +.. section: Core and Builtins + +The :envvar:`PYTHONMALLOCSTATS` environment variable can now also be used on +Python compiled in release mode. It now has no effect if set to an empty +string. + +.. + +.. bpo: 26516 +.. date: 8926 +.. nonce: 2k9k6R +.. section: Core and Builtins + +In debug mode, debug hooks are now also installed on Python memory +allocators when Python is configured without pymalloc. + +.. + +.. bpo: 26464 +.. date: 8925 +.. nonce: 7BreGz +.. section: Core and Builtins + +Fix str.translate() when string is ASCII and first replacements removes +character, but next replacement uses a non-ASCII character or a string +longer than 1 character. Regression introduced in Python 3.5.0. + +.. + +.. bpo: 22836 +.. date: 8924 +.. nonce: cimt1y +.. section: Core and Builtins + +Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() +are sensible even when formatting them produces secondary errors. This +affects the reports produced by sys.__excepthook__() and when __del__() +raises an exception. + +.. + +.. bpo: 26302 +.. date: 8923 +.. nonce: UD9XQt +.. section: Core and Builtins + +Correct behavior to reject comma as a legal character for cookie names. + +.. + +.. bpo: 26136 +.. date: 8922 +.. nonce: eZ0t1K +.. section: Core and Builtins + +Upgrade the warning when a generator raises StopIteration from +PendingDeprecationWarning to DeprecationWarning. Patch by Anish Shah. + +.. + +.. bpo: 26204 +.. date: 8921 +.. nonce: x3Zp8E +.. section: Core and Builtins + +The compiler now ignores all constant statements: bytes, str, int, float, +complex, name constants (None, False, True), Ellipsis and ast.Constant; not +only str and int. For example, ``1.0`` is now ignored in ``def f(): 1.0``. + +.. + +.. bpo: 4806 +.. date: 8920 +.. nonce: i9m3hj +.. section: Core and Builtins + +Avoid masking the original TypeError exception when using star (``*``) +unpacking in function calls. Based on patch by Hagen F?rstenau and Daniel +Urban. + +.. + +.. bpo: 26146 +.. date: 8919 +.. nonce: HKrUth +.. section: Core and Builtins + +Add a new kind of AST node: ``ast.Constant``. It can be used by external AST +optimizers, but the compiler does not emit directly such node. + +.. + +.. bpo: 23601 +.. date: 8918 +.. nonce: 2E4seG +.. section: Core and Builtins + +Sped-up allocation of dict key objects by using Python's small object +allocator. (Contributed by Julian Taylor.) + +.. + +.. bpo: 18018 +.. date: 8917 +.. nonce: XKKap3 +.. section: Core and Builtins + +Import raises ImportError instead of SystemError if a relative import is +attempted without a known parent package. + +.. + +.. bpo: 25843 +.. date: 8916 +.. nonce: NtJZie +.. section: Core and Builtins + +When compiling code, don't merge constants if they are equal but have a +different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now +correctly compiled to two different functions: ``f1()`` returns ``1`` +(``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and +``1.0`` are equal. + +.. + +.. bpo: 26107 +.. date: 8915 +.. nonce: q0LBMY +.. section: Core and Builtins + +The format of the ``co_lnotab`` attribute of code objects changes to support +negative line number delta. + +.. + +.. bpo: 26154 +.. date: 8914 +.. nonce: MtnRAH +.. section: Core and Builtins + +Add a new private _PyThreadState_UncheckedGet() function to get the current +Python thread state, but don't issue a fatal error if it is NULL. This new +function must be used instead of accessing directly the +_PyThreadState_Current variable. The variable is no more exposed since +Python 3.5.1 to hide the exact implementation of atomic C types, to avoid +compiler issues. + +.. + +.. bpo: 25791 +.. date: 8913 +.. nonce: gllzPw +.. section: Core and Builtins + +If __package__ != __spec__.parent or if neither __package__ or __spec__ are +defined then ImportWarning is raised. + +.. + +.. bpo: 22995 +.. date: 8912 +.. nonce: KYNKvs +.. section: Core and Builtins + +[UPDATE] Comment out the one of the pickleability tests in +_PyObject_GetState() due to regressions observed in Cython-based projects. + +.. + +.. bpo: 25961 +.. date: 8911 +.. nonce: Hdjjw0 +.. section: Core and Builtins + +Disallowed null characters in the type name. + +.. + +.. bpo: 25973 +.. date: 8910 +.. nonce: Ud__ZP +.. section: Core and Builtins + +Fix segfault when an invalid nonlocal statement binds a name starting with +two underscores. + +.. + +.. bpo: 22995 +.. date: 8909 +.. nonce: Wq0E86 +.. section: Core and Builtins + +Instances of extension types with a state that aren't subclasses of list or +dict and haven't implemented any pickle-related methods (__reduce__, +__reduce_ex__, __getnewargs__, __getnewargs_ex__, or __getstate__), can no +longer be pickled. Including memoryview. + +.. + +.. bpo: 20440 +.. date: 8908 +.. nonce: GCwOfH +.. section: Core and Builtins + +Massive replacing unsafe attribute setting code with special macro +Py_SETREF. + +.. + +.. bpo: 25766 +.. date: 8907 +.. nonce: jn93Yu +.. section: Core and Builtins + +Special method __bytes__() now works in str subclasses. + +.. + +.. bpo: 25421 +.. date: 8906 +.. nonce: c47YEL +.. section: Core and Builtins + +__sizeof__ methods of builtin types now use dynamic basic size. This allows +sys.getsize() to work correctly with their subclasses with __slots__ +defined. + +.. + +.. bpo: 25709 +.. date: 8905 +.. nonce: WwGm2k +.. section: Core and Builtins + +Fixed problem with in-place string concatenation and utf-8 cache. + +.. + +.. bpo: 5319 +.. date: 8904 +.. nonce: HxlGwI +.. section: Core and Builtins + +New Py_FinalizeEx() API allowing Python to set an exit status of 120 on +failure to flush buffered streams. + +.. + +.. bpo: 25485 +.. date: 8903 +.. nonce: 9qnaPt +.. section: Core and Builtins + +telnetlib.Telnet is now a context manager. + +.. + +.. bpo: 24097 +.. date: 8902 +.. nonce: Vt4E-i +.. section: Core and Builtins + +Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. + +.. + +.. bpo: 24731 +.. date: 8901 +.. nonce: h9-hnz +.. section: Core and Builtins + +Fixed crash on converting objects with special methods __bytes__, __trunc__, +and __float__ returning instances of subclasses of bytes, int, and float to +subclasses of bytes, int, and float correspondingly. + +.. + +.. bpo: 25630 +.. date: 8900 +.. nonce: ZxzcoY +.. section: Core and Builtins + +Fix a possible segfault during argument parsing in functions that accept +filesystem paths. + +.. + +.. bpo: 23564 +.. date: 8899 +.. nonce: XHarGG +.. section: Core and Builtins + +Fixed a partially broken sanity check in the _posixsubprocess internals +regarding how fds_to_pass were passed to the child. The bug had no actual +impact as subprocess.py already avoided it. + +.. + +.. bpo: 25388 +.. date: 8898 +.. nonce: zm3uuQ +.. section: Core and Builtins + +Fixed tokenizer crash when processing undecodable source code with a null +byte. + +.. + +.. bpo: 25462 +.. date: 8897 +.. nonce: eXDzgO +.. section: Core and Builtins + +The hash of the key now is calculated only once in most operations in C +implementation of OrderedDict. + +.. + +.. bpo: 22995 +.. date: 8896 +.. nonce: 90kpuP +.. section: Core and Builtins + +Default implementation of __reduce__ and __reduce_ex__ now rejects builtin +types with not defined __new__. + +.. + +.. bpo: 24802 +.. date: 8895 +.. nonce: Qie066 +.. section: Core and Builtins + +Avoid buffer overreads when int(), float(), compile(), exec() and eval() are +passed bytes-like objects. These objects are not necessarily terminated by +a null byte, but the functions assumed they were. + +.. + +.. bpo: 25555 +.. date: 8894 +.. nonce: MUpG-j +.. section: Core and Builtins + +Fix parser and AST: fill lineno and col_offset of "arg" node when compiling +AST from Python objects. + +.. + +.. bpo: 24726 +.. date: 8893 +.. nonce: AHk4v2 +.. section: Core and Builtins + +Fixed a crash and leaking NULL in repr() of OrderedDict that was mutated by +direct calls of dict methods. + +.. + +.. bpo: 25449 +.. date: 8892 +.. nonce: VqTOFi +.. section: Core and Builtins + +Iterating OrderedDict with keys with unstable hash now raises KeyError in C +implementations as well as in Python implementation. + +.. + +.. bpo: 25395 +.. date: 8891 +.. nonce: htkE3W +.. section: Core and Builtins + +Fixed crash when highly nested OrderedDict structures were garbage +collected. + +.. + +.. bpo: 25401 +.. date: 8890 +.. nonce: ofrAtd +.. section: Core and Builtins + +Optimize bytes.fromhex() and bytearray.fromhex(): they are now between 2x +and 3.5x faster. + +.. + +.. bpo: 25399 +.. date: 8889 +.. nonce: dNKIhY +.. section: Core and Builtins + +Optimize bytearray % args using the new private _PyBytesWriter API. +Formatting is now between 2.5 and 5 times faster. + +.. + +.. bpo: 25274 +.. date: 8888 +.. nonce: QCGvAF +.. section: Core and Builtins + +sys.setrecursionlimit() now raises a RecursionError if the new recursion +limit is too low depending at the current recursion depth. Modify also the +"lower-water mark" formula to make it monotonic. This mark is used to decide +when the overflowed flag of the thread state is reset. + +.. + +.. bpo: 24402 +.. date: 8887 +.. nonce: MAgi3X +.. section: Core and Builtins + +Fix input() to prompt to the redirected stdout when sys.stdout.fileno() +fails. + +.. + +.. bpo: 25349 +.. date: 8886 +.. nonce: 7lBgJ8 +.. section: Core and Builtins + +Optimize bytes % args using the new private _PyBytesWriter API. Formatting +is now up to 2 times faster. + +.. + +.. bpo: 24806 +.. date: 8885 +.. nonce: Nb0znT +.. section: Core and Builtins + +Prevent builtin types that are not allowed to be subclassed from being +subclassed through multiple inheritance. + +.. + +.. bpo: 25301 +.. date: 8884 +.. nonce: hUTCfr +.. section: Core and Builtins + +The UTF-8 decoder is now up to 15 times as fast for error handlers: +``ignore``, ``replace`` and ``surrogateescape``. + +.. + +.. bpo: 24848 +.. date: 8883 +.. nonce: HlUSuy +.. section: Core and Builtins + +Fixed a number of bugs in UTF-7 decoding of misformed data. + +.. + +.. bpo: 25267 +.. date: 8882 +.. nonce: SW8Gs6 +.. section: Core and Builtins + +The UTF-8 encoder is now up to 75 times as fast for error handlers: +``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``. Patch co- +written with Serhiy Storchaka. + +.. + +.. bpo: 25280 +.. date: 8881 +.. nonce: ivTMwd +.. section: Core and Builtins + +Import trace messages emitted in verbose (-v) mode are no longer formatted +twice. + +.. + +.. bpo: 25227 +.. date: 8880 +.. nonce: 19v5rp +.. section: Core and Builtins + +Optimize ASCII and latin1 encoders with the ``surrogateescape`` error +handler: the encoders are now up to 3 times as fast. Initial patch written +by Serhiy Storchaka. + +.. + +.. bpo: 25003 +.. date: 8879 +.. nonce: _ban92 +.. section: Core and Builtins + +On Solaris 11.3 or newer, os.urandom() now uses the getrandom() function +instead of the getentropy() function. The getentropy() function is blocking +to generate very good quality entropy, os.urandom() doesn't need such high- +quality entropy. + +.. + +.. bpo: 9232 +.. date: 8878 +.. nonce: pjsmWw +.. section: Core and Builtins + +Modify Python's grammar to allow trailing commas in the argument list of a +function declaration. For example, "def f(\*, a = 3,): pass" is now legal. +Patch from Mark Dickinson. + +.. + +.. bpo: 24965 +.. date: 8877 +.. nonce: wfyxbB +.. section: Core and Builtins + +Implement PEP 498 "Literal String Interpolation". This allows you to embed +expressions inside f-strings, which are converted to normal strings at run +time. Given x=3, then f'value={x}' == 'value=3'. Patch by Eric V. Smith. + +.. + +.. bpo: 26478 +.. date: 8876 +.. nonce: n0dB8e +.. section: Core and Builtins + +Fix semantic bugs when using binary operators with dictionary views and +tuples. + +.. + +.. bpo: 26171 +.. date: 8875 +.. nonce: 8SaQEa +.. section: Core and Builtins + +Fix possible integer overflow and heap corruption in zipimporter.get_data(). + +.. + +.. bpo: 25660 +.. date: 8874 +.. nonce: 93DzBo +.. section: Core and Builtins + +Fix TAB key behaviour in REPL with readline. + +.. + +.. bpo: 26288 +.. date: 8873 +.. nonce: f67RLk +.. section: Core and Builtins + +Optimize PyLong_AsDouble. + +.. + +.. bpo: 26289 +.. date: 8872 +.. nonce: uG9ozG +.. section: Core and Builtins + +Optimize floor and modulo division for single-digit longs. Microbenchmarks +show 2-2.5x improvement. Built-in 'divmod' function is now also ~10% +faster. (See also: bpo-26315) + +.. + +.. bpo: 25887 +.. date: 8871 +.. nonce: PtVIX7 +.. section: Core and Builtins + +Raise a RuntimeError when a coroutine object is awaited more than once. + +.. + +.. bpo: 27057 +.. date: 8870 +.. nonce: YzTA_Q +.. section: Library + +Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails +with EACCESS. The function now falls back to fcntl(). Patch written by +Micha? Bednarski. + +.. + +.. bpo: 27014 +.. date: 8869 +.. nonce: ui7Khn +.. section: Library + +Fix infinite recursion using typing.py. Thanks to Kalle Tuure! + +.. + +.. bpo: 27031 +.. date: 8868 +.. nonce: FtvDPs +.. section: Library + +Removed dummy methods in Tkinter widget classes: tk_menuBar() and +tk_bindForTraversal(). + +.. + +.. bpo: 14132 +.. date: 8867 +.. nonce: 5wR9MN +.. section: Library + +Fix urllib.request redirect handling when the target only has a query +string. Original fix by J?n Janech. + +.. + +.. bpo: 17214 +.. date: 8866 +.. nonce: lUbZOV +.. section: Library + +The "urllib.request" module now percent-encodes non-ASCII bytes found in +redirect target URLs. Some servers send Location header fields with non- +ASCII bytes, but "http.client" requires the request target to be ASCII- +encodable, otherwise a UnicodeEncodeError is raised. Based on patch by +Christian Heimes. + +.. + +.. bpo: 27033 +.. date: 8865 +.. nonce: o4XIPr +.. section: Library + +The default value of the decode_data parameter for smtpd.SMTPChannel and +smtpd.SMTPServer constructors is changed to False. + +.. + +.. bpo: 27034 +.. date: 8864 +.. nonce: ptzz_S +.. section: Library + +Removed deprecated class asynchat.fifo. + +.. + +.. bpo: 26870 +.. date: 8863 +.. nonce: 5tCUlp +.. section: Library + +Added readline.set_auto_history(), which can stop entries being +automatically added to the history list. Based on patch by Tyler Crompton. + +.. + +.. bpo: 26039 +.. date: 8862 +.. nonce: JnXjiE +.. section: Library + +zipfile.ZipFile.open() can now be used to write data into a ZIP file, as +well as for extracting data. Patch by Thomas Kluyver. + +.. + +.. bpo: 26892 +.. date: 8861 +.. nonce: XIXb0h +.. section: Library + +Honor debuglevel flag in urllib.request.HTTPHandler. Patch contributed by +Chi Hsuan Yen. + +.. + +.. bpo: 22274 +.. date: 8860 +.. nonce: 0RHDMN +.. section: Library + +In the subprocess module, allow stderr to be redirected to stdout even when +stdout is not redirected. Patch by Akira Li. + +.. + +.. bpo: 26807 +.. date: 8859 +.. nonce: LXSPP6 +.. section: Library + +mock_open 'files' no longer error on readline at end of file. Patch from +Yolanda Robla. + +.. + +.. bpo: 25745 +.. date: 8858 +.. nonce: -n8acU +.. section: Library + +Fixed leaking a userptr in curses panel destructor. + +.. + +.. bpo: 26977 +.. date: 8857 +.. nonce: 5G4HtL +.. section: Library + +Removed unnecessary, and ignored, call to sum of squares helper in +statistics.pvariance. + +.. + +.. bpo: 26002 +.. date: 8856 +.. nonce: bVD4pW +.. section: Library + +Use bisect in statistics.median instead of a linear search. Patch by Upendra +Kuma. + +.. + +.. bpo: 25974 +.. date: 8855 +.. nonce: cpOy5R +.. section: Library + +Make use of new Decimal.as_integer_ratio() method in statistics module. +Patch by Stefan Krah. + +.. + +.. bpo: 26996 +.. date: 8854 +.. nonce: LR__VD +.. section: Library + +Add secrets module as described in PEP 506. + +.. + +.. bpo: 26881 +.. date: 8853 +.. nonce: mdiq_L +.. section: Library + +The modulefinder module now supports extended opcode arguments. + +.. + +.. bpo: 23815 +.. date: 8852 +.. nonce: _krNe8 +.. section: Library + +Fixed crashes related to directly created instances of types in _tkinter and +curses.panel modules. + +.. + +.. bpo: 17765 +.. date: 8851 +.. nonce: hiSVS1 +.. section: Library + +weakref.ref() no longer silently ignores keyword arguments. Patch by Georg +Brandl. + +.. + +.. bpo: 26873 +.. date: 8850 +.. nonce: cYXRcH +.. section: Library + +xmlrpc now raises ResponseError on unsupported type tags instead of silently +return incorrect result. + +.. + +.. bpo: 26915 +.. date: 8849 +.. nonce: GoQKUL +.. section: Library + +The __contains__ methods in the collections ABCs now check for identity +before checking equality. This better matches the behavior of the concrete +classes, allows sensible handling of NaNs, and makes it easier to reason +about container invariants. + +.. + +.. bpo: 26711 +.. date: 8848 +.. nonce: Eu85Qw +.. section: Library + +Fixed the comparison of plistlib.Data with other types. + +.. + +.. bpo: 24114 +.. date: 8847 +.. nonce: RMRMtM +.. section: Library + +Fix an uninitialized variable in `ctypes.util`. + +The bug only occurs on SunOS when the ctypes implementation searches for the +`crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. + +.. + +.. bpo: 26864 +.. date: 8846 +.. nonce: 1KgGds +.. section: Library + +In urllib.request, change the proxy bypass host checking against no_proxy to +be case-insensitive, and to not match unrelated host names that happen to +have a bypassed hostname as a suffix. Patch by Xiang Zhang. + +.. + +.. bpo: 24902 +.. date: 8845 +.. nonce: bwWpLj +.. section: Library + +Print server URL on http.server startup. Initial patch by Felix Kaiser. + +.. + +.. bpo: 25788 +.. date: 8844 +.. nonce: 9weIV5 +.. section: Library + +fileinput.hook_encoded() now supports an "errors" argument for passing to +open. Original patch by Joseph Hackman. + +.. + +.. bpo: 26634 +.. date: 8843 +.. nonce: FZvsSb +.. section: Library + +recursive_repr() now sets __qualname__ of wrapper. Patch by Xiang Zhang. + +.. + +.. bpo: 26804 +.. date: 8842 +.. nonce: 9Orp-G +.. section: Library + +urllib.request will prefer lower_case proxy environment variables over +UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter Jansen. + +.. + +.. bpo: 26837 +.. date: 8841 +.. nonce: 2FXGsD +.. section: Library + +assertSequenceEqual() now correctly outputs non-stringified differing items +(like bytes in the -b mode). This affects assertListEqual() and +assertTupleEqual(). + +.. + +.. bpo: 26041 +.. date: 8840 +.. nonce: bVem-p +.. section: Library + +Remove "will be removed in Python 3.7" from deprecation messages of +platform.dist() and platform.linux_distribution(). Patch by Kumaripaba +Miyurusara Athukorala. + +.. + +.. bpo: 26822 +.. date: 8839 +.. nonce: rYSL4W +.. section: Library + +itemgetter, attrgetter and methodcaller objects no longer silently ignore +keyword arguments. + +.. + +.. bpo: 26733 +.. date: 8838 +.. nonce: YxaJmL +.. section: Library + +Disassembling a class now disassembles class and static methods. Patch by +Xiang Zhang. + +.. + +.. bpo: 26801 +.. date: 8837 +.. nonce: TQGY-7 +.. section: Library + +Fix error handling in :func:`shutil.get_terminal_size`, catch +:exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel +Barry. + +.. + +.. bpo: 24838 +.. date: 8836 +.. nonce: 3Pfx8T +.. section: Library + +tarfile's ustar and gnu formats now correctly calculate name and link field +limits for multibyte character encodings like utf-8. + +.. + +.. bpo: 26657 +.. date: 8835 +.. nonce: C_-XFg +.. original section: Library +.. section: Security + +Fix directory traversal vulnerability with http.server on Windows. This +fixes a regression that was introduced in 3.3.4rc1 and 3.4.0rc1. Based on +patch by Philipp Hagemeister. + +.. + +.. bpo: 26717 +.. date: 8834 +.. nonce: jngTdu +.. section: Library + +Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by Anthony Sottile. + +.. + +.. bpo: 26782 +.. date: 8833 +.. nonce: JWLPrH +.. section: Library + +Add STARTUPINFO to subprocess.__all__ on Windows. + +.. + +.. bpo: 26404 +.. date: 8832 +.. nonce: hXw7Bs +.. section: Library + +Add context manager to socketserver. Patch by Aviv Palivoda. + +.. + +.. bpo: 26735 +.. date: 8831 +.. nonce: riSl3b +.. section: Library + +Fix :func:`os.urandom` on Solaris 11.3 and newer when reading more than +1,024 bytes: call ``getrandom()`` multiple times with a limit of 1024 bytes +per call. + +.. + +.. bpo: 26585 +.. date: 8830 +.. nonce: kfb749 +.. section: Library + +Eliminate http.server._quote_html() and use html.escape(quote=False). Patch +by Xiang Zhang. + +.. + +.. bpo: 26685 +.. date: 8829 +.. nonce: sI_1Ff +.. section: Library + +Raise OSError if closing a socket fails. + +.. + +.. bpo: 16329 +.. date: 8828 +.. nonce: nuXD8W +.. section: Library + +Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 13952 +.. date: 8827 +.. nonce: SOoTVE +.. section: Library + +Add .csv to mimetypes.types_map. Patch by Geoff Wilson. + +.. + +.. bpo: 26587 +.. date: 8826 +.. nonce: Qo-B6C +.. section: Library + +the site module now allows .pth files to specify files to be added to +sys.path (e.g. zip files). + +.. + +.. bpo: 25609 +.. date: 8825 +.. nonce: t1ydQM +.. section: Library + +Introduce contextlib.AbstractContextManager and typing.ContextManager. + +.. + +.. bpo: 26709 +.. date: 8824 +.. nonce: luOPbP +.. section: Library + +Fixed Y2038 problem in loading binary PLists. + +.. + +.. bpo: 23735 +.. date: 8823 +.. nonce: Y5oQ9r +.. section: Library + +Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH +handler. Patch by Eric Price. + +.. + +.. bpo: 25951 +.. date: 8822 +.. nonce: 1CUASJ +.. section: Library + +Change SSLSocket.sendall() to return None, as explicitly documented for +plain socket objects. Patch by Aviv Palivoda. + +.. + +.. bpo: 26586 +.. date: 8821 +.. nonce: V5pZNa +.. section: Library + +In http.server, respond with "413 Request header fields too large" if there +are too many header fields to parse, rather than killing the connection and +raising an unhandled exception. Patch by Xiang Zhang. + +.. + +.. bpo: 26676 +.. date: 8820 +.. nonce: zLRFed +.. section: Library + +Added missing XMLPullParser to ElementTree.__all__. + +.. + +.. bpo: 22854 +.. date: 8819 +.. nonce: K3rMEH +.. section: Library + +Change BufferedReader.writable() and BufferedWriter.readable() to always +return False. + +.. + +.. bpo: 26492 +.. date: 8818 +.. nonce: YN18iz +.. section: Library + +Exhausted iterator of array.array now conforms with the behavior of +iterators of other mutable sequences: it lefts exhausted even if iterated +array is extended. + +.. + +.. bpo: 26641 +.. date: 8817 +.. nonce: 1ICQz0 +.. section: Library + +doctest.DocFileTest and doctest.testfile() now support packages (module +splitted into multiple directories) for the package parameter. + +.. + +.. bpo: 25195 +.. date: 8816 +.. nonce: EOc4Po +.. section: Library + +Fix a regression in mock.MagicMock. _Call is a subclass of tuple (changeset +3603bae63c13 only works for classes) so we need to implement __ne__ +ourselves. Patch by Andrew Plummer. + +.. + +.. bpo: 26644 +.. date: 8815 +.. nonce: 7tt1tk +.. section: Library + +Raise ValueError rather than SystemError when a negative length is passed to +SSLSocket.recv() or read(). + +.. + +.. bpo: 23804 +.. date: 8814 +.. nonce: PP63Ff +.. section: Library + +Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to +1024. + +.. + +.. bpo: 26616 +.. date: 8813 +.. nonce: v3QwdD +.. section: Library + +Fixed a bug in datetime.astimezone() method. + +.. + +.. bpo: 26637 +.. date: 8812 +.. nonce: ttiUf7 +.. section: Library + +The :mod:`importlib` module now emits an :exc:`ImportError` rather than a +:exc:`TypeError` if :func:`__import__` is tried during the Python shutdown +process but :data:`sys.path` is already cleared (set to ``None``). + +.. + +.. bpo: 21925 +.. date: 8811 +.. nonce: xFz-hR +.. section: Library + +:func:`warnings.formatwarning` now catches exceptions when calling +:func:`linecache.getline` and :func:`tracemalloc.get_object_traceback` to be +able to log :exc:`ResourceWarning` emitted late during the Python shutdown +process. + +.. + +.. bpo: 23848 +.. date: 8810 +.. nonce: RkKqPi +.. section: Library + +On Windows, faulthandler.enable() now also installs an exception handler to +dump the traceback of all Python threads on any Windows exception, not only +on UNIX signals (SIGSEGV, SIGFPE, SIGABRT). + +.. + +.. bpo: 26530 +.. date: 8809 +.. nonce: RWN1jR +.. section: Library + +Add C functions :c:func:`_PyTraceMalloc_Track` and +:c:func:`_PyTraceMalloc_Untrack` to track memory blocks using the +:mod:`tracemalloc` module. Add :c:func:`_PyTraceMalloc_GetTraceback` to get +the traceback of an object. + +.. + +.. bpo: 26588 +.. date: 8808 +.. nonce: uen0XP +.. section: Library + +The _tracemalloc now supports tracing memory allocations of multiple address +spaces (domains). + +.. + +.. bpo: 24266 +.. date: 8807 +.. nonce: YZgVyM +.. section: Library + +Ctrl+C during Readline history search now cancels the search mode when +compiled with Readline 7. + +.. + +.. bpo: 26590 +.. date: 8806 +.. nonce: qEy91x +.. section: Library + +Implement a safe finalizer for the _socket.socket type. It now releases the +GIL to close the socket. + +.. + +.. bpo: 18787 +.. date: 8805 +.. nonce: rWyzgA +.. section: Library + +spwd.getspnam() now raises a PermissionError if the user doesn't have +privileges. + +.. + +.. bpo: 26560 +.. date: 8804 +.. nonce: A4WXNz +.. section: Library + +Avoid potential ValueError in BaseHandler.start_response. Initial patch by +Peter Inglesby. + +.. + +.. bpo: 26567 +.. date: 8803 +.. nonce: kcC99B +.. section: Library + +Add a new function :c:func:`PyErr_ResourceWarning` function to pass the +destroyed object. Add a *source* attribute to +:class:`warnings.WarningMessage`. Add warnings._showwarnmsg() which uses +tracemalloc to get the traceback where source object was allocated. + +.. + +.. bpo: 26313 +.. date: 8802 +.. nonce: LjZAjy +.. original section: Library +.. section: Security + +ssl.py _load_windows_store_certs fails if windows cert store is empty. Patch +by Baji. + +.. + +.. bpo: 26569 +.. date: 8801 +.. nonce: EX8vF1 +.. section: Library + +Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` to support +importing packages. + +.. + +.. bpo: 26499 +.. date: 8800 +.. nonce: NP08PI +.. section: Library + +Account for remaining Content-Length in HTTPResponse.readline() and read1(). +Based on patch by Silent Ghost. Also document that HTTPResponse now supports +these methods. + +.. + +.. bpo: 25320 +.. date: 8799 +.. nonce: V96LIy +.. section: Library + +Handle sockets in directories unittest discovery is scanning. Patch from +Victor van den Elzen. + +.. + +.. bpo: 16181 +.. date: 8798 +.. nonce: P7lLvo +.. section: Library + +cookiejar.http2time() now returns None if year is higher than +datetime.MAXYEAR. + +.. + +.. bpo: 26513 +.. date: 8797 +.. nonce: HoPepy +.. section: Library + +Fixes platform module detection of Windows Server + +.. + +.. bpo: 23718 +.. date: 8796 +.. nonce: AMPC0o +.. section: Library + +Fixed parsing time in week 0 before Jan 1. Original patch by Tam?s Bence +Gedai. + +.. + +.. bpo: 26323 +.. date: 8795 +.. nonce: KkZqEj +.. section: Library + +Add Mock.assert_called() and Mock.assert_called_once() methods to +unittest.mock. Patch written by Amit Saha. + +.. + +.. bpo: 20589 +.. date: 8794 +.. nonce: NsQ_I1 +.. section: Library + +Invoking Path.owner() and Path.group() on Windows now raise +NotImplementedError instead of ImportError. + +.. + +.. bpo: 26177 +.. date: 8793 +.. nonce: HlSWer +.. section: Library + +Fixed the keys() method for Canvas and Scrollbar widgets. + +.. + +.. bpo: 15068 +.. date: 8792 +.. nonce: xokEVC +.. section: Library + +Got rid of excessive buffering in fileinput. The bufsize parameter is now +deprecated and ignored. + +.. + +.. bpo: 19475 +.. date: 8791 +.. nonce: MH2HH9 +.. section: Library + +Added an optional argument timespec to the datetime isoformat() method to +choose the precision of the time component. + +.. + +.. bpo: 2202 +.. date: 8790 +.. nonce: dk9sd0 +.. section: Library + +Fix UnboundLocalError in AbstractDigestAuthHandler.get_algorithm_impls. +Initial patch by Mathieu Dupuy. + +.. + +.. bpo: 26167 +.. date: 8789 +.. nonce: 3F-d12 +.. section: Library + +Minimized overhead in copy.copy() and copy.deepcopy(). Optimized copying and +deepcopying bytearrays, NotImplemented, slices, short lists, tuples, dicts, +sets. + +.. + +.. bpo: 25718 +.. date: 8788 +.. nonce: 4EjZyv +.. section: Library + +Fixed pickling and copying the accumulate() iterator with total is None. + +.. + +.. bpo: 26475 +.. date: 8787 +.. nonce: JXVccY +.. section: Library + +Fixed debugging output for regular expressions with the (?x) flag. + +.. + +.. bpo: 26482 +.. date: 8786 +.. nonce: d635gW +.. section: Library + +Allowed pickling recursive dequeues. + +.. + +.. bpo: 26335 +.. date: 8785 +.. nonce: iXw5Yb +.. section: Library + +Make mmap.write() return the number of bytes written like other write +methods. Patch by Jakub Stasiak. + +.. + +.. bpo: 26457 +.. date: 8784 +.. nonce: Xe6Clh +.. section: Library + +Fixed the subnets() methods in IP network classes for the case when +resulting prefix length is equal to maximal prefix length. Based on patch by +Xiang Zhang. + +.. + +.. bpo: 26385 +.. date: 8783 +.. nonce: 50bDXm +.. section: Library + +Remove the file if the internal open() call in NamedTemporaryFile() fails. +Patch by Silent Ghost. + +.. + +.. bpo: 26402 +.. date: 8782 +.. nonce: k7DVuU +.. section: Library + +Fix XML-RPC client to retry when the server shuts down a persistent +connection. This was a regression related to the new +http.client.RemoteDisconnected exception in 3.5.0a4. + +.. + +.. bpo: 25913 +.. date: 8781 +.. nonce: 5flb95 +.. section: Library + +Leading ``<~`` is optional now in base64.a85decode() with adobe=True. Patch +by Swati Jaiswal. + +.. + +.. bpo: 26186 +.. date: 8780 +.. nonce: R9rfiL +.. section: Library + +Remove an invalid type check in importlib.util.LazyLoader. + +.. + +.. bpo: 26367 +.. date: 8779 +.. nonce: Qct-9S +.. section: Library + +importlib.__import__() raises ImportError like builtins.__import__() when +``level`` is specified but without an accompanying package specified. + +.. + +.. bpo: 26309 +.. date: 8778 +.. nonce: ubEeiz +.. section: Library + +In the "socketserver" module, shut down the request (closing the connected +socket) when verify_request() returns false. Patch by Aviv Palivoda. + +.. + +.. bpo: 23430 +.. date: 8777 +.. nonce: s_mLiA +.. section: Library + +Change the socketserver module to only catch exceptions raised from a +request handler that are derived from Exception (instead of BaseException). +Therefore SystemExit and KeyboardInterrupt no longer trigger the +handle_error() method, and will now to stop a single-threaded server. + +.. + +.. bpo: 25939 +.. date: 8776 +.. nonce: X49Fqd +.. original section: Library +.. section: Security + +On Windows open the cert store readonly in ssl.enum_certificates. + +.. + +.. bpo: 25995 +.. date: 8775 +.. nonce: NfcimP +.. section: Library + +os.walk() no longer uses FDs proportional to the tree depth. + +.. + +.. bpo: 25994 +.. date: 8774 +.. nonce: ga9rT- +.. section: Library + +Added the close() method and the support of the context manager protocol for +the os.scandir() iterator. + +.. + +.. bpo: 23992 +.. date: 8773 +.. nonce: O0Hhvc +.. section: Library + +multiprocessing: make MapResult not fail-fast upon exception. + +.. + +.. bpo: 26243 +.. date: 8772 +.. nonce: 41WSpF +.. section: Library + +Support keyword arguments to zlib.compress(). Patch by Aviv Palivoda. + +.. + +.. bpo: 26117 +.. date: 8771 +.. nonce: ne6p11 +.. section: Library + +The os.scandir() iterator now closes file descriptor not only when the +iteration is finished, but when it was failed with error. + +.. + +.. bpo: 25949 +.. date: 8770 +.. nonce: -Lh9vz +.. section: Library + +__dict__ for an OrderedDict instance is now created only when needed. + +.. + +.. bpo: 25911 +.. date: 8769 +.. nonce: d4Zadh +.. section: Library + +Restored support of bytes paths in os.walk() on Windows. + +.. + +.. bpo: 26045 +.. date: 8768 +.. nonce: WmzUrX +.. section: Library + +Add UTF-8 suggestion to error message when posting a non-Latin-1 string with +http.client. + +.. + +.. bpo: 26039 +.. date: 8767 +.. nonce: a5Bxm4 +.. section: Library + +Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir(). Patch by +Thomas Kluyver. + +.. + +.. bpo: 12923 +.. date: 8766 +.. nonce: HPAu-B +.. section: Library + +Reset FancyURLopener's redirect counter even if there is an exception. +Based on patches by Brian Brazil and Daniel Rocco. + +.. + +.. bpo: 25945 +.. date: 8765 +.. nonce: guNgNM +.. section: Library + +Fixed a crash when unpickle the functools.partial object with wrong state. +Fixed a leak in failed functools.partial constructor. "args" and "keywords" +attributes of functools.partial have now always types tuple and dict +correspondingly. + +.. + +.. bpo: 26202 +.. date: 8764 +.. nonce: LPIXLg +.. section: Library + +copy.deepcopy() now correctly copies range() objects with non-atomic +attributes. + +.. + +.. bpo: 23076 +.. date: 8763 +.. nonce: 8rphoP +.. section: Library + +Path.glob() now raises a ValueError if it's called with an invalid pattern. +Patch by Thomas Nyberg. + +.. + +.. bpo: 19883 +.. date: 8762 +.. nonce: z9TsO6 +.. section: Library + +Fixed possible integer overflows in zipimport. + +.. + +.. bpo: 26227 +.. date: 8761 +.. nonce: Fe6oiB +.. section: Library + +On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions +of the socket module now decode the hostname from the ANSI code page rather +than UTF-8. + +.. + +.. bpo: 26099 +.. date: 8760 +.. nonce: CH5jer +.. section: Library + +The site module now writes an error into stderr if sitecustomize module can +be imported but executing the module raise an ImportError. Same change for +usercustomize. + +.. + +.. bpo: 26147 +.. date: 8759 +.. nonce: i-Jc01 +.. section: Library + +xmlrpc now works with strings not encodable with used non-UTF-8 encoding. + +.. + +.. bpo: 25935 +.. date: 8758 +.. nonce: cyni91 +.. section: Library + +Garbage collector now breaks reference loops with OrderedDict. + +.. + +.. bpo: 16620 +.. date: 8757 +.. nonce: rxpn_Y +.. section: Library + +Fixed AttributeError in msilib.Directory.glob(). + +.. + +.. bpo: 26013 +.. date: 8756 +.. nonce: 93RKNz +.. section: Library + +Added compatibility with broken protocol 2 pickles created in old Python 3 +versions (3.4.3 and lower). + +.. + +.. bpo: 26129 +.. date: 8755 +.. nonce: g4RQZd +.. section: Library + +Deprecated accepting non-integers in grp.getgrgid(). + +.. + +.. bpo: 25850 +.. date: 8754 +.. nonce: jwFPxj +.. section: Library + +Use cross-compilation by default for 64-bit Windows. + +.. + +.. bpo: 25822 +.. date: 8753 +.. nonce: 0Eafyi +.. section: Library + +Add docstrings to the fields of urllib.parse results. Patch contributed by +Swati Jaiswal. + +.. + +.. bpo: 22642 +.. date: 8752 +.. nonce: PEgS9F +.. section: Library + +Convert trace module option parsing mechanism to argparse. Patch contributed +by SilentGhost. + +.. + +.. bpo: 24705 +.. date: 8751 +.. nonce: IZYwjR +.. section: Library + +Fix sysconfig._parse_makefile not expanding ${} vars appearing before $() +vars. + +.. + +.. bpo: 26069 +.. date: 8750 +.. nonce: NaF4lN +.. section: Library + +Remove the deprecated apis in the trace module. + +.. + +.. bpo: 22138 +.. date: 8749 +.. nonce: nRNYkc +.. section: Library + +Fix mock.patch behavior when patching descriptors. Restore original values +after patching. Patch contributed by Sean McCully. + +.. + +.. bpo: 25672 +.. date: 8748 +.. nonce: fw9RJP +.. section: Library + +In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode option if it is +safe to do so. + +.. + +.. bpo: 26012 +.. date: 8747 +.. nonce: IFSXNm +.. section: Library + +Don't traverse into symlinks for ``**`` pattern in pathlib.Path.[r]glob(). + +.. + +.. bpo: 24120 +.. date: 8746 +.. nonce: Yiwa0h +.. section: Library + +Ignore PermissionError when traversing a tree with pathlib.Path.[r]glob(). +Patch by Ulrich Petri. + +.. + +.. bpo: 21815 +.. date: 8745 +.. nonce: h7-UY8 +.. section: Library + +Accept ] characters in the data portion of imap responses, in order to +handle the flags with square brackets accepted and produced by servers such +as gmail. + +.. + +.. bpo: 25447 +.. date: 8744 +.. nonce: -4m4xO +.. section: Library + +fileinput now uses sys.stdin as-is if it does not have a buffer attribute +(restores backward compatibility). + +.. + +.. bpo: 25971 +.. date: 8743 +.. nonce: vhMeG0 +.. section: Library + +Optimized creating Fractions from floats by 2 times and from Decimals by 3 +times. + +.. + +.. bpo: 25802 +.. date: 8742 +.. nonce: Y2KOnA +.. section: Library + +Document as deprecated the remaining implementations of +importlib.abc.Loader.load_module(). + +.. + +.. bpo: 25928 +.. date: 8741 +.. nonce: JsQfKK +.. section: Library + +Add Decimal.as_integer_ratio(). + +.. + +.. bpo: 25447 +.. date: 8740 +.. nonce: ajPRDy +.. section: Library + +Copying the lru_cache() wrapper object now always works, independently from +the type of the wrapped object (by returning the original object unchanged). + +.. + +.. bpo: 25768 +.. date: 8739 +.. nonce: GDj2ip +.. section: Library + +Have the functions in compileall return booleans instead of ints and add +proper documentation and tests for the return values. + +.. + +.. bpo: 24103 +.. date: 8738 +.. nonce: WufqrQ +.. section: Library + +Fixed possible use after free in ElementTree.XMLPullParser. + +.. + +.. bpo: 25860 +.. date: 8737 +.. nonce: 0hActb +.. section: Library + +os.fwalk() no longer skips remaining directories when error occurs. +Original patch by Samson Lee. + +.. + +.. bpo: 25914 +.. date: 8736 +.. nonce: h0V61F +.. section: Library + +Fixed and simplified OrderedDict.__sizeof__. + +.. + +.. bpo: 25869 +.. date: 8735 +.. nonce: eAnRH5 +.. section: Library + +Optimized deepcopying ElementTree; it is now 20 times faster. + +.. + +.. bpo: 25873 +.. date: 8734 +.. nonce: L4Fgjm +.. section: Library + +Optimized iterating ElementTree. Iterating elements Element.iter() is now +40% faster, iterating text Element.itertext() is now up to 2.5 times faster. + +.. + +.. bpo: 25902 +.. date: 8733 +.. nonce: 6t2FmH +.. section: Library + +Fixed various refcount issues in ElementTree iteration. + +.. + +.. bpo: 22227 +.. date: 8732 +.. nonce: 5utM-Q +.. section: Library + +The TarFile iterator is reimplemented using generator. This implementation +is simpler that using class. + +.. + +.. bpo: 25638 +.. date: 8731 +.. nonce: yitRj4 +.. section: Library + +Optimized ElementTree.iterparse(); it is now 2x faster. Optimized +ElementTree parsing; it is now 10% faster. + +.. + +.. bpo: 25761 +.. date: 8730 +.. nonce: JGgMOP +.. section: Library + +Improved detecting errors in broken pickle data. + +.. + +.. bpo: 25717 +.. date: 8729 +.. nonce: 0_xjaK +.. section: Library + +Restore the previous behaviour of tolerating most fstat() errors when +opening files. This was a regression in 3.5a1, and stopped anonymous +temporary files from working in special cases. + +.. + +.. bpo: 24903 +.. date: 8728 +.. nonce: 3LBdzb +.. section: Library + +Fix regression in number of arguments compileall accepts when '-d' is +specified. The check on the number of arguments has been dropped completely +as it never worked correctly anyway. + +.. + +.. bpo: 25764 +.. date: 8727 +.. nonce: 7WWG07 +.. section: Library + +In the subprocess module, preserve any exception caused by fork() failure +when preexec_fn is used. + +.. + +.. bpo: 25771 +.. date: 8726 +.. nonce: It-7Qf +.. section: Library + +Tweak the exception message for importlib.util.resolve_name() when 'package' +isn't specified but necessary. + +.. + +.. bpo: 6478 +.. date: 8725 +.. nonce: -Bi9Hb +.. section: Library + +_strptime's regexp cache now is reset after changing timezone with +time.tzset(). + +.. + +.. bpo: 14285 +.. date: 8724 +.. nonce: UyG8Hj +.. section: Library + +When executing a package with the "python -m package" option, and package +initialization fails, a proper traceback is now reported. The "runpy" +module now lets exceptions from package initialization pass back to the +caller, rather than raising ImportError. + +.. + +.. bpo: 19771 +.. date: 8723 +.. nonce: 5NG-bg +.. section: Library + +Also in runpy and the "-m" option, omit the irrelevant message ". . . is a +package and cannot be directly executed" if the package could not even be +initialized (e.g. due to a bad ``*.pyc`` file). + +.. + +.. bpo: 25177 +.. date: 8722 +.. nonce: aNR4Ha +.. section: Library + +Fixed problem with the mean of very small and very large numbers. As a side +effect, statistics.mean and statistics.variance should be significantly +faster. + +.. + +.. bpo: 25718 +.. date: 8721 +.. nonce: D9mHZF +.. section: Library + +Fixed copying object with state with boolean value is false. + +.. + +.. bpo: 10131 +.. date: 8720 +.. nonce: a7tptz +.. section: Library + +Fixed deep copying of minidom documents. Based on patch by Marian Ganisin. + +.. + +.. bpo: 7990 +.. date: 8719 +.. nonce: fpvQxH +.. section: Library + +dir() on ElementTree.Element now lists properties: "tag", "text", "tail" and +"attrib". Original patch by Santoso Wijaya. + +.. + +.. bpo: 25725 +.. date: 8718 +.. nonce: XIKv3R +.. section: Library + +Fixed a reference leak in pickle.loads() when unpickling invalid data +including tuple instructions. + +.. + +.. bpo: 25663 +.. date: 8717 +.. nonce: Ofwfqa +.. section: Library + +In the Readline completer, avoid listing duplicate global names, and search +the global namespace before searching builtins. + +.. + +.. bpo: 25688 +.. date: 8716 +.. nonce: 8P1HOv +.. section: Library + +Fixed file leak in ElementTree.iterparse() raising an error. + +.. + +.. bpo: 23914 +.. date: 8715 +.. nonce: 1sEz4J +.. section: Library + +Fixed SystemError raised by unpickler on broken pickle data. + +.. + +.. bpo: 25691 +.. date: 8714 +.. nonce: ZEaapY +.. section: Library + +Fixed crash on deleting ElementTree.Element attributes. + +.. + +.. bpo: 25624 +.. date: 8713 +.. nonce: ed-fM0 +.. section: Library + +ZipFile now always writes a ZIP_STORED header for directory entries. Patch +by Dingyuan Wang. + +.. + +.. bpo: 25626 +.. date: 8712 +.. nonce: TQ3fvb +.. section: Library + +Change three zlib functions to accept sizes that fit in Py_ssize_t, but +internally cap those sizes to UINT_MAX. This resolves a regression in 3.5 +where GzipFile.read() failed to read chunks larger than 2 or 4 GiB. The +change affects the zlib.Decompress.decompress() max_length parameter, the +zlib.decompress() bufsize parameter, and the zlib.Decompress.flush() length +parameter. + +.. + +.. bpo: 25583 +.. date: 8711 +.. nonce: Gk-cim +.. section: Library + +Avoid incorrect errors raised by os.makedirs(exist_ok=True) when the OS +gives priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 25593 +.. date: 8710 +.. nonce: 56uegI +.. section: Library + +Change semantics of EventLoop.stop() in asyncio. + +.. + +.. bpo: 6973 +.. date: 8709 +.. nonce: nl5cHt +.. section: Library + +When we know a subprocess.Popen process has died, do not allow the +send_signal(), terminate(), or kill() methods to do anything as they could +potentially signal a different process. + +.. + +.. bpo: 23883 +.. date: 8708 +.. nonce: OQS5sS +.. section: Library + +Added missing APIs to __all__ to match the documented APIs for the following +modules: calendar, csv, enum, fileinput, ftplib, logging, optparse, tarfile, +threading and wave. Also added a test.support.check__all__() helper. +Patches by Jacek Ko?odziej, Mauro S. M. Rodrigues and Joel Taddei. + +.. + +.. bpo: 25590 +.. date: 8707 +.. nonce: KPcnfv +.. section: Library + +In the Readline completer, only call getattr() once per attribute. Also +complete names of attributes such as properties and slots which are listed +by dir() but not yet created on an instance. + +.. + +.. bpo: 25498 +.. date: 8706 +.. nonce: AvqEBl +.. section: Library + +Fix a crash when garbage-collecting ctypes objects created by wrapping a +memoryview. This was a regression made in 3.5a1. Based on patch by +Eryksun. + +.. + +.. bpo: 25584 +.. date: 8705 +.. nonce: 124mYw +.. section: Library + +Added "escape" to the __all__ list in the glob module. + +.. + +.. bpo: 25584 +.. date: 8704 +.. nonce: ZeWX0J +.. section: Library + +Fixed recursive glob() with patterns starting with ``**``. + +.. + +.. bpo: 25446 +.. date: 8703 +.. nonce: k1DByx +.. section: Library + +Fix regression in smtplib's AUTH LOGIN support. + +.. + +.. bpo: 18010 +.. date: 8702 +.. nonce: Azyf1C +.. section: Library + +Fix the pydoc web server's module search function to handle exceptions from +importing packages. + +.. + +.. bpo: 25554 +.. date: 8701 +.. nonce: UM9MlR +.. section: Library + +Got rid of circular references in regular expression parsing. + +.. + +.. bpo: 18973 +.. date: 8700 +.. nonce: Am9jFL +.. section: Library + +Command-line interface of the calendar module now uses argparse instead of +optparse. + +.. + +.. bpo: 25510 +.. date: 8699 +.. nonce: 79g7LA +.. section: Library + +fileinput.FileInput.readline() now returns b'' instead of '' at the end if +the FileInput was opened with binary mode. Patch by Ryosuke Ito. + +.. + +.. bpo: 25503 +.. date: 8698 +.. nonce: Zea0Y7 +.. section: Library + +Fixed inspect.getdoc() for inherited docstrings of properties. Original +patch by John Mark Vandenberg. + +.. + +.. bpo: 25515 +.. date: 8697 +.. nonce: fQsyYG +.. section: Library + +Always use os.urandom as a source of randomness in uuid.uuid4. + +.. + +.. bpo: 21827 +.. date: 8696 +.. nonce: k2oreR +.. section: Library + +Fixed textwrap.dedent() for the case when largest common whitespace is a +substring of smallest leading whitespace. Based on patch by Robert Li. + +.. + +.. bpo: 25447 +.. date: 8695 +.. nonce: eDYc4t +.. section: Library + +The lru_cache() wrapper objects now can be copied and pickled (by returning +the original object unchanged). + +.. + +.. bpo: 25390 +.. date: 8694 +.. nonce: 6mSgRq +.. section: Library + +typing: Don't crash on Union[str, Pattern]. + +.. + +.. bpo: 25441 +.. date: 8693 +.. nonce: d7zph6 +.. section: Library + +asyncio: Raise error from drain() when socket is closed. + +.. + +.. bpo: 25410 +.. date: 8692 +.. nonce: QAs_3B +.. section: Library + +Cleaned up and fixed minor bugs in C implementation of OrderedDict. + +.. + +.. bpo: 25411 +.. date: 8691 +.. nonce: qsJTCb +.. section: Library + +Improved Unicode support in SMTPHandler through better use of the email +package. Thanks to user simon04 for the patch. + +.. + +.. bpo: 0 +.. date: 8690 +.. nonce: pFHJ0i +.. section: Library + +Move the imp module from a PendingDeprecationWarning to DeprecationWarning. + +.. + +.. bpo: 25407 +.. date: 8689 +.. nonce: ukNt1D +.. section: Library + +Remove mentions of the formatter module being removed in Python 3.6. + +.. + +.. bpo: 25406 +.. date: 8688 +.. nonce: 5MZKU_ +.. section: Library + +Fixed a bug in C implementation of OrderedDict.move_to_end() that caused +segmentation fault or hang in iterating after moving several items to the +start of ordered dict. + +.. + +.. bpo: 25382 +.. date: 8687 +.. nonce: XQ44yE +.. section: Library + +pickletools.dis() now outputs implicit memo index for the MEMOIZE opcode. + +.. + +.. bpo: 25357 +.. date: 8686 +.. nonce: ebqGy- +.. section: Library + +Add an optional newline paramer to binascii.b2a_base64(). base64.b64encode() +uses it to avoid a memory copy. + +.. + +.. bpo: 24164 +.. date: 8685 +.. nonce: oi6H3E +.. section: Library + +Objects that need calling ``__new__`` with keyword arguments, can now be +pickled using pickle protocols older than protocol version 4. + +.. + +.. bpo: 25364 +.. date: 8684 +.. nonce: u_1Wi6 +.. section: Library + +zipfile now works in threads disabled builds. + +.. + +.. bpo: 25328 +.. date: 8683 +.. nonce: Rja1Xg +.. section: Library + +smtpd's SMTPChannel now correctly raises a ValueError if both decode_data +and enable_SMTPUTF8 are set to true. + +.. + +.. bpo: 16099 +.. date: 8682 +.. nonce: _MTt3k +.. section: Library + +RobotFileParser now supports Crawl-delay and Request-rate extensions. Patch +by Nikolay Bogoychev. + +.. + +.. bpo: 25316 +.. date: 8681 +.. nonce: dHQHWI +.. section: Library + +distutils raises OSError instead of DistutilsPlatformError when MSVC is not +installed. + +.. + +.. bpo: 25380 +.. date: 8680 +.. nonce: sKZ6-I +.. section: Library + +Fixed protocol for the STACK_GLOBAL opcode in pickletools.opcodes. + +.. + +.. bpo: 23972 +.. date: 8679 +.. nonce: s2g30g +.. section: Library + +Updates asyncio datagram create method allowing reuseport and reuseaddr +socket options to be set prior to binding the socket. Mirroring the existing +asyncio create_server method the reuseaddr option for datagram sockets +defaults to True if the O/S is 'posix' (except if the platform is Cygwin). +Patch by Chris Laws. + +.. + +.. bpo: 25304 +.. date: 8678 +.. nonce: CsmLyI +.. section: Library + +Add asyncio.run_coroutine_threadsafe(). This lets you submit a coroutine to +a loop from another thread, returning a concurrent.futures.Future. By +Vincent Michel. + +.. + +.. bpo: 25232 +.. date: 8677 +.. nonce: KhKjCE +.. section: Library + +Fix CGIRequestHandler to split the query from the URL at the first question +mark (?) rather than the last. Patch from Xiang Zhang. + +.. + +.. bpo: 24657 +.. date: 8676 +.. nonce: h2Ag7y +.. section: Library + +Prevent CGIRequestHandler from collapsing slashes in the query part of the +URL as if it were a path. Patch from Xiang Zhang. + +.. + +.. bpo: 25287 +.. date: 8675 +.. nonce: KhzzMW +.. section: Library + +Don't add crypt.METHOD_CRYPT to crypt.methods if it's not supported. Check +if it is supported, it may not be supported on OpenBSD for example. + +.. + +.. bpo: 23600 +.. date: 8674 +.. nonce: 7J_RD5 +.. section: Library + +Default implementation of tzinfo.fromutc() was returning wrong results in +some cases. + +.. + +.. bpo: 25203 +.. date: 8673 +.. nonce: IgDEbt +.. section: Library + +Failed readline.set_completer_delims() no longer left the module in +inconsistent state. + +.. + +.. bpo: 25011 +.. date: 8672 +.. nonce: VcaCd6 +.. section: Library + +rlcompleter now omits private and special attribute names unless the prefix +starts with underscores. + +.. + +.. bpo: 25209 +.. date: 8671 +.. nonce: WxKcdJ +.. section: Library + +rlcompleter now can add a space or a colon after completed keyword. + +.. + +.. bpo: 22241 +.. date: 8670 +.. nonce: a-Mtw2 +.. section: Library + +timezone.utc name is now plain 'UTC', not 'UTC-00:00'. + +.. + +.. bpo: 23517 +.. date: 8669 +.. nonce: 0ABp8q +.. section: Library + +fromtimestamp() and utcfromtimestamp() methods of datetime.datetime now +round microseconds to nearest with ties going to nearest even integer +(ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity +(ROUND_FLOOR). + +.. + +.. bpo: 23552 +.. date: 8668 +.. nonce: I0T-M- +.. section: Library + +Timeit now warns when there is substantial (4x) variance between best and +worst times. Patch from Serhiy Storchaka. + +.. + +.. bpo: 24633 +.. date: 8667 +.. nonce: 6Unn9B +.. section: Library + +site-packages/README -> README.txt. + +.. + +.. bpo: 24879 +.. date: 8666 +.. nonce: YUzg_z +.. section: Library + +help() and pydoc can now list named tuple fields in the order they were +defined rather than alphabetically. The ordering is determined by the +_fields attribute if present. + +.. + +.. bpo: 24874 +.. date: 8665 +.. nonce: luBfgA +.. section: Library + +Improve speed of itertools.cycle() and make its pickle more compact. + +.. + +.. bpo: 0 +.. date: 8664 +.. nonce: mD-_3v +.. section: Library + +Fix crash in itertools.cycle.__setstate__() when the first argument wasn't a +list. + +.. + +.. bpo: 20059 +.. date: 8663 +.. nonce: SHv0Ji +.. section: Library + +urllib.parse raises ValueError on all invalid ports. Patch by Martin Panter. + +.. + +.. bpo: 24360 +.. date: 8662 +.. nonce: 5RwH-e +.. section: Library + +Improve __repr__ of argparse.Namespace() for invalid identifiers. Patch by +Matthias Bussonnier. + +.. + +.. bpo: 23426 +.. date: 8661 +.. nonce: PUV-Cx +.. section: Library + +run_setup was broken in distutils. Patch from Alexander Belopolsky. + +.. + +.. bpo: 13938 +.. date: 8660 +.. nonce: e5NSE1 +.. section: Library + +2to3 converts StringTypes to a tuple. Patch from Mark Hammond. + +.. + +.. bpo: 2091 +.. date: 8659 +.. nonce: bp56pO +.. section: Library + +open() accepted a 'U' mode string containing '+', but 'U' can only be used +with 'r'. Patch from Jeff Balogh and John O'Connor. + +.. + +.. bpo: 8585 +.. date: 8658 +.. nonce: 78hPc2 +.. section: Library + +improved tests for zipimporter2. Patch from Mark Lawrence. + +.. + +.. bpo: 18622 +.. date: 8657 +.. nonce: i6nCCW +.. section: Library + +unittest.mock.mock_open().reset_mock would recurse infinitely. Patch from +Nicola Palumbo and Laurent De Buyst. + +.. + +.. bpo: 24426 +.. date: 8656 +.. nonce: yCtQfT +.. section: Library + +Fast searching optimization in regular expressions now works for patterns +that starts with capturing groups. Fast searching optimization now can't be +disabled at compile time. + +.. + +.. bpo: 23661 +.. date: 8655 +.. nonce: 5VHJmh +.. section: Library + +unittest.mock side_effects can now be exceptions again. This was a +regression vs Python 3.4. Patch from Ignacio Rossi + +.. + +.. bpo: 13248 +.. date: 8654 +.. nonce: SA2hvu +.. section: Library + +Remove deprecated inspect.getmoduleinfo function. + +.. + +.. bpo: 25578 +.. date: 8653 +.. nonce: G6S-ft +.. section: Library + +Fix (another) memory leak in SSLSocket.getpeercer(). + +.. + +.. bpo: 25530 +.. date: 8652 +.. nonce: hDFkwu +.. section: Library + +Disable the vulnerable SSLv3 protocol by default when creating +ssl.SSLContext. + +.. + +.. bpo: 25569 +.. date: 8651 +.. nonce: CfvQjK +.. section: Library + +Fix memory leak in SSLSocket.getpeercert(). + +.. + +.. bpo: 25471 +.. date: 8650 +.. nonce: T0A02M +.. section: Library + +Sockets returned from accept() shouldn't appear to be nonblocking. + +.. + +.. bpo: 25319 +.. date: 8649 +.. nonce: iyuglv +.. section: Library + +When threading.Event is reinitialized, the underlying condition should use a +regular lock rather than a recursive lock. + +.. + +.. bpo: 0 +.. date: 8648 +.. nonce: rtZyid +.. section: Library + +Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26050 +.. date: 8647 +.. nonce: sclyvk +.. section: Library + +Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. + +.. + +.. bpo: 25924 +.. date: 8646 +.. nonce: Uxr2vt +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on OS X versions +10.5 or higher. Original patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26406 +.. date: 8645 +.. nonce: ihvhF4 +.. section: Library + +Avoid unnecessary serialization of getaddrinfo(3) calls on current versions +of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. + +.. + +.. bpo: 26848 +.. date: 8644 +.. nonce: ChBOpQ +.. section: Library + +Fix asyncio/subprocess.communicate() to handle empty input. Patch by Jack +O'Connor. + +.. + +.. bpo: 27040 +.. date: 8643 +.. nonce: UASyCC +.. section: Library + +Add loop.get_exception_handler method + +.. + +.. bpo: 27041 +.. date: 8642 +.. nonce: p3893U +.. section: Library + +asyncio: Add loop.create_future method + +.. + +.. bpo: 20640 +.. date: 8641 +.. nonce: PmI-G8 +.. section: IDLE + +Add tests for idlelib.configHelpSourceEdit. Patch by Saimadhav Heblikar. + +.. + +.. bpo: 0 +.. date: 8640 +.. nonce: _YJfG7 +.. section: IDLE + +In the 'IDLE-console differences' section of the IDLE doc, clarify how +running with IDLE affects sys.modules and the standard streams. + +.. + +.. bpo: 25507 +.. date: 8639 +.. nonce: i8bNpk +.. section: IDLE + +fix incorrect change in IOBinding that prevented printing. Augment IOBinding +htest to include all major IOBinding functions. + +.. + +.. bpo: 25905 +.. date: 8638 +.. nonce: FzNb3B +.. section: IDLE + +Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION MARK in +README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to +utf-8 and open it with 'utf-8'. + +.. + +.. bpo: 15348 +.. date: 8637 +.. nonce: d1Fg01 +.. section: IDLE + +Stop the debugger engine (normally in a user process) before closing the +debugger window (running in the IDLE process). This prevents the +RuntimeErrors that were being caught and ignored. + +.. + +.. bpo: 24455 +.. date: 8636 +.. nonce: x6YqtE +.. section: IDLE + +Prevent IDLE from hanging when a) closing the shell while the debugger is +active (15347); b) closing the debugger with the [X] button (15348); and c) +activating the debugger when already active (24455). The patch by Mark +Roseman does this by making two changes. 1. Suspend and resume the +gui.interaction method with the tcl vwait mechanism intended for this +purpose (instead of root.mainloop & .quit). 2. In gui.run, allow any +existing interaction to terminate first. + +.. + +.. bpo: 0 +.. date: 8635 +.. nonce: Yp9LRY +.. section: IDLE + +Change 'The program' to 'Your program' in an IDLE 'kill program?' message to +make it clearer that the program referred to is the currently running user +program, not IDLE itself. + +.. + +.. bpo: 24750 +.. date: 8634 +.. nonce: xgsi-K +.. section: IDLE + +Improve the appearance of the IDLE editor window status bar. Patch by Mark +Roseman. + +.. + +.. bpo: 25313 +.. date: 8633 +.. nonce: xMXHpO +.. section: IDLE + +Change the handling of new built-in text color themes to better address the +compatibility problem introduced by the addition of IDLE Dark. Consistently +use the revised idleConf.CurrentTheme everywhere in idlelib. + +.. + +.. bpo: 24782 +.. date: 8632 +.. nonce: RgIPYE +.. section: IDLE + +Extension configuration is now a tab in the IDLE Preferences dialog rather +than a separate dialog. The former tabs are now a sorted list. Patch by +Mark Roseman. + +.. + +.. bpo: 22726 +.. date: 8631 +.. nonce: x8T0dA +.. section: IDLE + +Re-activate the config dialog help button with some content about the other +buttons and the new IDLE Dark theme. + +.. + +.. bpo: 24820 +.. date: 8630 +.. nonce: TFPJhr +.. section: IDLE + +IDLE now has an 'IDLE Dark' built-in text color theme. It is more or less +IDLE Classic inverted, with a cobalt blue background. Strings, comments, +keywords, ... are still green, red, orange, ... . To use it with IDLEs +released before November 2015, hit the 'Save as New Custom Theme' button and +enter a new name, such as 'Custom Dark'. The custom theme will work with +any IDLE release, and can be modified. + +.. + +.. bpo: 25224 +.. date: 8629 +.. nonce: 5Llwo4 +.. section: IDLE + +README.txt is now an idlelib index for IDLE developers and curious users. +The previous user content is now in the IDLE doc chapter. 'IDLE' now means +'Integrated Development and Learning Environment'. + +.. + +.. bpo: 24820 +.. date: 8628 +.. nonce: ZUz9Fn +.. section: IDLE + +Users can now set breakpoint colors in Settings -> Custom Highlighting. +Original patch by Mark Roseman. + +.. + +.. bpo: 24972 +.. date: 8627 +.. nonce: uc0uNo +.. section: IDLE + +Inactive selection background now matches active selection background, as +configured by users, on all systems. Found items are now always highlighted +on Windows. Initial patch by Mark Roseman. + +.. + +.. bpo: 24570 +.. date: 8626 +.. nonce: s3EkNn +.. section: IDLE + +Idle: make calltip and completion boxes appear on Macs affected by a tk +regression. Initial patch by Mark Roseman. + +.. + +.. bpo: 24988 +.. date: 8625 +.. nonce: tXqq4T +.. section: IDLE + +Idle ScrolledList context menus (used in debugger) now work on Mac Aqua. +Patch by Mark Roseman. + +.. + +.. bpo: 24801 +.. date: 8624 +.. nonce: -bj_Ou +.. section: IDLE + +Make right-click for context menu work on Mac Aqua. Patch by Mark Roseman. + +.. + +.. bpo: 25173 +.. date: 8623 +.. nonce: EZzrPg +.. section: IDLE + +Associate tkinter messageboxes with a specific widget. For Mac OSX, make +them a 'sheet'. Patch by Mark Roseman. + +.. + +.. bpo: 25198 +.. date: 8622 +.. nonce: -j_BV7 +.. section: IDLE + +Enhance the initial html viewer now used for Idle Help. * Properly indent +fixed-pitch text (patch by Mark Roseman). * Give code snippet a very Sphinx- +like light blueish-gray background. * Re-use initial width and height set by +users for shell and editor. * When the Table of Contents (TOC) menu is used, +put the section header at the top of the screen. + +.. + +.. bpo: 25225 +.. date: 8621 +.. nonce: 9pvdq6 +.. section: IDLE + +Condense and rewrite Idle doc section on text colors. + +.. + +.. bpo: 21995 +.. date: 8620 +.. nonce: C5Rmzx +.. section: IDLE + +Explain some differences between IDLE and console Python. + +.. + +.. bpo: 22820 +.. date: 8619 +.. nonce: hix_8X +.. section: IDLE + +Explain need for *print* when running file from Idle editor. + +.. + +.. bpo: 25224 +.. date: 8618 +.. nonce: UVMYQq +.. section: IDLE + +Doc: augment Idle feature list and no-subprocess section. + +.. + +.. bpo: 25219 +.. date: 8617 +.. nonce: 8_9DYg +.. section: IDLE + +Update doc for Idle command line options. Some were missing and notes were +not correct. + +.. + +.. bpo: 24861 +.. date: 8616 +.. nonce: Ecg2yT +.. section: IDLE + +Most of idlelib is private and subject to change. Use idleib.idle.* to start +Idle. See idlelib.__init__.__doc__. + +.. + +.. bpo: 25199 +.. date: 8615 +.. nonce: ih7yY3 +.. section: IDLE + +Idle: add synchronization comments for future maintainers. + +.. + +.. bpo: 16893 +.. date: 8614 +.. nonce: uIi1oB +.. section: IDLE + +Replace help.txt with help.html for Idle doc display. The new +idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks +better than help.txt and will better document Idle as released. The tkinter +html viewer that works for this file was written by Rose Roseman. The now +unused EditorWindow.HelpDialog class and helt.txt file are deprecated. + +.. + +.. bpo: 24199 +.. date: 8613 +.. nonce: VKnZEv +.. section: IDLE + +Deprecate unused idlelib.idlever with possible removal in 3.6. + +.. + +.. bpo: 24790 +.. date: 8612 +.. nonce: hD1hlj +.. section: IDLE + +Remove extraneous code (which also create 2 & 3 conflicts). + +.. + +.. bpo: 26736 +.. date: 8611 +.. nonce: U_Hyqo +.. section: Documentation + +Used HTTPS for external links in the documentation if possible. + +.. + +.. bpo: 6953 +.. date: 8610 +.. nonce: Zk6rno +.. section: Documentation + +Rework the Readline module documentation to group related functions +together, and add more details such as what underlying Readline functions +and variables are accessed. + +.. + +.. bpo: 23606 +.. date: 8609 +.. nonce: 9MhIso +.. section: Documentation + +Adds note to ctypes documentation regarding cdll.msvcrt. + +.. + +.. bpo: 24952 +.. date: 8608 +.. nonce: RHhFPE +.. section: Documentation + +Clarify the default size argument of stack_size() in the "threading" and +"_thread" modules. Patch from Mattip. + +.. + +.. bpo: 26014 +.. date: 8607 +.. nonce: ptdZ_I +.. section: Documentation + +Update 3.x packaging documentation: * "See also" links to the new docs are +now provided in the legacy pages * links to setuptools documentation have +been updated + +.. + +.. bpo: 21916 +.. date: 8606 +.. nonce: muwCyp +.. section: Tests + +Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle +Zijlstra. + +.. + +.. bpo: 26295 +.. date: 8605 +.. nonce: sYBtj5 +.. section: Tests + +When using "python3 -m test --testdir=TESTDIR", regrtest doesn't add "test." +prefix to test module names. + +.. + +.. bpo: 26523 +.. date: 8604 +.. nonce: em_Uzt +.. section: Tests + +The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. + +.. + +.. bpo: 26015 +.. date: 8603 +.. nonce: p3oWK3 +.. section: Tests + +Added new tests for pickling iterators of mutable sequences. + +.. + +.. bpo: 26325 +.. date: 8602 +.. nonce: KOUc82 +.. section: Tests + +Added test.support.check_no_resource_warning() to check that no +ResourceWarning is emitted. + +.. + +.. bpo: 25940 +.. date: 8601 +.. nonce: MvBwSe +.. section: Tests + +Changed test_ssl to use its internal local server more. This avoids relying +on svn.python.org, which recently changed root certificate. + +.. + +.. bpo: 25616 +.. date: 8600 +.. nonce: Qr-60p +.. section: Tests + +Tests for OrderedDict are extracted from test_collections into separate file +test_ordered_dict. + +.. + +.. bpo: 25449 +.. date: 8599 +.. nonce: MP6KNs +.. section: Tests + +Added tests for OrderedDict subclasses. + +.. + +.. bpo: 25188 +.. date: 8598 +.. nonce: lnLnIW +.. section: Tests + +Add -P/--pgo to test.regrtest to suppress error output when running the test +suite for the purposes of a PGO build. Initial patch by Alecsandru Patrascu. + +.. + +.. bpo: 22806 +.. date: 8597 +.. nonce: _QHyyV +.. section: Tests + +Add ``python -m test --list-tests`` command to list tests. + +.. + +.. bpo: 18174 +.. date: 8596 +.. nonce: TzH9d_ +.. section: Tests + +``python -m test --huntrleaks ...`` now also checks for leak of file +descriptors. Patch written by Richard Oudkerk. + +.. + +.. bpo: 25260 +.. date: 8595 +.. nonce: jw3p83 +.. section: Tests + +Fix ``python -m test --coverage`` on Windows. Remove the list of ignored +directories. + +.. + +.. bpo: 0 +.. date: 8594 +.. nonce: X-Bk5l +.. section: Tests + +``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass +along to regrtest.py. Previously there was a limit of 9. + +.. + +.. bpo: 26583 +.. date: 8593 +.. nonce: Up7hTl +.. section: Tests + +Skip test_timestamp_overflow in test_import if bytecode files cannot be +written. + +.. + +.. bpo: 21277 +.. date: 8592 +.. nonce: 7y1j9a +.. section: Build + +Don't try to link _ctypes with a ffi_convenience library. + +.. + +.. bpo: 26884 +.. date: 8591 +.. nonce: O8-azL +.. section: Build + +Fix linking extension modules for cross builds. Patch by Xavier de Gaye. + +.. + +.. bpo: 26932 +.. date: 8590 +.. nonce: 5kzaG9 +.. section: Build + +Fixed support of RTLD_* constants defined as enum values, not via macros (in +particular on Android). Patch by Chi Hsuan Yen. + +.. + +.. bpo: 22359 +.. date: 8589 +.. nonce: HDjM4s +.. section: Build + +Disable the rules for running _freeze_importlib and pgen when cross- +compiling. The output of these programs is normally saved with the source +code anyway, and is still regenerated when doing a native build. Patch by +Xavier de Gaye. + +.. + +.. bpo: 21668 +.. date: 8588 +.. nonce: qWwBui +.. section: Build + +Link audioop, _datetime, _ctypes_test modules to libm, except on Mac OS X. +Patch written by Chi Hsuan Yen. + +.. + +.. bpo: 25702 +.. date: 8587 +.. nonce: ipxyJs +.. section: Build + +A --with-lto configure option has been added that will enable link time +optimizations at build time during a make profile-opt. Some compilers and +toolchains are known to not produce stable code when using LTO, be sure to +test things thoroughly before relying on it. It can provide a few % speed up +over profile-opt alone. + +.. + +.. bpo: 26624 +.. date: 8586 +.. nonce: 4fGrTl +.. section: Build + +Adds validation of ucrtbase[d].dll version with warning for old versions. + +.. + +.. bpo: 17603 +.. date: 8585 +.. nonce: 102DA- +.. section: Build + +Avoid error about nonexistant fileblocks.o file by using a lower-level check +for st_blocks in struct stat. + +.. + +.. bpo: 26079 +.. date: 8584 +.. nonce: mEzW0O +.. section: Build + +Fixing the build output folder for tix-8.4.3.6. Patch by Bjoern Thiel. + +.. + +.. bpo: 26465 +.. date: 8583 +.. nonce: _YR608 +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2g. + +.. + +.. bpo: 25348 +.. date: 8582 +.. nonce: FLSPfp +.. section: Build + +Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for +building with Profile-Guided Optimization. The old +``PCbuild\build_pgo.bat`` script is removed. + +.. + +.. bpo: 25827 +.. date: 8581 +.. nonce: yg3DMM +.. section: Build + +Add support for building with ICC to ``configure``, including a new +``--with-icc`` flag. + +.. + +.. bpo: 25696 +.. date: 8580 +.. nonce: 2R_wIv +.. section: Build + +Fix installation of Python on UNIX with make -j9. + +.. + +.. bpo: 24986 +.. date: 8579 +.. nonce: 1WyXeU +.. section: Build + +It is now possible to build Python on Windows without errors when external +libraries are not available. + +.. + +.. bpo: 24421 +.. date: 8578 +.. nonce: 2zY7vM +.. section: Build + +Compile Modules/_math.c once, before building extensions. Previously it +could fail to compile properly if the math and cmath builds were concurrent. + +.. + +.. bpo: 26465 +.. date: 8577 +.. nonce: PkIaV8 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2g. + +.. + +.. bpo: 26268 +.. date: 8576 +.. nonce: I3-YLh +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2f. + +.. + +.. bpo: 25136 +.. date: 8575 +.. nonce: Vi-fmO +.. section: Build + +Support Apple Xcode 7's new textual SDK stub libraries. + +.. + +.. bpo: 24324 +.. date: 8574 +.. nonce: m6DZMx +.. section: Build + +Do not enable unreachable code warnings when using gcc as the option does +not work correctly in older versions of gcc and has been silently removed as +of gcc-4.5. + +.. + +.. bpo: 27053 +.. date: 8573 +.. nonce: 1IRbae +.. section: Windows + +Updates make_zip.py to correctly generate library ZIP file. + +.. + +.. bpo: 26268 +.. date: 8572 +.. nonce: Z-lJEh +.. section: Windows + +Update the prepare_ssl.py script to handle OpenSSL releases that don't +include the contents of the include directory (that is, 1.0.2e and later). + +.. + +.. bpo: 26071 +.. date: 8571 +.. nonce: wLxL2l +.. section: Windows + +bdist_wininst created binaries fail to start and find 32bit Python + +.. + +.. bpo: 26073 +.. date: 8570 +.. nonce: XwWgHp +.. section: Windows + +Update the list of magic numbers in launcher + +.. + +.. bpo: 26065 +.. date: 8569 +.. nonce: SkVLJp +.. section: Windows + +Excludes venv from library when generating embeddable distro. + +.. + +.. bpo: 25022 +.. date: 8568 +.. nonce: vAt_zr +.. section: Windows + +Removed very outdated PC/example_nt/ directory. + +.. + +.. bpo: 26799 +.. date: 8567 +.. nonce: gK2VXX +.. section: Tools/Demos + +Fix python-gdb.py: don't get C types once when the Python code is loaded, +but get C types on demand. The C types can change if python-gdb.py is loaded +before the Python executable. Patch written by Thomas Ilsche. + +.. + +.. bpo: 26271 +.. date: 8566 +.. nonce: wg-rzr +.. section: Tools/Demos + +Fix the Freeze tool to properly use flags passed through configure. Patch by +Daniel Shaulov. + +.. + +.. bpo: 26489 +.. date: 8565 +.. nonce: rJ_U5S +.. section: Tools/Demos + +Add dictionary unpacking support to Tools/parser/unparse.py. Patch by Guo Ci +Teo. + +.. + +.. bpo: 26316 +.. date: 8564 +.. nonce: QJvVOi +.. section: Tools/Demos + +Fix variable name typo in Argument Clinic. + +.. + +.. bpo: 25440 +.. date: 8563 +.. nonce: 5xhyGr +.. section: Tools/Demos + +Fix output of python-config --extension-suffix. + +.. + +.. bpo: 25154 +.. date: 8562 +.. nonce: yLO-r4 +.. section: Tools/Demos + +The pyvenv script has been deprecated in favour of `python3 -m venv`. + +.. + +.. bpo: 26312 +.. date: 8561 +.. nonce: h1T61B +.. section: C API + +SystemError is now raised in all programming bugs with using +PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some +programming bugs. + +.. + +.. bpo: 26198 +.. date: 8560 +.. nonce: lVn1HX +.. section: C API + +ValueError is now raised instead of TypeError on buffer overflow in parsing +"es#" and "et#" format units. SystemError is now raised instead of +TypeError on programmical error in parsing format string. diff --git a/Misc/NEWS.d/3.6.0a2.rst b/Misc/NEWS.d/3.6.0a2.rst new file mode 100644 index 00000000000..7f3b0b8a0ad --- /dev/null +++ b/Misc/NEWS.d/3.6.0a2.rst @@ -0,0 +1,799 @@ +.. bpo: 27095 +.. date: 9032 +.. nonce: 92UoyH +.. release date: 2016-06-13 +.. section: Core and Builtins + +Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. Patch by Demur +Rumed. + +.. + +.. bpo: 27190 +.. date: 9031 +.. nonce: DHDFeD +.. section: Core and Builtins + +Raise NotSupportedError if sqlite3 is older than 3.3.1. Patch by Dave +Sawyer. + +.. + +.. bpo: 27286 +.. date: 9030 +.. nonce: U8q6B1 +.. section: Core and Builtins + +Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with +generalized unpacking (PEP 448) and conflicting keyword names could cause +undefined behavior. + +.. + +.. bpo: 27140 +.. date: 9029 +.. nonce: uc39-1 +.. section: Core and Builtins + +Added BUILD_CONST_KEY_MAP opcode. + +.. + +.. bpo: 27186 +.. date: 9028 +.. nonce: EAnCS7 +.. section: Core and Builtins + +Add support for os.PathLike objects to open() (part of PEP 519). + +.. + +.. bpo: 27066 +.. date: 9027 +.. nonce: SNExZi +.. section: Core and Builtins + +Fixed SystemError if a custom opener (for open()) returns a negative number +without setting an exception. + +.. + +.. bpo: 26983 +.. date: 9026 +.. nonce: A0f3fK +.. section: Core and Builtins + +float() now always return an instance of exact float. The deprecation +warning is emitted if __float__ returns an instance of a strict subclass of +float. In a future versions of Python this can be an error. + +.. + +.. bpo: 27097 +.. date: 9025 +.. nonce: woRKey +.. section: Core and Builtins + +Python interpreter is now about 7% faster due to optimized instruction +decoding. Based on patch by Demur Rumed. + +.. + +.. bpo: 26647 +.. date: 9024 +.. nonce: DLSzRi +.. section: Core and Builtins + +Python interpreter now uses 16-bit wordcode instead of bytecode. Patch by +Demur Rumed. + +.. + +.. bpo: 23275 +.. date: 9023 +.. nonce: YGPb_y +.. section: Core and Builtins + +Allow assigning to an empty target list in round brackets: () = iterable. + +.. + +.. bpo: 27243 +.. date: 9022 +.. nonce: U36M4E +.. section: Core and Builtins + +Update the __aiter__ protocol: instead of returning an awaitable that +resolves to an asynchronous iterator, the asynchronous iterator should be +returned directly. Doing the former will trigger a +PendingDeprecationWarning. + +.. + +.. bpo: 0 +.. date: 9021 +.. nonce: nBpVM1 +.. section: Library + +Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants +exposed on the API which are not implemented on GNU/Hurd. They would not +work at runtime anyway. + +.. + +.. bpo: 27025 +.. date: 9020 +.. nonce: ffzxpX +.. section: Library + +Generated names for Tkinter widgets are now more meanful and recognizirable. + +.. + +.. bpo: 25455 +.. date: 9019 +.. nonce: k10GoO +.. section: Library + +Fixed crashes in repr of recursive ElementTree.Element and functools.partial +objects. + +.. + +.. bpo: 27294 +.. date: 9018 +.. nonce: XPCURr +.. section: Library + +Improved repr for Tkinter event objects. + +.. + +.. bpo: 20508 +.. date: 9017 +.. nonce: 3NMbT2 +.. section: Library + +Improve exception message of IPv{4,6}Network.__getitem__. Patch by Gareth +Rees. + +.. + +.. bpo: 26556 +.. date: 9016 +.. nonce: v5j2uL +.. original section: Library +.. section: Security + +Update expat to 2.1.1, fixes CVE-2015-1283. + +.. + +.. bpo: 0 +.. date: 9015 +.. nonce: PHOAdg +.. original section: Library +.. section: Security + +Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. Reported by Team +Oststrom. + +.. + +.. bpo: 21386 +.. date: 9014 +.. nonce: DjV72U +.. section: Library + +Implement missing IPv4Address.is_global property. It was documented since +07a5610bae9d. Initial patch by Roger Luethi. + +.. + +.. bpo: 27029 +.. date: 9013 +.. nonce: dmycvw +.. section: Library + +Removed deprecated support of universal newlines mode from ZipFile.open(). + +.. + +.. bpo: 27030 +.. date: 9012 +.. nonce: p29J7m +.. section: Library + +Unknown escapes consisting of ``'\'`` and an ASCII letter in regular +expressions now are errors. The re.LOCALE flag now can be used only with +bytes patterns. + +.. + +.. bpo: 27186 +.. date: 9011 +.. nonce: UYiwoh +.. section: Library + +Add os.PathLike support to DirEntry (part of PEP 519). Initial patch by +Jelle Zijlstra. + +.. + +.. bpo: 20900 +.. date: 9010 +.. nonce: H5YQPR +.. section: Library + +distutils register command now decodes HTTP responses correctly. Initial +patch by ingrid. + +.. + +.. bpo: 27186 +.. date: 9009 +.. nonce: Xo4c_F +.. section: Library + +Add os.PathLike support to pathlib, removing its provisional status (part of +PEP 519). Initial patch by Dusty Phillips. + +.. + +.. bpo: 27186 +.. date: 9008 +.. nonce: ZD1wpp +.. section: Library + +Add support for os.PathLike objects to os.fsencode() and os.fsdecode() (part +of PEP 519). + +.. + +.. bpo: 27186 +.. date: 9007 +.. nonce: y7YRfj +.. section: Library + +Introduce os.PathLike and os.fspath() (part of PEP 519). + +.. + +.. bpo: 0 +.. date: 9006 +.. nonce: iYIeng +.. section: Library + +A new version of typing.py provides several new classes and features: + at overload outside stubs, Reversible, DefaultDict, Text, ContextManager, +Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of +the new features are not yet implemented in mypy or other static analyzers). +Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been +added (in fact they made it into 3.5.1 but were never mentioned). + +.. + +.. bpo: 25738 +.. date: 9005 +.. nonce: mED9w4 +.. section: Library + +Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message +body for 205 Reset Content. Also, don't send Content header fields in +responses that don't have a body. Patch by Susumu Koshiba. + +.. + +.. bpo: 21313 +.. date: 9004 +.. nonce: W30MBr +.. section: Library + +Fix the "platform" module to tolerate when sys.version contains truncated +build information. + +.. + +.. bpo: 26839 +.. date: 9003 +.. nonce: yVvy7R +.. original section: Library +.. section: Security + +On Linux, :func:`os.urandom` now calls ``getrandom()`` with +``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom +entropy pool is not initialized yet. Patch written by Colm Buckley. + +.. + +.. bpo: 23883 +.. date: 9002 +.. nonce: tsZUiM +.. section: Library + +Added missing APIs to __all__ to match the documented APIs for the following +modules: cgi, mailbox, mimetypes, plistlib and smtpd. Patches by Jacek +Ko?odziej. + +.. + +.. bpo: 27164 +.. date: 9001 +.. nonce: 6wmjx2 +.. section: Library + +In the zlib module, allow decompressing raw Deflate streams with a +predefined zdict. Based on patch by Xiang Zhang. + +.. + +.. bpo: 24291 +.. date: 9000 +.. nonce: Ac6HvL +.. section: Library + +Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the +client. Previously it could do partial writes and truncate data. Also, +wsgiref.handler.ServerHandler can now handle stdout doing partial writes, +but this is deprecated. + +.. + +.. bpo: 21272 +.. date: 8999 +.. nonce: unScIG +.. section: Library + +Use _sysconfigdata.py to initialize distutils.sysconfig. + +.. + +.. bpo: 19611 +.. date: 8998 +.. nonce: MT-Qga +.. section: Library + +:mod:`inspect` now reports the implicit ``.0`` parameters generated by the +compiler for comprehension and generator expression scopes as if they were +positional-only parameters called ``implicit0``. Patch by Jelle Zijlstra. + +.. + +.. bpo: 26809 +.. date: 8997 +.. nonce: ya7JMb +.. section: Library + +Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + +.. + +.. bpo: 26373 +.. date: 8996 +.. nonce: P6qz6o +.. section: Library + +subprocess.Popen.communicate now correctly ignores BrokenPipeError when the +child process dies before .communicate() is called in more/all +circumstances. + +.. + +.. bpo: 0 +.. date: 8995 +.. nonce: eKchPz +.. section: Library + +signal, socket, and ssl module IntEnum constant name lookups now return a +consistent name for values having multiple names. Ex: signal.Signals(6) now +refers to itself as signal.SIGALRM rather than flipping between that and +signal.SIGIOT based on the interpreter's hash randomization seed. + +.. + +.. bpo: 27167 +.. date: 8994 +.. nonce: orA_j0 +.. section: Library + +Clarify the subprocess.CalledProcessError error message text when the child +process died due to a signal. + +.. + +.. bpo: 25931 +.. date: 8993 +.. nonce: W7h6Am +.. section: Library + +Don't define socketserver.Forking* names on platforms such as Windows that +do not support os.fork(). + +.. + +.. bpo: 21776 +.. date: 8992 +.. nonce: 04eQfa +.. section: Library + +distutils.upload now correctly handles HTTPError. Initial patch by Claudiu +Popa. + +.. + +.. bpo: 26526 +.. date: 8991 +.. nonce: ScewjJ +.. section: Library + +Replace custom parse tree validation in the parser module with a simple DFA +validator. + +.. + +.. bpo: 27114 +.. date: 8990 +.. nonce: bGCuAM +.. section: Library + +Fix SSLContext._load_windows_store_certs fails with PermissionError + +.. + +.. bpo: 18383 +.. date: 8989 +.. nonce: jr-b0l +.. section: Library + +Avoid creating duplicate filters when using filterwarnings and simplefilter. +Based on patch by Alex Shkop. + +.. + +.. bpo: 23026 +.. date: 8988 +.. nonce: V2rgYX +.. section: Library + +winreg.QueryValueEx() now return an integer for REG_QWORD type. + +.. + +.. bpo: 26741 +.. date: 8987 +.. nonce: fsbb42 +.. section: Library + +subprocess.Popen destructor now emits a ResourceWarning warning if the child +process is still running. + +.. + +.. bpo: 27056 +.. date: 8986 +.. nonce: rk-BBL +.. section: Library + +Optimize pickle.load() and pickle.loads(), up to 10% faster to deserialize a +lot of small objects. + +.. + +.. bpo: 21271 +.. date: 8985 +.. nonce: bHIfFA +.. section: Library + +New keyword only parameters in reset_mock call. + +.. + +.. bpo: 5124 +.. date: 8984 +.. nonce: 4kwBvM +.. section: IDLE + +Paste with text selected now replaces the selection on X11. This matches how +paste works on Windows, Mac, most modern Linux apps, and ttk widgets. +Original patch by Serhiy Storchaka. + +.. + +.. bpo: 24750 +.. date: 8983 +.. nonce: wA-pc9 +.. section: IDLE + +Switch all scrollbars in IDLE to ttk versions. Where needed, minimal tests +are added to cover changes. + +.. + +.. bpo: 24759 +.. date: 8982 +.. nonce: 76HB4w +.. section: IDLE + +IDLE requires tk 8.5 and availability ttk widgets. Delete now unneeded tk +version tests and code for older versions. Add test for IDLE syntax +colorizoer. + +.. + +.. bpo: 27239 +.. date: 8981 +.. nonce: fToURh +.. section: IDLE + +idlelib.macosx.isXyzTk functions initialize as needed. + +.. + +.. bpo: 27262 +.. date: 8980 +.. nonce: t7ckly +.. section: IDLE + +move Aqua unbinding code, which enable context menus, to maxosx. + +.. + +.. bpo: 24759 +.. date: 8979 +.. nonce: ccmySu +.. section: IDLE + +Make clear in idlelib.idle_test.__init__ that the directory is a private +implementation of test.test_idle and tool for maintainers. + +.. + +.. bpo: 27196 +.. date: 8978 +.. nonce: 3yp8TF +.. section: IDLE + +Stop 'ThemeChanged' warnings when running IDLE tests. These persisted after +other warnings were suppressed in #20567. Apply Serhiy Storchaka's +update_idletasks solution to four test files. Record this additional advice +in idle_test/README.txt + +.. + +.. bpo: 20567 +.. date: 8977 +.. nonce: hhT32b +.. section: IDLE + +Revise idle_test/README.txt with advice about avoiding tk warning messages +from tests. Apply advice to several IDLE tests. + +.. + +.. bpo: 24225 +.. date: 8976 +.. nonce: NxQCka +.. section: IDLE + +Update idlelib/README.txt with new file names and event handlers. + +.. + +.. bpo: 27156 +.. date: 8975 +.. nonce: j1N9br +.. section: IDLE + +Remove obsolete code not used by IDLE. Replacements: 1. help.txt, replaced +by help.html, is out-of-date and should not be used. Its dedicated viewer +has be replaced by the html viewer in help.py. 2. ``import idlever; I = +idlever.IDLE_VERSION`` is the same as ``import sys; I = +version[:version.index(' ')]`` 3. After ``ob = +stackviewer.VariablesTreeItem(*args)``, ``ob.keys() == +list(ob.object.keys)``. 4. In macosc, runningAsOSXAPP == isAquaTk; +idCarbonAquaTk == isCarbonTk + +.. + +.. bpo: 27117 +.. date: 8974 +.. nonce: YrLPf4 +.. section: IDLE + +Make colorizer htest and turtledemo work with dark themes. Move code for +configuring text widget colors to a new function. + +.. + +.. bpo: 24225 +.. date: 8973 +.. nonce: RbyFuV +.. section: IDLE + +Rename many `idlelib/*.py` and `idle_test/test_*.py` files. Edit files to +replace old names with new names when the old name referred to the module +rather than the class it contained. See the issue and IDLE section in What's +New in 3.6 for more. + +.. + +.. bpo: 26673 +.. date: 8972 +.. nonce: dh0_Ij +.. section: IDLE + +When tk reports font size as 0, change to size 10. Such fonts on Linux +prevented the configuration dialog from opening. + +.. + +.. bpo: 21939 +.. date: 8971 +.. nonce: pWz-OK +.. section: IDLE + +Add test for IDLE's percolator. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 21676 +.. date: 8970 +.. nonce: hqy6Qh +.. section: IDLE + +Add test for IDLE's replace dialog. Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 18410 +.. date: 8969 +.. nonce: DLSPZo +.. section: IDLE + +Add test for IDLE's search dialog. Original patch by Westley Mart?nez. + +.. + +.. bpo: 21703 +.. date: 8968 +.. nonce: bEU8sP +.. section: IDLE + +Add test for undo delegator. Patch mostly by Saimadhav Heblikar . + +.. + +.. bpo: 27044 +.. date: 8967 +.. nonce: 4y7tyM +.. section: IDLE + +Add ConfigDialog.remove_var_callbacks to stop memory leaks. + +.. + +.. bpo: 23977 +.. date: 8966 +.. nonce: miDjj8 +.. section: IDLE + +Add more asserts to test_delegator. + +.. + +.. bpo: 16484 +.. date: 8965 +.. nonce: ITzcGg +.. section: Documentation + +Change the default PYTHONDOCS URL to "https:", and fix the resulting links +to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi. + +.. + +.. bpo: 24136 +.. date: 8964 +.. nonce: MUK0zK +.. section: Documentation + +Document the new PEP 448 unpacking syntax of 3.5. + +.. + +.. bpo: 22558 +.. date: 8963 +.. nonce: Pk02YC +.. section: Documentation + +Add remaining doc links to source code for Python-coded modules. Patch by +Yoni Lavi. + +.. + +.. bpo: 25285 +.. date: 8962 +.. nonce: 6CxIBo +.. section: Tests + +regrtest now uses subprocesses when the -j1 command line option is used: +each test file runs in a fresh child process. Before, the -j1 option was +ignored. + +.. + +.. bpo: 25285 +.. date: 8961 +.. nonce: ENYqUQ +.. section: Tests + +Tools/buildbot/test.bat script now uses -j1 by default to run each test file +in fresh child process. + +.. + +.. bpo: 27064 +.. date: 8960 +.. nonce: xeY1WF +.. section: Windows + +The py.exe launcher now defaults to Python 3. The Windows launcher +``py.exe`` no longer prefers an installed Python 2 version over Python 3 by +default when used interactively. + +.. + +.. bpo: 27229 +.. date: 8959 +.. nonce: C2NDch +.. section: Build + +Fix the cross-compiling pgen rule for in-tree builds. Patch by Xavier de +Gaye. + +.. + +.. bpo: 26930 +.. date: 8958 +.. nonce: Sqz2O3 +.. section: Build + +Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL +1.0.2h. + +.. + +.. bpo: 17500 +.. date: 8957 +.. nonce: QTZbRV +.. section: Windows + +Remove unused and outdated icons. (See also: +https://github.com/python/pythondotorg/issues/945) + +.. + +.. bpo: 27186 +.. date: 8956 +.. nonce: Ll8R-t +.. section: C API + +Add the PyOS_FSPath() function (part of PEP 519). + +.. + +.. bpo: 26282 +.. date: 8955 +.. nonce: Rp-R6L +.. section: C API + +PyArg_ParseTupleAndKeywords() now supports positional-only parameters. + +.. + +.. bpo: 26282 +.. date: 8954 +.. nonce: DRRV-- +.. section: Tools/Demos + +Argument Clinic now supports positional-only and keyword parameters in the +same function. diff --git a/Misc/NEWS.d/3.6.0a3.rst b/Misc/NEWS.d/3.6.0a3.rst new file mode 100644 index 00000000000..9bc9974e472 --- /dev/null +++ b/Misc/NEWS.d/3.6.0a3.rst @@ -0,0 +1,537 @@ +.. bpo: 27473 +.. date: 9085 +.. nonce: _nOtTA +.. release date: 2016-07-11 +.. section: Core and Builtins + +Fixed possible integer overflow in bytes and bytearray concatenations. +Patch by Xiang Zhang. + +.. + +.. bpo: 23034 +.. date: 9084 +.. nonce: GWaUqn +.. section: Core and Builtins + +The output of a special Python build with defined COUNT_ALLOCS, +SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can +be re-enabled using the "-X showalloccount" option. It now outputs to +stderr instead of stdout. + +.. + +.. bpo: 27443 +.. date: 9083 +.. nonce: 87ZwZ1 +.. section: Core and Builtins + +__length_hint__() of bytearray iterators no longer return a negative integer +for a resized bytearray. + +.. + +.. bpo: 27007 +.. date: 9082 +.. nonce: Gg8Um4 +.. section: Core and Builtins + +The fromhex() class methods of bytes and bytearray subclasses now return an +instance of corresponding subclass. + +.. + +.. bpo: 26844 +.. date: 9081 +.. nonce: I0wdnY +.. section: Library + +Fix error message for imp.find_module() to refer to 'path' instead of +'name'. Patch by Lev Maximov. + +.. + +.. bpo: 23804 +.. date: 9080 +.. nonce: ipFvxc +.. section: Library + +Fix SSL zero-length recv() calls to not block and not raise an error about +unclean EOF. + +.. + +.. bpo: 27466 +.. date: 9079 +.. nonce: C_3a8E +.. section: Library + +Change time format returned by http.cookie.time2netscape, confirming the +netscape cookie format and making it consistent with documentation. + +.. + +.. bpo: 21708 +.. date: 9078 +.. nonce: RpPYiv +.. section: Library + +Deprecated dbm.dumb behavior that differs from common dbm behavior: creating +a database in 'r' and 'w' modes and modifying a database in 'r' mode. + +.. + +.. bpo: 26721 +.. date: 9077 +.. nonce: L37Y7r +.. section: Library + +Change the socketserver.StreamRequestHandler.wfile attribute to implement +BufferedIOBase. In particular, the write() method no longer does partial +writes. + +.. + +.. bpo: 22115 +.. date: 9076 +.. nonce: vG5UQW +.. section: Library + +Added methods trace_add, trace_remove and trace_info in the tkinter.Variable +class. They replace old methods trace_variable, trace, trace_vdelete and +trace_vinfo that use obsolete Tcl commands and might not work in future +versions of Tcl. Fixed old tracing methods: trace_vdelete() with wrong mode +no longer break tracing, trace_vinfo() now always returns a list of pairs of +strings, tracing in the "u" mode now works. + +.. + +.. bpo: 26243 +.. date: 9075 +.. nonce: dBtlhI +.. section: Library + +Only the level argument to zlib.compress() is keyword argument now. The +first argument is positional-only. + +.. + +.. bpo: 27038 +.. date: 9074 +.. nonce: yGMV4h +.. section: Library + +Expose the DirEntry type as os.DirEntry. Code patch by Jelle Zijlstra. + +.. + +.. bpo: 27186 +.. date: 9073 +.. nonce: OtorpF +.. section: Library + +Update os.fspath()/PyOS_FSPath() to check the return value of __fspath__() +to be either str or bytes. + +.. + +.. bpo: 18726 +.. date: 9072 +.. nonce: eIXHIl +.. section: Library + +All optional parameters of the dump(), dumps(), load() and loads() functions +and JSONEncoder and JSONDecoder class constructors in the json module are +now keyword-only. + +.. + +.. bpo: 27319 +.. date: 9071 +.. nonce: vDl2zm +.. section: Library + +Methods selection_set(), selection_add(), selection_remove() and +selection_toggle() of ttk.TreeView now allow passing multiple items as +multiple arguments instead of passing them as a tuple. Deprecated +undocumented ability of calling the selection() method with arguments. + +.. + +.. bpo: 27079 +.. date: 9070 +.. nonce: c7d0Ym +.. section: Library + +Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +.. + +.. bpo: 27294 +.. date: 9069 +.. nonce: 0WSp9y +.. section: Library + +Numerical state in the repr for Tkinter event objects is now represented as +a combination of known flags. + +.. + +.. bpo: 27177 +.. date: 9068 +.. nonce: U6jRnd +.. section: Library + +Match objects in the re module now support index-like objects as group +indices. Based on patches by Jeroen Demeyer and Xiang Zhang. + +.. + +.. bpo: 26754 +.. date: 9067 +.. nonce: J3n0QW +.. section: Library + +Some functions (compile() etc) accepted a filename argument encoded as an +iterable of integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 26536 +.. date: 9066 +.. nonce: DgLWm- +.. section: Library + +socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. + +.. + +.. bpo: 27048 +.. date: 9065 +.. nonce: EVe-Bk +.. section: Library + +Prevents distutils failing on Windows when environment variables contain +non-ASCII characters + +.. + +.. bpo: 27330 +.. date: 9064 +.. nonce: GJaFCV +.. section: Library + +Fixed possible leaks in the ctypes module. + +.. + +.. bpo: 27238 +.. date: 9063 +.. nonce: Q6v6Qv +.. section: Library + +Got rid of bare excepts in the turtle module. Original patch by Jelle +Zijlstra. + +.. + +.. bpo: 27122 +.. date: 9062 +.. nonce: 06t7zN +.. section: Library + +When an exception is raised within the context being managed by a +contextlib.ExitStack() and one of the exit stack generators catches and +raises it in a chain, do not re-raise the original exception when exiting, +let the new chained one through. This avoids the PEP 479 bug described in +issue25782. + +.. + +.. bpo: 27278 +.. date: 9061 +.. nonce: y_HkGw +.. original section: Library +.. section: Security + +Fix os.urandom() implementation using getrandom() on Linux. Truncate size +to INT_MAX and loop until we collected enough random bytes, instead of +casting a directly Py_ssize_t to int. + +.. + +.. bpo: 16864 +.. date: 9060 +.. nonce: W7tJDa +.. section: Library + +sqlite3.Cursor.lastrowid now supports REPLACE statement. Initial patch by +Alex LordThorsen. + +.. + +.. bpo: 26386 +.. date: 9059 +.. nonce: 9L3Ut4 +.. section: Library + +Fixed ttk.TreeView selection operations with item id's containing spaces. + +.. + +.. bpo: 8637 +.. date: 9058 +.. nonce: lHiUSA +.. section: Library + +Honor a pager set by the env var MANPAGER (in preference to one set by the +env var PAGER). + +.. + +.. bpo: 22636 +.. date: 9057 +.. nonce: 3fQW_g +.. original section: Library +.. section: Security + +Avoid shell injection problems with ctypes.util.find_library(). + +.. + +.. bpo: 16182 +.. date: 9056 +.. nonce: RgFXyr +.. section: Library + +Fix various functions in the "readline" module to use the locale encoding, +and fix get_begidx() and get_endidx() to return code point indexes. + +.. + +.. bpo: 27392 +.. date: 9055 +.. nonce: obfni7 +.. section: Library + +Add loop.connect_accepted_socket(). Patch by Jim Fulton. + +.. + +.. bpo: 27477 +.. date: 9054 +.. nonce: iEuL-9 +.. section: IDLE + +IDLE search dialogs now use ttk widgets. + +.. + +.. bpo: 27173 +.. date: 9053 +.. nonce: M-fYaV +.. section: IDLE + +Add 'IDLE Modern Unix' to the built-in key sets. Make the default key set +depend on the platform. Add tests for the changes to the config module. + +.. + +.. bpo: 27452 +.. date: 9052 +.. nonce: dLxZ8W +.. section: IDLE + +make command line "idle-test> python test_help.py" work. __file__ is +relative when python is started in the file's directory. + +.. + +.. bpo: 27452 +.. date: 9051 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 27380 +.. date: 9050 +.. nonce: Q39r9U +.. section: IDLE + +IDLE: add query.py with base Query dialog and ttk widgets. Module had +subclasses SectionName, ModuleName, and HelpSource, which are used to get +information from users by configdialog and file =>Load Module. Each subclass +has itw own validity checks. Using ModuleName allows users to edit bad +module names instead of starting over. Add tests and delete the two files +combined into the new one. + +.. + +.. bpo: 27372 +.. date: 9049 +.. nonce: k3Wj2V +.. section: IDLE + +Test_idle no longer changes the locale. + +.. + +.. bpo: 27365 +.. date: 9048 +.. nonce: y7ys_A +.. section: IDLE + +Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +.. + +.. bpo: 27245 +.. date: 9047 +.. nonce: u9aKO1 +.. section: IDLE + +IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE +was started from a console or by import, a cascade of warnings was emitted. +Patch by Serhiy Storchaka. + +.. + +.. bpo: 24137 +.. date: 9046 +.. nonce: v8o-IT +.. section: IDLE + +Run IDLE, test_idle, and htest with tkinter default root disabled. Fix code +and tests that fail with this restriction. Fix htests to not create a +second and redundant root and mainloop. + +.. + +.. bpo: 27310 +.. date: 9045 +.. nonce: KiURpC +.. section: IDLE + +Fix IDLE.app failure to launch on OS X due to vestigial import. + +.. + +.. bpo: 26754 +.. date: 9044 +.. nonce: Qm_N79 +.. section: C API + +PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of +integers. Now only strings and byte-like objects are accepted. + +.. + +.. bpo: 28066 +.. date: 9043 +.. nonce: _3xImV +.. section: Build + +Fix the logic that searches build directories for generated include files +when building outside the source tree. + +.. + +.. bpo: 27442 +.. date: 9042 +.. nonce: S2M0cz +.. section: Build + +Expose the Android API level that python was built against, in +sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'. + +.. + +.. bpo: 27434 +.. date: 9041 +.. nonce: 4nRZmn +.. section: Build + +The interpreter that runs the cross-build, found in PATH, must now be of the +same feature version (e.g. 3.6) as the source being built. + +.. + +.. bpo: 26930 +.. date: 9040 +.. nonce: 9JUeSD +.. section: Build + +Update Windows builds to use OpenSSL 1.0.2h. + +.. + +.. bpo: 23968 +.. date: 9039 +.. nonce: 7AuSK9 +.. section: Build + +Rename the platform directory from plat-$(MACHDEP) to +plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from +config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET). Install the +platform specifc _sysconfigdata module into the platform directory and +rename it to include the ABIFLAGS. + +.. + +.. bpo: 0 +.. date: 9038 +.. nonce: U46i2u +.. section: Build + +Don't use largefile support for GNU/Hurd. + +.. + +.. bpo: 27332 +.. date: 9037 +.. nonce: OuRZp9 +.. section: Tools/Demos + +Fixed the type of the first argument of module-level functions generated by +Argument Clinic. Patch by Petr Viktorin. + +.. + +.. bpo: 27418 +.. date: 9036 +.. nonce: W2m_8I +.. section: Tools/Demos + +Fixed Tools/importbench/importbench.py. + +.. + +.. bpo: 19489 +.. date: 9035 +.. nonce: jvzuO7 +.. section: Documentation + +Moved the search box from the sidebar to the header and footer of each page. +Patch by Ammar Askar. + +.. + +.. bpo: 27285 +.. date: 9034 +.. nonce: wZur0b +.. section: Documentation + +Update documentation to reflect the deprecation of ``pyvenv`` and normalize +on the term "virtual environment". Patch by Steve Piercy. + +.. + +.. bpo: 27027 +.. date: 9033 +.. nonce: 5oRSGL +.. section: Tests + +Added test.support.is_android that is True when this is an Android build. diff --git a/Misc/NEWS.d/3.6.0a4.rst b/Misc/NEWS.d/3.6.0a4.rst new file mode 100644 index 00000000000..6c98c916461 --- /dev/null +++ b/Misc/NEWS.d/3.6.0a4.rst @@ -0,0 +1,685 @@ +.. bpo: 27704 +.. date: 9155 +.. nonce: RUxzHf +.. release date: 2016-08-15 +.. section: Core and Builtins + +Optimized creating bytes and bytearray from byte-like objects and iterables. +Speed up to 3 times for short objects. Original patch by Naoki Inada. + +.. + +.. bpo: 26823 +.. date: 9154 +.. nonce: UWORiU +.. section: Core and Builtins + +Large sections of repeated lines in tracebacks are now abbreviated as +"[Previous line repeated {count} more times]" by the builtin traceback +rendering. Patch by Emanuel Barry. + +.. + +.. bpo: 27574 +.. date: 9153 +.. nonce: q73Tss +.. section: Core and Builtins + +Decreased an overhead of parsing keyword arguments in functions implemented +with using Argument Clinic. + +.. + +.. bpo: 22557 +.. date: 9152 +.. nonce: Hta2Rz +.. section: Core and Builtins + +Now importing already imported modules is up to 2.5 times faster. + +.. + +.. bpo: 17596 +.. date: 9151 +.. nonce: XgbA9V +.. section: Core and Builtins + +Include to help with Min GW building. + +.. + +.. bpo: 17599 +.. date: 9150 +.. nonce: noy7o1 +.. section: Core and Builtins + +On Windows, rename the privately defined REPARSE_DATA_BUFFER structure to +avoid conflicting with the definition from Min GW. + +.. + +.. bpo: 27507 +.. date: 9149 +.. nonce: 3pX0Be +.. section: Core and Builtins + +Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. + +.. + +.. bpo: 27581 +.. date: 9148 +.. nonce: KezjNt +.. section: Core and Builtins + +Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by +Xiang Zhang. + +.. + +.. bpo: 1621 +.. date: 9147 +.. nonce: _FZWTr +.. section: Core and Builtins + +Avoid signed integer overflow in list and tuple operations. Patch by Xiang +Zhang. + +.. + +.. bpo: 27419 +.. date: 9146 +.. nonce: YaGodL +.. section: Core and Builtins + +Standard __import__() no longer look up "__import__" in globals or builtins +for importing submodules or "from import". Fixed a crash if raise a warning +about unabling to resolve package from __spec__ or __package__. + +.. + +.. bpo: 27083 +.. date: 9145 +.. nonce: F4ZT1C +.. section: Core and Builtins + +Respect the PYTHONCASEOK environment variable under Windows. + +.. + +.. bpo: 27514 +.. date: 9144 +.. nonce: NLbwPG +.. section: Core and Builtins + +Make having too many statically nested blocks a SyntaxError instead of +SystemError. + +.. + +.. bpo: 27366 +.. date: 9143 +.. nonce: VrInsj +.. section: Core and Builtins + +Implemented PEP 487 (Simpler customization of class creation). Upon +subclassing, the __init_subclass__ classmethod is called on the base class. +Descriptors are initialized with __set_name__ after class creation. + +.. + +.. bpo: 26027 +.. date: 9142 +.. nonce: nfVMKM +.. section: Library + +Add PEP 519/__fspath__() support to the os and os.path modules. Includes +code from Jelle Zijlstra. (See also: bpo-27524) + +.. + +.. bpo: 27598 +.. date: 9141 +.. nonce: y7PtEV +.. section: Library + +Add Collections to collections.abc. Patch by Ivan Levkivskyi, docs by Neil +Girdhar. + +.. + +.. bpo: 25958 +.. date: 9140 +.. nonce: X-V4U1 +.. section: Library + +Support "anti-registration" of special methods from various ABCs, like +__hash__, __iter__ or __len__. All these (and several more) can be set to +None in an implementation class and the behavior will be as if the method is +not defined at all. (Previously, this mechanism existed only for __hash__, +to make mutable classes unhashable.) Code contributed by Andrew Barnert and +Ivan Levkivskyi. + +.. + +.. bpo: 16764 +.. date: 9139 +.. nonce: cPbNjL +.. section: Library + +Support keyword arguments to zlib.decompress(). Patch by Xiang Zhang. + +.. + +.. bpo: 27736 +.. date: 9138 +.. nonce: 8kMhpQ +.. section: Library + +Prevent segfault after interpreter re-initialization due to ref count +problem introduced in code for Issue #27038 in 3.6.0a3. Patch by Xiang +Zhang. + +.. + +.. bpo: 25628 +.. date: 9137 +.. nonce: UcQnHF +.. section: Library + +The *verbose* and *rename* parameters for collections.namedtuple are now +keyword-only. + +.. + +.. bpo: 12345 +.. date: 9136 +.. nonce: nbAEM8 +.. section: Library + +Add mathematical constant tau to math and cmath. See also PEP 628. + +.. + +.. bpo: 26823 +.. date: 9135 +.. nonce: HcO8tR +.. section: Library + +traceback.StackSummary.format now abbreviates large sections of repeated +lines as "[Previous line repeated {count} more times]" (this change then +further affects other traceback display operations in the module). Patch by +Emanuel Barry. + +.. + +.. bpo: 27664 +.. date: 9134 +.. nonce: 6DJPxw +.. section: Library + +Add to concurrent.futures.thread.ThreadPoolExecutor() the ability to specify +a thread name prefix. + +.. + +.. bpo: 27181 +.. date: 9133 +.. nonce: 8aw9TZ +.. section: Library + +Add geometric_mean and harmonic_mean to statistics module. + +.. + +.. bpo: 27573 +.. date: 9132 +.. nonce: B7XhTs +.. section: Library + +code.interact now prints an message when exiting. + +.. + +.. bpo: 6422 +.. date: 9131 +.. nonce: iBSc45 +.. section: Library + +Add autorange method to timeit.Timer objects. + +.. + +.. bpo: 27773 +.. date: 9130 +.. nonce: hMSSeX +.. section: Library + +Correct some memory management errors server_hostname in _ssl.wrap_socket(). + +.. + +.. bpo: 26750 +.. date: 9129 +.. nonce: OQn3fr +.. section: Library + +unittest.mock.create_autospec() now works properly for subclasses of +property() and other data descriptors. Removes the never publicly used, +never documented unittest.mock.DescriptorTypes tuple. + +.. + +.. bpo: 26754 +.. date: 9128 +.. nonce: XZqomf +.. section: Library + +Undocumented support of general bytes-like objects as path in compile() and +similar functions is now deprecated. + +.. + +.. bpo: 26800 +.. date: 9127 +.. nonce: QDcK8u +.. section: Library + +Undocumented support of general bytes-like objects as paths in os functions +is now deprecated. + +.. + +.. bpo: 26981 +.. date: 9126 +.. nonce: yhNTCf +.. section: Library + +Add _order_ compatibility shim to enum.Enum for Python 2/3 code bases. + +.. + +.. bpo: 27661 +.. date: 9125 +.. nonce: 3JZckO +.. section: Library + +Added tzinfo keyword argument to datetime.combine. + +.. + +.. bpo: 0 +.. date: 9124 +.. nonce: Ny9oPv +.. section: Library + +In the curses module, raise an error if window.getstr() or window.instr() is +passed a negative value. + +.. + +.. bpo: 27783 +.. date: 9123 +.. nonce: cR1jXH +.. section: Library + +Fix possible usage of uninitialized memory in operator.methodcaller. + +.. + +.. bpo: 27774 +.. date: 9122 +.. nonce: FDcik1 +.. section: Library + +Fix possible Py_DECREF on unowned object in _sre. + +.. + +.. bpo: 27760 +.. date: 9121 +.. nonce: gxMjp4 +.. section: Library + +Fix possible integer overflow in binascii.b2a_qp. + +.. + +.. bpo: 27758 +.. date: 9120 +.. nonce: 0NRV03 +.. section: Library + +Fix possible integer overflow in the _csv module for large record lengths. + +.. + +.. bpo: 27568 +.. date: 9119 +.. nonce: OnuO9s +.. section: Library + +Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the HTTP_PROXY variable +when REQUEST_METHOD environment is set, which indicates that the script is +in CGI mode. + +.. + +.. bpo: 7063 +.. date: 9118 +.. nonce: nXsVKB +.. section: Library + +Remove dead code from the "array" module's slice handling. Patch by Chuck. + +.. + +.. bpo: 27656 +.. date: 9117 +.. nonce: joTscM +.. section: Library + +Do not assume sched.h defines any SCHED_* constants. + +.. + +.. bpo: 27130 +.. date: 9116 +.. nonce: SUxwXZ +.. section: Library + +In the "zlib" module, fix handling of large buffers (typically 4 GiB) when +compressing and decompressing. Previously, inputs were limited to 4 GiB, +and compression and decompression operations did not properly handle results +of 4 GiB. + +.. + +.. bpo: 24773 +.. date: 9115 +.. nonce: IDW05R +.. section: Library + +Implemented PEP 495 (Local Time Disambiguation). + +.. + +.. bpo: 0 +.. date: 9114 +.. nonce: lOkwM8 +.. section: Library + +Expose the EPOLLEXCLUSIVE constant (when it is defined) in the select +module. + +.. + +.. bpo: 27567 +.. date: 9113 +.. nonce: bYOgyw +.. section: Library + +Expose the EPOLLRDHUP and POLLRDHUP constants in the select module. + +.. + +.. bpo: 1621 +.. date: 9112 +.. nonce: 0nclmI +.. section: Library + +Avoid signed int negation overflow in the "audioop" module. + +.. + +.. bpo: 27533 +.. date: 9111 +.. nonce: iDmKzV +.. section: Library + +Release GIL in nt._isdir + +.. + +.. bpo: 17711 +.. date: 9110 +.. nonce: 47AILJ +.. section: Library + +Fixed unpickling by the persistent ID with protocol 0. Original patch by +Alexandre Vassalotti. + +.. + +.. bpo: 27522 +.. date: 9109 +.. nonce: 8vVz_t +.. section: Library + +Avoid an unintentional reference cycle in email.feedparser. + +.. + +.. bpo: 27512 +.. date: 9108 +.. nonce: FaGwup +.. section: Library + +Fix a segfault when os.fspath() called an __fspath__() method that raised an +exception. Patch by Xiang Zhang. + +.. + +.. bpo: 27714 +.. date: 9107 +.. nonce: bUEDsI +.. section: IDLE + +text_textview and test_autocomplete now pass when re-run in the same +process. This occurs when test_idle fails when run with the -w option but +without -jn. Fix warning from test_config. + +.. + +.. bpo: 27621 +.. date: 9106 +.. nonce: BcpOPU +.. section: IDLE + +Put query response validation error messages in the query box itself instead +of in a separate massagebox. Redo tests to match. Add Mac OSX refinements. +Original patch by Mark Roseman. + +.. + +.. bpo: 27620 +.. date: 9105 +.. nonce: TXRR6x +.. section: IDLE + +Escape key now closes Query box as cancelled. + +.. + +.. bpo: 27609 +.. date: 9104 +.. nonce: MbTuKa +.. section: IDLE + +IDLE: tab after initial whitespace should tab, not autocomplete. This fixes +problem with writing docstrings at least twice indented. + +.. + +.. bpo: 27609 +.. date: 9103 +.. nonce: OBYgv_ +.. section: IDLE + +Explicitly return None when there are also non-None returns. In a few cases, +reverse a condition and eliminate a return. + +.. + +.. bpo: 25507 +.. date: 9102 +.. nonce: lxf68d +.. section: IDLE + +IDLE no longer runs buggy code because of its tkinter imports. Users must +include the same imports required to run directly in Python. + +.. + +.. bpo: 27173 +.. date: 9101 +.. nonce: M-fYaV +.. section: IDLE + +Add 'IDLE Modern Unix' to the built-in key sets. Make the default key set +depend on the platform. Add tests for the changes to the config module. + +.. + +.. bpo: 27452 +.. date: 9100 +.. nonce: RtWnyR +.. section: IDLE + +add line counter and crc to IDLE configHandler test dump. + +.. + +.. bpo: 25805 +.. date: 9099 +.. nonce: 9SVxXQ +.. section: Tests + +Skip a test in test_pkgutil as needed that doesn't work when ``__name__ == +__main__``. Patch by SilentGhost. + +.. + +.. bpo: 27472 +.. date: 9098 +.. nonce: NS3L93 +.. section: Tests + +Add test.support.unix_shell as the path to the default shell. + +.. + +.. bpo: 27369 +.. date: 9097 +.. nonce: LG7U2D +.. section: Tests + +In test_pyexpat, avoid testing an error message detail that changed in Expat +2.2.0. + +.. + +.. bpo: 27594 +.. date: 9096 +.. nonce: w3F57B +.. section: Tests + +Prevent assertion error when running test_ast with coverage enabled: ensure +code object has a valid first line number. Patch suggested by Ivan +Levkivskyi. + +.. + +.. bpo: 27647 +.. date: 9095 +.. nonce: -1HUR6 +.. section: Windows + +Update bundled Tcl/Tk to 8.6.6. + +.. + +.. bpo: 27610 +.. date: 9094 +.. nonce: O0o0mB +.. section: Windows + +Adds PEP 514 metadata to Windows installer + +.. + +.. bpo: 27469 +.. date: 9093 +.. nonce: 0GwDkX +.. section: Windows + +Adds a shell extension to the launcher so that drag and drop works +correctly. + +.. + +.. bpo: 27309 +.. date: 9092 +.. nonce: chiOo6 +.. section: Windows + +Enables proper Windows styles in python[w].exe manifest. + +.. + +.. bpo: 27713 +.. date: 9091 +.. nonce: _3DgXG +.. section: Build + +Suppress spurious build warnings when updating importlib's bootstrap files. +Patch by Xiang Zhang + +.. + +.. bpo: 25825 +.. date: 9090 +.. nonce: MLbdVU +.. section: Build + +Correct the references to Modules/python.exp, which is required on AIX. The +references were accidentally changed in 3.5.0a1. + +.. + +.. bpo: 27453 +.. date: 9089 +.. nonce: Pb5DBi +.. section: Build + +CPP invocation in configure must use CPPFLAGS. Patch by Chi Hsuan Yen. + +.. + +.. bpo: 27641 +.. date: 9088 +.. nonce: eGzgCk +.. section: Build + +The configure script now inserts comments into the makefile to prevent the +pgen and _freeze_importlib executables from being cross- compiled. + +.. + +.. bpo: 26662 +.. date: 9087 +.. nonce: XkwRxM +.. section: Build + +Set PYTHON_FOR_GEN in configure as the Python program to be used for file +generation during the build. + +.. + +.. bpo: 10910 +.. date: 9086 +.. nonce: ZdRayb +.. section: Build + +Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD +version checks for the original ctype UTF-8 workaround. diff --git a/Misc/NEWS.d/3.6.0b1.rst b/Misc/NEWS.d/3.6.0b1.rst new file mode 100644 index 00000000000..8e0197fcbca --- /dev/null +++ b/Misc/NEWS.d/3.6.0b1.rst @@ -0,0 +1,1608 @@ +.. bpo: 23722 +.. date: 9319 +.. nonce: C-8boi +.. release date: 2016-09-12 +.. section: Core and Builtins + +The __class__ cell used by zero-argument super() is now initialized from +type.__new__ rather than __build_class__, so class methods relying on that +will now work correctly when called from metaclass methods during class +creation. Patch by Martin Teichmann. + +.. + +.. bpo: 25221 +.. date: 9318 +.. nonce: 9YbOxB +.. section: Core and Builtins + +Fix corrupted result from PyLong_FromLong(0) when Python is compiled with +NSMALLPOSINTS = 0. + +.. + +.. bpo: 27080 +.. date: 9317 +.. nonce: Te4Tjb +.. section: Core and Builtins + +Implement formatting support for PEP 515. Initial patch by Chris Angelico. + +.. + +.. bpo: 27199 +.. date: 9316 +.. nonce: GheADD +.. section: Core and Builtins + +In tarfile, expose copyfileobj bufsize to improve throughput. Patch by Jason +Fried. + +.. + +.. bpo: 27948 +.. date: 9315 +.. nonce: Rpw5nq +.. section: Core and Builtins + +In f-strings, only allow backslashes inside the braces (where the +expressions are). This is a breaking change from the 3.6 alpha releases, +where backslashes are allowed anywhere in an f-string. Also, require that +expressions inside f-strings be enclosed within literal braces, and not +escapes like ``f'\x7b"hi"\x7d'``. + +.. + +.. bpo: 28046 +.. date: 9314 +.. nonce: liHxFW +.. section: Core and Builtins + +Remove platform-specific directories from sys.path. + +.. + +.. bpo: 28071 +.. date: 9313 +.. nonce: PffE44 +.. section: Core and Builtins + +Add early-out for differencing from an empty set. + +.. + +.. bpo: 25758 +.. date: 9312 +.. nonce: yR-YTD +.. section: Core and Builtins + +Prevents zipimport from unnecessarily encoding a filename (patch by Eryk +Sun) + +.. + +.. bpo: 25856 +.. date: 9311 +.. nonce: neCvXl +.. section: Core and Builtins + +The __module__ attribute of extension classes and functions now is interned. +This leads to more compact pickle data with protocol 4. + +.. + +.. bpo: 27213 +.. date: 9310 +.. nonce: VCfkkp +.. section: Core and Builtins + +Rework CALL_FUNCTION* opcodes to produce shorter and more efficient +bytecode. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by +Serhiy Storchaka and Victor Stinner. + +.. + +.. bpo: 26331 +.. date: 9309 +.. nonce: TdJp8_ +.. section: Core and Builtins + +Implement tokenizing support for PEP 515. Patch by Georg Brandl. + +.. + +.. bpo: 27999 +.. date: 9308 +.. nonce: 8aacQj +.. section: Core and Builtins + +Make "global after use" a SyntaxError, and ditto for nonlocal. Patch by Ivan +Levkivskyi. + +.. + +.. bpo: 28003 +.. date: 9307 +.. nonce: noeoav +.. section: Core and Builtins + +Implement PEP 525 -- Asynchronous Generators. + +.. + +.. bpo: 27985 +.. date: 9306 +.. nonce: 0ayJ5k +.. section: Core and Builtins + +Implement PEP 526 -- Syntax for Variable Annotations. Patch by Ivan +Levkivskyi. + +.. + +.. bpo: 26058 +.. date: 9305 +.. nonce: UR_ojv +.. section: Core and Builtins + +Add a new private version to the builtin dict type, incremented at each +dictionary creation and at each dictionary change. Implementation of the PEP +509. + +.. + +.. bpo: 27364 +.. date: 9304 +.. nonce: 8u_LoD +.. section: Core and Builtins + +A backslash-character pair that is not a valid escape sequence now generates +a DeprecationWarning. Patch by Emanuel Barry. + +.. + +.. bpo: 27350 +.. date: 9303 +.. nonce: aABzcL +.. section: Core and Builtins + +`dict` implementation is changed like PyPy. It is more compact and preserves +insertion order. (Concept developed by Raymond Hettinger and patch by Inada +Naoki.) + +.. + +.. bpo: 27911 +.. date: 9302 +.. nonce: 1eaHRd +.. section: Core and Builtins + +Remove unnecessary error checks in ``exec_builtin_or_dynamic()``. + +.. + +.. bpo: 27078 +.. date: 9301 +.. nonce: ZevPQR +.. section: Core and Builtins + +Added BUILD_STRING opcode. Optimized f-strings evaluation. + +.. + +.. bpo: 17884 +.. date: 9300 +.. nonce: wGy0dr +.. section: Core and Builtins + +Python now requires systems with inttypes.h and stdint.h + +.. + +.. bpo: 27961 +.. date: 9299 +.. nonce: EYS8oe +.. section: Core and Builtins + +Require platforms to support ``long long``. Python hasn't compiled without +``long long`` for years, so this is basically a formality. + +.. + +.. bpo: 27355 +.. date: 9298 +.. nonce: qdIpxm +.. section: Core and Builtins + +Removed support for Windows CE. It was never finished, and Windows CE is no +longer a relevant platform for Python. + +.. + +.. bpo: 0 +.. date: 9297 +.. nonce: rdhhVw +.. section: Core and Builtins + +Implement PEP 523. + +.. + +.. bpo: 27870 +.. date: 9296 +.. nonce: Y0u34u +.. section: Core and Builtins + +A left shift of zero by a large integer no longer attempts to allocate large +amounts of memory. + +.. + +.. bpo: 25402 +.. date: 9295 +.. nonce: naeRHq +.. section: Core and Builtins + +In int-to-decimal-string conversion, improve the estimate of the +intermediate memory required, and remove an unnecessarily strict overflow +check. Patch by Serhiy Storchaka. + +.. + +.. bpo: 27214 +.. date: 9294 +.. nonce: CDh8S4 +.. section: Core and Builtins + +In long_invert, be more careful about modifying object returned by long_add, +and remove an unnecessary check for small longs. Thanks Oren Milman for +analysis and patch. + +.. + +.. bpo: 27506 +.. date: 9293 +.. nonce: eK87PI +.. section: Core and Builtins + +Support passing the bytes/bytearray.translate() "delete" argument by +keyword. + +.. + +.. bpo: 27812 +.. date: 9292 +.. nonce: sidcs8 +.. section: Core and Builtins + +Properly clear out a generator's frame's backreference to the generator to +prevent crashes in frame.clear(). + +.. + +.. bpo: 27811 +.. date: 9291 +.. nonce: T4AuBo +.. section: Core and Builtins + +Fix a crash when a coroutine that has not been awaited is finalized with +warnings-as-errors enabled. + +.. + +.. bpo: 27587 +.. date: 9290 +.. nonce: mbavY2 +.. section: Core and Builtins + +Fix another issue found by PVS-Studio: Null pointer check after use of 'def' +in _PyState_AddModule(). Initial patch by Christian Heimes. + +.. + +.. bpo: 27792 +.. date: 9289 +.. nonce: Np6_Hl +.. section: Core and Builtins + +The modulo operation applied to ``bool`` and other ``int`` subclasses now +always returns an ``int``. Previously the return type depended on the input +values. Patch by Xiang Zhang. + +.. + +.. bpo: 26984 +.. date: 9288 +.. nonce: 7--80J +.. section: Core and Builtins + +int() now always returns an instance of exact int. + +.. + +.. bpo: 25604 +.. date: 9287 +.. nonce: UkeHGy +.. section: Core and Builtins + +Fix a minor bug in integer true division; this bug could potentially have +caused off-by-one-ulp results on platforms with unreliable ldexp +implementations. + +.. + +.. bpo: 24254 +.. date: 9286 +.. nonce: 368r1U +.. section: Core and Builtins + +Make class definition namespace ordered by default. + +.. + +.. bpo: 27662 +.. date: 9285 +.. nonce: a8cBpq +.. section: Core and Builtins + +Fix an overflow check in ``List_New``: the original code was checking +against ``Py_SIZE_MAX`` instead of the correct upper bound of +``Py_SSIZE_T_MAX``. Patch by Xiang Zhang. + +.. + +.. bpo: 27782 +.. date: 9284 +.. nonce: C8OBQD +.. section: Core and Builtins + +Multi-phase extension module import now correctly allows the ``m_methods`` +field to be used to add module level functions to instances of non-module +types returned from ``Py_create_mod``. Patch by Xiang Zhang. + +.. + +.. bpo: 27936 +.. date: 9283 +.. nonce: AdOann +.. section: Core and Builtins + +The round() function accepted a second None argument for some types but not +for others. Fixed the inconsistency by accepting None for all numeric +types. + +.. + +.. bpo: 27487 +.. date: 9282 +.. nonce: jeTQNr +.. section: Core and Builtins + +Warn if a submodule argument to "python -m" or runpy.run_module() is found +in sys.modules after parent packages are imported, but before the submodule +is executed. + +.. + +.. bpo: 27157 +.. date: 9281 +.. nonce: Wf_eFE +.. section: Core and Builtins + +Make only type() itself accept the one-argument form. Patch by Eryk Sun and +Emanuel Barry. + +.. + +.. bpo: 27558 +.. date: 9280 +.. nonce: VmltMh +.. section: Core and Builtins + +Fix a SystemError in the implementation of "raise" statement. In a brand new +thread, raise a RuntimeError since there is no active exception to reraise. +Patch written by Xiang Zhang. + +.. + +.. bpo: 28008 +.. date: 9279 +.. nonce: 0DdIrA +.. section: Core and Builtins + +Implement PEP 530 -- asynchronous comprehensions. + +.. + +.. bpo: 27942 +.. date: 9278 +.. nonce: wCAkW5 +.. section: Core and Builtins + +Fix memory leak in codeobject.c + +.. + +.. bpo: 28732 +.. date: 9277 +.. nonce: xkG8k7 +.. section: Library + +Fix crash in os.spawnv() with no elements in args + +.. + +.. bpo: 28485 +.. date: 9276 +.. nonce: WuKqKh +.. section: Library + +Always raise ValueError for negative compileall.compile_dir(workers=...) +parameter, even when multithreading is unavailable. + +.. + +.. bpo: 28037 +.. date: 9275 +.. nonce: -3u7zq +.. section: Library + +Use sqlite3_get_autocommit() instead of setting Connection->inTransaction +manually. + +.. + +.. bpo: 25283 +.. date: 9274 +.. nonce: qwQDX2 +.. section: Library + +Attributes tm_gmtoff and tm_zone are now available on all platforms in the +return values of time.localtime() and time.gmtime(). + +.. + +.. bpo: 24454 +.. date: 9273 +.. nonce: pUTKOA +.. section: Library + +Regular expression match object groups are now accessible using __getitem__. +"mo[x]" is equivalent to "mo.group(x)". + +.. + +.. bpo: 10740 +.. date: 9272 +.. nonce: 8iGFan +.. section: Library + +sqlite3 no longer implicitly commit an open transaction before DDL +statements. + +.. + +.. bpo: 17941 +.. date: 9271 +.. nonce: E9rm_o +.. section: Library + +Add a *module* parameter to collections.namedtuple(). + +.. + +.. bpo: 22493 +.. date: 9270 +.. nonce: yDfUrj +.. section: Library + +Inline flags now should be used only at the start of the regular expression. +Deprecation warning is emitted if uses them in the middle of the regular +expression. + +.. + +.. bpo: 26885 +.. date: 9269 +.. nonce: TJ779X +.. section: Library + +xmlrpc now supports unmarshalling additional data types used by Apache XML- +RPC implementation for numerics and None. + +.. + +.. bpo: 28070 +.. date: 9268 +.. nonce: Kot8Hu +.. section: Library + +Fixed parsing inline verbose flag in regular expressions. + +.. + +.. bpo: 19500 +.. date: 9267 +.. nonce: H7q5im +.. section: Library + +Add client-side SSL session resumption to the ssl module. + +.. + +.. bpo: 28022 +.. date: 9266 +.. nonce: 08kTMg +.. section: Library + +Deprecate ssl-related arguments in favor of SSLContext. The deprecation +include manual creation of SSLSocket and certfile/keyfile (or similar) in +ftplib, httplib, imaplib, smtplib, poplib and urllib. + +.. + +.. bpo: 28043 +.. date: 9265 +.. nonce: 588Oy3 +.. section: Library + +SSLContext has improved default settings: OP_NO_SSLv2, OP_NO_SSLv3, +OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, +OP_SINGLE_ECDH_USE and HIGH ciphers without MD5. + +.. + +.. bpo: 24693 +.. date: 9264 +.. nonce: a63Shp +.. section: Library + +Changed some RuntimeError's in the zipfile module to more appropriate types. +Improved some error messages and debugging output. + +.. + +.. bpo: 17909 +.. date: 9263 +.. nonce: SMNkt6 +.. section: Library + +``json.load`` and ``json.loads`` now support binary input encoded as UTF-8, +UTF-16 or UTF-32. Patch by Serhiy Storchaka. + +.. + +.. bpo: 27137 +.. date: 9262 +.. nonce: frjG8W +.. section: Library + +the pure Python fallback implementation of ``functools.partial`` now matches +the behaviour of its accelerated C counterpart for subclassing, pickling and +text representation purposes. Patch by Emanuel Barry and Serhiy Storchaka. + +.. + +.. bpo: 0 +.. date: 9261 +.. nonce: 81jNns +.. section: Library + +Fix possible integer overflows and crashes in the mmap module with unusual +usage patterns. + +.. + +.. bpo: 1703178 +.. date: 9260 +.. nonce: meb49K +.. section: Library + +Fix the ability to pass the --link-objects option to the distutils build_ext +command. + +.. + +.. bpo: 28019 +.. date: 9259 +.. nonce: KUhBaS +.. section: Library + +itertools.count() no longer rounds non-integer step in range between 1.0 and +2.0 to 1. + +.. + +.. bpo: 18401 +.. date: 9258 +.. nonce: _12WDV +.. section: Library + +Pdb now supports the 'readrc' keyword argument to control whether .pdbrc +files should be read. Patch by Martin Matusiak and Sam Kimbrel. + +.. + +.. bpo: 25969 +.. date: 9257 +.. nonce: qSPkl- +.. section: Library + +Update the lib2to3 grammar to handle the unpacking generalizations added in +3.5. + +.. + +.. bpo: 14977 +.. date: 9256 +.. nonce: 4MvALg +.. section: Library + +mailcap now respects the order of the lines in the mailcap files ("first +match"), as required by RFC 1542. Patch by Michael Lazar. + +.. + +.. bpo: 28082 +.. date: 9255 +.. nonce: EICw4d +.. section: Library + +Convert re flag constants to IntFlag. + +.. + +.. bpo: 28025 +.. date: 9254 +.. nonce: YxcZHY +.. section: Library + +Convert all ssl module constants to IntEnum and IntFlags. SSLContext +properties now return flags and enums. + +.. + +.. bpo: 23591 +.. date: 9253 +.. nonce: 7gSXAN +.. section: Library + +Add Flag, IntFlag, and auto() to enum module. + +.. + +.. bpo: 433028 +.. date: 9252 +.. nonce: yGjT0q +.. section: Library + +Added support of modifier spans in regular expressions. + +.. + +.. bpo: 24594 +.. date: 9251 +.. nonce: 9CnFVS +.. section: Library + +Validates persist parameter when opening MSI database + +.. + +.. bpo: 17582 +.. date: 9250 +.. nonce: MXEHxQ +.. section: Library + +xml.etree.ElementTree nows preserves whitespaces in attributes (Patch by +Duane Griffin. Reviewed and approved by Stefan Behnel.) + +.. + +.. bpo: 28047 +.. date: 9249 +.. nonce: pDu3Fm +.. section: Library + +Fixed calculation of line length used for the base64 CTE in the new email +policies. + +.. + +.. bpo: 27576 +.. date: 9248 +.. nonce: tqZxYv +.. section: Library + +Fix call order in OrderedDict.__init__(). + +.. + +.. bpo: 0 +.. date: 9247 +.. nonce: cxHuUo +.. section: Library + +email.generator.DecodedGenerator now supports the policy keyword. + +.. + +.. bpo: 28027 +.. date: 9246 +.. nonce: v39s1z +.. section: Library + +Remove undocumented modules from ``Lib/plat-*``: IN, CDROM, DLFCN, TYPES, +CDIO, and STROPTS. + +.. + +.. bpo: 27445 +.. date: 9245 +.. nonce: wOG0C0 +.. section: Library + +Don't pass str(_charset) to MIMEText.set_payload(). Patch by Claude Paroz. + +.. + +.. bpo: 24277 +.. date: 9244 +.. nonce: OgDA28 +.. section: Library + +The new email API is no longer provisional, and the docs have been +reorganized and rewritten to emphasize the new API. + +.. + +.. bpo: 22450 +.. date: 9243 +.. nonce: T3Sn_J +.. section: Library + +urllib now includes an ``Accept: */*`` header among the default headers. +This makes the results of REST API requests more consistent and predictable +especially when proxy servers are involved. + +.. + +.. bpo: 0 +.. date: 9242 +.. nonce: PVZStR +.. section: Library + +lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between +runs given the same Grammar.txt input regardless of the hash randomization +setting. + +.. + +.. bpo: 28005 +.. date: 9241 +.. nonce: oJLK1w +.. section: Library + +Allow ImportErrors in encoding implementation to propagate. + +.. + +.. bpo: 26667 +.. date: 9240 +.. nonce: hWs9wA +.. section: Library + +Support path-like objects in importlib.util. + +.. + +.. bpo: 27570 +.. date: 9239 +.. nonce: pU0Zie +.. section: Library + +Avoid zero-length memcpy() etc calls with null source pointers in the +"ctypes" and "array" modules. + +.. + +.. bpo: 22233 +.. date: 9238 +.. nonce: uXSN0R +.. section: Library + +Break email header lines *only* on the RFC specified CR and LF characters, +not on arbitrary unicode line breaks. This also fixes a bug in HTTP header +parsing. + +.. + +.. bpo: 27331 +.. date: 9237 +.. nonce: akOxfh +.. section: Library + +The email.mime classes now all accept an optional policy keyword. + +.. + +.. bpo: 27988 +.. date: 9236 +.. nonce: VfMzZH +.. section: Library + +Fix email iter_attachments incorrect mutation of payload list. + +.. + +.. bpo: 16113 +.. date: 9235 +.. nonce: jyKRxs +.. section: Library + +Add SHA-3 and SHAKE support to hashlib module. + +.. + +.. bpo: 0 +.. date: 9234 +.. nonce: j7npJi +.. section: Library + +Eliminate a tautological-pointer-compare warning in _scproxy.c. + +.. + +.. bpo: 27776 +.. date: 9233 +.. nonce: dOJcUU +.. section: Library + +The :func:`os.urandom` function does now block on Linux 3.17 and newer until +the system urandom entropy pool is initialized to increase the security. +This change is part of the :pep:`524`. + +.. + +.. bpo: 27778 +.. date: 9232 +.. nonce: gvbf3F +.. section: Library + +Expose the Linux ``getrandom()`` syscall as a new :func:`os.getrandom` +function. This change is part of the :pep:`524`. + +.. + +.. bpo: 27691 +.. date: 9231 +.. nonce: TMYF5_ +.. section: Library + +Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 +certs. + +.. + +.. bpo: 18844 +.. date: 9230 +.. nonce: OZnLOi +.. section: Library + +Add random.choices(). + +.. + +.. bpo: 25761 +.. date: 9229 +.. nonce: qd--Ta +.. section: Library + +Improved error reporting about truncated pickle data in C implementation of +unpickler. UnpicklingError is now raised instead of AttributeError and +ValueError in some cases. + +.. + +.. bpo: 26798 +.. date: 9228 +.. nonce: he58yl +.. section: Library + +Add BLAKE2 (blake2b and blake2s) to hashlib. + +.. + +.. bpo: 26032 +.. date: 9227 +.. nonce: v5ByZW +.. section: Library + +Optimized globbing in pathlib by using os.scandir(); it is now about 1.5--4 +times faster. + +.. + +.. bpo: 25596 +.. date: 9226 +.. nonce: TFtyjC +.. section: Library + +Optimized glob() and iglob() functions in the glob module; they are now +about 3--6 times faster. + +.. + +.. bpo: 27928 +.. date: 9225 +.. nonce: vG2f6q +.. section: Library + +Add scrypt (password-based key derivation function) to hashlib module +(requires OpenSSL 1.1.0). + +.. + +.. bpo: 27850 +.. date: 9224 +.. nonce: kIVQ0m +.. section: Library + +Remove 3DES from ssl module's default cipher list to counter measure sweet32 +attack (CVE-2016-2183). + +.. + +.. bpo: 27766 +.. date: 9223 +.. nonce: WI70Tc +.. section: Library + +Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL +1.1.0 or LibreSSL). + +.. + +.. bpo: 25387 +.. date: 9222 +.. nonce: -wsV59 +.. section: Library + +Check return value of winsound.MessageBeep. + +.. + +.. bpo: 27866 +.. date: 9221 +.. nonce: FM3-BZ +.. section: Library + +Add SSLContext.get_ciphers() method to get a list of all enabled ciphers. + +.. + +.. bpo: 27744 +.. date: 9220 +.. nonce: 2cVMpG +.. section: Library + +Add AF_ALG (Linux Kernel crypto) to socket module. + +.. + +.. bpo: 26470 +.. date: 9219 +.. nonce: QGu_wo +.. section: Library + +Port ssl and hashlib module to OpenSSL 1.1.0. + +.. + +.. bpo: 11620 +.. date: 9218 +.. nonce: JyL-Po +.. section: Library + +Fix support for SND_MEMORY in winsound.PlaySound. Based on a patch by Tim +Lesher. + +.. + +.. bpo: 11734 +.. date: 9217 +.. nonce: AQoy-q +.. section: Library + +Add support for IEEE 754 half-precision floats to the struct module. Based +on a patch by Eli Stevens. + +.. + +.. bpo: 27919 +.. date: 9216 +.. nonce: NRqNEW +.. section: Library + +Deprecated ``extra_path`` distribution option in distutils packaging. + +.. + +.. bpo: 23229 +.. date: 9215 +.. nonce: gXhSFh +.. section: Library + +Add new ``cmath`` constants: ``cmath.inf`` and ``cmath.nan`` to match +``math.inf`` and ``math.nan``, and also ``cmath.infj`` and ``cmath.nanj`` to +match the format used by complex repr. + +.. + +.. bpo: 27842 +.. date: 9214 +.. nonce: qlhp0- +.. section: Library + +The csv.DictReader now returns rows of type OrderedDict. (Contributed by +Steve Holden.) + +.. + +.. bpo: 0 +.. date: 9213 +.. nonce: 6TjEgz +.. section: Library + +Remove support for passing a file descriptor to os.access. It never worked +but previously didn't raise. + +.. + +.. bpo: 12885 +.. date: 9212 +.. nonce: r-IV1g +.. section: Library + +Fix error when distutils encounters symlink. + +.. + +.. bpo: 27881 +.. date: 9211 +.. nonce: fkETd9 +.. section: Library + +Fixed possible bugs when setting sqlite3.Connection.isolation_level. Based +on patch by Xiang Zhang. + +.. + +.. bpo: 27861 +.. date: 9210 +.. nonce: DBYuo9 +.. section: Library + +Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a +cursor. Patch by Xiang Zhang. + +.. + +.. bpo: 19884 +.. date: 9209 +.. nonce: MO8AWH +.. section: Library + +Avoid spurious output on OS X with Gnu Readline. + +.. + +.. bpo: 27706 +.. date: 9208 +.. nonce: ZY67yu +.. section: Library + +Restore deterministic behavior of random.Random().seed() for string seeds +using seeding version 1. Allows sequences of calls to random() to exactly +match those obtained in Python 2. Patch by Nofar Schnider. + +.. + +.. bpo: 10513 +.. date: 9207 +.. nonce: tQIQD_ +.. section: Library + +Fix a regression in Connection.commit(). Statements should not be reset +after a commit. + +.. + +.. bpo: 12319 +.. date: 9206 +.. nonce: Wc4oUu +.. section: Library + +Chunked transfer encoding support added to http.client.HTTPConnection +requests. The urllib.request.AbstractHTTPHandler class does not enforce a +Content-Length header any more. If a HTTP request has a file or iterable +body, but no Content-Length header, the library now falls back to use +chunked transfer- encoding. + +.. + +.. bpo: 0 +.. date: 9205 +.. nonce: cYraeH +.. section: Library + +A new version of typing.py from https://github.com/python/typing: - +Collection (only for 3.6) (Issue #27598) - Add FrozenSet to __all__ +(upstream #261) - fix crash in _get_type_vars() (upstream #259) - Remove the +dict constraint in ForwardRef._eval_type (upstream #252) + +.. + +.. bpo: 27832 +.. date: 9204 +.. nonce: hxh6_h +.. section: Library + +Make ``_normalize`` parameter to ``Fraction`` constuctor keyword-only, so +that ``Fraction(2, 3, 4)`` now raises ``TypeError``. + +.. + +.. bpo: 27539 +.. date: 9203 +.. nonce: S4L1cq +.. section: Library + +Fix unnormalised ``Fraction.__pow__`` result in the case of negative +exponent and negative base. + +.. + +.. bpo: 21718 +.. date: 9202 +.. nonce: FUJd-7 +.. section: Library + +cursor.description is now available for queries using CTEs. + +.. + +.. bpo: 27819 +.. date: 9201 +.. nonce: -A_u1x +.. section: Library + +In distutils sdists, simply produce the "gztar" (gzipped tar format) +distributions on all platforms unless "formats" is supplied. + +.. + +.. bpo: 2466 +.. date: 9200 +.. nonce: VRNlkg +.. section: Library + +posixpath.ismount now correctly recognizes mount points which the user does +not have permission to access. + +.. + +.. bpo: 9998 +.. date: 9199 +.. nonce: SNIoPr +.. section: Library + +On Linux, ctypes.util.find_library now looks in LD_LIBRARY_PATH for shared +libraries. + +.. + +.. bpo: 27573 +.. date: 9198 +.. nonce: yuXLnW +.. section: Library + +exit message for code.interact is now configurable. + +.. + +.. bpo: 27930 +.. date: 9197 +.. nonce: BkOfSi +.. section: Library + +Improved behaviour of logging.handlers.QueueListener. Thanks to Paulo +Andrade and Petr Viktorin for the analysis and patch. + +.. + +.. bpo: 6766 +.. date: 9196 +.. nonce: _zO4cV +.. section: Library + +Distributed reference counting added to multiprocessing to support nesting +of shared values / proxy objects. + +.. + +.. bpo: 21201 +.. date: 9195 +.. nonce: wLCKiA +.. section: Library + +Improves readability of multiprocessing error message. Thanks to Wojciech +Walczak for patch. + +.. + +.. bpo: 0 +.. date: 9194 +.. nonce: hgCs-W +.. section: Library + +asyncio: Add set_protocol / get_protocol to Transports. + +.. + +.. bpo: 27456 +.. date: 9193 +.. nonce: lI_IE7 +.. section: Library + +asyncio: Set TCP_NODELAY by default. + +.. + +.. bpo: 15308 +.. date: 9192 +.. nonce: zZxn8m +.. section: IDLE + +Add 'interrupt execution' (^C) to Shell menu. Patch by Roger Serwy, updated +by Bayard Randel. + +.. + +.. bpo: 27922 +.. date: 9191 +.. nonce: UEtEv9 +.. section: IDLE + +Stop IDLE tests from 'flashing' gui widgets on the screen. + +.. + +.. bpo: 27891 +.. date: 9190 +.. nonce: 7W5cAj +.. section: IDLE + +Consistently group and sort imports within idlelib modules. + +.. + +.. bpo: 17642 +.. date: 9189 +.. nonce: B0BNOB +.. section: IDLE + +add larger font sizes for classroom projection. + +.. + +.. bpo: 0 +.. date: 9188 +.. nonce: zWZs6o +.. section: IDLE + +Add version to title of IDLE help window. + +.. + +.. bpo: 25564 +.. date: 9187 +.. nonce: GN0p14 +.. section: IDLE + +In section on IDLE -- console differences, mention that using exec means +that __builtins__ is defined for each statement. + +.. + +.. bpo: 27821 +.. date: 9186 +.. nonce: Vzr42u +.. section: IDLE + +Fix 3.6.0a3 regression that prevented custom key sets from being selected +when no custom theme was defined. + +.. + +.. bpo: 26900 +.. date: 9185 +.. nonce: 0erSIc +.. section: C API + +Excluded underscored names and other private API from limited API. + +.. + +.. bpo: 26027 +.. date: 9184 +.. nonce: 5uVb7n +.. section: C API + +Add support for path-like objects in PyUnicode_FSConverter() & +PyUnicode_FSDecoder(). + +.. + +.. bpo: 27427 +.. date: 9183 +.. nonce: OGhkYQ +.. section: Tests + +Additional tests for the math module. Patch by Francisco Couzo. + +.. + +.. bpo: 27953 +.. date: 9182 +.. nonce: oP3nuf +.. section: Tests + +Skip math and cmath tests that fail on OS X 10.4 due to a poor libm +implementation of tan. + +.. + +.. bpo: 26040 +.. date: 9181 +.. nonce: RvSU5I +.. section: Tests + +Improve test_math and test_cmath coverage and rigour. Patch by Jeff Allen. + +.. + +.. bpo: 27787 +.. date: 9180 +.. nonce: kf0YAt +.. section: Tests + +Call gc.collect() before checking each test for "dangling threads", since +the dangling threads are weak references. + +.. + +.. bpo: 27566 +.. date: 9179 +.. nonce: xDWjEb +.. section: Build + +Fix clean target in freeze makefile (patch by Lisa Roach) + +.. + +.. bpo: 27705 +.. date: 9178 +.. nonce: 8C2Ms3 +.. section: Build + +Update message in validate_ucrtbase.py + +.. + +.. bpo: 27976 +.. date: 9177 +.. nonce: z0CT-3 +.. section: Build + +Deprecate building _ctypes with the bundled copy of libffi on non-OSX UNIX +platforms. + +.. + +.. bpo: 27983 +.. date: 9176 +.. nonce: jL_1n8 +.. section: Build + +Cause lack of llvm-profdata tool when using clang as required for PGO +linking to be a configure time error rather than make time when --with- +optimizations is enabled. Also improve our ability to find the llvm- +profdata tool on MacOS and some Linuxes. + +.. + +.. bpo: 21590 +.. date: 9175 +.. nonce: haPolL +.. section: Build + +Support for DTrace and SystemTap probes. + +.. + +.. bpo: 26307 +.. date: 9174 +.. nonce: Puk2rd +.. section: Build + +The profile-opt build now applies PGO to the built-in modules. + +.. + +.. bpo: 26359 +.. date: 9173 +.. nonce: uxKCqR +.. section: Build + +Add the --with-optimizations flag to turn on LTO and PGO build support when +available. + +.. + +.. bpo: 27917 +.. date: 9172 +.. nonce: 8V2esX +.. section: Build + +Set platform triplets for Android builds. + +.. + +.. bpo: 25825 +.. date: 9171 +.. nonce: PwGiUI +.. section: Build + +Update references to the $(LIBPL) installation path on AIX. This path was +changed in 3.2a4. + +.. + +.. bpo: 0 +.. date: 9170 +.. nonce: G27B6T +.. section: Build + +Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2. + +.. + +.. bpo: 21122 +.. date: 9169 +.. nonce: 98ovv8 +.. section: Build + +Fix LTO builds on OS X. + +.. + +.. bpo: 17128 +.. date: 9168 +.. nonce: jd3Cll +.. section: Build + +Build OS X installer with a private copy of OpenSSL. Also provide a sample +Install Certificates command script to install a set of root certificates +from the third-party certifi module. + +.. + +.. bpo: 27952 +.. date: 9167 +.. nonce: WX9Ufc +.. section: Tools/Demos + +Get Tools/scripts/fixcid.py working with Python 3 and the current "re" +module, avoid invalid Python backslash escapes, and fix a bug parsing +escaped C quote signs. + +.. + +.. bpo: 28065 +.. date: 9166 +.. nonce: TUW63o +.. section: Windows + +Update xz dependency to 5.2.2 and build it from source. + +.. + +.. bpo: 25144 +.. date: 9165 +.. nonce: iUha52 +.. section: Windows + +Ensures TargetDir is set before continuing with custom install. + +.. + +.. bpo: 1602 +.. date: 9164 +.. nonce: 5Kowx0 +.. section: Windows + +Windows console doesn't input or print Unicode (PEP 528) + +.. + +.. bpo: 27781 +.. date: 9163 +.. nonce: 21eQH2 +.. section: Windows + +Change file system encoding on Windows to UTF-8 (PEP 529) + +.. + +.. bpo: 27731 +.. date: 9162 +.. nonce: U2HSrC +.. section: Windows + +Opt-out of MAX_PATH on Windows 10 + +.. + +.. bpo: 6135 +.. date: 9161 +.. nonce: pACuPJ +.. section: Windows + +Adds encoding and errors parameters to subprocess. + +.. + +.. bpo: 27959 +.. date: 9160 +.. nonce: JamSoC +.. section: Windows + +Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup. + +.. + +.. bpo: 27982 +.. date: 9159 +.. nonce: xrUa9R +.. section: Windows + +The functions of the winsound module now accept keyword arguments. + +.. + +.. bpo: 20366 +.. date: 9158 +.. nonce: s6b-ut +.. section: Windows + +Build full text search support into SQLite on Windows. + +.. + +.. bpo: 27756 +.. date: 9157 +.. nonce: PDAoGy +.. section: Windows + +Adds new icons for Python files and processes on Windows. Designs by Cherry +Wang. + +.. + +.. bpo: 27883 +.. date: 9156 +.. nonce: vyOnxj +.. section: Windows + +Update sqlite to 3.14.1.0 on Windows. diff --git a/Misc/NEWS.d/3.6.0b2.rst b/Misc/NEWS.d/3.6.0b2.rst new file mode 100644 index 00000000000..c4857505cc6 --- /dev/null +++ b/Misc/NEWS.d/3.6.0b2.rst @@ -0,0 +1,840 @@ +.. bpo: 28183 +.. date: 9407 +.. nonce: MJZeNd +.. release date: 2016-10-10 +.. section: Core and Builtins + +Optimize and cleanup dict iteration. + +.. + +.. bpo: 26081 +.. date: 9406 +.. nonce: _x5vjl +.. section: Core and Builtins + +Added C implementation of asyncio.Future. Original patch by Yury Selivanov. + +.. + +.. bpo: 28379 +.. date: 9405 +.. nonce: DuXlco +.. section: Core and Builtins + +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. + +.. + +.. bpo: 28376 +.. date: 9404 +.. nonce: oPD-5D +.. section: Core and Builtins + +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. + +.. + +.. bpo: 28376 +.. date: 9403 +.. nonce: YEy-uG +.. section: Core and Builtins + +Creating instances of range_iterator by calling range_iterator type now is +deprecated. Patch by Oren Milman. + +.. + +.. bpo: 28376 +.. date: 9402 +.. nonce: fLeHM2 +.. section: Core and Builtins + +The constructor of range_iterator now checks that step is not 0. Patch by +Oren Milman. + +.. + +.. bpo: 26906 +.. date: 9401 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 9400 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 9399 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28201 +.. date: 9398 +.. nonce: GWUxAy +.. section: Core and Builtins + +Dict reduces possibility of 2nd conflict in hash table when hashes have same +lower bits. + +.. + +.. bpo: 28350 +.. date: 9397 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 26617 +.. date: 9396 +.. nonce: Gh5LvN +.. section: Core and Builtins + +Fix crash when GC runs during weakref callbacks. + +.. + +.. bpo: 27942 +.. date: 9395 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 21578 +.. date: 9394 +.. nonce: GI1bhj +.. section: Core and Builtins + +Fixed misleading error message when ImportError called with invalid keyword +args. + +.. + +.. bpo: 28203 +.. date: 9393 +.. nonce: LRn5vp +.. section: Core and Builtins + +Fix incorrect type in complex(1.0, {2:3}) error message. Patch by Soumya +Sharma. + +.. + +.. bpo: 28086 +.. date: 9392 +.. nonce: JsQPMQ +.. section: Core and Builtins + +Single var-positional argument of tuple subtype was passed unscathed to the +C-defined function. Now it is converted to exact tuple. + +.. + +.. bpo: 28214 +.. date: 9391 +.. nonce: zQF8Em +.. section: Core and Builtins + +Now __set_name__ is looked up on the class instead of the instance. + +.. + +.. bpo: 27955 +.. date: 9390 +.. nonce: HC4pZ4 +.. section: Core and Builtins + +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. + +.. + +.. bpo: 28192 +.. date: 9389 +.. nonce: eR6stU +.. section: Core and Builtins + +Don't import readline in isolated mode. + +.. + +.. bpo: 0 +.. date: 9388 +.. nonce: 9EbOiD +.. section: Core and Builtins + +Upgrade internal unicode databases to Unicode version 9.0.0. + +.. + +.. bpo: 28131 +.. date: 9387 +.. nonce: owq0wW +.. section: Core and Builtins + +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. + +.. + +.. bpo: 28126 +.. date: 9386 +.. nonce: Qf6-uQ +.. section: Core and Builtins + +Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize +memcpy(). + +.. + +.. bpo: 28120 +.. date: 9385 +.. nonce: e5xc1i +.. section: Core and Builtins + +Fix dict.pop() for splitted dictionary when trying to remove a "pending key" +(Not yet inserted in split-table). Patch by Xiang Zhang. + +.. + +.. bpo: 26182 +.. date: 9384 +.. nonce: jYlqTO +.. section: Core and Builtins + +Raise DeprecationWarning when async and await keywords are used as +variable/attribute/class/function name. + +.. + +.. bpo: 27998 +.. date: 9383 +.. nonce: CPhy4H +.. section: Library + +Fixed bytes path support in os.scandir() on Windows. Patch by Eryk Sun. + +.. + +.. bpo: 28317 +.. date: 9382 +.. nonce: LgHleA +.. section: Library + +The disassembler now decodes FORMAT_VALUE argument. + +.. + +.. bpo: 26293 +.. date: 9381 +.. nonce: 2mjvwX +.. section: Library + +Fixed writing ZIP files that starts not from the start of the file. Offsets +in ZIP file now are relative to the start of the archive in conforming to +the specification. + +.. + +.. bpo: 28380 +.. date: 9380 +.. nonce: jKPMzH +.. section: Library + +unittest.mock Mock autospec functions now properly support assert_called, +assert_not_called, and assert_called_once. + +.. + +.. bpo: 27181 +.. date: 9379 +.. nonce: SQyDpC +.. section: Library + +remove statistics.geometric_mean and defer until 3.7. + +.. + +.. bpo: 28229 +.. date: 9378 +.. nonce: BKAxcS +.. section: Library + +lzma module now supports pathlib. + +.. + +.. bpo: 28321 +.. date: 9377 +.. nonce: bQ-IIX +.. section: Library + +Fixed writing non-BMP characters with binary format in plistlib. + +.. + +.. bpo: 28225 +.. date: 9376 +.. nonce: 6N28nu +.. section: Library + +bz2 module now supports pathlib. Initial patch by Ethan Furman. + +.. + +.. bpo: 28227 +.. date: 9375 +.. nonce: 7lUz8i +.. section: Library + +gzip now supports pathlib. Patch by Ethan Furman. + +.. + +.. bpo: 27358 +.. date: 9374 +.. nonce: t288Iv +.. section: Library + +Optimized merging var-keyword arguments and improved error message when +passing a non-mapping as a var-keyword argument. + +.. + +.. bpo: 28257 +.. date: 9373 +.. nonce: SVD_IH +.. section: Library + +Improved error message when passing a non-iterable as a var-positional +argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. + +.. + +.. bpo: 28322 +.. date: 9372 +.. nonce: l9hzap +.. section: Library + +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. + +.. + +.. bpo: 28228 +.. date: 9371 +.. nonce: 1qBwdM +.. section: Library + +imghdr now supports pathlib. + +.. + +.. bpo: 28226 +.. date: 9370 +.. nonce: nMXiwU +.. section: Library + +compileall now supports pathlib. + +.. + +.. bpo: 28314 +.. date: 9369 +.. nonce: N7YrkN +.. section: Library + +Fix function declaration (C flags) for the getiterator() method of +xml.etree.ElementTree.Element. + +.. + +.. bpo: 28148 +.. date: 9368 +.. nonce: Flzndx +.. section: Library + +Stop using localtime() and gmtime() in the time module. + +Introduced platform independent _PyTime_localtime API that is similar to +POSIX localtime_r, but available on all platforms. Patch by Ed Schouten. + +.. + +.. bpo: 28253 +.. date: 9367 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 28275 +.. date: 9366 +.. nonce: EhWIsz +.. section: Library + +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. + +.. + +.. bpo: 27897 +.. date: 9365 +.. nonce: I0Ppmx +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. + +.. + +.. bpo: 18844 +.. date: 9364 +.. nonce: fQsEdn +.. section: Library + +random.choices() now has k as a keyword-only argument to improve the +readability of common cases and come into line with the signature used in +other languages. + +.. + +.. bpo: 18893 +.. date: 9363 +.. nonce: osiX5c +.. section: Library + +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. + +.. + +.. bpo: 27611 +.. date: 9362 +.. nonce: A_ArH_ +.. section: Library + +Fixed support of default root window in the tkinter.tix module. Added the +master parameter in the DisplayStyle constructor. + +.. + +.. bpo: 27348 +.. date: 9361 +.. nonce: tDx7Vw +.. section: Library + +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. + +.. + +.. bpo: 25651 +.. date: 9360 +.. nonce: 3UhyPo +.. section: Library + +Allow falsy values to be used for msg parameter of subTest(). + +.. + +.. bpo: 27778 +.. date: 9359 +.. nonce: Yyo1aP +.. section: Library + +Fix a memory leak in os.getrandom() when the getrandom() is interrupted by a +signal and a signal handler raises a Python exception. + +.. + +.. bpo: 28200 +.. date: 9358 +.. nonce: 4IEbr7 +.. section: Library + +Fix memory leak on Windows in the os module (fix path_converter() function). + +.. + +.. bpo: 25400 +.. date: 9357 +.. nonce: d9Qn0E +.. section: Library + +RobotFileParser now correctly returns default values for crawl_delay and +request_rate. Initial patch by Peter Wirtz. + +.. + +.. bpo: 27932 +.. date: 9356 +.. nonce: mtgl-6 +.. section: Library + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 0 +.. date: 9355 +.. nonce: iPpjqX +.. section: Library + +Fix UnboundLocalError in socket._sendfile_use_sendfile. + +.. + +.. bpo: 28075 +.. date: 9354 +.. nonce: aLiUs9 +.. section: Library + +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. + +.. + +.. bpo: 22493 +.. date: 9353 +.. nonce: Mv_hZf +.. section: Library + +Warning message emitted by using inline flags in the middle of regular +expression now contains a (truncated) regex pattern. Patch by Tim Graham. + +.. + +.. bpo: 25270 +.. date: 9352 +.. nonce: jrZruM +.. section: Library + +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. + +.. + +.. bpo: 28181 +.. date: 9351 +.. nonce: NGc4Yv +.. section: Library + +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +.. + +.. bpo: 25895 +.. date: 9350 +.. nonce: j92qoQ +.. section: Library + +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. + +.. + +.. bpo: 28114 +.. date: 9349 +.. nonce: gmFXsA +.. section: Library + +Fix a crash in parse_envlist() when env contains byte strings. Patch by Eryk +Sun. + +.. + +.. bpo: 27599 +.. date: 9348 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 27906 +.. date: 9347 +.. nonce: TBBXrv +.. section: Library + +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. + +.. + +.. bpo: 28174 +.. date: 9346 +.. nonce: CV1UdI +.. section: Library + +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. + +.. + +.. bpo: 26654 +.. date: 9345 +.. nonce: XtzTE9 +.. section: Library + +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. + +.. + +.. bpo: 26909 +.. date: 9344 +.. nonce: ASiakT +.. section: Library + +Fix slow pipes IO in asyncio. Patch by INADA Naoki. + +.. + +.. bpo: 28176 +.. date: 9343 +.. nonce: sU8R6L +.. section: Library + +Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +.. + +.. bpo: 27759 +.. date: 9342 +.. nonce: qpMDGq +.. section: Library + +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. + +.. + +.. bpo: 28368 +.. date: 9341 +.. nonce: fGl9y4 +.. section: Library + +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. + +.. + +.. bpo: 28369 +.. date: 9340 +.. nonce: 8DTANe +.. section: Library + +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. + +.. + +.. bpo: 28370 +.. date: 9339 +.. nonce: 18jBuZ +.. section: Library + +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. + +.. + +.. bpo: 28371 +.. date: 9338 +.. nonce: U9Zqdk +.. section: Library + +Deprecate passing asyncio.Handles to run_in_executor. + +.. + +.. bpo: 28372 +.. date: 9337 +.. nonce: njcIPk +.. section: Library + +Fix asyncio to support formatting of non-python coroutines. + +.. + +.. bpo: 28399 +.. date: 9336 +.. nonce: QKIqRX +.. section: Library + +Remove UNIX socket from FS before binding. Patch by ????????? ????. + +.. + +.. bpo: 27972 +.. date: 9335 +.. nonce: ZK-GFm +.. section: Library + +Prohibit Tasks to await on themselves. + +.. + +.. bpo: 28402 +.. date: 9334 +.. nonce: v9zETJ +.. section: Windows + +Adds signed catalog files for stdlib on Windows. + +.. + +.. bpo: 28333 +.. date: 9333 +.. nonce: KnpeO4 +.. section: Windows + +Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun) + +.. + +.. bpo: 28251 +.. date: 9332 +.. nonce: tR_AFs +.. section: Windows + +Improvements to help manuals on Windows. + +.. + +.. bpo: 28110 +.. date: 9331 +.. nonce: cnkP5F +.. section: Windows + +launcher.msi has different product codes between 32-bit and 64-bit + +.. + +.. bpo: 28161 +.. date: 9330 +.. nonce: hF91LI +.. section: Windows + +Opening CON for write access fails + +.. + +.. bpo: 28162 +.. date: 9329 +.. nonce: 3FHPVD +.. section: Windows + +WindowsConsoleIO readall() fails if first line starts with Ctrl+Z + +.. + +.. bpo: 28163 +.. date: 9328 +.. nonce: -DUgJw +.. section: Windows + +WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle + +.. + +.. bpo: 28164 +.. date: 9327 +.. nonce: 5MfN0J +.. section: Windows + +_PyIO_get_console_type fails for various paths + +.. + +.. bpo: 28137 +.. date: 9326 +.. nonce: C1uvzY +.. section: Windows + +Renames Windows path file to ._pth + +.. + +.. bpo: 28138 +.. date: 9325 +.. nonce: pNdv64 +.. section: Windows + +Windows ._pth file should allow import site + +.. + +.. bpo: 28426 +.. date: 9324 +.. nonce: zPwvbI +.. section: C API + +Deprecated undocumented functions PyUnicode_AsEncodedObject(), +PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and +PyUnicode_AsEncodedUnicode(). + +.. + +.. bpo: 28258 +.. date: 9323 +.. nonce: iKtAHd +.. section: Build + +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 9322 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 15819 +.. date: 9321 +.. nonce: QVDr3E +.. section: Build + +Remove redundant include search directory option for building outside the +source tree. + +.. + +.. bpo: 28217 +.. date: 9320 +.. nonce: Y37OKV +.. section: Tests + +Adds _testconsole module to test console input. diff --git a/Misc/NEWS.d/3.6.0b3.rst b/Misc/NEWS.d/3.6.0b3.rst new file mode 100644 index 00000000000..c974229d60b --- /dev/null +++ b/Misc/NEWS.d/3.6.0b3.rst @@ -0,0 +1,364 @@ +.. bpo: 28128 +.. date: 9445 +.. nonce: Lc2sFu +.. release date: 2016-10-31 +.. section: Core and Builtins + +Deprecation warning for invalid str and byte escape sequences now prints +better information about where the error occurs. Patch by Serhiy Storchaka +and Eric Smith. + +.. + +.. bpo: 28509 +.. date: 9444 +.. nonce: _Fa4Uq +.. section: Core and Builtins + +dict.update() no longer allocate unnecessary large memory. + +.. + +.. bpo: 28426 +.. date: 9443 +.. nonce: E_quyK +.. section: Core and Builtins + +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. + +.. + +.. bpo: 28517 +.. date: 9442 +.. nonce: ExPkm9 +.. section: Core and Builtins + +Fixed of-by-one error in the peephole optimizer that caused keeping +unreachable code. + +.. + +.. bpo: 28214 +.. date: 9441 +.. nonce: 6ECJox +.. section: Core and Builtins + +Improved exception reporting for problematic __set_name__ attributes. + +.. + +.. bpo: 23782 +.. date: 9440 +.. nonce: lonDzj +.. section: Core and Builtins + +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). + +.. + +.. bpo: 28471 +.. date: 9439 +.. nonce: Vd5pv7 +.. section: Core and Builtins + +Fix "Python memory allocator called without holding the GIL" crash in +socket.setblocking. + +.. + +.. bpo: 26128 +.. date: 9438 +.. nonce: IEF1cf +.. section: Library + +Added keyword-only arguments support for subprocess.STARTUPINFO + +.. + +.. bpo: 27517 +.. date: 9437 +.. nonce: 1CYM8A +.. section: Library + +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. + +.. + +.. bpo: 28549 +.. date: 9436 +.. nonce: ShnM2y +.. section: Library + +Fixed segfault in curses's addch() with ncurses6. + +.. + +.. bpo: 28449 +.. date: 9435 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 23262 +.. date: 9434 +.. nonce: 6EVB7N +.. section: Library + +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. + +.. + +.. bpo: 27939 +.. date: 9433 +.. nonce: mTfADV +.. section: Library + +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. + +.. + +.. bpo: 18844 +.. date: 9432 +.. nonce: oif1-H +.. section: Library + +The various ways of specifying weights for random.choices() now produce the +same result sequences. + +.. + +.. bpo: 28255 +.. date: 9431 +.. nonce: _ZH4wm +.. section: Library + +calendar.TextCalendar().prmonth() no longer prints a space at the start of +new line after printing a month's calendar. Patch by Xiang Zhang. + +.. + +.. bpo: 20491 +.. date: 9430 +.. nonce: ObgnQ2 +.. section: Library + +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. + +.. + +.. bpo: 28353 +.. date: 9429 +.. nonce: sKGbLL +.. section: Library + +os.fwalk() no longer fails on broken links. + +.. + +.. bpo: 28430 +.. date: 9428 +.. nonce: 4MiEYT +.. section: Library + +Fix iterator of C implemented asyncio.Future doesn't accept non-None value +is passed to it.send(val). + +.. + +.. bpo: 27025 +.. date: 9427 +.. nonce: foAViS +.. section: Library + +Generated names for Tkinter widgets now start by the "!" prefix for +readability. + +.. + +.. bpo: 25464 +.. date: 9426 +.. nonce: HDUTCu +.. section: Library + +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. + +.. + +.. bpo: 28488 +.. date: 9425 +.. nonce: TgO112 +.. section: Library + +shutil.make_archive() no longer adds entry "./" to ZIP archive. + +.. + +.. bpo: 25953 +.. date: 9424 +.. nonce: EKKJAQ +.. section: Library + +re.sub() now raises an error for invalid numerical group reference in +replacement template even if the pattern is not found in the string. Error +message for invalid group reference now includes the group index and the +position of the reference. Based on patch by SilentGhost. + +.. + +.. bpo: 18219 +.. date: 9423 +.. nonce: 1ANQN1 +.. section: Library + +Optimize csv.DictWriter for large number of columns. Patch by Mariatta +Wijaya. + +.. + +.. bpo: 28448 +.. date: 9422 +.. nonce: 5bduWe +.. section: Library + +Fix C implemented asyncio.Future didn't work on Windows. + +.. + +.. bpo: 28480 +.. date: 9421 +.. nonce: 9lHw6m +.. section: Library + +Fix error building socket module when multithreading is disabled. + +.. + +.. bpo: 24452 +.. date: 9420 +.. nonce: m9Kyg3 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. + +.. + +.. bpo: 20766 +.. date: 9419 +.. nonce: 4kvCzx +.. section: Library + +Fix references leaked by pdb in the handling of SIGINT handlers. + +.. + +.. bpo: 28492 +.. date: 9418 +.. nonce: pFRLQE +.. section: Library + +Fix how StopIteration exception is raised in _asyncio.Future. + +.. + +.. bpo: 28500 +.. date: 9417 +.. nonce: NINKzZ +.. section: Library + +Fix asyncio to handle async gens GC from another thread. + +.. + +.. bpo: 26923 +.. date: 9416 +.. nonce: 8dh3AV +.. section: Library + +Fix asyncio.Gather to refuse being cancelled once all children are done. +Patch by Johannes Ebke. + +.. + +.. bpo: 26796 +.. date: 9415 +.. nonce: TZyAfJ +.. section: Library + +Don't configure the number of workers for default threadpool executor. +Initial patch by Hans Lawrenz. + +.. + +.. bpo: 28544 +.. date: 9414 +.. nonce: KD1oFP +.. section: Library + +Implement asyncio.Task in C. + +.. + +.. bpo: 28522 +.. date: 9413 +.. nonce: XHMQa7 +.. section: Windows + +Fixes mishandled buffer reallocation in getpathp.c + +.. + +.. bpo: 28444 +.. date: 9412 +.. nonce: zkc9nT +.. section: Build + +Fix missing extensions modules when cross compiling. + +.. + +.. bpo: 28208 +.. date: 9411 +.. nonce: DtoP1i +.. section: Build + +Update Windows build and OS X installers to use SQLite 3.14.2. + +.. + +.. bpo: 28248 +.. date: 9410 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 26944 +.. date: 9409 +.. nonce: ChZ_BO +.. section: Tests + +Fix test_posix for Android where 'id -G' is entirely wrong or missing the +effective gid. + +.. + +.. bpo: 28409 +.. date: 9408 +.. nonce: Q2IlxJ +.. section: Tests + +regrtest: fix the parser of command line arguments. diff --git a/Misc/NEWS.d/3.6.0b4.rst b/Misc/NEWS.d/3.6.0b4.rst new file mode 100644 index 00000000000..326da19dd26 --- /dev/null +++ b/Misc/NEWS.d/3.6.0b4.rst @@ -0,0 +1,327 @@ +.. bpo: 28532 +.. date: 9479 +.. nonce: KEYJny +.. release date: 2016-11-21 +.. section: Core and Builtins + +Show sys.version when -V option is supplied twice. + +.. + +.. bpo: 27100 +.. date: 9478 +.. nonce: poVjXq +.. section: Core and Builtins + +The with-statement now checks for __enter__ before it checks for __exit__. +This gives less confusing error messages when both methods are missing. +Patch by Jonathan Ellington. + +.. + +.. bpo: 28746 +.. date: 9477 +.. nonce: r5MXdB +.. section: Core and Builtins + +Fix the set_inheritable() file descriptor method on platforms that do not +have the ioctl FIOCLEX and FIONCLEX commands. + +.. + +.. bpo: 26920 +.. date: 9476 +.. nonce: 1URwGb +.. section: Core and Builtins + +Fix not getting the locale's charset upon initializing the interpreter, on +platforms that do not have langinfo. + +.. + +.. bpo: 28648 +.. date: 9475 +.. nonce: z7B52W +.. section: Core and Builtins + +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. + +.. + +.. bpo: 19398 +.. date: 9474 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 28665 +.. date: 9473 +.. nonce: v4nx86 +.. section: Core and Builtins + +Improve speed of the STORE_DEREF opcode by 40%. + +.. + +.. bpo: 28583 +.. date: 9472 +.. nonce: F-QAx1 +.. section: Core and Builtins + +PyDict_SetDefault didn't combine split table when needed. Patch by Xiang +Zhang. + +.. + +.. bpo: 27243 +.. date: 9471 +.. nonce: 61E6K5 +.. section: Core and Builtins + +Change PendingDeprecationWarning -> DeprecationWarning. As it was agreed in +the issue, __aiter__ returning an awaitable should result in +PendingDeprecationWarning in 3.5 and in DeprecationWarning in 3.6. + +.. + +.. bpo: 26182 +.. date: 9470 +.. nonce: a8JXK2 +.. section: Core and Builtins + +Fix a refleak in code that raises DeprecationWarning. + +.. + +.. bpo: 28721 +.. date: 9469 +.. nonce: BO9BUF +.. section: Core and Builtins + +Fix asynchronous generators aclose() and athrow() to handle +StopAsyncIteration propagation properly. + +.. + +.. bpo: 28752 +.. date: 9468 +.. nonce: Q-4oRE +.. section: Library + +Restored the __reduce__() methods of datetime objects. + +.. + +.. bpo: 28727 +.. date: 9467 +.. nonce: ubZP_b +.. section: Library + +Regular expression patterns, _sre.SRE_Pattern objects created by +re.compile(), become comparable (only x==y and x!=y operators). This change +should fix the issue #18383: don't duplicate warning filters when the +warnings module is reloaded (thing usually only done in unit tests). + +.. + +.. bpo: 20572 +.. date: 9466 +.. nonce: lGXaH9 +.. section: Library + +The subprocess.Popen.wait method's undocumented endtime parameter now raises +a DeprecationWarning. + +.. + +.. bpo: 25659 +.. date: 9465 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 19717 +.. date: 9464 +.. nonce: HXCAIz +.. section: Library + +Makes Path.resolve() succeed on paths that do not exist. Patch by Vajrasky +Kok + +.. + +.. bpo: 28563 +.. date: 9463 +.. nonce: iweEiw +.. section: Library + +Fixed possible DoS and arbitrary code execution when handle plural form +selections in the gettext module. The expression parser now supports exact +syntax supported by GNU gettext. + +.. + +.. bpo: 28387 +.. date: 9462 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 28600 +.. date: 9461 +.. nonce: wMVrjN +.. section: Library + +Optimize loop.call_soon. + +.. + +.. bpo: 28613 +.. date: 9460 +.. nonce: sqUPrv +.. section: Library + +Fix get_event_loop() return the current loop if called from +coroutines/callbacks. + +.. + +.. bpo: 28634 +.. date: 9459 +.. nonce: YlRydz +.. section: Library + +Fix asyncio.isfuture() to support unittest.Mock. + +.. + +.. bpo: 26081 +.. date: 9458 +.. nonce: 2Y8-a9 +.. section: Library + +Fix refleak in _asyncio.Future.__iter__().throw. + +.. + +.. bpo: 28639 +.. date: 9457 +.. nonce: WUPo1o +.. section: Library + +Fix inspect.isawaitable to always return bool Patch by Justin Mayfield. + +.. + +.. bpo: 28652 +.. date: 9456 +.. nonce: f5M8FG +.. section: Library + +Make loop methods reject socket kinds they do not support. + +.. + +.. bpo: 28653 +.. date: 9455 +.. nonce: S5bA9i +.. section: Library + +Fix a refleak in functools.lru_cache. + +.. + +.. bpo: 28703 +.. date: 9454 +.. nonce: CRLTJc +.. section: Library + +Fix asyncio.iscoroutinefunction to handle Mock objects. + +.. + +.. bpo: 28704 +.. date: 9453 +.. nonce: EFWBII +.. section: Library + +Fix create_unix_server to support Path-like objects (PEP 519). + +.. + +.. bpo: 28720 +.. date: 9452 +.. nonce: Fsz-Lf +.. section: Library + +Add collections.abc.AsyncGenerator. + +.. + +.. bpo: 28513 +.. date: 9451 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 28666 +.. date: 9450 +.. nonce: RtTk-4 +.. section: Tests + +Now test.support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 9449 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 10656 +.. date: 9448 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 9447 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28676 +.. date: 9446 +.. nonce: Wxf6Ds +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. diff --git a/Misc/NEWS.d/3.6.0rc1.rst b/Misc/NEWS.d/3.6.0rc1.rst new file mode 100644 index 00000000000..5e7e2b0af63 --- /dev/null +++ b/Misc/NEWS.d/3.6.0rc1.rst @@ -0,0 +1,122 @@ +.. bpo: 23722 +.. date: 9491 +.. nonce: e8BH5h +.. release date: 2016-12-06 +.. section: Core and Builtins + +Rather than silently producing a class that doesn't support zero-argument +``super()`` in methods, failing to pass the new ``__classcell__`` namespace +entry up to ``type.__new__`` now results in a ``DeprecationWarning`` and a +class that supports zero-argument ``super()``. + +.. + +.. bpo: 28797 +.. date: 9490 +.. nonce: _A0_Z5 +.. section: Core and Builtins + +Modifying the class __dict__ inside the __set_name__ method of a descriptor +that is used inside that class no longer prevents calling the __set_name__ +method of other descriptors. + +.. + +.. bpo: 28782 +.. date: 9489 +.. nonce: foJV_E +.. section: Core and Builtins + +Fix a bug in the implementation ``yield from`` when checking if the next +instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). + +.. + +.. bpo: 27030 +.. date: 9488 +.. nonce: 88FOrz +.. section: Library + +Unknown escapes in re.sub() replacement template are allowed again. But +they still are deprecated and will be disabled in 3.7. + +.. + +.. bpo: 28835 +.. date: 9487 +.. nonce: iWBYH7 +.. section: Library + +Fix a regression introduced in warnings.catch_warnings(): call +warnings.showwarning() if it was overridden inside the context manager. + +.. + +.. bpo: 27172 +.. date: 9486 +.. nonce: mVKfLT +.. section: Library + +To assist with upgrades from 2.7, the previously documented deprecation of +``inspect.getfullargspec()`` has been reversed. This decision may be +revisited again after the Python 2.7 branch is no longer officially +supported. + +.. + +.. bpo: 26273 +.. date: 9485 +.. nonce: ilNIWN +.. section: Library + +Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and +:data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by +Omar Sandoval. + +.. + +.. bpo: 24142 +.. date: 9484 +.. nonce: IrZnFs +.. section: Library + +Reading a corrupt config file left configparser in an invalid state. +Original patch by Florian H?ch. + +.. + +.. bpo: 28843 +.. date: 9483 +.. nonce: O7M0LE +.. section: Library + +Fix asyncio C Task to handle exceptions __traceback__. + +.. + +.. bpo: 28808 +.. date: 9482 +.. nonce: A03X6r +.. section: C API + +PyUnicode_CompareWithASCIIString() now never raises exceptions. + +.. + +.. bpo: 23722 +.. date: 9481 +.. nonce: 6HX6fk +.. section: Documentation + +The data model reference and the porting section in the What's New guide now +cover the additional ``__classcell__`` handling needed for custom +metaclasses to fully support PEP 487 and zero-argument ``super()``. + +.. + +.. bpo: 28023 +.. date: 9480 +.. nonce: 4gzSGp +.. section: Tools/Demos + +Fix python-gdb.py didn't support new dict implementation. diff --git a/Misc/NEWS.d/3.6.0rc2.rst b/Misc/NEWS.d/3.6.0rc2.rst new file mode 100644 index 00000000000..1a2c6462eff --- /dev/null +++ b/Misc/NEWS.d/3.6.0rc2.rst @@ -0,0 +1,45 @@ +.. bpo: 28147 +.. date: 9496 +.. nonce: CnK_xf +.. release date: 2016-12-16 +.. section: Core and Builtins + +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. Patch written by INADA Naoki. + +.. + +.. bpo: 28990 +.. date: 9495 +.. nonce: m8xRMJ +.. section: Core and Builtins + +Fix asyncio SSL hanging if connection is closed before handshake is +completed. (Patch by HoHo-Ho) + +.. + +.. bpo: 28770 +.. date: 9494 +.. nonce: N9GQsz +.. section: Tools/Demos + +Fix python-gdb.py for fastcalls. + +.. + +.. bpo: 28896 +.. date: 9493 +.. nonce: ymAbmH +.. section: Windows + +Deprecate WindowsRegistryFinder. + +.. + +.. bpo: 28898 +.. date: 9492 +.. nonce: YGUd_i +.. section: Build + +Prevent gdb build errors due to HAVE_LONG_LONG redefinition. diff --git a/Misc/NEWS.d/3.6.1rc1.rst b/Misc/NEWS.d/3.6.1rc1.rst new file mode 100644 index 00000000000..244bbbb396d --- /dev/null +++ b/Misc/NEWS.d/3.6.1rc1.rst @@ -0,0 +1,308 @@ +.. bpo: 28932 +.. date: 9529 +.. nonce: QnLx8A +.. release date: XXXX-XX-XX +.. section: Core and Builtins + +Do not include if it does not exist. + +.. + +.. bpo: 25677 +.. date: 9528 +.. nonce: RWhZrb +.. section: Core and Builtins + +Correct the positioning of the syntax error caret for indented blocks. +Based on patch by Michael Layzell. + +.. + +.. bpo: 29000 +.. date: 9527 +.. nonce: K6wQ-3 +.. section: Core and Builtins + +Fixed bytes formatting of octals with zero padding in alternate form. + +.. + +.. bpo: 26919 +.. date: 9526 +.. nonce: Cm7MSa +.. section: Core and Builtins + +On Android, operating system data is now always encoded/decoded to/from +UTF-8, instead of the locale encoding to avoid inconsistencies with +os.fsencode() and os.fsdecode() which are already using UTF-8. + +.. + +.. bpo: 28991 +.. date: 9525 +.. nonce: lGA0FK +.. section: Core and Builtins + +functools.lru_cache() was susceptible to an obscure reentrancy bug +triggerable by a monkey-patched len() function. + +.. + +.. bpo: 28739 +.. date: 9524 +.. nonce: w1fvhk +.. section: Core and Builtins + +f-string expressions are no longer accepted as docstrings and by +ast.literal_eval() even if they do not include expressions. + +.. + +.. bpo: 28512 +.. date: 9523 +.. nonce: i-pv6d +.. section: Core and Builtins + +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +.. + +.. bpo: 28918 +.. date: 9522 +.. nonce: SFVuPz +.. section: Core and Builtins + +Fix the cross compilation of xxlimited when Python has been built with +Py_DEBUG defined. + +.. + +.. bpo: 28731 +.. date: 9521 +.. nonce: oNF59u +.. section: Core and Builtins + +Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of +dict literal with constant keys up to 30%. + +.. + +.. bpo: 29085 +.. date: 9520 +.. nonce: bm3gkx +.. section: Library + +Allow random.Random.seed() to use high quality OS randomness rather than the +pid and time. + +.. + +.. bpo: 28923 +.. date: 9519 +.. nonce: naVULD +.. section: Library + +Remove editor artifacts from Tix.py. + +.. + +.. bpo: 29055 +.. date: 9518 +.. nonce: -r_9jc +.. section: Library + +Neaten-up empty population error on random.choice() by suppressing the +upstream exception. + +.. + +.. bpo: 28871 +.. date: 9517 +.. nonce: cPMXCJ +.. section: Library + +Fixed a crash when deallocate deep ElementTree. + +.. + +.. bpo: 19542 +.. date: 9516 +.. nonce: 5tCkaK +.. section: Library + +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. + +.. + +.. bpo: 20191 +.. date: 9515 +.. nonce: Q7uZCS +.. section: Library + +Fixed a crash in resource.prlimit() when passing a sequence that doesn't own +its elements as limits. + +.. + +.. bpo: 28779 +.. date: 9514 +.. nonce: t-mjED +.. section: Library + +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. + +.. + +.. bpo: 28847 +.. date: 9513 +.. nonce: J7d3nG +.. section: Library + +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. + +.. + +.. bpo: 26937 +.. date: 9512 +.. nonce: c9kgiA +.. section: Library + +The chown() method of the tarfile.TarFile class does not fail now when the +grp module cannot be imported, as for example on Android platforms. + +.. + +.. bpo: 29326 +.. date: 9511 +.. nonce: 4qDQzs +.. section: Windows + +Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) + +.. + +.. bpo: 28164 +.. date: 9510 +.. nonce: h4CFX8 +.. section: Windows + +Correctly handle special console filenames (patch by Eryk Sun) + +.. + +.. bpo: 29409 +.. date: 9509 +.. nonce: bhvrJ2 +.. section: Windows + +Implement PEP 529 for io.FileIO (Patch by Eryk Sun) + +.. + +.. bpo: 29392 +.. date: 9508 +.. nonce: OtqS5t +.. section: Windows + +Prevent crash when passing invalid arguments into msvcrt module. + +.. + +.. bpo: 25778 +.. date: 9507 +.. nonce: 8uKJ82 +.. section: Windows + +winreg does not truncate string correctly (Patch by Eryk Sun) + +.. + +.. bpo: 28896 +.. date: 9506 +.. nonce: VMi9w0 +.. section: Windows + +Deprecate WindowsRegistryFinder and disable it by default. + +.. + +.. bpo: 29349 +.. date: 9505 +.. nonce: PjSo-t +.. section: Documentation + +Fix Python 2 syntax in code for building the documentation. + +.. + +.. bpo: 28950 +.. date: 9504 +.. nonce: 1W8Glo +.. section: Tests + +Disallow -j0 to be combined with -T/-l in regrtest command line arguments. + +.. + +.. bpo: 28683 +.. date: 9503 +.. nonce: Fp-Hdq +.. section: Tests + +Fix the tests that bind() a unix socket and raise PermissionError on Android +for a non-root user. + +.. + +.. bpo: 26939 +.. date: 9502 +.. nonce: 7j_W5R +.. section: Tests + +Add the support.setswitchinterval() function to fix test_functools hanging +on the Android armv7 qemu emulator. + +.. + +.. bpo: 28762 +.. date: 9501 +.. nonce: Ru0YN_ +.. section: Build + +lockf() is available on Android API level 24, but the F_LOCK macro is not +defined in android-ndk-r13. + +.. + +.. bpo: 28538 +.. date: 9500 +.. nonce: FqtN7v +.. section: Build + +Fix the compilation error that occurs because if_nameindex() is available on +Android API level 24, but the if_nameindex structure is not defined. + +.. + +.. bpo: 20211 +.. date: 9499 +.. nonce: gpNptI +.. section: Build + +Do not add the directory for installing C header files and the directory for +installing object code libraries to the cross compilation search paths. +Original patch by Thomas Petazzoni. + +.. + +.. bpo: 28849 +.. date: 9498 +.. nonce: AzRRF5 +.. section: Build + +Do not define sys.implementation._multiarch on Android. diff --git a/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst b/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst new file mode 100644 index 00000000000..89dcfc79aab --- /dev/null +++ b/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst @@ -0,0 +1,2 @@ +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. diff --git a/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst b/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst new file mode 100644 index 00000000000..b5fdd6c8b66 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst @@ -0,0 +1,2 @@ +Remove redundant include search directory option for building outside the +source tree. diff --git a/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst b/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst new file mode 100644 index 00000000000..305fea89328 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst @@ -0,0 +1,3 @@ +A full copy of libffi is no longer bundled for use when building _ctypes on +non-OSX UNIX platforms. An installed copy of libffi is now required when +building _ctypes on such platforms. diff --git a/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst b/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst new file mode 100644 index 00000000000..af6057ab781 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst @@ -0,0 +1 @@ +setup.py now detects system libffi with multiarch wrapper. diff --git a/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst b/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst new file mode 100644 index 00000000000..b53e9479e5a --- /dev/null +++ b/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst @@ -0,0 +1,2 @@ +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. diff --git a/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst b/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst new file mode 100644 index 00000000000..f470ccdea6a --- /dev/null +++ b/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst @@ -0,0 +1,2 @@ +Add configure check for siginfo_t.si_band, which Cygwin does not provide. +Patch by Masayuki Yamamoto with review and rebase by Erik Bray. diff --git a/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst b/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst new file mode 100644 index 00000000000..b898c922d24 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst @@ -0,0 +1,2 @@ +Fix building extensions modules on Cygwin. Patch by Roumen Petrov, based on +original patch by Jason Tishler. diff --git a/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst b/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst new file mode 100644 index 00000000000..85743127a28 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst @@ -0,0 +1,2 @@ +Fix building the _struct module on Cygwin by passing ``NULL`` instead of +``&PyType_Type`` to PyVarObject_HEAD_INIT. Patch by Masayuki Yamamoto. diff --git a/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst b/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst new file mode 100644 index 00000000000..18d36930524 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst @@ -0,0 +1 @@ +Update Windows build and OS X installers to use OpenSSL 1.0.2j. diff --git a/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst b/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst new file mode 100644 index 00000000000..2deaf02c6dd --- /dev/null +++ b/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst @@ -0,0 +1 @@ +Update Windows build and OS X installers to use SQLite 3.14.2. diff --git a/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst b/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst new file mode 100644 index 00000000000..1df68241ca9 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst @@ -0,0 +1 @@ +Fix missing extensions modules when cross compiling. diff --git a/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst b/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst new file mode 100644 index 00000000000..581ddaf48c4 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst @@ -0,0 +1 @@ +Rename --with-optimiations to --enable-optimizations. diff --git a/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst b/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst new file mode 100644 index 00000000000..62cc5469b05 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst @@ -0,0 +1,2 @@ +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. diff --git a/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst b/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst new file mode 100644 index 00000000000..9aac0219edc --- /dev/null +++ b/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst @@ -0,0 +1 @@ +Do not define sys.implementation._multiarch on Android. diff --git a/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst b/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst new file mode 100644 index 00000000000..8bbea8d6a8a --- /dev/null +++ b/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst @@ -0,0 +1,3 @@ +Do not add the directory for installing C header files and the directory for +installing object code libraries to the cross compilation search paths. +Original patch by Thomas Petazzoni. diff --git a/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst b/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst new file mode 100644 index 00000000000..ddaf34a5c74 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst @@ -0,0 +1,2 @@ +Fix the compilation error that occurs because if_nameindex() is available on +Android API level 24, but the if_nameindex structure is not defined. diff --git a/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst b/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst new file mode 100644 index 00000000000..0bfb77e442b --- /dev/null +++ b/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst @@ -0,0 +1,2 @@ +lockf() is available on Android API level 24, but the F_LOCK macro is not +defined in android-ndk-r13. diff --git a/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst b/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst new file mode 100644 index 00000000000..39ff22212a0 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst @@ -0,0 +1 @@ +Added missed names to PC/python3.def. diff --git a/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst b/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst new file mode 100644 index 00000000000..3a4b7bf4e12 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst @@ -0,0 +1 @@ +Removes hard dependency on hg.exe from PCBuild/build.bat diff --git a/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst b/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst new file mode 100644 index 00000000000..702e14e1a94 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst @@ -0,0 +1 @@ +Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto diff --git a/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst b/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst new file mode 100644 index 00000000000..1b34a703d33 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst @@ -0,0 +1 @@ +Set Android compilation and link flags. diff --git a/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst b/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst new file mode 100644 index 00000000000..ccd28085fcc --- /dev/null +++ b/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst @@ -0,0 +1 @@ +Remove old Be OS helper scripts. diff --git a/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst b/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst new file mode 100644 index 00000000000..d7206592860 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst @@ -0,0 +1,3 @@ +Prohibit implicit C function declarations: use -Werror=implicit-function- +declaration when possible (GCC and Clang, but it depends on the compiler +version). Patch written by Chi Hsuan Yen. diff --git a/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst b/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst new file mode 100644 index 00000000000..9bf71f90d81 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst @@ -0,0 +1 @@ +Update Windows build and OS X installers to use OpenSSL 1.0.2k. diff --git a/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst b/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst new file mode 100644 index 00000000000..5b345e67a86 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst @@ -0,0 +1,3 @@ +sys.version and the platform module python_build(), python_branch(), and +python_revision() functions now use git information rather than hg when +building from a repo. diff --git a/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst b/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst new file mode 100644 index 00000000000..65b958ffef4 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst @@ -0,0 +1 @@ +Fix ``--enable-optimization`` didn't work. diff --git a/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst b/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst new file mode 100644 index 00000000000..0addfd094f1 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst @@ -0,0 +1,2 @@ +Don't regenerate generated files based on file modification time anymore: +the action is now explicit. Replace ``make touch`` with ``make regen-all``. diff --git a/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst b/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst new file mode 100644 index 00000000000..378e49f67bc --- /dev/null +++ b/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst @@ -0,0 +1,3 @@ +Prevent unnecessary rebuilding of Python during ``make test``, ``make +install`` and some other make targets when configured with ``--enable- +optimizations``. diff --git a/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst b/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst new file mode 100644 index 00000000000..13ff8372e5c --- /dev/null +++ b/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst @@ -0,0 +1 @@ +Fix out-of-tree builds of Python when configured with ``--with--dtrace``. diff --git a/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst b/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst new file mode 100644 index 00000000000..d36c9c0c8cd --- /dev/null +++ b/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst @@ -0,0 +1,2 @@ +Add ``--with-assertions`` configure flag to explicitly enable C ``assert()`` +checks. Defaults to off. ``--with-pydebug`` implies ``--with-assertions``. diff --git a/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst b/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst new file mode 100644 index 00000000000..3eb76d7764f --- /dev/null +++ b/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst @@ -0,0 +1,2 @@ +Support the *disabled* marker in Setup files. Extension modules listed after +this marker are not built at all, neither by the Makefile nor by setup.py. diff --git a/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst b/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst new file mode 100644 index 00000000000..9f37c075b84 --- /dev/null +++ b/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst @@ -0,0 +1 @@ +Locate msbuild.exe on Windows when building rather than vcvarsall.bat diff --git a/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst b/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst new file mode 100644 index 00000000000..9f18b725113 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst @@ -0,0 +1,3 @@ +Deprecated undocumented functions PyUnicode_AsEncodedObject(), +PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and +PyUnicode_AsEncodedUnicode(). diff --git a/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst b/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst new file mode 100644 index 00000000000..703569af382 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst @@ -0,0 +1 @@ +Compiler warnings are now emitted if use most of deprecated functions. diff --git a/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst b/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst new file mode 100644 index 00000000000..c0de814654f --- /dev/null +++ b/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst @@ -0,0 +1,2 @@ +Private variable _Py_PackageContext is now of type ``const char *`` rather +of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst b/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst new file mode 100644 index 00000000000..659edc15bfe --- /dev/null +++ b/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst @@ -0,0 +1,3 @@ +The fields name and doc of structures PyMemberDef, PyGetSetDef, +PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of +type ``const char *`` rather of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst b/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst new file mode 100644 index 00000000000..61276cdcc3d --- /dev/null +++ b/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst @@ -0,0 +1 @@ +PyUnicode_CompareWithASCIIString() now never raises exceptions. diff --git a/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst b/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst new file mode 100644 index 00000000000..63a13c88528 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst @@ -0,0 +1,2 @@ +The index parameters *start* and *end* of PyUnicode_FindChar() are now +adjusted to behave like ``str[start:end]``. diff --git a/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst b/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst new file mode 100644 index 00000000000..6f2fd6d05e7 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst @@ -0,0 +1,3 @@ +All stable API extensions added after Python 3.2 are now available only when +Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python +version supporting this API. diff --git a/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst b/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst new file mode 100644 index 00000000000..e2e7570ca98 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst @@ -0,0 +1,2 @@ +The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8() is now of +type ``const char *`` rather of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst b/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst new file mode 100644 index 00000000000..639fc25c972 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst @@ -0,0 +1,5 @@ +Fixed the declaration of some public API functions. PyArg_VaParse() and +PyArg_VaParseTupleAndKeywords() were not available in limited API. +PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() +were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is +defined. diff --git a/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst b/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst new file mode 100644 index 00000000000..dbfeede9bfc --- /dev/null +++ b/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst @@ -0,0 +1,4 @@ +Function PySlice_GetIndicesEx() is deprecated and replaced with a macro if +Py_LIMITED_API is not set or set to the value between 0x03050400 and +0x03060000 (not including) or 0x03060100 or higher. Added functions +PySlice_Unpack() and PySlice_AdjustIndices(). diff --git a/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst b/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst new file mode 100644 index 00000000000..82b8e6b0b2f --- /dev/null +++ b/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst @@ -0,0 +1,3 @@ +The type of results of PyThread_start_new_thread() and +PyThread_get_thread_ident(), and the id parameter of +PyThreadState_SetAsyncExc() changed from "long" to "unsigned long". diff --git a/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst b/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst new file mode 100644 index 00000000000..521aea80bd6 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst @@ -0,0 +1,2 @@ +Deprecate PyOS_AfterFork() and add PyOS_BeforeFork(), +PyOS_AfterFork_Parent() and PyOS_AfterFork_Child(). diff --git a/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst b/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst new file mode 100644 index 00000000000..f74ca22b184 --- /dev/null +++ b/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst @@ -0,0 +1,2 @@ +PyUnicode_AsWideCharString() now raises a ValueError if the second argument +is NULL and the wchar_t\* string contains null characters. diff --git a/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst b/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst new file mode 100644 index 00000000000..b0f63ad24e9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst @@ -0,0 +1 @@ +Speed-up method calls: add LOAD_METHOD and CALL_METHOD opcodes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst b/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst new file mode 100644 index 00000000000..3dbd1a3168f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst @@ -0,0 +1,2 @@ +Fix asynchronous generators aclose() and athrow() to handle +StopAsyncIteration propagation properly. diff --git a/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst b/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst new file mode 100644 index 00000000000..e856dd28e9f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst @@ -0,0 +1 @@ +Fix a refleak in code that raises DeprecationWarning. diff --git a/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst b/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst new file mode 100644 index 00000000000..a02818573c2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst @@ -0,0 +1,2 @@ +Raise DeprecationWarning when async and await keywords are used as +variable/attribute/class/function name. diff --git a/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst b/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst new file mode 100644 index 00000000000..55775ebab3f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst @@ -0,0 +1,2 @@ +Fix dict.pop() for splitted dictionary when trying to remove a "pending key" +(Not yet inserted in split-table). Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst b/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst new file mode 100644 index 00000000000..162ee3815cd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst @@ -0,0 +1,2 @@ +Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize +memcpy(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst b/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst new file mode 100644 index 00000000000..f532fa17d19 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst @@ -0,0 +1,2 @@ +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. diff --git a/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst b/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst new file mode 100644 index 00000000000..b72692d191f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst @@ -0,0 +1 @@ +Upgrade internal unicode databases to Unicode version 9.0.0. diff --git a/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst b/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst new file mode 100644 index 00000000000..93410fa121c --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst @@ -0,0 +1 @@ +Clean up redundant code in long_rshift function. Thanks Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst b/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst new file mode 100644 index 00000000000..2dd799d63b3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst @@ -0,0 +1,2 @@ +Remove some redundant assignments to ob_size in longobject.c. Thanks Oren +Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst b/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst new file mode 100644 index 00000000000..cc6e57cb3d6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst @@ -0,0 +1 @@ +Don't import readline in isolated mode. diff --git a/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst b/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst new file mode 100644 index 00000000000..d977df70dcc --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst @@ -0,0 +1,2 @@ +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. diff --git a/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst b/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst new file mode 100644 index 00000000000..29afe9cb122 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst @@ -0,0 +1 @@ +Now __set_name__ is looked up on the class instead of the instance. diff --git a/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst b/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst new file mode 100644 index 00000000000..faa9e3cf46e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst @@ -0,0 +1,2 @@ +Single var-positional argument of tuple subtype was passed unscathed to the +C-defined function. Now it is converted to exact tuple. diff --git a/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst b/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst new file mode 100644 index 00000000000..687a7e9aeb3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst @@ -0,0 +1,2 @@ +Fix incorrect type in complex(1.0, {2:3}) error message. Patch by Soumya +Sharma. diff --git a/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst b/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst new file mode 100644 index 00000000000..15c4de36950 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst @@ -0,0 +1,2 @@ +Fixed misleading error message when ImportError called with invalid keyword +args. diff --git a/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst b/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst new file mode 100644 index 00000000000..577e3f0a9b2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst @@ -0,0 +1 @@ +ImportError.__init__ now resets not specified attributes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst b/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst new file mode 100644 index 00000000000..ca8dfef90ae --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst @@ -0,0 +1 @@ +String constants now interned recursively in tuples and frozensets. diff --git a/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst b/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst new file mode 100644 index 00000000000..c3a41396df8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst @@ -0,0 +1 @@ +Fix crash when GC runs during weakref callbacks. diff --git a/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst b/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst new file mode 100644 index 00000000000..013b3e13fab --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst @@ -0,0 +1 @@ +String constants with null character no longer interned. diff --git a/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst b/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst new file mode 100644 index 00000000000..d1b56f52909 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst @@ -0,0 +1,2 @@ +Dict reduces possibility of 2nd conflict in hash table when hashes have same +lower bits. diff --git a/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst b/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst new file mode 100644 index 00000000000..82897ed22f3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst @@ -0,0 +1 @@ +Fixed possible crash when AST is changed in process of compiling it. diff --git a/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst b/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst new file mode 100644 index 00000000000..5ed03823842 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst @@ -0,0 +1,2 @@ +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. diff --git a/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst b/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst new file mode 100644 index 00000000000..9927fc9441b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst @@ -0,0 +1,2 @@ +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. diff --git a/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst b/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst new file mode 100644 index 00000000000..48cd8ca3547 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst @@ -0,0 +1,3 @@ +Creating instances of range_iterator by calling range_iterator type now is +disallowed. Calling iter() on range instance is the only way. Patch by Oren +Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst b/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst new file mode 100644 index 00000000000..0beccca88e9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst @@ -0,0 +1,2 @@ +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst b/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst new file mode 100644 index 00000000000..023812b6291 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst @@ -0,0 +1,2 @@ +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst b/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst new file mode 100644 index 00000000000..ada55163762 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst @@ -0,0 +1 @@ +Added C implementation of asyncio.Future. Original patch by Yury Selivanov. diff --git a/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst b/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst new file mode 100644 index 00000000000..2453de1d600 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst @@ -0,0 +1 @@ +Optimize and cleanup dict iteration. diff --git a/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst b/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst new file mode 100644 index 00000000000..36e85d8f2dc --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst @@ -0,0 +1,2 @@ +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst b/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst new file mode 100644 index 00000000000..b73c752dc2e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst @@ -0,0 +1 @@ +Improved exception reporting for problematic __set_name__ attributes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst b/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst new file mode 100644 index 00000000000..96ef7e082d5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst @@ -0,0 +1,2 @@ +Fixed of-by-one error in the peephole optimizer that caused keeping +unreachable code. diff --git a/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst b/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst new file mode 100644 index 00000000000..f21b3db00cf --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst @@ -0,0 +1 @@ +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. diff --git a/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst b/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst new file mode 100644 index 00000000000..040b7e7764e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst @@ -0,0 +1 @@ +dict.update() no longer allocate unnecessary large memory. diff --git a/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst b/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst new file mode 100644 index 00000000000..aac57afe022 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst @@ -0,0 +1,3 @@ +Deprecation warning for invalid str and byte escape sequences now prints +better information about where the error occurs. Patch by Serhiy Storchaka +and Eric Smith. diff --git a/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst b/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst new file mode 100644 index 00000000000..9ead27d33de --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst @@ -0,0 +1,2 @@ +PyDict_SetDefault didn't combine split table when needed. Patch by Xiang +Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst b/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst new file mode 100644 index 00000000000..cfc9737b72b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst @@ -0,0 +1 @@ +Optimize iterating split table values. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst b/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst new file mode 100644 index 00000000000..41d9b728140 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst @@ -0,0 +1,2 @@ +Sped up converting int to float by reusing faster bits counting +implementation. Patch by Adrian Wielgosik. diff --git a/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst b/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst new file mode 100644 index 00000000000..ba89b2a113f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst @@ -0,0 +1,2 @@ +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. diff --git a/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst b/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst new file mode 100644 index 00000000000..b9e965d11de --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst @@ -0,0 +1 @@ +Improve speed of the STORE_DEREF opcode by 40%. diff --git a/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst b/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst new file mode 100644 index 00000000000..48b17ff194a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst @@ -0,0 +1,2 @@ +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst b/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst new file mode 100644 index 00000000000..7d003d075f9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst @@ -0,0 +1,2 @@ +Fix not getting the locale's charset upon initializing the interpreter, on +platforms that do not have langinfo. diff --git a/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst b/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst new file mode 100644 index 00000000000..28a6112e89b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst @@ -0,0 +1,2 @@ +Fix the set_inheritable() file descriptor method on platforms that do not +have the ioctl FIOCLEX and FIONCLEX commands. diff --git a/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst b/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst new file mode 100644 index 00000000000..a5c27b6fa4b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst @@ -0,0 +1,3 @@ +The with-statement now checks for __enter__ before it checks for __exit__. +This gives less confusing error messages when both methods are missing. +Patch by Jonathan Ellington. diff --git a/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst b/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst new file mode 100644 index 00000000000..3a058ac82c3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst @@ -0,0 +1 @@ +Show sys.version when -V option is supplied twice. diff --git a/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst b/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst new file mode 100644 index 00000000000..a2fa1d5027e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst @@ -0,0 +1,2 @@ +Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of +dict literal with constant keys up to 30%. diff --git a/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst b/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst new file mode 100644 index 00000000000..1f67061b168 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst @@ -0,0 +1,4 @@ +Fix error position of the unicode error in ASCII and Latin1 encoders when a +string returned by the error handler contains multiple non-encodable +characters (non-ASCII for the ASCII codec, characters out of the +U+0000-U+00FF range for Latin1). diff --git a/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst b/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst new file mode 100644 index 00000000000..7a1ab498406 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst @@ -0,0 +1,2 @@ +Fix a bug in the implementation ``yield from`` when checking if the next +instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). diff --git a/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst b/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst new file mode 100644 index 00000000000..3704fbaf0fb --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst @@ -0,0 +1 @@ +More than 255 arguments can now be passed to a function. diff --git a/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst b/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst new file mode 100644 index 00000000000..95fe72c0e71 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst @@ -0,0 +1,4 @@ +Remove the ``PyEval_GetCallStats()`` function and deprecate the untested and +undocumented ``sys.callstats()`` function. Remove the ``CALL_PROFILE`` +special build: use the :func:`sys.setprofile` function, :mod:`cProfile` or +:mod:`profile` to profile function calls. diff --git a/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst b/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst new file mode 100644 index 00000000000..8735cad80ca --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst @@ -0,0 +1,3 @@ +Modifying the class __dict__ inside the __set_name__ method of a descriptor +that is used inside that class no longer prevents calling the __set_name__ +method of other descriptors. diff --git a/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst b/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst new file mode 100644 index 00000000000..b387559db31 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst @@ -0,0 +1,4 @@ +Rather than silently producing a class that doesn't support zero-argument +``super()`` in methods, failing to pass the new ``__classcell__`` namespace +entry up to ``type.__new__`` now results in a ``DeprecationWarning`` and a +class that supports zero-argument ``super()``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst b/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst new file mode 100644 index 00000000000..a3b924753a8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst @@ -0,0 +1,2 @@ +Fix the cross compilation of xxlimited when Python has been built with +Py_DEBUG defined. diff --git a/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst b/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst new file mode 100644 index 00000000000..058da76ca79 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst @@ -0,0 +1,2 @@ +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst b/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst new file mode 100644 index 00000000000..10be6c33d94 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst @@ -0,0 +1,2 @@ +f-string expressions are no longer accepted as docstrings and by +ast.literal_eval() even if they do not include expressions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst b/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst new file mode 100644 index 00000000000..61882116776 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst @@ -0,0 +1,2 @@ +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. Patch written by INADA Naoki. diff --git a/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst b/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst new file mode 100644 index 00000000000..f9999731db0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst @@ -0,0 +1,2 @@ +functools.lru_cache() was susceptible to an obscure reentrancy bug +triggerable by a monkey-patched len() function. diff --git a/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst b/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst new file mode 100644 index 00000000000..7be06401e41 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst @@ -0,0 +1,3 @@ +On Android, operating system data is now always encoded/decoded to/from +UTF-8, instead of the locale encoding to avoid inconsistencies with +os.fsencode() and os.fsdecode() which are already using UTF-8. diff --git a/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst b/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst new file mode 100644 index 00000000000..a5a89e13450 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst @@ -0,0 +1 @@ +Clean up interpreter startup (see PEP 432). diff --git a/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst b/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst new file mode 100644 index 00000000000..9f63ef982a9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst @@ -0,0 +1 @@ +The preferred encoding is UTF-8 on Android. Patch written by Chi Hsuan Yen. diff --git a/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst b/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst new file mode 100644 index 00000000000..a67dc93dfb8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst @@ -0,0 +1,2 @@ +Python function can now have more than 255 parameters. +collections.namedtuple() now supports tuples with more than 255 elements. diff --git a/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst b/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst new file mode 100644 index 00000000000..94c8b054e87 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst @@ -0,0 +1 @@ +Fixed bytes formatting of octals with zero padding in alternate form. diff --git a/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst b/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst new file mode 100644 index 00000000000..f665835a296 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst @@ -0,0 +1,2 @@ +Correct the positioning of the syntax error caret for indented blocks. +Based on patch by Michael Layzell. diff --git a/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst b/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst new file mode 100644 index 00000000000..e20901189b2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst @@ -0,0 +1 @@ +Do not include if it does not exist. diff --git a/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst b/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst new file mode 100644 index 00000000000..39358cd29c8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst @@ -0,0 +1,2 @@ +bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not +only spaces. Patch by Robert Xiao. diff --git a/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst b/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst new file mode 100644 index 00000000000..ff50abd37a9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst @@ -0,0 +1,2 @@ +Call _PyObject_GC_TRACK() lazily when calling Python function. Calling +function is up to 5% faster. diff --git a/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst b/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst new file mode 100644 index 00000000000..e67ea280100 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst @@ -0,0 +1 @@ +Fix regression in bytes(x) when x.__index__() raises Exception. diff --git a/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst b/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst new file mode 100644 index 00000000000..a356cd784e3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst @@ -0,0 +1 @@ +Fix memory leak and use-after-free in os module (path_converter). diff --git a/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst b/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst new file mode 100644 index 00000000000..f23bad0bc1a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst @@ -0,0 +1 @@ +Fixed a crash when pass the iterable keyword argument to sorted(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst b/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst new file mode 100644 index 00000000000..201325cbf6c --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst @@ -0,0 +1,2 @@ +Fixed possible BytesWarning when compare the code objects. Warnings could be +emitted at compile time. diff --git a/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst b/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst new file mode 100644 index 00000000000..254d8731d56 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst @@ -0,0 +1 @@ +Prevent RunMainFromImporter overwriting sys.path[0]. diff --git a/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst b/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst new file mode 100644 index 00000000000..a9d4bdbabd1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst @@ -0,0 +1,2 @@ +If max_line_length=None is specified while using the Compat32 policy, it is +no longer ignored. Patch by Mircea Cosbuc. diff --git a/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst b/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst new file mode 100644 index 00000000000..cb60a48a3c0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst @@ -0,0 +1 @@ +Improve from-import error message with location diff --git a/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst b/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst new file mode 100644 index 00000000000..0868cd17bea --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst @@ -0,0 +1,2 @@ +Set the 'path' and 'name' attribute on ImportError for ``from ... import +...``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst b/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst new file mode 100644 index 00000000000..e3eecb6136e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst @@ -0,0 +1 @@ +Fixed use-after-free problem in key sharing dict. diff --git a/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst b/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst new file mode 100644 index 00000000000..298d05f331d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst @@ -0,0 +1,4 @@ +Add ``docstring`` field to Module, ClassDef, FunctionDef, and +AsyncFunctionDef ast nodes. docstring is not first stmt in their body +anymore. It affects ``co_firstlineno`` and ``co_lnotab`` of code object for +module and class. diff --git a/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst b/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst new file mode 100644 index 00000000000..35fa1066645 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst @@ -0,0 +1,2 @@ +Fixed possibly dereferencing undefined pointers when creating weakref +objects. diff --git a/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst b/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst new file mode 100644 index 00000000000..cc1366caf30 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst @@ -0,0 +1,3 @@ +Fix incorrect handling of signed zeros in complex constructor for complex +subclasses and for inputs having a __complex__ method. Patch by Serhiy +Storchaka. diff --git a/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst b/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst new file mode 100644 index 00000000000..9185bdab9fe --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst @@ -0,0 +1,2 @@ +Fix stack_effect computation for CALL_FUNCTION_EX. Patch by Matthieu +Dartiailh. diff --git a/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst b/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst new file mode 100644 index 00000000000..4757347a3d0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst @@ -0,0 +1,2 @@ +Support __rmod__ for subclasses of str being called before str.__mod__. +Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst b/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst new file mode 100644 index 00000000000..738e3fc7eb4 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst @@ -0,0 +1,3 @@ +Fix minor regression of PyEval_CallObjectWithKeywords. It should raise +TypeError when kwargs is not a dict. But it might cause segv when args=NULL +and kwargs is not a dict. diff --git a/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst b/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst new file mode 100644 index 00000000000..00abe055759 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst @@ -0,0 +1 @@ +Fixes to memory allocation in _PyCode_SetExtra. Patch by Brian Coleman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst b/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst new file mode 100644 index 00000000000..76c09e34e1c --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst @@ -0,0 +1 @@ +``bool(range)`` works even if ``len(range)`` raises :exc:`OverflowError`. diff --git a/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst b/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst new file mode 100644 index 00000000000..15b74e714aa --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst @@ -0,0 +1,2 @@ +Set correct __cause__ for errors about invalid awaitables returned from +__aiter__ and __anext__. diff --git a/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst b/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst new file mode 100644 index 00000000000..66dde19fcc8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst @@ -0,0 +1,2 @@ +bool(), float(), list() and tuple() no longer take keyword arguments. The +first argument of int() can now be passes only as positional argument. diff --git a/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst b/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst new file mode 100644 index 00000000000..26e520864a7 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst @@ -0,0 +1,2 @@ +Fix a regression that bytes format may fail when containing zero bytes +inside. diff --git a/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst b/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst new file mode 100644 index 00000000000..d2d1fd547ca --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst @@ -0,0 +1,2 @@ +Escaped percent "%%" in the format string for classic string formatting no +longer allows any characters between two percents. diff --git a/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst b/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst new file mode 100644 index 00000000000..c8e9298d53a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst @@ -0,0 +1,7 @@ +The ``sys.path[0]`` initialization change for bpo-29139 caused a regression +by revealing an inconsistency in how sys.path is initialized when executing +``__main__`` from a zipfile, directory, or other import location. The +interpreter now consistently avoids ever adding the import location's parent +directory to ``sys.path``, and ensures no other ``sys.path`` entries are +inadvertently modified when inserting the import location named on the +command line. diff --git a/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst b/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst new file mode 100644 index 00000000000..753f0a485c8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst @@ -0,0 +1,2 @@ +Fix an oversight that %b format for bytes should support objects follow the +buffer protocol. diff --git a/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst b/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst new file mode 100644 index 00000000000..0d7901e25f8 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst @@ -0,0 +1 @@ +Fix a memory leak when an ImportError is raised during from import. diff --git a/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst b/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst new file mode 100644 index 00000000000..e40d8caf95e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst @@ -0,0 +1,2 @@ +Show correct error messages when any of the pthread_* calls in +thread_pthread.h fails. diff --git a/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst b/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst new file mode 100644 index 00000000000..850d91cdc85 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst @@ -0,0 +1,3 @@ +The deprecation warning is emitted if __complex__ returns an instance of a +strict subclass of complex. In a future versions of Python this can be an +error. diff --git a/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst b/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst new file mode 100644 index 00000000000..8576892ff7d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst @@ -0,0 +1,2 @@ +Add a unique ID to PyInterpreterState. This makes it easier to identify +each subinterpreter. diff --git a/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst b/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst new file mode 100644 index 00000000000..70a683b5def --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst @@ -0,0 +1,2 @@ +Fixed the slowing down to 25 times in the searching of some unlucky Unicode +characters. diff --git a/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst b/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst new file mode 100644 index 00000000000..fc1044ea9c6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst @@ -0,0 +1,3 @@ +Shift operation now has less opportunity to raise OverflowError. ValueError +always is raised rather than OverflowError for negative counts. Shifting +zero with non-negative count always returns zero. diff --git a/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst b/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst new file mode 100644 index 00000000000..6f96cded835 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst @@ -0,0 +1,2 @@ +Fixed error messages in the index() method of tuple, list and deque when +pass indices of wrong type. diff --git a/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst b/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst new file mode 100644 index 00000000000..92f50ccb7af --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst @@ -0,0 +1 @@ +Fix memory usage regression of set and frozenset object. diff --git a/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst b/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst new file mode 100644 index 00000000000..4351b4ad6ed --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst @@ -0,0 +1,3 @@ +Fixed default implementations of __reduce__ and __reduce_ex__(). +object.__reduce__() no longer takes arguments, object.__reduce_ex__() now +requires one argument. diff --git a/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst b/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst new file mode 100644 index 00000000000..cf3975ac469 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst @@ -0,0 +1,2 @@ +README.rst is now included in the list of distutils standard READMEs and +therefore included in source distributions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst b/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst new file mode 100644 index 00000000000..f047dd1a813 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst @@ -0,0 +1,2 @@ +len() now raises ValueError rather than OverflowError if __len__() returned +a large negative integer. diff --git a/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst b/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst new file mode 100644 index 00000000000..e57890dc8c1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst @@ -0,0 +1,2 @@ +sys.getsizeof() on a code object now returns the sizes which includes the +code struct and sizes of objects which it references. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst b/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst new file mode 100644 index 00000000000..ffaeee90c9e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst @@ -0,0 +1,2 @@ +Circular imports involving absolute imports with binding a submodule to a +name are now supported. diff --git a/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst b/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst new file mode 100644 index 00000000000..9611dbb9ba6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst @@ -0,0 +1,2 @@ +``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than +``format(str(self), '')``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst b/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst new file mode 100644 index 00000000000..8884a9aee1e --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst @@ -0,0 +1,3 @@ +If a KeyboardInterrupt happens when the interpreter is in the middle of +resuming a chain of nested 'yield from' or 'await' calls, it's now correctly +delivered to the innermost frame. diff --git a/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst b/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst new file mode 100644 index 00000000000..de46584a64d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst @@ -0,0 +1,2 @@ +Fixed type.__setattr__() and type.__delattr__() for non-interned attribute +names. Based on patch by Eryk Sun. diff --git a/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst b/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst new file mode 100644 index 00000000000..da5b8d1a2ca --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst @@ -0,0 +1,3 @@ +Fixed various segfaults with dict when input collections are mutated during +searching, inserting or comparing. Based on patches by Duane Griffin and +Tim Mitchell. diff --git a/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst b/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst new file mode 100644 index 00000000000..45e0fa1eb80 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst @@ -0,0 +1 @@ +Fixed parsing backslashes in f-strings. diff --git a/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst b/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst new file mode 100644 index 00000000000..15025232e70 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst @@ -0,0 +1,3 @@ +Tokens needed for parsing in Python moved to C. ``COMMENT``, ``NL`` and +``ENCODING``. This way the tokens and tok_names in the token module don't +get changed when you import the tokenize module. diff --git a/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst b/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst new file mode 100644 index 00000000000..2f042aba42c --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst @@ -0,0 +1,2 @@ +itertools.islice now accepts integer-like objects (having an __index__ +method) as start, stop, and slice arguments diff --git a/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst b/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst new file mode 100644 index 00000000000..f081dfd0b7b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst @@ -0,0 +1 @@ +Allows setting cell values for __closure__. Patch by Lisa Roach. diff --git a/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst b/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst new file mode 100644 index 00000000000..00341e01140 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst @@ -0,0 +1,4 @@ +Implement PEP 538 (legacy C locale coercion). This means that when a +suitable coercion target locale is available, both the core interpreter and +locale-aware C extensions will assume the use of UTF-8 as the default text +encoding, rather than ASCII. diff --git a/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst b/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst new file mode 100644 index 00000000000..2e8c39d24fb --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst @@ -0,0 +1,3 @@ +The compiler now produces more optimal code for complex condition +expressions in the "if", "while" and "assert" statement, the "if" +expression, and generator expressions and comprehensions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst b/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst new file mode 100644 index 00000000000..ad0bde2e0c1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst @@ -0,0 +1,2 @@ +Removed a too-strict assertion that failed for certain f-strings, such as +eval("f'\\\n'") and eval("f'\\\r'"). diff --git a/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst b/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst new file mode 100644 index 00000000000..0114fee02a4 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst @@ -0,0 +1,2 @@ +``print`` now shows expected input in custom error message when used as a +Python 2 statement. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst b/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst new file mode 100644 index 00000000000..3ec21b4a6d3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst @@ -0,0 +1 @@ +Move co_extra_freefuncs from per-thread to per-interpreter to avoid crashes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst b/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst new file mode 100644 index 00000000000..07d6ceb5d9d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst @@ -0,0 +1 @@ +The internal unicodedata database has been upgraded to Unicode 10.0. diff --git a/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst b/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst new file mode 100644 index 00000000000..8d63a46cbde --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst @@ -0,0 +1 @@ +Fixed a race condition when import a submodule from a package. diff --git a/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst b/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst new file mode 100644 index 00000000000..3ecd404373b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst @@ -0,0 +1,2 @@ +Make sure the 'Missing parentheses' syntax error message is only applied to +SyntaxError, not to subclasses. Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst b/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst new file mode 100644 index 00000000000..b758724fb71 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst @@ -0,0 +1 @@ +Documented command-line interface of zipfile. diff --git a/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst b/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst new file mode 100644 index 00000000000..4708fb26196 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst @@ -0,0 +1,3 @@ +The data model reference and the porting section in the 3.6 What's New guide +now cover the additional ``__classcell__`` handling needed for custom +metaclasses to fully support PEP 487 and zero-argument ``super()``. diff --git a/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst b/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst new file mode 100644 index 00000000000..09f6f3889b5 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst @@ -0,0 +1 @@ +Fix Python 2 syntax in code for building the documentation. diff --git a/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst b/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst new file mode 100644 index 00000000000..2614c0ba850 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst @@ -0,0 +1,2 @@ +Add canonical header link on each page to corresponding major version of the +documentation. Patch by Matthias Bussonnier. diff --git a/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst b/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst new file mode 100644 index 00000000000..ea4046ead7d --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst @@ -0,0 +1,2 @@ +Document smtpd.py as effectively deprecated and add a pointer to aiosmtpd, a +third-party asyncio-based replacement. diff --git a/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst b/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst new file mode 100644 index 00000000000..acacdd01322 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst @@ -0,0 +1 @@ +Link the documentation to its source file on GitHub. diff --git a/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst b/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst new file mode 100644 index 00000000000..3410f7085c7 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst @@ -0,0 +1,3 @@ +Improve the documentation for, and links to, template strings by emphasizing +their utility for internationalization, and by clarifying some usage +constraints. (See also: bpo-20314, bpo-12518) diff --git a/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst b/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst new file mode 100644 index 00000000000..3413e054759 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst @@ -0,0 +1 @@ +Add missing info of code object in inspect documentation. diff --git a/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst b/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst new file mode 100644 index 00000000000..fe8eb2aaa0c --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst @@ -0,0 +1,8 @@ +the link targets for :func:`bytes` and :func:`bytearray` are now their +respective type definitions, rather than the corresponding builtin function +entries. Use :ref:`bytes ` and :ref:`bytearray ` +to reference the latter. + +In order to ensure this and future cross-reference updates are applied +automatically, the daily documentation builds now disable the default output +caching features in Sphinx. diff --git a/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst b/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst new file mode 100644 index 00000000000..df73aeda646 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst @@ -0,0 +1 @@ +Add missing attribute related constants in curses documentation. diff --git a/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst b/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst new file mode 100644 index 00000000000..efc3bc8c76f --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst @@ -0,0 +1,2 @@ +Add 10% to coverage of IDLE's test_configdialog. Update and augment +description of the configuration system. diff --git a/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst b/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst new file mode 100644 index 00000000000..504d803c7eb --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst @@ -0,0 +1 @@ +IDLE colors f-string prefixes (but not invalid ur prefixes). diff --git a/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst b/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst new file mode 100644 index 00000000000..3c30eb8b670 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst @@ -0,0 +1,2 @@ +Add _utest option to textview; add new tests. Increase coverage to 100%. +Patches by Louie Lu and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst b/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst new file mode 100644 index 00000000000..fb4e25feb93 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst @@ -0,0 +1,2 @@ +Help-about: use pep8 names and add tests. Increase coverage to 100%. Patches +by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst b/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst new file mode 100644 index 00000000000..13ac32b24c7 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst @@ -0,0 +1,2 @@ +Add docstrings for textview.py and use PEP8 names. Patches by Cheryl Sabella +and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst b/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst new file mode 100644 index 00000000000..ac6b5158ddb --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst @@ -0,0 +1 @@ +Fix reference leaks in IDLE tests. Patches by Louie Lu and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst b/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst new file mode 100644 index 00000000000..b92e6f9af02 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst @@ -0,0 +1,2 @@ +Add doc subsubsection about IDLE failure to start. Popup no-connection +message directs users to this section. diff --git a/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst b/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst new file mode 100644 index 00000000000..1c8141e7af1 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst @@ -0,0 +1,4 @@ +Fix several problems with IDLE's autocompletion box. The following should +now work: clicking on selection box items; using the scrollbar; selecting an +item by hitting Return. Hangs on MacOSX should no longer happen. Patch by +Louie Lu. diff --git a/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst b/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst new file mode 100644 index 00000000000..8c0674a0f5d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst @@ -0,0 +1,2 @@ +path.resolve(strict=False) no longer cuts the path after the first element +not present in the filesystem. Patch by Antoine Pietri. diff --git a/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst b/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst new file mode 100644 index 00000000000..8146dcdc6d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst @@ -0,0 +1,3 @@ +inspect.unwrap() will now only try to unwrap an object +sys.getrecursionlimit() times, to protect against objects which create a new +object on every attribute access. diff --git a/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst b/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst new file mode 100644 index 00000000000..10b11a4dcdb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst @@ -0,0 +1,2 @@ +ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base classes to +use keyword parameters in __init_subclass__. Patch by Nate Soares. diff --git a/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst b/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst new file mode 100644 index 00000000000..be376cdafac --- /dev/null +++ b/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst @@ -0,0 +1,2 @@ +Reading a corrupt config file left configparser in an invalid state. +Original patch by Florian H?ch. diff --git a/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst b/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst new file mode 100644 index 00000000000..6ffaab0e73d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst @@ -0,0 +1 @@ +Prohibit Tasks to await on themselves. diff --git a/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst b/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst new file mode 100644 index 00000000000..f3becad1775 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst @@ -0,0 +1 @@ +Remove UNIX socket from FS before binding. Patch by ????????? ????. diff --git a/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst b/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst new file mode 100644 index 00000000000..9adfb940811 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst @@ -0,0 +1 @@ +Fix asyncio to support formatting of non-python coroutines. diff --git a/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst b/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst new file mode 100644 index 00000000000..bf3594afff5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst @@ -0,0 +1 @@ +Deprecate passing asyncio.Handles to run_in_executor. diff --git a/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst b/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst new file mode 100644 index 00000000000..5a8ab80e0dd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst @@ -0,0 +1 @@ +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. diff --git a/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst b/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst new file mode 100644 index 00000000000..62d5f45b5cb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst @@ -0,0 +1,2 @@ +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. diff --git a/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst b/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst new file mode 100644 index 00000000000..3385265a51e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst @@ -0,0 +1,2 @@ +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. diff --git a/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst b/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst new file mode 100644 index 00000000000..8a53daac3c8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst @@ -0,0 +1 @@ +Remove vestigial MacOS 9 macurl2path module and its tests. diff --git a/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst b/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst new file mode 100644 index 00000000000..f262c84a51b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst @@ -0,0 +1,2 @@ +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. diff --git a/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst b/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst new file mode 100644 index 00000000000..79bdb480d2f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst @@ -0,0 +1 @@ +Fix callbacks race in asyncio.SelectorLoop.sock_connect. diff --git a/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst b/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst new file mode 100644 index 00000000000..1add3ddc317 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst @@ -0,0 +1 @@ +Fix slow pipes IO in asyncio. Patch by INADA Naoki. diff --git a/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst b/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst new file mode 100644 index 00000000000..81f3f525c61 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst @@ -0,0 +1 @@ +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. diff --git a/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst b/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst new file mode 100644 index 00000000000..e67ba9606e2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst @@ -0,0 +1,2 @@ +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. diff --git a/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst b/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst new file mode 100644 index 00000000000..9e261ccd858 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst @@ -0,0 +1 @@ +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. diff --git a/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst b/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst new file mode 100644 index 00000000000..71905507f18 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst @@ -0,0 +1 @@ +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). diff --git a/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst b/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst new file mode 100644 index 00000000000..9c567f0c1ce --- /dev/null +++ b/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst @@ -0,0 +1,2 @@ +Fix a crash in parse_envlist() when env contains byte strings. Patch by Eryk +Sun. diff --git a/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst b/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst new file mode 100644 index 00000000000..8690675e56e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst @@ -0,0 +1,2 @@ +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. diff --git a/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst b/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst new file mode 100644 index 00000000000..104fa1a011b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst @@ -0,0 +1 @@ +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. diff --git a/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst b/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst new file mode 100644 index 00000000000..fe11915953d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst @@ -0,0 +1,2 @@ +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. diff --git a/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst b/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst new file mode 100644 index 00000000000..fedd5a5fd10 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst @@ -0,0 +1,2 @@ +Warning message emitted by using inline flags in the middle of regular +expression now contains a (truncated) regex pattern. Patch by Tim Graham. diff --git a/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst b/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst new file mode 100644 index 00000000000..8a44468e8d4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst @@ -0,0 +1,2 @@ +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. diff --git a/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst b/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst new file mode 100644 index 00000000000..8dd432b9643 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst @@ -0,0 +1 @@ +Fix UnboundLocalError in socket._sendfile_use_sendfile. diff --git a/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst b/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst new file mode 100644 index 00000000000..d60eefe4667 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst @@ -0,0 +1 @@ +Prevent memory leak in win32_ver(). diff --git a/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst b/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst new file mode 100644 index 00000000000..60180e7b01a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst @@ -0,0 +1,2 @@ +RobotFileParser now correctly returns default values for crawl_delay and +request_rate. Initial patch by Peter Wirtz. diff --git a/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst b/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst new file mode 100644 index 00000000000..8cb460c76b9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst @@ -0,0 +1 @@ +Fix memory leak on Windows in the os module (fix path_converter() function). diff --git a/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst b/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst new file mode 100644 index 00000000000..8e4d1c93492 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst @@ -0,0 +1,2 @@ +Fix a memory leak in os.getrandom() when the getrandom() is interrupted by a +signal and a signal handler raises a Python exception. diff --git a/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst b/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst new file mode 100644 index 00000000000..33809ea0f37 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst @@ -0,0 +1 @@ +Allow falsy values to be used for msg parameter of subTest(). diff --git a/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst b/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst new file mode 100644 index 00000000000..846b80adfab --- /dev/null +++ b/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst @@ -0,0 +1,2 @@ +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. diff --git a/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst b/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst new file mode 100644 index 00000000000..090049151b6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst @@ -0,0 +1,2 @@ +Fixed support of default root window in the tkinter.tix module. Added the +master parameter in the DisplayStyle constructor. diff --git a/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst b/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst new file mode 100644 index 00000000000..31683232e4e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst @@ -0,0 +1,2 @@ +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. diff --git a/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst b/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst new file mode 100644 index 00000000000..f9fa6409385 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst @@ -0,0 +1,3 @@ +random.choices() now has k as a keyword-only argument to improve the +readability of common cases and come into line with the signature used in +other languages. diff --git a/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst b/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst new file mode 100644 index 00000000000..da0793afa0b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst @@ -0,0 +1,2 @@ +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst b/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst new file mode 100644 index 00000000000..cff7838f524 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst @@ -0,0 +1,2 @@ +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. diff --git a/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst b/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst new file mode 100644 index 00000000000..b25f9817469 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst @@ -0,0 +1,4 @@ +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. diff --git a/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst b/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst new file mode 100644 index 00000000000..49304e63d63 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst @@ -0,0 +1,4 @@ +Stop using localtime() and gmtime() in the time module. + +Introduced platform independent _PyTime_localtime API that is similar to +POSIX localtime_r, but available on all platforms. Patch by Ed Schouten. diff --git a/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst b/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst new file mode 100644 index 00000000000..7f9b9afa6b4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst @@ -0,0 +1,2 @@ +Fix function declaration (C flags) for the getiterator() method of +xml.etree.ElementTree.Element. diff --git a/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst b/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst new file mode 100644 index 00000000000..fc5d14e38c5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst @@ -0,0 +1 @@ +compileall now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst b/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst new file mode 100644 index 00000000000..b3e7ba5bf1e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst @@ -0,0 +1 @@ +imghdr now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst b/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst new file mode 100644 index 00000000000..5e33ba12c0d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst @@ -0,0 +1,2 @@ +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. diff --git a/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst b/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst new file mode 100644 index 00000000000..ebf241afd53 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst @@ -0,0 +1,2 @@ +Improved error message when passing a non-iterable as a var-positional +argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. diff --git a/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst b/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst new file mode 100644 index 00000000000..2ca6fedd02b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst @@ -0,0 +1,2 @@ +Optimized merging var-keyword arguments and improved error message when +passing a non-mapping as a var-keyword argument. diff --git a/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst b/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst new file mode 100644 index 00000000000..e315ecc00b4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst @@ -0,0 +1,2 @@ +Deprecated silent truncations in socket.htons and socket.ntohs. Original +patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst b/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst new file mode 100644 index 00000000000..eb21cffc39d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst @@ -0,0 +1 @@ +gzip now supports pathlib. Patch by Ethan Furman. diff --git a/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst b/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst new file mode 100644 index 00000000000..6abd1a078a1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst @@ -0,0 +1 @@ +bz2 module now supports pathlib. Initial patch by Ethan Furman. diff --git a/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst b/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst new file mode 100644 index 00000000000..69bd193641d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst @@ -0,0 +1 @@ +Fixed writing non-BMP characters with binary format in plistlib. diff --git a/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst b/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst new file mode 100644 index 00000000000..5d2a7763cb7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst @@ -0,0 +1 @@ +lzma module now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst b/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst new file mode 100644 index 00000000000..35d26ae41ee --- /dev/null +++ b/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst @@ -0,0 +1,2 @@ +unittest.mock Mock autospec functions now properly support assert_called, +assert_not_called, and assert_called_once. diff --git a/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst b/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst new file mode 100644 index 00000000000..3d3a19ba472 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst @@ -0,0 +1 @@ +The disassembler now decodes FORMAT_VALUE argument. diff --git a/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst b/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst new file mode 100644 index 00000000000..040b4c0888f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst @@ -0,0 +1 @@ +Fixed bytes path support in os.scandir() on Windows. Patch by Eryk Sun. diff --git a/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst b/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst new file mode 100644 index 00000000000..5495b783568 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst @@ -0,0 +1 @@ +Fix references leaked by pdb in the handling of SIGINT handlers. diff --git a/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst b/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst new file mode 100644 index 00000000000..26bb026dd00 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst @@ -0,0 +1 @@ +Make webbrowser support Chrome on Mac OS X. Patch by Ned Batchelder. diff --git a/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst b/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst new file mode 100644 index 00000000000..c3cf076e463 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst @@ -0,0 +1,4 @@ +Distutils.sdist now looks for README and setup.py files with case +sensitivity. This behavior matches that found in Setuptools 6.0 and later. +See `setuptools 100 `_ for +rationale. diff --git a/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst b/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst new file mode 100644 index 00000000000..d2c24f36719 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst @@ -0,0 +1,3 @@ +timeit autorange now uses a single loop iteration if the benchmark takes +less than 10 seconds, instead of 10 iterations. "python3 -m timeit -s +'import time' 'time.sleep(1)'" now takes 4 seconds instead of 40 seconds. diff --git a/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst b/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst new file mode 100644 index 00000000000..650c94ad719 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst @@ -0,0 +1,2 @@ +timeit now repeats the benchmarks 5 times instead of only 3 to make +benchmarks more reliable. diff --git a/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst b/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst new file mode 100644 index 00000000000..377b3dc2e7b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst @@ -0,0 +1,2 @@ +timeit: remove ``-c/--clock`` and ``-t/--time`` command line options which +were deprecated since Python 3.3. diff --git a/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst b/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst new file mode 100644 index 00000000000..786ff2c1a6a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst @@ -0,0 +1 @@ +Fix error building socket module when multithreading is disabled. diff --git a/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst b/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst new file mode 100644 index 00000000000..a09e1d8cba6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst @@ -0,0 +1,3 @@ +In the "io" module, the argument to BufferedReader and BytesIO's read1() +methods is now optional and can be -1, matching the BufferedIOBase +specification. diff --git a/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst b/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst new file mode 100644 index 00000000000..bb3f32b3740 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst @@ -0,0 +1 @@ +Fix C implemented asyncio.Future didn't work on Windows. diff --git a/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst b/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst new file mode 100644 index 00000000000..cf19d7e04cd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst @@ -0,0 +1,2 @@ +Optimize csv.DictWriter for large number of columns. Patch by Mariatta +Wijaya. diff --git a/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst b/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst new file mode 100644 index 00000000000..b8a77f78766 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst @@ -0,0 +1,2 @@ +Command-line interface of the zipfile module now uses argparse. Added +support of long options. diff --git a/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst b/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst new file mode 100644 index 00000000000..ef2d4766394 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst @@ -0,0 +1,2 @@ +timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead of 1, 10, +100,... for autoranging. diff --git a/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst b/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst new file mode 100644 index 00000000000..72a8f59d125 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst @@ -0,0 +1,4 @@ +re.sub() now raises an error for invalid numerical group reference in +replacement template even if the pattern is not found in the string. Error +message for invalid group reference now includes the group index and the +position of the reference. Based on patch by SilentGhost. diff --git a/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst b/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst new file mode 100644 index 00000000000..f8d370c0b24 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst @@ -0,0 +1 @@ +shutil.make_archive() no longer adds entry "./" to ZIP archive. diff --git a/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst b/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst new file mode 100644 index 00000000000..4b90795b470 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst @@ -0,0 +1,2 @@ +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. diff --git a/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst b/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst new file mode 100644 index 00000000000..ca1f183e0cd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst @@ -0,0 +1,2 @@ +Generated names for Tkinter widgets now start by the "!" prefix for +readability. diff --git a/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst b/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst new file mode 100644 index 00000000000..90394c4603e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst @@ -0,0 +1,2 @@ +Fix iterator of C implemented asyncio.Future doesn't accept non-None value +is passed to it.send(val). diff --git a/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst b/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst new file mode 100644 index 00000000000..74f33025c13 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst @@ -0,0 +1 @@ +os.fwalk() no longer fails on broken links. diff --git a/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst b/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst new file mode 100644 index 00000000000..a2a3f295437 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst @@ -0,0 +1,2 @@ +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. diff --git a/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst b/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst new file mode 100644 index 00000000000..6818da9048e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst @@ -0,0 +1,2 @@ +calendar.TextCalendar.prmonth() no longer prints a space at the start of new +line after printing a month's calendar. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst b/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst new file mode 100644 index 00000000000..56c6d653cdf --- /dev/null +++ b/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst @@ -0,0 +1,3 @@ +calendar.TextCalendar.prweek() no longer prints a space after a weeks's +calendar. calendar.TextCalendar.pryear() no longer prints redundant newline +after a year's calendar. Based on patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst b/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst new file mode 100644 index 00000000000..53c40580f29 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst @@ -0,0 +1,3 @@ +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. diff --git a/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst b/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst new file mode 100644 index 00000000000..0aa7db90a93 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst @@ -0,0 +1,4 @@ +The webbrowser in an X environment now prefers using the default browser +directly. Also, the webbrowser register() function now has a documented +'preferred' argument, to specify browsers to be returned by get() with no +arguments. Patch by David Steele diff --git a/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst b/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst new file mode 100644 index 00000000000..dba0be1c22a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst @@ -0,0 +1,2 @@ +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. diff --git a/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst b/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst new file mode 100644 index 00000000000..896227d0f1a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst @@ -0,0 +1,3 @@ +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. diff --git a/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst b/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst new file mode 100644 index 00000000000..237e66dd085 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst @@ -0,0 +1 @@ +Fixed segfault in curses's addch() with ncurses6. diff --git a/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst b/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst new file mode 100644 index 00000000000..c9e5b8dd2c0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst @@ -0,0 +1,2 @@ +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. diff --git a/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst b/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst new file mode 100644 index 00000000000..aa8e29d97c6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst @@ -0,0 +1,2 @@ +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. diff --git a/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst b/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst new file mode 100644 index 00000000000..9da96ab9ba6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst @@ -0,0 +1,3 @@ +Fixed possible DoS and arbitrary code execution when handle plural form +selections in the gettext module. The expression parser now supports exact +syntax supported by GNU gettext. diff --git a/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst b/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst new file mode 100644 index 00000000000..9d0622b33fd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst @@ -0,0 +1,2 @@ +Makes Path.resolve() succeed on paths that do not exist. Patch by Vajrasky +Kok diff --git a/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst b/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst new file mode 100644 index 00000000000..daa0cdaf816 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst @@ -0,0 +1,2 @@ +In the "http.server" module, parse the protocol version if possible, to +avoid using HTTP 0.9 in some error responses. diff --git a/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst b/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst new file mode 100644 index 00000000000..8c12033b7c0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst @@ -0,0 +1,2 @@ +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. diff --git a/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst b/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst new file mode 100644 index 00000000000..9f712803e11 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst @@ -0,0 +1,2 @@ +Remove the subprocess.Popen.wait endtime parameter. It was deprecated in +3.4 and undocumented prior to that. diff --git a/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst b/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst new file mode 100644 index 00000000000..682cb16bfe6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst @@ -0,0 +1,4 @@ +Regular expression patterns, _sre.SRE_Pattern objects created by +re.compile(), become comparable (only x==y and x!=y operators). This change +should fix the issue #18383: don't duplicate warning filters when the +warnings module is reloaded (thing usually only done in unit tests). diff --git a/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst b/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst new file mode 100644 index 00000000000..0c5730600f0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst @@ -0,0 +1 @@ +Restored the __reduce__() methods of datetime objects. diff --git a/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst b/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst new file mode 100644 index 00000000000..dc603f0a4f2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst @@ -0,0 +1,3 @@ +Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and +:data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by +Omar Sandoval. diff --git a/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst b/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst new file mode 100644 index 00000000000..2cdfc78e69c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst @@ -0,0 +1,2 @@ +Add sys.getandroidapilevel(): return the build time API version of Android +as an integer. Function only available on Android. diff --git a/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst b/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst new file mode 100644 index 00000000000..e49ec2e2b83 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst @@ -0,0 +1,4 @@ +To assist with upgrades from 2.7, the previously documented deprecation of +``inspect.getfullargspec()`` has been reversed. This decision may be +revisited again after the Python 2.7 branch is no longer officially +supported. diff --git a/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst b/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst new file mode 100644 index 00000000000..af92a019ebe --- /dev/null +++ b/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst @@ -0,0 +1,2 @@ +Fix a regression introduced in warnings.catch_warnings(): call +warnings.showwarning() if it was overridden inside the context manager. diff --git a/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst b/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst new file mode 100644 index 00000000000..a05f572ad17 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst @@ -0,0 +1,2 @@ +Unknown escapes consisting of ``'\'`` and an ASCII letter in re.sub() +replacement templates regular expressions now are errors. diff --git a/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst b/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst new file mode 100644 index 00000000000..1e1e8a0ca9b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst @@ -0,0 +1,4 @@ +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. A deprecation warning is now emitted if the +index file is missed and recreated in the 'r' and 'w' modes (will be an +error in future Python releases). diff --git a/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst b/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst new file mode 100644 index 00000000000..3d0e17fe5c9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst @@ -0,0 +1,2 @@ +The chown() method of the tarfile.TarFile class does not fail now when the +grp module cannot be imported, as for example on Android platforms. diff --git a/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst b/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst new file mode 100644 index 00000000000..63b22ee36c8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst @@ -0,0 +1,3 @@ +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. diff --git a/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst b/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst new file mode 100644 index 00000000000..c7fd44b6651 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst @@ -0,0 +1,2 @@ +subprocess.Popen uses /system/bin/sh on Android as the shell, instead of +/bin/sh. diff --git a/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst b/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst new file mode 100644 index 00000000000..8ea757bb42f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst @@ -0,0 +1,2 @@ +Fixed a crash in resource.prlimit() when passing a sequence that doesn't own +its elements as limits. diff --git a/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst b/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst new file mode 100644 index 00000000000..b330241c2a8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst @@ -0,0 +1,2 @@ +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. diff --git a/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst b/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst new file mode 100644 index 00000000000..43830548b8c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst @@ -0,0 +1 @@ +Fixed a crash when deallocate deep ElementTree. diff --git a/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst b/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst new file mode 100644 index 00000000000..5470585f69f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst @@ -0,0 +1 @@ +Remove editor artifacts from Tix.py. diff --git a/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst b/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst new file mode 100644 index 00000000000..e6eab05306f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst @@ -0,0 +1,2 @@ +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. diff --git a/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst b/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst new file mode 100644 index 00000000000..18abe3d6d2c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst @@ -0,0 +1 @@ +curses.ascii predicates now work correctly with negative integers. diff --git a/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst b/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst new file mode 100644 index 00000000000..87fe36e34a6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst @@ -0,0 +1,2 @@ +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. diff --git a/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst b/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst new file mode 100644 index 00000000000..2bc4cd41157 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst @@ -0,0 +1 @@ +Prevent infinite loop in pathlib.resolve() on Windows diff --git a/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst b/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst new file mode 100644 index 00000000000..8b41a1f6312 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst @@ -0,0 +1 @@ +Update authorizer constants in sqlite3 module. Patch by Dingyuan Wang. diff --git a/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst b/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst new file mode 100644 index 00000000000..6df13d27c5e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst @@ -0,0 +1,2 @@ +inspect.getframeinfo() now correctly shows the first line of a context. +Patch by Sam Breese. diff --git a/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst b/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst new file mode 100644 index 00000000000..31d81af9853 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst @@ -0,0 +1,2 @@ +Fix unittest.mock._Call helper: don't ignore the name parameter anymore. +Patch written by Jiajun Huang. diff --git a/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst b/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst new file mode 100644 index 00000000000..fd5465baa90 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst @@ -0,0 +1,3 @@ +In urllib.request, suffixes in no_proxy environment variable with leading +dots could match related hostnames again (e.g. .b.c matches a.b.c). Patch by +Milan Oberkirch. diff --git a/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst b/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst new file mode 100644 index 00000000000..b2e9bce519c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst @@ -0,0 +1,2 @@ +The unittest.mock.sentinel attributes now preserve their identity when they +are copied or pickled. diff --git a/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst b/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst new file mode 100644 index 00000000000..f2a4171294f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst @@ -0,0 +1,3 @@ +Fixed race condition in C implementation of functools.lru_cache. KeyError +could be raised when cached function with full cache was simultaneously +called from differen threads with the same uncached arguments. diff --git a/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst b/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst new file mode 100644 index 00000000000..47123d98f6c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst @@ -0,0 +1,2 @@ +Removed support of deprecated undocumented keyword arguments in methods of +regular expression objects. diff --git a/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst b/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst new file mode 100644 index 00000000000..b87246f5a07 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst @@ -0,0 +1,2 @@ +A format string argument for string.Formatter.format() is now positional- +only. diff --git a/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst b/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst new file mode 100644 index 00000000000..e23778956be --- /dev/null +++ b/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst @@ -0,0 +1 @@ +Removed deprecated features in the http.cookies module. diff --git a/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst b/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst new file mode 100644 index 00000000000..ab6725f596a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst @@ -0,0 +1 @@ +Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances. diff --git a/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst b/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst new file mode 100644 index 00000000000..02452fe88d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst @@ -0,0 +1 @@ +Removed support of deprecated argument "exclude" in tarfile.TarFile.add(). diff --git a/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst b/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst new file mode 100644 index 00000000000..9e9fc4fbcf8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst @@ -0,0 +1 @@ +Removed deprecated function ntpath.splitunc(). diff --git a/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst b/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst new file mode 100644 index 00000000000..1ec6247bb9c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst @@ -0,0 +1 @@ +Fixed the comparison of mock.MagickMock with mock.ANY. diff --git a/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst b/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst new file mode 100644 index 00000000000..a4ac1f0725f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst @@ -0,0 +1,2 @@ +Fix a regression in argparse that help messages would wrap at non-breaking +spaces. diff --git a/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst b/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst new file mode 100644 index 00000000000..79e17482299 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst @@ -0,0 +1,2 @@ +Fix subprocess.Popen.wait() when the child process has exited to a stopped +instead of terminated state (ex: when under ptrace). diff --git a/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst b/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst new file mode 100644 index 00000000000..a9e5315e8e9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst @@ -0,0 +1,2 @@ +The help of a builtin or extension class now includes the constructor +signature if __text_signature__ is provided for the class. diff --git a/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst b/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst new file mode 100644 index 00000000000..04c7dfce8a5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst @@ -0,0 +1,3 @@ +The extend() method is now called instead of the append() method when +unpickle collections.deque and other list-like objects. This can speed up +unpickling to 2 times. diff --git a/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst b/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst new file mode 100644 index 00000000000..cd7c117d52a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst @@ -0,0 +1,2 @@ +Unused install_misc command is now removed. It has been documented as +unused since 2000. Patch by Eric N. Vander Weele. diff --git a/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst b/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst new file mode 100644 index 00000000000..4b7bd5a944b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst @@ -0,0 +1,2 @@ +Add WrapperDescriptorType, MethodWrapperType, and MethodDescriptorType +built-in types to types module. Original patch by Manuel Krebber. diff --git a/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst b/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst new file mode 100644 index 00000000000..05e96fb79da --- /dev/null +++ b/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst @@ -0,0 +1,2 @@ +Fixed out-of-bounds buffer access in the group() method of the match object. +Based on patch by WGH. diff --git a/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst b/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst new file mode 100644 index 00000000000..b0b9838b373 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst @@ -0,0 +1 @@ +Prevent infinite loop in pathlib.Path.mkdir diff --git a/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst b/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst new file mode 100644 index 00000000000..d12217a34bd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst @@ -0,0 +1,2 @@ +Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check +minimum and maximum years. diff --git a/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst b/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst new file mode 100644 index 00000000000..5b1c326f486 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst @@ -0,0 +1,3 @@ +Various updates to typing module: typing.Counter, typing.ChainMap, improved +ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, Manuel +Krebber, and ?ukasz Langa. diff --git a/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst b/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst new file mode 100644 index 00000000000..c346c364249 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst @@ -0,0 +1,2 @@ +importlib.reload() now raises ModuleNotFoundError if the module lacks a +spec. diff --git a/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst b/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst new file mode 100644 index 00000000000..38866c3a291 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst @@ -0,0 +1,2 @@ +locale.format_string now supports the 'monetary' keyword argument, and +locale.format is deprecated. diff --git a/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst b/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst new file mode 100644 index 00000000000..94a015c3964 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst @@ -0,0 +1,2 @@ +Fixed different behaviour of Decimal.from_float() for _decimal and +_pydecimal. Thanks Andrew Nester. diff --git a/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst b/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst new file mode 100644 index 00000000000..789bb3e688d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst @@ -0,0 +1,2 @@ +Improve some deprecations in importlib. Some deprecated methods now emit +DeprecationWarnings and have better descriptive messages. diff --git a/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst b/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst new file mode 100644 index 00000000000..af151acec52 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst @@ -0,0 +1,3 @@ +Add uuid.SafeUUID and uuid.UUID.is_safe to relay information from the +platform about whether generated UUIDs are generated with a multiprocessing +safe method. diff --git a/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst b/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst new file mode 100644 index 00000000000..10c495cb907 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst @@ -0,0 +1,2 @@ +Fix file object leak in aifc.open() when file is given as a filesystem path +and is not in valid AIFF format. Patch by Anthony Zhang. diff --git a/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst b/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst new file mode 100644 index 00000000000..9e3a25e2908 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst @@ -0,0 +1,2 @@ +Altering a kwarg dictionary passed to functools.partial() no longer affects +a partial object after creation. diff --git a/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst b/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst new file mode 100644 index 00000000000..f1db485970a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst @@ -0,0 +1,3 @@ +urrlib.parse.quote is now based on RFC 3986 and hence includes '~' in the +set of characters that is not quoted by default. Patch by Christian Theune +and Ratnadeep Debnath. diff --git a/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst b/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst new file mode 100644 index 00000000000..af487f02efe --- /dev/null +++ b/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst @@ -0,0 +1,2 @@ +get_extra_info() raises exception if get called on closed ssl transport. +Patch by Nikolay Kim. diff --git a/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst b/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst new file mode 100644 index 00000000000..c40da624958 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst @@ -0,0 +1,2 @@ +Start a transaction implicitly before a DML statement. Patch by Aviv +Palivoda. diff --git a/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst b/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst new file mode 100644 index 00000000000..caf5197fd56 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst @@ -0,0 +1,2 @@ +Add a test that checks that cwd parameter of Popen() accepts PathLike +objects. Patch by Sayan Chowdhury. diff --git a/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst b/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst new file mode 100644 index 00000000000..5b610c45895 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst @@ -0,0 +1 @@ +Fix assertion error in threading._DummyThread.is_alive(). diff --git a/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst b/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst new file mode 100644 index 00000000000..a9ccebebb9d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst @@ -0,0 +1,2 @@ +Method register_function() of xmlrpc.server.SimpleXMLRPCDispatcher and its +subclasses can now be used as a decorator. diff --git a/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst b/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst new file mode 100644 index 00000000000..4cef50404a5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst @@ -0,0 +1,2 @@ +SimpleXMLRPCDispatcher no longer chains KeyError (or any other exception) to +exception(s) raised in the dispatched methods. Patch by Petr Motejlek. diff --git a/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst b/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst new file mode 100644 index 00000000000..ce844f7b2ba --- /dev/null +++ b/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst @@ -0,0 +1 @@ +Fix asyncio to support instantiation of new event loops in child processes. diff --git a/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst b/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst new file mode 100644 index 00000000000..fd3f2aea906 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst @@ -0,0 +1,2 @@ +Fix Task.current_task and Task.all_tasks implemented in C to accept None +argument as their pure Python implementation. diff --git a/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst b/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst new file mode 100644 index 00000000000..c371cedc086 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst @@ -0,0 +1,2 @@ +asyncio.subprocess.SubprocessStreamProtocol no longer closes before all +pipes are closed. diff --git a/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst b/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst new file mode 100644 index 00000000000..15e34710252 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst @@ -0,0 +1,2 @@ +Fix out of bound iteration in asyncio.Future.remove_done_callback +implemented in C. diff --git a/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst b/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst new file mode 100644 index 00000000000..edad62bc1e4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst @@ -0,0 +1 @@ +Migrate sqlite3 module to _v2 API. Patch by Aviv Palivoda. diff --git a/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst b/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst new file mode 100644 index 00000000000..331fc02ae5a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst @@ -0,0 +1,2 @@ +Allow use of path-like object as a single argument in ConfigParser.read(). +Patch by David Ellis. diff --git a/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst b/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst new file mode 100644 index 00000000000..81786e33259 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst @@ -0,0 +1,2 @@ +Add new :data:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constant. Patch by +Nathaniel J. Smith. diff --git a/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst b/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst new file mode 100644 index 00000000000..480325cf9e2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst @@ -0,0 +1 @@ +Added support for bytes paths in os.fwalk(). diff --git a/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst b/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst new file mode 100644 index 00000000000..cb9fd02e1c7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst @@ -0,0 +1,2 @@ +index() and count() methods of collections.abc.Sequence now check identity +before checking equality when do comparisons. diff --git a/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst b/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst new file mode 100644 index 00000000000..b706b0641a3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst @@ -0,0 +1 @@ +The zipfile module now accepts path-like objects for external paths. diff --git a/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst b/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst new file mode 100644 index 00000000000..8f194b8a23e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst @@ -0,0 +1,2 @@ +Speed up importing the webbrowser module. webbrowser.register() is now +thread-safe. diff --git a/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst b/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst new file mode 100644 index 00000000000..1e5ba953445 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst @@ -0,0 +1,2 @@ +Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big intables +(objects that have __int__) as elements. diff --git a/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst b/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst new file mode 100644 index 00000000000..ae8df9ffdd0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst @@ -0,0 +1,2 @@ +os.stat() and os.DirEntry.inode() now convert inode (st_ino) using unsigned +integers. diff --git a/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst b/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst new file mode 100644 index 00000000000..82a54e5d9ec --- /dev/null +++ b/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst @@ -0,0 +1 @@ +Use C library implementation for math functions erf() and erfc(). diff --git a/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst b/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst new file mode 100644 index 00000000000..a99463b03f0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst @@ -0,0 +1,2 @@ +Using non-integer value for selecting a plural form in gettext is now +deprecated. diff --git a/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst b/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst new file mode 100644 index 00000000000..3a9fc7c07bc --- /dev/null +++ b/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst @@ -0,0 +1,2 @@ +Fixed possible failing or crashing input() if attributes "encoding" or +"errors" of sys.stdin or sys.stdout are not set or are not strings. diff --git a/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst b/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst new file mode 100644 index 00000000000..e4aba4b88e6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst @@ -0,0 +1,2 @@ +Fix crashes in partial.__repr__ if the keys of partial.keywords are not +strings. Patch by Michael Seifert. diff --git a/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst b/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst new file mode 100644 index 00000000000..ee68d5b6c86 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst @@ -0,0 +1 @@ +Fixed crashes in repr of recursive buffered file-like objects. diff --git a/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst b/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst new file mode 100644 index 00000000000..90b5f0cf9ac --- /dev/null +++ b/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst @@ -0,0 +1,2 @@ +faulthandler: Restore the old sigaltstack during teardown. Patch by +Christophe Zeitouny. diff --git a/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst b/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst new file mode 100644 index 00000000000..50075da9ec9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst @@ -0,0 +1,2 @@ +The mode argument of os.makedirs() no longer affects the file permission +bits of newly-created intermediate-level directories. diff --git a/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst b/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst new file mode 100644 index 00000000000..c14091ab5bd --- /dev/null +++ b/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst @@ -0,0 +1,2 @@ +Release references to tasks, their arguments and their results as soon as +they are finished in multiprocessing.Pool. diff --git a/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst b/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst new file mode 100644 index 00000000000..2ca8488f397 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst @@ -0,0 +1,2 @@ +Avoid incorrect errors raised by Path.mkdir(exist_ok=True) when the OS gives +priority to errors such as EACCES over EEXIST. diff --git a/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst b/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst new file mode 100644 index 00000000000..51fde26f1e1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst @@ -0,0 +1,2 @@ +The zipapp module now supports general path-like objects, not just +pathlib.Path. diff --git a/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst b/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst new file mode 100644 index 00000000000..7a589f1dcdb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst @@ -0,0 +1,2 @@ +unittest.TestCase.assertRaises() now manually breaks a reference cycle to +not keep objects alive longer than expected. diff --git a/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst b/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst new file mode 100644 index 00000000000..5ea6808390e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst @@ -0,0 +1,3 @@ +Fixed a bug in pools in multiprocessing.pool that raising an exception at +the very first of an iterable may swallow the exception or make the program +hang. Patch by Davin Potts and Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst b/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst new file mode 100644 index 00000000000..b2786264aa4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst @@ -0,0 +1,2 @@ +Added support of file descriptors in os.scandir() on Unix. os.fwalk() is +sped up by 2 times by using os.scandir(). diff --git a/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst b/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst new file mode 100644 index 00000000000..49f0f03d7bb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst @@ -0,0 +1,2 @@ +Fixed multiple crashes in ElementTree caused by race conditions and wrong +types. diff --git a/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst b/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst new file mode 100644 index 00000000000..cde465f4b29 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst @@ -0,0 +1,3 @@ +Element.getiterator() and the html parameter of XMLParser() were deprecated +only in the documentation (since Python 3.2 and 3.4 correspondintly). Now +using them emits a deprecation warning. diff --git a/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst b/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst new file mode 100644 index 00000000000..e215fc2faab --- /dev/null +++ b/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst @@ -0,0 +1 @@ +Sped up reading encrypted ZIP files by 2 times. diff --git a/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst b/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst new file mode 100644 index 00000000000..39b8ba8f3e0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst @@ -0,0 +1,2 @@ +Fix a crash in itertools.chain.from_iterable when encountering long runs of +empty iterables. diff --git a/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst b/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst new file mode 100644 index 00000000000..214fd31b802 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst @@ -0,0 +1,2 @@ +Fixed memory leaks in the replace() method of datetime and time objects when +pass out of bound fold argument. diff --git a/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst b/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst new file mode 100644 index 00000000000..cb098ff6b05 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst @@ -0,0 +1,2 @@ +Fixed comparison check for ipaddress.ip_interface objects. Patch by Sanjay +Sundaresan. diff --git a/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst b/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst new file mode 100644 index 00000000000..26ef8ef1f4c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst @@ -0,0 +1,2 @@ +Support If-Modified-Since HTTP header (browser cache). Patch by Pierre +Quentel. diff --git a/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst b/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst new file mode 100644 index 00000000000..58c8a8e2f34 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst @@ -0,0 +1,2 @@ +Improve struct.pack_into() exception messages for problems with the buffer +size and offset. Patch by Andrew Nester. diff --git a/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst b/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst new file mode 100644 index 00000000000..4844525f23a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst @@ -0,0 +1,2 @@ +Add math.remainder operation, implementing remainder as specified in IEEE +754. diff --git a/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst b/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst new file mode 100644 index 00000000000..5e6637873b3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst @@ -0,0 +1 @@ +re.escape() now escapes only regex special characters. diff --git a/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst b/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst new file mode 100644 index 00000000000..1999770e5d3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst @@ -0,0 +1 @@ +Pickling and copying ImportError now preserves name and path attributes. diff --git a/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst b/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst new file mode 100644 index 00000000000..d57348eeb28 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst @@ -0,0 +1,2 @@ +Allowed calling the close() method of the zip entry writer object multiple +times. Writing to a closed writer now always produces a ValueError. diff --git a/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst b/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst new file mode 100644 index 00000000000..f21f7a7dc61 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst @@ -0,0 +1,3 @@ +Test that sqlite3 trace callback is not called multiple times when schema is +changing. Indirectly fixed by switching to use sqlite3_prepare_v2() in +bpo-9303. Patch by Aviv Palivoda. diff --git a/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst b/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst new file mode 100644 index 00000000000..118475deca0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst @@ -0,0 +1,2 @@ +Fixed arbitrary unchaining of RuntimeError exceptions in +contextlib.contextmanager. Patch by Siddharth Velankar. diff --git a/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst b/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst new file mode 100644 index 00000000000..fd91668c3df --- /dev/null +++ b/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst @@ -0,0 +1,2 @@ +Fixed race condition in pathlib mkdir with flags parents=True. Patch by +Armin Rigo. diff --git a/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst b/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst new file mode 100644 index 00000000000..429673b83ac --- /dev/null +++ b/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst @@ -0,0 +1 @@ +_io._IOBase.readlines will check if it's closed first when hint is present. diff --git a/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst b/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst new file mode 100644 index 00000000000..842aa953b4b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst @@ -0,0 +1,2 @@ +Compiled regular expression and match objects in the re module now support +copy.copy() and copy.deepcopy() (they are considered atomic). diff --git a/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst b/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst new file mode 100644 index 00000000000..bf1ff7d4720 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst @@ -0,0 +1 @@ +Fix PathLike support for shutil.unpack_archive. Patch by Jelle Zijlstra. diff --git a/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst b/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst new file mode 100644 index 00000000000..0b181f6084f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst @@ -0,0 +1,4 @@ +Fixed crashes in IOBase methods __next__() and readlines() when readline() +or __next__() respectively return non-sizeable object. Fixed possible other +errors caused by not checking results of PyObject_Size(), PySequence_Size(), +or PyMapping_Size(). diff --git a/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst b/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst new file mode 100644 index 00000000000..e74ad0ed975 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst @@ -0,0 +1,2 @@ +Column widths in the output of dis.dis() are now adjusted for large line +numbers and instruction offsets. diff --git a/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst b/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst new file mode 100644 index 00000000000..8e31371216a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst @@ -0,0 +1 @@ +Fixed leaks and crashes in errors handling in the parser module. diff --git a/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst b/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst new file mode 100644 index 00000000000..0b37a4b96d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst @@ -0,0 +1,2 @@ +Preserve generator state when _random.Random.setstate() raises an exception. +Patch by Bryan Olson. diff --git a/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst b/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst new file mode 100644 index 00000000000..a9ed2719b4a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst @@ -0,0 +1,2 @@ +inspect.isabstract() now works during __init_subclass__. Patch by Nate +Soares. diff --git a/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst b/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst new file mode 100644 index 00000000000..cb1577550a6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst @@ -0,0 +1 @@ +Add support for curses.A_ITALIC. diff --git a/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst b/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst new file mode 100644 index 00000000000..7c52e0693e8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst @@ -0,0 +1,3 @@ +unittest's assertAlmostEqual and assertNotAlmostEqual provide a better +message in case of failure which includes the difference between left and +right arguments. (patch by Giampaolo Rodola') diff --git a/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst b/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst new file mode 100644 index 00000000000..fdd33cc0022 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst @@ -0,0 +1,2 @@ +The seek() and tell() methods of io.FileIO now set the internal seekable +attribute to avoid one syscall on open() (in buffered or text mode). diff --git a/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst b/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst new file mode 100644 index 00000000000..2692614a80a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst @@ -0,0 +1 @@ +Fix getsockname() for unbound AF_UNIX sockets on Linux. diff --git a/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst b/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst new file mode 100644 index 00000000000..dd8fc74567d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst @@ -0,0 +1,3 @@ +Various updates to typing module: add typing.NoReturn type, use +WrapperDescriptorType, minor bug-fixes. Original PRs by Jim Fasarakis- +Hilliard and Ivan Levkivskyi. diff --git a/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst b/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst new file mode 100644 index 00000000000..b49ba6f2ce9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst @@ -0,0 +1,2 @@ +binascii.b2a_uu() and uu.encode() now support using ``'`'`` as zero instead +of space. diff --git a/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst b/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst new file mode 100644 index 00000000000..f19d47c7af9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst @@ -0,0 +1,2 @@ +Avoid KeyboardInterrupt tracebacks in forkserver helper process when Ctrl-C +is received. diff --git a/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst b/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst new file mode 100644 index 00000000000..36e2939c902 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst @@ -0,0 +1,3 @@ +Compiled regular expression objects with the re.LOCALE flag no longer depend +on the locale at compile time. Only the locale at matching time affects the +result of matching. diff --git a/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst b/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst new file mode 100644 index 00000000000..6037eaf2555 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst @@ -0,0 +1,3 @@ +Removed the __init__ methods of _json's scanner and encoder. Misusing them +could cause memory leaks or crashes. Now scanner and encoder objects are +completely initialized in the __new__ methods. diff --git a/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst b/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst new file mode 100644 index 00000000000..ea6329d3952 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst @@ -0,0 +1,3 @@ +rewrite cgi.parse_multipart, reusing the FieldStorage class and making its +results consistent with those of FieldStorage for multipart/form-data +requests. Patch by Pierre Quentel. diff --git a/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst b/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst new file mode 100644 index 00000000000..7a6793095f4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst @@ -0,0 +1 @@ +Fix range checking in GB18030 decoder. Original patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst b/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst new file mode 100644 index 00000000000..2e09fb93042 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst @@ -0,0 +1 @@ +Optimized case-insensitive matching and searching of regular expressions. diff --git a/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst b/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst new file mode 100644 index 00000000000..d0102a01a4e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst @@ -0,0 +1,4 @@ +Weaken the condition of deprecation warnings for inline modifiers. Now +allowed several subsequential inline modifiers at the start of the pattern +(e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments now are +allowed before and between inline modifiers (e.g. ``'(?x) (?i) (?s)...'``). diff --git a/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst b/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst new file mode 100644 index 00000000000..d79acef6765 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst @@ -0,0 +1,2 @@ +Enhanced regular expressions optimization. This increased the performance of +matching some patterns up to 25 times. diff --git a/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst b/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst new file mode 100644 index 00000000000..c9154526ddb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst @@ -0,0 +1,3 @@ +contextlib.AbstractContextManager now supports anti-registration by setting +__enter__ = None or __exit__ = None, following the pattern introduced in +bpo-25958. Patch by Jelle Zijlstra. diff --git a/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst b/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst new file mode 100644 index 00000000000..ee47a9e5832 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst @@ -0,0 +1,2 @@ +Fixed ``Task.cancel()`` can be ignored when the task is running coroutine +and the coroutine returned without any more ``await``. diff --git a/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst b/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst new file mode 100644 index 00000000000..00702b5d1e4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst @@ -0,0 +1,2 @@ +Compiling regular expression in debug mode on CPython now displays the +compiled bytecode in human readable form. diff --git a/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst b/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst new file mode 100644 index 00000000000..c1e4112dc07 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst @@ -0,0 +1 @@ +The :mod:`macpath` is now deprecated and will be removed in Python 3.8. diff --git a/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst b/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst new file mode 100644 index 00000000000..a435b8246f1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst @@ -0,0 +1,4 @@ +Removed previously deprecated in Python 2.4 classes Plist, Dict and +_InternalDict in the plistlib module. Dict values in the result of +functions readPlist() and readPlistFromBytes() are now normal dicts. You no +longer can use attribute access to access items of these dictionaries. diff --git a/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst b/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst new file mode 100644 index 00000000000..d9d7be37e44 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst @@ -0,0 +1,3 @@ +imaplib and poplib now catch the Windows socket WSAEINVAL error (code 10022) +on shutdown(SHUT_RDWR): An invalid operation was attempted. This error +occurs sometimes on SSL connections. diff --git a/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst b/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst new file mode 100644 index 00000000000..cb0f7eb038c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst @@ -0,0 +1,3 @@ +Warnings emitted when compile a regular expression now always point to the +line in the user code. Previously they could point into inners of the re +module if emitted from inside of groups or conditionals. diff --git a/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst b/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst new file mode 100644 index 00000000000..0479f10483f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst @@ -0,0 +1,2 @@ +Fix AttributeError when using SimpleQueue.empty() under *spawn* and +*forkserver* start methods. diff --git a/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst b/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst new file mode 100644 index 00000000000..ad6724d5f07 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst @@ -0,0 +1,3 @@ +importlib.find_spec() raises ModuleNotFoundError instead of AttributeError +if the specified parent module is not a package (i.e. lacks a __path__ +attribute). diff --git a/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst b/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst new file mode 100644 index 00000000000..44a69f47ce8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst @@ -0,0 +1,2 @@ +inspect.signature() now supports callables with variable-argument parameters +wrapped with partialmethod. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst b/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst new file mode 100644 index 00000000000..ac449728fd7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst @@ -0,0 +1 @@ +Fix handling escape characters in HZ codec. Based on patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst b/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst new file mode 100644 index 00000000000..3bd0a23069e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst @@ -0,0 +1,2 @@ +multiprocessing.Queue._feed background running thread do not break from main +loop on exception. diff --git a/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst b/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst new file mode 100644 index 00000000000..666175af758 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst @@ -0,0 +1,2 @@ +Deprecate invalid ctypes call protection on Windows. Patch by Mariatta +Wijaya. diff --git a/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst b/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst new file mode 100644 index 00000000000..5b1b3f9d4d8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst @@ -0,0 +1 @@ +Allow registering at-fork handlers. diff --git a/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst b/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst new file mode 100644 index 00000000000..5994abe142c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst @@ -0,0 +1,2 @@ +Fix the problem that logging.handlers.SysLogHandler cannot handle IPv6 +addresses. diff --git a/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst b/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst new file mode 100644 index 00000000000..f7c1b254c5a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst @@ -0,0 +1,2 @@ +Fix possible overflow when organize struct.pack_into error message. Patch +by Yuan Liu. diff --git a/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst b/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst new file mode 100644 index 00000000000..ab5a622021a --- /dev/null +++ b/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst @@ -0,0 +1 @@ +Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through attribute. diff --git a/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst b/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst new file mode 100644 index 00000000000..f9f28700076 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst @@ -0,0 +1 @@ +faulthandler now correctly filters and displays exception codes on Windows diff --git a/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst b/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst new file mode 100644 index 00000000000..87b18d9f47f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst @@ -0,0 +1 @@ +Loggers are now pickleable. diff --git a/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst b/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst new file mode 100644 index 00000000000..588d17e8ee4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst @@ -0,0 +1,2 @@ +Addded empty __slots__ to abc.ABC. This allows subclassers to deny __dict__ +and __weakref__ creation. Patch by Aaron Hall. diff --git a/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst b/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst new file mode 100644 index 00000000000..43e149daffe --- /dev/null +++ b/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst @@ -0,0 +1,2 @@ +On Windows, subprocess.Popen.communicate() now also ignore EINVAL on +stdin.write() if the child process is still running but closed the pipe. diff --git a/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst b/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst new file mode 100644 index 00000000000..8292e857a90 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst @@ -0,0 +1,2 @@ +modify() method of poll(), epoll() and devpoll() based classes of selectors +module is around 10% faster. Patch by Giampaolo Rodola'. diff --git a/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst b/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst new file mode 100644 index 00000000000..3e31ab1b855 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst @@ -0,0 +1 @@ +Fix waiter cancellation in asyncio.Lock. Patch by Mathieu Sornay. diff --git a/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst b/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst new file mode 100644 index 00000000000..c4264b45ce5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst @@ -0,0 +1,2 @@ +Closing transport during handshake process leaks open socket. Patch by +Nikolay Kim diff --git a/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst b/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst new file mode 100644 index 00000000000..55b78a7a79b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst @@ -0,0 +1,2 @@ +Fix ssl sockets leaks when connection is aborted in asyncio/ssl +implementation. Patch by Micha?l Sgha?er. diff --git a/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst b/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst new file mode 100644 index 00000000000..a01c8dda8a7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst @@ -0,0 +1,2 @@ +re.compile() no longer raises a BytesWarning when compiling a bytes instance +with misplaced inline modifier. Patch by Roy Williams. diff --git a/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst b/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst new file mode 100644 index 00000000000..96a4eeb3cb9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst @@ -0,0 +1,3 @@ +Updates to typing module: Add generic AsyncContextManager, add support for +ContextManager on all versions. Original PRs by Jelle Zijlstra and Ivan +Levkivskyi diff --git a/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst b/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst new file mode 100644 index 00000000000..6f3e2b62ebb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst @@ -0,0 +1,3 @@ +multiprocessing.Queue.get() with a timeout now polls its reader in non- +blocking mode if it succeeded to acquire the lock but the acquire took +longer than the timeout. diff --git a/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst b/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst new file mode 100644 index 00000000000..26cb1cb041f --- /dev/null +++ b/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst @@ -0,0 +1,2 @@ +selectors does not take KeyboardInterrupt and SystemExit into account, +leaving a fd in a bad state in case of error. Patch by Giampaolo Rodola'. diff --git a/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst b/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst new file mode 100644 index 00000000000..b8cec56c0a1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst @@ -0,0 +1 @@ +The dis.dis() function now is able to disassemble nested code objects. diff --git a/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst b/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst new file mode 100644 index 00000000000..309908f7cfc --- /dev/null +++ b/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst @@ -0,0 +1,2 @@ +Fix path calculation in `imp.load_package()`, fixing it for cases when a +package is only shipped with bytecodes. Patch by Alexandru Ardelean. diff --git a/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst b/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst new file mode 100644 index 00000000000..c0322082e8b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst @@ -0,0 +1 @@ +Don't log exceptions if Task/Future "cancel()" method was called. diff --git a/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst b/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst new file mode 100644 index 00000000000..80de944b4e8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst @@ -0,0 +1,2 @@ +The traceback no longer displayed for SystemExit raised in a callback +registered by atexit. diff --git a/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst b/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst new file mode 100644 index 00000000000..ac5f0bb2f1b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst @@ -0,0 +1,3 @@ +Fix multiprocessing.Process.exitcode to return the opposite of the signal +number when the process is killed by a signal (instead of 255) when using +the "forkserver" method. diff --git a/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst b/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst new file mode 100644 index 00000000000..ac5b648a25b --- /dev/null +++ b/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst @@ -0,0 +1 @@ +Avoid race condition in multiprocessing cleanup. diff --git a/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst b/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst new file mode 100644 index 00000000000..5a87ccb421d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst @@ -0,0 +1,2 @@ +pkgutil.walk_packages function now raises ValueError if *path* is a string. +Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst b/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst new file mode 100644 index 00000000000..16004ccc3a3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst @@ -0,0 +1 @@ +lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. diff --git a/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst b/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst new file mode 100644 index 00000000000..bfb9a1df80e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst @@ -0,0 +1,2 @@ +Fix race condition between signal delivery and wakeup file descriptor. +Patch by Nathaniel Smith. diff --git a/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst b/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst new file mode 100644 index 00000000000..e254768b94e --- /dev/null +++ b/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst @@ -0,0 +1 @@ +Functional API of enum allows to create empty enums. Patched by Dong-hee Na diff --git a/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst b/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst new file mode 100644 index 00000000000..f4f1b277c18 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst @@ -0,0 +1,2 @@ +Fixed the lgettext() family of functions in the gettext module. They now +always return bytes. diff --git a/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst b/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst new file mode 100644 index 00000000000..9395b6bc7bb --- /dev/null +++ b/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst @@ -0,0 +1,3 @@ +Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non +repr() based thread name by default when no thread_name_prefix is supplied. +They will now identify themselves as "ThreadPoolExecutor-y_n". diff --git a/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst b/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst new file mode 100644 index 00000000000..5e54970454d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst @@ -0,0 +1 @@ +struct.Struct.format type is now :class:`str` instead of :class:`bytes`. diff --git a/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst b/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst new file mode 100644 index 00000000000..2636960523c --- /dev/null +++ b/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst @@ -0,0 +1,2 @@ +The description of a unittest subtest now preserves the order of keyword +arguments of TestCase.subTest(). diff --git a/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst b/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst new file mode 100644 index 00000000000..94803bb5f1d --- /dev/null +++ b/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst @@ -0,0 +1,2 @@ +Prohibited the '=' character in environment variable names in +``os.putenv()`` and ``os.spawn*()``. diff --git a/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst b/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst new file mode 100644 index 00000000000..862c114aef8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst @@ -0,0 +1,2 @@ +os.listdir() and os.scandir() now emit bytes names when called with bytes- +like argument. diff --git a/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst b/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst new file mode 100644 index 00000000000..a37d3703842 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst @@ -0,0 +1,2 @@ +ftplib.FTP.putline() now throws ValueError on commands that contains CR or +LF. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst b/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst new file mode 100644 index 00000000000..96d066d41d2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst @@ -0,0 +1 @@ +Update zlib to 1.2.11. diff --git a/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst b/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst new file mode 100644 index 00000000000..7394ac2ff0e --- /dev/null +++ b/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst @@ -0,0 +1,5 @@ +.. original section: Library + +Update expat copy from 2.1.1 to 2.2.0 to get fixes of CVE-2016-0718 and +CVE-2016-4472. See https://sourceforge.net/p/expat/bugs/537/ for more +information. diff --git a/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst b/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst new file mode 100644 index 00000000000..adf464567b0 --- /dev/null +++ b/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst @@ -0,0 +1,6 @@ +.. original section: Library + +Fix urllib.parse.splithost() to correctly parse fragments. For example, +``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the +``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an +authentification (``login at host``). diff --git a/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst b/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst new file mode 100644 index 00000000000..ebbd359e63f --- /dev/null +++ b/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst @@ -0,0 +1,10 @@ +.. original section: Library + +Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security +vulnerabilities including: CVE-2017-9233 (External entity infinite loop +DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix +regression bugs from 2.2.0's fix to CVE-2016-0718) and CVE-2012-0876 +(Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os- +specific entropy sources like getrandom) doesn't impact Python, since Python +already gets entropy from the OS to set the expat secret using +``XML_SetHashSalt()``. diff --git a/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst b/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst new file mode 100644 index 00000000000..008aa706d49 --- /dev/null +++ b/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst @@ -0,0 +1,4 @@ +.. original section: Library + +Prevent environment variables injection in subprocess on Windows. Prevent +passing other environment variables and command arguments. diff --git a/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst b/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst new file mode 100644 index 00000000000..1288f34f5ac --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst @@ -0,0 +1,2 @@ +Add the support.setswitchinterval() function to fix test_functools hanging +on the Android armv7 qemu emulator. diff --git a/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst b/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst new file mode 100644 index 00000000000..90fb8631c10 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst @@ -0,0 +1 @@ +Adds _testconsole module to test console input. diff --git a/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst b/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst new file mode 100644 index 00000000000..27af4a2135a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst @@ -0,0 +1 @@ +regrtest: fix the parser of command line arguments. diff --git a/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst b/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst new file mode 100644 index 00000000000..78384ffb4c1 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst @@ -0,0 +1,2 @@ +Fix test_posix for Android where 'id -G' is entirely wrong or missing the +effective gid. diff --git a/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst b/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst new file mode 100644 index 00000000000..8cf2627787e --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst @@ -0,0 +1 @@ +Various caches now are cleared before running every test file. diff --git a/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst b/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst new file mode 100644 index 00000000000..ec9830397c4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst @@ -0,0 +1,2 @@ +Now test.support.rmtree is able to remove unwritable or unreadable +directories. diff --git a/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst b/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst new file mode 100644 index 00000000000..330399cc4bf --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst @@ -0,0 +1,2 @@ +Fix the test_socket failures on Android - getservbyname(), getservbyport() +and getaddrinfo() are broken on some Android API levels. diff --git a/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst b/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst new file mode 100644 index 00000000000..2dd5006f2c5 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst @@ -0,0 +1,2 @@ +Fix the tests that bind() a unix socket and raise PermissionError on Android +for a non-root user. diff --git a/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst b/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst new file mode 100644 index 00000000000..c7421780b2d --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst @@ -0,0 +1 @@ +Disallow -j0 to be combined with -T/-l in regrtest command line arguments. diff --git a/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst b/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst new file mode 100644 index 00000000000..044e7a40dda --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst @@ -0,0 +1 @@ +Use proper command line parsing in _testembed diff --git a/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst b/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst new file mode 100644 index 00000000000..63461bb478b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst @@ -0,0 +1,5 @@ +Enhanced functions swap_attr() and swap_item() in the test.support module. +They now work when delete replaced attribute or item inside the with +statement. The old value of the attribute or item (or None if it doesn't +exist) now will be assigned to the target of the "as" clause, if there is +one. diff --git a/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst b/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst new file mode 100644 index 00000000000..c7e7b7f242b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst @@ -0,0 +1,3 @@ +test_thread: setUp() now uses support.threading_setup() and +support.threading_cleanup() to wait until threads complete to avoid random +side effects on following tests. Initial patch written by Grzegorz Grzywacz. diff --git a/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst b/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst new file mode 100644 index 00000000000..bfd2f95def1 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst @@ -0,0 +1,2 @@ +The zipfile module CLI now prints usage to stderr. Patch by Stephen J. +Turnbull. diff --git a/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst b/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst new file mode 100644 index 00000000000..0d785edcb5d --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst @@ -0,0 +1,4 @@ +The pybench and pystone microbenchmark have been removed from Tools. Please +use the new Python benchmark suite https://github.com/python/performance +which is more reliable and includes a portable version of pybench working on +Python 2 and Python 3. diff --git a/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst b/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst new file mode 100644 index 00000000000..515c7175a79 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst @@ -0,0 +1 @@ +Fix python-gdb.py didn't support new dict implementation. diff --git a/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst b/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst new file mode 100644 index 00000000000..c0dc7d1f975 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst @@ -0,0 +1,2 @@ +python-gdb.py now supports also ``method-wrapper`` (``wrapperobject``) +objects. diff --git a/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst b/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst new file mode 100644 index 00000000000..1be5ab30e9c --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst @@ -0,0 +1,3 @@ +Argument Clinic now uses the converter `bool(accept={int})` rather than +`int` for semantical booleans. This avoids repeating the default value for +Python and C and will help in converting to `bool` in future. diff --git a/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst b/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst new file mode 100644 index 00000000000..2992d06249f --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst @@ -0,0 +1 @@ +Added the slice index converter in Argument Clinic. diff --git a/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst b/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst new file mode 100644 index 00000000000..fb06e8ea323 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst @@ -0,0 +1 @@ +Windows ._pth file should allow import site diff --git a/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst b/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst new file mode 100644 index 00000000000..fd98a660c9a --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst @@ -0,0 +1 @@ +Renames Windows path file to ._pth diff --git a/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst b/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst new file mode 100644 index 00000000000..83ee2eb8df0 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst @@ -0,0 +1 @@ +_PyIO_get_console_type fails for various paths diff --git a/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst b/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst new file mode 100644 index 00000000000..0c44499e74a --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst @@ -0,0 +1 @@ +WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle diff --git a/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst b/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst new file mode 100644 index 00000000000..2568d3676b5 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst @@ -0,0 +1 @@ +WindowsConsoleIO readall() fails if first line starts with Ctrl+Z diff --git a/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst b/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst new file mode 100644 index 00000000000..667817a2fd9 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst @@ -0,0 +1 @@ +Opening CON for write access fails diff --git a/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst b/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst new file mode 100644 index 00000000000..174690e49ae --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst @@ -0,0 +1 @@ +launcher.msi has different product codes between 32-bit and 64-bit diff --git a/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst b/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst new file mode 100644 index 00000000000..16d5ad08d80 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst @@ -0,0 +1 @@ +Improvements to help manuals on Windows. diff --git a/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst b/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst new file mode 100644 index 00000000000..564c925e182 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst @@ -0,0 +1 @@ +Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun) diff --git a/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst b/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst new file mode 100644 index 00000000000..cdf17e1685d --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst @@ -0,0 +1 @@ +Adds signed catalog files for stdlib on Windows. diff --git a/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst b/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst new file mode 100644 index 00000000000..9b91f326d77 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst @@ -0,0 +1 @@ +Fixes mishandled buffer reallocation in getpathp.c diff --git a/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst b/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst new file mode 100644 index 00000000000..727830c3899 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst @@ -0,0 +1 @@ +Deprecate WindowsRegistryFinder and disable it by default diff --git a/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst b/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst new file mode 100644 index 00000000000..efe97458158 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst @@ -0,0 +1 @@ +winreg does not truncate string correctly (Patch by Eryk Sun) diff --git a/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst b/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst new file mode 100644 index 00000000000..13c5b0d9dfd --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst @@ -0,0 +1 @@ +Removes readme.txt from the installer. diff --git a/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst b/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst new file mode 100644 index 00000000000..be003d1a0cf --- /dev/null +++ b/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst @@ -0,0 +1,4 @@ +The build process on Windows no longer depends on Subversion, instead +pulling external code from GitHub via a Python script. If Python 3.6 is not +found on the system (via ``py -3.6``), NuGet is used to download a copy of +32-bit Python. From webhook-mailer at python.org Mon Sep 4 16:32:13 2017 From: webhook-mailer at python.org (Barry Warsaw) Date: Mon, 04 Sep 2017 20:32:13 -0000 Subject: [Python-checkins] bpo-1198569: Allow string.Template braced pattern to be different (#3288) Message-ID: https://github.com/python/cpython/commit/ba4279683f8eb8f59be10d12547ea89480614388 commit: ba4279683f8eb8f59be10d12547ea89480614388 branch: master author: Barry Warsaw committer: GitHub date: 2017-09-04T16:32:10-04:00 summary: bpo-1198569: Allow string.Template braced pattern to be different (#3288) * bpo-1198569: Allow the braced pattern to be different ``string.Template`` subclasses can optionally define ``braceidpattern`` if they want to specify different placeholder patterns inside and outside the braces. If None (the default) it falls back to ``idpattern``. files: A Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst M Doc/library/string.rst M Lib/string.py M Lib/test/test_string.py diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 8176a81d4cf..1a9b6309752 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -754,9 +754,21 @@ attributes: be set in the subclass's class namespace). * *idpattern* -- This is the regular expression describing the pattern for - non-braced placeholders (the braces will be added automatically as - appropriate). The default value is the regular expression - ``[_a-z][_a-z0-9]*``. + non-braced placeholders. The default value is the regular expression + ``[_a-z][_a-z0-9]*``. If this is given and *braceidpattern* is ``None`` + this pattern will also apply to braced placeholders. + + .. versionchanged:: 3.7 + *braceidpattern* can be used to define separate patterns used inside and + outside the braces. + +* *braceidpattern* -- This is like *idpattern* but describes the pattern for + braced placeholders. Defaults to ``None`` which means to fall back to + *idpattern* (i.e. the same pattern is used both inside and outside braces). + If given, this allows you to define different patterns for braced and + unbraced placeholders. + + .. versionadded:: 3.7 * *flags* -- The regular expression flags that will be applied when compiling the regular expression used for recognizing substitutions. The default value diff --git a/Lib/string.py b/Lib/string.py index bc9508c1e6e..b46e60c38f4 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -57,7 +57,7 @@ class _TemplateMetaclass(type): %(delim)s(?: (?P%(delim)s) | # Escape sequence of two delimiters (?P%(id)s) | # delimiter and a Python identifier - {(?P%(id)s)} | # delimiter and a braced identifier + {(?P%(bid)s)} | # delimiter and a braced identifier (?P) # Other ill-formed delimiter exprs ) """ @@ -70,6 +70,7 @@ def __init__(cls, name, bases, dct): pattern = _TemplateMetaclass.pattern % { 'delim' : _re.escape(cls.delimiter), 'id' : cls.idpattern, + 'bid' : cls.braceidpattern or cls.idpattern, } cls.pattern = _re.compile(pattern, cls.flags | _re.VERBOSE) @@ -79,6 +80,7 @@ class Template(metaclass=_TemplateMetaclass): delimiter = '$' idpattern = r'[_a-z][_a-z0-9]*' + braceidpattern = None flags = _re.IGNORECASE def __init__(self, template): diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index a7b8aad8aba..6e241ac72ab 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -282,6 +282,30 @@ class PathPattern(Template): s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + def test_idpattern_override_inside_outside(self): + # bpo-1198569: Allow the regexp inside and outside braces to be + # different when deriving from Template. + class MyPattern(Template): + idpattern = r'[a-z]+' + braceidpattern = r'[A-Z]+' + flags = 0 + m = dict(foo='foo', BAR='BAR') + s = MyPattern('$foo ${BAR}') + self.assertEqual(s.substitute(m), 'foo BAR') + + def test_idpattern_override_inside_outside_invalid_unbraced(self): + # bpo-1198569: Allow the regexp inside and outside braces to be + # different when deriving from Template. + class MyPattern(Template): + idpattern = r'[a-z]+' + braceidpattern = r'[A-Z]+' + flags = 0 + m = dict(foo='foo', BAR='BAR') + s = MyPattern('$FOO') + self.assertRaises(ValueError, s.substitute, m) + s = MyPattern('${bar}') + self.assertRaises(ValueError, s.substitute, m) + def test_pattern_override(self): class MyPattern(Template): pattern = r""" diff --git a/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst b/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst new file mode 100644 index 00000000000..86754191e7d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst @@ -0,0 +1,3 @@ +``string.Template`` subclasses can optionally define ``braceidpattern`` if +they want to specify different placeholder patterns inside and outside the +braces. If None (the default) it falls back to ``idpattern``. From webhook-mailer at python.org Mon Sep 4 16:32:36 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 20:32:36 -0000 Subject: [Python-checkins] remote note about IRIX in aifc (#3299) Message-ID: https://github.com/python/cpython/commit/5b79d60d2cdd28989f07dd4a6bdff3a9b455ab58 commit: 5b79d60d2cdd28989f07dd4a6bdff3a9b455ab58 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T13:32:34-07:00 summary: remote note about IRIX in aifc (#3299) This comment hasn't been true since Python 3.0. files: M Doc/library/aifc.rst diff --git a/Doc/library/aifc.rst b/Doc/library/aifc.rst index 23a96207d08..970a7aeb98a 100644 --- a/Doc/library/aifc.rst +++ b/Doc/library/aifc.rst @@ -18,12 +18,6 @@ AIFF is Audio Interchange File Format, a format for storing digital audio samples in a file. AIFF-C is a newer version of the format that includes the ability to compress the audio data. -.. note:: - - Some operations may only work under IRIX; these will raise :exc:`ImportError` - when attempting to import the :mod:`cl` module, which is only available on - IRIX. - Audio files have a number of parameters that describe the audio data. The sampling rate or frame rate is the number of times per second the sound is sampled. The number of channels indicate if the audio is mono, stereo, or From webhook-mailer at python.org Mon Sep 4 16:54:50 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 20:54:50 -0000 Subject: [Python-checkins] [3.6] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3300) Message-ID: https://github.com/python/cpython/commit/4bc8ef0eeed191f9398a90e748f732cfba67546d commit: 4bc8ef0eeed191f9398a90e748f732cfba67546d branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-04T22:54:47+02:00 summary: [3.6] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3300) Signed-off-by: Christian Heimes (cherry picked from commit 002d64039b60c1a9289f981fe73a5cf91d082136) files: A Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst D Lib/test/sha256.pem M Lib/test/test_ssl.py diff --git a/Lib/test/sha256.pem b/Lib/test/sha256.pem deleted file mode 100644 index d3db4b85c0a..00000000000 --- a/Lib/test/sha256.pem +++ /dev/null @@ -1,128 +0,0 @@ -# Certificate chain for https://sha256.tbs-internet.com - 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com - i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC ------BEGIN CERTIFICATE----- -MIIGXDCCBUSgAwIBAgIRAKpVmHgg9nfCodAVwcP4siwwDQYJKoZIhvcNAQELBQAw -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMB4XDTEyMDEwNDAwMDAwMFoXDTE0MDIxNzIzNTk1OVowgcsxCzAJBgNV -BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV -BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM -VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS -c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0 -LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKQIX/zdJcyxty0m -PM1XQSoSSifueS3AVcgqMsaIKS/u+rYzsv4hQ/qA6vLn5m5/ewUcZDj7zdi6rBVf -PaVNXJ6YinLX0tkaW8TEjeVuZG5yksGZlhCt1CJ1Ho9XLiLaP4uJ7MCoNUntpJ+E -LfrOdgsIj91kPmwjDJeztVcQCvKzhjVJA/KxdInc0JvOATn7rpaSmQI5bvIjufgo -qVsTPwVFzuUYULXBk7KxRT7MiEqnd5HvviNh0285QC478zl3v0I0Fb5El4yD3p49 -IthcRnxzMKc0UhU5ogi0SbONyBfm/mzONVfSxpM+MlyvZmJqrbuuLoEDzJD+t8PU -xSuzgbcCAwEAAaOCAj4wggI6MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMB0GA1UdDgQWBBT/qTGYdaj+f61c2IRFL/B1eEsM8DAOBgNVHQ8BAf8EBAMC -BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG -CisGAQQBgjcKAwMGCWCGSAGG+EIEATBLBgNVHSAERDBCMEAGCisGAQQB5TcCBAEw -MjAwBggrBgEFBQcCARYkaHR0cHM6Ly93d3cudGJzLWludGVybmV0LmNvbS9DQS9D -UFM0MG0GA1UdHwRmMGQwMqAwoC6GLGh0dHA6Ly9jcmwudGJzLWludGVybmV0LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMC6gLKAqhihodHRwOi8vY3JsLnRicy14NTA5LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMIGmBggrBgEFBQcBAQSBmTCBljA4BggrBgEFBQcw -AoYsaHR0cDovL2NydC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQVNHQy5jcnQw -NAYIKwYBBQUHMAKGKGh0dHA6Ly9jcnQudGJzLXg1MDkuY29tL1RCU1g1MDlDQVNH -Qy5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLnRicy14NTA5LmNvbTA/BgNV -HREEODA2ghdzaGEyNTYudGJzLWludGVybmV0LmNvbYIbd3d3LnNoYTI1Ni50YnMt -aW50ZXJuZXQuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA0pOuL8QvAa5yksTbGShzX -ABApagunUGoEydv4YJT1MXy9tTp7DrWaozZSlsqBxrYAXP1d9r2fuKbEniYHxaQ0 -UYaf1VSIlDo1yuC8wE7wxbHDIpQ/E5KAyxiaJ8obtDhFstWAPAH+UoGXq0kj2teN -21sFQ5dXgA95nldvVFsFhrRUNB6xXAcaj0VZFhttI0ZfQZmQwEI/P+N9Jr40OGun -aa+Dn0TMeUH4U20YntfLbu2nDcJcYfyurm+8/0Tr4HznLnedXu9pCPYj0TaddrgT -XO0oFiyy7qGaY6+qKh71yD64Y3ycCJ/HR9Wm39mjZYc9ezYwT4noP6r7Lk8YO7/q ------END CERTIFICATE----- - 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC - i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk -ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF -eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6 -rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0 -9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ -ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk -owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G -Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk -9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ -MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3 -AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk -ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k -by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw -cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV -VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B -ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN -AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232 -euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY -1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98 -RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz -8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV -v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E= ------END CERTIFICATE----- - 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT -AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0 -ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB -IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05 -4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6 -2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh -alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv -u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW -xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p -XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd -tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX -BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov -L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN -AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO -rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd -FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM -+bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI -3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb -+M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g= ------END CERTIFICATE----- - 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG -EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD -VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu -dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 -E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ -D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK -4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq -lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW -bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB -o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT -MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js -LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr -BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB -AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj -j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH -KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv -2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 -mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 3fdbba13705..4c060ea1c1e 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1793,34 +1793,6 @@ def test_get_server_certificate_ipv6(self): _test_get_server_certificate(self, 'ipv6.google.com', 443) _test_get_server_certificate_fail(self, 'ipv6.google.com', 443) - def test_algorithms(self): - # Issue #8484: all algorithms should be available when verifying a - # certificate. - # SHA256 was added in OpenSSL 0.9.8 - if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15): - self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION) - # sha256.tbs-internet.com needs SNI to use the correct certificate - if not ssl.HAS_SNI: - self.skipTest("SNI needed for this test") - # https://sha2.hboeck.de/ was used until 2011-01-08 (no route to host) - remote = ("sha256.tbs-internet.com", 443) - sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem") - with support.transient_internet("sha256.tbs-internet.com"): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.load_verify_locations(sha256_cert) - s = ctx.wrap_socket(socket.socket(socket.AF_INET), - server_hostname="sha256.tbs-internet.com") - try: - s.connect(remote) - if support.verbose: - sys.stdout.write("\nCipher with %r is %r\n" % - (remote, s.cipher())) - sys.stdout.write("Certificate is:\n%s\n" % - pprint.pformat(s.getpeercert())) - finally: - s.close() - def _test_get_server_certificate(test, host, port, cert=None): pem = ssl.get_server_certificate((host, port)) diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst new file mode 100644 index 00000000000..383d1b43615 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst @@ -0,0 +1 @@ +Remove sha256.tbs-internet.com ssl test From webhook-mailer at python.org Mon Sep 4 16:58:26 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 20:58:26 -0000 Subject: [Python-checkins] [3.6] remote note about IRIX in aifc (#3304) Message-ID: https://github.com/python/cpython/commit/703fdb837abb8e6c4df4e7070dc266383e9a7bd7 commit: 703fdb837abb8e6c4df4e7070dc266383e9a7bd7 branch: 3.6 author: Benjamin Peterson committer: GitHub date: 2017-09-04T13:58:23-07:00 summary: [3.6] remote note about IRIX in aifc (#3304) This comment hasn't been true since Python 3.0. (cherry picked from commit b84efddb9a87d515029bac943812b66eb3486eb5) files: M Doc/library/aifc.rst diff --git a/Doc/library/aifc.rst b/Doc/library/aifc.rst index 23a96207d08..970a7aeb98a 100644 --- a/Doc/library/aifc.rst +++ b/Doc/library/aifc.rst @@ -18,12 +18,6 @@ AIFF is Audio Interchange File Format, a format for storing digital audio samples in a file. AIFF-C is a newer version of the format that includes the ability to compress the audio data. -.. note:: - - Some operations may only work under IRIX; these will raise :exc:`ImportError` - when attempting to import the :mod:`cl` module, which is only available on - IRIX. - Audio files have a number of parameters that describe the audio data. The sampling rate or frame rate is the number of times per second the sound is sampled. The number of channels indicate if the audio is mono, stereo, or From webhook-mailer at python.org Mon Sep 4 17:05:35 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 21:05:35 -0000 Subject: [Python-checkins] remove configure.ac support for SGI_ABI (#3294) Message-ID: https://github.com/python/cpython/commit/14ce158e3d7c64cfcd2e74246bcafe088b95af2c commit: 14ce158e3d7c64cfcd2e74246bcafe088b95af2c branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T14:05:32-07:00 summary: remove configure.ac support for SGI_ABI (#3294) files: M configure M configure.ac diff --git a/configure b/configure index b5d57676e38..5b742b884dc 100755 --- a/configure +++ b/configure @@ -728,7 +728,6 @@ CFLAGS CC EXPORT_MACOSX_DEPLOYMENT_TARGET CONFIGURE_MACOSX_DEPLOYMENT_TARGET -SGI_ABI _PYTHON_HOST_PLATFORM MACHDEP FRAMEWORKINSTALLAPPSPREFIX @@ -3448,25 +3447,6 @@ $as_echo "#define _INCLUDE__STDC_A1_SOURCE 1" >>confdefs.h fi -# -# SGI compilers allow the specification of the both the ABI and the -# ISA on the command line. Depending on the values of these switches, -# different and often incompatible code will be generated. -# -# The SGI_ABI variable can be used to modify the CC and LDFLAGS and -# thus supply support for various ABI/ISA combinations. The MACHDEP -# variable is also adjusted. -# - -if test ! -z "$SGI_ABI" -then - CC="cc $SGI_ABI" - LDFLAGS="$SGI_ABI $LDFLAGS" - MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACHDEP" >&5 -$as_echo "$MACHDEP" >&6; } - # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, # it may influence the way we can build extensions, so distutils # needs to check it diff --git a/configure.ac b/configure.ac index 5786525b291..57f4492e484 100644 --- a/configure.ac +++ b/configure.ac @@ -546,24 +546,6 @@ then AC_DEFINE(_INCLUDE__STDC_A1_SOURCE, 1, Define to include mbstate_t for mbrtowc) fi -# -# SGI compilers allow the specification of the both the ABI and the -# ISA on the command line. Depending on the values of these switches, -# different and often incompatible code will be generated. -# -# The SGI_ABI variable can be used to modify the CC and LDFLAGS and -# thus supply support for various ABI/ISA combinations. The MACHDEP -# variable is also adjusted. -# -AC_SUBST(SGI_ABI) -if test ! -z "$SGI_ABI" -then - CC="cc $SGI_ABI" - LDFLAGS="$SGI_ABI $LDFLAGS" - MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` -fi -AC_MSG_RESULT($MACHDEP) - # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, # it may influence the way we can build extensions, so distutils # needs to check it From webhook-mailer at python.org Mon Sep 4 17:08:39 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 21:08:39 -0000 Subject: [Python-checkins] [2.7] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3301) Message-ID: https://github.com/python/cpython/commit/57d963b0b559078ca419811d0d25fea27d42f30c commit: 57d963b0b559078ca419811d0d25fea27d42f30c branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-04T23:08:36+02:00 summary: [2.7] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) (#3301) * bpo-25674: remove sha256.tbs-internet.com ssl test (#3297) Signed-off-by: Christian Heimes (cherry picked from commit 002d64039b60c1a9289f981fe73a5cf91d082136) * [2.7] bpo-25674: remove sha256.tbs-internet.com ssl test (GH-3297) Signed-off-by: Christian Heimes . (cherry picked from commit 002d64039b60c1a9289f981fe73a5cf91d082136) files: A Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst D Lib/test/sha256.pem M Lib/test/test_ssl.py diff --git a/Lib/test/sha256.pem b/Lib/test/sha256.pem deleted file mode 100644 index d3db4b85c0a..00000000000 --- a/Lib/test/sha256.pem +++ /dev/null @@ -1,128 +0,0 @@ -# Certificate chain for https://sha256.tbs-internet.com - 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com - i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC ------BEGIN CERTIFICATE----- -MIIGXDCCBUSgAwIBAgIRAKpVmHgg9nfCodAVwcP4siwwDQYJKoZIhvcNAQELBQAw -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMB4XDTEyMDEwNDAwMDAwMFoXDTE0MDIxNzIzNTk1OVowgcsxCzAJBgNV -BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV -BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM -VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS -c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0 -LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKQIX/zdJcyxty0m -PM1XQSoSSifueS3AVcgqMsaIKS/u+rYzsv4hQ/qA6vLn5m5/ewUcZDj7zdi6rBVf -PaVNXJ6YinLX0tkaW8TEjeVuZG5yksGZlhCt1CJ1Ho9XLiLaP4uJ7MCoNUntpJ+E -LfrOdgsIj91kPmwjDJeztVcQCvKzhjVJA/KxdInc0JvOATn7rpaSmQI5bvIjufgo -qVsTPwVFzuUYULXBk7KxRT7MiEqnd5HvviNh0285QC478zl3v0I0Fb5El4yD3p49 -IthcRnxzMKc0UhU5ogi0SbONyBfm/mzONVfSxpM+MlyvZmJqrbuuLoEDzJD+t8PU -xSuzgbcCAwEAAaOCAj4wggI6MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMB0GA1UdDgQWBBT/qTGYdaj+f61c2IRFL/B1eEsM8DAOBgNVHQ8BAf8EBAMC -BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG -CisGAQQBgjcKAwMGCWCGSAGG+EIEATBLBgNVHSAERDBCMEAGCisGAQQB5TcCBAEw -MjAwBggrBgEFBQcCARYkaHR0cHM6Ly93d3cudGJzLWludGVybmV0LmNvbS9DQS9D -UFM0MG0GA1UdHwRmMGQwMqAwoC6GLGh0dHA6Ly9jcmwudGJzLWludGVybmV0LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMC6gLKAqhihodHRwOi8vY3JsLnRicy14NTA5LmNv -bS9UQlNYNTA5Q0FTR0MuY3JsMIGmBggrBgEFBQcBAQSBmTCBljA4BggrBgEFBQcw -AoYsaHR0cDovL2NydC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQVNHQy5jcnQw -NAYIKwYBBQUHMAKGKGh0dHA6Ly9jcnQudGJzLXg1MDkuY29tL1RCU1g1MDlDQVNH -Qy5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLnRicy14NTA5LmNvbTA/BgNV -HREEODA2ghdzaGEyNTYudGJzLWludGVybmV0LmNvbYIbd3d3LnNoYTI1Ni50YnMt -aW50ZXJuZXQuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQA0pOuL8QvAa5yksTbGShzX -ABApagunUGoEydv4YJT1MXy9tTp7DrWaozZSlsqBxrYAXP1d9r2fuKbEniYHxaQ0 -UYaf1VSIlDo1yuC8wE7wxbHDIpQ/E5KAyxiaJ8obtDhFstWAPAH+UoGXq0kj2teN -21sFQ5dXgA95nldvVFsFhrRUNB6xXAcaj0VZFhttI0ZfQZmQwEI/P+N9Jr40OGun -aa+Dn0TMeUH4U20YntfLbu2nDcJcYfyurm+8/0Tr4HznLnedXu9pCPYj0TaddrgT -XO0oFiyy7qGaY6+qKh71yD64Y3ycCJ/HR9Wm39mjZYc9ezYwT4noP6r7Lk8YO7/q ------END CERTIFICATE----- - 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC - i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root ------BEGIN CERTIFICATE----- -MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk -ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF -eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow -gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl -bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u -ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv -cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg -Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6 -rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0 -9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ -ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk -owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G -Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk -9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf -2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ -MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3 -AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk -ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k -by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw -cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV -VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B -ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN -AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232 -euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY -1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98 -RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz -8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV -v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E= ------END CERTIFICATE----- - 2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT -AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0 -ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB -IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05 -4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6 -2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh -alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv -u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW -xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p -XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd -tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX -BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov -L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN -AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO -rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd -FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM -+bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI -3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb -+M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g= ------END CERTIFICATE----- - 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC - i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG -EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD -VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu -dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 -E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ -D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK -4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq -lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW -bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB -o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT -MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js -LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr -BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB -AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj -j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH -KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv -2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 -mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 07526c2cf15..d9ef232580c 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1588,34 +1588,6 @@ def test_ciphers(self): cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") s.connect(remote) - def test_algorithms(self): - # Issue #8484: all algorithms should be available when verifying a - # certificate. - # SHA256 was added in OpenSSL 0.9.8 - if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15): - self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION) - # sha256.tbs-internet.com needs SNI to use the correct certificate - if not ssl.HAS_SNI: - self.skipTest("SNI needed for this test") - # https://sha2.hboeck.de/ was used until 2011-01-08 (no route to host) - remote = ("sha256.tbs-internet.com", 443) - sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem") - with support.transient_internet("sha256.tbs-internet.com"): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.load_verify_locations(sha256_cert) - s = ctx.wrap_socket(socket.socket(socket.AF_INET), - server_hostname="sha256.tbs-internet.com") - try: - s.connect(remote) - if support.verbose: - sys.stdout.write("\nCipher with %r is %r\n" % - (remote, s.cipher())) - sys.stdout.write("Certificate is:\n%s\n" % - pprint.pformat(s.getpeercert())) - finally: - s.close() - def test_get_ca_certs_capath(self): # capath certs are loaded on request with support.transient_internet(REMOTE_HOST): diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst new file mode 100644 index 00000000000..383d1b43615 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst @@ -0,0 +1 @@ +Remove sha256.tbs-internet.com ssl test From webhook-mailer at python.org Mon Sep 4 17:23:25 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Mon, 04 Sep 2017 21:23:25 -0000 Subject: [Python-checkins] bpo-22536 [3.6] Set filename in FileNotFoundError (#3305) Message-ID: https://github.com/python/cpython/commit/1dba3789e335f06e3b01cdc84070f2e828c9b861 commit: 1dba3789e335f06e3b01cdc84070f2e828c9b861 branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-04T14:23:23-07:00 summary: bpo-22536 [3.6] Set filename in FileNotFoundError (#3305) * [3.6] bpo-22536: Set the filename in FileNotFoundError. (GH-3194) Have the subprocess module set the filename in the FileNotFoundError exception raised on POSIX systems when the executable or cwd are missing. (cherry picked from commit 8621bb5d93239316f97281826461b85072ff6db7) * bpo-22536 [3.6] (GH-3202) skip non-windows tests. files: A Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst M Lib/subprocess.py M Lib/test/test_subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index e0a93c55dc0..d0132342462 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1328,15 +1328,15 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" + # The error must be from chdir(cwd). + err_filename = cwd + else: + err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) if errno_num == errno.ENOENT: - if child_exec_never_called: - # The error must be from chdir(cwd). - err_msg += ': ' + repr(cwd) - else: - err_msg += ': ' + repr(orig_executable) - raise child_exception_type(errno_num, err_msg) + err_msg += ': ' + repr(err_filename) + raise child_exception_type(errno_num, err_msg, err_filename) raise child_exception_type(err_msg) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index ccdd3232700..83abe9d67f7 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1375,6 +1375,18 @@ def test_failed_child_execute_fd_leak(self): fds_after_exception = os.listdir(fd_directory) self.assertEqual(fds_before_popen, fds_after_exception) + @unittest.skipIf(mswindows, "behavior currently not supported on Windows") + def test_file_not_found_includes_filename(self): + with self.assertRaises(FileNotFoundError) as c: + subprocess.call(['/opt/nonexistent_binary', 'with', 'some', 'args']) + self.assertEqual(c.exception.filename, '/opt/nonexistent_binary') + + @unittest.skipIf(mswindows, "behavior currently not supported on Windows") + def test_file_not_found_with_bad_cwd(self): + with self.assertRaises(FileNotFoundError) as c: + subprocess.Popen(['exit', '0'], cwd='/some/nonexistent/directory') + self.assertEqual(c.exception.filename, '/some/nonexistent/directory') + class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): diff --git a/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst b/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst new file mode 100644 index 00000000000..bd238f95b8a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst @@ -0,0 +1,2 @@ +The subprocess module now sets the filename when FileNotFoundError +is raised on POSIX systems due to the executable or cwd not being found. From webhook-mailer at python.org Mon Sep 4 17:26:30 2017 From: webhook-mailer at python.org (Steve Dower) Date: Mon, 04 Sep 2017 21:26:30 -0000 Subject: [Python-checkins] Fixes doc/make.bat to properly handle quoted paths. (#3302) Message-ID: https://github.com/python/cpython/commit/d5cd21d75a27a377f2f9c8370fd8e8c7efaeefb1 commit: d5cd21d75a27a377f2f9c8370fd8e8c7efaeefb1 branch: master author: Steve Dower committer: GitHub date: 2017-09-04T14:26:27-07:00 summary: Fixes doc/make.bat to properly handle quoted paths. (#3302) files: M Doc/make.bat diff --git a/Doc/make.bat b/Doc/make.bat index b9e8a759c51..b03372aade7 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -6,18 +6,18 @@ pushd %~dp0 set this=%~n0 call ..\PCBuild\find_python.bat %PYTHON% -if "%SPHINXBUILD%" EQU "" if "%PYTHON%" NEQ "" ( - set SPHINXBUILD=%PYTHON%\..\Scripts\sphinx-build.exe - rem Cannot use %SPHINXBUILD% in the same block where we set it - if not exist "%PYTHON%\..\Scripts\sphinx-build.exe" ( +if not defined SPHINXBUILD if defined PYTHON ( + %PYTHON% -c "import sphinx" > nul 2> nul + if errorlevel 1 ( echo Installing sphinx with %PYTHON% - "%PYTHON%" -m pip install sphinx + %PYTHON% -m pip install sphinx if errorlevel 1 exit /B ) + set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()" ) -if "%PYTHON%" EQU "" set PYTHON=py -if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build +if not defined PYTHON set PYTHON=py +if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build if "%1" NEQ "htmlhelp" goto :skiphhcsearch if exist "%HTMLHELP%" goto :skiphhcsearch @@ -99,7 +99,7 @@ goto end if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) -cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%* +cmd /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%*" if "%1" EQU "htmlhelp" ( cmd /C "%HTMLHELP%" build\htmlhelp\python%DISTVERSION:.=%.hhp From webhook-mailer at python.org Mon Sep 4 17:29:29 2017 From: webhook-mailer at python.org (Barry Warsaw) Date: Mon, 04 Sep 2017 21:29:29 -0000 Subject: [Python-checkins] What's New for bpo-1198569 (#3303) Message-ID: https://github.com/python/cpython/commit/973b901212bd84d279904bab6654709f4ec32470 commit: 973b901212bd84d279904bab6654709f4ec32470 branch: master author: Barry Warsaw committer: GitHub date: 2017-09-04T17:29:27-04:00 summary: What's New for bpo-1198569 (#3303) files: M Doc/whatsnew/3.7.rst diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 8547660e188..f0c50e89a63 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -223,6 +223,13 @@ New function :func:`os.register_at_fork` allows registering Python callbacks to be executed on a process fork. (Contributed by Antoine Pitrou in :issue:`16500`.) +string +------ + +:class:`string.Template` now lets you to optionally modify the regular +expression pattern for braced placeholders and non-braced placeholders +separately. (Contributed by Barry Warsaw in :issue:`1198569`.) + unittest.mock ------------- From webhook-mailer at python.org Mon Sep 4 17:35:18 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 21:35:18 -0000 Subject: [Python-checkins] bpo-30622: Change NPN detection: (#2079) Message-ID: https://github.com/python/cpython/commit/b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8 commit: b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8 branch: master author: Melvyn Sopacua committer: Christian Heimes date: 2017-09-04T23:35:15+02:00 summary: bpo-30622: Change NPN detection: (#2079) * Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: #if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) # define OPENSSL_NPN_UNSUPPORTED 0 # define OPENSSL_NPN_NEGOTIATED 1 # define OPENSSL_NPN_NO_OVERLAP 2 #endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7 files: M Modules/_ssl.c M Modules/clinic/_ssl.c.h diff --git a/Modules/_ssl.c b/Modules/_ssl.c index e8abcb286f2..b7761d70398 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -315,7 +315,7 @@ static unsigned int _ssl_locks_count = 0; typedef struct { PyObject_HEAD SSL_CTX *ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) unsigned char *npn_protocols; int npn_protocols_len; #endif @@ -1697,7 +1697,7 @@ _ssl__SSLSocket_version_impl(PySSLSocket *self) return PyUnicode_FromString(version); } -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) /*[clinic input] _ssl._SSLSocket.selected_npn_protocol [clinic start generated code]*/ @@ -2647,7 +2647,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version) return NULL; } self->ctx = ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) self->npn_protocols = NULL; #endif #ifdef HAVE_ALPN @@ -2782,7 +2782,7 @@ context_dealloc(PySSLContext *self) PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyMem_FREE(self->npn_protocols); #endif #ifdef HAVE_ALPN @@ -2860,7 +2860,7 @@ _ssl__SSLContext_get_ciphers_impl(PySSLContext *self) #endif -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) || defined(HAVE_ALPN) static int do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, const unsigned char *server_protocols, unsigned int server_protocols_len, @@ -2884,7 +2884,9 @@ do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, return SSL_TLSEXT_ERR_OK; } +#endif +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) /* this callback gets passed to SSL_CTX_set_next_protos_advertise_cb */ static int _advertiseNPN_cb(SSL *s, @@ -2927,7 +2929,7 @@ _ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self, Py_buffer *protos) /*[clinic end generated code: output=72b002c3324390c6 input=319fcb66abf95bd7]*/ { -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyMem_Free(self->npn_protocols); self->npn_protocols = PyMem_Malloc(protos->len); if (self->npn_protocols == NULL) @@ -5397,7 +5399,7 @@ PyInit__ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ECDH", r); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) r = Py_True; #else r = Py_False; diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index ac205f6549f..fa4f7e222b2 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -132,7 +132,7 @@ _ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored)) return _ssl__SSLSocket_version_impl(self); } -#if defined(OPENSSL_NPN_NEGOTIATED) +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__, "selected_npn_protocol($self, /)\n" @@ -151,7 +151,7 @@ _ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ign return _ssl__SSLSocket_selected_npn_protocol_impl(self); } -#endif /* defined(OPENSSL_NPN_NEGOTIATED) */ +#endif /* defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) */ #if defined(HAVE_ALPN) From webhook-mailer at python.org Mon Sep 4 17:58:33 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Mon, 04 Sep 2017 21:58:33 -0000 Subject: [Python-checkins] [3.6] Added effect of re.ASCII and reworded slightly (GH-1782) (#3313) Message-ID: https://github.com/python/cpython/commit/d50ce4fcc9b481b66ce594f291dec14251b16ba5 commit: d50ce4fcc9b481b66ce594f291dec14251b16ba5 branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-04T14:58:31-07:00 summary: [3.6] Added effect of re.ASCII and reworded slightly (GH-1782) (#3313) (cherry picked from commit c9d6dbc2900ace9564b8f67e63617be747355c6b) files: M Doc/library/re.rst diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 7a51abdc983..56fc4ed2c94 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -542,9 +542,11 @@ form. .. data:: I IGNORECASE - Perform case-insensitive matching; expressions like ``[A-Z]`` will match - lowercase letters, too. This is not affected by the current locale - and works for Unicode characters as expected. + Perform case-insensitive matching; expressions like ``[A-Z]`` will also + match lowercase letters. The current locale does not change the effect of + this flag. Full Unicode matching (such as ``?`` matching ``?``) also + works unless the :const:`re.ASCII` flag is also used to disable non-ASCII + matches. .. data:: L From webhook-mailer at python.org Mon Sep 4 17:59:04 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Mon, 04 Sep 2017 21:59:04 -0000 Subject: [Python-checkins] Cache externals, depending on changes to PCbuild (#3308) Message-ID: https://github.com/python/cpython/commit/f801322e92384ef3eac2a9b7ac2c49d37102d0f3 commit: f801322e92384ef3eac2a9b7ac2c49d37102d0f3 branch: master author: Zachary Ware committer: GitHub date: 2017-09-04T14:59:02-07:00 summary: Cache externals, depending on changes to PCbuild (#3308) files: M .github/appveyor.yml diff --git a/.github/appveyor.yml b/.github/appveyor.yml index cb9821ccc65..6a79a621e09 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -5,6 +5,8 @@ branches: - master - /\d\.\d/ - buildbot-custom +cache: + - externals -> PCbuild\* build_script: - cmd: PCbuild\build.bat -e - cmd: PCbuild\win32\python.exe -m test.pythoninfo From webhook-mailer at python.org Mon Sep 4 18:28:55 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 22:28:55 -0000 Subject: [Python-checkins] bpo-30502: Fix handling of long oids in ssl. (#2909) Message-ID: https://github.com/python/cpython/commit/e503ca52889bf66ac502702569e726caa7970299 commit: e503ca52889bf66ac502702569e726caa7970299 branch: master author: Serhiy Storchaka committer: Christian Heimes date: 2017-09-05T00:28:53+02:00 summary: bpo-30502: Fix handling of long oids in ssl. (#2909) files: A Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst new file mode 100644 index 00000000000..522bdf669e9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst @@ -0,0 +1 @@ +Fix handling of long oids in ssl. Based on patch by Christian Heimes. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b7761d70398..9ceaf5acc63 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -787,49 +787,64 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) } static PyObject * -_create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) { - - char namebuf[X509_NAME_MAXLEN]; +_asn1obj2py(const ASN1_OBJECT *name, int no_name) +{ + char buf[X509_NAME_MAXLEN]; + char *namebuf = buf; int buflen; - PyObject *name_obj; - PyObject *value_obj; - PyObject *attr; - unsigned char *valuebuf = NULL; + PyObject *name_obj = NULL; - buflen = OBJ_obj2txt(namebuf, sizeof(namebuf), name, 0); + buflen = OBJ_obj2txt(namebuf, X509_NAME_MAXLEN, name, no_name); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - goto fail; + return NULL; } - name_obj = PyUnicode_FromStringAndSize(namebuf, buflen); - if (name_obj == NULL) - goto fail; + /* initial buffer is too small for oid + terminating null byte */ + if (buflen > X509_NAME_MAXLEN - 1) { + /* make OBJ_obj2txt() calculate the required buflen */ + buflen = OBJ_obj2txt(NULL, 0, name, no_name); + /* allocate len + 1 for terminating NULL byte */ + namebuf = PyMem_Malloc(buflen + 1); + if (namebuf == NULL) { + PyErr_NoMemory(); + return NULL; + } + buflen = OBJ_obj2txt(namebuf, buflen + 1, name, no_name); + if (buflen < 0) { + _setSSLError(NULL, 0, __FILE__, __LINE__); + goto done; + } + } + if (!buflen && no_name) { + Py_INCREF(Py_None); + name_obj = Py_None; + } + else { + name_obj = PyUnicode_FromStringAndSize(namebuf, buflen); + } + + done: + if (buf != namebuf) { + PyMem_Free(namebuf); + } + return name_obj; +} + +static PyObject * +_create_tuple_for_attribute(ASN1_OBJECT *name, ASN1_STRING *value) +{ + Py_ssize_t buflen; + unsigned char *valuebuf = NULL; + PyObject *attr; buflen = ASN1_STRING_to_UTF8(&valuebuf, value); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - Py_DECREF(name_obj); - goto fail; + return NULL; } - value_obj = PyUnicode_DecodeUTF8((char *) valuebuf, - buflen, "strict"); + attr = Py_BuildValue("Ns#", _asn1obj2py(name, 0), valuebuf, buflen); OPENSSL_free(valuebuf); - if (value_obj == NULL) { - Py_DECREF(name_obj); - goto fail; - } - attr = PyTuple_New(2); - if (attr == NULL) { - Py_DECREF(name_obj); - Py_DECREF(value_obj); - goto fail; - } - PyTuple_SET_ITEM(attr, 0, name_obj); - PyTuple_SET_ITEM(attr, 1, value_obj); return attr; - - fail: - return NULL; } static PyObject * @@ -4676,8 +4691,6 @@ asn1obj2py(ASN1_OBJECT *obj) { int nid; const char *ln, *sn; - char buf[100]; - Py_ssize_t buflen; nid = OBJ_obj2nid(obj); if (nid == NID_undef) { @@ -4686,16 +4699,7 @@ asn1obj2py(ASN1_OBJECT *obj) } sn = OBJ_nid2sn(nid); ln = OBJ_nid2ln(nid); - buflen = OBJ_obj2txt(buf, sizeof(buf), obj, 1); - if (buflen < 0) { - _setSSLError(NULL, 0, __FILE__, __LINE__); - return NULL; - } - if (buflen) { - return Py_BuildValue("isss#", nid, sn, ln, buf, buflen); - } else { - return Py_BuildValue("issO", nid, sn, ln, Py_None); - } + return Py_BuildValue("issN", nid, sn, ln, _asn1obj2py(obj, 1)); } /*[clinic input] From webhook-mailer at python.org Mon Sep 4 18:45:21 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Mon, 04 Sep 2017 22:45:21 -0000 Subject: [Python-checkins] Regen Moduls/clinic/_ssl.c.h (GH-3320) Message-ID: https://github.com/python/cpython/commit/af64aff9f7de2ee60c20bfb331e8a00ea0521c1e commit: af64aff9f7de2ee60c20bfb331e8a00ea0521c1e branch: master author: Zachary Ware committer: GitHub date: 2017-09-04T15:45:18-07:00 summary: Regen Moduls/clinic/_ssl.c.h (GH-3320) Broken in GH-2079 files: M Modules/clinic/_ssl.c.h diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index fa4f7e222b2..2427b5a42d3 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -132,7 +132,7 @@ _ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored)) return _ssl__SSLSocket_version_impl(self); } -#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) +#if (defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG)) PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__, "selected_npn_protocol($self, /)\n" @@ -151,7 +151,7 @@ _ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ign return _ssl__SSLSocket_selected_npn_protocol_impl(self); } -#endif /* defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) */ +#endif /* (defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG)) */ #if defined(HAVE_ALPN) @@ -1168,4 +1168,4 @@ _ssl_enum_crls(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=2d1424e6cc647fa8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=00790af9c3f31706 input=a9049054013a1b77]*/ From webhook-mailer at python.org Mon Sep 4 19:05:36 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Mon, 04 Sep 2017 23:05:36 -0000 Subject: [Python-checkins] [2.7] bpo-30450: Pull Windows dependencies from GitHub rather than SVN (GH-1783) (GH-3306) Message-ID: https://github.com/python/cpython/commit/986b7ffc650919b3022ccaa458a843bb8a95d2bd commit: 986b7ffc650919b3022ccaa458a843bb8a95d2bd branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-04T16:05:33-07:00 summary: [2.7] bpo-30450: Pull Windows dependencies from GitHub rather than SVN (GH-1783) (GH-3306) The Windows build now depends on Python 3.6 to fetch externals, but it will be downloaded via NuGet (which is downloaded via PowerShell) if it is not available via `py -3.6`. This means the only thing that must be installed on a modern Windows box to do a full build of CPython with all extensions is Visual Studio. Cherry-picked from 51599e2bdd10ab77212a7cbb41a13ea70ee13da8, parts of 40a23e88994aca92c83c8e84ab8b8cdc11d7ec54, parts of 68d663cf85d1ac5eaf83482eed39c0a6f8093601, d5cd21d75a27a377f2f9c8370fd8e8c7efaeefb1, and possibly others that I've missed. Also: * Rename db -> bsddb for disambiguity * Update sqlite3 to 3.14.2.0 since it's the version we use on 3.x, and it's simpler to just use it than to also upload the old version to cpython-source-deps * Add PCbuild/*.ilk to .gitignore files: A Misc/NEWS.d/next/Windows/2017-09-04-14-00-37.bpo-30450.YwitaJ.rst A PCbuild/find_msbuild.bat A PCbuild/find_python.bat A PCbuild/get_external.py M .github/appveyor.yml M .gitignore M Doc/make.bat M PC/VS9.0/pyproject.vsprops M PCbuild/build.bat M PCbuild/get_externals.bat M PCbuild/python.props M PCbuild/python.vcxproj M PCbuild/readme.txt M Tools/nuget/build.bat diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 34c5e8b6843..b809ad680b1 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -10,6 +10,8 @@ build_script: - cmd: PCbuild\python.exe -m test.pythoninfo test_script: - cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest -j2 +environment: + HOST_PYTHON: C:\Python36\python.exe # Only trigger AppVeyor if actual code or its configuration changes only_commits: diff --git a/.gitignore b/.gitignore index a8c73d4b14b..a44b733b101 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ PC/*/*.suo PC/*/Win32-temp-* PC/*/x64-temp-* PC/*/amd64 +PCbuild/*.ilk PCbuild/*.user PCbuild/*.suo PCbuild/*.*sdf diff --git a/Doc/make.bat b/Doc/make.bat index 53195614ef0..ae6224ab4ca 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -5,8 +5,19 @@ pushd %~dp0 set this=%~n0 -if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build -if "%PYTHON%" EQU "" set PYTHON=py +call ..\PCBuild\find_python.bat %PYTHON% +if not defined SPHINXBUILD if defined PYTHON ( + %PYTHON% -c "import sphinx" > nul 2> nul + if errorlevel 1 ( + echo Installing sphinx with %PYTHON% + %PYTHON% -m pip install sphinx + if errorlevel 1 exit /B + ) + set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()" +) + +if not defined PYTHON set PYTHON=py +if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build if DEFINED ProgramFiles(x86) set _PRGMFLS=%ProgramFiles(x86)% if NOT DEFINED ProgramFiles(x86) set _PRGMFLS=%ProgramFiles% @@ -73,7 +84,7 @@ goto end if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) -cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%* +cmd /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%*" if "%1" EQU "htmlhelp" ( if not exist "%HTMLHELP%" ( diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-14-00-37.bpo-30450.YwitaJ.rst b/Misc/NEWS.d/next/Windows/2017-09-04-14-00-37.bpo-30450.YwitaJ.rst new file mode 100644 index 00000000000..e7e06a14488 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-04-14-00-37.bpo-30450.YwitaJ.rst @@ -0,0 +1 @@ +Pull build dependencies from GitHub rather than svn.python.org. diff --git a/PC/VS9.0/pyproject.vsprops b/PC/VS9.0/pyproject.vsprops index 44b4f5317ed..d4ced7bbf68 100644 --- a/PC/VS9.0/pyproject.vsprops +++ b/PC/VS9.0/pyproject.vsprops @@ -50,7 +50,7 @@ /> "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc" + at if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found + + at rem VS 2015 and earlier register MSBuild separately, so we can find it. + at rem Prefer MSBuild 14.0 over MSBuild 15.0, since the latter may not be able to find a VC14 install. + at reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32 >nul 2>nul + at if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32') DO @( + @if "%%i"=="MSBuildToolsPath" @if exist "%%k\msbuild.exe" @(set MSBUILD="%%k\msbuild.exe") +) + at if exist %MSBUILD% (set _Py_MSBuild_Source=registry) & goto :found + + at rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. + at reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul + at if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( + @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") +) + at if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found + + + at exit /b 1 + +:found + at echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%) + at set _Py_MSBuild_Source= diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat new file mode 100644 index 00000000000..ba3a0f5a10d --- /dev/null +++ b/PCbuild/find_python.bat @@ -0,0 +1,75 @@ + at rem + at rem Searches for python.exe and may download a private copy from nuget. + at rem + at rem This file is supposed to modify the state of the caller (specifically + at rem the MSBUILD variable), so we do not use setlocal or echo, and avoid + at rem changing any other persistent state. + at rem + + at rem No arguments provided means do full search + at if '%1' EQU '' goto :begin_search + + at rem One argument may be the full path. Use a goto so we don't try to + at rem parse the next if statement - incorrect quoting in the multi-arg + at rem case can cause us to break immediately. + at if '%2' EQU '' goto :one_arg + + at rem Entire command line may represent the full path if quoting failed. + at if exist "%*" (set PYTHON="%*") & (set _Py_Python_Source=from environment) & goto :found + at goto :begin_search + +:one_arg + at if exist "%~1" (set PYTHON="%~1") & (set _Py_Python_Source=from environment) & goto :found + +:begin_search + at set PYTHON= + + at set _Py_EXTERNALS_DIR=%EXTERNAL_DIR% + at if "%_Py_EXTERNALS_DIR%"=="" (set _Py_EXTERNALS_DIR=%~dp0\..\externals) + + at rem If we have Python in externals, use that one + at if exist "%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe" (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found in externals directory) & goto :found + + at rem If HOST_PYTHON is recent enough, use that + at if NOT "%HOST_PYTHON%"=="" @%HOST_PYTHON% -c "import sys; assert sys.version_info[:2] >= (3, 6)" >nul 2>nul && (set PYTHON="%HOST_PYTHON%") && (set _Py_Python_Source=found as HOST_PYTHON) && goto :found + + at rem If py.exe finds a recent enough version, use that one + at py -3.6 -V >nul 2>&1 && (set PYTHON=py -3.6) && (set _Py_Python_Source=found with py.exe) && goto :found + + at if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%" + at set _Py_NUGET=%NUGET% + at set _Py_NUGET_URL=%NUGET_URL% + at set _Py_HOST_PYTHON=%HOST_PYTHON% + at if "%_Py_HOST_PYTHON%"=="" set _Py_HOST_PYTHON=py + at if "%_Py_NUGET%"=="" (set _Py_NUGET=%_Py_EXTERNALS_DIR%\nuget.exe) + at if "%_Py_NUGET_URL%"=="" (set _Py_NUGET_URL=https://aka.ms/nugetclidl) + at if NOT exist "%_Py_NUGET%" ( + @echo Downloading nuget... + @rem NB: Must use single quotes around NUGET here, NOT double! + @rem Otherwise, a space in the path would break things + @rem If it fails, retry with any available copy of Python + @powershell.exe -Command Invoke-WebRequest %_Py_NUGET_URL% -OutFile '%_Py_NUGET%' + @if errorlevel 1 ( + @%_Py_HOST_PYTHON% "%~dp0\urlretrieve.py" "%_Py_NUGET_URL%" "%_Py_NUGET%" + ) +) + at echo Installing Python via nuget... +@"%_Py_NUGET%" install pythonx86 -ExcludeVersion -OutputDirectory "%_Py_EXTERNALS_DIR%" + at rem Quote it here; it's not quoted later because "py -3.6" wouldn't work + at if not errorlevel 1 (set PYTHON="%_Py_EXTERNALS_DIR%\pythonx86\tools\python.exe") & (set _Py_Python_Source=found on nuget.org) & goto :found + + + at set _Py_Python_Source= + at set _Py_EXTERNALS_DIR= + at set _Py_NUGET= + at set _Py_NUGET_URL= + at set _Py_HOST_PYTHON= + at exit /b 1 + +:found + at echo Using %PYTHON% (%_Py_Python_Source%) + at set _Py_Python_Source= + at set _Py_EXTERNALS_DIR= + at set _Py_NUGET= + at set _Py_NUGET_URL= + at set _Py_HOST_PYTHON= diff --git a/PCbuild/get_external.py b/PCbuild/get_external.py new file mode 100644 index 00000000000..a682d3849f1 --- /dev/null +++ b/PCbuild/get_external.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import argparse +import os +import pathlib +import zipfile +from urllib.request import urlretrieve + + +def fetch_zip(commit_hash, zip_dir, *, org='python', binary=False, verbose): + repo = f'cpython-{"bin" if binary else "source"}-deps' + url = f'https://github.com/{org}/{repo}/archive/{commit_hash}.zip' + reporthook = None + if verbose: + reporthook = print + zip_dir.mkdir(parents=True, exist_ok=True) + filename, headers = urlretrieve( + url, + zip_dir / f'{commit_hash}.zip', + reporthook=reporthook, + ) + return filename + + +def extract_zip(externals_dir, zip_path): + with zipfile.ZipFile(os.fspath(zip_path)) as zf: + zf.extractall(os.fspath(externals_dir)) + return externals_dir / zf.namelist()[0].split('/')[0] + + +def parse_args(): + p = argparse.ArgumentParser() + p.add_argument('-v', '--verbose', action='store_true') + p.add_argument('-b', '--binary', action='store_true', + help='Is the dependency in the binary repo?') + p.add_argument('-O', '--organization', + help='Organization owning the deps repos', default='python') + p.add_argument('-e', '--externals-dir', type=pathlib.Path, + help='Directory in which to store dependencies', + default=pathlib.Path(__file__).parent.parent / 'externals') + p.add_argument('tag', + help='tag of the dependency') + return p.parse_args() + + +def main(): + args = parse_args() + zip_path = fetch_zip( + args.tag, + args.externals_dir / 'zips', + org=args.organization, + binary=args.binary, + verbose=args.verbose, + ) + final_name = args.externals_dir / args.tag + extract_zip(args.externals_dir, zip_path).replace(final_name) + + +if __name__ == '__main__': + main() diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index ad42eb87751..e83e1d4c9ad 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -2,51 +2,38 @@ setlocal rem Simple script to fetch source for external libraries -if not exist "%~dp0..\externals" mkdir "%~dp0..\externals" -pushd "%~dp0..\externals" +if "%PCBUILD%"=="" (set PCBUILD=%~dp0) +if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) -if "%SVNROOT%"=="" set SVNROOT=http://svn.python.org/projects/external/ +set DO_FETCH=true +set DO_CLEAN=false -rem Optionally clean up first. Be warned that this can be very destructive! -if not "%1"=="" ( - for %%c in (-c --clean --clean-only) do ( - if "%1"=="%%c" goto clean - ) - goto usage -) -goto fetch +:CheckOpts +if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts +if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts +if "%~1"=="--python" (set PYTHON_FOR_BUILD=%2) & shift & shift & goto CheckOpts +if "%~1"=="--organization" (set ORG=%2) & shift & shift & goto CheckOpts +if "%~1"=="-c" (set DO_CLEAN=true) & shift & goto CheckOpts +if "%~1"=="--clean" (set DO_CLEAN=true) & shift & goto CheckOpts +if "%~1"=="--clean-only" (set DO_FETCH=false) & goto clean +if "x%~1" NEQ "x" goto usage +if "%DO_CLEAN%"=="false" goto fetch :clean echo.Cleaning up external libraries. -for /D %%d in ( - bzip2-* - db-* - nasm-* - openssl-* - tcl-* - tcltk* - tk-* - tix-* - sqlite-* - xz-* - ) do ( - echo.Removing %%d - rmdir /s /q %%d -) -if "%1"=="--clean-only" ( - goto end +if exist "%EXTERNALS_DIR%" ( + rem Sometimes this fails the first time; try it twice + rmdir /s /q "%EXTERNALS_DIR%" || rmdir /s /q "%EXTERNALS_DIR%" ) +if "%DO_FETCH%"=="false" goto end :fetch -rem Fetch current versions - -svn --version > nul 2>&1 -if ERRORLEVEL 9009 ( - echo.svn.exe must be on your PATH. - echo.Try TortoiseSVN (http://tortoisesvn.net/^) and be sure to check the - echo.command line tools option. - popd - exit /b 1 + +if "%ORG%"=="" (set ORG=python) +call "%PCBUILD%find_python.bat" "%PYTHON%" + +if "%PYTHON%"=="" ( + where /Q git || echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1 ) echo.Fetching external libraries... @@ -56,52 +43,62 @@ rem files in both this dir and PC\VS9.0 set libraries= set libraries=%libraries% bzip2-1.0.6 -if NOT "%IncludeBsddb%"=="false" set libraries=%libraries% db-4.7.25.0 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 +if NOT "%IncludeBsddb%"=="false" set libraries=%libraries% bsddb-4.7.25.0 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2k -set libraries=%libraries% sqlite-3.8.11.0 +set libraries=%libraries% sqlite-3.14.2.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-8.5.15.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.5.15.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.5 for %%e in (%libraries%) do ( - if exist %%e ( + if exist "%EXTERNALS_DIR%\%%e" ( echo.%%e already exists, skipping. + ) else if "%PYTHON%"=="" ( + echo.Fetching %%e with git... + git clone --depth 1 https://github.com/%ORG%/cpython-source-deps --branch %%e "%EXTERNALS_DIR%\%%e" ) else ( echo.Fetching %%e... - svn export -q %SVNROOT%%%e + %PYTHON% "%PCBUILD%get_external.py" -O %ORG% %%e + ) +) + +echo.Fetching external binaries... + +set binaries= +set binaries=%binaries% +if NOT "%IncludeSSL%"=="false" set binaries=%binaries% nasm-2.11.06 + +for %%b in (%binaries%) do ( + if exist "%EXTERNALS_DIR%\%%b" ( + echo.%%b already exists, skipping. + ) else if "%PYTHON%"=="" ( + echo.Fetching %%b with git... + git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b" + ) else ( + echo.Fetching %%b... + %PYTHON% "%PCBUILD%get_external.py" -b -O %ORG% %%b ) ) +echo Finished. goto end :usage -echo.invalid argument: %1 -echo.usage: %~n0 [[ -c ^| --clean ] ^| --clean-only ] +echo.Valid options: -c, --clean, --clean-only, --organization, --python, +echo.--no-tkinter, --no-openssl echo. -echo.Pull all sources necessary for compiling optional extension modules -echo.that rely on external libraries. Requires svn.exe to be on your PATH -echo.and pulls sources from %SVNROOT%. +echo.Pull all sources and binaries necessary for compiling optional extension +echo.modules that rely on external libraries. echo. -echo.Use the -c or --clean option to clean up all external library sources -echo.before pulling in the current versions. +echo.The --organization option determines which github organization to download +echo.from, the --python option determines which Python 3.6+ interpreter to use +echo.with PCbuild\get_external.py. +echo. +echo.Use the -c or --clean option to remove the entire externals directory. echo. echo.Use the --clean-only option to do the same cleaning, without pulling in echo.anything new. echo. -echo.Only the first argument is checked, all others are ignored. -echo. -echo.**WARNING**: the cleaning options unconditionally remove any directory -echo.that is a child of -echo. %CD% -echo.and matches wildcard patterns beginning with bzip2-, db-, nasm-, openssl-, -echo.tcl-, tcltk, tk-, tix-, sqlite-, or xz-, and as such has the potential -echo.to be very destructive if you are not aware of what it is doing. Use with -echo.caution! -popd exit /b -1 - :end -echo Finished. -popd diff --git a/PCbuild/python.props b/PCbuild/python.props index 486a7c9914b..e0b0d826740 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -32,9 +32,9 @@ $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) - $(ExternalsDir)sqlite-3.8.11.0\ + $(ExternalsDir)sqlite-3.14.2.0\ $(ExternalsDir)bzip2-1.0.6\ - $(ExternalsDir)db-4.7.25.0 + $(ExternalsDir)bsddb-4.7.25.0 $(ExternalsDir)openssl-1.0.2k\ $(opensslDir)include32 $(opensslDir)include64 diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index 4380fedee84..c1ab6e9ca9e 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -93,6 +93,8 @@ + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64 <_Content>@rem This script invokes the most recently built Python with all arguments @rem passed through to the interpreter. This file is generated by the @rem build process and any changes *will* be thrown away by the next @@ -100,6 +102,9 @@ @rem This is only meant as a convenience for developing CPython @rem and using it outside of that context is ill-advised. @echo Running $(Configuration)^|$(Platform) interpreter... + at setlocal + at set PYTHONHOME=$(PySourcePath) +$(_PGOPath) @"$(OutDir)python$(PyDebugExt).exe" %* <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat')) diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index d05a5031fa3..a1777a6a873 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -4,9 +4,11 @@ Quick Start Guide 1. Install Microsoft Visual Studio 2008, any edition. 2. Install Microsoft Visual Studio 2010, any edition, or Windows SDK 7.1 and any version of Microsoft Visual Studio newer than 2010. -3. Install Subversion, and make sure 'svn.exe' is on your PATH. -4. Run "build.bat -e" to build Python in 32-bit Release configuration. -5. (Optional, but recommended) Run the test suite with "rt.bat -q". +2a. Optionally install Python 3.6 or later. If not installed, + get_externals.bat (build.bat -e) will download and use Python via + NuGet. +3. Run "build.bat -e" to build Python in 32-bit Release configuration. +4. (Optional, but recommended) Run the test suite with "rt.bat -q". Building Python using MSVC 9.0 via MSBuild @@ -250,9 +252,16 @@ order to download the relevant source files for each project before they can be built. However, a simple script is provided to make this as painless as possible, called "get_externals.bat" and located in this directory. This script extracts all the external sub-projects from - http://svn.python.org/projects/external -via Subversion (so you'll need svn.exe on your PATH) and places them -in ..\externals (relative to this directory). + https://github.com/python/cpython-source-deps +and + https://github.com/python/cpython-bin-deps +via a Python script called "get_external.py", located in this directory. +If Python 3.6 or later is not available via the "py.exe" launcher, the +path or command to use for Python can be provided in the PYTHON_FOR_BUILD +environment variable, or get_externals.bat will download the latest +version of NuGet and use it to download the latest "pythonx86" package +for use with get_external.py. Everything downloaded by these scripts is +stored in ..\externals (relative to this directory). It is also possible to download sources from each project's homepage, though you may have to change folder names or pass the names to MSBuild diff --git a/Tools/nuget/build.bat b/Tools/nuget/build.bat index 7dcaa25a5af..f4e15c7ed79 100644 --- a/Tools/nuget/build.bat +++ b/Tools/nuget/build.bat @@ -21,6 +21,8 @@ if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckO if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) if not defined NUGET where nuget -q || echo Cannot find nuget.exe on PATH and NUGET is not set. && exit /B 1 +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) if not defined PYTHON set PYTHON=py -3 @%PYTHON% -c "" >nul 2>nul @@ -29,7 +31,6 @@ if not defined PYTHON set PYTHON=py -3 set PYTHON="%D%obj\python\tools\python.exe" ) -call "%PCBUILD%env.bat" x86 if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" @@ -38,7 +39,7 @@ if defined BUILDX86 ( ) else if not exist "%PCBUILD%python.exe" call "%PCBUILD%build.bat" -e if errorlevel 1 goto :eof - msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% + %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% if errorlevel 1 goto :eof ) @@ -47,7 +48,7 @@ if defined BUILDX64 ( ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e if errorlevel 1 goto :eof - msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% + %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% if errorlevel 1 goto :eof ) From webhook-mailer at python.org Mon Sep 4 19:07:09 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 04 Sep 2017 23:07:09 -0000 Subject: [Python-checkins] Code clean-up. Remove unnecessary pre-increment before the loop starts. (#3312) Message-ID: https://github.com/python/cpython/commit/e1b0287c0440399e8cc855897113614fa5f6bc96 commit: e1b0287c0440399e8cc855897113614fa5f6bc96 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T16:07:06-07:00 summary: Code clean-up. Remove unnecessary pre-increment before the loop starts. (#3312) files: M Modules/_collectionsmodule.c diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index adbe7897004..8766d86dd3e 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -938,8 +938,7 @@ deque_reverse(dequeobject *deque, PyObject *unused) Py_ssize_t n = Py_SIZE(deque) >> 1; PyObject *tmp; - n++; - while (--n) { + while (--n >= 0) { /* Validate that pointers haven't met in the middle */ assert(leftblock != rightblock || leftindex < rightindex); CHECK_NOT_END(leftblock); @@ -981,8 +980,7 @@ deque_count(dequeobject *deque, PyObject *v) PyObject *item; int cmp; - n++; - while (--n) { + while (--n >= 0) { CHECK_NOT_END(b); item = b->data[index]; cmp = PyObject_RichCompareBool(item, v, Py_EQ); @@ -1019,8 +1017,7 @@ deque_contains(dequeobject *deque, PyObject *v) PyObject *item; int cmp; - n++; - while (--n) { + while (--n >= 0) { CHECK_NOT_END(b); item = b->data[index]; cmp = PyObject_RichCompareBool(item, v, Py_EQ); @@ -1088,13 +1085,13 @@ deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs) } } - n = stop - i + 1; - while (--n) { + n = stop - i; + while (--n >= 0) { CHECK_NOT_END(b); item = b->data[index]; cmp = PyObject_RichCompareBool(item, v, Py_EQ); if (cmp > 0) - return PyLong_FromSsize_t(stop - n); + return PyLong_FromSsize_t(stop - n - 1); if (cmp < 0) return NULL; if (start_state != deque->state) { @@ -1228,16 +1225,14 @@ deque_item(dequeobject *deque, Py_ssize_t i) i = (Py_ssize_t)((size_t) i % BLOCKLEN); if (index < (Py_SIZE(deque) >> 1)) { b = deque->leftblock; - n++; - while (--n) + while (--n >= 0) b = b->rightlink; } else { n = (Py_ssize_t)( ((size_t)(deque->leftindex + Py_SIZE(deque) - 1)) / BLOCKLEN - n); b = deque->rightblock; - n++; - while (--n) + while (--n >= 0) b = b->leftlink; } } @@ -1281,16 +1276,14 @@ deque_ass_item(dequeobject *deque, Py_ssize_t i, PyObject *v) i = (Py_ssize_t)((size_t) i % BLOCKLEN); if (index <= halflen) { b = deque->leftblock; - n++; - while (--n) + while (--n >= 0) b = b->rightlink; } else { n = (Py_ssize_t)( ((size_t)(deque->leftindex + Py_SIZE(deque) - 1)) / BLOCKLEN - n); b = deque->rightblock; - n++; - while (--n) + while (--n >= 0) b = b->leftlink; } Py_INCREF(v); From webhook-mailer at python.org Mon Sep 4 19:11:43 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 23:11:43 -0000 Subject: [Python-checkins] [2.7] bpo-30622: Change NPN detection: (GH-2079) (#3316) Message-ID: https://github.com/python/cpython/commit/72ed233167b10d3a488d30a8ec3a17e412a7dd69 commit: 72ed233167b10d3a488d30a8ec3a17e412a7dd69 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-05T01:11:40+02:00 summary: [2.7] bpo-30622: Change NPN detection: (GH-2079) (#3316) * Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) GH- define OPENSSL_NPN_UNSUPPORTED 0 GH- define OPENSSL_NPN_NEGOTIATED 1 GH- define OPENSSL_NPN_NO_OVERLAP 2 GH-endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7. (cherry picked from commit b2d096bd2a5ff86e53c25d00ee5fa097b36bf1d8) files: M Modules/_ssl.c diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 213c7d21510..832b5f96bff 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -280,7 +280,7 @@ static unsigned int _ssl_locks_count = 0; typedef struct { PyObject_HEAD SSL_CTX *ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) unsigned char *npn_protocols; int npn_protocols_len; #endif @@ -1502,7 +1502,7 @@ static PyObject *PySSL_version(PySSLSocket *self) return PyUnicode_FromString(version); } -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) static PyObject *PySSL_selected_npn_protocol(PySSLSocket *self) { const unsigned char *out; unsigned int outlen; @@ -2140,7 +2140,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } self->ctx = ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) self->npn_protocols = NULL; #endif #ifdef HAVE_ALPN @@ -2218,7 +2218,7 @@ context_dealloc(PySSLContext *self) PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyMem_FREE(self->npn_protocols); #endif #ifdef HAVE_ALPN @@ -2248,7 +2248,7 @@ set_ciphers(PySSLContext *self, PyObject *args) Py_RETURN_NONE; } -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) || defined(HAVE_ALPN) static int do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, const unsigned char *server_protocols, unsigned int server_protocols_len, @@ -2272,7 +2272,9 @@ do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, return SSL_TLSEXT_ERR_OK; } +#endif +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) /* this callback gets passed to SSL_CTX_set_next_protos_advertise_cb */ static int _advertiseNPN_cb(SSL *s, @@ -2307,7 +2309,7 @@ _selectNPN_cb(SSL *s, static PyObject * _set_npn_protocols(PySSLContext *self, PyObject *args) { -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) Py_buffer protos; if (!PyArg_ParseTuple(args, "s*:set_npn_protocols", &protos)) @@ -4305,7 +4307,7 @@ init_ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ECDH", r); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) r = Py_True; #else r = Py_False; From webhook-mailer at python.org Mon Sep 4 19:36:08 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 04 Sep 2017 23:36:08 -0000 Subject: [Python-checkins] remove IRIX support (closes bpo-31341) (#3310) Message-ID: https://github.com/python/cpython/commit/069306312addf87252e2dbf250fc7632fc8b7da3 commit: 069306312addf87252e2dbf250fc7632fc8b7da3 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T16:36:05-07:00 summary: remove IRIX support (closes bpo-31341) (#3310) See PEP 11. files: A Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst M Doc/distutils/apiref.rst M Doc/library/sysconfig.rst M Lib/distutils/tests/test_unixccompiler.py M Lib/distutils/unixccompiler.py M Lib/distutils/util.py M Lib/sysconfig.py M Lib/test/test_pty.py M Lib/uuid.py M Modules/Setup.dist M Modules/fpectlmodule.c M Modules/socketmodule.c M Tools/scripts/objgraph.py M configure M configure.ac M pyconfig.h.in diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index b5b7731074c..622c7d1708f 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -1086,19 +1086,16 @@ other utility module. Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built - distributions. Typically includes the OS name and version and the architecture - (as supplied by 'os.uname()'), although the exact information included depends - on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only - runs on SGI hardware), but for Linux the kernel version isn't particularly - important. + distributions. Typically includes the OS name and version and the + architecture (as supplied by 'os.uname()'), although the exact information + included depends on the OS; e.g., on Linux, the kernel version isn't + particularly important. Examples of returned values: * ``linux-i586`` * ``linux-alpha`` * ``solaris-2.6-sun4u`` - * ``irix-5.3`` - * ``irix64-6.2`` For non-POSIX platforms, currently just returns ``sys.platform``. diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index f066a765d00..84f56463a11 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -173,18 +173,15 @@ Other functions This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and - version and the architecture (as supplied by :func:`os.uname`), although the - exact information included depends on the OS; e.g. for IRIX the architecture - isn't particularly important (IRIX only runs on SGI hardware), but for Linux - the kernel version isn't particularly important. + version and the architecture (as supplied by 'os.uname()'), although the + exact information included depends on the OS; e.g., on Linux, the kernel + version isn't particularly important. Examples of returned values: - linux-i586 - linux-alpha (?) - solaris-2.6-sun4u - - irix-5.3 - - irix64-6.2 Windows will return one of: diff --git a/Lib/distutils/tests/test_unixccompiler.py b/Lib/distutils/tests/test_unixccompiler.py index efba27e1c8a..eef702cf018 100644 --- a/Lib/distutils/tests/test_unixccompiler.py +++ b/Lib/distutils/tests/test_unixccompiler.py @@ -51,14 +51,6 @@ def gcv(v): sysconfig.get_config_var = old_gcv - # irix646 - sys.platform = 'irix646' - self.assertEqual(self.cc.rpath_foo(), ['-rpath', '/foo']) - - # osf1V5 - sys.platform = 'osf1V5' - self.assertEqual(self.cc.rpath_foo(), ['-rpath', '/foo']) - # GCC GNULD sys.platform = 'bar' def gcv(v): diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 3f321c28dc3..ab4d4de1566 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -233,8 +233,6 @@ def runtime_library_dir_option(self, dir): if self._is_gcc(compiler): return ["-Wl,+s", "-L" + dir] return ["+s", "-L" + dir] - elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5": - return ["-rpath", dir] else: if self._is_gcc(compiler): # gcc on non-GNU systems does not need -Wl, but can diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index fdcf6fabae2..b8a69114c8f 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -16,21 +16,17 @@ from distutils.errors import DistutilsByteCompileError def get_platform (): - """Return a string that identifies the current platform. This is used - mainly to distinguish platform-specific build directories and - platform-specific built distributions. Typically includes the OS name - and version and the architecture (as supplied by 'os.uname()'), - although the exact information included depends on the OS; eg. for IRIX - the architecture isn't particularly important (IRIX only runs on SGI - hardware), but for Linux the kernel version isn't particularly - important. + """Return a string that identifies the current platform. This is used mainly to + distinguish platform-specific build directories and platform-specific built + distributions. Typically includes the OS name and version and the + architecture (as supplied by 'os.uname()'), although the exact information + included depends on the OS; eg. on Linux, the kernel version isn't + particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u - irix-5.3 - irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) @@ -38,6 +34,7 @@ def get_platform (): win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. + """ if os.name == 'nt': # sniff sys.version for architecture. @@ -87,8 +84,6 @@ def get_platform (): bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation - elif osname[:4] == "irix": # could be "irix64"! - return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index e6618b1d518..fc3e03b2a2d 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -599,19 +599,15 @@ def get_platform(): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and - platform-specific built distributions. Typically includes the OS name - and version and the architecture (as supplied by 'os.uname()'), - although the exact information included depends on the OS; eg. for IRIX - the architecture isn't particularly important (IRIX only runs on SGI - hardware), but for Linux the kernel version isn't particularly - important. + platform-specific built distributions. Typically includes the OS name and + version and the architecture (as supplied by 'os.uname()'), although the + exact information included depends on the OS; on Linux, the kernel version + isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u - irix-5.3 - irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) @@ -619,6 +615,7 @@ def get_platform(): win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. + """ if os.name == 'nt': # sniff sys.version for architecture. @@ -666,8 +663,6 @@ def get_platform(): bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation - elif osname[:4] == "irix": # could be "irix64"! - return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 15f88e4fcd7..b6e2ed51f61 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -24,12 +24,12 @@ def debug(msg): def normalize_output(data): - # Some operating systems do conversions on newline. We could possibly - # fix that by doing the appropriate termios.tcsetattr()s. I couldn't - # figure out the right combo on Tru64 and I don't have an IRIX box. - # So just normalize the output and doc the problem O/Ses by allowing - # certain combinations for some platforms, but avoid allowing other - # differences (like extra whitespace, trailing garbage, etc.) + # Some operating systems do conversions on newline. We could possibly fix + # that by doing the appropriate termios.tcsetattr()s. I couldn't figure out + # the right combo on Tru64. So, just normalize the output and doc the + # problem O/Ses by allowing certain combinations for some platforms, but + # avoid allowing other differences (like extra whitespace, trailing garbage, + # etc.) # This is about the best we can do without getting some feedback # from someone more knowledgable. @@ -38,7 +38,6 @@ def normalize_output(data): if data.endswith(b'\r\r\n'): return data.replace(b'\r\r\n', b'\n') - # IRIX apparently turns \n into \r\n. if data.endswith(b'\r\n'): return data.replace(b'\r\n', b'\n') diff --git a/Lib/uuid.py b/Lib/uuid.py index d4259ae0b3b..15a81f5c18b 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -399,7 +399,7 @@ def _lanscan_getnode(): def _netstat_getnode(): """Get the hardware address on Unix by running netstat.""" - # This might work on AIX, Tru64 UNIX and presumably on IRIX. + # This might work on AIX, Tru64 UNIX. try: proc = _popen('netstat', '-ia') if not proc: diff --git a/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst b/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst new file mode 100644 index 00000000000..1429d8b0e7d --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst @@ -0,0 +1 @@ +Per PEP 11, support for the IRIX operating system was removed. diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 97c36dbd5d4..dd533ef5c90 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -350,9 +350,6 @@ _symtable symtablemodule.c # The library to link fpectl with is platform specific. # Choose *one* of the options below for fpectl: -# For SGI IRIX (tested on 5.3): -#fpectl fpectlmodule.c -lfpe - # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): # (Without the compiler you don't have -lsunmath.) #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c index 8e058037b0d..404f69269aa 100644 --- a/Modules/fpectlmodule.c +++ b/Modules/fpectlmodule.c @@ -111,29 +111,8 @@ static void fpe_reset(Sigfunc *handler) * handler for SIGFPE to the given handler. */ -/*-- IRIX -----------------------------------------------------------------*/ -#if defined(sgi) - /* See man page on handle_sigfpes -- must link with -lfpe - * My usage doesn't follow the man page exactly. Maybe somebody - * else can explain handle_sigfpes to me.... - * cc -c -I/usr/local/python/include fpectlmodule.c - * ld -shared -o fpectlmodule.so fpectlmodule.o -lfpe - */ -#include - typedef void user_routine (unsigned[5], int[2]); - typedef void abort_routine (unsigned long); - handle_sigfpes(_OFF, 0, - (user_routine *)0, - _TURN_OFF_HANDLER_ON_ERROR, - NULL); - handle_sigfpes(_ON, _EN_OVERFL | _EN_DIVZERO | _EN_INVALID, - (user_routine *)0, - _ABORT_ON_ERROR, - NULL); - PyOS_setsig(SIGFPE, handler); - /*-- SunOS and Solaris ----------------------------------------------------*/ -#elif defined(sun) +#if defined(sun) /* References: ieee_handler, ieee_sun, ieee_functions, and ieee_flags man pages (SunOS or Solaris) cc -c -I/usr/local/python/include fpectlmodule.c diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index beadecfad50..37626e67cb0 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -268,10 +268,8 @@ if_indextoname(index) -- return the corresponding interface name\n\ #include #endif -/* Irix 6.5 fails to define this variable at all. This is needed - for both GCC and SGI's compiler. I'd say that the SGI headers - are just busted. Same thing for Solaris. */ -#if (defined(__sgi) || defined(sun)) && !defined(INET_ADDRSTRLEN) +/* Solaris fails to define this variable at all. */ +#if defined(sun) && !defined(INET_ADDRSTRLEN) #define INET_ADDRSTRLEN 16 #endif diff --git a/Tools/scripts/objgraph.py b/Tools/scripts/objgraph.py index 1e1fce07dd5..3bb1712a9dc 100755 --- a/Tools/scripts/objgraph.py +++ b/Tools/scripts/objgraph.py @@ -2,8 +2,8 @@ # objgraph # -# Read "nm -o" input (on IRIX: "nm -Bo") of a set of libraries or modules -# and print various interesting listings, such as: +# Read "nm -o" input of a set of libraries or modules and print various +# interesting listings, such as: # # - which names are used but not defined in the set (and used where), # - which names are defined in the set (and where), @@ -15,7 +15,7 @@ # -d: print callees per objectfile # -u: print usage of undefined symbols # If none of -cdu is specified, all are assumed. -# Use "nm -o" to generate the input (on IRIX: "nm -Bo"), +# Use "nm -o" to generate the input # e.g.: nm -o /lib/libc.a | objgraph @@ -161,7 +161,7 @@ def main(): print('-d: print callees per objectfile') print('-u: print usage of undefined symbols') print('If none of -cdu is specified, all are assumed.') - print('Use "nm -o" to generate the input (on IRIX: "nm -Bo"),') + print('Use "nm -o" to generate the input') print('e.g.: nm -o /lib/libc.a | objgraph') return 1 optu = optc = optd = 0 diff --git a/configure b/configure index 5b742b884dc..d2766bc435d 100755 --- a/configure +++ b/configure @@ -2994,12 +2994,6 @@ $as_echo "#define __BSD_VISIBLE 1" >>confdefs.h # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# u_int on Irix 5.3. Defining _BSD_TYPES brings it back. - -$as_echo "#define _BSD_TYPES 1" >>confdefs.h - - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable # them. @@ -3298,7 +3292,6 @@ then linux*) MACHDEP="linux";; cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; - irix646) MACHDEP="irix6";; '') MACHDEP="unknown";; esac fi @@ -9136,7 +9129,7 @@ fi $as_echo "$SHLIB_SUFFIX" >&6; } # LDSHARED is the ld *command* used to create shared library -# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 +# -- "cc -G" on SunOS 5.x. # (Shared libraries in this instance are shared modules to be loaded into # Python, as opposed to building Python itself as a shared library.) { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDSHARED" >&5 @@ -9148,8 +9141,6 @@ then BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp" LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp" ;; - IRIX/5*) LDSHARED="ld -shared";; - IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; SunOS/5*) if test "$GCC" = "yes" ; then LDSHARED='$(CC) -shared' @@ -9309,10 +9300,6 @@ then then CCSHARED="-fPIC" else CCSHARED="-Kpic -belf" fi;; - IRIX*/6*) case $CC in - *gcc*) CCSHARED="-shared";; - *) CCSHARED="";; - esac;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CCSHARED" >&5 diff --git a/configure.ac b/configure.ac index 57f4492e484..4ceeea8d89c 100644 --- a/configure.ac +++ b/configure.ac @@ -134,10 +134,6 @@ AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features] AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# u_int on Irix 5.3. Defining _BSD_TYPES brings it back. -AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable # them. AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) @@ -406,7 +402,6 @@ then linux*) MACHDEP="linux";; cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; - irix646) MACHDEP="irix6";; '') MACHDEP="unknown";; esac fi @@ -2402,7 +2397,7 @@ fi AC_MSG_RESULT($SHLIB_SUFFIX) # LDSHARED is the ld *command* used to create shared library -# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 +# -- "cc -G" on SunOS 5.x. # (Shared libraries in this instance are shared modules to be loaded into # Python, as opposed to building Python itself as a shared library.) AC_MSG_CHECKING(LDSHARED) @@ -2413,8 +2408,6 @@ then BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp" LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp" ;; - IRIX/5*) LDSHARED="ld -shared";; - IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; SunOS/5*) if test "$GCC" = "yes" ; then LDSHARED='$(CC) -shared' @@ -2572,10 +2565,6 @@ then then CCSHARED="-fPIC" else CCSHARED="-Kpic -belf" fi;; - IRIX*/6*) case $CC in - *gcc*) CCSHARED="-shared";; - *) CCSHARED="";; - esac;; esac fi AC_MSG_RESULT($CCSHARED) diff --git a/pyconfig.h.in b/pyconfig.h.in index a524204e755..2efd768a96a 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1415,9 +1415,6 @@ /* Define on OpenBSD to activate all library features */ #undef _BSD_SOURCE -/* Define on Irix to enable u_int */ -#undef _BSD_TYPES - /* Define on Darwin to activate all library features */ #undef _DARWIN_C_SOURCE From webhook-mailer at python.org Mon Sep 4 19:38:25 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Mon, 04 Sep 2017 23:38:25 -0000 Subject: [Python-checkins] Rename my manually mis-named NEWS.d file. #sorry (#3326) Message-ID: https://github.com/python/cpython/commit/16a3a7b6a0c95fd81ccd6cde130a057713f8c08c commit: 16a3a7b6a0c95fd81ccd6cde130a057713f8c08c branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-04T16:38:23-07:00 summary: Rename my manually mis-named NEWS.d file. #sorry (#3326) files: A Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst D Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst diff --git a/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst b/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst similarity index 100% rename from Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bps-9146._-oo-_.rst rename to Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst From webhook-mailer at python.org Mon Sep 4 19:48:57 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 04 Sep 2017 23:48:57 -0000 Subject: [Python-checkins] Travis: use ccache (#3307) Message-ID: https://github.com/python/cpython/commit/8adc73c2c1a5e3e3c9289dd61ab553b718211b23 commit: 8adc73c2c1a5e3e3c9289dd61ab553b718211b23 branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T01:48:54+02:00 summary: Travis: use ccache (#3307) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index f6e9057e28d..65033fbd74c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ dist: trusty sudo: false group: beta -# To cache doc-building dependencies. -cache: pip +# To cache doc-building dependencies and C compiler output. +cache: + - pip + - ccache branches: only: From webhook-mailer at python.org Mon Sep 4 19:51:09 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 04 Sep 2017 23:51:09 -0000 Subject: [Python-checkins] random_triangular: sqrt() is more accurate than **0.5 (#3317) Message-ID: https://github.com/python/cpython/commit/f5ea83f4864232fecc042ff0d1c2401807b19280 commit: f5ea83f4864232fecc042ff0d1c2401807b19280 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T16:51:06-07:00 summary: random_triangular: sqrt() is more accurate than **0.5 (#3317) files: M Lib/random.py diff --git a/Lib/random.py b/Lib/random.py index e1c2c2bbcbe..01c0c3d25fb 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -388,7 +388,7 @@ def triangular(self, low=0.0, high=1.0, mode=None): u = 1.0 - u c = 1.0 - c low, high = high, low - return low + (high - low) * (u * c) ** 0.5 + return low + (high - low) * _sqrt(u * c) ## -------------------- normal distribution -------------------- From webhook-mailer at python.org Mon Sep 4 19:54:12 2017 From: webhook-mailer at python.org (Eric Snow) Date: Mon, 04 Sep 2017 23:54:12 -0000 Subject: [Python-checkins] bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638) Message-ID: https://github.com/python/cpython/commit/86b7afdfeee77993fe896a2aa13b3f4f95973f16 commit: 86b7afdfeee77993fe896a2aa13b3f4f95973f16 branch: master author: Eric Snow committer: GitHub date: 2017-09-04T17:54:09-06:00 summary: bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638) sys.modules is the one true source. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst M Doc/c-api/import.rst M Doc/whatsnew/3.7.rst M Include/import.h M Include/modsupport.h M Include/pystate.h M Modules/_pickle.c M Modules/pyexpat.c M Objects/moduleobject.c M Objects/typeobject.c M Python/_warnings.c M Python/bltinmodule.c M Python/ceval.c M Python/import.c M Python/importdl.c M Python/pylifecycle.c M Python/pystate.c M Python/sysmodule.c diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index 7c16ece0586..8cdc256e7c9 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -204,6 +204,13 @@ Importing Modules Return the dictionary used for the module administration (a.k.a. ``sys.modules``). Note that this is a per-interpreter variable. +.. c:function:: PyObject* PyImport_GetModule(PyObject *name) + + Return the already imported module with the given name. If the + module has not been imported yet then returns NULL but does not set + an error. Returns NULL and sets an error if the lookup failed. + + .. versionadded:: 3.7 .. c:function:: PyObject* PyImport_GetImporter(PyObject *path) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index f0c50e89a63..7a5d1e56854 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -456,6 +456,9 @@ Changes in the Python API and module are affected by this change. (Contributed by INADA Naoki and Eugene Toder in :issue:`29463`.) +* ``PyInterpreterState`` no longer has a ``modules`` field. Instead use + ``sys.modules``. + * The *mode* argument of :func:`os.makedirs` no longer affects the file permission bits of newly-created intermediate-level directories. To set their file permission bits you can set the umask before invoking diff --git a/Include/import.h b/Include/import.h index bb6beba67b7..4ab14d72816 100644 --- a/Include/import.h +++ b/Include/import.h @@ -38,11 +38,25 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); +#endif +PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyImport_GetModule(PyObject *name); +PyAPI_FUNC(PyObject *) _PyImport_GetModuleWithError(PyObject *name); +PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); +PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); +PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); +#endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -97,14 +111,19 @@ PyAPI_FUNC(int) _PyImport_ReleaseLock(void); PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *, + PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); -PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, + PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ diff --git a/Include/modsupport.h b/Include/modsupport.h index 8c7cf39d9a3..73d86a94b95 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -191,6 +191,10 @@ PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, int apiver); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*, + int apiver); +#endif #ifdef Py_LIMITED_API #define PyModule_Create(module) \ diff --git a/Include/pystate.h b/Include/pystate.h index edfb08b15bc..8a92f3ec3ed 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -52,7 +52,6 @@ typedef struct _is { int64_t id; - PyObject *modules; PyObject *modules_by_index; PyObject *sysdict; PyObject *builtins; diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst new file mode 100644 index 00000000000..2417f781276 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst @@ -0,0 +1,4 @@ +``PyInterpreterState`` has a "modules" field that is copied into +``sys.modules`` during interpreter startup. This causes problems if a +program replaces ``sys.modules`` with something else. To solve this we +eliminate ``PyInterpreterState.modules``. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index a6f3abeba06..2a3e73988d4 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6418,9 +6418,7 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, /*[clinic end generated code: output=becc08d7f9ed41e3 input=e2e6a865de093ef4]*/ { PyObject *global; - PyObject *modules_dict; PyObject *module; - _Py_IDENTIFIER(modules); /* Try to map the old names used in Python 2.x to the new ones used in Python 3.x. We do this only with old pickle protocols and when the @@ -6477,13 +6475,7 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, } } - modules_dict = _PySys_GetObjectId(&PyId_modules); - if (modules_dict == NULL) { - PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); - return NULL; - } - - module = PyDict_GetItemWithError(modules_dict, module_name); + module = PyImport_GetModule(module_name); if (module == NULL) { if (PyErr_Occurred()) return NULL; @@ -6491,11 +6483,11 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, if (module == NULL) return NULL; global = getattribute(module, global_name, self->proto >= 4); - Py_DECREF(module); } else { global = getattribute(module, global_name, self->proto >= 4); } + Py_DECREF(module); return global; } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index d9cfa3e2085..c8a01d4e088 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1643,7 +1643,6 @@ MODULE_INITFUNC(void) PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; - PyObject *sys_modules; PyObject *tmpnum, *tmpstr; PyObject *codes_dict; PyObject *rev_codes_dict; @@ -1693,11 +1692,6 @@ MODULE_INITFUNC(void) */ PyModule_AddStringConstant(m, "native_encoding", "UTF-8"); - sys_modules = PySys_GetObject("modules"); - if (sys_modules == NULL) { - Py_DECREF(m); - return NULL; - } d = PyModule_GetDict(m); if (d == NULL) { Py_DECREF(m); @@ -1707,7 +1701,7 @@ MODULE_INITFUNC(void) if (errors_module == NULL) { errors_module = PyModule_New(MODULE_NAME ".errors"); if (errors_module != NULL) { - PyDict_SetItem(sys_modules, errmod_name, errors_module); + _PyImport_SetModule(errmod_name, errors_module); /* gives away the reference to errors_module */ PyModule_AddObject(m, "errors", errors_module); } @@ -1717,7 +1711,7 @@ MODULE_INITFUNC(void) if (model_module == NULL) { model_module = PyModule_New(MODULE_NAME ".model"); if (model_module != NULL) { - PyDict_SetItem(sys_modules, modelmod_name, model_module); + _PyImport_SetModule(modelmod_name, model_module); /* gives away the reference to model_module */ PyModule_AddObject(m, "model", model_module); } diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 02a8cf0cb6e..89afe290323 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -161,11 +161,17 @@ _add_methods_to_object(PyObject *module, PyObject *name, PyMethodDef *functions) PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { + if (!_PyImport_IsInitialized(PyThreadState_GET()->interp)) + Py_FatalError("Python import machinery not initialized"); + return _PyModule_CreateInitialized(module, module_api_version); +} + +PyObject * +_PyModule_CreateInitialized(struct PyModuleDef* module, int module_api_version) +{ const char* name; PyModuleObject *m; - PyInterpreterState *interp = PyThreadState_Get()->interp; - if (interp->modules == NULL) - Py_FatalError("Python import machinery not initialized"); + if (!PyModuleDef_Init(module)) return NULL; name = module->m_name; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index d1a12a7efac..1d963aae3f8 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3901,7 +3901,6 @@ import_copyreg(void) { PyObject *copyreg_str; PyObject *copyreg_module; - PyInterpreterState *interp = PyThreadState_GET()->interp; _Py_IDENTIFIER(copyreg); copyreg_str = _PyUnicode_FromId(&PyId_copyreg); @@ -3913,7 +3912,7 @@ import_copyreg(void) by storing a reference to the cached module in a static variable, but this broke when multiple embedded interpreters were in use (see issue #17408 and #19088). */ - copyreg_module = PyDict_GetItemWithError(interp->modules, copyreg_str); + copyreg_module = _PyImport_GetModuleWithError(copyreg_str); if (copyreg_module != NULL) { Py_INCREF(copyreg_module); return copyreg_module; diff --git a/Python/_warnings.c b/Python/_warnings.c index add72e4ebb3..8616195c4e3 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -44,7 +44,6 @@ static PyObject * get_warnings_attr(const char *attr, int try_import) { static PyObject *warnings_str = NULL; - PyObject *all_modules; PyObject *warnings_module, *obj; if (warnings_str == NULL) { @@ -64,9 +63,7 @@ get_warnings_attr(const char *attr, int try_import) } } else { - all_modules = PyImport_GetModuleDict(); - - warnings_module = PyDict_GetItem(all_modules, warnings_str); + warnings_module = _PyImport_GetModule(warnings_str); if (warnings_module == NULL) return NULL; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 5e1f1d3854f..c363cfe8cea 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2685,7 +2685,7 @@ _PyBuiltin_Init(void) PyType_Ready(&PyZip_Type) < 0) return NULL; - mod = PyModule_Create(&builtinsmodule); + mod = _PyModule_CreateInitialized(&builtinsmodule, PYTHON_API_VERSION); if (mod == NULL) return NULL; dict = PyModule_GetDict(mod); diff --git a/Python/ceval.c b/Python/ceval.c index 92b13311355..436e5cad25f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5054,7 +5054,7 @@ import_from(PyObject *v, PyObject *name) Py_DECREF(pkgname); return NULL; } - x = PyDict_GetItem(PyImport_GetModuleDict(), fullmodname); + x = _PyImport_GetModule(fullmodname); Py_DECREF(fullmodname); if (x == NULL) { goto error; diff --git a/Python/import.c b/Python/import.c index f27b7cb010c..542a91b9e6c 100644 --- a/Python/import.c +++ b/Python/import.c @@ -303,10 +303,115 @@ _PyImport_Fini(void) PyObject * PyImport_GetModuleDict(void) { - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->modules == NULL) - Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); - return interp->modules; + PyObject *sysdict = PyThreadState_GET()->interp->sysdict; + if (sysdict == NULL) { + Py_FatalError("PyImport_GetModuleDict: no sys module!"); + } + + _Py_IDENTIFIER(modules); + PyObject *modules = _PyDict_GetItemId(sysdict, &PyId_modules); + if (modules == NULL) { + Py_FatalError("lost sys.modules"); + } + return modules; +} + +/* In some corner cases it is important to be sure that the import + machinery has been initialized (or not cleaned up yet). For + example, see issue #4236 and PyModule_Create2(). */ + +int +_PyImport_IsInitialized(PyInterpreterState *interp) +{ + if (interp->sysdict == NULL) + return 0; + _Py_IDENTIFIER(modules); + PyObject *modules = _PyDict_GetItemId(interp->sysdict, &PyId_modules); + if (modules == NULL) + return 0; + return 1; +} + +PyObject * +_PyImport_GetModule(PyObject *name) +{ + PyObject *modules = PyImport_GetModuleDict(); + if (PyDict_CheckExact(modules)) { + return PyDict_GetItem(modules, name); + } + + PyObject *mod = PyObject_GetItem(modules, name); + // For backward-comaptibility we copy the behavior of PyDict_GetItem(). + if (PyErr_Occurred()) { + PyErr_Clear(); + } + Py_XDECREF(mod); + return mod; +} + +PyObject * +_PyImport_GetModuleWithError(PyObject *name) +{ + PyObject *modules = PyImport_GetModuleDict(); + if (PyDict_CheckExact(modules)) { + return PyDict_GetItemWithError(modules, name); + } + + PyObject *mod = PyObject_GetItem(modules, name); + // For backward-comaptibility we copy the behavior + // of PyDict_GetItemWithError(). + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + } + return mod; +} + +PyObject * +_PyImport_GetModuleId(struct _Py_Identifier *nameid) +{ + PyObject *name = _PyUnicode_FromId(nameid); /* borrowed */ + if (name == NULL) { + return NULL; + } + return _PyImport_GetModule(name); +} + +int +_PyImport_SetModule(PyObject *name, PyObject *m) +{ + PyObject *modules = PyImport_GetModuleDict(); + return PyObject_SetItem(modules, name, m); +} + +int +_PyImport_SetModuleString(const char *name, PyObject *m) +{ + PyObject *modules = PyImport_GetModuleDict(); + return PyMapping_SetItemString(modules, name, m); +} + +PyObject * +PyImport_GetModule(PyObject *name) +{ + PyObject *m; + PyObject *modules = PyImport_GetModuleDict(); + if (modules == NULL) { + PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); + return NULL; + } + Py_INCREF(modules); + if (PyDict_CheckExact(modules)) { + m = PyDict_GetItemWithError(modules, name); /* borrowed */ + Py_XINCREF(m); + } + else { + m = PyObject_GetItem(modules, name); + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + } + } + Py_DECREF(modules); + return m; } @@ -336,7 +441,7 @@ PyImport_Cleanup(void) Py_ssize_t pos; PyObject *key, *value, *dict; PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; + PyObject *modules = PyImport_GetModuleDict(); PyObject *weaklist = NULL; const char * const *p; @@ -398,7 +503,7 @@ PyImport_Cleanup(void) if (Py_VerboseFlag && PyUnicode_Check(key)) PySys_FormatStderr("# cleanup[2] removing %U\n", key); STORE_MODULE_WEAKREF(key, value); - PyDict_SetItem(modules, key, Py_None); + PyObject_SetItem(modules, key, Py_None); } } @@ -465,7 +570,6 @@ PyImport_Cleanup(void) /* Clear and delete the modules directory. Actual modules will still be there only if imported during the execution of some destructor. */ - interp->modules = NULL; Py_DECREF(modules); /* Once more */ @@ -524,9 +628,9 @@ PyImport_GetMagicTag(void) int _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, - PyObject *filename) + PyObject *filename, PyObject *modules) { - PyObject *modules, *dict, *key; + PyObject *dict, *key; struct PyModuleDef *def; int res; if (extensions == NULL) { @@ -543,11 +647,10 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, PyErr_BadInternalCall(); return -1; } - modules = PyImport_GetModuleDict(); - if (PyDict_SetItem(modules, name, mod) < 0) + if (PyObject_SetItem(modules, name, mod) < 0) return -1; if (_PyState_AddModule(mod, def) < 0) { - PyDict_DelItem(modules, name); + PyMapping_DelItem(modules, name); return -1; } if (def->m_size == -1) { @@ -575,14 +678,14 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, } int -_PyImport_FixupBuiltin(PyObject *mod, const char *name) +_PyImport_FixupBuiltin(PyObject *mod, const char *name, PyObject *modules) { int res; PyObject *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return -1; - res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj); + res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj, modules); Py_DECREF(nameobj); return res; } @@ -590,6 +693,14 @@ _PyImport_FixupBuiltin(PyObject *mod, const char *name) PyObject * _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) { + PyObject *modules = PyImport_GetModuleDict(); + return _PyImport_FindExtensionObjectEx(name, filename, modules); +} + +PyObject * +_PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, + PyObject *modules) +{ PyObject *mod, *mdict, *key; PyModuleDef* def; if (extensions == NULL) @@ -605,7 +716,7 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) /* Module does not support repeated initialization */ if (def->m_base.m_copy == NULL) return NULL; - mod = PyImport_AddModuleObject(name); + mod = _PyImport_AddModuleObject(name, modules); if (mod == NULL) return NULL; mdict = PyModule_GetDict(mod); @@ -620,14 +731,14 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) mod = def->m_base.m_init(); if (mod == NULL) return NULL; - if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) { + if (PyObject_SetItem(modules, name, mod) == -1) { Py_DECREF(mod); return NULL; } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) { - PyDict_DelItem(PyImport_GetModuleDict(), name); + PyMapping_DelItem(modules, name); Py_DECREF(mod); return NULL; } @@ -639,13 +750,13 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) } PyObject * -_PyImport_FindBuiltin(const char *name) +_PyImport_FindBuiltin(const char *name, PyObject *modules) { PyObject *res, *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return NULL; - res = _PyImport_FindExtensionObject(nameobj, nameobj); + res = _PyImport_FindExtensionObjectEx(nameobj, nameobj, modules); Py_DECREF(nameobj); return res; } @@ -660,19 +771,34 @@ PyObject * PyImport_AddModuleObject(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); - PyObject *m; + return _PyImport_AddModuleObject(name, modules); +} - if ((m = PyDict_GetItemWithError(modules, name)) != NULL && - PyModule_Check(m)) { - return m; +PyObject * +_PyImport_AddModuleObject(PyObject *name, PyObject *modules) +{ + PyObject *m; + if (PyDict_CheckExact(modules)) { + m = PyDict_GetItemWithError(modules, name); + } + else { + m = PyObject_GetItem(modules, name); + // For backward-comaptibility we copy the behavior + // of PyDict_GetItemWithError(). + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + } } if (PyErr_Occurred()) { return NULL; } + if (m != NULL && PyModule_Check(m)) { + return m; + } m = PyModule_NewObject(name); if (m == NULL) return NULL; - if (PyDict_SetItem(modules, name, m) != 0) { + if (PyObject_SetItem(modules, name, m) != 0) { Py_DECREF(m); return NULL; } @@ -699,11 +825,13 @@ static void remove_module(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); - if (PyDict_GetItem(modules, name) == NULL) - return; - if (PyDict_DelItem(modules, name) < 0) + if (PyMapping_DelItem(modules, name) < 0) { + if (!PyMapping_HasKey(modules, name)) { + return; + } Py_FatalError("import: deleting existing key in" "sys.modules failed"); + } } @@ -812,7 +940,6 @@ module_dict_for_exec(PyObject *name) static PyObject * exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object) { - PyObject *modules = PyImport_GetModuleDict(); PyObject *v, *m; v = PyEval_EvalCode(code_object, module_dict, module_dict); @@ -822,7 +949,8 @@ exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object } Py_DECREF(v); - if ((m = PyDict_GetItem(modules, name)) == NULL) { + m = _PyImport_GetModule(name); + if (m == NULL) { PyErr_Format(PyExc_ImportError, "Loaded module %R not found in sys.modules", name); @@ -1055,6 +1183,7 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } + PyObject *modules = NULL; for (p = PyImport_Inittab; p->name != NULL; p++) { PyModuleDef *def; if (_PyUnicode_EqualToASCIIString(name, p->name)) { @@ -1080,7 +1209,11 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } def->m_base.m_init = p->initfunc; - if (_PyImport_FixupExtensionObject(mod, name, name) < 0) { + if (modules == NULL) { + modules = PyImport_GetModuleDict(); + } + if (_PyImport_FixupExtensionObject(mod, name, name, + modules) < 0) { Py_DECREF(name); return NULL; } @@ -1524,7 +1657,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, Py_INCREF(abs_name); } - mod = PyDict_GetItem(interp->modules, abs_name); + mod = _PyImport_GetModule(abs_name); if (mod != NULL && mod != Py_None) { _Py_IDENTIFIER(__spec__); _Py_IDENTIFIER(_initializing); @@ -1611,7 +1744,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, goto error; } - final_mod = PyDict_GetItem(interp->modules, to_return); + final_mod = _PyImport_GetModule(to_return); Py_DECREF(to_return); if (final_mod == NULL) { PyErr_Format(PyExc_KeyError, @@ -1664,10 +1797,10 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { + _Py_IDENTIFIER(imp); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *modules = PyImport_GetModuleDict(); - PyObject *imp = PyDict_GetItemString(modules, "imp"); + PyObject *imp = _PyImport_GetModuleId(&PyId_imp); if (imp == NULL) { imp = PyImport_ImportModule("imp"); if (imp == NULL) { @@ -1702,7 +1835,6 @@ PyImport_Import(PyObject *module_name) PyObject *globals = NULL; PyObject *import = NULL; PyObject *builtins = NULL; - PyObject *modules = NULL; PyObject *r = NULL; /* Initialize constant string objects */ @@ -1757,8 +1889,7 @@ PyImport_Import(PyObject *module_name) goto err; Py_DECREF(r); - modules = PyImport_GetModuleDict(); - r = PyDict_GetItemWithError(modules, module_name); + r = _PyImport_GetModule(module_name); if (r != NULL) { Py_INCREF(r); } diff --git a/Python/importdl.c b/Python/importdl.c index d8656b94333..32fb7e1be21 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -215,7 +215,8 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp) else Py_INCREF(path); - if (_PyImport_FixupExtensionObject(m, name_unicode, path) < 0) + PyObject *modules = PyImport_GetModuleDict(); + if (_PyImport_FixupExtensionObject(m, name_unicode, path, modules) < 0) goto error; Py_DECREF(name_unicode); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index eaa7b7f4599..662405bdeb3 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -41,6 +41,7 @@ _Py_IDENTIFIER(name); _Py_IDENTIFIER(stdin); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); +_Py_IDENTIFIER(threading); #ifdef __cplusplus extern "C" { @@ -262,7 +263,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) { PyObject *importlib; PyObject *impmod; - PyObject *sys_modules; PyObject *value; /* Import _importlib through its frozen version, _frozen_importlib. */ @@ -293,11 +293,7 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) else if (Py_VerboseFlag) { PySys_FormatStderr("import _imp # builtin\n"); } - sys_modules = PyImport_GetModuleDict(); - if (Py_VerboseFlag) { - PySys_FormatStderr("import sys # builtin\n"); - } - if (PyDict_SetItemString(sys_modules, "_imp", impmod) < 0) { + if (_PyImport_SetModuleString("_imp", impmod) < 0) { Py_FatalError("Py_Initialize: can't save _imp to sys.modules"); } @@ -647,10 +643,20 @@ void _Py_InitializeCore(const _PyCoreConfig *config) if (!_PyFloat_Init()) Py_FatalError("Py_InitializeCore: can't init float"); - interp->modules = PyDict_New(); - if (interp->modules == NULL) + PyObject *modules = PyDict_New(); + if (modules == NULL) Py_FatalError("Py_InitializeCore: can't make modules dictionary"); + sysmod = _PySys_BeginInit(); + if (sysmod == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys"); + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys dict"); + Py_INCREF(interp->sysdict); + PyDict_SetItemString(interp->sysdict, "modules", modules); + _PyImport_FixupBuiltin(sysmod, "sys", modules); + /* Init Unicode implementation; relies on the codec registry */ if (_PyUnicode_Init() < 0) Py_FatalError("Py_InitializeCore: can't initialize unicode"); @@ -661,7 +667,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) bimod = _PyBuiltin_Init(); if (bimod == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins modules"); - _PyImport_FixupBuiltin(bimod, "builtins"); + _PyImport_FixupBuiltin(bimod, "builtins", modules); interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins dict"); @@ -670,17 +676,6 @@ void _Py_InitializeCore(const _PyCoreConfig *config) /* initialize builtin exceptions */ _PyExc_Init(bimod); - sysmod = _PySys_BeginInit(); - if (sysmod == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys"); - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys dict"); - Py_INCREF(interp->sysdict); - _PyImport_FixupBuiltin(sysmod, "sys"); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); - /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1178,9 +1173,22 @@ Py_NewInterpreter(void) /* XXX The following is lax in error checking */ - interp->modules = PyDict_New(); + PyObject *modules = PyDict_New(); + if (modules == NULL) + Py_FatalError("Py_NewInterpreter: can't make modules dictionary"); - bimod = _PyImport_FindBuiltin("builtins"); + sysmod = _PyImport_FindBuiltin("sys", modules); + if (sysmod != NULL) { + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + goto handle_error; + Py_INCREF(interp->sysdict); + PyDict_SetItemString(interp->sysdict, "modules", modules); + PySys_SetPath(Py_GetPath()); + _PySys_EndInit(interp->sysdict); + } + + bimod = _PyImport_FindBuiltin("builtins", modules); if (bimod != NULL) { interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) @@ -1191,18 +1199,9 @@ Py_NewInterpreter(void) /* initialize builtin exceptions */ _PyExc_Init(bimod); - sysmod = _PyImport_FindBuiltin("sys"); if (bimod != NULL && sysmod != NULL) { PyObject *pstderr; - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - goto handle_error; - Py_INCREF(interp->sysdict); - _PySys_EndInit(interp->sysdict); - PySys_SetPath(Py_GetPath()); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1882,14 +1881,13 @@ wait_for_thread_shutdown(void) #ifdef WITH_THREAD _Py_IDENTIFIER(_shutdown); PyObject *result; - PyThreadState *tstate = PyThreadState_GET(); - PyObject *threading = PyMapping_GetItemString(tstate->interp->modules, - "threading"); + PyObject *threading = _PyImport_GetModuleId(&PyId_threading); if (threading == NULL) { /* threading not imported */ PyErr_Clear(); return; } + Py_INCREF(threading); result = _PyObject_CallMethodId(threading, &PyId__shutdown, NULL); if (result == NULL) { PyErr_WriteUnraisable(threading); diff --git a/Python/pystate.c b/Python/pystate.c index 24a08ebf4fe..30a372212ed 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -97,7 +97,6 @@ PyInterpreterState_New(void) if (head_mutex == NULL) Py_FatalError("Can't initialize threads for interpreter"); #endif - interp->modules = NULL; interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; @@ -158,7 +157,6 @@ PyInterpreterState_Clear(PyInterpreterState *interp) Py_CLEAR(interp->codec_search_path); Py_CLEAR(interp->codec_search_cache); Py_CLEAR(interp->codec_error_registry); - Py_CLEAR(interp->modules); Py_CLEAR(interp->modules_by_index); Py_CLEAR(interp->sysdict); Py_CLEAR(interp->builtins); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ab435c83104..852babbed78 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -159,13 +159,11 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; - PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; PyObject *builtins; static PyObject *newline = NULL; int err; - builtins = _PyDict_GetItemId(modules, &PyId_builtins); + builtins = _PyImport_GetModuleId(&PyId_builtins); if (builtins == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); return NULL; @@ -1929,7 +1927,7 @@ _PySys_BeginInit(void) PyObject *m, *sysdict, *version_info; int res; - m = PyModule_Create(&sysmodule); + m = _PyModule_CreateInitialized(&sysmodule, PYTHON_API_VERSION); if (m == NULL) return NULL; sysdict = PyModule_GetDict(m); From webhook-mailer at python.org Mon Sep 4 19:58:11 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 04 Sep 2017 23:58:11 -0000 Subject: [Python-checkins] bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) Message-ID: https://github.com/python/cpython/commit/759e30ec47048cb9835c62aaeac48748c8151390 commit: 759e30ec47048cb9835c62aaeac48748c8151390 branch: master author: Victor Stinner committer: GitHub date: 2017-09-05T01:58:08+02:00 summary: bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) * bpo-31170: Update libexpat from 2.2.3 to 2.2.4 Fix copying of partial characters for UTF-8 input (libexpat bug 115): https://github.com/libexpat/libexpat/issues/115 * Add NEWS entry. files: A Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst M Modules/expat/ascii.h M Modules/expat/asciitab.h M Modules/expat/expat.h M Modules/expat/expat_external.h M Modules/expat/iasciitab.h M Modules/expat/internal.h M Modules/expat/latin1tab.h M Modules/expat/loadlibrary.c M Modules/expat/nametab.h M Modules/expat/utf8tab.h M Modules/expat/winconfig.h M Modules/expat/xmlparse.c M Modules/expat/xmlrole.c M Modules/expat/xmlrole.h M Modules/expat/xmltok.c M Modules/expat/xmltok.h M Modules/expat/xmltok_impl.c M Modules/expat/xmltok_impl.h M Modules/expat/xmltok_ns.c diff --git a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst new file mode 100644 index 00000000000..2505007dac0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst @@ -0,0 +1,3 @@ +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 diff --git a/Modules/expat/ascii.h b/Modules/expat/ascii.h index d10530b09bd..c3587e57332 100644 --- a/Modules/expat/ascii.h +++ b/Modules/expat/ascii.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ASCII_A 0x41 diff --git a/Modules/expat/asciitab.h b/Modules/expat/asciitab.h index 79a15c28ca1..2f59fd92906 100644 --- a/Modules/expat/asciitab.h +++ b/Modules/expat/asciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index 7e5bbb7e393..d0735bb5c61 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_INCLUDED @@ -1048,7 +1076,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 3 +#define XML_MICRO_VERSION 4 #ifdef __cplusplus } diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index 4c9e5eabdee..81102856496 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_External_INCLUDED diff --git a/Modules/expat/iasciitab.h b/Modules/expat/iasciitab.h index 24a1d5ccc9a..ce4a4bf7ede 100644 --- a/Modules/expat/iasciitab.h +++ b/Modules/expat/iasciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index 94cb98e15ca..3c5d6e913d6 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -18,6 +18,35 @@ Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) diff --git a/Modules/expat/latin1tab.h b/Modules/expat/latin1tab.h index 53c25d76b26..95dfa52b1fb 100644 --- a/Modules/expat/latin1tab.h +++ b/Modules/expat/latin1tab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Modules/expat/loadlibrary.c b/Modules/expat/loadlibrary.c index ffce868399b..452ae92db26 100644 --- a/Modules/expat/loadlibrary.c +++ b/Modules/expat/loadlibrary.c @@ -6,8 +6,10 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2016 - 2017, Steve Holme, . + * Copyright (C) 2017, Expat development team * * All rights reserved. + * Licensed under the MIT license: * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/Modules/expat/nametab.h b/Modules/expat/nametab.h index b05e62c77a6..bfa2bd38cd9 100644 --- a/Modules/expat/nametab.h +++ b/Modules/expat/nametab.h @@ -1,3 +1,35 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + static const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/Modules/expat/utf8tab.h b/Modules/expat/utf8tab.h index 7bb3e77603f..fa0bed6f5d7 100644 --- a/Modules/expat/utf8tab.h +++ b/Modules/expat/utf8tab.h @@ -1,7 +1,34 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index 9bf014d7fba..17fea468900 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -1,10 +1,33 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef WINCONFIG_H diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index b703e61a040..0df68830f05 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,7 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - 101bfd65d1ff3d1511cf6671e6aae65f82cd97df6f4da137d46d510731830ad9 (2.2.3+) +/* 8c6b2be7c6281da65ce05218fc15c339f02a811706340824ab596aa86e1fd51a (2.2.4+) + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined(_GNU_SOURCE) @@ -80,9 +106,6 @@ If insist on not using any of these, bypass this error by defining \ XML_POOR_ENTROPY; you have been warned. \ \ - For CMake, one way to pass the define is: \ - cmake -DCMAKE_C_FLAGS="-pipe -O2 -DHAVE_SYSCALL_GETRANDOM" . \ - \ If you have reasons to patch this detection code away or need changes \ to the build system, please open a bug. Thank you! #endif diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c index c809ee51482..708507d575b 100644 --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/Modules/expat/xmlrole.h b/Modules/expat/xmlrole.h index 4dd9f06f976..e5f048eab55 100644 --- a/Modules/expat/xmlrole.h +++ b/Modules/expat/xmlrole.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlRole_INCLUDED diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index db4a5c8ca3e..007aed0640a 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1,8 +1,38 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include +#include // memcpy #ifdef _WIN32 #include "winconfig.h" @@ -363,22 +393,33 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - char *to; - const char *from; - const char *fromLimInitial = fromLim; + bool input_incomplete = false; + bool output_exhausted = false; + + /* Avoid copying partial characters (due to limited space). */ + const ptrdiff_t bytesAvailable = fromLim - *fromP; + const ptrdiff_t bytesStorable = toLim - *toP; + if (bytesAvailable > bytesStorable) { + fromLim = *fromP + bytesStorable; + output_exhausted = true; + } - /* Avoid copying partial characters. */ + /* Avoid copying partial characters (from incomplete input). */ + const char * const fromLimBefore = fromLim; align_limit_to_full_utf8_characters(*fromP, &fromLim); + if (fromLim < fromLimBefore) { + input_incomplete = true; + } - for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) - *to = *from; - *fromP = from; - *toP = to; + const ptrdiff_t bytesToCopy = fromLim - *fromP; + memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy); + *fromP += bytesToCopy; + *toP += bytesToCopy; - if (fromLim < fromLimInitial) - return XML_CONVERT_INPUT_INCOMPLETE; - else if ((to == toLim) && (from < fromLim)) + if (output_exhausted) // needs to go first return XML_CONVERT_OUTPUT_EXHAUSTED; + else if (input_incomplete) + return XML_CONVERT_INPUT_INCOMPLETE; else return XML_CONVERT_COMPLETED; } diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h index 752007e8b9e..6d31879b331 100644 --- a/Modules/expat/xmltok.h +++ b/Modules/expat/xmltok.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlTok_INCLUDED diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c index 4fa1ff679ce..93328b841a1 100644 --- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_IMPL_C #ifndef IS_INVALID_CHAR diff --git a/Modules/expat/xmltok_impl.h b/Modules/expat/xmltok_impl.h index da0ea60a657..a6420f48eed 100644 --- a/Modules/expat/xmltok_impl.h +++ b/Modules/expat/xmltok_impl.h @@ -1,6 +1,33 @@ /* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum { diff --git a/Modules/expat/xmltok_ns.c b/Modules/expat/xmltok_ns.c index c3b88fdf4e3..23d31e8e424 100644 --- a/Modules/expat/xmltok_ns.c +++ b/Modules/expat/xmltok_ns.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * From webhook-mailer at python.org Mon Sep 4 20:47:55 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 05 Sep 2017 00:47:55 -0000 Subject: [Python-checkins] Add comment to explain the implications of not sorting keywords (#3331) Message-ID: https://github.com/python/cpython/commit/550370957cb0e40bfc497174c95fee47d01de995 commit: 550370957cb0e40bfc497174c95fee47d01de995 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T17:47:53-07:00 summary: Add comment to explain the implications of not sorting keywords (#3331) In Python 3.6, sorted() was removed from _make_key() for the lru_cache and instead rely on guaranteed keyword argument order preservation. This makes keyword argument handling faster but it also causes multiple callers with a different keyword argument order to be cached as separate items. Depending on your point of view, this is either a performance regression (increased number of cache misses) or a performance enhancement (faster computation of keys). files: M Lib/functools.py diff --git a/Lib/functools.py b/Lib/functools.py index 89f2cf4f5f7..0873f207154 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -432,6 +432,10 @@ def _make_key(args, kwds, typed, saves space and improves lookup speed. """ + # All of code below relies on kwds preserving the order input by the user. + # Formerly, we sorted() the kwds before looping. The new way is *much* + # faster; however, it means that f(x=1, y=2) will now be treated as a + # distinct call from f(y=2, x=1) which will be cached separately. key = args if kwds: key += kwd_mark From webhook-mailer at python.org Mon Sep 4 21:54:19 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 05 Sep 2017 01:54:19 -0000 Subject: [Python-checkins] Fix terminology in comment and add more design rationale. (#3335) Message-ID: https://github.com/python/cpython/commit/64263dfd182da4984c51ea33ebd597369d4196f3 commit: 64263dfd182da4984c51ea33ebd597369d4196f3 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-04T18:54:16-07:00 summary: Fix terminology in comment and add more design rationale. (#3335) * Fix terminology in comment and add more design rationale. * Fix extra space files: M Objects/setobject.c diff --git a/Objects/setobject.c b/Objects/setobject.c index 5c61bc71795..219e81d0baf 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -12,16 +12,23 @@ To improve cache locality, each probe inspects a series of consecutive nearby entries before moving on to probes elsewhere in memory. This leaves - us with a hybrid of linear probing and open addressing. The linear probing + us with a hybrid of linear probing and randomized probing. The linear probing reduces the cost of hash collisions because consecutive memory accesses tend to be much cheaper than scattered probes. After LINEAR_PROBES steps, - we then use open addressing with the upper bits from the hash value. This - helps break-up long chains of collisions. + we then use more of the upper bits from the hash value and apply a simple + linear congruential random number genearator. This helps break-up long + chains of collisions. All arithmetic on hash should ignore overflow. Unlike the dictionary implementation, the lookkey function can return NULL if the rich comparison returns an error. + + Use cases for sets differ considerably from dictionaries where looked-up + keys are more likely to be present. In contrast, sets are primarily + about membership testing where the presence of an element is not known in + advance. Accordingly, the set implementation needs to optimize for both + the found and not-found case. */ #include "Python.h" From webhook-mailer at python.org Mon Sep 4 23:18:43 2017 From: webhook-mailer at python.org (Neil Schemenauer) Date: Tue, 05 Sep 2017 03:18:43 -0000 Subject: [Python-checkins] bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908) Message-ID: https://github.com/python/cpython/commit/e38d12ed34870c140016bef1e0ff10c8c3d3f213 commit: e38d12ed34870c140016bef1e0ff10c8c3d3f213 branch: master author: Neil Schemenauer committer: GitHub date: 2017-09-04T20:18:38-07:00 summary: bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908) * Maintain a list of BufferedWriter objects. Flush them on exit. In Python 3, the buffer and the underlying file object are separate and so the order in which objects are finalized matters. This is unlike Python 2 where the file and buffer were a single object and finalization was done for both at the same time. In Python 3, if the file is finalized and closed before the buffer then the data in the buffer is lost. This change adds a doubly linked list of open file buffers. An atexit hook ensures they are flushed before proceeding with interpreter shutdown. This is addition does not remove the need to properly close files as there are other reasons why buffered data could get lost during finalization. Initial patch by Armin Rigo. * Use weakref.WeakSet instead of WeakKeyDictionary. * Simplify buffered double-linked list types. * In _flush_all_writers(), suppress errors from flush(). * Remove NEWS entry, use blurb. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst M Lib/_pyio.py M Modules/_io/_iomodule.c M Modules/_io/_iomodule.h M Modules/_io/bufferedio.c diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 4653847bcb1..3aa2b24c040 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1185,6 +1185,7 @@ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): self.buffer_size = buffer_size self._write_buf = bytearray() self._write_lock = Lock() + _register_writer(self) def writable(self): return self.raw.writable() @@ -2574,3 +2575,26 @@ def encoding(self): def detach(self): # This doesn't make sense on StringIO. self._unsupported("detach") + + +# ____________________________________________________________ + +import atexit, weakref + +_all_writers = weakref.WeakSet() + +def _register_writer(w): + # keep weak-ref to buffered writer + _all_writers.add(w) + +def _flush_all_writers(): + # Ensure all buffered writers are flushed before proceeding with + # normal shutdown. Otherwise, if the underlying file objects get + # finalized before the buffered writer wrapping it then any buffered + # data will be lost. + for w in _all_writers: + try: + w.flush() + except: + pass +atexit.register(_flush_all_writers) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst new file mode 100644 index 00000000000..185664c747d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst @@ -0,0 +1,2 @@ +Maintain a list of open buffered files, flush them before exiting the +interpreter. Based on a patch from Armin Rigo. diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index f0621f4d4ab..5db44f970d2 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -766,6 +766,8 @@ PyInit__io(void) !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; + _Py_PyAtExit(_PyIO_atexit_flush); + state->initialized = 1; return m; diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h index db8403774ea..1dce5dada4e 100644 --- a/Modules/_io/_iomodule.h +++ b/Modules/_io/_iomodule.h @@ -183,3 +183,5 @@ extern PyObject *_PyIO_empty_str; extern PyObject *_PyIO_empty_bytes; extern PyTypeObject _PyBytesIOBuffer_Type; + +extern void _PyIO_atexit_flush(void); diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 189b1cd8442..50c87c1746d 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -196,7 +196,7 @@ bufferediobase_write(PyObject *self, PyObject *args) } -typedef struct { +typedef struct _buffered { PyObject_HEAD PyObject *raw; @@ -240,8 +240,18 @@ typedef struct { PyObject *dict; PyObject *weakreflist; + + /* a doubly-linked chained list of "buffered" objects that need to + be flushed when the process exits */ + struct _buffered *next, *prev; } buffered; +/* the actual list of buffered objects */ +static buffered buffer_list_end = { + .next = &buffer_list_end, + .prev = &buffer_list_end +}; + /* Implementation notes: @@ -387,6 +397,15 @@ _enter_buffered_busy(buffered *self) static void +remove_from_linked_list(buffered *self) +{ + self->next->prev = self->prev; + self->prev->next = self->next; + self->prev = NULL; + self->next = NULL; +} + +static void buffered_dealloc(buffered *self) { self->finalizing = 1; @@ -394,6 +413,8 @@ buffered_dealloc(buffered *self) return; _PyObject_GC_UNTRACK(self); self->ok = 0; + if (self->next != NULL) + remove_from_linked_list(self); if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *)self); Py_CLEAR(self->raw); @@ -1817,10 +1838,33 @@ _io_BufferedWriter___init___impl(buffered *self, PyObject *raw, self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && Py_TYPE(raw) == &PyFileIO_Type); + if (self->next == NULL) { + self->prev = &buffer_list_end; + self->next = buffer_list_end.next; + buffer_list_end.next->prev = self; + buffer_list_end.next = self; + } + self->ok = 1; return 0; } +/* +* Ensure all buffered writers are flushed before proceeding with +* normal shutdown. Otherwise, if the underlying file objects get +* finalized before the buffered writer wrapping it then any buffered +* data will be lost. +*/ +void _PyIO_atexit_flush(void) +{ + while (buffer_list_end.next != &buffer_list_end) { + buffered *buf = buffer_list_end.next; + remove_from_linked_list(buf); + buffered_flush(buf, NULL); + PyErr_Clear(); + } +} + static Py_ssize_t _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) { From webhook-mailer at python.org Tue Sep 5 01:13:20 2017 From: webhook-mailer at python.org (Neil Schemenauer) Date: Tue, 05 Sep 2017 05:13:20 -0000 Subject: [Python-checkins] Revert "bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908)" (#3337) Message-ID: https://github.com/python/cpython/commit/db564238db440d4a2d8eb9d60ffb94ef291f6d30 commit: db564238db440d4a2d8eb9d60ffb94ef291f6d30 branch: master author: Neil Schemenauer committer: GitHub date: 2017-09-04T22:13:17-07:00 summary: Revert "bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#1908)" (#3337) This reverts commit e38d12ed34870c140016bef1e0ff10c8c3d3f213. files: D Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst M Lib/_pyio.py M Modules/_io/_iomodule.c M Modules/_io/_iomodule.h M Modules/_io/bufferedio.c diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 3aa2b24c040..4653847bcb1 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1185,7 +1185,6 @@ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): self.buffer_size = buffer_size self._write_buf = bytearray() self._write_lock = Lock() - _register_writer(self) def writable(self): return self.raw.writable() @@ -2575,26 +2574,3 @@ def encoding(self): def detach(self): # This doesn't make sense on StringIO. self._unsupported("detach") - - -# ____________________________________________________________ - -import atexit, weakref - -_all_writers = weakref.WeakSet() - -def _register_writer(w): - # keep weak-ref to buffered writer - _all_writers.add(w) - -def _flush_all_writers(): - # Ensure all buffered writers are flushed before proceeding with - # normal shutdown. Otherwise, if the underlying file objects get - # finalized before the buffered writer wrapping it then any buffered - # data will be lost. - for w in _all_writers: - try: - w.flush() - except: - pass -atexit.register(_flush_all_writers) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst deleted file mode 100644 index 185664c747d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Maintain a list of open buffered files, flush them before exiting the -interpreter. Based on a patch from Armin Rigo. diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index 5db44f970d2..f0621f4d4ab 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -766,8 +766,6 @@ PyInit__io(void) !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; - _Py_PyAtExit(_PyIO_atexit_flush); - state->initialized = 1; return m; diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h index 1dce5dada4e..db8403774ea 100644 --- a/Modules/_io/_iomodule.h +++ b/Modules/_io/_iomodule.h @@ -183,5 +183,3 @@ extern PyObject *_PyIO_empty_str; extern PyObject *_PyIO_empty_bytes; extern PyTypeObject _PyBytesIOBuffer_Type; - -extern void _PyIO_atexit_flush(void); diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 50c87c1746d..189b1cd8442 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -196,7 +196,7 @@ bufferediobase_write(PyObject *self, PyObject *args) } -typedef struct _buffered { +typedef struct { PyObject_HEAD PyObject *raw; @@ -240,18 +240,8 @@ typedef struct _buffered { PyObject *dict; PyObject *weakreflist; - - /* a doubly-linked chained list of "buffered" objects that need to - be flushed when the process exits */ - struct _buffered *next, *prev; } buffered; -/* the actual list of buffered objects */ -static buffered buffer_list_end = { - .next = &buffer_list_end, - .prev = &buffer_list_end -}; - /* Implementation notes: @@ -397,15 +387,6 @@ _enter_buffered_busy(buffered *self) static void -remove_from_linked_list(buffered *self) -{ - self->next->prev = self->prev; - self->prev->next = self->next; - self->prev = NULL; - self->next = NULL; -} - -static void buffered_dealloc(buffered *self) { self->finalizing = 1; @@ -413,8 +394,6 @@ buffered_dealloc(buffered *self) return; _PyObject_GC_UNTRACK(self); self->ok = 0; - if (self->next != NULL) - remove_from_linked_list(self); if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *)self); Py_CLEAR(self->raw); @@ -1838,33 +1817,10 @@ _io_BufferedWriter___init___impl(buffered *self, PyObject *raw, self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && Py_TYPE(raw) == &PyFileIO_Type); - if (self->next == NULL) { - self->prev = &buffer_list_end; - self->next = buffer_list_end.next; - buffer_list_end.next->prev = self; - buffer_list_end.next = self; - } - self->ok = 1; return 0; } -/* -* Ensure all buffered writers are flushed before proceeding with -* normal shutdown. Otherwise, if the underlying file objects get -* finalized before the buffered writer wrapping it then any buffered -* data will be lost. -*/ -void _PyIO_atexit_flush(void) -{ - while (buffer_list_end.next != &buffer_list_end) { - buffered *buf = buffer_list_end.next; - remove_from_linked_list(buf); - buffered_flush(buf, NULL); - PyErr_Clear(); - } -} - static Py_ssize_t _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) { From webhook-mailer at python.org Tue Sep 5 01:23:45 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Tue, 05 Sep 2017 05:23:45 -0000 Subject: [Python-checkins] bpo-31347: _PyObject_FastCall_Prepend: do not call memcpy if args might not be null (#3329) Message-ID: https://github.com/python/cpython/commit/a3070d530c70477273cacbc61660b318582fff44 commit: a3070d530c70477273cacbc61660b318582fff44 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-04T22:23:42-07:00 summary: bpo-31347: _PyObject_FastCall_Prepend: do not call memcpy if args might not be null (#3329) Passing NULL as the second argument to to memcpy is undefined behavior even if the size is 0. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst M Objects/call.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst new file mode 100644 index 00000000000..52a6168e632 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst @@ -0,0 +1 @@ +Fix possible undefined behavior in _PyObject_FastCall_Prepend. diff --git a/Objects/call.c b/Objects/call.c index 4294a9beb0a..92464327fbc 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -854,9 +854,9 @@ _PyObject_FastCall_Prepend(PyObject *callable, /* use borrowed references */ args2[0] = obj; - memcpy(&args2[1], - args, - (nargs - 1)* sizeof(PyObject *)); + if (nargs > 1) { + memcpy(&args2[1], args, (nargs - 1) * sizeof(PyObject *)); + } result = _PyObject_FastCall(callable, args2, nargs); if (args2 != small_stack) { From webhook-mailer at python.org Tue Sep 5 01:27:34 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 05 Sep 2017 05:27:34 -0000 Subject: [Python-checkins] Fix malformed handcrafted blurb filename. (#3327) Message-ID: https://github.com/python/cpython/commit/254ee4d5ed9655668c2ee1cbc4d0ee88c6e45435 commit: 254ee4d5ed9655668c2ee1cbc4d0ee88c6e45435 branch: 3.6 author: larryhastings committer: Ned Deily date: 2017-09-04T22:27:31-07:00 summary: Fix malformed handcrafted blurb filename. (#3327) files: From webhook-mailer at python.org Tue Sep 5 02:23:07 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 05 Sep 2017 06:23:07 -0000 Subject: [Python-checkins] Simplify NEWS entry to prevent suspicious warnings. (#3339) Message-ID: https://github.com/python/cpython/commit/114c457408f33dfc6d297d269c7cbca60b650d83 commit: 114c457408f33dfc6d297d269c7cbca60b650d83 branch: 3.6 author: Ned Deily committer: GitHub date: 2017-09-04T23:23:04-07:00 summary: Simplify NEWS entry to prevent suspicious warnings. (#3339) files: M Misc/NEWS.d/3.6.0a2.rst diff --git a/Misc/NEWS.d/3.6.0a2.rst b/Misc/NEWS.d/3.6.0a2.rst index 3984fabedba..46387a5c0b1 100644 --- a/Misc/NEWS.d/3.6.0a2.rst +++ b/Misc/NEWS.d/3.6.0a2.rst @@ -584,14 +584,7 @@ Update idlelib/README.txt with new file names and event handlers. .. nonce: j1N9br .. section: IDLE -Remove obsolete code not used by IDLE. Replacements: 1. help.txt, replaced -by help.html, is out-of-date and should not be used. Its dedicated viewer -has be replaced by the html viewer in help.py. 2. ``import idlever; I = -idlever.IDLE_VERSION`` is the same as ``import sys; I = -version[:version.index(' ')]`` 3. After ``ob = -stackviewer.VariablesTreeItem(*args)``, ``ob.keys() == -list(ob.object.keys)``. 4. In macosc, runningAsOSXAPP == isAquaTk; -idCarbonAquaTk == isCarbonTk +Remove obsolete code not used by IDLE. .. From webhook-mailer at python.org Tue Sep 5 03:10:33 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 05 Sep 2017 07:10:33 -0000 Subject: [Python-checkins] Include additional changes to support blurbified NEWS (#3340) Message-ID: https://github.com/python/cpython/commit/e2543a67fb8e84ac982929f07e1ae98ec1e23fa4 commit: e2543a67fb8e84ac982929f07e1ae98ec1e23fa4 branch: 3.6 author: Ned Deily committer: GitHub date: 2017-09-05T00:10:31-07:00 summary: Include additional changes to support blurbified NEWS (#3340) files: M .travis.yml M Doc/Makefile M Doc/whatsnew/changelog.rst diff --git a/.travis.yml b/.travis.yml index 57b4c08a3e7..2515d6416a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ matrix: - cd Doc # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures. # (Updating the version is fine as long as no warnings are raised by doing so.) - - python -m pip install sphinx~=1.6.1 + - python -m pip install sphinx~=1.6.1 blurb script: - make check suspicious html SPHINXOPTS="-q -W -j4" - os: linux diff --git a/Doc/Makefile b/Doc/Makefile index 526269d1e19..63bbe1d4d71 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -6,6 +6,7 @@ # You can set these variables from the command line. PYTHON = python3 SPHINXBUILD = sphinx-build +BLURB = $(PYTHON) -m blurb PAPER = SOURCES = DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) @@ -38,6 +39,20 @@ help: @echo " serve to serve the documentation on the localhost (8000)" build: + -mkdir -p build +# Look first for a Misc/NEWS file (building from a source release tarball +# or old repo) and use that, otherwise look for a Misc/NEWS.d directory +# (building from a newer repo) and use blurb to generate the NEWS file. + @if [ -f ../Misc/NEWS ] ; then \ + echo "Using existing Misc/NEWS file"; \ + cp ../Misc/NEWS build/NEWS; \ + elif [ -d ../Misc/NEWS.d ]; then \ + echo "Building NEWS from Misc/NEWS.d with blurb"; \ + $(BLURB) merge -f build/NEWS; \ + else \ + echo "Neither Misc/NEWS.d nor Misc/NEWS found; cannot build docs"; \ + exit 1; \ + fi $(SPHINXBUILD) $(ALLSPHINXOPTS) @echo @@ -107,7 +122,7 @@ clean: venv: $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install -U Sphinx + ./venv/bin/python3 -m pip install -U Sphinx blurb dist: rm -rf dist diff --git a/Doc/whatsnew/changelog.rst b/Doc/whatsnew/changelog.rst index 67a12f3374f..b4356143659 100644 --- a/Doc/whatsnew/changelog.rst +++ b/Doc/whatsnew/changelog.rst @@ -4,4 +4,4 @@ Changelog +++++++++ -.. miscnews:: ../../Misc/NEWS +.. miscnews:: ../build/NEWS From webhook-mailer at python.org Tue Sep 5 03:47:28 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 05 Sep 2017 07:47:28 -0000 Subject: [Python-checkins] Simplify NEWS entry to prevent suspicious warnings. (#3339) Message-ID: https://github.com/python/cpython/commit/e295b826099ecad6926d4f95e3f739b3ecdc3cc7 commit: e295b826099ecad6926d4f95e3f739b3ecdc3cc7 branch: master author: Ned Deily committer: Ned Deily date: 2017-09-05T00:45:36-07:00 summary: Simplify NEWS entry to prevent suspicious warnings. (#3339) files: M Misc/NEWS.d/3.6.0a2.rst diff --git a/Misc/NEWS.d/3.6.0a2.rst b/Misc/NEWS.d/3.6.0a2.rst index 7f3b0b8a0ad..6ca65a06cb3 100644 --- a/Misc/NEWS.d/3.6.0a2.rst +++ b/Misc/NEWS.d/3.6.0a2.rst @@ -584,14 +584,7 @@ Update idlelib/README.txt with new file names and event handlers. .. nonce: j1N9br .. section: IDLE -Remove obsolete code not used by IDLE. Replacements: 1. help.txt, replaced -by help.html, is out-of-date and should not be used. Its dedicated viewer -has be replaced by the html viewer in help.py. 2. ``import idlever; I = -idlever.IDLE_VERSION`` is the same as ``import sys; I = -version[:version.index(' ')]`` 3. After ``ob = -stackviewer.VariablesTreeItem(*args)``, ``ob.keys() == -list(ob.object.keys)``. 4. In macosc, runningAsOSXAPP == isAquaTk; -idCarbonAquaTk == isCarbonTk +Remove obsolete code not used by IDLE. .. From webhook-mailer at python.org Tue Sep 5 04:34:50 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 05 Sep 2017 08:34:50 -0000 Subject: [Python-checkins] Prevent a few make suspicious warnings. (#3341) Message-ID: https://github.com/python/cpython/commit/52451fbaaf099e68044e67153c2c3eaa2d71e6e7 commit: 52451fbaaf099e68044e67153c2c3eaa2d71e6e7 branch: master author: Ned Deily committer: GitHub date: 2017-09-05T01:34:47-07:00 summary: Prevent a few make suspicious warnings. (#3341) files: M Doc/tools/susp-ignored.csv diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 393dc6b96b4..7f1f9ea1629 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -325,6 +325,8 @@ whatsnew/3.5,,:warning,'WARNING:root:warning\n' whatsnew/3.5,,::,>>> addr6 = ipaddress.IPv6Address('::1') whatsnew/3.5,,:root,ERROR:root:exception whatsnew/3.5,,:exception,ERROR:root:exception +whatsnew/changelog,,`,'`' +whatsnew/changelog,,:end,str[start:end] library/binascii,,`,'`' library/uu,,`,'`' whatsnew/3.7,,`,'`' From solipsis at pitrou.net Tue Sep 5 05:05:22 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 05 Sep 2017 09:05:22 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=1 Message-ID: <20170905090510.91276.EAA4B54A122D4900@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [3, 0, 0] memory blocks, sum=3 test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [0, 2, -2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogKU76FB', '--timeout', '7200'] From webhook-mailer at python.org Tue Sep 5 09:47:14 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 13:47:14 -0000 Subject: [Python-checkins] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (#3112) Message-ID: https://github.com/python/cpython/commit/c941e6238ab2a8caad11fe17d4723a5d5e7a2d76 commit: c941e6238ab2a8caad11fe17d4723a5d5e7a2d76 branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T15:47:11+02:00 summary: bpo-30102: Call OPENSSL_add_all_algorithms_noconf (#3112) The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0. The function detects CPU features and enables optimizations on some CPU architectures such as POWER8. Patch is based on research from Gustavo Serra Scalet. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst M Modules/_hashopenssl.c M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst new file mode 100644 index 00000000000..13c07e39fdc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst @@ -0,0 +1,4 @@ +The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on +OpenSSL < 1.1.0. The function detects CPU features and enables optimizations +on some CPU architectures such as POWER8. Patch is based on research from +Gustavo Serra Scalet. diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 037fa4e2e99..8ef8c54bfd6 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -1022,8 +1022,11 @@ PyInit__hashlib(void) { PyObject *m, *openssl_md_meth_names; - OpenSSL_add_all_digests(); +#ifndef OPENSSL_VERSION_1_1 + /* Load all digest algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); ERR_load_crypto_strings(); +#endif /* TODO build EVP_functions openssl_* entries dynamically based * on what hashes are supported rather than listing many diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 9ceaf5acc63..b001bca99d9 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5181,9 +5181,14 @@ PyInit__ssl(void) return NULL; PySocketModule = *socket_api; +#ifndef OPENSSL_VERSION_1_1 + /* Load all algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); /* Init OpenSSL */ SSL_load_error_strings(); SSL_library_init(); +#endif + #ifdef WITH_THREAD #ifdef HAVE_OPENSSL_CRYPTO_LOCK /* note that this will start threading if not already started */ @@ -5195,7 +5200,6 @@ PyInit__ssl(void) _ssl_locks_count++; #endif #endif /* WITH_THREAD */ - OpenSSL_add_all_algorithms(); /* Add symbols to module dict */ sslerror_type_slots[0].pfunc = PyExc_OSError; From webhook-mailer at python.org Tue Sep 5 09:53:12 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 13:53:12 -0000 Subject: [Python-checkins] bpo-31343: Include sys/sysmacros.h (#3318) Message-ID: https://github.com/python/cpython/commit/75b961869a1184895c9d5bf41a57f3c985622662 commit: 75b961869a1184895c9d5bf41a57f3c985622662 branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T15:53:09+02:00 summary: bpo-31343: Include sys/sysmacros.h (#3318) Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst M Modules/posixmodule.c M aclocal.m4 M configure M configure.ac M pyconfig.h.in diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst new file mode 100644 index 00000000000..7def54336fd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst @@ -0,0 +1,2 @@ +Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray +plans to remove the functions from sys/types.h. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index e8138d5d3c3..7b57d8bda3e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -56,6 +56,11 @@ corresponding Unix manual entries for more information on calls."); #include #endif +#ifdef HAVE_SYS_SYSMACROS_H +/* GNU C Library: major(), minor(), makedev() */ +#include +#endif + #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ diff --git a/aclocal.m4 b/aclocal.m4 index 2a745e57466..5fadcb1e445 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -12,9 +12,9 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + dnl Copyright ? 2004 Scott James Remnant . dnl Copyright ? 2012-2015 Dan Nicholson dnl @@ -288,3 +288,71 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + diff --git a/configure b/configure index d2766bc435d..3880421dba1 100755 --- a/configure +++ b/configure @@ -782,7 +782,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -896,7 +895,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1149,15 +1147,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1295,7 +1284,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1448,7 +1437,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -7811,7 +7799,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h +sys/endian.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 4ceeea8d89c..3bf01386d66 100644 --- a/configure.ac +++ b/configure.ac @@ -2060,7 +2060,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h) +sys/endian.h sys/sysmacros.h) AC_HEADER_DIRENT AC_HEADER_MAJOR diff --git a/pyconfig.h.in b/pyconfig.h.in index 2efd768a96a..69033ef9e2e 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1054,6 +1054,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCALL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYS_DOMAIN_H From webhook-mailer at python.org Tue Sep 5 10:00:57 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 14:00:57 -0000 Subject: [Python-checkins] [3.6] bpo-30622: Change NPN detection: (GH-2079) (#3314) Message-ID: https://github.com/python/cpython/commit/7316c6d4a57931e9786c06eae168b227d7463317 commit: 7316c6d4a57931e9786c06eae168b227d7463317 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T16:00:44+02:00 summary: [3.6] bpo-30622: Change NPN detection: (GH-2079) (#3314) * Change NPN detection: Version breakdown, support disabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will be defined -> True/False Version breakdown support enabled (pre-patch/post-patch): - pre-1.0.1: OPENSSL_NPN_NEGOTIATED will not be defined -> False/False - 1.0.1 and 1.0.2: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True - 1.1.0+: OPENSSL_NPN_NEGOTIATED will be defined and OPENSSL_NO_NEXTPROTONEG will not be defined -> True/True * Refine NPN guard: - If NPN is disabled, but ALPN is available we need our callback - Make clinic's ssl behave the same way This created a working ssl module for me, with NPN disabled and ALPN enabled for OpenSSL 1.1.0f. Concerns to address: The initial commit for NPN support into OpenSSL [1], had the OPENSSL_NPN_* variables defined inside the OPENSSL_NO_NEXTPROTONEG guard. The question is if that ever made it into a release. This would need an ugly hack, something like: GH-if defined(OPENSSL_NO_NEXTPROTONEG) && \ !defined(OPENSSL_NPN_NEGOTIATED) GH- define OPENSSL_NPN_UNSUPPORTED 0 GH- define OPENSSL_NPN_NEGOTIATED 1 GH- define OPENSSL_NPN_NO_OVERLAP 2 GH-endif [1] https://github.com/openssl/openssl/commit/68b33cc5c7 (cherry picked from commit b2d096b) files: M Modules/_ssl.c M Modules/clinic/_ssl.c.h diff --git a/Modules/_ssl.c b/Modules/_ssl.c index ae38386ca02..6b6f2b1135c 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -279,7 +279,7 @@ static unsigned int _ssl_locks_count = 0; typedef struct { PyObject_HEAD SSL_CTX *ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) unsigned char *npn_protocols; int npn_protocols_len; #endif @@ -1693,7 +1693,7 @@ _ssl__SSLSocket_version_impl(PySSLSocket *self) return PyUnicode_FromString(version); } -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) /*[clinic input] _ssl._SSLSocket.selected_npn_protocol [clinic start generated code]*/ @@ -2645,7 +2645,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version) return NULL; } self->ctx = ctx; -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) self->npn_protocols = NULL; #endif #ifdef HAVE_ALPN @@ -2780,7 +2780,7 @@ context_dealloc(PySSLContext *self) PyObject_GC_UnTrack(self); context_clear(self); SSL_CTX_free(self->ctx); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyMem_FREE(self->npn_protocols); #endif #ifdef HAVE_ALPN @@ -2858,7 +2858,7 @@ _ssl__SSLContext_get_ciphers_impl(PySSLContext *self) #endif -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) || defined(HAVE_ALPN) static int do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, const unsigned char *server_protocols, unsigned int server_protocols_len, @@ -2882,7 +2882,9 @@ do_protocol_selection(int alpn, unsigned char **out, unsigned char *outlen, return SSL_TLSEXT_ERR_OK; } +#endif +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) /* this callback gets passed to SSL_CTX_set_next_protos_advertise_cb */ static int _advertiseNPN_cb(SSL *s, @@ -2925,7 +2927,7 @@ _ssl__SSLContext__set_npn_protocols_impl(PySSLContext *self, Py_buffer *protos) /*[clinic end generated code: output=72b002c3324390c6 input=319fcb66abf95bd7]*/ { -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) PyMem_Free(self->npn_protocols); self->npn_protocols = PyMem_Malloc(protos->len); if (self->npn_protocols == NULL) @@ -5391,7 +5393,7 @@ PyInit__ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ECDH", r); -#ifdef OPENSSL_NPN_NEGOTIATED +#if defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG) r = Py_True; #else r = Py_False; diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 75f8f5a60bb..6f748903f4e 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -132,7 +132,7 @@ _ssl__SSLSocket_version(PySSLSocket *self, PyObject *Py_UNUSED(ignored)) return _ssl__SSLSocket_version_impl(self); } -#if defined(OPENSSL_NPN_NEGOTIATED) +#if (defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG)) PyDoc_STRVAR(_ssl__SSLSocket_selected_npn_protocol__doc__, "selected_npn_protocol($self, /)\n" @@ -151,7 +151,7 @@ _ssl__SSLSocket_selected_npn_protocol(PySSLSocket *self, PyObject *Py_UNUSED(ign return _ssl__SSLSocket_selected_npn_protocol_impl(self); } -#endif /* defined(OPENSSL_NPN_NEGOTIATED) */ +#endif /* (defined(OPENSSL_NPN_NEGOTIATED) && !defined(OPENSSL_NO_NEXTPROTONEG)) */ #if defined(HAVE_ALPN) @@ -1168,4 +1168,4 @@ _ssl_enum_crls(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kw #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=56cead8610faa505 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a8b184655068c238 input=a9049054013a1b77]*/ From webhook-mailer at python.org Tue Sep 5 10:03:32 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 14:03:32 -0000 Subject: [Python-checkins] [3.6] Travis: use ccache (GH-3307) (#3332) Message-ID: https://github.com/python/cpython/commit/8704d5439c7de8b471921e0ebcb6a62ebb6fe1a1 commit: 8704d5439c7de8b471921e0ebcb6a62ebb6fe1a1 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T16:03:29+02:00 summary: [3.6] Travis: use ccache (GH-3307) (#3332) (cherry picked from commit 8adc73c) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 2515d6416a7..4a507c995e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ dist: trusty sudo: false group: beta -# To cache doc-building dependencies. -cache: pip +# To cache doc-building dependencies and C compiler output. +cache: + - pip + - ccache branches: only: From webhook-mailer at python.org Tue Sep 5 11:08:48 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 15:08:48 -0000 Subject: [Python-checkins] [2.7] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3345) Message-ID: https://github.com/python/cpython/commit/ffa7011cb904ee6ad9d4931b073c13d9e1514e6b commit: ffa7011cb904ee6ad9d4931b073c13d9e1514e6b branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-05T17:08:45+02:00 summary: [2.7] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3345) Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes . (cherry picked from commit 75b961869a1184895c9d5bf41a57f3c985622662) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst M Modules/posixmodule.c M aclocal.m4 M configure M configure.ac M pyconfig.h.in diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst new file mode 100644 index 00000000000..7def54336fd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst @@ -0,0 +1,2 @@ +Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray +plans to remove the functions from sys/types.h. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index a06c56e0691..c9886d514b7 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -65,6 +65,11 @@ corresponding Unix manual entries for more information on calls."); #include "osdefs.h" #endif +#ifdef HAVE_SYS_SYSMACROS_H +/* GNU C Library: major(), minor(), makedev() */ +#include +#endif + #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ diff --git a/aclocal.m4 b/aclocal.m4 index 2a745e57466..5fadcb1e445 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -12,9 +12,9 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + dnl Copyright ? 2004 Scott James Remnant . dnl Copyright ? 2012-2015 Dan Nicholson dnl @@ -288,3 +288,71 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + diff --git a/configure b/configure index 4c0435e98d2..daa442883a8 100755 --- a/configure +++ b/configure @@ -2963,7 +2963,7 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 $as_echo "$interp" >&6; } - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp fi elif test "$cross_compiling" = maybe; then as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 @@ -6399,6 +6399,7 @@ if test "$Py_OPT" = 'true' ; then # compile working code using it and both test_distutils and test_gdb are # broken when you do managed to get a toolchain that works with it. People # who want LTO need to use --with-lto themselves. + Py_LTO='true' DEF_MAKE_ALL_RULE="profile-opt" REQUIRE_PGO="yes" DEF_MAKE_RULE="build_all" @@ -7045,7 +7046,7 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/ sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ -bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h +bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 780f2758c83..344d9b03673 100644 --- a/configure.ac +++ b/configure.ac @@ -1702,7 +1702,7 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/ sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ -bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h) +bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h) AC_HEADER_DIRENT AC_HEADER_MAJOR diff --git a/pyconfig.h.in b/pyconfig.h.in index 98a76a55f44..2815c15d391 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -799,6 +799,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIO_H From webhook-mailer at python.org Tue Sep 5 11:09:15 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 15:09:15 -0000 Subject: [Python-checkins] [3.6] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3344) Message-ID: https://github.com/python/cpython/commit/02854dab6231d726fa2c63d44ab25598988c44f4 commit: 02854dab6231d726fa2c63d44ab25598988c44f4 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T17:09:12+02:00 summary: [3.6] bpo-31343: Include sys/sysmacros.h (GH-3318) (#3344) Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes (cherry picked from commit 75b9618) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst M Modules/posixmodule.c M aclocal.m4 M configure M configure.ac M pyconfig.h.in diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst new file mode 100644 index 00000000000..7def54336fd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst @@ -0,0 +1,2 @@ +Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray +plans to remove the functions from sys/types.h. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index ead2ea93702..ee27fa4dec6 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -55,6 +55,11 @@ corresponding Unix manual entries for more information on calls."); #include #endif +#ifdef HAVE_SYS_SYSMACROS_H +/* GNU C Library: major(), minor(), makedev() */ +#include +#endif + #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ diff --git a/aclocal.m4 b/aclocal.m4 index 2a745e57466..5fadcb1e445 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -12,9 +12,9 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + dnl Copyright ? 2004 Scott James Remnant . dnl Copyright ? 2012-2015 Dan Nicholson dnl @@ -288,3 +288,71 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + diff --git a/configure b/configure index 10ac675ea86..ed305a89b4b 100755 --- a/configure +++ b/configure @@ -7822,7 +7822,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h +sys/endian.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 962006704f9..e400fa187de 100644 --- a/configure.ac +++ b/configure.ac @@ -2068,7 +2068,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ -sys/endian.h) +sys/endian.h sys/sysmacros.h) AC_HEADER_DIRENT AC_HEADER_MAJOR diff --git a/pyconfig.h.in b/pyconfig.h.in index b10c57f85de..cdcb5704a85 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1057,6 +1057,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSCALL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYS_DOMAIN_H From webhook-mailer at python.org Tue Sep 5 11:12:06 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 15:12:06 -0000 Subject: [Python-checkins] [3.6] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3342) Message-ID: https://github.com/python/cpython/commit/2ddea0f098b42dfd74f53bcbf08c8e68c83e1049 commit: 2ddea0f098b42dfd74f53bcbf08c8e68c83e1049 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T17:12:03+02:00 summary: [3.6] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3342) The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0. The function detects CPU features and enables optimizations on some CPU architectures such as POWER8. Patch is based on research from Gustavo Serra Scalet. Signed-off-by: Christian Heimes (cherry picked from commit c941e62) files: A Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst M Modules/_hashopenssl.c M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst new file mode 100644 index 00000000000..13c07e39fdc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst @@ -0,0 +1,4 @@ +The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on +OpenSSL < 1.1.0. The function detects CPU features and enables optimizations +on some CPU architectures such as POWER8. Patch is based on research from +Gustavo Serra Scalet. diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 395c719f302..5a86376aa8b 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -1022,8 +1022,11 @@ PyInit__hashlib(void) { PyObject *m, *openssl_md_meth_names; - OpenSSL_add_all_digests(); +#ifndef OPENSSL_VERSION_1_1 + /* Load all digest algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); ERR_load_crypto_strings(); +#endif /* TODO build EVP_functions openssl_* entries dynamically based * on what hashes are supported rather than listing many diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 6b6f2b1135c..a21283af7a8 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5171,9 +5171,14 @@ PyInit__ssl(void) return NULL; PySocketModule = *socket_api; +#ifndef OPENSSL_VERSION_1_1 + /* Load all algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); /* Init OpenSSL */ SSL_load_error_strings(); SSL_library_init(); +#endif + #ifdef WITH_THREAD #ifdef HAVE_OPENSSL_CRYPTO_LOCK /* note that this will start threading if not already started */ @@ -5185,7 +5190,6 @@ PyInit__ssl(void) _ssl_locks_count++; #endif #endif /* WITH_THREAD */ - OpenSSL_add_all_algorithms(); /* Add symbols to module dict */ sslerror_type_slots[0].pfunc = PyExc_OSError; From webhook-mailer at python.org Tue Sep 5 11:12:15 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 15:12:15 -0000 Subject: [Python-checkins] [2.7] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3343) Message-ID: https://github.com/python/cpython/commit/7daa45db1d60eed4e5050bf792969893d9f2c8e0 commit: 7daa45db1d60eed4e5050bf792969893d9f2c8e0 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-05T17:12:12+02:00 summary: [2.7] bpo-30102: Call OPENSSL_add_all_algorithms_noconf (GH-3112) (#3343) The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on OpenSSL < 1.1.0. The function detects CPU features and enables optimizations on some CPU architectures such as POWER8. Patch is based on research from Gustavo Serra Scalet. Signed-off-by: Christian Heimes (cherry picked from commit c941e62) files: A Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst M Modules/_hashopenssl.c M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst new file mode 100644 index 00000000000..13c07e39fdc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst @@ -0,0 +1,4 @@ +The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on +OpenSSL < 1.1.0. The function detects CPU features and enables optimizations +on some CPU architectures such as POWER8. Patch is based on research from +Gustavo Serra Scalet. diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 75b3a3d3b6c..de69f6fcd03 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -899,8 +899,11 @@ init_hashlib(void) { PyObject *m, *openssl_md_meth_names; - OpenSSL_add_all_digests(); +#ifndef OPENSSL_VERSION_1_1 + /* Load all digest algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); ERR_load_crypto_strings(); +#endif /* TODO build EVP_functions openssl_* entries dynamically based * on what hashes are supported rather than listing many diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 832b5f96bff..2bc981f6091 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -4084,9 +4084,14 @@ init_ssl(void) if (PySocketModule_ImportModuleAndAPI()) return; +#ifndef OPENSSL_VERSION_1_1 + /* Load all algorithms and initialize cpuid */ + OPENSSL_add_all_algorithms_noconf(); /* Init OpenSSL */ SSL_load_error_strings(); SSL_library_init(); +#endif + #ifdef WITH_THREAD #ifdef HAVE_OPENSSL_CRYPTO_LOCK /* note that this will start threading if not already started */ @@ -4098,7 +4103,6 @@ init_ssl(void) _ssl_locks_count++; #endif #endif /* WITH_THREAD */ - OpenSSL_add_all_algorithms(); /* Add symbols to module dict */ PySSLErrorObject = PyErr_NewExceptionWithDoc( From webhook-mailer at python.org Tue Sep 5 12:34:57 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Tue, 05 Sep 2017 16:34:57 -0000 Subject: [Python-checkins] Don't use `where`, it doesn't exist on XP (GH-3330) Message-ID: https://github.com/python/cpython/commit/aa23144d153b9c30fbaf8ba8d2a4d6a668e79417 commit: aa23144d153b9c30fbaf8ba8d2a4d6a668e79417 branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-05T09:34:54-07:00 summary: Don't use `where`, it doesn't exist on XP (GH-3330) files: M PCbuild/get_externals.bat diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index e83e1d4c9ad..92fc9441727 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -32,8 +32,11 @@ if "%DO_FETCH%"=="false" goto end if "%ORG%"=="" (set ORG=python) call "%PCBUILD%find_python.bat" "%PYTHON%" -if "%PYTHON%"=="" ( - where /Q git || echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1 +git 2>&1 > nul +if ERRORLEVEL 9009 ( + if "%PYTHON%"=="" ( + echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1 + ) ) echo.Fetching external libraries... From webhook-mailer at python.org Tue Sep 5 12:40:47 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 05 Sep 2017 16:40:47 -0000 Subject: [Python-checkins] Conceptually, roots is a set. Also searching it as a set is a tiny bit faster (#3338) Message-ID: https://github.com/python/cpython/commit/15ce0bee973596f02983f39e1a1b172b91e9cdda commit: 15ce0bee973596f02983f39e1a1b172b91e9cdda branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-05T09:40:44-07:00 summary: Conceptually, roots is a set. Also searching it as a set is a tiny bit faster (#3338) files: M Lib/functools.py diff --git a/Lib/functools.py b/Lib/functools.py index 0873f207154..23ad1609300 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -193,7 +193,7 @@ def _lt_from_ge(self, other, NotImplemented=NotImplemented): def total_ordering(cls): """Class decorator that fills in missing ordering methods""" # Find user-defined comparisons (not those inherited from object). - roots = [op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)] + roots = {op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)} if not roots: raise ValueError('must define at least one ordering operation: < > <= >=') root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__ From webhook-mailer at python.org Tue Sep 5 13:13:07 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 17:13:07 -0000 Subject: [Python-checkins] [3.6] bpo-30502: Fix handling of long oids in ssl. (GH-2909) (#3321) Message-ID: https://github.com/python/cpython/commit/f201e886fc7aaeb50f5e945578c6aec2a59a5323 commit: f201e886fc7aaeb50f5e945578c6aec2a59a5323 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T19:13:03+02:00 summary: [3.6] bpo-30502: Fix handling of long oids in ssl. (GH-2909) (#3321) (cherry picked from commit e503ca52889bf66ac502702569e726caa7970299) files: A Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst new file mode 100644 index 00000000000..522bdf669e9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst @@ -0,0 +1 @@ +Fix handling of long oids in ssl. Based on patch by Christian Heimes. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index a21283af7a8..9429c8080d0 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -763,49 +763,64 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) } static PyObject * -_create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) { - - char namebuf[X509_NAME_MAXLEN]; +_asn1obj2py(const ASN1_OBJECT *name, int no_name) +{ + char buf[X509_NAME_MAXLEN]; + char *namebuf = buf; int buflen; - PyObject *name_obj; - PyObject *value_obj; - PyObject *attr; - unsigned char *valuebuf = NULL; + PyObject *name_obj = NULL; - buflen = OBJ_obj2txt(namebuf, sizeof(namebuf), name, 0); + buflen = OBJ_obj2txt(namebuf, X509_NAME_MAXLEN, name, no_name); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - goto fail; + return NULL; } - name_obj = PyUnicode_FromStringAndSize(namebuf, buflen); - if (name_obj == NULL) - goto fail; + /* initial buffer is too small for oid + terminating null byte */ + if (buflen > X509_NAME_MAXLEN - 1) { + /* make OBJ_obj2txt() calculate the required buflen */ + buflen = OBJ_obj2txt(NULL, 0, name, no_name); + /* allocate len + 1 for terminating NULL byte */ + namebuf = PyMem_Malloc(buflen + 1); + if (namebuf == NULL) { + PyErr_NoMemory(); + return NULL; + } + buflen = OBJ_obj2txt(namebuf, buflen + 1, name, no_name); + if (buflen < 0) { + _setSSLError(NULL, 0, __FILE__, __LINE__); + goto done; + } + } + if (!buflen && no_name) { + Py_INCREF(Py_None); + name_obj = Py_None; + } + else { + name_obj = PyUnicode_FromStringAndSize(namebuf, buflen); + } + + done: + if (buf != namebuf) { + PyMem_Free(namebuf); + } + return name_obj; +} + +static PyObject * +_create_tuple_for_attribute(ASN1_OBJECT *name, ASN1_STRING *value) +{ + Py_ssize_t buflen; + unsigned char *valuebuf = NULL; + PyObject *attr; buflen = ASN1_STRING_to_UTF8(&valuebuf, value); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - Py_DECREF(name_obj); - goto fail; + return NULL; } - value_obj = PyUnicode_DecodeUTF8((char *) valuebuf, - buflen, "strict"); + attr = Py_BuildValue("Ns#", _asn1obj2py(name, 0), valuebuf, buflen); OPENSSL_free(valuebuf); - if (value_obj == NULL) { - Py_DECREF(name_obj); - goto fail; - } - attr = PyTuple_New(2); - if (attr == NULL) { - Py_DECREF(name_obj); - Py_DECREF(value_obj); - goto fail; - } - PyTuple_SET_ITEM(attr, 0, name_obj); - PyTuple_SET_ITEM(attr, 1, value_obj); return attr; - - fail: - return NULL; } static PyObject * @@ -4669,8 +4684,6 @@ asn1obj2py(ASN1_OBJECT *obj) { int nid; const char *ln, *sn; - char buf[100]; - Py_ssize_t buflen; nid = OBJ_obj2nid(obj); if (nid == NID_undef) { @@ -4679,16 +4692,7 @@ asn1obj2py(ASN1_OBJECT *obj) } sn = OBJ_nid2sn(nid); ln = OBJ_nid2ln(nid); - buflen = OBJ_obj2txt(buf, sizeof(buf), obj, 1); - if (buflen < 0) { - _setSSLError(NULL, 0, __FILE__, __LINE__); - return NULL; - } - if (buflen) { - return Py_BuildValue("isss#", nid, sn, ln, buf, buflen); - } else { - return Py_BuildValue("issO", nid, sn, ln, Py_None); - } + return Py_BuildValue("issN", nid, sn, ln, _asn1obj2py(obj, 1)); } /*[clinic input] From webhook-mailer at python.org Tue Sep 5 13:13:10 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 17:13:10 -0000 Subject: [Python-checkins] [2.7] bpo-30502: Fix handling of long oids in ssl. (GH-2909). (#3322) Message-ID: https://github.com/python/cpython/commit/c9d668c0d8a6f3e8e72345e53d1dd34be172f16e commit: c9d668c0d8a6f3e8e72345e53d1dd34be172f16e branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-05T19:13:07+02:00 summary: [2.7] bpo-30502: Fix handling of long oids in ssl. (GH-2909). (#3322) (cherry picked from commit e503ca52889bf66ac502702569e726caa7970299) files: A Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst new file mode 100644 index 00000000000..522bdf669e9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst @@ -0,0 +1 @@ +Fix handling of long oids in ssl. Based on patch by Christian Heimes. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 2bc981f6091..761554a7827 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -676,49 +676,67 @@ static PyObject *PySSL_SSLdo_handshake(PySSLSocket *self) } static PyObject * -_create_tuple_for_attribute (ASN1_OBJECT *name, ASN1_STRING *value) { - - char namebuf[X509_NAME_MAXLEN]; +_asn1obj2py(const ASN1_OBJECT *name, int no_name) +{ + char buf[X509_NAME_MAXLEN]; + char *namebuf = buf; int buflen; - PyObject *name_obj; - PyObject *value_obj; - PyObject *attr; - unsigned char *valuebuf = NULL; + PyObject *name_obj = NULL; - buflen = OBJ_obj2txt(namebuf, sizeof(namebuf), name, 0); + buflen = OBJ_obj2txt(namebuf, X509_NAME_MAXLEN, name, no_name); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - goto fail; + return NULL; + } + /* initial buffer is too small for oid + terminating null byte */ + if (buflen > X509_NAME_MAXLEN - 1) { + /* make OBJ_obj2txt() calculate the required buflen */ + buflen = OBJ_obj2txt(NULL, 0, name, no_name); + /* allocate len + 1 for terminating NULL byte */ + namebuf = PyMem_Malloc(buflen + 1); + if (namebuf == NULL) { + PyErr_NoMemory(); + return NULL; + } + buflen = OBJ_obj2txt(namebuf, buflen + 1, name, no_name); + if (buflen < 0) { + _setSSLError(NULL, 0, __FILE__, __LINE__); + goto done; + } + } + if (!buflen && no_name) { + Py_INCREF(Py_None); + name_obj = Py_None; + } + else { + name_obj = PyString_FromStringAndSize(namebuf, buflen); } - name_obj = PyString_FromStringAndSize(namebuf, buflen); - if (name_obj == NULL) - goto fail; + + done: + if (buf != namebuf) { + PyMem_Free(namebuf); + } + return name_obj; +} + +static PyObject * +_create_tuple_for_attribute(ASN1_OBJECT *name, ASN1_STRING *value) +{ + Py_ssize_t buflen; + unsigned char *valuebuf = NULL; + PyObject *attr, *value_obj; buflen = ASN1_STRING_to_UTF8(&valuebuf, value); if (buflen < 0) { _setSSLError(NULL, 0, __FILE__, __LINE__); - Py_DECREF(name_obj); - goto fail; + return NULL; } value_obj = PyUnicode_DecodeUTF8((char *) valuebuf, buflen, "strict"); + + attr = Py_BuildValue("NN", _asn1obj2py(name, 0), value_obj); OPENSSL_free(valuebuf); - if (value_obj == NULL) { - Py_DECREF(name_obj); - goto fail; - } - attr = PyTuple_New(2); - if (attr == NULL) { - Py_DECREF(name_obj); - Py_DECREF(value_obj); - goto fail; - } - PyTuple_SET_ITEM(attr, 0, name_obj); - PyTuple_SET_ITEM(attr, 1, value_obj); return attr; - - fail: - return NULL; } static PyObject * @@ -3576,8 +3594,6 @@ asn1obj2py(ASN1_OBJECT *obj) { int nid; const char *ln, *sn; - char buf[100]; - Py_ssize_t buflen; nid = OBJ_obj2nid(obj); if (nid == NID_undef) { @@ -3586,16 +3602,7 @@ asn1obj2py(ASN1_OBJECT *obj) } sn = OBJ_nid2sn(nid); ln = OBJ_nid2ln(nid); - buflen = OBJ_obj2txt(buf, sizeof(buf), obj, 1); - if (buflen < 0) { - _setSSLError(NULL, 0, __FILE__, __LINE__); - return NULL; - } - if (buflen) { - return Py_BuildValue("isss#", nid, sn, ln, buf, buflen); - } else { - return Py_BuildValue("issO", nid, sn, ln, Py_None); - } + return Py_BuildValue("issN", nid, sn, ln, _asn1obj2py(obj, 1)); } PyDoc_STRVAR(PySSL_txt2obj_doc, From webhook-mailer at python.org Tue Sep 5 13:14:06 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 17:14:06 -0000 Subject: [Python-checkins] [2.7] Travis: use ccache (GH-3307) (#3333) Message-ID: https://github.com/python/cpython/commit/9721e51daf59e9a2f56dbf7c2428ea79c0b13be0 commit: 9721e51daf59e9a2f56dbf7c2428ea79c0b13be0 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-05T19:14:03+02:00 summary: [2.7] Travis: use ccache (GH-3307) (#3333) (cherry picked from commit 8adc73c) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index d73cb9e3189..571dd045e2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ dist: trusty sudo: false group: beta -# To cache doc-building dependencies. -cache: pip +# To cache doc-building dependencies and C compiler output. +cache: + - pip + - ccache branches: only: From webhook-mailer at python.org Tue Sep 5 13:38:07 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Tue, 05 Sep 2017 17:38:07 -0000 Subject: [Python-checkins] Link to blurb on PyPI in the NEWS.d READMEs. (#3323) Message-ID: https://github.com/python/cpython/commit/564a2c68add64ebf2e558a54f5697513b19293cb commit: 564a2c68add64ebf2e558a54f5697513b19293cb branch: master author: Gregory P. Smith committer: GitHub date: 2017-09-05T10:38:05-07:00 summary: Link to blurb on PyPI in the NEWS.d READMEs. (#3323) files: M Misc/NEWS.d/next/Build/README.rst M Misc/NEWS.d/next/C API/README.rst M Misc/NEWS.d/next/Core and Builtins/README.rst M Misc/NEWS.d/next/Documentation/README.rst M Misc/NEWS.d/next/IDLE/README.rst M Misc/NEWS.d/next/Library/README.rst M Misc/NEWS.d/next/Security/README.rst M Misc/NEWS.d/next/Tests/README.rst M Misc/NEWS.d/next/Tools-Demos/README.rst M Misc/NEWS.d/next/Windows/README.rst M Misc/NEWS.d/next/macOS/README.rst diff --git a/Misc/NEWS.d/next/Build/README.rst b/Misc/NEWS.d/next/Build/README.rst index 0d2d2c1fc38..d43e989e180 100644 --- a/Misc/NEWS.d/next/Build/README.rst +++ b/Misc/NEWS.d/next/Build/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Build* section in this directory. +Put news entry `blurb`_ files for the *Build* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/C API/README.rst b/Misc/NEWS.d/next/C API/README.rst index 5a04f76f47b..a4eb261579f 100644 --- a/Misc/NEWS.d/next/C API/README.rst +++ b/Misc/NEWS.d/next/C API/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *C API* section in this directory. +Put news entry `blurb`_ files for the *C API* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Core and Builtins/README.rst b/Misc/NEWS.d/next/Core and Builtins/README.rst index 52b8c3e6263..00831936c45 100644 --- a/Misc/NEWS.d/next/Core and Builtins/README.rst +++ b/Misc/NEWS.d/next/Core and Builtins/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Core and Builtins* section in this directory. +Put news entry `blurb`_ files for the *Core and Builtins* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Documentation/README.rst b/Misc/NEWS.d/next/Documentation/README.rst index 405f0ac01a7..245b7d63599 100644 --- a/Misc/NEWS.d/next/Documentation/README.rst +++ b/Misc/NEWS.d/next/Documentation/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Documentation* section in this directory. +Put news entry `blurb`_ files for the *Documentation* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/IDLE/README.rst b/Misc/NEWS.d/next/IDLE/README.rst index 5475f7b4205..834c5d48b95 100644 --- a/Misc/NEWS.d/next/IDLE/README.rst +++ b/Misc/NEWS.d/next/IDLE/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *IDLE* section in this directory. +Put news entry `blurb`_ files for the *IDLE* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Library/README.rst b/Misc/NEWS.d/next/Library/README.rst index 6d2d30eca0f..178ac664cc0 100644 --- a/Misc/NEWS.d/next/Library/README.rst +++ b/Misc/NEWS.d/next/Library/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Library* section in this directory. +Put news entry `blurb`_ files for the *Library* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Security/README.rst b/Misc/NEWS.d/next/Security/README.rst index 84c1a3a6ed7..9ea371df667 100644 --- a/Misc/NEWS.d/next/Security/README.rst +++ b/Misc/NEWS.d/next/Security/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Security* section in this directory. +Put news entry `blurb`_ files for the *Security* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Tests/README.rst b/Misc/NEWS.d/next/Tests/README.rst index d2e50e43d84..8ea9b4ceb27 100644 --- a/Misc/NEWS.d/next/Tests/README.rst +++ b/Misc/NEWS.d/next/Tests/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Tests* section in this directory. +Put news entry `blurb`_ files for the *Tests* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Tools-Demos/README.rst b/Misc/NEWS.d/next/Tools-Demos/README.rst index 357f82862cb..9f03d79b208 100644 --- a/Misc/NEWS.d/next/Tools-Demos/README.rst +++ b/Misc/NEWS.d/next/Tools-Demos/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Tools/Demos* section in this directory. +Put news entry `blurb`_ files for the *Tools/Demos* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/Windows/README.rst b/Misc/NEWS.d/next/Windows/README.rst index 1e65de35f0a..7dbc5805e3f 100644 --- a/Misc/NEWS.d/next/Windows/README.rst +++ b/Misc/NEWS.d/next/Windows/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *Windows* section in this directory. +Put news entry `blurb`_ files for the *Windows* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ diff --git a/Misc/NEWS.d/next/macOS/README.rst b/Misc/NEWS.d/next/macOS/README.rst index a3adb59b626..563766928cf 100644 --- a/Misc/NEWS.d/next/macOS/README.rst +++ b/Misc/NEWS.d/next/macOS/README.rst @@ -1 +1,3 @@ -Put news entry ``blurb`` files for the *macOS* section in this directory. +Put news entry `blurb`_ files for the *macOS* section in this directory. + +.. _blurb: https://pypi.org/project/blurb/ From webhook-mailer at python.org Tue Sep 5 14:20:05 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Tue, 05 Sep 2017 18:20:05 -0000 Subject: [Python-checkins] bpo-27448: Work around a gc.disable race condition in subprocess. (#1932) Message-ID: https://github.com/python/cpython/commit/5e8e371364ee58dadb9a4e4e51c7e9cf6bedbfae commit: 5e8e371364ee58dadb9a4e4e51c7e9cf6bedbfae branch: 2.7 author: Gregory P. Smith committer: GitHub date: 2017-09-05T11:20:02-07:00 summary: bpo-27448: Work around a gc.disable race condition in subprocess. (#1932) * bpo-27448: Work around a gc.disable race condition in subprocess. This works around a gc.isenabled/gc.disable race condition in the 2.7 subprocess module by using a lock for the critical section. It'll prevent multiple simultaneous subprocess launches from winding up with gc remaining disabled but it can't fix the ultimate problem: gc enable and disable is a global setting and a hack. Users are *strongly encouraged* to use subprocess32 from PyPI instead of the 2.7 standard library subprocess module. Mixing threads with subprocess is a recipie for disaster otherwise even with "fixes" to ameliorate common issues like this. * Add a blurb! files: A Misc/NEWS.d/next/Library/2017-09-05-10-55-50.bpo-27448.QdAqzZ.rst M Lib/subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 4b41f5ec5c7..1f2da0ffbe8 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -71,6 +71,10 @@ class pywintypes: else: import select _has_poll = hasattr(select, 'poll') + try: + import threading + except ImportError: + threading = None import fcntl import pickle @@ -878,6 +882,21 @@ def _close_fds(self, but): pass + # Used as a bandaid workaround for https://bugs.python.org/issue27448 + # to prevent multiple simultaneous subprocess launches from interfering + # with one another and leaving gc disabled. + if threading: + _disabling_gc_lock = threading.Lock() + else: + class _noop_context_manager(object): + # A dummy context manager that does nothing for the rare + # user of a --without-threads build. + def __enter__(self): pass + def __exit__(self, *args): pass + + _disabling_gc_lock = _noop_context_manager() + + def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, @@ -909,10 +928,12 @@ def _close_in_parent(fd): errpipe_read, errpipe_write = self.pipe_cloexec() try: try: - gc_was_enabled = gc.isenabled() - # Disable gc to avoid bug where gc -> file_dealloc -> - # write to stderr -> hang. http://bugs.python.org/issue1336 - gc.disable() + with self._disabling_gc_lock: + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. + # https://bugs.python.org/issue1336 + gc.disable() try: self.pid = os.fork() except: @@ -986,9 +1007,10 @@ def _dup2(a, b): exc_value.child_traceback = ''.join(exc_lines) os.write(errpipe_write, pickle.dumps(exc_value)) - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) + finally: + # This exitcode won't be reported to applications, so it + # really doesn't matter what we return. + os._exit(255) # Parent if gc_was_enabled: diff --git a/Misc/NEWS.d/next/Library/2017-09-05-10-55-50.bpo-27448.QdAqzZ.rst b/Misc/NEWS.d/next/Library/2017-09-05-10-55-50.bpo-27448.QdAqzZ.rst new file mode 100644 index 00000000000..9e269858d4b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-10-55-50.bpo-27448.QdAqzZ.rst @@ -0,0 +1,5 @@ +Work around a `gc.disable()` race condition in the `subprocess` module that +could leave garbage collection disabled when multiple threads are spawning +subprocesses at once. Users are *strongly encouraged* to use the +`subprocess32` module from PyPI on Python 2.7 instead, it is much more +reliable. From webhook-mailer at python.org Tue Sep 5 16:02:10 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Tue, 05 Sep 2017 20:02:10 -0000 Subject: [Python-checkins] bpo-30450: Don't use where, XP doesn't have it (GH-3348) Message-ID: https://github.com/python/cpython/commit/8905fb831cf7c400c479b79bb2f90bfbe9c71337 commit: 8905fb831cf7c400c479b79bb2f90bfbe9c71337 branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-05T13:02:03-07:00 summary: bpo-30450: Don't use where, XP doesn't have it (GH-3348) Really this time! files: M PCbuild/build.bat M PCbuild/find_msbuild.bat diff --git a/PCbuild/build.bat b/PCbuild/build.bat index e31056b2c00..13da4be4404 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -96,9 +96,8 @@ if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" ( ) ) -if not exist "%GIT%" where git > "%TEMP%\git.loc" 2> nul && set /P GIT= < "%TEMP%\git.loc" & del "%TEMP%\git.loc" +if "%GIT%" EQU "" set GIT=git if exist "%GIT%" set GITProperty=/p:GIT="%GIT%" -if not exist "%GIT%" echo Cannot find Git on PATH & set GITProperty= rem Setup the environment call "%dir%find_msbuild.bat" %MSBUILD% diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat index 2b7413fbcde..76bc9739550 100644 --- a/PCbuild/find_msbuild.bat +++ b/PCbuild/find_msbuild.bat @@ -26,8 +26,8 @@ @set MSBUILD= @rem If msbuild.exe is on the PATH, assume that the user wants that one. - at where msbuild > "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc" - at if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found + at msbuild /version > nul 2>&1 + at if NOT ERRORLEVEL 9009 set MSBUILD=msbuild & (set _Py_MSBuild_Source=PATH) & goto :found @rem VS 2015 and earlier register MSBuild separately, so we can find it. @rem Prefer MSBuild 14.0 over MSBuild 15.0, since the latter may not be able to find a VC14 install. From webhook-mailer at python.org Tue Sep 5 16:43:07 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 20:43:07 -0000 Subject: [Python-checkins] [3.6] bpo-29334: Fix ssl.getpeercert for auto-handshake (GH-1769) (#1778) Message-ID: https://github.com/python/cpython/commit/63b3f2b19cc96801c3b8619e4cf8aa9028e7a33c commit: 63b3f2b19cc96801c3b8619e4cf8aa9028e7a33c branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T13:43:05-07:00 summary: [3.6] bpo-29334: Fix ssl.getpeercert for auto-handshake (GH-1769) (#1778) Drop handshake_done and peer_cert members from PySSLSocket struct. The peer certificate can be acquired from *SSL directly. SSL_get_peer_certificate() does not trigger any network activity. Instead of manually tracking the handshake state, simply use SSL_is_init_finished(). In combination these changes fix auto-handshake for non-blocking MemoryBIO connections. Signed-off-by: Christian Heimes . (cherry picked from commit 66dc33b6822be93f85d84d24d3f9159ff568fbbb) files: M Modules/_ssl.c diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 9429c8080d0..b5eab0f1c4b 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -298,9 +298,7 @@ typedef struct { PyObject *Socket; /* weakref to socket on which we're layered */ SSL *ssl; PySSLContext *ctx; /* weakref to SSL context */ - X509 *peer_cert; char shutdown_seen_zero; - char handshake_done; enum py_ssl_server_or_client socket_type; PyObject *owner; /* Python level "owner" passed to servername callback */ PyObject *server_hostname; @@ -595,13 +593,11 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, if (self == NULL) return NULL; - self->peer_cert = NULL; self->ssl = NULL; self->Socket = NULL; self->ctx = sslctx; Py_INCREF(sslctx); self->shutdown_seen_zero = 0; - self->handshake_done = 0; self->owner = NULL; self->server_hostname = NULL; if (server_hostname != NULL) { @@ -747,15 +743,7 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) if (ret < 1) return PySSL_SetError(self, ret, __FILE__, __LINE__); - if (self->peer_cert) - X509_free (self->peer_cert); - PySSL_BEGIN_ALLOW_THREADS - self->peer_cert = SSL_get_peer_certificate(self->ssl); - PySSL_END_ALLOW_THREADS - self->handshake_done = 1; - - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; error: Py_XDECREF(sock); @@ -1521,25 +1509,30 @@ _ssl__SSLSocket_peer_certificate_impl(PySSLSocket *self, int binary_mode) /*[clinic end generated code: output=f0dc3e4d1d818a1d input=8281bd1d193db843]*/ { int verification; + X509 *peer_cert; + PyObject *result; - if (!self->handshake_done) { + if (!SSL_is_init_finished(self->ssl)) { PyErr_SetString(PyExc_ValueError, "handshake not done yet"); return NULL; } - if (!self->peer_cert) + peer_cert = SSL_get_peer_certificate(self->ssl); + if (peer_cert == NULL) Py_RETURN_NONE; if (binary_mode) { /* return cert in DER-encoded format */ - return _certificate_to_der(self->peer_cert); + result = _certificate_to_der(peer_cert); } else { verification = SSL_CTX_get_verify_mode(SSL_get_SSL_CTX(self->ssl)); if ((verification & SSL_VERIFY_PEER) == 0) - return PyDict_New(); + result = PyDict_New(); else - return _decode_certificate(self->peer_cert); + result = _decode_certificate(peer_cert); } + X509_free(peer_cert); + return result; } static PyObject * @@ -1860,8 +1853,6 @@ Passed as \"self\" in servername callback."); static void PySSL_dealloc(PySSLSocket *self) { - if (self->peer_cert) /* Possible not to have one? */ - X509_free (self->peer_cert); if (self->ssl) SSL_free(self->ssl); Py_XDECREF(self->Socket); @@ -2457,7 +2448,7 @@ static int PySSL_set_session(PySSLSocket *self, PyObject *value, "Cannot set session for server-side SSLSocket."); return -1; } - if (self->handshake_done) { + if (SSL_is_init_finished(self->ssl)) { PyErr_SetString(PyExc_ValueError, "Cannot set session after handshake."); return -1; From webhook-mailer at python.org Tue Sep 5 17:30:20 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 21:30:20 -0000 Subject: [Python-checkins] _pickle: Fix whichmodule() (#3358) Message-ID: https://github.com/python/cpython/commit/af46eb8d5f23c6f4e69a6a1f579fac8c2250b7c2 commit: af46eb8d5f23c6f4e69a6a1f579fac8c2250b7c2 branch: master author: Victor Stinner committer: Christian Heimes date: 2017-09-05T14:30:16-07:00 summary: _pickle: Fix whichmodule() (#3358) _PyUnicode_FromId() can return NULL: replace Py_INCREF() with Py_XINCREF(). Fix coverity report: CID 1417269. files: M Modules/_pickle.c diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 2a3e73988d4..25255368a10 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1705,7 +1705,7 @@ whichmodule(PyObject *global, PyObject *dotted_path) /* If no module is found, use __main__. */ module_name = _PyUnicode_FromId(&PyId___main__); - Py_INCREF(module_name); + Py_XINCREF(module_name); return module_name; } From webhook-mailer at python.org Tue Sep 5 19:07:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 Sep 2017 23:07:47 -0000 Subject: [Python-checkins] bpo-30445: Allow appended output in RecursionError message (#3356) Message-ID: https://github.com/python/cpython/commit/6fce7ea893dc3f69b607dd6ef48c2d3d0f6ca414 commit: 6fce7ea893dc3f69b607dd6ef48c2d3d0f6ca414 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-06T01:07:44+02:00 summary: bpo-30445: Allow appended output in RecursionError message (#3356) Running under coverage sometimes causes 'in comparison' to be added to the end of the RecursionError message, which is acceptable. Patched by Maria Mckinley (cherry picked from commit 3480ef9dd3177be8c0d71a74853dca6e5b11fbe1) files: M Lib/test/test_traceback.py diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 7276bc7ee79..e4833535890 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -344,7 +344,8 @@ def f(): # 2nd last line contains the repetition count self.assertEqual(actual[:-2], expected[:-2]) self.assertRegex(actual[-2], expected[-2]) - self.assertEqual(actual[-1], expected[-1]) + # last line can have additional text appended + self.assertIn(expected[-1], actual[-1]) # Check the recursion count is roughly as expected rec_limit = sys.getrecursionlimit() From webhook-mailer at python.org Tue Sep 5 19:23:51 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Tue, 05 Sep 2017 23:23:51 -0000 Subject: [Python-checkins] bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (#2179) Message-ID: https://github.com/python/cpython/commit/faa57cbe7074b26807cd7ed89a7b173b5cbf3086 commit: faa57cbe7074b26807cd7ed89a7b173b5cbf3086 branch: master author: Jonathan Eunice committer: Raymond Hettinger date: 2017-09-05T16:23:49-07:00 summary: bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (#2179) * fixed OrderedDict.__init__ docstring re PEP 468 * tightened comment and mirrored to C impl * added space after period per marco-buttu * preserved substituted for stable * drop references to Python 3.6 and PEP 468 files: M Lib/collections/__init__.py M Objects/odictobject.c diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 8408255d27e..70cb683088b 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -85,9 +85,7 @@ class OrderedDict(dict): def __init__(*args, **kwds): '''Initialize an ordered dictionary. The signature is the same as - regular dictionaries, but keyword arguments are not recommended because - their insertion order is arbitrary. - + regular dictionaries. Keyword argument order is preserved. ''' if not args: raise TypeError("descriptor '__init__' of 'OrderedDict' object " diff --git a/Objects/odictobject.c b/Objects/odictobject.c index c3d1a09584e..e1ee53beae6 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -882,8 +882,7 @@ odict_eq(PyObject *a, PyObject *b) PyDoc_STRVAR(odict_init__doc__, "Initialize an ordered dictionary. The signature is the same as\n\ - regular dictionaries, but keyword arguments are not recommended because\n\ - their insertion order is arbitrary.\n\ + regular dictionaries. Keyword argument order is preserved.\n\ \n\ "); From webhook-mailer at python.org Tue Sep 5 19:24:43 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Tue, 05 Sep 2017 23:24:43 -0000 Subject: [Python-checkins] link to legacy doc on the non-legacy website (#3362) Message-ID: https://github.com/python/cpython/commit/60dbed18509f99af8eaa685d9736f954b8d621fb commit: 60dbed18509f99af8eaa685d9736f954b8d621fb branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-05T16:24:39-07:00 summary: link to legacy doc on the non-legacy website (#3362) files: M Doc/library/importlib.rst M Doc/reference/import.rst diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 45a02e568e1..3a72648cbec 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -32,7 +32,7 @@ generically as an :term:`importer`) to participate in the import process. :ref:`import` The language reference for the :keyword:`import` statement. - `Packages specification `__ + `Packages specification `__ Original specification of packages. Some semantics have changed since the writing of this document (e.g. redirecting based on ``None`` in :data:`sys.modules`). diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index d504f373874..8cf16cad4c9 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -965,7 +965,7 @@ References The import machinery has evolved considerably since Python's early days. The original `specification for packages -`_ is still available to read, +`_ is still available to read, although some details have changed since the writing of that document. The original specification for :data:`sys.meta_path` was :pep:`302`, with From webhook-mailer at python.org Tue Sep 5 19:30:24 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 Sep 2017 23:30:24 -0000 Subject: [Python-checkins] bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) (#3350) Message-ID: https://github.com/python/cpython/commit/e5f2f8038540f9f06478f842f8f7313df4d2e59b commit: e5f2f8038540f9f06478f842f8f7313df4d2e59b branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-06T01:30:22+02:00 summary: bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) (#3350) * bpo-31170: Update libexpat from 2.2.3 to 2.2.4 Fix copying of partial characters for UTF-8 input (libexpat bug 115): https://github.com/libexpat/libexpat/issues/115 * Add NEWS entry. (cherry picked from commit 759e30ec47048cb9835c62aaeac48748c8151390) files: A Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst M Modules/expat/ascii.h M Modules/expat/asciitab.h M Modules/expat/expat.h M Modules/expat/expat_external.h M Modules/expat/iasciitab.h M Modules/expat/internal.h M Modules/expat/latin1tab.h M Modules/expat/loadlibrary.c M Modules/expat/nametab.h M Modules/expat/utf8tab.h M Modules/expat/winconfig.h M Modules/expat/xmlparse.c M Modules/expat/xmlrole.c M Modules/expat/xmlrole.h M Modules/expat/xmltok.c M Modules/expat/xmltok.h M Modules/expat/xmltok_impl.c M Modules/expat/xmltok_impl.h M Modules/expat/xmltok_ns.c diff --git a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst new file mode 100644 index 00000000000..2505007dac0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst @@ -0,0 +1,3 @@ +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 diff --git a/Modules/expat/ascii.h b/Modules/expat/ascii.h index d10530b09bd..c3587e57332 100644 --- a/Modules/expat/ascii.h +++ b/Modules/expat/ascii.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ASCII_A 0x41 diff --git a/Modules/expat/asciitab.h b/Modules/expat/asciitab.h index 79a15c28ca1..2f59fd92906 100644 --- a/Modules/expat/asciitab.h +++ b/Modules/expat/asciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index 7e5bbb7e393..d0735bb5c61 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_INCLUDED @@ -1048,7 +1076,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 3 +#define XML_MICRO_VERSION 4 #ifdef __cplusplus } diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index 4c9e5eabdee..81102856496 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_External_INCLUDED diff --git a/Modules/expat/iasciitab.h b/Modules/expat/iasciitab.h index 24a1d5ccc9a..ce4a4bf7ede 100644 --- a/Modules/expat/iasciitab.h +++ b/Modules/expat/iasciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index 94cb98e15ca..3c5d6e913d6 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -18,6 +18,35 @@ Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) diff --git a/Modules/expat/latin1tab.h b/Modules/expat/latin1tab.h index 53c25d76b26..95dfa52b1fb 100644 --- a/Modules/expat/latin1tab.h +++ b/Modules/expat/latin1tab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Modules/expat/loadlibrary.c b/Modules/expat/loadlibrary.c index ffce868399b..452ae92db26 100644 --- a/Modules/expat/loadlibrary.c +++ b/Modules/expat/loadlibrary.c @@ -6,8 +6,10 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2016 - 2017, Steve Holme, . + * Copyright (C) 2017, Expat development team * * All rights reserved. + * Licensed under the MIT license: * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/Modules/expat/nametab.h b/Modules/expat/nametab.h index b05e62c77a6..bfa2bd38cd9 100644 --- a/Modules/expat/nametab.h +++ b/Modules/expat/nametab.h @@ -1,3 +1,35 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + static const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/Modules/expat/utf8tab.h b/Modules/expat/utf8tab.h index 7bb3e77603f..fa0bed6f5d7 100644 --- a/Modules/expat/utf8tab.h +++ b/Modules/expat/utf8tab.h @@ -1,7 +1,34 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index 9bf014d7fba..17fea468900 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -1,10 +1,33 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef WINCONFIG_H diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index b703e61a040..0df68830f05 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,7 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - 101bfd65d1ff3d1511cf6671e6aae65f82cd97df6f4da137d46d510731830ad9 (2.2.3+) +/* 8c6b2be7c6281da65ce05218fc15c339f02a811706340824ab596aa86e1fd51a (2.2.4+) + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined(_GNU_SOURCE) @@ -80,9 +106,6 @@ If insist on not using any of these, bypass this error by defining \ XML_POOR_ENTROPY; you have been warned. \ \ - For CMake, one way to pass the define is: \ - cmake -DCMAKE_C_FLAGS="-pipe -O2 -DHAVE_SYSCALL_GETRANDOM" . \ - \ If you have reasons to patch this detection code away or need changes \ to the build system, please open a bug. Thank you! #endif diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c index c809ee51482..708507d575b 100644 --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/Modules/expat/xmlrole.h b/Modules/expat/xmlrole.h index 4dd9f06f976..e5f048eab55 100644 --- a/Modules/expat/xmlrole.h +++ b/Modules/expat/xmlrole.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlRole_INCLUDED diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index db4a5c8ca3e..007aed0640a 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1,8 +1,38 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include +#include // memcpy #ifdef _WIN32 #include "winconfig.h" @@ -363,22 +393,33 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - char *to; - const char *from; - const char *fromLimInitial = fromLim; + bool input_incomplete = false; + bool output_exhausted = false; + + /* Avoid copying partial characters (due to limited space). */ + const ptrdiff_t bytesAvailable = fromLim - *fromP; + const ptrdiff_t bytesStorable = toLim - *toP; + if (bytesAvailable > bytesStorable) { + fromLim = *fromP + bytesStorable; + output_exhausted = true; + } - /* Avoid copying partial characters. */ + /* Avoid copying partial characters (from incomplete input). */ + const char * const fromLimBefore = fromLim; align_limit_to_full_utf8_characters(*fromP, &fromLim); + if (fromLim < fromLimBefore) { + input_incomplete = true; + } - for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) - *to = *from; - *fromP = from; - *toP = to; + const ptrdiff_t bytesToCopy = fromLim - *fromP; + memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy); + *fromP += bytesToCopy; + *toP += bytesToCopy; - if (fromLim < fromLimInitial) - return XML_CONVERT_INPUT_INCOMPLETE; - else if ((to == toLim) && (from < fromLim)) + if (output_exhausted) // needs to go first return XML_CONVERT_OUTPUT_EXHAUSTED; + else if (input_incomplete) + return XML_CONVERT_INPUT_INCOMPLETE; else return XML_CONVERT_COMPLETED; } diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h index 752007e8b9e..6d31879b331 100644 --- a/Modules/expat/xmltok.h +++ b/Modules/expat/xmltok.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlTok_INCLUDED diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c index 4fa1ff679ce..93328b841a1 100644 --- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_IMPL_C #ifndef IS_INVALID_CHAR diff --git a/Modules/expat/xmltok_impl.h b/Modules/expat/xmltok_impl.h index da0ea60a657..a6420f48eed 100644 --- a/Modules/expat/xmltok_impl.h +++ b/Modules/expat/xmltok_impl.h @@ -1,6 +1,33 @@ /* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum { diff --git a/Modules/expat/xmltok_ns.c b/Modules/expat/xmltok_ns.c index c3b88fdf4e3..23d31e8e424 100644 --- a/Modules/expat/xmltok_ns.c +++ b/Modules/expat/xmltok_ns.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * From webhook-mailer at python.org Tue Sep 5 19:35:42 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 05 Sep 2017 23:35:42 -0000 Subject: [Python-checkins] bpo-31339: Rewrite time.asctime() and time.ctime() (#3293) Message-ID: https://github.com/python/cpython/commit/eeadf5fc231163ec97a8010754d9c995c7c14876 commit: eeadf5fc231163ec97a8010754d9c995c7c14876 branch: 2.7 author: Victor Stinner committer: GitHub date: 2017-09-06T01:35:39+02:00 summary: bpo-31339: Rewrite time.asctime() and time.ctime() (#3293) * bpo-31339: Rewrite time.asctime() and time.ctime() Backport and adapt the _asctime() function from the master branch to not depend on the implementation of asctime() and ctime() from the external C library. This change fixes a bug when Python is run using the musl C library. * bound checks for time.asctime() * bound checks for time.strftime() files: A Misc/NEWS.d/next/Security/2017-09-04-21-24-51.bpo-31339.YSczZN.rst M Lib/test/test_time.py M Modules/timemodule.c diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 4571c108d67..4da6703c56c 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -2,6 +2,12 @@ import time import unittest import sys +import sysconfig + + +# Max year is only limited by the size of C int. +SIZEOF_INT = sysconfig.get_config_var('SIZEOF_INT') or 4 +TIME_MAXYEAR = (1 << 8 * SIZEOF_INT - 1) - 1 class TimeTestCase(unittest.TestCase): @@ -45,6 +51,66 @@ def test_strftime(self): with self.assertRaises(ValueError): time.strftime('%f') + def _bounds_checking(self, func): + # Make sure that strftime() checks the bounds of the various parts + # of the time tuple (0 is valid for *all* values). + + # The year field is tested by other test cases above + + # Check month [1, 12] + zero support + func((1900, 0, 1, 0, 0, 0, 0, 1, -1)) + func((1900, 12, 1, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, -1, 1, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 13, 1, 0, 0, 0, 0, 1, -1)) + # Check day of month [1, 31] + zero support + func((1900, 1, 0, 0, 0, 0, 0, 1, -1)) + func((1900, 1, 31, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, -1, 0, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 32, 0, 0, 0, 0, 1, -1)) + # Check hour [0, 23] + func((1900, 1, 1, 23, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, -1, 0, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 24, 0, 0, 0, 1, -1)) + # Check minute [0, 59] + func((1900, 1, 1, 0, 59, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, -1, 0, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 60, 0, 0, 1, -1)) + # Check second [0, 61] + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 0, -1, 0, 1, -1)) + # C99 only requires allowing for one leap second, but Python's docs say + # allow two leap seconds (0..61) + func((1900, 1, 1, 0, 0, 60, 0, 1, -1)) + func((1900, 1, 1, 0, 0, 61, 0, 1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 0, 62, 0, 1, -1)) + # No check for upper-bound day of week; + # value forced into range by a ``% 7`` calculation. + # Start check at -2 since gettmarg() increments value before taking + # modulo. + self.assertEqual(func((1900, 1, 1, 0, 0, 0, -1, 1, -1)), + func((1900, 1, 1, 0, 0, 0, +6, 1, -1))) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 0, 0, -2, 1, -1)) + # Check day of the year [1, 366] + zero support + func((1900, 1, 1, 0, 0, 0, 0, 0, -1)) + func((1900, 1, 1, 0, 0, 0, 0, 366, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 0, 0, 0, -1, -1)) + self.assertRaises(ValueError, func, + (1900, 1, 1, 0, 0, 0, 0, 367, -1)) + + def test_strftime_bounding_check(self): + self._bounds_checking(lambda tup: time.strftime('', tup)) + def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). @@ -123,15 +189,15 @@ def test_asctime(self): time.asctime(time.gmtime(self.t)) self.assertRaises(TypeError, time.asctime, 0) self.assertRaises(TypeError, time.asctime, ()) - # XXX: Posix compiant asctime should refuse to convert - # year > 9999, but Linux implementation does not. - # self.assertRaises(ValueError, time.asctime, - # (12345, 1, 0, 0, 0, 0, 0, 0, 0)) - # XXX: For now, just make sure we don't have a crash: - try: - time.asctime((12345, 1, 1, 0, 0, 0, 0, 1, 0)) - except ValueError: - pass + + # Max year is only limited by the size of C int. + asc = time.asctime((TIME_MAXYEAR, 6, 1) + (0,) * 6) + self.assertEqual(asc[-len(str(TIME_MAXYEAR)):], str(TIME_MAXYEAR)) + self.assertRaises(OverflowError, time.asctime, + (TIME_MAXYEAR + 1,) + (0,) * 8) + self.assertRaises(TypeError, time.asctime, 0) + self.assertRaises(TypeError, time.asctime, ()) + self.assertRaises(TypeError, time.asctime, (0,) * 10) @unittest.skipIf(not hasattr(time, "tzset"), "time module has no attribute tzset") diff --git a/Misc/NEWS.d/next/Security/2017-09-04-21-24-51.bpo-31339.YSczZN.rst b/Misc/NEWS.d/next/Security/2017-09-04-21-24-51.bpo-31339.YSczZN.rst new file mode 100644 index 00000000000..a02a407b5d6 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2017-09-04-21-24-51.bpo-31339.YSczZN.rst @@ -0,0 +1,4 @@ +Rewrite time.asctime() and time.ctime(). Backport and adapt the _asctime() +function from the master branch to not depend on the implementation of +asctime() and ctime() from the external C library. This change fixes a bug +when Python is run using the musl C library. diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 12c43b08fe4..61b8d612a4a 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -388,6 +388,76 @@ gettmarg(PyObject *args, struct tm *p) return 1; } +/* Check values of the struct tm fields before it is passed to strftime() and + * asctime(). Return 1 if all values are valid, otherwise set an exception + * and returns 0. + */ +static int +checktm(struct tm* buf) +{ + /* Checks added to make sure strftime() and asctime() does not crash Python by + indexing blindly into some array for a textual representation + by some bad index (fixes bug #897625 and #6608). + + Also support values of zero from Python code for arguments in which + that is out of range by forcing that value to the lowest value that + is valid (fixed bug #1520914). + + Valid ranges based on what is allowed in struct tm: + + - tm_year: [0, max(int)] (1) + - tm_mon: [0, 11] (2) + - tm_mday: [1, 31] + - tm_hour: [0, 23] + - tm_min: [0, 59] + - tm_sec: [0, 60] + - tm_wday: [0, 6] (1) + - tm_yday: [0, 365] (2) + - tm_isdst: [-max(int), max(int)] + + (1) gettmarg() handles bounds-checking. + (2) Python's acceptable range is one greater than the range in C, + thus need to check against automatic decrement by gettmarg(). + */ + if (buf->tm_mon == -1) + buf->tm_mon = 0; + else if (buf->tm_mon < 0 || buf->tm_mon > 11) { + PyErr_SetString(PyExc_ValueError, "month out of range"); + return 0; + } + if (buf->tm_mday == 0) + buf->tm_mday = 1; + else if (buf->tm_mday < 0 || buf->tm_mday > 31) { + PyErr_SetString(PyExc_ValueError, "day of month out of range"); + return 0; + } + if (buf->tm_hour < 0 || buf->tm_hour > 23) { + PyErr_SetString(PyExc_ValueError, "hour out of range"); + return 0; + } + if (buf->tm_min < 0 || buf->tm_min > 59) { + PyErr_SetString(PyExc_ValueError, "minute out of range"); + return 0; + } + if (buf->tm_sec < 0 || buf->tm_sec > 61) { + PyErr_SetString(PyExc_ValueError, "seconds out of range"); + return 0; + } + /* tm_wday does not need checking of its upper-bound since taking + ``% 7`` in gettmarg() automatically restricts the range. */ + if (buf->tm_wday < 0) { + PyErr_SetString(PyExc_ValueError, "day of week out of range"); + return 0; + } + if (buf->tm_yday == -1) + buf->tm_yday = 0; + else if (buf->tm_yday < 0 || buf->tm_yday > 365) { + PyErr_SetString(PyExc_ValueError, "day of year out of range"); + return 0; + } + return 1; +} + #ifdef HAVE_STRFTIME static PyObject * time_strftime(PyObject *self, PyObject *args) @@ -407,8 +477,10 @@ time_strftime(PyObject *self, PyObject *args) if (tup == NULL) { time_t tt = time(NULL); buf = *localtime(&tt); - } else if (!gettmarg(tup, &buf)) + } else if (!gettmarg(tup, &buf) + || !checktm(&buf)) { return NULL; + } /* Checks added to make sure strftime() does not crash Python by indexing blindly into some array for a textual representation @@ -559,26 +631,50 @@ See the library reference manual for formatting codes (same as strftime())."); static PyObject * +_asctime(struct tm *timeptr) +{ + /* Inspired by Open Group reference implementation available at + * http://pubs.opengroup.org/onlinepubs/009695399/functions/asctime.html */ + static const char wday_name[7][4] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char mon_name[12][4] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + PyObject *unicode, *str; + /* PyString_FromString() cannot be used because it doesn't support %3d */ + unicode = PyUnicode_FromFormat( + "%s %s%3d %.2d:%.2d:%.2d %d", + wday_name[timeptr->tm_wday], + mon_name[timeptr->tm_mon], + timeptr->tm_mday, timeptr->tm_hour, + timeptr->tm_min, timeptr->tm_sec, + 1900 + timeptr->tm_year); + if (unicode == NULL) { + return NULL; + } + + str = PyUnicode_AsASCIIString(unicode); + Py_DECREF(unicode); + return str; +} + +static PyObject * time_asctime(PyObject *self, PyObject *args) { PyObject *tup = NULL; struct tm buf; - char *p; if (!PyArg_UnpackTuple(args, "asctime", 0, 1, &tup)) return NULL; if (tup == NULL) { time_t tt = time(NULL); buf = *localtime(&tt); - } else if (!gettmarg(tup, &buf)) - return NULL; - p = asctime(&buf); - if (p == NULL) { - PyErr_SetString(PyExc_ValueError, "invalid time"); + } else if (!gettmarg(tup, &buf) + || !checktm(&buf)) { return NULL; } - if (p[24] == '\n') - p[24] = '\0'; - return PyString_FromString(p); + return _asctime(&buf); } PyDoc_STRVAR(asctime_doc, @@ -593,7 +689,7 @@ time_ctime(PyObject *self, PyObject *args) { PyObject *ot = NULL; time_t tt; - char *p; + struct tm *buf; if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) return NULL; @@ -607,14 +703,16 @@ time_ctime(PyObject *self, PyObject *args) if (tt == (time_t)-1 && PyErr_Occurred()) return NULL; } - p = ctime(&tt); - if (p == NULL) { - PyErr_SetString(PyExc_ValueError, "unconvertible time"); - return NULL; + buf = localtime(&tt); + if (buf == NULL) { +#ifdef EINVAL + if (errno == 0) { + errno = EINVAL; + } +#endif + return PyErr_SetFromErrno(PyExc_ValueError); } - if (p[24] == '\n') - p[24] = '\0'; - return PyString_FromString(p); + return _asctime(buf); } PyDoc_STRVAR(ctime_doc, From webhook-mailer at python.org Tue Sep 5 19:37:13 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Tue, 05 Sep 2017 23:37:13 -0000 Subject: [Python-checkins] bpo-31320: No traceback to sys.stderr in test_ssl (#3360) Message-ID: https://github.com/python/cpython/commit/305e56c27afce605e5d2f71903a966cf0bb95038 commit: 305e56c27afce605e5d2f71903a966cf0bb95038 branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T16:37:09-07:00 summary: bpo-31320: No traceback to sys.stderr in test_ssl (#3360) In case PROTOCOL_TLS_SERVER is used for both client context and server context, the test thread dies with OSError. Catch OSError to avoid traceback on sys.stderr Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 5916a2bcf16..a8ffef0944f 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1853,11 +1853,14 @@ def wrap_conn(self): self.sock, server_side=True) self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol()) self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol()) - except (ssl.SSLError, ConnectionResetError) as e: + except (ssl.SSLError, ConnectionResetError, OSError) as e: # We treat ConnectionResetError as though it were an # SSLError - OpenSSL on Ubuntu abruptly closes the # connection when asked to use an unsupported protocol. # + # OSError may occur with wrong protocols, e.g. both + # sides use PROTOCOL_TLS_SERVER. + # # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. diff --git a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst new file mode 100644 index 00000000000..8b7163dfe79 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst @@ -0,0 +1 @@ +Silence traceback in test_ssl From webhook-mailer at python.org Tue Sep 5 20:10:11 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 Sep 2017 00:10:11 -0000 Subject: [Python-checkins] bpo-30442: Skips refcount test in test_xml_etree under coverage (#1767) (#3363) Message-ID: https://github.com/python/cpython/commit/9a3b3852afe61f9083d336c4394984d0e92799a3 commit: 9a3b3852afe61f9083d336c4394984d0e92799a3 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-06T02:10:08+02:00 summary: bpo-30442: Skips refcount test in test_xml_etree under coverage (#1767) (#3363) (cherry picked from commit 1de4705d00168afa8c5b6741af02e21fc609af58) files: M Lib/test/test_xml_etree.py diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index dbdad23a742..15af1fc5336 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1523,6 +1523,7 @@ def test_bug_xmltoolkit62(self): self.assertEqual(t.find('.//paragraph').text, 'A new cultivar of Begonia plant named \u2018BCT9801BEG\u2019.') + @unittest.skipIf(sys.gettrace(), "Skips under coverage.") def test_bug_xmltoolkit63(self): # Check reference leak. def xmltoolkit63(): From webhook-mailer at python.org Tue Sep 5 20:37:02 2017 From: webhook-mailer at python.org (Yury Selivanov) Date: Wed, 06 Sep 2017 00:37:02 -0000 Subject: [Python-checkins] bpo-31350: Optimize get_event_loop and _get_running_loop (#3347) Message-ID: https://github.com/python/cpython/commit/80bbe6a7b67f33d0d0976bb8e3e5ba26b6b0e626 commit: 80bbe6a7b67f33d0d0976bb8e3e5ba26b6b0e626 branch: master author: jimmylai committer: Yury Selivanov date: 2017-09-05T20:36:59-04:00 summary: bpo-31350: Optimize get_event_loop and _get_running_loop (#3347) * call remove_done_callback in finally section * Optimize get_event_loop and _get_running_loop * rename _loop_pid as loop_pid and add blurb news * rename _loop_pid as loop_pid and add blurb news * add back _RunningLoop * Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst * Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst files: A Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst M Lib/asyncio/events.py diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 6af91374ecf..03af6994e94 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -606,8 +606,7 @@ def new_event_loop(self): # A TLS for the running event loop, used by _get_running_loop. class _RunningLoop(threading.local): - _loop = None - _pid = None + loop_pid = (None, None) _running_loop = _RunningLoop() @@ -619,8 +618,8 @@ def _get_running_loop(): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - running_loop = _running_loop._loop - if running_loop is not None and _running_loop._pid == os.getpid(): + running_loop, pid = _running_loop.loop_pid + if running_loop is not None and pid == os.getpid(): return running_loop @@ -630,8 +629,7 @@ def _set_running_loop(loop): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - _running_loop._pid = os.getpid() - _running_loop._loop = loop + _running_loop.loop_pid = (loop, os.getpid()) def _init_event_loop_policy(): diff --git a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst new file mode 100644 index 00000000000..299cf3c9d54 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst @@ -0,0 +1 @@ +Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. From webhook-mailer at python.org Tue Sep 5 20:45:14 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 06 Sep 2017 00:45:14 -0000 Subject: [Python-checkins] [3.6] link to legacy doc on the non-legacy website (GH-3362) (#3368) Message-ID: https://github.com/python/cpython/commit/1b1329debc2ca0311af9a5e9a11709a000029bb7 commit: 1b1329debc2ca0311af9a5e9a11709a000029bb7 branch: 3.6 author: Benjamin Peterson committer: GitHub date: 2017-09-05T17:45:11-07:00 summary: [3.6] link to legacy doc on the non-legacy website (GH-3362) (#3368) (cherry picked from commit 60dbed18509f99af8eaa685d9736f954b8d621fb) files: M Doc/library/importlib.rst M Doc/reference/import.rst diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 1fd56983d0a..6406e306c49 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -32,7 +32,7 @@ generically as an :term:`importer`) to participate in the import process. :ref:`import` The language reference for the :keyword:`import` statement. - `Packages specification `__ + `Packages specification `__ Original specification of packages. Some semantics have changed since the writing of this document (e.g. redirecting based on ``None`` in :data:`sys.modules`). diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index d504f373874..8cf16cad4c9 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -965,7 +965,7 @@ References The import machinery has evolved considerably since Python's early days. The original `specification for packages -`_ is still available to read, +`_ is still available to read, although some details have changed since the writing of that document. The original specification for :data:`sys.meta_path` was :pep:`302`, with From webhook-mailer at python.org Tue Sep 5 20:57:17 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 06 Sep 2017 00:57:17 -0000 Subject: [Python-checkins] bpo-31355: Travis CI: remove the macOS job (#3367) Message-ID: https://github.com/python/cpython/commit/501b324d3a940d26e0021a38aae8d896a30fbcff commit: 501b324d3a940d26e0021a38aae8d896a30fbcff branch: master author: Victor Stinner committer: GitHub date: 2017-09-06T02:57:14+02:00 summary: bpo-31355: Travis CI: remove the macOS job (#3367) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index c4ae89cc2f5..148c0eb3f96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,15 +25,6 @@ matrix: # compiler here and the other to run the coverage build. Clang is preferred # in this instance for its better error messages. env: TESTING=cpython - - os: osx - language: c - compiler: clang - # Testing under macOS is optional until testing stability has been demonstrated. - env: OPTIONAL=true - before_install: - - brew install openssl xz - - export CPPFLAGS="-I$(brew --prefix openssl)/include" - - export LDFLAGS="-L$(brew --prefix openssl)/lib" - os: linux language: python # Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs. From webhook-mailer at python.org Tue Sep 5 21:01:36 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Wed, 06 Sep 2017 01:01:36 -0000 Subject: [Python-checkins] [3.6] Cache externals, depending on changes to PCbuild (GH-3308) (#3366) Message-ID: https://github.com/python/cpython/commit/56b56e3da006279b9b09d73db2f13ab3d88ee996 commit: 56b56e3da006279b9b09d73db2f13ab3d88ee996 branch: 3.6 author: Zachary Ware committer: GitHub date: 2017-09-05T18:01:33-07:00 summary: [3.6] Cache externals, depending on changes to PCbuild (GH-3308) (#3366) (cherry picked from commit f801322e92384ef3eac2a9b7ac2c49d37102d0f3) files: M .github/appveyor.yml diff --git a/.github/appveyor.yml b/.github/appveyor.yml index aa6c3ab88cc..0936469370e 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -5,6 +5,8 @@ branches: - master - /\d\.\d/ - buildbot-custom +cache: + - externals -> PCbuild\* build_script: - cmd: PCbuild\build.bat -e - cmd: PCbuild\win32\python.exe -m test.pythoninfo From webhook-mailer at python.org Tue Sep 5 21:01:51 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Wed, 06 Sep 2017 01:01:51 -0000 Subject: [Python-checkins] [2.7] Cache externals, depending on changes to PCbuild (GH-3308) (#3365) Message-ID: https://github.com/python/cpython/commit/fef3ddbbcc408be8a5e5df645b301964e726bf7c commit: fef3ddbbcc408be8a5e5df645b301964e726bf7c branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-05T18:01:49-07:00 summary: [2.7] Cache externals, depending on changes to PCbuild (GH-3308) (#3365) (cherry picked from commit f801322e92384ef3eac2a9b7ac2c49d37102d0f3) files: M .github/appveyor.yml diff --git a/.github/appveyor.yml b/.github/appveyor.yml index b809ad680b1..2cd9a42feb8 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -5,6 +5,8 @@ branches: - master - /\d\.\d/ - buildbot-custom +cache: + - externals -> PCbuild\* build_script: - cmd: PCbuild\build.bat -e - cmd: PCbuild\python.exe -m test.pythoninfo From webhook-mailer at python.org Tue Sep 5 21:07:08 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 06 Sep 2017 01:07:08 -0000 Subject: [Python-checkins] bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) Message-ID: https://github.com/python/cpython/commit/c00d5087cd308cc8be41e0afd8df27726185347f commit: c00d5087cd308cc8be41e0afd8df27726185347f branch: 2.7 author: Victor Stinner committer: Benjamin Peterson date: 2017-09-05T18:04:39-07:00 summary: bpo-31170: Update libexpat from 2.2.3 to 2.2.4 (#3315) Fix copying of partial characters for UTF-8 input (libexpat bug 115): https://github.com/libexpat/libexpat/issues/115 (cherry picked from commit 759e30ec47048cb9835c62aaeac48748c8151390) The standard header stdbool.h is not available with old Visual Studio compilers Cherry-picked from libexpat b4b89c2ab0cc5325a41360c25ef9d2ccbe617e5c. expat: Add artificial scopes in xmltok.c utf8_toUtf8() to fix c89 compilation. Cherry-picked from libexpat commit e0b290eb3d8f4c4b45137a7d7f4f8db812145bd2 files: A Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst M Modules/expat/ascii.h M Modules/expat/asciitab.h M Modules/expat/expat.h M Modules/expat/expat_external.h M Modules/expat/iasciitab.h M Modules/expat/internal.h M Modules/expat/latin1tab.h M Modules/expat/loadlibrary.c M Modules/expat/nametab.h M Modules/expat/utf8tab.h M Modules/expat/winconfig.h M Modules/expat/xmlparse.c M Modules/expat/xmlrole.c M Modules/expat/xmlrole.h M Modules/expat/xmltok.c M Modules/expat/xmltok.h M Modules/expat/xmltok_impl.c M Modules/expat/xmltok_impl.h M Modules/expat/xmltok_ns.c diff --git a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst new file mode 100644 index 00000000000..2505007dac0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst @@ -0,0 +1,3 @@ +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 diff --git a/Modules/expat/ascii.h b/Modules/expat/ascii.h index d10530b09bd..c3587e57332 100644 --- a/Modules/expat/ascii.h +++ b/Modules/expat/ascii.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ASCII_A 0x41 diff --git a/Modules/expat/asciitab.h b/Modules/expat/asciitab.h index 79a15c28ca1..2f59fd92906 100644 --- a/Modules/expat/asciitab.h +++ b/Modules/expat/asciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index 7e5bbb7e393..d0735bb5c61 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_INCLUDED @@ -1048,7 +1076,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 3 +#define XML_MICRO_VERSION 4 #ifdef __cplusplus } diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index 4c9e5eabdee..81102856496 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_External_INCLUDED diff --git a/Modules/expat/iasciitab.h b/Modules/expat/iasciitab.h index 24a1d5ccc9a..ce4a4bf7ede 100644 --- a/Modules/expat/iasciitab.h +++ b/Modules/expat/iasciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index 94cb98e15ca..3c5d6e913d6 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -18,6 +18,35 @@ Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) diff --git a/Modules/expat/latin1tab.h b/Modules/expat/latin1tab.h index 53c25d76b26..95dfa52b1fb 100644 --- a/Modules/expat/latin1tab.h +++ b/Modules/expat/latin1tab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Modules/expat/loadlibrary.c b/Modules/expat/loadlibrary.c index ffce868399b..452ae92db26 100644 --- a/Modules/expat/loadlibrary.c +++ b/Modules/expat/loadlibrary.c @@ -6,8 +6,10 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2016 - 2017, Steve Holme, . + * Copyright (C) 2017, Expat development team * * All rights reserved. + * Licensed under the MIT license: * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/Modules/expat/nametab.h b/Modules/expat/nametab.h index b05e62c77a6..bfa2bd38cd9 100644 --- a/Modules/expat/nametab.h +++ b/Modules/expat/nametab.h @@ -1,3 +1,35 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + static const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/Modules/expat/utf8tab.h b/Modules/expat/utf8tab.h index 7bb3e77603f..fa0bed6f5d7 100644 --- a/Modules/expat/utf8tab.h +++ b/Modules/expat/utf8tab.h @@ -1,7 +1,34 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index 9bf014d7fba..17fea468900 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -1,10 +1,33 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef WINCONFIG_H diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index b703e61a040..0df68830f05 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,7 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - 101bfd65d1ff3d1511cf6671e6aae65f82cd97df6f4da137d46d510731830ad9 (2.2.3+) +/* 8c6b2be7c6281da65ce05218fc15c339f02a811706340824ab596aa86e1fd51a (2.2.4+) + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined(_GNU_SOURCE) @@ -80,9 +106,6 @@ If insist on not using any of these, bypass this error by defining \ XML_POOR_ENTROPY; you have been warned. \ \ - For CMake, one way to pass the define is: \ - cmake -DCMAKE_C_FLAGS="-pipe -O2 -DHAVE_SYSCALL_GETRANDOM" . \ - \ If you have reasons to patch this detection code away or need changes \ to the build system, please open a bug. Thank you! #endif diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c index c809ee51482..708507d575b 100644 --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/Modules/expat/xmlrole.h b/Modules/expat/xmlrole.h index 4dd9f06f976..e5f048eab55 100644 --- a/Modules/expat/xmlrole.h +++ b/Modules/expat/xmlrole.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlRole_INCLUDED diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index db4a5c8ca3e..482df75b204 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1,8 +1,47 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include // memcpy + +#if defined(_MSC_VER) && (_MSC_VER <= 1700) + /* for vs2012/11.0/1700 and earlier Visual Studio compilers */ +# define bool int +# define false 0 +# define true 1 +#else +# include +#endif + #ifdef _WIN32 #include "winconfig.h" @@ -363,22 +402,37 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - char *to; - const char *from; - const char *fromLimInitial = fromLim; + bool input_incomplete = false; + bool output_exhausted = false; + + /* Avoid copying partial characters (due to limited space). */ + const ptrdiff_t bytesAvailable = fromLim - *fromP; + const ptrdiff_t bytesStorable = toLim - *toP; + if (bytesAvailable > bytesStorable) { + fromLim = *fromP + bytesStorable; + output_exhausted = true; + } - /* Avoid copying partial characters. */ - align_limit_to_full_utf8_characters(*fromP, &fromLim); + /* Avoid copying partial characters (from incomplete input). */ + { + const char * const fromLimBefore = fromLim; + align_limit_to_full_utf8_characters(*fromP, &fromLim); + if (fromLim < fromLimBefore) { + input_incomplete = true; + } + } - for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) - *to = *from; - *fromP = from; - *toP = to; + { + const ptrdiff_t bytesToCopy = fromLim - *fromP; + memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy); + *fromP += bytesToCopy; + *toP += bytesToCopy; + } - if (fromLim < fromLimInitial) - return XML_CONVERT_INPUT_INCOMPLETE; - else if ((to == toLim) && (from < fromLim)) + if (output_exhausted) // needs to go first return XML_CONVERT_OUTPUT_EXHAUSTED; + else if (input_incomplete) + return XML_CONVERT_INPUT_INCOMPLETE; else return XML_CONVERT_COMPLETED; } diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h index 752007e8b9e..6d31879b331 100644 --- a/Modules/expat/xmltok.h +++ b/Modules/expat/xmltok.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlTok_INCLUDED diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c index 4fa1ff679ce..93328b841a1 100644 --- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_IMPL_C #ifndef IS_INVALID_CHAR diff --git a/Modules/expat/xmltok_impl.h b/Modules/expat/xmltok_impl.h index da0ea60a657..a6420f48eed 100644 --- a/Modules/expat/xmltok_impl.h +++ b/Modules/expat/xmltok_impl.h @@ -1,6 +1,33 @@ /* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum { diff --git a/Modules/expat/xmltok_ns.c b/Modules/expat/xmltok_ns.c index c3b88fdf4e3..23d31e8e424 100644 --- a/Modules/expat/xmltok_ns.c +++ b/Modules/expat/xmltok_ns.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * From lp_benchmark_robot at intel.com Tue Sep 5 21:06:31 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 5 Sep 2017 18:06:31 -0700 Subject: [Python-checkins] [1 down, 1 up, 63 flat] Results for Python (master branch) 2017-09-05 Message-ID: Results for project python/master, build date: 2017-09-05 08:37:17-07:00. - commit: 75b9618 - previous commit: 122e88a - revision date: 2017-09-05 15:53:09+02:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.178% | -0.357% | +2.801% | +8.864% | +-----+------------------------+--------+------------+------------+------------+ | :-( | call_method| 0.649% | -2.856% | +20.880% | +13.951% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.843% | -2.405% | +21.778% | +13.001% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 1.126% | +0.451% | +21.908% | +8.144% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 1.787% | -1.501% | +0.961% | +16.255% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.986% | -1.431% | +11.192% | +9.215% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.792% | +1.886% | +8.102% | +9.751% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.738% | +1.187% | +4.177% | +3.816% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 2.684% | +3.491% | +9.243% | +16.660% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 8.458% | -2.258% | +2.568% | +18.665% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.349% | -2.169% | +2.050% | +8.919% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.182% | +1.448% | +7.149% | +3.357% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 3.458% | -0.724% | +2.831% | +5.887% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.425% | +0.822% | +8.556% | +12.105% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.478% | +0.431% | +6.171% | +10.837% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.724% | +0.358% | +6.637% | +10.630% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.786% | -0.704% | +8.682% | +11.578% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.530% | +0.739% | +5.714% | +11.846% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 2.265% | -3.388% | +2.142% | +9.689% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.633% | -0.603% | +0.438% | +10.817% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.649% | +0.057% | +5.618% | +13.304% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.426% | +0.543% | +46.903% | +10.773% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.792% | +1.105% | +6.830% | +13.126% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.467% | -0.127% | +18.764% | +10.235% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 5.537% | -0.074% | +6.187% | +11.511% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.106% | -0.244% | +4.008% | +5.606% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.522% | +3.031% | -2.070% | +4.009% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.984% | -1.482% | +1.540% | +8.093% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 2.132% | -4.131% | -0.566% | +12.983% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 2.386% | +0.097% | -0.187% | +22.434% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_dict| 0.777% | +2.132% | +4.675% | +19.000% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.645% | -2.782% | +3.922% | +20.769% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 5.180% | -2.725% | +9.760% | +10.661% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.379% | -0.134% | +0.264% | +9.885% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.181% | +0.519% | +9.026% | +4.650% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.123% | +0.714% | +1.323% | +4.768% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.085% | +1.151% | +9.547% | +12.804% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.646% | -0.561% | -8.401% | +11.139% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 1.210% | -0.066% | +2.047% | +8.326% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 1.880% | +16.068% | -1.923% | +6.192% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.433% | -2.641% | +9.393% | +5.149% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.550% | +0.159% | +7.656% | +15.190% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.518% | +1.774% | +2.503% | +1.489% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 4.111% | -2.377% | +24.738% | +11.384% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.229% | +3.344% | +5.944% | +4.014% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.911% | +1.099% | +15.347% | +8.291% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 1.215% | +1.201% | +2.049% | +0.142% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.437% | +2.482% | +7.647% | -0.248% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.992% | -0.629% | +3.827% | +9.748% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.908% | -0.587% | +4.549% | +6.714% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.521% | +2.568% | +3.624% | +6.140% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 1.953% | +0.206% | +12.052% | +8.924% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 2.172% | -0.541% | +9.090% | +8.026% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.969% | -0.343% | +11.286% | +10.317% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.179% | -1.065% | +11.260% | +12.654% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.994% | +0.745% | +23.800% | +7.967% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.017% | +0.279% | +5.753% | +4.975% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.622% | +0.118% | +2.886% | -1.293% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 6.148% | -1.043% | +8.922% | +18.879% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.571% | +1.815% | -0.504% | +17.644% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 1.798% | +1.165% | +6.958% | +5.622% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.855% | -0.298% | +6.050% | +7.278% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.443% | +0.385% | +2.926% | +5.117% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.104% | +0.134% | -4.624% | +10.459% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.512% | -1.122% | +6.542% | +7.742% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-1-up-63-flat-results-for-python-master-branch-2017-09-05 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Tue Sep 5 21:11:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 06 Sep 2017 01:11:34 -0000 Subject: [Python-checkins] [3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369) Message-ID: https://github.com/python/cpython/commit/c506403faf8dbfc8baf4212e8e2aedb7268acb5e commit: c506403faf8dbfc8baf4212e8e2aedb7268acb5e branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-05T18:11:31-07:00 summary: [3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369) In case PROTOCOL_TLS_SERVER is used for both client context and server context, the test thread dies with OSError. Catch OSError to avoid traceback on sys.stderr Signed-off-by: Christian Heimes (cherry picked from commit 305e56c27afce605e5d2f71903a966cf0bb95038) files: A Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 4c060ea1c1e..29d4b4083da 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1843,11 +1843,14 @@ def wrap_conn(self): self.sock, server_side=True) self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol()) self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol()) - except (ssl.SSLError, ConnectionResetError) as e: + except (ssl.SSLError, ConnectionResetError, OSError) as e: # We treat ConnectionResetError as though it were an # SSLError - OpenSSL on Ubuntu abruptly closes the # connection when asked to use an unsupported protocol. # + # OSError may occur with wrong protocols, e.g. both + # sides use PROTOCOL_TLS_SERVER. + # # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. diff --git a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst new file mode 100644 index 00000000000..8b7163dfe79 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst @@ -0,0 +1 @@ +Silence traceback in test_ssl From webhook-mailer at python.org Tue Sep 5 21:13:09 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 06 Sep 2017 01:13:09 -0000 Subject: [Python-checkins] [3.6] bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (GH-2179) (GH-3370) Message-ID: https://github.com/python/cpython/commit/3b9d4444fe631117430dee8ef8a2f205b4b450d5 commit: 3b9d4444fe631117430dee8ef8a2f205b4b450d5 branch: 3.6 author: Mariatta committer: GitHub date: 2017-09-05T18:13:07-07:00 summary: [3.6] bpo-30662: fixed OrderedDict.__init__ docstring re PEP 468 (GH-2179) (GH-3370) * fixed OrderedDict.__init__ docstring re PEP 468 * tightened comment and mirrored to C impl * added space after period per marco-buttu * preserved substituted for stable * drop references to Python 3.6 and PEP 468 (cherry picked from commit faa57cbe7074b26807cd7ed89a7b173b5cbf3086) files: M Lib/collections/__init__.py M Objects/odictobject.c diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 85b4c3c19ac..1d6822a3a0b 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -85,9 +85,7 @@ class OrderedDict(dict): def __init__(*args, **kwds): '''Initialize an ordered dictionary. The signature is the same as - regular dictionaries, but keyword arguments are not recommended because - their insertion order is arbitrary. - + regular dictionaries. Keyword argument order is preserved. ''' if not args: raise TypeError("descriptor '__init__' of 'OrderedDict' object " diff --git a/Objects/odictobject.c b/Objects/odictobject.c index f9f1bf362e7..9e891152aff 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -875,8 +875,7 @@ odict_eq(PyObject *a, PyObject *b) PyDoc_STRVAR(odict_init__doc__, "Initialize an ordered dictionary. The signature is the same as\n\ - regular dictionaries, but keyword arguments are not recommended because\n\ - their insertion order is arbitrary.\n\ + regular dictionaries. Keyword argument order is preserved.\n\ \n\ "); From webhook-mailer at python.org Tue Sep 5 21:18:19 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 06 Sep 2017 01:18:19 -0000 Subject: [Python-checkins] [2.7] Issue GH-28705: greatly simplify the FAQ entry on transpiling. (#3371) Message-ID: https://github.com/python/cpython/commit/6d6ff08d38bec7e3f844079c681bafad16e1d6e1 commit: 6d6ff08d38bec7e3f844079c681bafad16e1d6e1 branch: 2.7 author: Benjamin Peterson committer: GitHub date: 2017-09-05T18:18:16-07:00 summary: [2.7] Issue GH-28705: greatly simplify the FAQ entry on transpiling. (#3371) This also eliminats a dead link to Weave in the process.. (cherry picked from commit 78ffd6cffacb04bea61bb0ef850d05859ab2dbe4) files: M Doc/faq/design.rst diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 0a8cfdd25d1..15e4af57fee 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -391,50 +391,11 @@ is exactly the same type of object that a lambda expression yields) is assigned! Can Python be compiled to machine code, C or some other language? ----------------------------------------------------------------- -Not easily. Python's high level data types, dynamic typing of objects and -run-time invocation of the interpreter (using :func:`eval` or :keyword:`exec`) -together mean that a "compiled" Python program would probably consist mostly of -calls into the Python run-time system, even for seemingly simple operations like -``x+1``. - -Several projects described in the Python newsgroup or at past `Python -conferences `_ have shown that this -approach is feasible, although the speedups reached so far are only modest -(e.g. 2x). Jython uses the same strategy for compiling to Java bytecode. (Jim -Hugunin has demonstrated that in combination with whole-program analysis, -speedups of 1000x are feasible for small demo programs. See the proceedings -from the `1997 Python conference -`_ for more information.) - -Internally, Python source code is always translated into a bytecode -representation, and this bytecode is then executed by the Python virtual -machine. In order to avoid the overhead of repeatedly parsing and translating -modules that rarely change, this byte code is written into a file whose name -ends in ".pyc" whenever a module is parsed. When the corresponding .py file is -changed, it is parsed and translated again and the .pyc file is rewritten. - -There is no performance difference once the .pyc file has been loaded, as the -bytecode read from the .pyc file is exactly the same as the bytecode created by -direct translation. The only difference is that loading code from a .pyc file -is faster than parsing and translating a .py file, so the presence of -precompiled .pyc files improves the start-up time of Python scripts. If -desired, the Lib/compileall.py module can be used to create valid .pyc files for -a given set of modules. - -Note that the main script executed by Python, even if its filename ends in .py, -is not compiled to a .pyc file. It is compiled to bytecode, but the bytecode is -not saved to a file. Usually main scripts are quite short, so this doesn't cost -much speed. - -.. XXX check which of these projects are still alive - -There are also several programs which make it easier to intermingle Python and C -code in various ways to increase performance. See, for example, `Cython `_ , `Psyco -`_, `Pyrex -`_, `PyInline -`_, `Py2Cmod -`_, and -`Weave `_. +`Cython `_ compiles a modified version of Python with +optional annotations into C extensions. `Nuitka `_ is +an up-and-coming compiler of Python into C++ code, aiming to support the full +Python language. For compiling to Java you can consider +`VOC `_. How does Python manage memory? From webhook-mailer at python.org Tue Sep 5 21:26:19 2017 From: webhook-mailer at python.org (Eric Snow) Date: Wed, 06 Sep 2017 01:26:19 -0000 Subject: [Python-checkins] bpo-30860: Consolidate stateful runtime globals. (#2594) Message-ID: https://github.com/python/cpython/commit/76d5abc8684bac4f2fc7cccfe2cd940923357351 commit: 76d5abc8684bac4f2fc7cccfe2cd940923357351 branch: master author: Eric Snow committer: GitHub date: 2017-09-05T18:26:16-07:00 summary: bpo-30860: Consolidate stateful runtime globals. (#2594) * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py). files: A Include/internal/_Python.h A Include/internal/_ceval.h A Include/internal/_condvar.h A Include/internal/_gil.h A Include/internal/_mem.h A Include/internal/_pymalloc.h A Include/internal/_pystate.h A Include/internal/_warnings.h A Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst A Tools/c-globals/README A Tools/c-globals/check-c-globals.py A Tools/c-globals/ignored-globals.txt M Include/Python.h M Include/ceval.h M Include/object.h M Include/pylifecycle.h M Include/pystate.h M Makefile.pre.in M Modules/_io/bufferedio.c M Modules/_threadmodule.c M Modules/_winapi.c M Modules/gcmodule.c M Modules/main.c M Objects/object.c M Objects/obmalloc.c M Objects/setobject.c M Objects/typeobject.c M PCbuild/pythoncore.vcxproj M PCbuild/pythoncore.vcxproj.filters M Parser/pgenmain.c M Python/_warnings.c M Python/ceval.c M Python/ceval_gil.h M Python/condvar.h M Python/pylifecycle.c M Python/pystate.c M Python/sysmodule.c M Python/thread.c M Python/thread_nt.h M Python/thread_pthread.h diff --git a/Include/Python.h b/Include/Python.h index 061d693f34b..3ab9fe914ec 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -133,4 +133,8 @@ #include "fileutils.h" #include "pyfpe.h" +#ifdef Py_BUILD_CORE +#include "internal/_Python.h" +#endif + #endif /* !Py_PYTHON_H */ diff --git a/Include/ceval.h b/Include/ceval.h index b2d57cbd6f7..7cbbf7c5287 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -93,7 +93,12 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void); PyThreadState_GET()->overflowed = 0; \ } while(0) PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); -PyAPI_DATA(int) _Py_CheckRecursionLimit; +#ifdef Py_BUILD_CORE +#define _Py_CheckRecursionLimit _PyRuntime.ceval.check_recursion_limit +#else +PyAPI_FUNC(int) _PyEval_CheckRecursionLimit(void); +#define _Py_CheckRecursionLimit _PyEval_CheckRecursionLimit() +#endif #ifdef USE_STACKCHECK /* With USE_STACKCHECK, we artificially decrement the recursion limit in order diff --git a/Include/internal/_Python.h b/Include/internal/_Python.h new file mode 100644 index 00000000000..c56e98f740b --- /dev/null +++ b/Include/internal/_Python.h @@ -0,0 +1,16 @@ +#ifndef _Py_PYTHON_H +#define _Py_PYTHON_H +/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ + +/* Include all internal Python header files */ + +#ifndef Py_BUILD_CORE +#error "Internal headers are not available externally." +#endif + +#include "_mem.h" +#include "_ceval.h" +#include "_warnings.h" +#include "_pystate.h" + +#endif /* !_Py_PYTHON_H */ diff --git a/Include/internal/_ceval.h b/Include/internal/_ceval.h new file mode 100644 index 00000000000..c2343f11323 --- /dev/null +++ b/Include/internal/_ceval.h @@ -0,0 +1,71 @@ +#ifndef _Py_CEVAL_H +#define _Py_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "ceval.h" +#include "compile.h" +#include "pyatomic.h" + +#ifdef WITH_THREAD +#include "pythread.h" +#endif + +struct _pending_calls { + unsigned long main_thread; +#ifdef WITH_THREAD + PyThread_type_lock lock; + /* Request for running pending calls. */ + _Py_atomic_int calls_to_do; + /* Request for looking at the `async_exc` field of the current + thread state. + Guarded by the GIL. */ + int async_exc; +#define NPENDINGCALLS 32 + struct { + int (*func)(void *); + void *arg; + } calls[NPENDINGCALLS]; + int first; + int last; +#else /* ! WITH_THREAD */ + _Py_atomic_int calls_to_do; +#define NPENDINGCALLS 32 + struct { + int (*func)(void *); + void *arg; + } calls[NPENDINGCALLS]; + volatile int first; + volatile int last; +#endif /* WITH_THREAD */ +}; + +#include "_gil.h" + +struct _ceval_runtime_state { + int recursion_limit; + int check_recursion_limit; + /* Records whether tracing is on for any thread. Counts the number + of threads for which tstate->c_tracefunc is non-NULL, so if the + value is 0, we know we don't have to check this thread's + c_tracefunc. This speeds up the if statement in + PyEval_EvalFrameEx() after fast_next_opcode. */ + int tracing_possible; + /* This single variable consolidates all requests to break out of + the fast path in the eval loop. */ + _Py_atomic_int eval_breaker; +#ifdef WITH_THREAD + /* Request for dropping the GIL */ + _Py_atomic_int gil_drop_request; +#endif + struct _pending_calls pending; + struct _gil_runtime_state gil; +}; + +PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); + +#ifdef __cplusplus +} +#endif +#endif /* !_Py_CEVAL_H */ diff --git a/Include/internal/_condvar.h b/Include/internal/_condvar.h new file mode 100644 index 00000000000..6827db7e0b4 --- /dev/null +++ b/Include/internal/_condvar.h @@ -0,0 +1,91 @@ +#ifndef _CONDVAR_H_ +#define _CONDVAR_H_ + +#ifndef _POSIX_THREADS +/* This means pthreads are not implemented in libc headers, hence the macro + not present in unistd.h. But they still can be implemented as an external + library (e.g. gnu pth in pthread emulation) */ +# ifdef HAVE_PTHREAD_H +# include /* _POSIX_THREADS */ +# endif +#endif + +#ifdef _POSIX_THREADS +/* + * POSIX support + */ +#define Py_HAVE_CONDVAR + +#include + +#define PyMUTEX_T pthread_mutex_t +#define PyCOND_T pthread_cond_t + +#elif defined(NT_THREADS) +/* + * Windows (XP, 2003 server and later, as well as (hopefully) CE) support + * + * Emulated condition variables ones that work with XP and later, plus + * example native support on VISTA and onwards. + */ +#define Py_HAVE_CONDVAR + +/* include windows if it hasn't been done before */ +#define WIN32_LEAN_AND_MEAN +#include + +/* options */ +/* non-emulated condition variables are provided for those that want + * to target Windows Vista. Modify this macro to enable them. + */ +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ +#endif + +/* fall back to emulation if not targeting Vista */ +#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif + +#if _PY_EMULATED_WIN_CV + +typedef CRITICAL_SECTION PyMUTEX_T; + +/* The ConditionVariable object. From XP onwards it is easily emulated + with a Semaphore. + Semaphores are available on Windows XP (2003 server) and later. + We use a Semaphore rather than an auto-reset event, because although + an auto-resent event might appear to solve the lost-wakeup bug (race + condition between releasing the outer lock and waiting) because it + maintains state even though a wait hasn't happened, there is still + a lost wakeup problem if more than one thread are interrupted in the + critical place. A semaphore solves that, because its state is + counted, not Boolean. + Because it is ok to signal a condition variable with no one + waiting, we need to keep track of the number of + waiting threads. Otherwise, the semaphore's state could rise + without bound. This also helps reduce the number of "spurious wakeups" + that would otherwise happen. + */ + +typedef struct _PyCOND_T +{ + HANDLE sem; + int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ +} PyCOND_T; + +#else /* !_PY_EMULATED_WIN_CV */ + +/* Use native Win7 primitives if build target is Win7 or higher */ + +/* SRWLOCK is faster and better than CriticalSection */ +typedef SRWLOCK PyMUTEX_T; + +typedef CONDITION_VARIABLE PyCOND_T; + +#endif /* _PY_EMULATED_WIN_CV */ + +#endif /* _POSIX_THREADS, NT_THREADS */ + +#endif /* _CONDVAR_H_ */ diff --git a/Include/internal/_gil.h b/Include/internal/_gil.h new file mode 100644 index 00000000000..42301bf3fca --- /dev/null +++ b/Include/internal/_gil.h @@ -0,0 +1,48 @@ +#ifndef _Py_GIL_H +#define _Py_GIL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pyatomic.h" + +#include "internal/_condvar.h" +#ifndef Py_HAVE_CONDVAR +#error You need either a POSIX-compatible or a Windows system! +#endif + +/* Enable if you want to force the switching of threads at least + every `interval`. */ +#undef FORCE_SWITCHING +#define FORCE_SWITCHING + +struct _gil_runtime_state { + /* microseconds (the Python API uses seconds, though) */ + unsigned long interval; + /* Last PyThreadState holding / having held the GIL. This helps us + know whether anyone else was scheduled after we dropped the GIL. */ + _Py_atomic_address last_holder; + /* Whether the GIL is already taken (-1 if uninitialized). This is + atomic because it can be read without any lock taken in ceval.c. */ + _Py_atomic_int locked; + /* Number of GIL switches since the beginning. */ + unsigned long switch_number; +#ifdef WITH_THREAD + /* This condition variable allows one or several threads to wait + until the GIL is released. In addition, the mutex also protects + the above variables. */ + PyCOND_T cond; + PyMUTEX_T mutex; +#ifdef FORCE_SWITCHING + /* This condition variable helps the GIL-releasing thread wait for + a GIL-awaiting thread to be scheduled and take the GIL. */ + PyCOND_T switch_cond; + PyMUTEX_T switch_mutex; +#endif +#endif /* WITH_THREAD */ +}; + +#ifdef __cplusplus +} +#endif +#endif /* !_Py_GIL_H */ diff --git a/Include/internal/_mem.h b/Include/internal/_mem.h new file mode 100644 index 00000000000..2932377148e --- /dev/null +++ b/Include/internal/_mem.h @@ -0,0 +1,197 @@ +#ifndef _Py_MEM_H +#define _Py_MEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "objimpl.h" +#include "pymem.h" + +#ifdef WITH_PYMALLOC +#include "_pymalloc.h" +#endif + +/* Low-level memory runtime state */ + +struct _pymem_runtime_state { + struct _allocator_runtime_state { + PyMemAllocatorEx mem; + PyMemAllocatorEx obj; + PyMemAllocatorEx raw; + } allocators; +#ifdef WITH_PYMALLOC + /* Array of objects used to track chunks of memory (arenas). */ + struct arena_object* arenas; + /* The head of the singly-linked, NULL-terminated list of available + arena_objects. */ + struct arena_object* unused_arena_objects; + /* The head of the doubly-linked, NULL-terminated at each end, + list of arena_objects associated with arenas that have pools + available. */ + struct arena_object* usable_arenas; + /* Number of slots currently allocated in the `arenas` vector. */ + unsigned int maxarenas; + /* Number of arenas allocated that haven't been free()'d. */ + size_t narenas_currently_allocated; + /* High water mark (max value ever seen) for + * narenas_currently_allocated. */ + size_t narenas_highwater; + /* Total number of times malloc() called to allocate an arena. */ + size_t ntimes_arena_allocated; + poolp usedpools[MAX_POOLS]; + Py_ssize_t num_allocated_blocks; + size_t serialno; /* incremented on each debug {m,re}alloc */ +#endif /* WITH_PYMALLOC */ +}; + +PyAPI_FUNC(void) _PyMem_Initialize(struct _pymem_runtime_state *); + + +/* High-level memory runtime state */ + +struct _pyobj_runtime_state { + PyObjectArenaAllocator allocator_arenas; +}; + +PyAPI_FUNC(void) _PyObject_Initialize(struct _pyobj_runtime_state *); + + +/* GC runtime state */ + +/* If we change this, we need to change the default value in the + signature of gc.collect. */ +#define NUM_GENERATIONS 3 + +/* + NOTE: about the counting of long-lived objects. + + To limit the cost of garbage collection, there are two strategies; + - make each collection faster, e.g. by scanning fewer objects + - do less collections + This heuristic is about the latter strategy. + + In addition to the various configurable thresholds, we only trigger a + full collection if the ratio + long_lived_pending / long_lived_total + is above a given value (hardwired to 25%). + + The reason is that, while "non-full" collections (i.e., collections of + the young and middle generations) will always examine roughly the same + number of objects -- determined by the aforementioned thresholds --, + the cost of a full collection is proportional to the total number of + long-lived objects, which is virtually unbounded. + + Indeed, it has been remarked that doing a full collection every + of object creations entails a dramatic performance + degradation in workloads which consist in creating and storing lots of + long-lived objects (e.g. building a large list of GC-tracked objects would + show quadratic performance, instead of linear as expected: see issue #4074). + + Using the above ratio, instead, yields amortized linear performance in + the total number of objects (the effect of which can be summarized + thusly: "each full garbage collection is more and more costly as the + number of objects grows, but we do fewer and fewer of them"). + + This heuristic was suggested by Martin von L?wis on python-dev in + June 2008. His original analysis and proposal can be found at: + http://mail.python.org/pipermail/python-dev/2008-June/080579.html +*/ + +/* + NOTE: about untracking of mutable objects. + + Certain types of container cannot participate in a reference cycle, and + so do not need to be tracked by the garbage collector. Untracking these + objects reduces the cost of garbage collections. However, determining + which objects may be untracked is not free, and the costs must be + weighed against the benefits for garbage collection. + + There are two possible strategies for when to untrack a container: + + i) When the container is created. + ii) When the container is examined by the garbage collector. + + Tuples containing only immutable objects (integers, strings etc, and + recursively, tuples of immutable objects) do not need to be tracked. + The interpreter creates a large number of tuples, many of which will + not survive until garbage collection. It is therefore not worthwhile + to untrack eligible tuples at creation time. + + Instead, all tuples except the empty tuple are tracked when created. + During garbage collection it is determined whether any surviving tuples + can be untracked. A tuple can be untracked if all of its contents are + already not tracked. Tuples are examined for untracking in all garbage + collection cycles. It may take more than one cycle to untrack a tuple. + + Dictionaries containing only immutable objects also do not need to be + tracked. Dictionaries are untracked when created. If a tracked item is + inserted into a dictionary (either as a key or value), the dictionary + becomes tracked. During a full garbage collection (all generations), + the collector will untrack any dictionaries whose contents are not + tracked. + + The module provides the python function is_tracked(obj), which returns + the CURRENT tracking status of the object. Subsequent garbage + collections may change the tracking status of the object. + + Untracking of certain containers was introduced in issue #4688, and + the algorithm was refined in response to issue #14775. +*/ + +struct gc_generation { + PyGC_Head head; + int threshold; /* collection threshold */ + int count; /* count of allocations or collections of younger + generations */ +}; + +/* Running stats per generation */ +struct gc_generation_stats { + /* total number of collections */ + Py_ssize_t collections; + /* total number of collected objects */ + Py_ssize_t collected; + /* total number of uncollectable objects (put into gc.garbage) */ + Py_ssize_t uncollectable; +}; + +struct _gc_runtime_state { + /* List of objects that still need to be cleaned up, singly linked + * via their gc headers' gc_prev pointers. */ + PyObject *trash_delete_later; + /* Current call-stack depth of tp_dealloc calls. */ + int trash_delete_nesting; + + int enabled; + int debug; + /* linked lists of container objects */ + struct gc_generation generations[NUM_GENERATIONS]; + PyGC_Head *generation0; + struct gc_generation_stats generation_stats[NUM_GENERATIONS]; + /* true if we are currently running the collector */ + int collecting; + /* list of uncollectable objects */ + PyObject *garbage; + /* a list of callbacks to be invoked when collection is performed */ + PyObject *callbacks; + /* This is the number of objects that survived the last full + collection. It approximates the number of long lived objects + tracked by the GC. + + (by "full collection", we mean a collection of the oldest + generation). */ + Py_ssize_t long_lived_total; + /* This is the number of objects that survived all "non-full" + collections, and are awaiting to undergo a full collection for + the first time. */ + Py_ssize_t long_lived_pending; +}; + +PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *); + +#define _PyGC_generation0 _PyRuntime.gc.generation0 + +#ifdef __cplusplus +} +#endif +#endif /* !_Py_MEM_H */ diff --git a/Include/internal/_pymalloc.h b/Include/internal/_pymalloc.h new file mode 100644 index 00000000000..764edf94ffd --- /dev/null +++ b/Include/internal/_pymalloc.h @@ -0,0 +1,443 @@ + +/* An object allocator for Python. + + Here is an introduction to the layers of the Python memory architecture, + showing where the object allocator is actually used (layer +2), It is + called for every object allocation and deallocation (PyObject_New/Del), + unless the object-specific allocators implement a proprietary allocation + scheme (ex.: ints use a simple free list). This is also the place where + the cyclic garbage collector operates selectively on container objects. + + + Object-specific allocators + _____ ______ ______ ________ + [ int ] [ dict ] [ list ] ... [ string ] Python core | ++3 | <----- Object-specific memory -----> | <-- Non-object memory --> | + _______________________________ | | + [ Python's object allocator ] | | ++2 | ####### Object memory ####### | <------ Internal buffers ------> | + ______________________________________________________________ | + [ Python's raw memory allocator (PyMem_ API) ] | ++1 | <----- Python memory (under PyMem manager's control) ------> | | + __________________________________________________________________ + [ Underlying general-purpose allocator (ex: C library malloc) ] + 0 | <------ Virtual memory allocated for the python process -------> | + + ========================================================================= + _______________________________________________________________________ + [ OS-specific Virtual Memory Manager (VMM) ] +-1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | + __________________________________ __________________________________ + [ ] [ ] +-2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | + +*/ +/*==========================================================================*/ + +/* A fast, special-purpose memory allocator for small blocks, to be used + on top of a general-purpose malloc -- heavily based on previous art. */ + +/* Vladimir Marangozov -- August 2000 */ + +/* + * "Memory management is where the rubber meets the road -- if we do the wrong + * thing at any level, the results will not be good. And if we don't make the + * levels work well together, we are in serious trouble." (1) + * + * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, + * "Dynamic Storage Allocation: A Survey and Critical Review", + * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. + */ + +#ifndef _Py_PYMALLOC_H +#define _Py_PYMALLOC_H + +/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ + +/*==========================================================================*/ + +/* + * Allocation strategy abstract: + * + * For small requests, the allocator sub-allocates blocks of memory. + * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the + * system's allocator. + * + * Small requests are grouped in size classes spaced 8 bytes apart, due + * to the required valid alignment of the returned address. Requests of + * a particular size are serviced from memory pools of 4K (one VMM page). + * Pools are fragmented on demand and contain free lists of blocks of one + * particular size class. In other words, there is a fixed-size allocator + * for each size class. Free pools are shared by the different allocators + * thus minimizing the space reserved for a particular size class. + * + * This allocation strategy is a variant of what is known as "simple + * segregated storage based on array of free lists". The main drawback of + * simple segregated storage is that we might end up with lot of reserved + * memory for the different free lists, which degenerate in time. To avoid + * this, we partition each free list in pools and we share dynamically the + * reserved space between all free lists. This technique is quite efficient + * for memory intensive programs which allocate mainly small-sized blocks. + * + * For small requests we have the following table: + * + * Request in bytes Size of allocated block Size class idx + * ---------------------------------------------------------------- + * 1-8 8 0 + * 9-16 16 1 + * 17-24 24 2 + * 25-32 32 3 + * 33-40 40 4 + * 41-48 48 5 + * 49-56 56 6 + * 57-64 64 7 + * 65-72 72 8 + * ... ... ... + * 497-504 504 62 + * 505-512 512 63 + * + * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying + * allocator. + */ + +/*==========================================================================*/ + +/* + * -- Main tunable settings section -- + */ + +/* + * Alignment of addresses returned to the user. 8-bytes alignment works + * on most current architectures (with 32-bit or 64-bit address busses). + * The alignment value is also used for grouping small requests in size + * classes spaced ALIGNMENT bytes apart. + * + * You shouldn't change this unless you know what you are doing. + */ +#define ALIGNMENT 8 /* must be 2^N */ +#define ALIGNMENT_SHIFT 3 + +/* Return the number of bytes in size class I, as a uint. */ +#define INDEX2SIZE(I) (((unsigned int)(I) + 1) << ALIGNMENT_SHIFT) + +/* + * Max size threshold below which malloc requests are considered to be + * small enough in order to use preallocated memory pools. You can tune + * this value according to your application behaviour and memory needs. + * + * Note: a size threshold of 512 guarantees that newly created dictionaries + * will be allocated from preallocated memory pools on 64-bit. + * + * The following invariants must hold: + * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 + * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT + * + * Although not required, for better performance and space efficiency, + * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. + */ +#define SMALL_REQUEST_THRESHOLD 512 +#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) + +#if NB_SMALL_SIZE_CLASSES > 64 +#error "NB_SMALL_SIZE_CLASSES should be less than 64" +#endif /* NB_SMALL_SIZE_CLASSES > 64 */ + +/* + * The system's VMM page size can be obtained on most unices with a + * getpagesize() call or deduced from various header files. To make + * things simpler, we assume that it is 4K, which is OK for most systems. + * It is probably better if this is the native page size, but it doesn't + * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page + * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation + * violation fault. 4K is apparently OK for all the platforms that python + * currently targets. + */ +#define SYSTEM_PAGE_SIZE (4 * 1024) +#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) + +/* + * Maximum amount of memory managed by the allocator for small requests. + */ +#ifdef WITH_MEMORY_LIMITS +#ifndef SMALL_MEMORY_LIMIT +#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ +#endif +#endif + +/* + * The allocator sub-allocates blocks of memory (called arenas) aligned + * on a page boundary. This is a reserved virtual address space for the + * current process (obtained through a malloc()/mmap() call). In no way this + * means that the memory arenas will be used entirely. A malloc() is + * usually an address range reservation for bytes, unless all pages within + * this space are referenced subsequently. So malloc'ing big blocks and not + * using them does not mean "wasting memory". It's an addressable range + * wastage... + * + * Arenas are allocated with mmap() on systems supporting anonymous memory + * mappings to reduce heap fragmentation. + */ +#define ARENA_SIZE (256 << 10) /* 256KB */ + +#ifdef WITH_MEMORY_LIMITS +#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) +#endif + +/* + * Size of the pools used for small blocks. Should be a power of 2, + * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. + */ +#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ +#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK + +/* + * -- End of tunable settings section -- + */ + +/*==========================================================================*/ + +/* + * Locking + * + * To reduce lock contention, it would probably be better to refine the + * crude function locking with per size class locking. I'm not positive + * however, whether it's worth switching to such locking policy because + * of the performance penalty it might introduce. + * + * The following macros describe the simplest (should also be the fastest) + * lock object on a particular platform and the init/fini/lock/unlock + * operations on it. The locks defined here are not expected to be recursive + * because it is assumed that they will always be called in the order: + * INIT, [LOCK, UNLOCK]*, FINI. + */ + +/* + * Python's threads are serialized, so object malloc locking is disabled. + */ +#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ +#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ +#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ +#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ +#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ + +/* When you say memory, my mind reasons in terms of (pointers to) blocks */ +typedef uint8_t pyblock; + +/* Pool for small blocks. */ +struct pool_header { + union { pyblock *_padding; + unsigned int count; } ref; /* number of allocated blocks */ + pyblock *freeblock; /* pool's free list head */ + struct pool_header *nextpool; /* next pool of this size class */ + struct pool_header *prevpool; /* previous pool "" */ + unsigned int arenaindex; /* index into arenas of base adr */ + unsigned int szidx; /* block size class index */ + unsigned int nextoffset; /* bytes to virgin block */ + unsigned int maxnextoffset; /* largest valid nextoffset */ +}; + +typedef struct pool_header *poolp; + +/* Record keeping for arenas. */ +struct arena_object { + /* The address of the arena, as returned by malloc. Note that 0 + * will never be returned by a successful malloc, and is used + * here to mark an arena_object that doesn't correspond to an + * allocated arena. + */ + uintptr_t address; + + /* Pool-aligned pointer to the next pool to be carved off. */ + pyblock* pool_address; + + /* The number of available pools in the arena: free pools + never- + * allocated pools. + */ + unsigned int nfreepools; + + /* The total number of pools in the arena, whether or not available. */ + unsigned int ntotalpools; + + /* Singly-linked list of available pools. */ + struct pool_header* freepools; + + /* Whenever this arena_object is not associated with an allocated + * arena, the nextarena member is used to link all unassociated + * arena_objects in the singly-linked `unused_arena_objects` list. + * The prevarena member is unused in this case. + * + * When this arena_object is associated with an allocated arena + * with at least one available pool, both members are used in the + * doubly-linked `usable_arenas` list, which is maintained in + * increasing order of `nfreepools` values. + * + * Else this arena_object is associated with an allocated arena + * all of whose pools are in use. `nextarena` and `prevarena` + * are both meaningless in this case. + */ + struct arena_object* nextarena; + struct arena_object* prevarena; +}; + +#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) + +#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ + +/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ +#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) + +/* Return total number of blocks in pool of size index I, as a uint. */ +#define NUMBLOCKS(I) \ + ((unsigned int)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) + +/*==========================================================================*/ + +/* + * This malloc lock + */ +SIMPLELOCK_DECL(_malloc_lock) +#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) +#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) +#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) +#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) + +/* + * Pool table -- headed, circular, doubly-linked lists of partially used pools. + +This is involved. For an index i, usedpools[i+i] is the header for a list of +all partially used pools holding small blocks with "size class idx" i. So +usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size +16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to +the start of a singly-linked list of free blocks within the pool. When a +block is freed, it's inserted at the front of its pool's freeblock list. Note +that the available blocks in a pool are *not* linked all together when a pool +is initialized. Instead only "the first two" (lowest addresses) blocks are +set up, returning the first such block, and setting pool->freeblock to a +one-block list holding the second such block. This is consistent with that +pymalloc strives at all levels (arena, pool, and block) never to touch a piece +of memory until it's actually needed. + +So long as a pool is in the used state, we're certain there *is* a block +available for allocating, and pool->freeblock is not NULL. If pool->freeblock +points to the end of the free list before we've carved the entire pool into +blocks, that means we simply haven't yet gotten to one of the higher-address +blocks. The offset from the pool_header to the start of "the next" virgin +block is stored in the pool_header nextoffset member, and the largest value +of nextoffset that makes sense is stored in the maxnextoffset member when a +pool is initialized. All the blocks in a pool have been passed out at least +once when and only when nextoffset > maxnextoffset. + + +Major obscurity: While the usedpools vector is declared to have poolp +entries, it doesn't really. It really contains two pointers per (conceptual) +poolp entry, the nextpool and prevpool members of a pool_header. The +excruciating initialization code below fools C so that + + usedpool[i+i] + +"acts like" a genuine poolp, but only so long as you only reference its +nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is +compensating for that a pool_header's nextpool and prevpool members +immediately follow a pool_header's first two members: + + union { block *_padding; + uint count; } ref; + block *freeblock; + +each of which consume sizeof(block *) bytes. So what usedpools[i+i] really +contains is a fudged-up pointer p such that *if* C believes it's a poolp +pointer, then p->nextpool and p->prevpool are both p (meaning that the headed +circular list is empty). + +It's unclear why the usedpools setup is so convoluted. It could be to +minimize the amount of cache required to hold this heavily-referenced table +(which only *needs* the two interpool pointer members of a pool_header). OTOH, +referencing code has to remember to "double the index" and doing so isn't +free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying +on that C doesn't insert any padding anywhere in a pool_header at or before +the prevpool member. +**************************************************************************** */ + +#define MAX_POOLS (2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8) + +/*========================================================================== +Arena management. + +`arenas` is a vector of arena_objects. It contains maxarenas entries, some of +which may not be currently used (== they're arena_objects that aren't +currently associated with an allocated arena). Note that arenas proper are +separately malloc'ed. + +Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, +we do try to free() arenas, and use some mild heuristic strategies to increase +the likelihood that arenas eventually can be freed. + +unused_arena_objects + + This is a singly-linked list of the arena_objects that are currently not + being used (no arena is associated with them). Objects are taken off the + head of the list in new_arena(), and are pushed on the head of the list in + PyObject_Free() when the arena is empty. Key invariant: an arena_object + is on this list if and only if its .address member is 0. + +usable_arenas + + This is a doubly-linked list of the arena_objects associated with arenas + that have pools available. These pools are either waiting to be reused, + or have not been used before. The list is sorted to have the most- + allocated arenas first (ascending order based on the nfreepools member). + This means that the next allocation will come from a heavily used arena, + which gives the nearly empty arenas a chance to be returned to the system. + In my unscientific tests this dramatically improved the number of arenas + that could be freed. + +Note that an arena_object associated with an arena all of whose pools are +currently in use isn't on either list. +*/ + +/* How many arena_objects do we initially allocate? + * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the + * `arenas` vector. + */ +#define INITIAL_ARENA_OBJECTS 16 + +#endif /* _Py_PYMALLOC_H */ diff --git a/Include/internal/_pystate.h b/Include/internal/_pystate.h new file mode 100644 index 00000000000..9f2dea1befa --- /dev/null +++ b/Include/internal/_pystate.h @@ -0,0 +1,93 @@ +#ifndef _Py_PYSTATE_H +#define _Py_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pystate.h" +#include "pyatomic.h" + +#ifdef WITH_THREAD +#include "pythread.h" +#endif + +#include "_mem.h" +#include "_ceval.h" +#include "_warnings.h" + + +/* GIL state */ + +struct _gilstate_runtime_state { + int check_enabled; + /* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ + _Py_atomic_address tstate_current; + PyThreadFrameGetter getframe; +#ifdef WITH_THREAD + /* The single PyInterpreterState used by this process' + GILState implementation + */ + /* TODO: Given interp_main, it may be possible to kill this ref */ + PyInterpreterState *autoInterpreterState; + int autoTLSkey; +#endif /* WITH_THREAD */ +}; + +/* hook for PyEval_GetFrame(), requested for Psyco */ +#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe + +/* Issue #26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ +#define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled + + +/* Full Python runtime state */ + +typedef struct pyruntimestate { + int initialized; + int core_initialized; + PyThreadState *finalizing; + + struct pyinterpreters { +#ifdef WITH_THREAD + PyThread_type_lock mutex; +#endif + PyInterpreterState *head; + PyInterpreterState *main; + /* _next_interp_id is an auto-numbered sequence of small + integers. It gets initialized in _PyInterpreterState_Init(), + which is called in Py_Initialize(), and used in + PyInterpreterState_New(). A negative interpreter ID + indicates an error occurred. The main interpreter will + always have an ID of 0. Overflow results in a RuntimeError. + If that becomes a problem later then we can adjust, e.g. by + using a Python int. */ + int64_t next_id; + } interpreters; + +#define NEXITFUNCS 32 + void (*exitfuncs[NEXITFUNCS])(void); + int nexitfuncs; + void (*pyexitfunc)(void); + + struct _pyobj_runtime_state obj; + struct _gc_runtime_state gc; + struct _pymem_runtime_state mem; + struct _warnings_runtime_state warnings; + struct _ceval_runtime_state ceval; + struct _gilstate_runtime_state gilstate; + + // XXX Consolidate globals found via the check-c-globals script. +} _PyRuntimeState; + +PyAPI_DATA(_PyRuntimeState) _PyRuntime; +PyAPI_FUNC(void) _PyRuntimeState_Init(_PyRuntimeState *); +PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *); + +PyAPI_FUNC(void) _PyInterpreterState_Enable(_PyRuntimeState *); + +#ifdef __cplusplus +} +#endif +#endif /* !_Py_PYSTATE_H */ diff --git a/Include/internal/_warnings.h b/Include/internal/_warnings.h new file mode 100644 index 00000000000..2a1abb2d5d2 --- /dev/null +++ b/Include/internal/_warnings.h @@ -0,0 +1,21 @@ +#ifndef _Py_WARNINGS_H +#define _Py_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "object.h" + +struct _warnings_runtime_state { + /* Both 'filters' and 'onceregistry' can be set in warnings.py; + get_warnings_attr() will reset these variables accordingly. */ + PyObject *filters; /* List */ + PyObject *once_registry; /* Dict */ + PyObject *default_action; /* String */ + long filters_version; +}; + +#ifdef __cplusplus +} +#endif +#endif /* !_Py_WARNINGS_H */ diff --git a/Include/object.h b/Include/object.h index f5ed70b1129..b46d4c30e1e 100644 --- a/Include/object.h +++ b/Include/object.h @@ -1038,8 +1038,6 @@ with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. Kept for binary compatibility of extensions using the stable ABI. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); -PyAPI_DATA(int) _PyTrash_delete_nesting; -PyAPI_DATA(PyObject *) _PyTrash_delete_later; #endif /* !Py_LIMITED_API */ /* The new thread-safe private API, invoked by the macros below. */ diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 0d609ec2344..b02cd4cc543 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -119,7 +119,10 @@ PyAPI_FUNC(void) _PyType_Fini(void); PyAPI_FUNC(void) _Py_HashRandomization_Fini(void); PyAPI_FUNC(void) PyAsyncGen_Fini(void); -PyAPI_DATA(PyThreadState *) _Py_Finalizing; +#define _Py_IS_FINALIZING() \ + (_PyRuntime.finalizing != NULL) +#define _Py_CURRENTLY_FINALIZING(tstate) \ + (_PyRuntime.finalizing == tstate) #endif /* Signals */ diff --git a/Include/pystate.h b/Include/pystate.h index 8a92f3ec3ed..90081c51c0e 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -29,9 +29,10 @@ typedef struct { int use_hash_seed; unsigned long hash_seed; int _disable_importlib; /* Needed by freeze_importlib */ + char *allocator; } _PyCoreConfig; -#define _PyCoreConfig_INIT {0, -1, 0, 0} +#define _PyCoreConfig_INIT {0, -1, 0, 0, NULL} /* Placeholders while working on the new configuration API * @@ -57,6 +58,19 @@ typedef struct _is { PyObject *builtins; PyObject *importlib; + /* Used in Python/sysmodule.c. */ + int check_interval; + PyObject *warnoptions; + PyObject *xoptions; + + /* Used in Modules/_threadmodule.c. */ + long num_threads; + /* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ + /* Used in Python/thread.c. */ + size_t pythread_stacksize; + PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; @@ -185,9 +199,6 @@ typedef struct _ts { #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyInterpreterState_Init(void); -#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); @@ -246,7 +257,7 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE -PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; +# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else @@ -301,10 +312,6 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API -/* Issue #26558: Flag to disable PyGILState_Check(). - If set to non-zero, PyGILState_Check() always return 1. */ -PyAPI_DATA(int) _PyGILState_check_enabled; - /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. @@ -340,11 +347,6 @@ PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); #endif -/* hook for PyEval_GetFrame(), requested for Psyco */ -#ifndef Py_LIMITED_API -PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; -#endif - #ifdef __cplusplus } #endif diff --git a/Makefile.pre.in b/Makefile.pre.in index 57d2ab72ba9..d6ebf854eda 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -987,6 +987,13 @@ PYTHON_HEADERS= \ pyconfig.h \ $(PARSER_HEADERS) \ $(srcdir)/Include/Python-ast.h \ + $(srcdir)/Include/internal/_Python.h \ + $(srcdir)/Include/internal/_ceval.h \ + $(srcdir)/Include/internal/_gil.h \ + $(srcdir)/Include/internal/_mem.h \ + $(srcdir)/Include/internal/_pymalloc.h \ + $(srcdir)/Include/internal/_pystate.h \ + $(srcdir)/Include/internal/_warnings.h \ $(DTRACE_HEADERS) $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst new file mode 100644 index 00000000000..d8e9d5eeea1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst @@ -0,0 +1,2 @@ +Consolidate CPython's global runtime state under a single struct. This +improves discoverability of the runtime state. diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 189b1cd8442..3f57041855d 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -279,7 +279,7 @@ _enter_buffered_busy(buffered *self) "reentrant call inside %R", self); return 0; } - relax_locking = (_Py_Finalizing != NULL); + relax_locking = _Py_IS_FINALIZING(); Py_BEGIN_ALLOW_THREADS if (!relax_locking) st = PyThread_acquire_lock(self->lock, 1); diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index da750c01cd9..89be96c313f 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -14,7 +14,6 @@ #include "pythread.h" static PyObject *ThreadError; -static long nb_threads = 0; static PyObject *str_dict; _Py_IDENTIFIER(stderr); @@ -993,7 +992,7 @@ t_bootstrap(void *boot_raw) tstate->thread_id = PyThread_get_thread_ident(); _PyThreadState_Init(tstate); PyEval_AcquireThread(tstate); - nb_threads++; + tstate->interp->num_threads++; res = PyObject_Call(boot->func, boot->args, boot->keyw); if (res == NULL) { if (PyErr_ExceptionMatches(PyExc_SystemExit)) @@ -1020,7 +1019,7 @@ t_bootstrap(void *boot_raw) Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - nb_threads--; + tstate->interp->num_threads--; PyThreadState_Clear(tstate); PyThreadState_DeleteCurrent(); PyThread_exit_thread(); @@ -1159,7 +1158,8 @@ A thread's identity may be reused for another thread after it exits."); static PyObject * thread__count(PyObject *self) { - return PyLong_FromLong(nb_threads); + PyThreadState *tstate = PyThreadState_Get(); + return PyLong_FromLong(tstate->interp->num_threads); } PyDoc_STRVAR(_count_doc, @@ -1352,6 +1352,7 @@ PyInit__thread(void) PyObject *m, *d, *v; double time_max; double timeout_max; + PyThreadState *tstate = PyThreadState_Get(); /* Initialize types: */ if (PyType_Ready(&localdummytype) < 0) @@ -1396,7 +1397,7 @@ PyInit__thread(void) if (PyModule_AddObject(m, "_local", (PyObject *)&localtype) < 0) return NULL; - nb_threads = 0; + tstate->interp->num_threads = 0; str_dict = PyUnicode_InternFromString("__dict__"); if (str_dict == NULL) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 682d0a3cdd8..6556d99ea8e 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -114,7 +114,7 @@ overlapped_dealloc(OverlappedObject *self) { /* The operation is no longer pending -- nothing to do. */ } - else if (_Py_Finalizing == NULL) + else if _Py_IS_FINALIZING() { /* The operation is still pending -- give a warning. This will probably only happen on Windows XP. */ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 4e5acf305b9..fa67f7f5439 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -39,133 +39,9 @@ module gc /* Get the object given the GC head */ #define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) -/*** Global GC state ***/ - -struct gc_generation { - PyGC_Head head; - int threshold; /* collection threshold */ - int count; /* count of allocations or collections of younger - generations */ -}; - -/* If we change this, we need to change the default value in the signature of - gc.collect. */ -#define NUM_GENERATIONS 3 -#define GEN_HEAD(n) (&generations[n].head) - -/* linked lists of container objects */ -static struct gc_generation generations[NUM_GENERATIONS] = { - /* PyGC_Head, threshold, count */ - {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, - {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, - {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, -}; - -PyGC_Head *_PyGC_generation0 = GEN_HEAD(0); - -static int enabled = 1; /* automatic collection enabled? */ - -/* true if we are currently running the collector */ -static int collecting = 0; - -/* list of uncollectable objects */ -static PyObject *garbage = NULL; - /* Python string to use if unhandled exception occurs */ static PyObject *gc_str = NULL; -/* a list of callbacks to be invoked when collection is performed */ -static PyObject *callbacks = NULL; - -/* This is the number of objects that survived the last full collection. It - approximates the number of long lived objects tracked by the GC. - - (by "full collection", we mean a collection of the oldest generation). -*/ -static Py_ssize_t long_lived_total = 0; - -/* This is the number of objects that survived all "non-full" collections, - and are awaiting to undergo a full collection for the first time. - -*/ -static Py_ssize_t long_lived_pending = 0; - -/* - NOTE: about the counting of long-lived objects. - - To limit the cost of garbage collection, there are two strategies; - - make each collection faster, e.g. by scanning fewer objects - - do less collections - This heuristic is about the latter strategy. - - In addition to the various configurable thresholds, we only trigger a - full collection if the ratio - long_lived_pending / long_lived_total - is above a given value (hardwired to 25%). - - The reason is that, while "non-full" collections (i.e., collections of - the young and middle generations) will always examine roughly the same - number of objects -- determined by the aforementioned thresholds --, - the cost of a full collection is proportional to the total number of - long-lived objects, which is virtually unbounded. - - Indeed, it has been remarked that doing a full collection every - of object creations entails a dramatic performance - degradation in workloads which consist in creating and storing lots of - long-lived objects (e.g. building a large list of GC-tracked objects would - show quadratic performance, instead of linear as expected: see issue #4074). - - Using the above ratio, instead, yields amortized linear performance in - the total number of objects (the effect of which can be summarized - thusly: "each full garbage collection is more and more costly as the - number of objects grows, but we do fewer and fewer of them"). - - This heuristic was suggested by Martin von L?wis on python-dev in - June 2008. His original analysis and proposal can be found at: - http://mail.python.org/pipermail/python-dev/2008-June/080579.html -*/ - -/* - NOTE: about untracking of mutable objects. - - Certain types of container cannot participate in a reference cycle, and - so do not need to be tracked by the garbage collector. Untracking these - objects reduces the cost of garbage collections. However, determining - which objects may be untracked is not free, and the costs must be - weighed against the benefits for garbage collection. - - There are two possible strategies for when to untrack a container: - - i) When the container is created. - ii) When the container is examined by the garbage collector. - - Tuples containing only immutable objects (integers, strings etc, and - recursively, tuples of immutable objects) do not need to be tracked. - The interpreter creates a large number of tuples, many of which will - not survive until garbage collection. It is therefore not worthwhile - to untrack eligible tuples at creation time. - - Instead, all tuples except the empty tuple are tracked when created. - During garbage collection it is determined whether any surviving tuples - can be untracked. A tuple can be untracked if all of its contents are - already not tracked. Tuples are examined for untracking in all garbage - collection cycles. It may take more than one cycle to untrack a tuple. - - Dictionaries containing only immutable objects also do not need to be - tracked. Dictionaries are untracked when created. If a tracked item is - inserted into a dictionary (either as a key or value), the dictionary - becomes tracked. During a full garbage collection (all generations), - the collector will untrack any dictionaries whose contents are not - tracked. - - The module provides the python function is_tracked(obj), which returns - the CURRENT tracking status of the object. Subsequent garbage - collections may change the tracking status of the object. - - Untracking of certain containers was introduced in issue #4688, and - the algorithm was refined in response to issue #14775. -*/ - /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ #define DEBUG_COLLECTABLE (1<<1) /* print collectable objects */ @@ -174,19 +50,26 @@ static Py_ssize_t long_lived_pending = 0; #define DEBUG_LEAK DEBUG_COLLECTABLE | \ DEBUG_UNCOLLECTABLE | \ DEBUG_SAVEALL -static int debug; - -/* Running stats per generation */ -struct gc_generation_stats { - /* total number of collections */ - Py_ssize_t collections; - /* total number of collected objects */ - Py_ssize_t collected; - /* total number of uncollectable objects (put into gc.garbage) */ - Py_ssize_t uncollectable; -}; -static struct gc_generation_stats generation_stats[NUM_GENERATIONS]; +#define GEN_HEAD(n) (&_PyRuntime.gc.generations[n].head) + +void +_PyGC_Initialize(struct _gc_runtime_state *state) +{ + state->enabled = 1; /* automatic collection enabled? */ + +#define _GEN_HEAD(n) (&state->generations[n].head) + struct gc_generation generations[NUM_GENERATIONS] = { + /* PyGC_Head, threshold, count */ + {{{_GEN_HEAD(0), _GEN_HEAD(0), 0}}, 700, 0}, + {{{_GEN_HEAD(1), _GEN_HEAD(1), 0}}, 10, 0}, + {{{_GEN_HEAD(2), _GEN_HEAD(2), 0}}, 10, 0}, + }; + for (int i = 0; i < NUM_GENERATIONS; i++) { + state->generations[i] = generations[i]; + }; + state->generation0 = GEN_HEAD(0); +} /*-------------------------------------------------------------------------- gc_refs values. @@ -766,16 +649,16 @@ handle_legacy_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc = finalizers->gc.gc_next; - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) + if (_PyRuntime.gc.garbage == NULL) { + _PyRuntime.gc.garbage = PyList_New(0); + if (_PyRuntime.gc.garbage == NULL) Py_FatalError("gc couldn't create gc.garbage list"); } for (; gc != finalizers; gc = gc->gc.gc_next) { PyObject *op = FROM_GC(gc); - if ((debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { - if (PyList_Append(garbage, op) < 0) + if ((_PyRuntime.gc.debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { + if (PyList_Append(_PyRuntime.gc.garbage, op) < 0) return -1; } } @@ -865,8 +748,8 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old) PyGC_Head *gc = collectable->gc.gc_next; PyObject *op = FROM_GC(gc); - if (debug & DEBUG_SAVEALL) { - PyList_Append(garbage, op); + if (_PyRuntime.gc.debug & DEBUG_SAVEALL) { + PyList_Append(_PyRuntime.gc.garbage, op); } else { if ((clear = Py_TYPE(op)->tp_clear) != NULL) { @@ -919,9 +802,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, PyGC_Head *gc; _PyTime_t t1 = 0; /* initialize to prevent a compiler warning */ - struct gc_generation_stats *stats = &generation_stats[generation]; + struct gc_generation_stats *stats = &_PyRuntime.gc.generation_stats[generation]; - if (debug & DEBUG_STATS) { + if (_PyRuntime.gc.debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", generation); PySys_WriteStderr("gc: objects in each generation:"); @@ -938,9 +821,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* update collection and allocation counters */ if (generation+1 < NUM_GENERATIONS) - generations[generation+1].count += 1; + _PyRuntime.gc.generations[generation+1].count += 1; for (i = 0; i <= generation; i++) - generations[i].count = 0; + _PyRuntime.gc.generations[i].count = 0; /* merge younger generations with one we are currently collecting */ for (i = 0; i < generation; i++) { @@ -974,7 +857,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* Move reachable objects to next generation. */ if (young != old) { if (generation == NUM_GENERATIONS - 2) { - long_lived_pending += gc_list_size(young); + _PyRuntime.gc.long_lived_pending += gc_list_size(young); } gc_list_merge(young, old); } @@ -982,8 +865,8 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* We only untrack dicts in full collections, to avoid quadratic dict build-up. See issue #14775. */ untrack_dicts(young); - long_lived_pending = 0; - long_lived_total = gc_list_size(young); + _PyRuntime.gc.long_lived_pending = 0; + _PyRuntime.gc.long_lived_total = gc_list_size(young); } /* All objects in unreachable are trash, but objects reachable from @@ -1003,7 +886,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; - if (debug & DEBUG_COLLECTABLE) { + if (_PyRuntime.gc.debug & DEBUG_COLLECTABLE) { debug_cycle("collectable", FROM_GC(gc)); } } @@ -1032,10 +915,10 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, gc != &finalizers; gc = gc->gc.gc_next) { n++; - if (debug & DEBUG_UNCOLLECTABLE) + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) debug_cycle("uncollectable", FROM_GC(gc)); } - if (debug & DEBUG_STATS) { + if (_PyRuntime.gc.debug & DEBUG_STATS) { _PyTime_t t2 = _PyTime_GetMonotonicClock(); if (m == 0 && n == 0) @@ -1098,11 +981,11 @@ invoke_gc_callback(const char *phase, int generation, PyObject *info = NULL; /* we may get called very early */ - if (callbacks == NULL) + if (_PyRuntime.gc.callbacks == NULL) return; /* The local variable cannot be rebound, check it for sanity */ - assert(callbacks != NULL && PyList_CheckExact(callbacks)); - if (PyList_GET_SIZE(callbacks) != 0) { + assert(_PyRuntime.gc.callbacks != NULL && PyList_CheckExact(_PyRuntime.gc.callbacks)); + if (PyList_GET_SIZE(_PyRuntime.gc.callbacks) != 0) { info = Py_BuildValue("{sisnsn}", "generation", generation, "collected", collected, @@ -1112,8 +995,8 @@ invoke_gc_callback(const char *phase, int generation, return; } } - for (i=0; i= 0; i--) { - if (generations[i].count > generations[i].threshold) { + if (_PyRuntime.gc.generations[i].count > _PyRuntime.gc.generations[i].threshold) { /* Avoid quadratic performance degradation in number of tracked objects. See comments at the beginning of this file, and issue #4074. */ if (i == NUM_GENERATIONS - 1 - && long_lived_pending < long_lived_total / 4) + && _PyRuntime.gc.long_lived_pending < _PyRuntime.gc.long_lived_total / 4) continue; n = collect_with_callback(i); break; @@ -1174,7 +1057,7 @@ static PyObject * gc_enable_impl(PyObject *module) /*[clinic end generated code: output=45a427e9dce9155c input=81ac4940ca579707]*/ { - enabled = 1; + _PyRuntime.gc.enabled = 1; Py_RETURN_NONE; } @@ -1188,7 +1071,7 @@ static PyObject * gc_disable_impl(PyObject *module) /*[clinic end generated code: output=97d1030f7aa9d279 input=8c2e5a14e800d83b]*/ { - enabled = 0; + _PyRuntime.gc.enabled = 0; Py_RETURN_NONE; } @@ -1202,7 +1085,7 @@ static int gc_isenabled_impl(PyObject *module) /*[clinic end generated code: output=1874298331c49130 input=30005e0422373b31]*/ { - return enabled; + return _PyRuntime.gc.enabled; } /*[clinic input] @@ -1230,12 +1113,12 @@ gc_collect_impl(PyObject *module, int generation) return -1; } - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; /* already collecting, don't do anything */ else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect_with_callback(generation); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; @@ -1263,7 +1146,7 @@ static PyObject * gc_set_debug_impl(PyObject *module, int flags) /*[clinic end generated code: output=7c8366575486b228 input=5e5ce15e84fbed15]*/ { - debug = flags; + _PyRuntime.gc.debug = flags; Py_RETURN_NONE; } @@ -1278,7 +1161,7 @@ static int gc_get_debug_impl(PyObject *module) /*[clinic end generated code: output=91242f3506cd1e50 input=91a101e1c3b98366]*/ { - return debug; + return _PyRuntime.gc.debug; } PyDoc_STRVAR(gc_set_thresh__doc__, @@ -1292,13 +1175,13 @@ gc_set_thresh(PyObject *self, PyObject *args) { int i; if (!PyArg_ParseTuple(args, "i|ii:set_threshold", - &generations[0].threshold, - &generations[1].threshold, - &generations[2].threshold)) + &_PyRuntime.gc.generations[0].threshold, + &_PyRuntime.gc.generations[1].threshold, + &_PyRuntime.gc.generations[2].threshold)) return NULL; for (i = 2; i < NUM_GENERATIONS; i++) { /* generations higher than 2 get the same threshold */ - generations[i].threshold = generations[2].threshold; + _PyRuntime.gc.generations[i].threshold = _PyRuntime.gc.generations[2].threshold; } Py_RETURN_NONE; @@ -1315,9 +1198,9 @@ gc_get_threshold_impl(PyObject *module) /*[clinic end generated code: output=7902bc9f41ecbbd8 input=286d79918034d6e6]*/ { return Py_BuildValue("(iii)", - generations[0].threshold, - generations[1].threshold, - generations[2].threshold); + _PyRuntime.gc.generations[0].threshold, + _PyRuntime.gc.generations[1].threshold, + _PyRuntime.gc.generations[2].threshold); } /*[clinic input] @@ -1331,9 +1214,9 @@ gc_get_count_impl(PyObject *module) /*[clinic end generated code: output=354012e67b16398f input=a392794a08251751]*/ { return Py_BuildValue("(iii)", - generations[0].count, - generations[1].count, - generations[2].count); + _PyRuntime.gc.generations[0].count, + _PyRuntime.gc.generations[1].count, + _PyRuntime.gc.generations[2].count); } static int @@ -1464,7 +1347,7 @@ gc_get_stats_impl(PyObject *module) /* To get consistent values despite allocations while constructing the result list, we use a snapshot of the running stats. */ for (i = 0; i < NUM_GENERATIONS; i++) { - stats[i] = generation_stats[i]; + stats[i] = _PyRuntime.gc.generation_stats[i]; } result = PyList_New(0); @@ -1581,22 +1464,22 @@ PyInit_gc(void) if (m == NULL) return NULL; - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) + if (_PyRuntime.gc.garbage == NULL) { + _PyRuntime.gc.garbage = PyList_New(0); + if (_PyRuntime.gc.garbage == NULL) return NULL; } - Py_INCREF(garbage); - if (PyModule_AddObject(m, "garbage", garbage) < 0) + Py_INCREF(_PyRuntime.gc.garbage); + if (PyModule_AddObject(m, "garbage", _PyRuntime.gc.garbage) < 0) return NULL; - if (callbacks == NULL) { - callbacks = PyList_New(0); - if (callbacks == NULL) + if (_PyRuntime.gc.callbacks == NULL) { + _PyRuntime.gc.callbacks = PyList_New(0); + if (_PyRuntime.gc.callbacks == NULL) return NULL; } - Py_INCREF(callbacks); - if (PyModule_AddObject(m, "callbacks", callbacks) < 0) + Py_INCREF(_PyRuntime.gc.callbacks); + if (PyModule_AddObject(m, "callbacks", _PyRuntime.gc.callbacks) < 0) return NULL; #define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return NULL @@ -1615,12 +1498,12 @@ PyGC_Collect(void) { Py_ssize_t n; - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; /* already collecting, don't do anything */ else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect_with_callback(NUM_GENERATIONS - 1); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; @@ -1629,7 +1512,7 @@ PyGC_Collect(void) Py_ssize_t _PyGC_CollectIfEnabled(void) { - if (!enabled) + if (!_PyRuntime.gc.enabled) return 0; return PyGC_Collect(); @@ -1646,12 +1529,12 @@ _PyGC_CollectNoFail(void) during interpreter shutdown (and then never finish it). See http://bugs.python.org/issue8713#msg195178 for an example. */ - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect(NUM_GENERATIONS - 1, NULL, NULL, 1); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; } @@ -1659,10 +1542,10 @@ _PyGC_CollectNoFail(void) void _PyGC_DumpShutdownStats(void) { - if (!(debug & DEBUG_SAVEALL) - && garbage != NULL && PyList_GET_SIZE(garbage) > 0) { + if (!(_PyRuntime.gc.debug & DEBUG_SAVEALL) + && _PyRuntime.gc.garbage != NULL && PyList_GET_SIZE(_PyRuntime.gc.garbage) > 0) { char *message; - if (debug & DEBUG_UNCOLLECTABLE) + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) message = "gc: %zd uncollectable objects at " \ "shutdown"; else @@ -1673,13 +1556,13 @@ _PyGC_DumpShutdownStats(void) already. */ if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0, "gc", NULL, message, - PyList_GET_SIZE(garbage))) + PyList_GET_SIZE(_PyRuntime.gc.garbage))) PyErr_WriteUnraisable(NULL); - if (debug & DEBUG_UNCOLLECTABLE) { + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) { PyObject *repr = NULL, *bytes = NULL; - repr = PyObject_Repr(garbage); + repr = PyObject_Repr(_PyRuntime.gc.garbage); if (!repr || !(bytes = PyUnicode_EncodeFSDefault(repr))) - PyErr_WriteUnraisable(garbage); + PyErr_WriteUnraisable(_PyRuntime.gc.garbage); else { PySys_WriteStderr( " %s\n", @@ -1695,7 +1578,7 @@ _PyGC_DumpShutdownStats(void) void _PyGC_Fini(void) { - Py_CLEAR(callbacks); + Py_CLEAR(_PyRuntime.gc.callbacks); } /* for debugging */ @@ -1746,15 +1629,15 @@ _PyObject_GC_Alloc(int use_calloc, size_t basicsize) return PyErr_NoMemory(); g->gc.gc_refs = 0; _PyGCHead_SET_REFS(g, GC_UNTRACKED); - generations[0].count++; /* number of allocated GC objects */ - if (generations[0].count > generations[0].threshold && - enabled && - generations[0].threshold && - !collecting && + _PyRuntime.gc.generations[0].count++; /* number of allocated GC objects */ + if (_PyRuntime.gc.generations[0].count > _PyRuntime.gc.generations[0].threshold && + _PyRuntime.gc.enabled && + _PyRuntime.gc.generations[0].threshold && + !_PyRuntime.gc.collecting && !PyErr_Occurred()) { - collecting = 1; + _PyRuntime.gc.collecting = 1; collect_generations(); - collecting = 0; + _PyRuntime.gc.collecting = 0; } op = FROM_GC(g); return op; @@ -1819,8 +1702,8 @@ PyObject_GC_Del(void *op) PyGC_Head *g = AS_GC(op); if (IS_TRACKED(op)) gc_list_remove(g); - if (generations[0].count > 0) { - generations[0].count--; + if (_PyRuntime.gc.generations[0].count > 0) { + _PyRuntime.gc.generations[0].count--; } PyObject_FREE(g); } diff --git a/Modules/main.c b/Modules/main.c index 08b22760de1..3e347dc8e24 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -598,16 +598,10 @@ Py_Main(int argc, wchar_t **argv) } } - char *pymalloc = Py_GETENV("PYTHONMALLOC"); - if (_PyMem_SetupAllocators(pymalloc) < 0) { - fprintf(stderr, - "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", pymalloc); - exit(1); - } - /* Initialize the core language runtime */ Py_IgnoreEnvironmentFlag = core_config.ignore_environment; core_config._disable_importlib = 0; + core_config.allocator = Py_GETENV("PYTHONMALLOC"); _Py_InitializeCore(&core_config); /* Reprocess the command line with the language runtime available */ diff --git a/Objects/object.c b/Objects/object.c index 2ba6e572ea6..68a90c23107 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2028,14 +2028,6 @@ Py_ReprLeave(PyObject *obj) /* Trashcan support. */ -/* Current call-stack depth of tp_dealloc calls. */ -int _PyTrash_delete_nesting = 0; - -/* List of objects that still need to be cleaned up, singly linked via their - * gc headers' gc_prev pointers. - */ -PyObject *_PyTrash_delete_later = NULL; - /* Add op to the _PyTrash_delete_later list. Called when the current * call-stack depth gets large. op must be a currently untracked gc'ed * object, with refcount 0. Py_DECREF must already have been called on it. @@ -2046,8 +2038,8 @@ _PyTrash_deposit_object(PyObject *op) assert(PyObject_IS_GC(op)); assert(_PyGC_REFS(op) == _PyGC_REFS_UNTRACKED); assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; - _PyTrash_delete_later = op; + _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyRuntime.gc.trash_delete_later; + _PyRuntime.gc.trash_delete_later = op; } /* The equivalent API, using per-thread state recursion info */ @@ -2068,11 +2060,11 @@ _PyTrash_thread_deposit_object(PyObject *op) void _PyTrash_destroy_chain(void) { - while (_PyTrash_delete_later) { - PyObject *op = _PyTrash_delete_later; + while (_PyRuntime.gc.trash_delete_later) { + PyObject *op = _PyRuntime.gc.trash_delete_later; destructor dealloc = Py_TYPE(op)->tp_dealloc; - _PyTrash_delete_later = + _PyRuntime.gc.trash_delete_later = (PyObject*) _Py_AS_GC(op)->gc.gc_prev; /* Call the deallocator directly. This used to try to @@ -2082,9 +2074,9 @@ _PyTrash_destroy_chain(void) * up distorting allocation statistics. */ assert(op->ob_refcnt == 0); - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; (*dealloc)(op); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; } } diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 32e7ecbe1e0..3698cfc260e 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -178,7 +178,9 @@ static struct { #define PYDBG_FUNCS \ _PyMem_DebugMalloc, _PyMem_DebugCalloc, _PyMem_DebugRealloc, _PyMem_DebugFree -static PyMemAllocatorEx _PyMem_Raw = { + +#define _PyMem_Raw _PyRuntime.mem.allocators.raw +static const PyMemAllocatorEx _pymem_raw = { #ifdef Py_DEBUG &_PyMem_Debug.raw, PYRAWDBG_FUNCS #else @@ -186,7 +188,8 @@ static PyMemAllocatorEx _PyMem_Raw = { #endif }; -static PyMemAllocatorEx _PyMem = { +#define _PyMem _PyRuntime.mem.allocators.mem +static const PyMemAllocatorEx _pymem = { #ifdef Py_DEBUG &_PyMem_Debug.mem, PYDBG_FUNCS #else @@ -194,7 +197,8 @@ static PyMemAllocatorEx _PyMem = { #endif }; -static PyMemAllocatorEx _PyObject = { +#define _PyObject _PyRuntime.mem.allocators.obj +static const PyMemAllocatorEx _pyobject = { #ifdef Py_DEBUG &_PyMem_Debug.obj, PYDBG_FUNCS #else @@ -267,7 +271,7 @@ _PyMem_SetupAllocators(const char *opt) #undef PYRAWDBG_FUNCS #undef PYDBG_FUNCS -static PyObjectArenaAllocator _PyObject_Arena = {NULL, +static const PyObjectArenaAllocator _PyObject_Arena = {NULL, #ifdef MS_WINDOWS _PyObject_ArenaVirtualAlloc, _PyObject_ArenaVirtualFree #elif defined(ARENAS_USE_MMAP) @@ -277,6 +281,34 @@ static PyObjectArenaAllocator _PyObject_Arena = {NULL, #endif }; +void +_PyObject_Initialize(struct _pyobj_runtime_state *state) +{ + state->allocator_arenas = _PyObject_Arena; +} + +void +_PyMem_Initialize(struct _pymem_runtime_state *state) +{ + state->allocators.raw = _pymem_raw; + state->allocators.mem = _pymem; + state->allocators.obj = _pyobject; + +#ifdef WITH_PYMALLOC + for (int i = 0; i < 8; i++) { + if (NB_SMALL_SIZE_CLASSES <= i * 8) + break; + for (int j = 0; j < 8; j++) { + int x = i * 8 + j; + poolp *addr = &(state->usedpools[2*(x)]); + poolp val = (poolp)((uint8_t *)addr - 2*sizeof(pyblock *)); + state->usedpools[x * 2] = val; + state->usedpools[x * 2 + 1] = val; + }; + }; +#endif /* WITH_PYMALLOC */ +} + #ifdef WITH_PYMALLOC static int _PyMem_DebugEnabled(void) @@ -363,13 +395,13 @@ PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator) void PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator) { - *allocator = _PyObject_Arena; + *allocator = _PyRuntime.obj.allocator_arenas; } void PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator) { - _PyObject_Arena = *allocator; + _PyRuntime.obj.allocator_arenas = *allocator; } void * @@ -404,7 +436,8 @@ PyMem_RawRealloc(void *ptr, size_t new_size) return _PyMem_Raw.realloc(_PyMem_Raw.ctx, ptr, new_size); } -void PyMem_RawFree(void *ptr) +void +PyMem_RawFree(void *ptr) { _PyMem_Raw.free(_PyMem_Raw.ctx, ptr); } @@ -521,497 +554,10 @@ PyObject_Free(void *ptr) static int running_on_valgrind = -1; #endif -/* An object allocator for Python. - - Here is an introduction to the layers of the Python memory architecture, - showing where the object allocator is actually used (layer +2), It is - called for every object allocation and deallocation (PyObject_New/Del), - unless the object-specific allocators implement a proprietary allocation - scheme (ex.: ints use a simple free list). This is also the place where - the cyclic garbage collector operates selectively on container objects. - - - Object-specific allocators - _____ ______ ______ ________ - [ int ] [ dict ] [ list ] ... [ string ] Python core | -+3 | <----- Object-specific memory -----> | <-- Non-object memory --> | - _______________________________ | | - [ Python's object allocator ] | | -+2 | ####### Object memory ####### | <------ Internal buffers ------> | - ______________________________________________________________ | - [ Python's raw memory allocator (PyMem_ API) ] | -+1 | <----- Python memory (under PyMem manager's control) ------> | | - __________________________________________________________________ - [ Underlying general-purpose allocator (ex: C library malloc) ] - 0 | <------ Virtual memory allocated for the python process -------> | - - ========================================================================= - _______________________________________________________________________ - [ OS-specific Virtual Memory Manager (VMM) ] --1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | - __________________________________ __________________________________ - [ ] [ ] --2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | - -*/ -/*==========================================================================*/ - -/* A fast, special-purpose memory allocator for small blocks, to be used - on top of a general-purpose malloc -- heavily based on previous art. */ - -/* Vladimir Marangozov -- August 2000 */ - -/* - * "Memory management is where the rubber meets the road -- if we do the wrong - * thing at any level, the results will not be good. And if we don't make the - * levels work well together, we are in serious trouble." (1) - * - * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, - * "Dynamic Storage Allocation: A Survey and Critical Review", - * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. - */ - -/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ - -/*==========================================================================*/ - -/* - * Allocation strategy abstract: - * - * For small requests, the allocator sub-allocates blocks of memory. - * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the - * system's allocator. - * - * Small requests are grouped in size classes spaced 8 bytes apart, due - * to the required valid alignment of the returned address. Requests of - * a particular size are serviced from memory pools of 4K (one VMM page). - * Pools are fragmented on demand and contain free lists of blocks of one - * particular size class. In other words, there is a fixed-size allocator - * for each size class. Free pools are shared by the different allocators - * thus minimizing the space reserved for a particular size class. - * - * This allocation strategy is a variant of what is known as "simple - * segregated storage based on array of free lists". The main drawback of - * simple segregated storage is that we might end up with lot of reserved - * memory for the different free lists, which degenerate in time. To avoid - * this, we partition each free list in pools and we share dynamically the - * reserved space between all free lists. This technique is quite efficient - * for memory intensive programs which allocate mainly small-sized blocks. - * - * For small requests we have the following table: - * - * Request in bytes Size of allocated block Size class idx - * ---------------------------------------------------------------- - * 1-8 8 0 - * 9-16 16 1 - * 17-24 24 2 - * 25-32 32 3 - * 33-40 40 4 - * 41-48 48 5 - * 49-56 56 6 - * 57-64 64 7 - * 65-72 72 8 - * ... ... ... - * 497-504 504 62 - * 505-512 512 63 - * - * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying - * allocator. - */ - -/*==========================================================================*/ - -/* - * -- Main tunable settings section -- - */ - -/* - * Alignment of addresses returned to the user. 8-bytes alignment works - * on most current architectures (with 32-bit or 64-bit address busses). - * The alignment value is also used for grouping small requests in size - * classes spaced ALIGNMENT bytes apart. - * - * You shouldn't change this unless you know what you are doing. - */ -#define ALIGNMENT 8 /* must be 2^N */ -#define ALIGNMENT_SHIFT 3 - -/* Return the number of bytes in size class I, as a uint. */ -#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) - -/* - * Max size threshold below which malloc requests are considered to be - * small enough in order to use preallocated memory pools. You can tune - * this value according to your application behaviour and memory needs. - * - * Note: a size threshold of 512 guarantees that newly created dictionaries - * will be allocated from preallocated memory pools on 64-bit. - * - * The following invariants must hold: - * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 - * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT - * - * Although not required, for better performance and space efficiency, - * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. - */ -#define SMALL_REQUEST_THRESHOLD 512 -#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) - -/* - * The system's VMM page size can be obtained on most unices with a - * getpagesize() call or deduced from various header files. To make - * things simpler, we assume that it is 4K, which is OK for most systems. - * It is probably better if this is the native page size, but it doesn't - * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page - * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation - * violation fault. 4K is apparently OK for all the platforms that python - * currently targets. - */ -#define SYSTEM_PAGE_SIZE (4 * 1024) -#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) - -/* - * Maximum amount of memory managed by the allocator for small requests. - */ -#ifdef WITH_MEMORY_LIMITS -#ifndef SMALL_MEMORY_LIMIT -#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ -#endif -#endif - -/* - * The allocator sub-allocates blocks of memory (called arenas) aligned - * on a page boundary. This is a reserved virtual address space for the - * current process (obtained through a malloc()/mmap() call). In no way this - * means that the memory arenas will be used entirely. A malloc() is - * usually an address range reservation for bytes, unless all pages within - * this space are referenced subsequently. So malloc'ing big blocks and not - * using them does not mean "wasting memory". It's an addressable range - * wastage... - * - * Arenas are allocated with mmap() on systems supporting anonymous memory - * mappings to reduce heap fragmentation. - */ -#define ARENA_SIZE (256 << 10) /* 256KB */ - -#ifdef WITH_MEMORY_LIMITS -#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) -#endif - -/* - * Size of the pools used for small blocks. Should be a power of 2, - * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. - */ -#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ -#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK - -/* - * -- End of tunable settings section -- - */ - -/*==========================================================================*/ - -/* - * Locking - * - * To reduce lock contention, it would probably be better to refine the - * crude function locking with per size class locking. I'm not positive - * however, whether it's worth switching to such locking policy because - * of the performance penalty it might introduce. - * - * The following macros describe the simplest (should also be the fastest) - * lock object on a particular platform and the init/fini/lock/unlock - * operations on it. The locks defined here are not expected to be recursive - * because it is assumed that they will always be called in the order: - * INIT, [LOCK, UNLOCK]*, FINI. - */ - -/* - * Python's threads are serialized, so object malloc locking is disabled. - */ -#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ -#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ -#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ -#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ -#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ - -/* When you say memory, my mind reasons in terms of (pointers to) blocks */ -typedef uint8_t block; - -/* Pool for small blocks. */ -struct pool_header { - union { block *_padding; - uint count; } ref; /* number of allocated blocks */ - block *freeblock; /* pool's free list head */ - struct pool_header *nextpool; /* next pool of this size class */ - struct pool_header *prevpool; /* previous pool "" */ - uint arenaindex; /* index into arenas of base adr */ - uint szidx; /* block size class index */ - uint nextoffset; /* bytes to virgin block */ - uint maxnextoffset; /* largest valid nextoffset */ -}; - -typedef struct pool_header *poolp; - -/* Record keeping for arenas. */ -struct arena_object { - /* The address of the arena, as returned by malloc. Note that 0 - * will never be returned by a successful malloc, and is used - * here to mark an arena_object that doesn't correspond to an - * allocated arena. - */ - uintptr_t address; - - /* Pool-aligned pointer to the next pool to be carved off. */ - block* pool_address; - - /* The number of available pools in the arena: free pools + never- - * allocated pools. - */ - uint nfreepools; - - /* The total number of pools in the arena, whether or not available. */ - uint ntotalpools; - - /* Singly-linked list of available pools. */ - struct pool_header* freepools; - - /* Whenever this arena_object is not associated with an allocated - * arena, the nextarena member is used to link all unassociated - * arena_objects in the singly-linked `unused_arena_objects` list. - * The prevarena member is unused in this case. - * - * When this arena_object is associated with an allocated arena - * with at least one available pool, both members are used in the - * doubly-linked `usable_arenas` list, which is maintained in - * increasing order of `nfreepools` values. - * - * Else this arena_object is associated with an allocated arena - * all of whose pools are in use. `nextarena` and `prevarena` - * are both meaningless in this case. - */ - struct arena_object* nextarena; - struct arena_object* prevarena; -}; - -#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) - -#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ - -/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ -#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) - -/* Return total number of blocks in pool of size index I, as a uint. */ -#define NUMBLOCKS(I) ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) - -/*==========================================================================*/ - -/* - * This malloc lock - */ -SIMPLELOCK_DECL(_malloc_lock) -#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) -#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) -#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) -#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) - -/* - * Pool table -- headed, circular, doubly-linked lists of partially used pools. - -This is involved. For an index i, usedpools[i+i] is the header for a list of -all partially used pools holding small blocks with "size class idx" i. So -usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size -16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to -the start of a singly-linked list of free blocks within the pool. When a -block is freed, it's inserted at the front of its pool's freeblock list. Note -that the available blocks in a pool are *not* linked all together when a pool -is initialized. Instead only "the first two" (lowest addresses) blocks are -set up, returning the first such block, and setting pool->freeblock to a -one-block list holding the second such block. This is consistent with that -pymalloc strives at all levels (arena, pool, and block) never to touch a piece -of memory until it's actually needed. - -So long as a pool is in the used state, we're certain there *is* a block -available for allocating, and pool->freeblock is not NULL. If pool->freeblock -points to the end of the free list before we've carved the entire pool into -blocks, that means we simply haven't yet gotten to one of the higher-address -blocks. The offset from the pool_header to the start of "the next" virgin -block is stored in the pool_header nextoffset member, and the largest value -of nextoffset that makes sense is stored in the maxnextoffset member when a -pool is initialized. All the blocks in a pool have been passed out at least -once when and only when nextoffset > maxnextoffset. - - -Major obscurity: While the usedpools vector is declared to have poolp -entries, it doesn't really. It really contains two pointers per (conceptual) -poolp entry, the nextpool and prevpool members of a pool_header. The -excruciating initialization code below fools C so that - - usedpool[i+i] - -"acts like" a genuine poolp, but only so long as you only reference its -nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is -compensating for that a pool_header's nextpool and prevpool members -immediately follow a pool_header's first two members: - - union { block *_padding; - uint count; } ref; - block *freeblock; - -each of which consume sizeof(block *) bytes. So what usedpools[i+i] really -contains is a fudged-up pointer p such that *if* C believes it's a poolp -pointer, then p->nextpool and p->prevpool are both p (meaning that the headed -circular list is empty). - -It's unclear why the usedpools setup is so convoluted. It could be to -minimize the amount of cache required to hold this heavily-referenced table -(which only *needs* the two interpool pointer members of a pool_header). OTOH, -referencing code has to remember to "double the index" and doing so isn't -free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying -on that C doesn't insert any padding anywhere in a pool_header at or before -the prevpool member. -**************************************************************************** */ - -#define PTA(x) ((poolp )((uint8_t *)&(usedpools[2*(x)]) - 2*sizeof(block *))) -#define PT(x) PTA(x), PTA(x) - -static poolp usedpools[2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8] = { - PT(0), PT(1), PT(2), PT(3), PT(4), PT(5), PT(6), PT(7) -#if NB_SMALL_SIZE_CLASSES > 8 - , PT(8), PT(9), PT(10), PT(11), PT(12), PT(13), PT(14), PT(15) -#if NB_SMALL_SIZE_CLASSES > 16 - , PT(16), PT(17), PT(18), PT(19), PT(20), PT(21), PT(22), PT(23) -#if NB_SMALL_SIZE_CLASSES > 24 - , PT(24), PT(25), PT(26), PT(27), PT(28), PT(29), PT(30), PT(31) -#if NB_SMALL_SIZE_CLASSES > 32 - , PT(32), PT(33), PT(34), PT(35), PT(36), PT(37), PT(38), PT(39) -#if NB_SMALL_SIZE_CLASSES > 40 - , PT(40), PT(41), PT(42), PT(43), PT(44), PT(45), PT(46), PT(47) -#if NB_SMALL_SIZE_CLASSES > 48 - , PT(48), PT(49), PT(50), PT(51), PT(52), PT(53), PT(54), PT(55) -#if NB_SMALL_SIZE_CLASSES > 56 - , PT(56), PT(57), PT(58), PT(59), PT(60), PT(61), PT(62), PT(63) -#if NB_SMALL_SIZE_CLASSES > 64 -#error "NB_SMALL_SIZE_CLASSES should be less than 64" -#endif /* NB_SMALL_SIZE_CLASSES > 64 */ -#endif /* NB_SMALL_SIZE_CLASSES > 56 */ -#endif /* NB_SMALL_SIZE_CLASSES > 48 */ -#endif /* NB_SMALL_SIZE_CLASSES > 40 */ -#endif /* NB_SMALL_SIZE_CLASSES > 32 */ -#endif /* NB_SMALL_SIZE_CLASSES > 24 */ -#endif /* NB_SMALL_SIZE_CLASSES > 16 */ -#endif /* NB_SMALL_SIZE_CLASSES > 8 */ -}; - -/*========================================================================== -Arena management. - -`arenas` is a vector of arena_objects. It contains maxarenas entries, some of -which may not be currently used (== they're arena_objects that aren't -currently associated with an allocated arena). Note that arenas proper are -separately malloc'ed. - -Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, -we do try to free() arenas, and use some mild heuristic strategies to increase -the likelihood that arenas eventually can be freed. - -unused_arena_objects - - This is a singly-linked list of the arena_objects that are currently not - being used (no arena is associated with them). Objects are taken off the - head of the list in new_arena(), and are pushed on the head of the list in - PyObject_Free() when the arena is empty. Key invariant: an arena_object - is on this list if and only if its .address member is 0. - -usable_arenas - - This is a doubly-linked list of the arena_objects associated with arenas - that have pools available. These pools are either waiting to be reused, - or have not been used before. The list is sorted to have the most- - allocated arenas first (ascending order based on the nfreepools member). - This means that the next allocation will come from a heavily used arena, - which gives the nearly empty arenas a chance to be returned to the system. - In my unscientific tests this dramatically improved the number of arenas - that could be freed. - -Note that an arena_object associated with an arena all of whose pools are -currently in use isn't on either list. -*/ - -/* Array of objects used to track chunks of memory (arenas). */ -static struct arena_object* arenas = NULL; -/* Number of slots currently allocated in the `arenas` vector. */ -static uint maxarenas = 0; - -/* The head of the singly-linked, NULL-terminated list of available - * arena_objects. - */ -static struct arena_object* unused_arena_objects = NULL; - -/* The head of the doubly-linked, NULL-terminated at each end, list of - * arena_objects associated with arenas that have pools available. - */ -static struct arena_object* usable_arenas = NULL; - -/* How many arena_objects do we initially allocate? - * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the - * `arenas` vector. - */ -#define INITIAL_ARENA_OBJECTS 16 - -/* Number of arenas allocated that haven't been free()'d. */ -static size_t narenas_currently_allocated = 0; - -/* Total number of times malloc() called to allocate an arena. */ -static size_t ntimes_arena_allocated = 0; -/* High water mark (max value ever seen) for narenas_currently_allocated. */ -static size_t narenas_highwater = 0; - -static Py_ssize_t _Py_AllocatedBlocks = 0; - Py_ssize_t _Py_GetAllocatedBlocks(void) { - return _Py_AllocatedBlocks; + return _PyRuntime.mem.num_allocated_blocks; } @@ -1035,7 +581,7 @@ new_arena(void) if (debug_stats) _PyObject_DebugMallocStats(stderr); - if (unused_arena_objects == NULL) { + if (_PyRuntime.mem.unused_arena_objects == NULL) { uint i; uint numarenas; size_t nbytes; @@ -1043,18 +589,18 @@ new_arena(void) /* Double the number of arena objects on each allocation. * Note that it's possible for `numarenas` to overflow. */ - numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; - if (numarenas <= maxarenas) + numarenas = _PyRuntime.mem.maxarenas ? _PyRuntime.mem.maxarenas << 1 : INITIAL_ARENA_OBJECTS; + if (numarenas <= _PyRuntime.mem.maxarenas) return NULL; /* overflow */ #if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > SIZE_MAX / sizeof(*arenas)) + if (numarenas > SIZE_MAX / sizeof(*_PyRuntime.mem.arenas)) return NULL; /* overflow */ #endif - nbytes = numarenas * sizeof(*arenas); - arenaobj = (struct arena_object *)PyMem_RawRealloc(arenas, nbytes); + nbytes = numarenas * sizeof(*_PyRuntime.mem.arenas); + arenaobj = (struct arena_object *)PyMem_RawRealloc(_PyRuntime.mem.arenas, nbytes); if (arenaobj == NULL) return NULL; - arenas = arenaobj; + _PyRuntime.mem.arenas = arenaobj; /* We might need to fix pointers that were copied. However, * new_arena only gets called when all the pages in the @@ -1062,45 +608,45 @@ new_arena(void) * into the old array. Thus, we don't have to worry about * invalid pointers. Just to be sure, some asserts: */ - assert(usable_arenas == NULL); - assert(unused_arena_objects == NULL); + assert(_PyRuntime.mem.usable_arenas == NULL); + assert(_PyRuntime.mem.unused_arena_objects == NULL); /* Put the new arenas on the unused_arena_objects list. */ - for (i = maxarenas; i < numarenas; ++i) { - arenas[i].address = 0; /* mark as unassociated */ - arenas[i].nextarena = i < numarenas - 1 ? - &arenas[i+1] : NULL; + for (i = _PyRuntime.mem.maxarenas; i < numarenas; ++i) { + _PyRuntime.mem.arenas[i].address = 0; /* mark as unassociated */ + _PyRuntime.mem.arenas[i].nextarena = i < numarenas - 1 ? + &_PyRuntime.mem.arenas[i+1] : NULL; } /* Update globals. */ - unused_arena_objects = &arenas[maxarenas]; - maxarenas = numarenas; + _PyRuntime.mem.unused_arena_objects = &_PyRuntime.mem.arenas[_PyRuntime.mem.maxarenas]; + _PyRuntime.mem.maxarenas = numarenas; } /* Take the next available arena object off the head of the list. */ - assert(unused_arena_objects != NULL); - arenaobj = unused_arena_objects; - unused_arena_objects = arenaobj->nextarena; + assert(_PyRuntime.mem.unused_arena_objects != NULL); + arenaobj = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = arenaobj->nextarena; assert(arenaobj->address == 0); - address = _PyObject_Arena.alloc(_PyObject_Arena.ctx, ARENA_SIZE); + address = _PyRuntime.obj.allocator_arenas.alloc(_PyRuntime.obj.allocator_arenas.ctx, ARENA_SIZE); if (address == NULL) { /* The allocation failed: return NULL after putting the * arenaobj back. */ - arenaobj->nextarena = unused_arena_objects; - unused_arena_objects = arenaobj; + arenaobj->nextarena = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = arenaobj; return NULL; } arenaobj->address = (uintptr_t)address; - ++narenas_currently_allocated; - ++ntimes_arena_allocated; - if (narenas_currently_allocated > narenas_highwater) - narenas_highwater = narenas_currently_allocated; + ++_PyRuntime.mem.narenas_currently_allocated; + ++_PyRuntime.mem.ntimes_arena_allocated; + if (_PyRuntime.mem.narenas_currently_allocated > _PyRuntime.mem.narenas_highwater) + _PyRuntime.mem.narenas_highwater = _PyRuntime.mem.narenas_currently_allocated; arenaobj->freepools = NULL; /* pool_address <- first pool-aligned address in the arena nfreepools <- number of whole pools that fit after alignment */ - arenaobj->pool_address = (block*)arenaobj->address; + arenaobj->pool_address = (pyblock*)arenaobj->address; arenaobj->nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * arenaobj->nfreepools == ARENA_SIZE); excess = (uint)(arenaobj->address & POOL_SIZE_MASK); @@ -1197,9 +743,9 @@ address_in_range(void *p, poolp pool) // the GIL. The following dance forces the compiler to read pool->arenaindex // only once. uint arenaindex = *((volatile uint *)&pool->arenaindex); - return arenaindex < maxarenas && - (uintptr_t)p - arenas[arenaindex].address < ARENA_SIZE && - arenas[arenaindex].address != 0; + return arenaindex < _PyRuntime.mem.maxarenas && + (uintptr_t)p - _PyRuntime.mem.arenas[arenaindex].address < ARENA_SIZE && + _PyRuntime.mem.arenas[arenaindex].address != 0; } /*==========================================================================*/ @@ -1220,12 +766,12 @@ static void * _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) { size_t nbytes; - block *bp; + pyblock *bp; poolp pool; poolp next; uint size; - _Py_AllocatedBlocks++; + _PyRuntime.mem.num_allocated_blocks++; assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize); nbytes = nelem * elsize; @@ -1246,7 +792,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * Most frequent paths first */ size = (uint)(nbytes - 1) >> ALIGNMENT_SHIFT; - pool = usedpools[size + size]; + pool = _PyRuntime.mem.usedpools[size + size]; if (pool != pool->nextpool) { /* * There is a used pool for this size class. @@ -1255,7 +801,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) ++pool->ref.count; bp = pool->freeblock; assert(bp != NULL); - if ((pool->freeblock = *(block **)bp) != NULL) { + if ((pool->freeblock = *(pyblock **)bp) != NULL) { UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1266,10 +812,10 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ if (pool->nextoffset <= pool->maxnextoffset) { /* There is room for another block. */ - pool->freeblock = (block*)pool + + pool->freeblock = (pyblock*)pool + pool->nextoffset; pool->nextoffset += INDEX2SIZE(size); - *(block **)(pool->freeblock) = NULL; + *(pyblock **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1289,29 +835,29 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) /* There isn't a pool of the right size class immediately * available: use a free pool. */ - if (usable_arenas == NULL) { + if (_PyRuntime.mem.usable_arenas == NULL) { /* No arena has a free pool: allocate a new arena. */ #ifdef WITH_MEMORY_LIMITS - if (narenas_currently_allocated >= MAX_ARENAS) { + if (_PyRuntime.mem.narenas_currently_allocated >= MAX_ARENAS) { UNLOCK(); goto redirect; } #endif - usable_arenas = new_arena(); - if (usable_arenas == NULL) { + _PyRuntime.mem.usable_arenas = new_arena(); + if (_PyRuntime.mem.usable_arenas == NULL) { UNLOCK(); goto redirect; } - usable_arenas->nextarena = - usable_arenas->prevarena = NULL; + _PyRuntime.mem.usable_arenas->nextarena = + _PyRuntime.mem.usable_arenas->prevarena = NULL; } - assert(usable_arenas->address != 0); + assert(_PyRuntime.mem.usable_arenas->address != 0); /* Try to get a cached free pool. */ - pool = usable_arenas->freepools; + pool = _PyRuntime.mem.usable_arenas->freepools; if (pool != NULL) { /* Unlink from cached pools. */ - usable_arenas->freepools = pool->nextpool; + _PyRuntime.mem.usable_arenas->freepools = pool->nextpool; /* This arena already had the smallest nfreepools * value, so decreasing nfreepools doesn't change @@ -1320,18 +866,18 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * become wholly allocated, we need to remove its * arena_object from usable_arenas. */ - --usable_arenas->nfreepools; - if (usable_arenas->nfreepools == 0) { + --_PyRuntime.mem.usable_arenas->nfreepools; + if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { /* Wholly allocated: remove. */ - assert(usable_arenas->freepools == NULL); - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); - - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); + assert(_PyRuntime.mem.usable_arenas->freepools == NULL); + assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || + _PyRuntime.mem.usable_arenas->nextarena->prevarena == + _PyRuntime.mem.usable_arenas); + + _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; + if (_PyRuntime.mem.usable_arenas != NULL) { + _PyRuntime.mem.usable_arenas->prevarena = NULL; + assert(_PyRuntime.mem.usable_arenas->address != 0); } } else { @@ -1340,14 +886,14 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * off all the arena's pools for the first * time. */ - assert(usable_arenas->freepools != NULL || - usable_arenas->pool_address <= - (block*)usable_arenas->address + + assert(_PyRuntime.mem.usable_arenas->freepools != NULL || + _PyRuntime.mem.usable_arenas->pool_address <= + (pyblock*)_PyRuntime.mem.usable_arenas->address + ARENA_SIZE - POOL_SIZE); } init_pool: /* Frontlink to used pools. */ - next = usedpools[size + size]; /* == prev */ + next = _PyRuntime.mem.usedpools[size + size]; /* == prev */ pool->nextpool = next; pool->prevpool = next; next->nextpool = pool; @@ -1360,7 +906,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ bp = pool->freeblock; assert(bp != NULL); - pool->freeblock = *(block **)bp; + pool->freeblock = *(pyblock **)bp; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1373,11 +919,11 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ pool->szidx = size; size = INDEX2SIZE(size); - bp = (block *)pool + POOL_OVERHEAD; + bp = (pyblock *)pool + POOL_OVERHEAD; pool->nextoffset = POOL_OVERHEAD + (size << 1); pool->maxnextoffset = POOL_SIZE - size; pool->freeblock = bp + size; - *(block **)(pool->freeblock) = NULL; + *(pyblock **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1385,26 +931,26 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) } /* Carve off a new pool. */ - assert(usable_arenas->nfreepools > 0); - assert(usable_arenas->freepools == NULL); - pool = (poolp)usable_arenas->pool_address; - assert((block*)pool <= (block*)usable_arenas->address + - ARENA_SIZE - POOL_SIZE); - pool->arenaindex = (uint)(usable_arenas - arenas); - assert(&arenas[pool->arenaindex] == usable_arenas); + assert(_PyRuntime.mem.usable_arenas->nfreepools > 0); + assert(_PyRuntime.mem.usable_arenas->freepools == NULL); + pool = (poolp)_PyRuntime.mem.usable_arenas->pool_address; + assert((pyblock*)pool <= (pyblock*)_PyRuntime.mem.usable_arenas->address + + ARENA_SIZE - POOL_SIZE); + pool->arenaindex = (uint)(_PyRuntime.mem.usable_arenas - _PyRuntime.mem.arenas); + assert(&_PyRuntime.mem.arenas[pool->arenaindex] == _PyRuntime.mem.usable_arenas); pool->szidx = DUMMY_SIZE_IDX; - usable_arenas->pool_address += POOL_SIZE; - --usable_arenas->nfreepools; + _PyRuntime.mem.usable_arenas->pool_address += POOL_SIZE; + --_PyRuntime.mem.usable_arenas->nfreepools; - if (usable_arenas->nfreepools == 0) { - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); + if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { + assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || + _PyRuntime.mem.usable_arenas->nextarena->prevarena == + _PyRuntime.mem.usable_arenas); /* Unlink the arena: it is completely allocated. */ - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); + _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; + if (_PyRuntime.mem.usable_arenas != NULL) { + _PyRuntime.mem.usable_arenas->prevarena = NULL; + assert(_PyRuntime.mem.usable_arenas->address != 0); } } @@ -1426,7 +972,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) else result = PyMem_RawMalloc(nbytes); if (!result) - _Py_AllocatedBlocks--; + _PyRuntime.mem.num_allocated_blocks--; return result; } } @@ -1449,14 +995,14 @@ static void _PyObject_Free(void *ctx, void *p) { poolp pool; - block *lastfree; + pyblock *lastfree; poolp next, prev; uint size; if (p == NULL) /* free(NULL) has no effect */ return; - _Py_AllocatedBlocks--; + _PyRuntime.mem.num_allocated_blocks--; #ifdef WITH_VALGRIND if (UNLIKELY(running_on_valgrind > 0)) @@ -1474,8 +1020,8 @@ _PyObject_Free(void *ctx, void *p) * list in any case). */ assert(pool->ref.count > 0); /* else it was empty */ - *(block **)p = lastfree = pool->freeblock; - pool->freeblock = (block *)p; + *(pyblock **)p = lastfree = pool->freeblock; + pool->freeblock = (pyblock *)p; if (lastfree) { struct arena_object* ao; uint nf; /* ao->nfreepools */ @@ -1501,7 +1047,7 @@ _PyObject_Free(void *ctx, void *p) /* Link the pool to freepools. This is a singly-linked * list, and pool->prevpool isn't used there. */ - ao = &arenas[pool->arenaindex]; + ao = &_PyRuntime.mem.arenas[pool->arenaindex]; pool->nextpool = ao->freepools; ao->freepools = pool; nf = ++ao->nfreepools; @@ -1530,9 +1076,9 @@ _PyObject_Free(void *ctx, void *p) * usable_arenas pointer. */ if (ao->prevarena == NULL) { - usable_arenas = ao->nextarena; - assert(usable_arenas == NULL || - usable_arenas->address != 0); + _PyRuntime.mem.usable_arenas = ao->nextarena; + assert(_PyRuntime.mem.usable_arenas == NULL || + _PyRuntime.mem.usable_arenas->address != 0); } else { assert(ao->prevarena->nextarena == ao); @@ -1548,14 +1094,14 @@ _PyObject_Free(void *ctx, void *p) /* Record that this arena_object slot is * available to be reused. */ - ao->nextarena = unused_arena_objects; - unused_arena_objects = ao; + ao->nextarena = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = ao; /* Free the entire arena. */ - _PyObject_Arena.free(_PyObject_Arena.ctx, + _PyRuntime.obj.allocator_arenas.free(_PyRuntime.obj.allocator_arenas.ctx, (void *)ao->address, ARENA_SIZE); ao->address = 0; /* mark unassociated */ - --narenas_currently_allocated; + --_PyRuntime.mem.narenas_currently_allocated; UNLOCK(); return; @@ -1566,12 +1112,12 @@ _PyObject_Free(void *ctx, void *p) * ao->nfreepools was 0 before, ao isn't * currently on the usable_arenas list. */ - ao->nextarena = usable_arenas; + ao->nextarena = _PyRuntime.mem.usable_arenas; ao->prevarena = NULL; - if (usable_arenas) - usable_arenas->prevarena = ao; - usable_arenas = ao; - assert(usable_arenas->address != 0); + if (_PyRuntime.mem.usable_arenas) + _PyRuntime.mem.usable_arenas->prevarena = ao; + _PyRuntime.mem.usable_arenas = ao; + assert(_PyRuntime.mem.usable_arenas->address != 0); UNLOCK(); return; @@ -1601,8 +1147,8 @@ _PyObject_Free(void *ctx, void *p) } else { /* ao is at the head of the list */ - assert(usable_arenas == ao); - usable_arenas = ao->nextarena; + assert(_PyRuntime.mem.usable_arenas == ao); + _PyRuntime.mem.usable_arenas = ao->nextarena; } ao->nextarena->prevarena = ao->prevarena; @@ -1631,7 +1177,7 @@ _PyObject_Free(void *ctx, void *p) nf > ao->prevarena->nfreepools); assert(ao->nextarena == NULL || ao->nextarena->prevarena == ao); - assert((usable_arenas == ao && + assert((_PyRuntime.mem.usable_arenas == ao && ao->prevarena == NULL) || ao->prevarena->nextarena == ao); @@ -1647,7 +1193,7 @@ _PyObject_Free(void *ctx, void *p) --pool->ref.count; assert(pool->ref.count > 0); /* else the pool is empty */ size = pool->szidx; - next = usedpools[size + size]; + next = _PyRuntime.mem.usedpools[size + size]; prev = next->prevpool; /* insert pool before next: prev <-> pool <-> next */ pool->nextpool = next; @@ -1769,15 +1315,13 @@ _Py_GetAllocatedBlocks(void) #define DEADBYTE 0xDB /* dead (newly freed) memory */ #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ -static size_t serialno = 0; /* incremented on each debug {m,re}alloc */ - /* serialno is always incremented via calling this routine. The point is * to supply a single place to set a breakpoint. */ static void bumpserialno(void) { - ++serialno; + ++_PyRuntime.mem.serialno; } #define SST SIZEOF_SIZE_T @@ -1868,7 +1412,7 @@ _PyMem_DebugRawAlloc(int use_calloc, void *ctx, size_t nbytes) /* at tail, write pad (SST bytes) and serialno (SST bytes) */ tail = p + 2*SST + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); + write_size_t(tail + SST, _PyRuntime.mem.serialno); return p + 2*SST; } @@ -1953,7 +1497,7 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes) tail = q + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); + write_size_t(tail + SST, _PyRuntime.mem.serialno); if (nbytes > original_nbytes) { /* growing: mark new extra memory clean */ @@ -2285,16 +1829,16 @@ _PyObject_DebugMallocStats(FILE *out) * to march over all the arenas. If we're lucky, most of the memory * will be living in full pools -- would be a shame to miss them. */ - for (i = 0; i < maxarenas; ++i) { + for (i = 0; i < _PyRuntime.mem.maxarenas; ++i) { uint j; - uintptr_t base = arenas[i].address; + uintptr_t base = _PyRuntime.mem.arenas[i].address; /* Skip arenas which are not allocated. */ - if (arenas[i].address == (uintptr_t)NULL) + if (_PyRuntime.mem.arenas[i].address == (uintptr_t)NULL) continue; narenas += 1; - numfreepools += arenas[i].nfreepools; + numfreepools += _PyRuntime.mem.arenas[i].nfreepools; /* round up to pool alignment */ if (base & (uintptr_t)POOL_SIZE_MASK) { @@ -2304,8 +1848,8 @@ _PyObject_DebugMallocStats(FILE *out) } /* visit every pool in the arena */ - assert(base <= (uintptr_t) arenas[i].pool_address); - for (j = 0; base < (uintptr_t) arenas[i].pool_address; + assert(base <= (uintptr_t) _PyRuntime.mem.arenas[i].pool_address); + for (j = 0; base < (uintptr_t) _PyRuntime.mem.arenas[i].pool_address; ++j, base += POOL_SIZE) { poolp p = (poolp)base; const uint sz = p->szidx; @@ -2314,7 +1858,7 @@ _PyObject_DebugMallocStats(FILE *out) if (p->ref.count == 0) { /* currently unused */ #ifdef Py_DEBUG - assert(pool_is_in_list(p, arenas[i].freepools)); + assert(pool_is_in_list(p, _PyRuntime.mem.arenas[i].freepools)); #endif continue; } @@ -2324,11 +1868,11 @@ _PyObject_DebugMallocStats(FILE *out) numfreeblocks[sz] += freeblocks; #ifdef Py_DEBUG if (freeblocks > 0) - assert(pool_is_in_list(p, usedpools[sz + sz])); + assert(pool_is_in_list(p, _PyRuntime.mem.usedpools[sz + sz])); #endif } } - assert(narenas == narenas_currently_allocated); + assert(narenas == _PyRuntime.mem.narenas_currently_allocated); fputc('\n', out); fputs("class size num pools blocks in use avail blocks\n" @@ -2356,10 +1900,10 @@ _PyObject_DebugMallocStats(FILE *out) } fputc('\n', out); if (_PyMem_DebugEnabled()) - (void)printone(out, "# times object malloc called", serialno); - (void)printone(out, "# arenas allocated total", ntimes_arena_allocated); - (void)printone(out, "# arenas reclaimed", ntimes_arena_allocated - narenas); - (void)printone(out, "# arenas highwater mark", narenas_highwater); + (void)printone(out, "# times object malloc called", _PyRuntime.mem.serialno); + (void)printone(out, "# arenas allocated total", _PyRuntime.mem.ntimes_arena_allocated); + (void)printone(out, "# arenas reclaimed", _PyRuntime.mem.ntimes_arena_allocated - narenas); + (void)printone(out, "# arenas highwater mark", _PyRuntime.mem.narenas_highwater); (void)printone(out, "# arenas allocated current", narenas); PyOS_snprintf(buf, sizeof(buf), diff --git a/Objects/setobject.c b/Objects/setobject.c index 219e81d0baf..6001f7b6f43 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1115,6 +1115,7 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } /* The empty frozenset is a singleton */ if (emptyfrozenset == NULL) + /* There is a possible (relatively harmless) race here. */ emptyfrozenset = make_new_set(type, NULL); Py_XINCREF(emptyfrozenset); return emptyfrozenset; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 1d963aae3f8..6bf474a7d1f 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1157,10 +1157,10 @@ subtype_dealloc(PyObject *self) /* UnTrack and re-Track around the trashcan macro, alas */ /* See explanation at end of function for full disclosure */ PyObject_GC_UnTrack(self); - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_BEGIN(self); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; -- tstate->trash_delete_nesting; /* Find the nearest base with a different tp_dealloc */ @@ -1254,10 +1254,10 @@ subtype_dealloc(PyObject *self) Py_DECREF(type); endlabel: - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_END(self); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; -- tstate->trash_delete_nesting; /* Explanation of the weirdness around the trashcan macros: @@ -1297,7 +1297,7 @@ subtype_dealloc(PyObject *self) a subtle disaster. Q. Why the bizarre (net-zero) manipulation of - _PyTrash_delete_nesting around the trashcan macros? + _PyRuntime.trash_delete_nesting around the trashcan macros? A. Some base classes (e.g. list) also use the trashcan mechanism. The following scenario used to be possible: diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 8ebb22e0e2b..5db80b6cf7c 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -106,6 +106,14 @@ + + + + + + + + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index cbe1a3943ff..e5a9b6293c8 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -129,6 +129,30 @@ Include + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + Include diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c index e386248c2f8..fd927c0a96b 100644 --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -21,10 +21,12 @@ #include "node.h" #include "parsetok.h" #include "pgen.h" +#include "internal/_mem.h" int Py_DebugFlag; int Py_VerboseFlag; int Py_IgnoreEnvironmentFlag; +struct pyruntimestate _PyRuntime = {}; /* Forward */ grammar *getgrammar(const char *filename); @@ -61,6 +63,8 @@ main(int argc, char **argv) filename = argv[1]; graminit_h = argv[2]; graminit_c = argv[3]; + _PyObject_Initialize(&_PyRuntime.obj); + _PyMem_Initialize(&_PyRuntime.mem); g = getgrammar(filename); fp = fopen(graminit_c, "w"); if (fp == NULL) { diff --git a/Python/_warnings.c b/Python/_warnings.c index 8616195c4e3..a5e42a31dc4 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -8,13 +8,6 @@ PyDoc_STRVAR(warnings__doc__, MODULE_NAME " provides basic warning filtering support.\n" "It is a helper module to speed up interpreter start-up."); -/* Both 'filters' and 'onceregistry' can be set in warnings.py; - get_warnings_attr() will reset these variables accordingly. */ -static PyObject *_filters; /* List */ -static PyObject *_once_registry; /* Dict */ -static PyObject *_default_action; /* String */ -static long _filters_version; - _Py_IDENTIFIER(argv); _Py_IDENTIFIER(stderr); @@ -53,7 +46,7 @@ get_warnings_attr(const char *attr, int try_import) } /* don't try to import after the start of the Python finallization */ - if (try_import && _Py_Finalizing == NULL) { + if (try_import && !_Py_IS_FINALIZING()) { warnings_module = PyImport_Import(warnings_str); if (warnings_module == NULL) { /* Fallback to the C implementation if we cannot get @@ -90,10 +83,10 @@ get_once_registry(void) if (registry == NULL) { if (PyErr_Occurred()) return NULL; - return _once_registry; + return _PyRuntime.warnings.once_registry; } - Py_DECREF(_once_registry); - _once_registry = registry; + Py_DECREF(_PyRuntime.warnings.once_registry); + _PyRuntime.warnings.once_registry = registry; return registry; } @@ -108,11 +101,11 @@ get_default_action(void) if (PyErr_Occurred()) { return NULL; } - return _default_action; + return _PyRuntime.warnings.default_action; } - Py_DECREF(_default_action); - _default_action = default_action; + Py_DECREF(_PyRuntime.warnings.default_action); + _PyRuntime.warnings.default_action = default_action; return default_action; } @@ -132,23 +125,24 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, return NULL; } else { - Py_DECREF(_filters); - _filters = warnings_filters; + Py_DECREF(_PyRuntime.warnings.filters); + _PyRuntime.warnings.filters = warnings_filters; } - if (_filters == NULL || !PyList_Check(_filters)) { + PyObject *filters = _PyRuntime.warnings.filters; + if (filters == NULL || !PyList_Check(filters)) { PyErr_SetString(PyExc_ValueError, MODULE_NAME ".filters must be a list"); return NULL; } - /* _filters could change while we are iterating over it. */ - for (i = 0; i < PyList_GET_SIZE(_filters); i++) { + /* _PyRuntime.warnings.filters could change while we are iterating over it. */ + for (i = 0; i < PyList_GET_SIZE(filters); i++) { PyObject *tmp_item, *action, *msg, *cat, *mod, *ln_obj; Py_ssize_t ln; int is_subclass, good_msg, good_mod; - tmp_item = PyList_GET_ITEM(_filters, i); + tmp_item = PyList_GET_ITEM(filters, i); if (!PyTuple_Check(tmp_item) || PyTuple_GET_SIZE(tmp_item) != 5) { PyErr_Format(PyExc_ValueError, MODULE_NAME ".filters item %zd isn't a 5-tuple", i); @@ -220,9 +214,9 @@ already_warned(PyObject *registry, PyObject *key, int should_set) version_obj = _PyDict_GetItemId(registry, &PyId_version); if (version_obj == NULL || !PyLong_CheckExact(version_obj) - || PyLong_AsLong(version_obj) != _filters_version) { + || PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) { PyDict_Clear(registry); - version_obj = PyLong_FromLong(_filters_version); + version_obj = PyLong_FromLong(_PyRuntime.warnings.filters_version); if (version_obj == NULL) return -1; if (_PyDict_SetItemId(registry, &PyId_version, version_obj) < 0) { @@ -520,7 +514,7 @@ warn_explicit(PyObject *category, PyObject *message, if (registry == NULL) goto cleanup; } - /* _once_registry[(text, category)] = 1 */ + /* _PyRuntime.warnings.once_registry[(text, category)] = 1 */ rc = update_registry(registry, text, category, 0); } else if (_PyUnicode_EqualToASCIIString(action, "module")) { @@ -910,7 +904,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) static PyObject * warnings_filters_mutated(PyObject *self, PyObject *args) { - _filters_version++; + _PyRuntime.warnings.filters_version++; Py_RETURN_NONE; } @@ -1160,7 +1154,8 @@ create_filter(PyObject *category, const char *action) } /* This assumes the line number is zero for now. */ - return PyTuple_Pack(5, action_obj, Py_None, category, Py_None, _PyLong_Zero); + return PyTuple_Pack(5, action_obj, Py_None, + category, Py_None, _PyLong_Zero); } static PyObject * @@ -1228,33 +1223,35 @@ _PyWarnings_Init(void) if (m == NULL) return NULL; - if (_filters == NULL) { - _filters = init_filters(); - if (_filters == NULL) + if (_PyRuntime.warnings.filters == NULL) { + _PyRuntime.warnings.filters = init_filters(); + if (_PyRuntime.warnings.filters == NULL) return NULL; } - Py_INCREF(_filters); - if (PyModule_AddObject(m, "filters", _filters) < 0) + Py_INCREF(_PyRuntime.warnings.filters); + if (PyModule_AddObject(m, "filters", _PyRuntime.warnings.filters) < 0) return NULL; - if (_once_registry == NULL) { - _once_registry = PyDict_New(); - if (_once_registry == NULL) + if (_PyRuntime.warnings.once_registry == NULL) { + _PyRuntime.warnings.once_registry = PyDict_New(); + if (_PyRuntime.warnings.once_registry == NULL) return NULL; } - Py_INCREF(_once_registry); - if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) + Py_INCREF(_PyRuntime.warnings.once_registry); + if (PyModule_AddObject(m, "_onceregistry", + _PyRuntime.warnings.once_registry) < 0) return NULL; - if (_default_action == NULL) { - _default_action = PyUnicode_FromString("default"); - if (_default_action == NULL) + if (_PyRuntime.warnings.default_action == NULL) { + _PyRuntime.warnings.default_action = PyUnicode_FromString("default"); + if (_PyRuntime.warnings.default_action == NULL) return NULL; } - Py_INCREF(_default_action); - if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) + Py_INCREF(_PyRuntime.warnings.default_action); + if (PyModule_AddObject(m, "_defaultaction", + _PyRuntime.warnings.default_action) < 0) return NULL; - _filters_version = 0; + _PyRuntime.warnings.filters_version = 0; return m; } diff --git a/Python/ceval.c b/Python/ceval.c index 436e5cad25f..9741c15b892 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -36,7 +36,8 @@ extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **); typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *); /* Forward declarations */ -Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *); +Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, + PyObject *); static PyObject * do_call_core(PyObject *, PyObject *, PyObject *); #ifdef LLTRACE @@ -52,13 +53,15 @@ static int call_trace_protected(Py_tracefunc, PyObject *, static void call_exc_trace(Py_tracefunc, PyObject *, PyThreadState *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, - PyThreadState *, PyFrameObject *, int *, int *, int *); + PyThreadState *, PyFrameObject *, + int *, int *, int *); static void maybe_dtrace_line(PyFrameObject *, int *, int *, int *); static void dtrace_function_entry(PyFrameObject *); static void dtrace_function_return(PyFrameObject *); static PyObject * cmp_outcome(int, PyObject *, PyObject *); -static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, PyObject *); +static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, + PyObject *); static PyObject * import_from(PyObject *, PyObject *); static int import_all_from(PyObject *, PyObject *); static void format_exc_check_arg(PyObject *, const char *, PyObject *); @@ -88,7 +91,7 @@ static long dxp[256]; #endif #ifdef WITH_THREAD -#define GIL_REQUEST _Py_atomic_load_relaxed(&gil_drop_request) +#define GIL_REQUEST _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) #else #define GIL_REQUEST 0 #endif @@ -98,22 +101,22 @@ static long dxp[256]; the GIL eventually anyway. */ #define COMPUTE_EVAL_BREAKER() \ _Py_atomic_store_relaxed( \ - &eval_breaker, \ + &_PyRuntime.ceval.eval_breaker, \ GIL_REQUEST | \ - _Py_atomic_load_relaxed(&pendingcalls_to_do) | \ - pending_async_exc) + _Py_atomic_load_relaxed(&_PyRuntime.ceval.pending.calls_to_do) | \ + _PyRuntime.ceval.pending.async_exc) #ifdef WITH_THREAD #define SET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&gil_drop_request, 1); \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define RESET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&gil_drop_request, 0); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) @@ -122,34 +125,28 @@ static long dxp[256]; /* Pending calls are only modified under pending_lock */ #define SIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&pendingcalls_to_do, 1); \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define UNSIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&pendingcalls_to_do, 0); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) #define SIGNAL_ASYNC_EXC() \ do { \ - pending_async_exc = 1; \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _PyRuntime.ceval.pending.async_exc = 1; \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define UNSIGNAL_ASYNC_EXC() \ - do { pending_async_exc = 0; COMPUTE_EVAL_BREAKER(); } while (0) - + do { \ + _PyRuntime.ceval.pending.async_exc = 0; \ + COMPUTE_EVAL_BREAKER(); \ + } while (0) -/* This single variable consolidates all requests to break out of the fast path - in the eval loop. */ -static _Py_atomic_int eval_breaker = {0}; -/* Request for running pending calls. */ -static _Py_atomic_int pendingcalls_to_do = {0}; -/* Request for looking at the `async_exc` field of the current thread state. - Guarded by the GIL. */ -static int pending_async_exc = 0; #ifdef WITH_THREAD @@ -157,12 +154,6 @@ static int pending_async_exc = 0; #include #endif #include "pythread.h" - -static PyThread_type_lock pending_lock = 0; /* for pending calls */ -static unsigned long main_thread = 0; -/* Request for dropping the GIL */ -static _Py_atomic_int gil_drop_request = {0}; - #include "ceval_gil.h" int @@ -178,9 +169,9 @@ PyEval_InitThreads(void) return; create_gil(); take_gil(PyThreadState_GET()); - main_thread = PyThread_get_thread_ident(); - if (!pending_lock) - pending_lock = PyThread_allocate_lock(); + _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); + if (!_PyRuntime.ceval.pending.lock) + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); } void @@ -248,9 +239,9 @@ PyEval_ReInitThreads(void) if (!gil_created()) return; recreate_gil(); - pending_lock = PyThread_allocate_lock(); + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); take_gil(current_tstate); - main_thread = PyThread_get_thread_ident(); + _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); /* Destroy all threads except the current one */ _PyThreadState_DeleteExcept(current_tstate); @@ -294,7 +285,7 @@ PyEval_RestoreThread(PyThreadState *tstate) int err = errno; take_gil(tstate); /* _Py_Finalizing is protected by the GIL */ - if (_Py_Finalizing && tstate != _Py_Finalizing) { + if (_Py_IS_FINALIZING() && !_Py_CURRENTLY_FINALIZING(tstate)) { drop_gil(tstate); PyThread_exit_thread(); assert(0); /* unreachable */ @@ -346,19 +337,11 @@ _PyEval_SignalReceived(void) callback. */ -#define NPENDINGCALLS 32 -static struct { - int (*func)(void *); - void *arg; -} pendingcalls[NPENDINGCALLS]; -static int pendingfirst = 0; -static int pendinglast = 0; - int Py_AddPendingCall(int (*func)(void *), void *arg) { int i, j, result=0; - PyThread_type_lock lock = pending_lock; + PyThread_type_lock lock = _PyRuntime.ceval.pending.lock; /* try a few times for the lock. Since this mechanism is used * for signal handling (on the main thread), there is a (slim) @@ -380,14 +363,14 @@ Py_AddPendingCall(int (*func)(void *), void *arg) return -1; } - i = pendinglast; + i = _PyRuntime.ceval.pending.last; j = (i + 1) % NPENDINGCALLS; - if (j == pendingfirst) { + if (j == _PyRuntime.ceval.pending.first) { result = -1; /* Queue full */ } else { - pendingcalls[i].func = func; - pendingcalls[i].arg = arg; - pendinglast = j; + _PyRuntime.ceval.pending.calls[i].func = func; + _PyRuntime.ceval.pending.calls[i].arg = arg; + _PyRuntime.ceval.pending.last = j; } /* signal main loop */ SIGNAL_PENDING_CALLS(); @@ -405,16 +388,19 @@ Py_MakePendingCalls(void) assert(PyGILState_Check()); - if (!pending_lock) { + if (!_PyRuntime.ceval.pending.lock) { /* initial allocation of the lock */ - pending_lock = PyThread_allocate_lock(); - if (pending_lock == NULL) + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + if (_PyRuntime.ceval.pending.lock == NULL) return -1; } /* only service pending calls on main thread */ - if (main_thread && PyThread_get_thread_ident() != main_thread) + if (_PyRuntime.ceval.pending.main_thread && + PyThread_get_thread_ident() != _PyRuntime.ceval.pending.main_thread) + { return 0; + } /* don't perform recursive pending calls */ if (busy) return 0; @@ -436,16 +422,16 @@ Py_MakePendingCalls(void) void *arg = NULL; /* pop one item off the queue while holding the lock */ - PyThread_acquire_lock(pending_lock, WAIT_LOCK); - j = pendingfirst; - if (j == pendinglast) { + PyThread_acquire_lock(_PyRuntime.ceval.pending.lock, WAIT_LOCK); + j = _PyRuntime.ceval.pending.first; + if (j == _PyRuntime.ceval.pending.last) { func = NULL; /* Queue empty */ } else { - func = pendingcalls[j].func; - arg = pendingcalls[j].arg; - pendingfirst = (j + 1) % NPENDINGCALLS; + func = _PyRuntime.ceval.pending.calls[j].func; + arg = _PyRuntime.ceval.pending.calls[j].arg; + _PyRuntime.ceval.pending.first = (j + 1) % NPENDINGCALLS; } - PyThread_release_lock(pending_lock); + PyThread_release_lock(_PyRuntime.ceval.pending.lock); /* having released the lock, perform the callback */ if (func == NULL) break; @@ -489,14 +475,6 @@ Py_MakePendingCalls(void) The two threads could theoretically wiggle around the "busy" variable. */ -#define NPENDINGCALLS 32 -static struct { - int (*func)(void *); - void *arg; -} pendingcalls[NPENDINGCALLS]; -static volatile int pendingfirst = 0; -static volatile int pendinglast = 0; - int Py_AddPendingCall(int (*func)(void *), void *arg) { @@ -506,15 +484,15 @@ Py_AddPendingCall(int (*func)(void *), void *arg) if (busy) return -1; busy = 1; - i = pendinglast; + i = _PyRuntime.ceval.pending.last; j = (i + 1) % NPENDINGCALLS; - if (j == pendingfirst) { + if (j == _PyRuntime.ceval.pending.first) { busy = 0; return -1; /* Queue full */ } - pendingcalls[i].func = func; - pendingcalls[i].arg = arg; - pendinglast = j; + _PyRuntime.ceval.pending.calls[i].func = func; + _PyRuntime.ceval.pending.calls[i].arg = arg; + _PyRuntime.ceval.pending.last = j; SIGNAL_PENDING_CALLS(); busy = 0; @@ -543,12 +521,12 @@ Py_MakePendingCalls(void) int i; int (*func)(void *); void *arg; - i = pendingfirst; - if (i == pendinglast) + i = _PyRuntime.ceval.pending.first; + if (i == _PyRuntime.ceval.pending.last) break; /* Queue empty */ - func = pendingcalls[i].func; - arg = pendingcalls[i].arg; - pendingfirst = (i + 1) % NPENDINGCALLS; + func = _PyRuntime.ceval.pending.calls[i].func; + arg = _PyRuntime.ceval.pending.calls[i].arg; + _PyRuntime.ceval.pending.first = (i + 1) % NPENDINGCALLS; if (func(arg) < 0) { goto error; } @@ -570,20 +548,32 @@ Py_MakePendingCalls(void) #ifndef Py_DEFAULT_RECURSION_LIMIT #define Py_DEFAULT_RECURSION_LIMIT 1000 #endif -static int recursion_limit = Py_DEFAULT_RECURSION_LIMIT; -int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; + +void +_PyEval_Initialize(struct _ceval_runtime_state *state) +{ + state->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; + state->check_recursion_limit = Py_DEFAULT_RECURSION_LIMIT; + _gil_initialize(&state->gil); +} + +int +_PyEval_CheckRecursionLimit(void) +{ + return _PyRuntime.ceval.check_recursion_limit; +} int Py_GetRecursionLimit(void) { - return recursion_limit; + return _PyRuntime.ceval.recursion_limit; } void Py_SetRecursionLimit(int new_limit) { - recursion_limit = new_limit; - _Py_CheckRecursionLimit = recursion_limit; + _PyRuntime.ceval.recursion_limit = new_limit; + _PyRuntime.ceval.check_recursion_limit = _PyRuntime.ceval.recursion_limit; } /* the macro Py_EnterRecursiveCall() only calls _Py_CheckRecursiveCall() @@ -595,6 +585,7 @@ int _Py_CheckRecursiveCall(const char *where) { PyThreadState *tstate = PyThreadState_GET(); + int recursion_limit = _PyRuntime.ceval.recursion_limit; #ifdef USE_STACKCHECK if (PyOS_CheckStack()) { @@ -603,7 +594,7 @@ _Py_CheckRecursiveCall(const char *where) return -1; } #endif - _Py_CheckRecursionLimit = recursion_limit; + _PyRuntime.ceval.check_recursion_limit = recursion_limit; if (tstate->recursion_critical) /* Somebody asked that we don't check for recursion. */ return 0; @@ -642,13 +633,7 @@ static void restore_and_clear_exc_state(PyThreadState *, PyFrameObject *); static int do_raise(PyObject *, PyObject *); static int unpack_iterable(PyObject *, int, int, PyObject **); -/* Records whether tracing is on for any thread. Counts the number of - threads for which tstate->c_tracefunc is non-NULL, so if the value - is 0, we know we don't have to check this thread's c_tracefunc. - This speeds up the if statement in PyEval_EvalFrameEx() after - fast_next_opcode*/ -static int _Py_TracingPossible = 0; - +#define _Py_TracingPossible _PyRuntime.ceval.tracing_possible PyObject * @@ -779,7 +764,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) #define DISPATCH() \ { \ - if (!_Py_atomic_load_relaxed(&eval_breaker)) { \ + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \ FAST_DISPATCH(); \ } \ continue; \ @@ -827,7 +812,8 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) /* Code access macros */ /* The integer overflow is checked by an assertion below. */ -#define INSTR_OFFSET() (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) +#define INSTR_OFFSET() \ + (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) #define NEXTOPARG() do { \ _Py_CODEUNIT word = *next_instr; \ opcode = _Py_OPCODE(word); \ @@ -1080,7 +1066,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ - if (_Py_atomic_load_relaxed(&eval_breaker)) { + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { if (_Py_OPCODE(*next_instr) == SETUP_FINALLY || _Py_OPCODE(*next_instr) == YIELD_FROM) { /* Two cases where we skip running signal handlers and other @@ -1097,12 +1083,16 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) */ goto fast_next_opcode; } - if (_Py_atomic_load_relaxed(&pendingcalls_to_do)) { + if (_Py_atomic_load_relaxed( + &_PyRuntime.ceval.pending.calls_to_do)) + { if (Py_MakePendingCalls() < 0) goto error; } #ifdef WITH_THREAD - if (_Py_atomic_load_relaxed(&gil_drop_request)) { + if (_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil_drop_request)) + { /* Give another thread a chance */ if (PyThreadState_Swap(NULL) != tstate) Py_FatalError("ceval: tstate mix-up"); @@ -1113,7 +1103,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) take_gil(tstate); /* Check if we should make a quick exit. */ - if (_Py_Finalizing && _Py_Finalizing != tstate) { + if (_Py_IS_FINALIZING() && + !_Py_CURRENTLY_FINALIZING(tstate)) + { drop_gil(tstate); PyThread_exit_thread(); } diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index a3b450bd5c4..ef5189068e0 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -8,20 +8,13 @@ /* First some general settings */ -/* microseconds (the Python API uses seconds, though) */ -#define DEFAULT_INTERVAL 5000 -static unsigned long gil_interval = DEFAULT_INTERVAL; -#define INTERVAL (gil_interval >= 1 ? gil_interval : 1) - -/* Enable if you want to force the switching of threads at least every `gil_interval` */ -#undef FORCE_SWITCHING -#define FORCE_SWITCHING +#define INTERVAL (_PyRuntime.ceval.gil.interval >= 1 ? _PyRuntime.ceval.gil.interval : 1) /* Notes about the implementation: - - The GIL is just a boolean variable (gil_locked) whose access is protected + - The GIL is just a boolean variable (locked) whose access is protected by a mutex (gil_mutex), and whose changes are signalled by a condition variable (gil_cond). gil_mutex is taken for short periods of time, and therefore mostly uncontended. @@ -48,7 +41,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; - When a thread releases the GIL and gil_drop_request is set, that thread ensures that another GIL-awaiting thread gets scheduled. It does so by waiting on a condition variable (switch_cond) until - the value of gil_last_holder is changed to something else than its + the value of last_holder is changed to something else than its own thread state pointer, indicating that another thread was able to take the GIL. @@ -60,11 +53,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; */ #include "condvar.h" -#ifndef Py_HAVE_CONDVAR -#error You need either a POSIX-compatible or a Windows system! -#endif -#define MUTEX_T PyMUTEX_T #define MUTEX_INIT(mut) \ if (PyMUTEX_INIT(&(mut))) { \ Py_FatalError("PyMUTEX_INIT(" #mut ") failed"); }; @@ -78,7 +67,6 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; if (PyMUTEX_UNLOCK(&(mut))) { \ Py_FatalError("PyMUTEX_UNLOCK(" #mut ") failed"); }; -#define COND_T PyCOND_T #define COND_INIT(cond) \ if (PyCOND_INIT(&(cond))) { \ Py_FatalError("PyCOND_INIT(" #cond ") failed"); }; @@ -103,48 +91,36 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; } \ +#define DEFAULT_INTERVAL 5000 -/* Whether the GIL is already taken (-1 if uninitialized). This is atomic - because it can be read without any lock taken in ceval.c. */ -static _Py_atomic_int gil_locked = {-1}; -/* Number of GIL switches since the beginning. */ -static unsigned long gil_switch_number = 0; -/* Last PyThreadState holding / having held the GIL. This helps us know - whether anyone else was scheduled after we dropped the GIL. */ -static _Py_atomic_address gil_last_holder = {0}; - -/* This condition variable allows one or several threads to wait until - the GIL is released. In addition, the mutex also protects the above - variables. */ -static COND_T gil_cond; -static MUTEX_T gil_mutex; - -#ifdef FORCE_SWITCHING -/* This condition variable helps the GIL-releasing thread wait for - a GIL-awaiting thread to be scheduled and take the GIL. */ -static COND_T switch_cond; -static MUTEX_T switch_mutex; -#endif - +static void _gil_initialize(struct _gil_runtime_state *state) +{ + _Py_atomic_int uninitialized = {-1}; + state->locked = uninitialized; + state->interval = DEFAULT_INTERVAL; +} static int gil_created(void) { - return _Py_atomic_load_explicit(&gil_locked, _Py_memory_order_acquire) >= 0; + return (_Py_atomic_load_explicit(&_PyRuntime.ceval.gil.locked, + _Py_memory_order_acquire) + ) >= 0; } static void create_gil(void) { - MUTEX_INIT(gil_mutex); + MUTEX_INIT(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - MUTEX_INIT(switch_mutex); + MUTEX_INIT(_PyRuntime.ceval.gil.switch_mutex); #endif - COND_INIT(gil_cond); + COND_INIT(_PyRuntime.ceval.gil.cond); #ifdef FORCE_SWITCHING - COND_INIT(switch_cond); + COND_INIT(_PyRuntime.ceval.gil.switch_cond); #endif - _Py_atomic_store_relaxed(&gil_last_holder, 0); - _Py_ANNOTATE_RWLOCK_CREATE(&gil_locked); - _Py_atomic_store_explicit(&gil_locked, 0, _Py_memory_order_release); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, 0); + _Py_ANNOTATE_RWLOCK_CREATE(&_PyRuntime.ceval.gil.locked); + _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, 0, + _Py_memory_order_release); } static void destroy_gil(void) @@ -152,54 +128,62 @@ static void destroy_gil(void) /* some pthread-like implementations tie the mutex to the cond * and must have the cond destroyed first. */ - COND_FINI(gil_cond); - MUTEX_FINI(gil_mutex); + COND_FINI(_PyRuntime.ceval.gil.cond); + MUTEX_FINI(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - COND_FINI(switch_cond); - MUTEX_FINI(switch_mutex); + COND_FINI(_PyRuntime.ceval.gil.switch_cond); + MUTEX_FINI(_PyRuntime.ceval.gil.switch_mutex); #endif - _Py_atomic_store_explicit(&gil_locked, -1, _Py_memory_order_release); - _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); + _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, -1, + _Py_memory_order_release); + _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); } static void recreate_gil(void) { - _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); + _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); /* XXX should we destroy the old OS resources here? */ create_gil(); } static void drop_gil(PyThreadState *tstate) { - if (!_Py_atomic_load_relaxed(&gil_locked)) + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) Py_FatalError("drop_gil: GIL is not locked"); /* tstate is allowed to be NULL (early interpreter init) */ if (tstate != NULL) { /* Sub-interpreter support: threads might have been switched under our feet using PyThreadState_Swap(). Fix the GIL last holder variable so that our heuristics work. */ - _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, + (uintptr_t)tstate); } - MUTEX_LOCK(gil_mutex); - _Py_ANNOTATE_RWLOCK_RELEASED(&gil_locked, /*is_write=*/1); - _Py_atomic_store_relaxed(&gil_locked, 0); - COND_SIGNAL(gil_cond); - MUTEX_UNLOCK(gil_mutex); + MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); + _Py_ANNOTATE_RWLOCK_RELEASED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 0); + COND_SIGNAL(_PyRuntime.ceval.gil.cond); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) { - MUTEX_LOCK(switch_mutex); + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) && + tstate != NULL) + { + MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); /* Not switched yet => wait */ - if ((PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder) == tstate) { + if (((PyThreadState*)_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil.last_holder) + ) == tstate) + { RESET_GIL_DROP_REQUEST(); /* NOTE: if COND_WAIT does not atomically start waiting when releasing the mutex, another thread can run through, take the GIL and drop it again, and reset the condition before we even had a chance to wait for it. */ - COND_WAIT(switch_cond, switch_mutex); + COND_WAIT(_PyRuntime.ceval.gil.switch_cond, + _PyRuntime.ceval.gil.switch_mutex); } - MUTEX_UNLOCK(switch_mutex); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); } #endif } @@ -211,60 +195,65 @@ static void take_gil(PyThreadState *tstate) Py_FatalError("take_gil: NULL tstate"); err = errno; - MUTEX_LOCK(gil_mutex); + MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); - if (!_Py_atomic_load_relaxed(&gil_locked)) + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) goto _ready; - while (_Py_atomic_load_relaxed(&gil_locked)) { + while (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) { int timed_out = 0; unsigned long saved_switchnum; - saved_switchnum = gil_switch_number; - COND_TIMED_WAIT(gil_cond, gil_mutex, INTERVAL, timed_out); + saved_switchnum = _PyRuntime.ceval.gil.switch_number; + COND_TIMED_WAIT(_PyRuntime.ceval.gil.cond, _PyRuntime.ceval.gil.mutex, + INTERVAL, timed_out); /* If we timed out and no switch occurred in the meantime, it is time to ask the GIL-holding thread to drop it. */ if (timed_out && - _Py_atomic_load_relaxed(&gil_locked) && - gil_switch_number == saved_switchnum) { + _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked) && + _PyRuntime.ceval.gil.switch_number == saved_switchnum) { SET_GIL_DROP_REQUEST(); } } _ready: #ifdef FORCE_SWITCHING - /* This mutex must be taken before modifying gil_last_holder (see drop_gil()). */ - MUTEX_LOCK(switch_mutex); + /* This mutex must be taken before modifying + _PyRuntime.ceval.gil.last_holder (see drop_gil()). */ + MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); #endif /* We now hold the GIL */ - _Py_atomic_store_relaxed(&gil_locked, 1); - _Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1); - - if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) { - _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); - ++gil_switch_number; + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 1); + _Py_ANNOTATE_RWLOCK_ACQUIRED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); + + if (tstate != (PyThreadState*)_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil.last_holder)) + { + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, + (uintptr_t)tstate); + ++_PyRuntime.ceval.gil.switch_number; } #ifdef FORCE_SWITCHING - COND_SIGNAL(switch_cond); - MUTEX_UNLOCK(switch_mutex); + COND_SIGNAL(_PyRuntime.ceval.gil.switch_cond); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); #endif - if (_Py_atomic_load_relaxed(&gil_drop_request)) { + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request)) { RESET_GIL_DROP_REQUEST(); } if (tstate->async_exc != NULL) { _PyEval_SignalAsyncExc(); } - MUTEX_UNLOCK(gil_mutex); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); errno = err; } void _PyEval_SetSwitchInterval(unsigned long microseconds) { - gil_interval = microseconds; + _PyRuntime.ceval.gil.interval = microseconds; } unsigned long _PyEval_GetSwitchInterval() { - return gil_interval; + return _PyRuntime.ceval.gil.interval; } diff --git a/Python/condvar.h b/Python/condvar.h index 9a71b17738f..aaa8043585f 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -37,27 +37,16 @@ * Condition Variable. */ -#ifndef _CONDVAR_H_ -#define _CONDVAR_H_ +#ifndef _CONDVAR_IMPL_H_ +#define _CONDVAR_IMPL_H_ #include "Python.h" - -#ifndef _POSIX_THREADS -/* This means pthreads are not implemented in libc headers, hence the macro - not present in unistd.h. But they still can be implemented as an external - library (e.g. gnu pth in pthread emulation) */ -# ifdef HAVE_PTHREAD_H -# include /* _POSIX_THREADS */ -# endif -#endif +#include "internal/_condvar.h" #ifdef _POSIX_THREADS /* * POSIX support */ -#define Py_HAVE_CONDVAR - -#include #define PyCOND_ADD_MICROSECONDS(tv, interval) \ do { /* TODO: add overflow and truncation checks */ \ @@ -74,13 +63,11 @@ do { /* TODO: add overflow and truncation checks */ \ #endif /* The following functions return 0 on success, nonzero on error */ -#define PyMUTEX_T pthread_mutex_t #define PyMUTEX_INIT(mut) pthread_mutex_init((mut), NULL) #define PyMUTEX_FINI(mut) pthread_mutex_destroy(mut) #define PyMUTEX_LOCK(mut) pthread_mutex_lock(mut) #define PyMUTEX_UNLOCK(mut) pthread_mutex_unlock(mut) -#define PyCOND_T pthread_cond_t #define PyCOND_INIT(cond) pthread_cond_init((cond), NULL) #define PyCOND_FINI(cond) pthread_cond_destroy(cond) #define PyCOND_SIGNAL(cond) pthread_cond_signal(cond) @@ -116,45 +103,11 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) * Emulated condition variables ones that work with XP and later, plus * example native support on VISTA and onwards. */ -#define Py_HAVE_CONDVAR - - -/* include windows if it hasn't been done before */ -#define WIN32_LEAN_AND_MEAN -#include - -/* options */ -/* non-emulated condition variables are provided for those that want - * to target Windows Vista. Modify this macro to enable them. - */ -#ifndef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ -#endif - -/* fall back to emulation if not targeting Vista */ -#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA -#undef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 -#endif - #if _PY_EMULATED_WIN_CV /* The mutex is a CriticalSection object and The condition variables is emulated with the help of a semaphore. - Semaphores are available on Windows XP (2003 server) and later. - We use a Semaphore rather than an auto-reset event, because although - an auto-resent event might appear to solve the lost-wakeup bug (race - condition between releasing the outer lock and waiting) because it - maintains state even though a wait hasn't happened, there is still - a lost wakeup problem if more than one thread are interrupted in the - critical place. A semaphore solves that, because its state is counted, - not Boolean. - Because it is ok to signal a condition variable with no one - waiting, we need to keep track of the number of - waiting threads. Otherwise, the semaphore's state could rise - without bound. This also helps reduce the number of "spurious wakeups" - that would otherwise happen. This implementation still has the problem that the threads woken with a "signal" aren't necessarily those that are already @@ -168,8 +121,6 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) http://www.cse.wustl.edu/~schmidt/win32-cv-1.html */ -typedef CRITICAL_SECTION PyMUTEX_T; - Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) { @@ -198,15 +149,6 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) return 0; } -/* The ConditionVariable object. From XP onwards it is easily emulated with - * a Semaphore - */ - -typedef struct _PyCOND_T -{ - HANDLE sem; - int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ -} PyCOND_T; Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) @@ -304,12 +246,7 @@ PyCOND_BROADCAST(PyCOND_T *cv) return 0; } -#else - -/* Use native Win7 primitives if build target is Win7 or higher */ - -/* SRWLOCK is faster and better than CriticalSection */ -typedef SRWLOCK PyMUTEX_T; +#else /* !_PY_EMULATED_WIN_CV */ Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) @@ -339,8 +276,6 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) } -typedef CONDITION_VARIABLE PyCOND_T; - Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) { @@ -387,4 +322,4 @@ PyCOND_BROADCAST(PyCOND_T *cv) #endif /* _POSIX_THREADS, NT_THREADS */ -#endif /* _CONDVAR_H_ */ +#endif /* _CONDVAR_IMPL_H_ */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 662405bdeb3..f33e920e6b5 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -77,6 +77,30 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); #endif /* WITH_THREAD */ +_PyRuntimeState _PyRuntime = {}; + +void +_PyRuntime_Initialize(void) +{ + /* XXX We only initialize once in the process, which aligns with + the static initialization of the former globals now found in + _PyRuntime. However, _PyRuntime *should* be initialized with + every Py_Initialize() call, but doing so breaks the runtime. + This is because the runtime state is not properly finalized + currently. */ + static int initialized = 0; + if (initialized) + return; + initialized = 1; + _PyRuntimeState_Init(&_PyRuntime); +} + +void +_PyRuntime_Finalize(void) +{ + _PyRuntimeState_Fini(&_PyRuntime); +} + /* Global configuration variable declarations are in pydebug.h */ /* XXX (ncoghlan): move those declarations to pylifecycle.h? */ int Py_DebugFlag; /* Needed by parser.c */ @@ -100,8 +124,6 @@ int Py_LegacyWindowsFSEncodingFlag = 0; /* Uses mbcs instead of utf-8 */ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */ #endif -PyThreadState *_Py_Finalizing = NULL; - /* Hack to force loading of object files */ int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \ PyOS_mystrnicmp; /* Python/pystrcmp.o */ @@ -119,19 +141,17 @@ PyModule_GetWarningsModule(void) * * Can be called prior to Py_Initialize. */ -int _Py_CoreInitialized = 0; -int _Py_Initialized = 0; int _Py_IsCoreInitialized(void) { - return _Py_CoreInitialized; + return _PyRuntime.core_initialized; } int Py_IsInitialized(void) { - return _Py_Initialized; + return _PyRuntime.initialized; } /* Helper to allow an embedding application to override the normal @@ -544,14 +564,16 @@ void _Py_InitializeCore(const _PyCoreConfig *config) _PyCoreConfig core_config = _PyCoreConfig_INIT; _PyMainInterpreterConfig preinit_config = _PyMainInterpreterConfig_INIT; + _PyRuntime_Initialize(); + if (config != NULL) { core_config = *config; } - if (_Py_Initialized) { + if (_PyRuntime.initialized) { Py_FatalError("Py_InitializeCore: main interpreter already initialized"); } - if (_Py_CoreInitialized) { + if (_PyRuntime.core_initialized) { Py_FatalError("Py_InitializeCore: runtime core already initialized"); } @@ -564,7 +586,14 @@ void _Py_InitializeCore(const _PyCoreConfig *config) * threads still hanging around from a previous Py_Initialize/Finalize * pair :( */ - _Py_Finalizing = NULL; + _PyRuntime.finalizing = NULL; + + if (_PyMem_SetupAllocators(core_config.allocator) < 0) { + fprintf(stderr, + "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", + core_config.allocator); + exit(1); + } #ifdef __ANDROID__ /* Passing "" to setlocale() on Android requests the C locale rather @@ -606,7 +635,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) Py_HashRandomizationFlag = 1; } - _PyInterpreterState_Init(); + _PyInterpreterState_Enable(&_PyRuntime); interp = PyInterpreterState_New(); if (interp == NULL) Py_FatalError("Py_InitializeCore: can't make main interpreter"); @@ -698,7 +727,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) } /* Only when we get here is the runtime core fully initialized */ - _Py_CoreInitialized = 1; + _PyRuntime.core_initialized = 1; } /* Read configuration settings from standard locations @@ -739,10 +768,10 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) PyInterpreterState *interp; PyThreadState *tstate; - if (!_Py_CoreInitialized) { + if (!_PyRuntime.core_initialized) { Py_FatalError("Py_InitializeMainInterpreter: runtime core not initialized"); } - if (_Py_Initialized) { + if (_PyRuntime.initialized) { Py_FatalError("Py_InitializeMainInterpreter: main interpreter already initialized"); } @@ -763,7 +792,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) * This means anything which needs support from extension modules * or pure Python code in the standard library won't work. */ - _Py_Initialized = 1; + _PyRuntime.initialized = 1; return 0; } /* TODO: Report exceptions rather than fatal errors below here */ @@ -808,7 +837,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) Py_XDECREF(warnings_module); } - _Py_Initialized = 1; + _PyRuntime.initialized = 1; if (!Py_NoSiteFlag) initsite(); /* Module site */ @@ -924,7 +953,7 @@ Py_FinalizeEx(void) PyThreadState *tstate; int status = 0; - if (!_Py_Initialized) + if (!_PyRuntime.initialized) return status; wait_for_thread_shutdown(); @@ -946,9 +975,9 @@ Py_FinalizeEx(void) /* Remaining threads (e.g. daemon threads) will automatically exit after taking the GIL (in PyEval_RestoreThread()). */ - _Py_Finalizing = tstate; - _Py_Initialized = 0; - _Py_CoreInitialized = 0; + _PyRuntime.finalizing = tstate; + _PyRuntime.initialized = 0; + _PyRuntime.core_initialized = 0; /* Flush sys.stdout and sys.stderr */ if (flush_std_files() < 0) { @@ -1110,6 +1139,7 @@ Py_FinalizeEx(void) #endif call_ll_exitfuncs(); + _PyRuntime_Finalize(); return status; } @@ -1139,7 +1169,7 @@ Py_NewInterpreter(void) PyThreadState *tstate, *save_tstate; PyObject *bimod, *sysmod; - if (!_Py_Initialized) + if (!_PyRuntime.initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); #ifdef WITH_THREAD @@ -1854,20 +1884,19 @@ Py_FatalError(const char *msg) # include "pythread.h" #endif -static void (*pyexitfunc)(void) = NULL; /* For the atexit module. */ void _Py_PyAtExit(void (*func)(void)) { - pyexitfunc = func; + _PyRuntime.pyexitfunc = func; } static void call_py_exitfuncs(void) { - if (pyexitfunc == NULL) + if (_PyRuntime.pyexitfunc == NULL) return; - (*pyexitfunc)(); + (*_PyRuntime.pyexitfunc)(); PyErr_Clear(); } @@ -1900,22 +1929,19 @@ wait_for_thread_shutdown(void) } #define NEXITFUNCS 32 -static void (*exitfuncs[NEXITFUNCS])(void); -static int nexitfuncs = 0; - int Py_AtExit(void (*func)(void)) { - if (nexitfuncs >= NEXITFUNCS) + if (_PyRuntime.nexitfuncs >= NEXITFUNCS) return -1; - exitfuncs[nexitfuncs++] = func; + _PyRuntime.exitfuncs[_PyRuntime.nexitfuncs++] = func; return 0; } static void call_ll_exitfuncs(void) { - while (nexitfuncs > 0) - (*exitfuncs[--nexitfuncs])(); + while (_PyRuntime.nexitfuncs > 0) + (*_PyRuntime.exitfuncs[--_PyRuntime.nexitfuncs])(); fflush(stdout); fflush(stderr); diff --git a/Python/pystate.c b/Python/pystate.c index 30a372212ed..3d3207702f8 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -34,55 +34,66 @@ to avoid the expense of doing their own locking). extern "C" { #endif -int _PyGILState_check_enabled = 1; +void +_PyRuntimeState_Init(_PyRuntimeState *runtime) +{ + _PyRuntimeState initial = {}; + *runtime = initial; + + _PyObject_Initialize(&runtime->obj); + _PyMem_Initialize(&runtime->mem); + _PyGC_Initialize(&runtime->gc); + _PyEval_Initialize(&runtime->ceval); + + runtime->gilstate.check_enabled = 1; + runtime->gilstate.autoTLSkey = -1; #ifdef WITH_THREAD -#include "pythread.h" -static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ -#define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) -#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK) -#define HEAD_UNLOCK() PyThread_release_lock(head_mutex) - -/* The single PyInterpreterState used by this process' - GILState implementation -*/ -/* TODO: Given interp_main, it may be possible to kill this ref */ -static PyInterpreterState *autoInterpreterState = NULL; -static int autoTLSkey = -1; + runtime->interpreters.mutex = PyThread_allocate_lock(); + if (runtime->interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); +#endif + runtime->interpreters.next_id = -1; +} + +void +_PyRuntimeState_Fini(_PyRuntimeState *runtime) +{ +#ifdef WITH_THREAD + if (runtime->interpreters.mutex != NULL) { + PyThread_free_lock(runtime->interpreters.mutex); + runtime->interpreters.mutex = NULL; + } +#endif +} + +#ifdef WITH_THREAD +#define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \ + WAIT_LOCK) +#define HEAD_UNLOCK() PyThread_release_lock(_PyRuntime.interpreters.mutex) #else -#define HEAD_INIT() /* Nothing */ #define HEAD_LOCK() /* Nothing */ #define HEAD_UNLOCK() /* Nothing */ #endif -static PyInterpreterState *interp_head = NULL; -static PyInterpreterState *interp_main = NULL; - -/* Assuming the current thread holds the GIL, this is the - PyThreadState for the current thread. */ -_Py_atomic_address _PyThreadState_Current = {0}; -PyThreadFrameGetter _PyThreadState_GetFrame = NULL; - #ifdef WITH_THREAD static void _PyGILState_NoteThreadState(PyThreadState* tstate); #endif -/* _next_interp_id is an auto-numbered sequence of small integers. - It gets initialized in _PyInterpreterState_Init(), which is called - in Py_Initialize(), and used in PyInterpreterState_New(). A negative - interpreter ID indicates an error occurred. The main interpreter - will always have an ID of 0. Overflow results in a RuntimeError. - If that becomes a problem later then we can adjust, e.g. by using - a Python int. - - We initialize this to -1 so that the pre-Py_Initialize() value - results in an error. */ -static int64_t _next_interp_id = -1; - void -_PyInterpreterState_Init(void) +_PyInterpreterState_Enable(_PyRuntimeState *runtime) { - _next_interp_id = 0; + runtime->interpreters.next_id = 0; +#ifdef WITH_THREAD + /* Since we only call _PyRuntimeState_Init() once per process + (see _PyRuntime_Initialize()), we make sure the mutex is + initialized here. */ + if (runtime->interpreters.mutex == NULL) { + runtime->interpreters.mutex = PyThread_allocate_lock(); + if (runtime->interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); + } +#endif } PyInterpreterState * @@ -92,16 +103,16 @@ PyInterpreterState_New(void) PyMem_RawMalloc(sizeof(PyInterpreterState)); if (interp != NULL) { - HEAD_INIT(); -#ifdef WITH_THREAD - if (head_mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); -#endif interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; interp->builtins_copy = NULL; interp->tstate_head = NULL; + interp->check_interval = 100; + interp->warnoptions = NULL; + interp->xoptions = NULL; + interp->num_threads = 0; + interp->pythread_stacksize = 0; interp->codec_search_path = NULL; interp->codec_search_cache = NULL; interp->codec_error_registry = NULL; @@ -125,19 +136,19 @@ PyInterpreterState_New(void) #endif HEAD_LOCK(); - interp->next = interp_head; - if (interp_main == NULL) { - interp_main = interp; + interp->next = _PyRuntime.interpreters.head; + if (_PyRuntime.interpreters.main == NULL) { + _PyRuntime.interpreters.main = interp; } - interp_head = interp; - if (_next_interp_id < 0) { + _PyRuntime.interpreters.head = interp; + if (_PyRuntime.interpreters.next_id < 0) { /* overflow or Py_Initialize() not called! */ PyErr_SetString(PyExc_RuntimeError, "failed to get an interpreter ID"); interp = NULL; } else { - interp->id = _next_interp_id; - _next_interp_id += 1; + interp->id = _PyRuntime.interpreters.next_id; + _PyRuntime.interpreters.next_id += 1; } HEAD_UNLOCK(); } @@ -189,7 +200,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp) PyInterpreterState **p; zapthreads(interp); HEAD_LOCK(); - for (p = &interp_head; ; p = &(*p)->next) { + for (p = &_PyRuntime.interpreters.head; ; p = &(*p)->next) { if (*p == NULL) Py_FatalError( "PyInterpreterState_Delete: invalid interp"); @@ -199,19 +210,13 @@ PyInterpreterState_Delete(PyInterpreterState *interp) if (interp->tstate_head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining threads"); *p = interp->next; - if (interp_main == interp) { - interp_main = NULL; - if (interp_head != NULL) + if (_PyRuntime.interpreters.main == interp) { + _PyRuntime.interpreters.main = NULL; + if (_PyRuntime.interpreters.head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining subinterpreters"); } HEAD_UNLOCK(); PyMem_RawFree(interp); -#ifdef WITH_THREAD - if (interp_head == NULL && head_mutex != NULL) { - PyThread_free_lock(head_mutex); - head_mutex = NULL; - } -#endif } @@ -499,8 +504,11 @@ PyThreadState_Delete(PyThreadState *tstate) if (tstate == GET_TSTATE()) Py_FatalError("PyThreadState_Delete: tstate is still current"); #ifdef WITH_THREAD - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); + if (_PyRuntime.gilstate.autoInterpreterState && + PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) + { + PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); + } #endif /* WITH_THREAD */ tstate_delete_common(tstate); } @@ -515,8 +523,11 @@ PyThreadState_DeleteCurrent() Py_FatalError( "PyThreadState_DeleteCurrent: no current tstate"); tstate_delete_common(tstate); - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); + if (_PyRuntime.gilstate.autoInterpreterState && + PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) + { + PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); + } SET_TSTATE(NULL); PyEval_ReleaseLock(); } @@ -676,13 +687,13 @@ PyThreadState_SetAsyncExc(unsigned long id, PyObject *exc) PyInterpreterState * PyInterpreterState_Head(void) { - return interp_head; + return _PyRuntime.interpreters.head; } PyInterpreterState * PyInterpreterState_Main(void) { - return interp_main; + return _PyRuntime.interpreters.main; } PyInterpreterState * @@ -722,7 +733,7 @@ _PyThread_CurrentFrames(void) * need to grab head_mutex for the duration. */ HEAD_LOCK(); - for (i = interp_head; i != NULL; i = i->next) { + for (i = _PyRuntime.interpreters.head; i != NULL; i = i->next) { PyThreadState *t; for (t = i->tstate_head; t != NULL; t = t->next) { PyObject *id; @@ -774,11 +785,11 @@ void _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) { assert(i && t); /* must init with valid states */ - autoTLSkey = PyThread_create_key(); - if (autoTLSkey == -1) + _PyRuntime.gilstate.autoTLSkey = PyThread_create_key(); + if (_PyRuntime.gilstate.autoTLSkey == -1) Py_FatalError("Could not allocate TLS entry"); - autoInterpreterState = i; - assert(PyThread_get_key_value(autoTLSkey) == NULL); + _PyRuntime.gilstate.autoInterpreterState = i; + assert(PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL); assert(t->gilstate_counter == 0); _PyGILState_NoteThreadState(t); @@ -787,15 +798,15 @@ _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) PyInterpreterState * _PyGILState_GetInterpreterStateUnsafe(void) { - return autoInterpreterState; + return _PyRuntime.gilstate.autoInterpreterState; } void _PyGILState_Fini(void) { - PyThread_delete_key(autoTLSkey); - autoTLSkey = -1; - autoInterpreterState = NULL; + PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); + _PyRuntime.gilstate.autoTLSkey = -1; + _PyRuntime.gilstate.autoInterpreterState = NULL; } /* Reset the TLS key - called by PyOS_AfterFork_Child(). @@ -806,17 +817,19 @@ void _PyGILState_Reinit(void) { #ifdef WITH_THREAD - head_mutex = NULL; - HEAD_INIT(); + _PyRuntime.interpreters.mutex = PyThread_allocate_lock(); + if (_PyRuntime.interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); #endif PyThreadState *tstate = PyGILState_GetThisThreadState(); - PyThread_delete_key(autoTLSkey); - if ((autoTLSkey = PyThread_create_key()) == -1) + PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); + if ((_PyRuntime.gilstate.autoTLSkey = PyThread_create_key()) == -1) Py_FatalError("Could not allocate TLS entry"); /* If the thread had an associated auto thread state, reassociate it with * the new key. */ - if (tstate && PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) + if (tstate && PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, + (void *)tstate) < 0) Py_FatalError("Couldn't create autoTLSkey mapping"); } @@ -831,7 +844,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) /* If autoTLSkey isn't initialized, this must be the very first threadstate created in Py_Initialize(). Don't do anything for now (we'll be back here when _PyGILState_Init is called). */ - if (!autoInterpreterState) + if (!_PyRuntime.gilstate.autoInterpreterState) return; /* Stick the thread state for this thread in thread local storage. @@ -846,9 +859,13 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) The first thread state created for that given OS level thread will "win", which seems reasonable behaviour. */ - if (PyThread_get_key_value(autoTLSkey) == NULL) { - if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) + if (PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL) { + if ((PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, + (void *)tstate) + ) < 0) + { Py_FatalError("Couldn't create autoTLSkey mapping"); + } } /* PyGILState_Release must not try to delete this thread state. */ @@ -859,9 +876,10 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) PyThreadState * PyGILState_GetThisThreadState(void) { - if (autoInterpreterState == NULL) + if (_PyRuntime.gilstate.autoInterpreterState == NULL) return NULL; - return (PyThreadState *)PyThread_get_key_value(autoTLSkey); + return (PyThreadState *)PyThread_get_key_value( + _PyRuntime.gilstate.autoTLSkey); } int @@ -872,7 +890,7 @@ PyGILState_Check(void) if (!_PyGILState_check_enabled) return 1; - if (autoTLSkey == -1) + if (_PyRuntime.gilstate.autoTLSkey == -1) return 1; tstate = GET_TSTATE(); @@ -892,8 +910,10 @@ PyGILState_Ensure(void) spells out other issues. Embedders are expected to have called Py_Initialize() and usually PyEval_InitThreads(). */ - assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ - tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); + /* Py_Initialize() hasn't been called! */ + assert(_PyRuntime.gilstate.autoInterpreterState); + tcur = (PyThreadState *)PyThread_get_key_value( + _PyRuntime.gilstate.autoTLSkey); if (tcur == NULL) { /* At startup, Python has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the first time, we need the create the @@ -901,7 +921,7 @@ PyGILState_Ensure(void) PyEval_InitThreads(); /* Create a new thread state for this thread */ - tcur = PyThreadState_New(autoInterpreterState); + tcur = PyThreadState_New(_PyRuntime.gilstate.autoInterpreterState); if (tcur == NULL) Py_FatalError("Couldn't create thread-state for new thread"); /* This is our thread state! We'll need to delete it in the @@ -926,7 +946,7 @@ void PyGILState_Release(PyGILState_STATE oldstate) { PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value( - autoTLSkey); + _PyRuntime.gilstate.autoTLSkey); if (tcur == NULL) Py_FatalError("auto-releasing thread-state, " "but no thread-state for this thread"); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 852babbed78..080c541c6df 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -519,8 +519,6 @@ Return the profiling function set with sys.setprofile.\n\ See the profiler chapter in the library manual." ); -static int _check_interval = 100; - static PyObject * sys_setcheckinterval(PyObject *self, PyObject *args) { @@ -529,7 +527,8 @@ sys_setcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.setswitchinterval() " "instead.", 1) < 0) return NULL; - if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval)) + PyInterpreterState *interp = PyThreadState_GET()->interp; + if (!PyArg_ParseTuple(args, "i:setcheckinterval", &interp->check_interval)) return NULL; Py_RETURN_NONE; } @@ -549,7 +548,8 @@ sys_getcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.getswitchinterval() " "instead.", 1) < 0) return NULL; - return PyLong_FromLong(_check_interval); + PyInterpreterState *interp = PyThreadState_GET()->interp; + return PyLong_FromLong(interp->check_interval); } PyDoc_STRVAR(getcheckinterval_doc, @@ -1339,7 +1339,7 @@ Clear the internal type lookup cache."); static PyObject * sys_is_finalizing(PyObject* self, PyObject* args) { - return PyBool_FromLong(_Py_Finalizing != NULL); + return PyBool_FromLong(_Py_IS_FINALIZING()); } PyDoc_STRVAR(is_finalizing_doc, @@ -1479,11 +1479,24 @@ list_builtin_module_names(void) return list; } -static PyObject *warnoptions = NULL; +static PyObject * +get_warnoptions(void) +{ + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + if (warnoptions == NULL || !PyList_Check(warnoptions)) { + Py_XDECREF(warnoptions); + warnoptions = PyList_New(0); + if (warnoptions == NULL) + return NULL; + PyThreadState_GET()->interp->warnoptions = warnoptions; + } + return warnoptions; +} void PySys_ResetWarnOptions(void) { + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1492,12 +1505,9 @@ PySys_ResetWarnOptions(void) void PySys_AddWarnOptionUnicode(PyObject *unicode) { - if (warnoptions == NULL || !PyList_Check(warnoptions)) { - Py_XDECREF(warnoptions); - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return; - } + PyObject *warnoptions = get_warnoptions(); + if (warnoptions == NULL) + return; PyList_Append(warnoptions, unicode); } @@ -1515,17 +1525,20 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } -static PyObject *xoptions = NULL; - static PyObject * get_xoptions(void) { + PyObject *xoptions = PyThreadState_GET()->interp->xoptions; if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); + if (xoptions == NULL) + return NULL; + PyThreadState_GET()->interp->xoptions = xoptions; } return xoptions; } @@ -2130,17 +2143,15 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - if (warnoptions == NULL) { - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return -1; - } - - SET_SYS_FROM_STRING_INT_RESULT("warnoptions", - PyList_GetSlice(warnoptions, - 0, Py_SIZE(warnoptions))); + PyObject *warnoptions = get_warnoptions(); + if (warnoptions == NULL) + return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); - SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", get_xoptions()); + PyObject *xoptions = get_xoptions(); + if (xoptions == NULL) + return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); if (PyErr_Occurred()) return -1; diff --git a/Python/thread.c b/Python/thread.c index 4d2f2c32a19..6fd594fd301 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -76,11 +76,6 @@ PyThread_init_thread(void) PyThread__init_thread(); } -/* Support for runtime thread stack size tuning. - A value of 0 means using the platform's default stack size - or the size specified by the THREAD_STACK_SIZE macro. */ -static size_t _pythread_stacksize = 0; - #if defined(_POSIX_THREADS) # define PYTHREAD_NAME "pthread" # include "thread_pthread.h" @@ -96,7 +91,7 @@ static size_t _pythread_stacksize = 0; size_t PyThread_get_stacksize(void) { - return _pythread_stacksize; + return PyThreadState_GET()->interp->pythread_stacksize; } /* Only platforms defining a THREAD_SET_STACKSIZE() macro diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 47eb4b6e94c..2f3a71b86ad 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -189,9 +189,10 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; obj->func = func; obj->arg = arg; + PyThreadState *tstate = PyThreadState_GET(); + size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; hThread = (HANDLE)_beginthreadex(0, - Py_SAFE_DOWNCAST(_pythread_stacksize, - Py_ssize_t, unsigned int), + Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int), bootstrap, obj, 0, &threadID); if (hThread == 0) { @@ -332,13 +333,13 @@ _pythread_nt_set_stacksize(size_t size) { /* set to default */ if (size == 0) { - _pythread_stacksize = 0; + PyThreadState_GET()->interp->pythread_stacksize = 0; return 0; } /* valid range? */ if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) { - _pythread_stacksize = size; + PyThreadState_GET()->interp->pythread_stacksize = size; return 0; } diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 268dec41168..ea05b6fbcfe 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -205,8 +205,9 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; #endif #if defined(THREAD_STACK_SIZE) - tss = (_pythread_stacksize != 0) ? _pythread_stacksize - : THREAD_STACK_SIZE; + PyThreadState *tstate = PyThreadState_GET(); + size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; + tss = (stacksize != 0) ? stacksize : THREAD_STACK_SIZE; if (tss != 0) { if (pthread_attr_setstacksize(&attrs, tss) != 0) { pthread_attr_destroy(&attrs); @@ -578,7 +579,7 @@ _pythread_pthread_set_stacksize(size_t size) /* set to default */ if (size == 0) { - _pythread_stacksize = 0; + PyThreadState_GET()->interp->pythread_stacksize = 0; return 0; } @@ -595,7 +596,7 @@ _pythread_pthread_set_stacksize(size_t size) rc = pthread_attr_setstacksize(&attrs, size); pthread_attr_destroy(&attrs); if (rc == 0) { - _pythread_stacksize = size; + PyThreadState_GET()->interp->pythread_stacksize = size; return 0; } } diff --git a/Tools/c-globals/README b/Tools/c-globals/README new file mode 100644 index 00000000000..d0e6e8eba06 --- /dev/null +++ b/Tools/c-globals/README @@ -0,0 +1,41 @@ +####################################### +# C Globals and CPython Runtime State. + +CPython's C code makes extensive use of global variables. Each global +falls into one of several categories: + +* (effectively) constants (incl. static types) +* globals used exclusively in main or in the REPL +* freelists, caches, and counters +* process-global state +* module state +* Python runtime state + +The ignored-globals.txt file is organized similarly. Of the different +categories, the last two are problematic and generally should not exist +in the codebase. + +Globals that hold module state (i.e. in Modules/*.c) cause problems +when multiple interpreters are in use. For more info, see PEP 3121, +which addresses the situation for extension modules in general. + +Globals in the last category should be avoided as well. The problem +isn't with the Python runtime having state. Rather, the problem is with +that state being spread thoughout the codebase in dozens of individual +globals. Unlike the other globals, the runtime state represents a set +of values that are constantly shifting in a complex way. When they are +spread out it's harder to get a clear picture of what the runtime +involves. Furthermore, when they are spread out it complicates efforts +that change the runtime. + +Consequently, the globals for Python's runtime state have been +consolidated under a single top-level _PyRuntime global. No new globals +should be added for runtime state. Instead, they should be added to +_PyRuntimeState or one of its sub-structs. The check-c-globals script +should be run to ensure that no new globals have been added: + + python3 Tools/c-globals/check-c-globals.py + +If it reports any globals then they should be resolved. If the globals +are runtime state then they should be folded into _PyRuntimeState. +Otherwise they should be added to ignored-globals.txt. diff --git a/Tools/c-globals/check-c-globals.py b/Tools/c-globals/check-c-globals.py new file mode 100644 index 00000000000..1de69a8751c --- /dev/null +++ b/Tools/c-globals/check-c-globals.py @@ -0,0 +1,446 @@ + +from collections import namedtuple +import glob +import os.path +import re +import shutil +import sys +import subprocess + + +VERBOSITY = 2 + +C_GLOBALS_DIR = os.path.abspath(os.path.dirname(__file__)) +TOOLS_DIR = os.path.dirname(C_GLOBALS_DIR) +ROOT_DIR = os.path.dirname(TOOLS_DIR) +GLOBALS_FILE = os.path.join(C_GLOBALS_DIR, 'ignored-globals.txt') + +SOURCE_DIRS = ['Include', 'Objects', 'Modules', 'Parser', 'Python'] + +CAPI_REGEX = re.compile(r'^ *PyAPI_DATA\([^)]*\) \W*(_?Py\w+(?:, \w+)*\w).*;.*$') + + +IGNORED_VARS = { + '_DYNAMIC', + '_GLOBAL_OFFSET_TABLE_', + '__JCR_LIST__', + '__JCR_END__', + '__TMC_END__', + '__bss_start', + '__data_start', + '__dso_handle', + '_edata', + '_end', + } + + +def find_capi_vars(root): + capi_vars = {} + for dirname in SOURCE_DIRS: + for filename in glob.glob(os.path.join(ROOT_DIR, dirname, '**/*.[hc]'), + recursive=True): + with open(filename) as file: + for name in _find_capi_vars(file): + if name in capi_vars: + assert not filename.endswith('.c') + assert capi_vars[name].endswith('.c') + capi_vars[name] = filename + return capi_vars + + +def _find_capi_vars(lines): + for line in lines: + if not line.startswith('PyAPI_DATA'): + continue + assert '{' not in line + match = CAPI_REGEX.match(line) + assert match + names, = match.groups() + for name in names.split(', '): + yield name + + +def _read_global_names(filename): + # These variables are shared between all interpreters in the process. + with open(filename) as file: + return {line.partition('#')[0].strip() + for line in file + if line.strip() and not line.startswith('#')} + + +def _is_global_var(name, globalnames): + if _is_autogen_var(name): + return True + if _is_type_var(name): + return True + if _is_module(name): + return True + if _is_exception(name): + return True + if _is_compiler(name): + return True + return name in globalnames + + +def _is_autogen_var(name): + return ( + name.startswith('PyId_') or + '.' in name or + # Objects/typeobject.c + name.startswith('op_id.') or + name.startswith('rop_id.') or + # Python/graminit.c + name.startswith('arcs_') or + name.startswith('states_') + ) + + +def _is_type_var(name): + if name.endswith(('Type', '_Type', '_type')): # XXX Always a static type? + return True + if name.endswith('_desc'): # for structseq types + return True + return ( + name.startswith('doc_') or + name.endswith(('_doc', '__doc__', '_docstring')) or + name.endswith('_methods') or + name.endswith('_fields') or + name.endswith(('_memberlist', '_members')) or + name.endswith('_slots') or + name.endswith(('_getset', '_getsets', '_getsetlist')) or + name.endswith('_as_mapping') or + name.endswith('_as_number') or + name.endswith('_as_sequence') or + name.endswith('_as_buffer') or + name.endswith('_as_async') + ) + + +def _is_module(name): + if name.endswith(('_functions', 'Methods', '_Methods')): + return True + if name == 'module_def': + return True + if name == 'initialized': + return True + return name.endswith(('module', '_Module')) + + +def _is_exception(name): + # Other vars are enumerated in globals-core.txt. + if not name.startswith(('PyExc_', '_PyExc_')): + return False + return name.endswith(('Error', 'Warning')) + + +def _is_compiler(name): + return ( + # Python/Pythyon-ast.c + name.endswith('_type') or + name.endswith('_singleton') or + name.endswith('_attributes') + ) + + +class Var(namedtuple('Var', 'name kind scope capi filename')): + + @classmethod + def parse_nm(cls, line, expected, ignored, capi_vars, globalnames): + _, _, line = line.partition(' ') # strip off the address + line = line.strip() + kind, _, line = line.partition(' ') + if kind in ignored or (): + return None + elif kind not in expected or (): + raise RuntimeError('unsupported NM type {!r}'.format(kind)) + + name, _, filename = line.partition('\t') + name = name.strip() + if _is_autogen_var(name): + return None + if _is_global_var(name, globalnames): + scope = 'global' + else: + scope = None + capi = (name in capi_vars or ()) + if filename: + filename = os.path.relpath(filename.partition(':')[0]) + return cls(name, kind, scope, capi, filename or '~???~') + + @property + def external(self): + return self.kind.isupper() + + +def find_vars(root, globals_filename=GLOBALS_FILE): + python = os.path.join(root, 'python') + if not os.path.exists(python): + raise RuntimeError('python binary missing (need to build it first?)') + capi_vars = find_capi_vars(root) + globalnames = _read_global_names(globals_filename) + + nm = shutil.which('nm') + if nm is None: + # XXX Use dumpbin.exe /SYMBOLS on Windows. + raise NotImplementedError + else: + yield from (var + for var in _find_var_symbols(python, nm, capi_vars, + globalnames) + if var.name not in IGNORED_VARS) + + +NM_FUNCS = set('Tt') +NM_PUBLIC_VARS = set('BD') +NM_PRIVATE_VARS = set('bd') +NM_VARS = NM_PUBLIC_VARS | NM_PRIVATE_VARS +NM_DATA = set('Rr') +NM_OTHER = set('ACGgiINpSsuUVvWw-?') +NM_IGNORED = NM_FUNCS | NM_DATA | NM_OTHER + + +def _find_var_symbols(python, nm, capi_vars, globalnames): + args = [nm, + '--line-numbers', + python] + out = subprocess.check_output(args) + for line in out.decode('utf-8').splitlines(): + var = Var.parse_nm(line, NM_VARS, NM_IGNORED, capi_vars, globalnames) + if var is None: + continue + yield var + + +####################################### + +class Filter(namedtuple('Filter', 'name op value action')): + + @classmethod + def parse(cls, raw): + action = '+' + if raw.startswith(('+', '-')): + action = raw[0] + raw = raw[1:] + # XXX Support < and >? + name, op, value = raw.partition('=') + return cls(name, op, value, action) + + def check(self, var): + value = getattr(var, self.name, None) + if not self.op: + matched = bool(value) + elif self.op == '=': + matched = (value == self.value) + else: + raise NotImplementedError + + if self.action == '+': + return matched + elif self.action == '-': + return not matched + else: + raise NotImplementedError + + +def filter_var(var, filters): + for filter in filters: + if not filter.check(var): + return False + return True + + +def make_sort_key(spec): + columns = [(col.strip('_'), '_' if col.startswith('_') else '') + for col in spec] + def sort_key(var): + return tuple(getattr(var, col).lstrip(prefix) + for col, prefix in columns) + return sort_key + + +def make_groups(allvars, spec): + group = spec + groups = {} + for var in allvars: + value = getattr(var, group) + key = '{}: {}'.format(group, value) + try: + groupvars = groups[key] + except KeyError: + groupvars = groups[key] = [] + groupvars.append(var) + return groups + + +def format_groups(groups, columns, fmts, widths): + for group in sorted(groups): + groupvars = groups[group] + yield '', 0 + yield ' # {}'.format(group), 0 + yield from format_vars(groupvars, columns, fmts, widths) + + +def format_vars(allvars, columns, fmts, widths): + fmt = ' '.join(fmts[col] for col in columns) + fmt = ' ' + fmt.replace(' ', ' ') + ' ' # for div margin + header = fmt.replace(':', ':^').format(*(col.upper() for col in columns)) + yield header, 0 + div = ' '.join('-'*(widths[col]+2) for col in columns) + yield div, 0 + for var in allvars: + values = (getattr(var, col) for col in columns) + row = fmt.format(*('X' if val is True else val or '' + for val in values)) + yield row, 1 + yield div, 0 + + +####################################### + +COLUMNS = 'name,external,capi,scope,filename' +COLUMN_NAMES = COLUMNS.split(',') + +COLUMN_WIDTHS = {col: len(col) + for col in COLUMN_NAMES} +COLUMN_WIDTHS.update({ + 'name': 50, + 'scope': 7, + 'filename': 40, + }) +COLUMN_FORMATS = {col: '{:%s}' % width + for col, width in COLUMN_WIDTHS.items()} +for col in COLUMN_FORMATS: + if COLUMN_WIDTHS[col] == len(col): + COLUMN_FORMATS[col] = COLUMN_FORMATS[col].replace(':', ':^') + + +def _parse_filters_arg(raw, error): + filters = [] + for value in raw.split(','): + value=value.strip() + if not value: + continue + try: + filter = Filter.parse(value) + if filter.name not in COLUMN_NAMES: + raise Exception('unsupported column {!r}'.format(filter.name)) + except Exception as e: + error('bad filter {!r}: {}'.format(raw, e)) + filters.append(filter) + return filters + + +def _parse_columns_arg(raw, error): + columns = raw.split(',') + for column in columns: + if column not in COLUMN_NAMES: + error('unsupported column {!r}'.format(column)) + return columns + + +def _parse_sort_arg(raw, error): + sort = raw.split(',') + for column in sort: + if column.lstrip('_') not in COLUMN_NAMES: + error('unsupported column {!r}'.format(column)) + return sort + + +def _parse_group_arg(raw, error): + if not raw: + return raw + group = raw + if group not in COLUMN_NAMES: + error('unsupported column {!r}'.format(group)) + if group != 'filename': + error('unsupported group {!r}'.format(group)) + return group + + +def parse_args(argv=None): + if argv is None: + argv = sys.argv[1:] + + import argparse + parser = argparse.ArgumentParser() + + parser.add_argument('-v', '--verbose', action='count', default=0) + parser.add_argument('-q', '--quiet', action='count', default=0) + + parser.add_argument('--filters', default='-scope', + help='[[-][=]] ...') + + parser.add_argument('--columns', default=COLUMNS, + help='a comma-separated list of columns to show') + parser.add_argument('--sort', default='filename,_name', + help='a comma-separated list of columns to sort') + parser.add_argument('--group', + help='group by the given column name (- to not group)') + + parser.add_argument('--rc-on-match', dest='rc', type=int) + + parser.add_argument('filename', nargs='?', default=GLOBALS_FILE) + + args = parser.parse_args(argv) + + verbose = vars(args).pop('verbose', 0) + quiet = vars(args).pop('quiet', 0) + args.verbosity = max(0, VERBOSITY + verbose - quiet) + + if args.sort.startswith('filename') and not args.group: + args.group = 'filename' + + if args.rc is None: + if '-scope=core' in args.filters or 'core' not in args.filters: + args.rc = 0 + else: + args.rc = 1 + + args.filters = _parse_filters_arg(args.filters, parser.error) + args.columns = _parse_columns_arg(args.columns, parser.error) + args.sort = _parse_sort_arg(args.sort, parser.error) + args.group = _parse_group_arg(args.group, parser.error) + + return args + + +def main(root=ROOT_DIR, filename=GLOBALS_FILE, + filters=None, columns=COLUMN_NAMES, sort=None, group=None, + verbosity=VERBOSITY, rc=1): + + log = lambda msg: ... + if verbosity >= 2: + log = lambda msg: print(msg) + + allvars = (var + for var in find_vars(root, filename) + if filter_var(var, filters)) + if sort: + allvars = sorted(allvars, key=make_sort_key(sort)) + + if group: + try: + columns.remove(group) + except ValueError: + pass + grouped = make_groups(allvars, group) + lines = format_groups(grouped, columns, COLUMN_FORMATS, COLUMN_WIDTHS) + else: + lines = format_vars(allvars, columns, COLUMN_FORMATS, COLUMN_WIDTHS) + + total = 0 + for line, count in lines: + total += count + log(line) + log('\ntotal: {}'.format(total)) + + if total and rc: + print('ERROR: found unsafe globals', file=sys.stderr) + return rc + return 0 + + +if __name__ == '__main__': + args = parse_args() + sys.exit( + main(**vars(args))) diff --git a/Tools/c-globals/ignored-globals.txt b/Tools/c-globals/ignored-globals.txt new file mode 100644 index 00000000000..4fafba6eefa --- /dev/null +++ b/Tools/c-globals/ignored-globals.txt @@ -0,0 +1,494 @@ +# All variables declared here are shared between all interpreters +# in a single process. That means that they must not be changed +# unless that change should apply to all interpreters. +# +# See check-c-globals.py. +# +# Many generic names are handled via the script: +# +# * most exceptions and all warnings handled via _is_exception() +# * for builtin modules, generic names are handled via _is_module() +# * generic names for static types handled via _is_type_var() +# * AST vars handled via _is_compiler() + + +####################################### +# main + +# Modules/getpath.c +exec_prefix +module_search_path +prefix +progpath + +# Modules/main.c +orig_argc +orig_argv + +# Python/getopt.c +opt_ptr +_PyOS_optarg +_PyOS_opterr +_PyOS_optind + + +####################################### +# REPL + +# Parser/myreadline.c +PyOS_InputHook +PyOS_ReadlineFunctionPointer +_PyOS_ReadlineLock +_PyOS_ReadlineTState + + +####################################### +# state + +# Python/dtoa.c +p5s +pmem_next # very slight race +private_mem # very slight race + +# Python/import.c +# For the moment the import lock stays global. Ultimately there should +# be a global lock for extension modules and a per-interpreter lock. +import_lock +import_lock_level +import_lock_thread + +# Python/pylifecycle.c +_PyRuntime + + +#--------------------------------- +# module globals (PyObject) + +# Modules/_functoolsmodule.c +kwd_mark + +# Modules/_localemodule.c +Error + +# Modules/_threadmodule.c +ThreadError + +# Modules/_tracemalloc.c +unknown_filename + +# Modules/gcmodule.c +gc_str + +# Modules/posixmodule.c +billion +posix_putenv_garbage + +# Modules/signalmodule.c +DefaultHandler +IgnoreHandler +IntHandler +ItimerError + +# Modules/zipimport.c +ZipImportError +zip_directory_cache + + +#--------------------------------- +# module globals (other) + +# Modules/_tracemalloc.c +allocators +tables_lock +tracemalloc_config +tracemalloc_empty_traceback +tracemalloc_filenames +tracemalloc_peak_traced_memory +tracemalloc_reentrant_key +tracemalloc_traceback +tracemalloc_tracebacks +tracemalloc_traced_memory +tracemalloc_traces + +# Modules/faulthandler.c +fatal_error +faulthandler_handlers +old_stack +stack +thread +user_signals + +# Modules/posixmodule.c +posix_constants_confstr +posix_constants_pathconf +posix_constants_sysconf +_stat_float_times # deprecated, __main__-only +structseq_new +ticks_per_second + +# Modules/signalmodule.c +Handlers # main thread only +is_tripped # main thread only +main_pid +main_thread +old_siginthandler +wakeup_fd # main thread only + +# Modules/zipimport.c +zip_searchorder + +# Python/bltinmodule.c +Py_FileSystemDefaultEncodeErrors +Py_FileSystemDefaultEncoding +Py_HasFileSystemDefaultEncoding + +# Python/sysmodule.c +_PySys_ImplCacheTag +_PySys_ImplName + + +#--------------------------------- +# freelists + +# Modules/_collectionsmodule.c +freeblocks +numfreeblocks + +# Objects/classobject.c +free_list +numfree + +# Objects/dictobject.c +free_list +keys_free_list +numfree +numfreekeys + +# Objects/exceptions.c +memerrors_freelist +memerrors_numfree + +# Objects/floatobject.c +free_list +numfree + +# Objects/frameobject.c +free_list +numfree + +# Objects/genobject.c +ag_asend_freelist +ag_asend_freelist_free +ag_value_freelist +ag_value_freelist_free + +# Objects/listobject.c +free_list +numfree + +# Objects/methodobject.c +free_list +numfree + +# Objects/sliceobject.c +slice_cache # slight race + +# Objects/tupleobject.c +free_list +numfree + +# Python/dtoa.c +freelist # very slight race + + +#--------------------------------- +# caches (PyObject) + +# Objects/typeobject.c +method_cache # only for static types +next_version_tag # only for static types + +# Python/dynload_shlib.c +handles # slight race during import +nhandles # slight race during import + +# Python/import.c +extensions # slight race on init during import + + +#--------------------------------- +# caches (other) + +# Python/bootstrap_hash.c +urandom_cache + +# Python/modsupport.c +_Py_PackageContext # Slight race during import! Move to PyThreadState? + + +#--------------------------------- +# counters + +# Objects/bytesobject.c +null_strings +one_strings + +# Objects/dictobject.c +pydict_global_version + +# Objects/moduleobject.c +max_module_number # slight race during import + + +####################################### +# constants + +#--------------------------------- +# singletons + +# Objects/boolobject.c +_Py_FalseStruct +_Py_TrueStruct + +# Objects/object.c +_Py_NoneStruct +_Py_NotImplementedStruct + +# Objects/sliceobject.c +_Py_EllipsisObject + + +#--------------------------------- +# constants (other) + +# Modules/config.c +_PyImport_Inittab + +# Objects/bytearrayobject.c +_PyByteArray_empty_string + +# Objects/dictobject.c +empty_keys_struct +empty_values + +# Objects/floatobject.c +detected_double_format +detected_float_format +double_format +float_format + +# Objects/longobject.c +_PyLong_DigitValue + +# Objects/object.c +_Py_SwappedOp + +# Objects/obmalloc.c +_PyMem_Debug + +# Objects/setobject.c +_dummy_struct + +# Objects/structseq.c +PyStructSequence_UnnamedField + +# Objects/typeobject.c +name_op +slotdefs # almost +slotdefs_initialized # almost +subtype_getsets_dict_only +subtype_getsets_full +subtype_getsets_weakref_only +tp_new_methoddef + +# Objects/unicodeobject.c +bloom_linebreak +static_strings # slight race + +# Parser/tokenizer.c +_PyParser_TokenNames + +# Python/Python-ast.c +alias_fields + +# Python/codecs.c +Py_hexdigits +ucnhash_CAPI # slight performance-only race + +# Python/dynload_shlib.c +_PyImport_DynLoadFiletab + +# Python/fileutils.c +_Py_open_cloexec_works +force_ascii + +# Python/frozen.c +M___hello__ +PyImport_FrozenModules + +# Python/graminit.c +_PyParser_Grammar +dfas +labels + +# Python/import.c +PyImport_Inittab + +# Python/pylifecycle.c +_TARGET_LOCALES + + +#--------------------------------- +# initialized (PyObject) + +# Objects/bytesobject.c +characters +nullstring + +# Objects/exceptions.c +PyExc_RecursionErrorInst +errnomap + +# Objects/longobject.c +_PyLong_One +_PyLong_Zero +small_ints + +# Objects/setobject.c +emptyfrozenset + +# Objects/unicodeobject.c +interned # slight race on init in PyUnicode_InternInPlace() +unicode_empty +unicode_latin1 + + +#--------------------------------- +# initialized (other) + +# Python/getargs.c +static_arg_parsers + +# Python/pyhash.c +PyHash_Func +_Py_HashSecret +_Py_HashSecret_Initialized + +# Python/pylifecycle.c +_Py_StandardStreamEncoding +_Py_StandardStreamErrors +default_home +env_home +progname +Py_BytesWarningFlag +Py_DebugFlag +Py_DontWriteBytecodeFlag +Py_FrozenFlag +Py_HashRandomizationFlag +Py_IgnoreEnvironmentFlag +Py_InspectFlag +Py_InteractiveFlag +Py_IsolatedFlag +Py_NoSiteFlag +Py_NoUserSiteDirectory +Py_OptimizeFlag +Py_QuietFlag +Py_UnbufferedStdioFlag +Py_UseClassExceptionsFlag +Py_VerboseFlag + + +#--------------------------------- +# types + +# Modules/_threadmodule.c +Locktype +RLocktype +localdummytype +localtype + +# Objects/exceptions.c +PyExc_BaseException +PyExc_Exception +PyExc_GeneratorExit +PyExc_KeyboardInterrupt +PyExc_StopAsyncIteration +PyExc_StopIteration +PyExc_SystemExit +_PyExc_BaseException +_PyExc_Exception +_PyExc_GeneratorExit +_PyExc_KeyboardInterrupt +_PyExc_StopAsyncIteration +_PyExc_StopIteration +_PyExc_SystemExit + +# Objects/structseq.c +_struct_sequence_template + + +#--------------------------------- +# interned strings/bytes + +# Modules/_io/_iomodule.c +_PyIO_empty_bytes +_PyIO_empty_str +_PyIO_str_close +_PyIO_str_closed +_PyIO_str_decode +_PyIO_str_encode +_PyIO_str_fileno +_PyIO_str_flush +_PyIO_str_getstate +_PyIO_str_isatty +_PyIO_str_newlines +_PyIO_str_nl +_PyIO_str_read +_PyIO_str_read1 +_PyIO_str_readable +_PyIO_str_readall +_PyIO_str_readinto +_PyIO_str_readline +_PyIO_str_reset +_PyIO_str_seek +_PyIO_str_seekable +_PyIO_str_setstate +_PyIO_str_tell +_PyIO_str_truncate +_PyIO_str_writable +_PyIO_str_write + +# Modules/_threadmodule.c +str_dict + +# Objects/boolobject.c +false_str +true_str + +# Objects/listobject.c +indexerr + +# Python/symtable.c +__class__ +dictcomp +genexpr +lambda +listcomp +setcomp +top + +# Python/sysmodule.c +whatstrings + + +####################################### +# hacks + +# Objects/object.c +_Py_abstract_hack + +# Objects/setobject.c +_PySet_Dummy + +# Python/pylifecycle.c +_PyOS_mystrnicmp_hack From webhook-mailer at python.org Tue Sep 5 21:43:17 2017 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 06 Sep 2017 01:43:17 -0000 Subject: [Python-checkins] bpo-31355: Travis CI: remove the macOS job (#3367) Message-ID: https://github.com/python/cpython/commit/11453524ed26ee449275c32bedfd86ef19dd91ee commit: 11453524ed26ee449275c32bedfd86ef19dd91ee branch: 3.6 author: Victor Stinner committer: Ned Deily date: 2017-09-05T18:41:28-07:00 summary: bpo-31355: Travis CI: remove the macOS job (#3367) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 4a507c995e3..031ba792cbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,15 +25,6 @@ matrix: # compiler here and the other to run the coverage build. Clang is preferred # in this instance for its better error messages. env: TESTING=cpython - - os: osx - language: c - compiler: clang - # Testing under macOS is optional until testing stability has been demonstrated. - env: OPTIONAL=true - before_install: - - brew install openssl xz - - export CPPFLAGS="-I$(brew --prefix openssl)/include" - - export LDFLAGS="-L$(brew --prefix openssl)/lib" - os: linux language: python python: 3.6 From webhook-mailer at python.org Tue Sep 5 21:45:29 2017 From: webhook-mailer at python.org (Ned Deily) Date: Wed, 06 Sep 2017 01:45:29 -0000 Subject: [Python-checkins] bpo-31355: Travis CI: remove the macOS job (#3367) Message-ID: https://github.com/python/cpython/commit/2bc83afb30850f682487ffa560c9e3663788baaa commit: 2bc83afb30850f682487ffa560c9e3663788baaa branch: 2.7 author: Victor Stinner committer: Ned Deily date: 2017-09-05T18:44:40-07:00 summary: bpo-31355: Travis CI: remove the macOS job (#3367) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 571dd045e2d..6a64ec62ab8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,15 +25,6 @@ matrix: # compiler here and the other to run the coverage build. Clang is preferred # in this instance for its better error messages. env: TESTING=cpython - - os: osx - language: c - compiler: clang - # Testing under macOS is optional until testing stability has been demonstrated. - env: OPTIONAL=true - before_install: - - brew install openssl xz - - export CPPFLAGS="-I$(brew --prefix openssl)/include" - - export LDFLAGS="-L$(brew --prefix openssl)/lib" - os: linux language: python python: 2.7 From webhook-mailer at python.org Tue Sep 5 23:05:38 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 06 Sep 2017 03:05:38 -0000 Subject: [Python-checkins] bpo-31350: Optimize get_event_loop and _get_running_loop (GH-3347) (GH-3373) Message-ID: https://github.com/python/cpython/commit/ff125e1aa9ee4eb928de79320a0e7c1b0c0f58f4 commit: ff125e1aa9ee4eb928de79320a0e7c1b0c0f58f4 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-05T20:05:35-07:00 summary: bpo-31350: Optimize get_event_loop and _get_running_loop (GH-3347) (GH-3373) * call remove_done_callback in finally section * Optimize get_event_loop and _get_running_loop * rename _loop_pid as loop_pid and add blurb news * rename _loop_pid as loop_pid and add blurb news * add back _RunningLoop * Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst * Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst (cherry picked from commit 80bbe6a7b67f33d0d0976bb8e3e5ba26b6b0e626) files: A Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst M Lib/asyncio/events.py diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index e85634e588f..d41f3f5b755 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -611,8 +611,7 @@ def new_event_loop(self): # A TLS for the running event loop, used by _get_running_loop. class _RunningLoop(threading.local): - _loop = None - _pid = None + loop_pid = (None, None) _running_loop = _RunningLoop() @@ -624,8 +623,8 @@ def _get_running_loop(): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - running_loop = _running_loop._loop - if running_loop is not None and _running_loop._pid == os.getpid(): + running_loop, pid = _running_loop.loop_pid + if running_loop is not None and pid == os.getpid(): return running_loop @@ -635,8 +634,7 @@ def _set_running_loop(loop): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - _running_loop._pid = os.getpid() - _running_loop._loop = loop + _running_loop.loop_pid = (loop, os.getpid()) def _init_event_loop_policy(): diff --git a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst new file mode 100644 index 00000000000..299cf3c9d54 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst @@ -0,0 +1 @@ +Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. From webhook-mailer at python.org Tue Sep 5 23:19:15 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 06 Sep 2017 03:19:15 -0000 Subject: [Python-checkins] correct initialization code (#3376) Message-ID: https://github.com/python/cpython/commit/b0a9a5a6a4786a6f8f0540e243427775d8ca245e commit: b0a9a5a6a4786a6f8f0540e243427775d8ca245e branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-05T20:19:12-07:00 summary: correct initialization code (#3376) Explicitly initialize struct members rather than relying on compiler extensions. files: M Python/pylifecycle.c M Python/pystate.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index f33e920e6b5..3f405b1225a 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -77,7 +77,7 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); #endif /* WITH_THREAD */ -_PyRuntimeState _PyRuntime = {}; +_PyRuntimeState _PyRuntime = {0, 0}; void _PyRuntime_Initialize(void) diff --git a/Python/pystate.c b/Python/pystate.c index 3d3207702f8..2d926372fd6 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -37,8 +37,7 @@ extern "C" { void _PyRuntimeState_Init(_PyRuntimeState *runtime) { - _PyRuntimeState initial = {}; - *runtime = initial; + memset(runtime, 0, sizeof(*runtime)); _PyObject_Initialize(&runtime->obj); _PyMem_Initialize(&runtime->mem); From webhook-mailer at python.org Tue Sep 5 23:45:52 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 06 Sep 2017 03:45:52 -0000 Subject: [Python-checkins] pytime: include winsock2, so we can have a complete timeval type (#3377) Message-ID: https://github.com/python/cpython/commit/833860615bedfd2484ac0623d6f01ff0578ba09f commit: 833860615bedfd2484ac0623d6f01ff0578ba09f branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-05T20:45:48-07:00 summary: pytime: include winsock2, so we can have a complete timeval type (#3377) files: M Python/pytime.c diff --git a/Python/pytime.c b/Python/pytime.c index 8979adc2191..b7d6e84101d 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -1,6 +1,7 @@ #include "Python.h" #ifdef MS_WINDOWS #include +#include /* struct timeval */ #endif #if defined(__APPLE__) From webhook-mailer at python.org Wed Sep 6 00:43:12 2017 From: webhook-mailer at python.org (Eric Snow) Date: Wed, 06 Sep 2017 04:43:12 -0000 Subject: [Python-checkins] Revert "bpo-30860: Consolidate stateful runtime globals." (#3379) Message-ID: https://github.com/python/cpython/commit/05351c1bd8b70d1878527762174cdaaba3572395 commit: 05351c1bd8b70d1878527762174cdaaba3572395 branch: master author: Eric Snow committer: GitHub date: 2017-09-05T21:43:08-07:00 summary: Revert "bpo-30860: Consolidate stateful runtime globals." (#3379) Windows buildbots started failing due to include-related errors. files: D Include/internal/_Python.h D Include/internal/_ceval.h D Include/internal/_condvar.h D Include/internal/_gil.h D Include/internal/_mem.h D Include/internal/_pymalloc.h D Include/internal/_pystate.h D Include/internal/_warnings.h D Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst D Tools/c-globals/README D Tools/c-globals/check-c-globals.py D Tools/c-globals/ignored-globals.txt M Include/Python.h M Include/ceval.h M Include/object.h M Include/pylifecycle.h M Include/pystate.h M Makefile.pre.in M Modules/_io/bufferedio.c M Modules/_threadmodule.c M Modules/_winapi.c M Modules/gcmodule.c M Modules/main.c M Objects/object.c M Objects/obmalloc.c M Objects/setobject.c M Objects/typeobject.c M PCbuild/pythoncore.vcxproj M PCbuild/pythoncore.vcxproj.filters M Parser/pgenmain.c M Python/_warnings.c M Python/ceval.c M Python/ceval_gil.h M Python/condvar.h M Python/pylifecycle.c M Python/pystate.c M Python/sysmodule.c M Python/thread.c M Python/thread_nt.h M Python/thread_pthread.h diff --git a/Include/Python.h b/Include/Python.h index 3ab9fe914ec..061d693f34b 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -133,8 +133,4 @@ #include "fileutils.h" #include "pyfpe.h" -#ifdef Py_BUILD_CORE -#include "internal/_Python.h" -#endif - #endif /* !Py_PYTHON_H */ diff --git a/Include/ceval.h b/Include/ceval.h index 7cbbf7c5287..b2d57cbd6f7 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -93,12 +93,7 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void); PyThreadState_GET()->overflowed = 0; \ } while(0) PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); -#ifdef Py_BUILD_CORE -#define _Py_CheckRecursionLimit _PyRuntime.ceval.check_recursion_limit -#else -PyAPI_FUNC(int) _PyEval_CheckRecursionLimit(void); -#define _Py_CheckRecursionLimit _PyEval_CheckRecursionLimit() -#endif +PyAPI_DATA(int) _Py_CheckRecursionLimit; #ifdef USE_STACKCHECK /* With USE_STACKCHECK, we artificially decrement the recursion limit in order diff --git a/Include/internal/_Python.h b/Include/internal/_Python.h deleted file mode 100644 index c56e98f740b..00000000000 --- a/Include/internal/_Python.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _Py_PYTHON_H -#define _Py_PYTHON_H -/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ - -/* Include all internal Python header files */ - -#ifndef Py_BUILD_CORE -#error "Internal headers are not available externally." -#endif - -#include "_mem.h" -#include "_ceval.h" -#include "_warnings.h" -#include "_pystate.h" - -#endif /* !_Py_PYTHON_H */ diff --git a/Include/internal/_ceval.h b/Include/internal/_ceval.h deleted file mode 100644 index c2343f11323..00000000000 --- a/Include/internal/_ceval.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _Py_CEVAL_H -#define _Py_CEVAL_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "ceval.h" -#include "compile.h" -#include "pyatomic.h" - -#ifdef WITH_THREAD -#include "pythread.h" -#endif - -struct _pending_calls { - unsigned long main_thread; -#ifdef WITH_THREAD - PyThread_type_lock lock; - /* Request for running pending calls. */ - _Py_atomic_int calls_to_do; - /* Request for looking at the `async_exc` field of the current - thread state. - Guarded by the GIL. */ - int async_exc; -#define NPENDINGCALLS 32 - struct { - int (*func)(void *); - void *arg; - } calls[NPENDINGCALLS]; - int first; - int last; -#else /* ! WITH_THREAD */ - _Py_atomic_int calls_to_do; -#define NPENDINGCALLS 32 - struct { - int (*func)(void *); - void *arg; - } calls[NPENDINGCALLS]; - volatile int first; - volatile int last; -#endif /* WITH_THREAD */ -}; - -#include "_gil.h" - -struct _ceval_runtime_state { - int recursion_limit; - int check_recursion_limit; - /* Records whether tracing is on for any thread. Counts the number - of threads for which tstate->c_tracefunc is non-NULL, so if the - value is 0, we know we don't have to check this thread's - c_tracefunc. This speeds up the if statement in - PyEval_EvalFrameEx() after fast_next_opcode. */ - int tracing_possible; - /* This single variable consolidates all requests to break out of - the fast path in the eval loop. */ - _Py_atomic_int eval_breaker; -#ifdef WITH_THREAD - /* Request for dropping the GIL */ - _Py_atomic_int gil_drop_request; -#endif - struct _pending_calls pending; - struct _gil_runtime_state gil; -}; - -PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); - -#ifdef __cplusplus -} -#endif -#endif /* !_Py_CEVAL_H */ diff --git a/Include/internal/_condvar.h b/Include/internal/_condvar.h deleted file mode 100644 index 6827db7e0b4..00000000000 --- a/Include/internal/_condvar.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _CONDVAR_H_ -#define _CONDVAR_H_ - -#ifndef _POSIX_THREADS -/* This means pthreads are not implemented in libc headers, hence the macro - not present in unistd.h. But they still can be implemented as an external - library (e.g. gnu pth in pthread emulation) */ -# ifdef HAVE_PTHREAD_H -# include /* _POSIX_THREADS */ -# endif -#endif - -#ifdef _POSIX_THREADS -/* - * POSIX support - */ -#define Py_HAVE_CONDVAR - -#include - -#define PyMUTEX_T pthread_mutex_t -#define PyCOND_T pthread_cond_t - -#elif defined(NT_THREADS) -/* - * Windows (XP, 2003 server and later, as well as (hopefully) CE) support - * - * Emulated condition variables ones that work with XP and later, plus - * example native support on VISTA and onwards. - */ -#define Py_HAVE_CONDVAR - -/* include windows if it hasn't been done before */ -#define WIN32_LEAN_AND_MEAN -#include - -/* options */ -/* non-emulated condition variables are provided for those that want - * to target Windows Vista. Modify this macro to enable them. - */ -#ifndef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ -#endif - -/* fall back to emulation if not targeting Vista */ -#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA -#undef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 -#endif - -#if _PY_EMULATED_WIN_CV - -typedef CRITICAL_SECTION PyMUTEX_T; - -/* The ConditionVariable object. From XP onwards it is easily emulated - with a Semaphore. - Semaphores are available on Windows XP (2003 server) and later. - We use a Semaphore rather than an auto-reset event, because although - an auto-resent event might appear to solve the lost-wakeup bug (race - condition between releasing the outer lock and waiting) because it - maintains state even though a wait hasn't happened, there is still - a lost wakeup problem if more than one thread are interrupted in the - critical place. A semaphore solves that, because its state is - counted, not Boolean. - Because it is ok to signal a condition variable with no one - waiting, we need to keep track of the number of - waiting threads. Otherwise, the semaphore's state could rise - without bound. This also helps reduce the number of "spurious wakeups" - that would otherwise happen. - */ - -typedef struct _PyCOND_T -{ - HANDLE sem; - int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ -} PyCOND_T; - -#else /* !_PY_EMULATED_WIN_CV */ - -/* Use native Win7 primitives if build target is Win7 or higher */ - -/* SRWLOCK is faster and better than CriticalSection */ -typedef SRWLOCK PyMUTEX_T; - -typedef CONDITION_VARIABLE PyCOND_T; - -#endif /* _PY_EMULATED_WIN_CV */ - -#endif /* _POSIX_THREADS, NT_THREADS */ - -#endif /* _CONDVAR_H_ */ diff --git a/Include/internal/_gil.h b/Include/internal/_gil.h deleted file mode 100644 index 42301bf3fca..00000000000 --- a/Include/internal/_gil.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _Py_GIL_H -#define _Py_GIL_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "pyatomic.h" - -#include "internal/_condvar.h" -#ifndef Py_HAVE_CONDVAR -#error You need either a POSIX-compatible or a Windows system! -#endif - -/* Enable if you want to force the switching of threads at least - every `interval`. */ -#undef FORCE_SWITCHING -#define FORCE_SWITCHING - -struct _gil_runtime_state { - /* microseconds (the Python API uses seconds, though) */ - unsigned long interval; - /* Last PyThreadState holding / having held the GIL. This helps us - know whether anyone else was scheduled after we dropped the GIL. */ - _Py_atomic_address last_holder; - /* Whether the GIL is already taken (-1 if uninitialized). This is - atomic because it can be read without any lock taken in ceval.c. */ - _Py_atomic_int locked; - /* Number of GIL switches since the beginning. */ - unsigned long switch_number; -#ifdef WITH_THREAD - /* This condition variable allows one or several threads to wait - until the GIL is released. In addition, the mutex also protects - the above variables. */ - PyCOND_T cond; - PyMUTEX_T mutex; -#ifdef FORCE_SWITCHING - /* This condition variable helps the GIL-releasing thread wait for - a GIL-awaiting thread to be scheduled and take the GIL. */ - PyCOND_T switch_cond; - PyMUTEX_T switch_mutex; -#endif -#endif /* WITH_THREAD */ -}; - -#ifdef __cplusplus -} -#endif -#endif /* !_Py_GIL_H */ diff --git a/Include/internal/_mem.h b/Include/internal/_mem.h deleted file mode 100644 index 2932377148e..00000000000 --- a/Include/internal/_mem.h +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef _Py_MEM_H -#define _Py_MEM_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "objimpl.h" -#include "pymem.h" - -#ifdef WITH_PYMALLOC -#include "_pymalloc.h" -#endif - -/* Low-level memory runtime state */ - -struct _pymem_runtime_state { - struct _allocator_runtime_state { - PyMemAllocatorEx mem; - PyMemAllocatorEx obj; - PyMemAllocatorEx raw; - } allocators; -#ifdef WITH_PYMALLOC - /* Array of objects used to track chunks of memory (arenas). */ - struct arena_object* arenas; - /* The head of the singly-linked, NULL-terminated list of available - arena_objects. */ - struct arena_object* unused_arena_objects; - /* The head of the doubly-linked, NULL-terminated at each end, - list of arena_objects associated with arenas that have pools - available. */ - struct arena_object* usable_arenas; - /* Number of slots currently allocated in the `arenas` vector. */ - unsigned int maxarenas; - /* Number of arenas allocated that haven't been free()'d. */ - size_t narenas_currently_allocated; - /* High water mark (max value ever seen) for - * narenas_currently_allocated. */ - size_t narenas_highwater; - /* Total number of times malloc() called to allocate an arena. */ - size_t ntimes_arena_allocated; - poolp usedpools[MAX_POOLS]; - Py_ssize_t num_allocated_blocks; - size_t serialno; /* incremented on each debug {m,re}alloc */ -#endif /* WITH_PYMALLOC */ -}; - -PyAPI_FUNC(void) _PyMem_Initialize(struct _pymem_runtime_state *); - - -/* High-level memory runtime state */ - -struct _pyobj_runtime_state { - PyObjectArenaAllocator allocator_arenas; -}; - -PyAPI_FUNC(void) _PyObject_Initialize(struct _pyobj_runtime_state *); - - -/* GC runtime state */ - -/* If we change this, we need to change the default value in the - signature of gc.collect. */ -#define NUM_GENERATIONS 3 - -/* - NOTE: about the counting of long-lived objects. - - To limit the cost of garbage collection, there are two strategies; - - make each collection faster, e.g. by scanning fewer objects - - do less collections - This heuristic is about the latter strategy. - - In addition to the various configurable thresholds, we only trigger a - full collection if the ratio - long_lived_pending / long_lived_total - is above a given value (hardwired to 25%). - - The reason is that, while "non-full" collections (i.e., collections of - the young and middle generations) will always examine roughly the same - number of objects -- determined by the aforementioned thresholds --, - the cost of a full collection is proportional to the total number of - long-lived objects, which is virtually unbounded. - - Indeed, it has been remarked that doing a full collection every - of object creations entails a dramatic performance - degradation in workloads which consist in creating and storing lots of - long-lived objects (e.g. building a large list of GC-tracked objects would - show quadratic performance, instead of linear as expected: see issue #4074). - - Using the above ratio, instead, yields amortized linear performance in - the total number of objects (the effect of which can be summarized - thusly: "each full garbage collection is more and more costly as the - number of objects grows, but we do fewer and fewer of them"). - - This heuristic was suggested by Martin von L?wis on python-dev in - June 2008. His original analysis and proposal can be found at: - http://mail.python.org/pipermail/python-dev/2008-June/080579.html -*/ - -/* - NOTE: about untracking of mutable objects. - - Certain types of container cannot participate in a reference cycle, and - so do not need to be tracked by the garbage collector. Untracking these - objects reduces the cost of garbage collections. However, determining - which objects may be untracked is not free, and the costs must be - weighed against the benefits for garbage collection. - - There are two possible strategies for when to untrack a container: - - i) When the container is created. - ii) When the container is examined by the garbage collector. - - Tuples containing only immutable objects (integers, strings etc, and - recursively, tuples of immutable objects) do not need to be tracked. - The interpreter creates a large number of tuples, many of which will - not survive until garbage collection. It is therefore not worthwhile - to untrack eligible tuples at creation time. - - Instead, all tuples except the empty tuple are tracked when created. - During garbage collection it is determined whether any surviving tuples - can be untracked. A tuple can be untracked if all of its contents are - already not tracked. Tuples are examined for untracking in all garbage - collection cycles. It may take more than one cycle to untrack a tuple. - - Dictionaries containing only immutable objects also do not need to be - tracked. Dictionaries are untracked when created. If a tracked item is - inserted into a dictionary (either as a key or value), the dictionary - becomes tracked. During a full garbage collection (all generations), - the collector will untrack any dictionaries whose contents are not - tracked. - - The module provides the python function is_tracked(obj), which returns - the CURRENT tracking status of the object. Subsequent garbage - collections may change the tracking status of the object. - - Untracking of certain containers was introduced in issue #4688, and - the algorithm was refined in response to issue #14775. -*/ - -struct gc_generation { - PyGC_Head head; - int threshold; /* collection threshold */ - int count; /* count of allocations or collections of younger - generations */ -}; - -/* Running stats per generation */ -struct gc_generation_stats { - /* total number of collections */ - Py_ssize_t collections; - /* total number of collected objects */ - Py_ssize_t collected; - /* total number of uncollectable objects (put into gc.garbage) */ - Py_ssize_t uncollectable; -}; - -struct _gc_runtime_state { - /* List of objects that still need to be cleaned up, singly linked - * via their gc headers' gc_prev pointers. */ - PyObject *trash_delete_later; - /* Current call-stack depth of tp_dealloc calls. */ - int trash_delete_nesting; - - int enabled; - int debug; - /* linked lists of container objects */ - struct gc_generation generations[NUM_GENERATIONS]; - PyGC_Head *generation0; - struct gc_generation_stats generation_stats[NUM_GENERATIONS]; - /* true if we are currently running the collector */ - int collecting; - /* list of uncollectable objects */ - PyObject *garbage; - /* a list of callbacks to be invoked when collection is performed */ - PyObject *callbacks; - /* This is the number of objects that survived the last full - collection. It approximates the number of long lived objects - tracked by the GC. - - (by "full collection", we mean a collection of the oldest - generation). */ - Py_ssize_t long_lived_total; - /* This is the number of objects that survived all "non-full" - collections, and are awaiting to undergo a full collection for - the first time. */ - Py_ssize_t long_lived_pending; -}; - -PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *); - -#define _PyGC_generation0 _PyRuntime.gc.generation0 - -#ifdef __cplusplus -} -#endif -#endif /* !_Py_MEM_H */ diff --git a/Include/internal/_pymalloc.h b/Include/internal/_pymalloc.h deleted file mode 100644 index 764edf94ffd..00000000000 --- a/Include/internal/_pymalloc.h +++ /dev/null @@ -1,443 +0,0 @@ - -/* An object allocator for Python. - - Here is an introduction to the layers of the Python memory architecture, - showing where the object allocator is actually used (layer +2), It is - called for every object allocation and deallocation (PyObject_New/Del), - unless the object-specific allocators implement a proprietary allocation - scheme (ex.: ints use a simple free list). This is also the place where - the cyclic garbage collector operates selectively on container objects. - - - Object-specific allocators - _____ ______ ______ ________ - [ int ] [ dict ] [ list ] ... [ string ] Python core | -+3 | <----- Object-specific memory -----> | <-- Non-object memory --> | - _______________________________ | | - [ Python's object allocator ] | | -+2 | ####### Object memory ####### | <------ Internal buffers ------> | - ______________________________________________________________ | - [ Python's raw memory allocator (PyMem_ API) ] | -+1 | <----- Python memory (under PyMem manager's control) ------> | | - __________________________________________________________________ - [ Underlying general-purpose allocator (ex: C library malloc) ] - 0 | <------ Virtual memory allocated for the python process -------> | - - ========================================================================= - _______________________________________________________________________ - [ OS-specific Virtual Memory Manager (VMM) ] --1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | - __________________________________ __________________________________ - [ ] [ ] --2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | - -*/ -/*==========================================================================*/ - -/* A fast, special-purpose memory allocator for small blocks, to be used - on top of a general-purpose malloc -- heavily based on previous art. */ - -/* Vladimir Marangozov -- August 2000 */ - -/* - * "Memory management is where the rubber meets the road -- if we do the wrong - * thing at any level, the results will not be good. And if we don't make the - * levels work well together, we are in serious trouble." (1) - * - * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, - * "Dynamic Storage Allocation: A Survey and Critical Review", - * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. - */ - -#ifndef _Py_PYMALLOC_H -#define _Py_PYMALLOC_H - -/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ - -/*==========================================================================*/ - -/* - * Allocation strategy abstract: - * - * For small requests, the allocator sub-allocates blocks of memory. - * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the - * system's allocator. - * - * Small requests are grouped in size classes spaced 8 bytes apart, due - * to the required valid alignment of the returned address. Requests of - * a particular size are serviced from memory pools of 4K (one VMM page). - * Pools are fragmented on demand and contain free lists of blocks of one - * particular size class. In other words, there is a fixed-size allocator - * for each size class. Free pools are shared by the different allocators - * thus minimizing the space reserved for a particular size class. - * - * This allocation strategy is a variant of what is known as "simple - * segregated storage based on array of free lists". The main drawback of - * simple segregated storage is that we might end up with lot of reserved - * memory for the different free lists, which degenerate in time. To avoid - * this, we partition each free list in pools and we share dynamically the - * reserved space between all free lists. This technique is quite efficient - * for memory intensive programs which allocate mainly small-sized blocks. - * - * For small requests we have the following table: - * - * Request in bytes Size of allocated block Size class idx - * ---------------------------------------------------------------- - * 1-8 8 0 - * 9-16 16 1 - * 17-24 24 2 - * 25-32 32 3 - * 33-40 40 4 - * 41-48 48 5 - * 49-56 56 6 - * 57-64 64 7 - * 65-72 72 8 - * ... ... ... - * 497-504 504 62 - * 505-512 512 63 - * - * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying - * allocator. - */ - -/*==========================================================================*/ - -/* - * -- Main tunable settings section -- - */ - -/* - * Alignment of addresses returned to the user. 8-bytes alignment works - * on most current architectures (with 32-bit or 64-bit address busses). - * The alignment value is also used for grouping small requests in size - * classes spaced ALIGNMENT bytes apart. - * - * You shouldn't change this unless you know what you are doing. - */ -#define ALIGNMENT 8 /* must be 2^N */ -#define ALIGNMENT_SHIFT 3 - -/* Return the number of bytes in size class I, as a uint. */ -#define INDEX2SIZE(I) (((unsigned int)(I) + 1) << ALIGNMENT_SHIFT) - -/* - * Max size threshold below which malloc requests are considered to be - * small enough in order to use preallocated memory pools. You can tune - * this value according to your application behaviour and memory needs. - * - * Note: a size threshold of 512 guarantees that newly created dictionaries - * will be allocated from preallocated memory pools on 64-bit. - * - * The following invariants must hold: - * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 - * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT - * - * Although not required, for better performance and space efficiency, - * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. - */ -#define SMALL_REQUEST_THRESHOLD 512 -#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) - -#if NB_SMALL_SIZE_CLASSES > 64 -#error "NB_SMALL_SIZE_CLASSES should be less than 64" -#endif /* NB_SMALL_SIZE_CLASSES > 64 */ - -/* - * The system's VMM page size can be obtained on most unices with a - * getpagesize() call or deduced from various header files. To make - * things simpler, we assume that it is 4K, which is OK for most systems. - * It is probably better if this is the native page size, but it doesn't - * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page - * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation - * violation fault. 4K is apparently OK for all the platforms that python - * currently targets. - */ -#define SYSTEM_PAGE_SIZE (4 * 1024) -#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) - -/* - * Maximum amount of memory managed by the allocator for small requests. - */ -#ifdef WITH_MEMORY_LIMITS -#ifndef SMALL_MEMORY_LIMIT -#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ -#endif -#endif - -/* - * The allocator sub-allocates blocks of memory (called arenas) aligned - * on a page boundary. This is a reserved virtual address space for the - * current process (obtained through a malloc()/mmap() call). In no way this - * means that the memory arenas will be used entirely. A malloc() is - * usually an address range reservation for bytes, unless all pages within - * this space are referenced subsequently. So malloc'ing big blocks and not - * using them does not mean "wasting memory". It's an addressable range - * wastage... - * - * Arenas are allocated with mmap() on systems supporting anonymous memory - * mappings to reduce heap fragmentation. - */ -#define ARENA_SIZE (256 << 10) /* 256KB */ - -#ifdef WITH_MEMORY_LIMITS -#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) -#endif - -/* - * Size of the pools used for small blocks. Should be a power of 2, - * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. - */ -#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ -#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK - -/* - * -- End of tunable settings section -- - */ - -/*==========================================================================*/ - -/* - * Locking - * - * To reduce lock contention, it would probably be better to refine the - * crude function locking with per size class locking. I'm not positive - * however, whether it's worth switching to such locking policy because - * of the performance penalty it might introduce. - * - * The following macros describe the simplest (should also be the fastest) - * lock object on a particular platform and the init/fini/lock/unlock - * operations on it. The locks defined here are not expected to be recursive - * because it is assumed that they will always be called in the order: - * INIT, [LOCK, UNLOCK]*, FINI. - */ - -/* - * Python's threads are serialized, so object malloc locking is disabled. - */ -#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ -#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ -#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ -#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ -#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ - -/* When you say memory, my mind reasons in terms of (pointers to) blocks */ -typedef uint8_t pyblock; - -/* Pool for small blocks. */ -struct pool_header { - union { pyblock *_padding; - unsigned int count; } ref; /* number of allocated blocks */ - pyblock *freeblock; /* pool's free list head */ - struct pool_header *nextpool; /* next pool of this size class */ - struct pool_header *prevpool; /* previous pool "" */ - unsigned int arenaindex; /* index into arenas of base adr */ - unsigned int szidx; /* block size class index */ - unsigned int nextoffset; /* bytes to virgin block */ - unsigned int maxnextoffset; /* largest valid nextoffset */ -}; - -typedef struct pool_header *poolp; - -/* Record keeping for arenas. */ -struct arena_object { - /* The address of the arena, as returned by malloc. Note that 0 - * will never be returned by a successful malloc, and is used - * here to mark an arena_object that doesn't correspond to an - * allocated arena. - */ - uintptr_t address; - - /* Pool-aligned pointer to the next pool to be carved off. */ - pyblock* pool_address; - - /* The number of available pools in the arena: free pools + never- - * allocated pools. - */ - unsigned int nfreepools; - - /* The total number of pools in the arena, whether or not available. */ - unsigned int ntotalpools; - - /* Singly-linked list of available pools. */ - struct pool_header* freepools; - - /* Whenever this arena_object is not associated with an allocated - * arena, the nextarena member is used to link all unassociated - * arena_objects in the singly-linked `unused_arena_objects` list. - * The prevarena member is unused in this case. - * - * When this arena_object is associated with an allocated arena - * with at least one available pool, both members are used in the - * doubly-linked `usable_arenas` list, which is maintained in - * increasing order of `nfreepools` values. - * - * Else this arena_object is associated with an allocated arena - * all of whose pools are in use. `nextarena` and `prevarena` - * are both meaningless in this case. - */ - struct arena_object* nextarena; - struct arena_object* prevarena; -}; - -#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) - -#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ - -/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ -#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) - -/* Return total number of blocks in pool of size index I, as a uint. */ -#define NUMBLOCKS(I) \ - ((unsigned int)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) - -/*==========================================================================*/ - -/* - * This malloc lock - */ -SIMPLELOCK_DECL(_malloc_lock) -#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) -#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) -#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) -#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) - -/* - * Pool table -- headed, circular, doubly-linked lists of partially used pools. - -This is involved. For an index i, usedpools[i+i] is the header for a list of -all partially used pools holding small blocks with "size class idx" i. So -usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size -16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to -the start of a singly-linked list of free blocks within the pool. When a -block is freed, it's inserted at the front of its pool's freeblock list. Note -that the available blocks in a pool are *not* linked all together when a pool -is initialized. Instead only "the first two" (lowest addresses) blocks are -set up, returning the first such block, and setting pool->freeblock to a -one-block list holding the second such block. This is consistent with that -pymalloc strives at all levels (arena, pool, and block) never to touch a piece -of memory until it's actually needed. - -So long as a pool is in the used state, we're certain there *is* a block -available for allocating, and pool->freeblock is not NULL. If pool->freeblock -points to the end of the free list before we've carved the entire pool into -blocks, that means we simply haven't yet gotten to one of the higher-address -blocks. The offset from the pool_header to the start of "the next" virgin -block is stored in the pool_header nextoffset member, and the largest value -of nextoffset that makes sense is stored in the maxnextoffset member when a -pool is initialized. All the blocks in a pool have been passed out at least -once when and only when nextoffset > maxnextoffset. - - -Major obscurity: While the usedpools vector is declared to have poolp -entries, it doesn't really. It really contains two pointers per (conceptual) -poolp entry, the nextpool and prevpool members of a pool_header. The -excruciating initialization code below fools C so that - - usedpool[i+i] - -"acts like" a genuine poolp, but only so long as you only reference its -nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is -compensating for that a pool_header's nextpool and prevpool members -immediately follow a pool_header's first two members: - - union { block *_padding; - uint count; } ref; - block *freeblock; - -each of which consume sizeof(block *) bytes. So what usedpools[i+i] really -contains is a fudged-up pointer p such that *if* C believes it's a poolp -pointer, then p->nextpool and p->prevpool are both p (meaning that the headed -circular list is empty). - -It's unclear why the usedpools setup is so convoluted. It could be to -minimize the amount of cache required to hold this heavily-referenced table -(which only *needs* the two interpool pointer members of a pool_header). OTOH, -referencing code has to remember to "double the index" and doing so isn't -free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying -on that C doesn't insert any padding anywhere in a pool_header at or before -the prevpool member. -**************************************************************************** */ - -#define MAX_POOLS (2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8) - -/*========================================================================== -Arena management. - -`arenas` is a vector of arena_objects. It contains maxarenas entries, some of -which may not be currently used (== they're arena_objects that aren't -currently associated with an allocated arena). Note that arenas proper are -separately malloc'ed. - -Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, -we do try to free() arenas, and use some mild heuristic strategies to increase -the likelihood that arenas eventually can be freed. - -unused_arena_objects - - This is a singly-linked list of the arena_objects that are currently not - being used (no arena is associated with them). Objects are taken off the - head of the list in new_arena(), and are pushed on the head of the list in - PyObject_Free() when the arena is empty. Key invariant: an arena_object - is on this list if and only if its .address member is 0. - -usable_arenas - - This is a doubly-linked list of the arena_objects associated with arenas - that have pools available. These pools are either waiting to be reused, - or have not been used before. The list is sorted to have the most- - allocated arenas first (ascending order based on the nfreepools member). - This means that the next allocation will come from a heavily used arena, - which gives the nearly empty arenas a chance to be returned to the system. - In my unscientific tests this dramatically improved the number of arenas - that could be freed. - -Note that an arena_object associated with an arena all of whose pools are -currently in use isn't on either list. -*/ - -/* How many arena_objects do we initially allocate? - * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the - * `arenas` vector. - */ -#define INITIAL_ARENA_OBJECTS 16 - -#endif /* _Py_PYMALLOC_H */ diff --git a/Include/internal/_pystate.h b/Include/internal/_pystate.h deleted file mode 100644 index 9f2dea1befa..00000000000 --- a/Include/internal/_pystate.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _Py_PYSTATE_H -#define _Py_PYSTATE_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "pystate.h" -#include "pyatomic.h" - -#ifdef WITH_THREAD -#include "pythread.h" -#endif - -#include "_mem.h" -#include "_ceval.h" -#include "_warnings.h" - - -/* GIL state */ - -struct _gilstate_runtime_state { - int check_enabled; - /* Assuming the current thread holds the GIL, this is the - PyThreadState for the current thread. */ - _Py_atomic_address tstate_current; - PyThreadFrameGetter getframe; -#ifdef WITH_THREAD - /* The single PyInterpreterState used by this process' - GILState implementation - */ - /* TODO: Given interp_main, it may be possible to kill this ref */ - PyInterpreterState *autoInterpreterState; - int autoTLSkey; -#endif /* WITH_THREAD */ -}; - -/* hook for PyEval_GetFrame(), requested for Psyco */ -#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe - -/* Issue #26558: Flag to disable PyGILState_Check(). - If set to non-zero, PyGILState_Check() always return 1. */ -#define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled - - -/* Full Python runtime state */ - -typedef struct pyruntimestate { - int initialized; - int core_initialized; - PyThreadState *finalizing; - - struct pyinterpreters { -#ifdef WITH_THREAD - PyThread_type_lock mutex; -#endif - PyInterpreterState *head; - PyInterpreterState *main; - /* _next_interp_id is an auto-numbered sequence of small - integers. It gets initialized in _PyInterpreterState_Init(), - which is called in Py_Initialize(), and used in - PyInterpreterState_New(). A negative interpreter ID - indicates an error occurred. The main interpreter will - always have an ID of 0. Overflow results in a RuntimeError. - If that becomes a problem later then we can adjust, e.g. by - using a Python int. */ - int64_t next_id; - } interpreters; - -#define NEXITFUNCS 32 - void (*exitfuncs[NEXITFUNCS])(void); - int nexitfuncs; - void (*pyexitfunc)(void); - - struct _pyobj_runtime_state obj; - struct _gc_runtime_state gc; - struct _pymem_runtime_state mem; - struct _warnings_runtime_state warnings; - struct _ceval_runtime_state ceval; - struct _gilstate_runtime_state gilstate; - - // XXX Consolidate globals found via the check-c-globals script. -} _PyRuntimeState; - -PyAPI_DATA(_PyRuntimeState) _PyRuntime; -PyAPI_FUNC(void) _PyRuntimeState_Init(_PyRuntimeState *); -PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *); - -PyAPI_FUNC(void) _PyInterpreterState_Enable(_PyRuntimeState *); - -#ifdef __cplusplus -} -#endif -#endif /* !_Py_PYSTATE_H */ diff --git a/Include/internal/_warnings.h b/Include/internal/_warnings.h deleted file mode 100644 index 2a1abb2d5d2..00000000000 --- a/Include/internal/_warnings.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _Py_WARNINGS_H -#define _Py_WARNINGS_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "object.h" - -struct _warnings_runtime_state { - /* Both 'filters' and 'onceregistry' can be set in warnings.py; - get_warnings_attr() will reset these variables accordingly. */ - PyObject *filters; /* List */ - PyObject *once_registry; /* Dict */ - PyObject *default_action; /* String */ - long filters_version; -}; - -#ifdef __cplusplus -} -#endif -#endif /* !_Py_WARNINGS_H */ diff --git a/Include/object.h b/Include/object.h index b46d4c30e1e..f5ed70b1129 100644 --- a/Include/object.h +++ b/Include/object.h @@ -1038,6 +1038,8 @@ with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. Kept for binary compatibility of extensions using the stable ABI. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); +PyAPI_DATA(int) _PyTrash_delete_nesting; +PyAPI_DATA(PyObject *) _PyTrash_delete_later; #endif /* !Py_LIMITED_API */ /* The new thread-safe private API, invoked by the macros below. */ diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index b02cd4cc543..0d609ec2344 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -119,10 +119,7 @@ PyAPI_FUNC(void) _PyType_Fini(void); PyAPI_FUNC(void) _Py_HashRandomization_Fini(void); PyAPI_FUNC(void) PyAsyncGen_Fini(void); -#define _Py_IS_FINALIZING() \ - (_PyRuntime.finalizing != NULL) -#define _Py_CURRENTLY_FINALIZING(tstate) \ - (_PyRuntime.finalizing == tstate) +PyAPI_DATA(PyThreadState *) _Py_Finalizing; #endif /* Signals */ diff --git a/Include/pystate.h b/Include/pystate.h index 90081c51c0e..8a92f3ec3ed 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -29,10 +29,9 @@ typedef struct { int use_hash_seed; unsigned long hash_seed; int _disable_importlib; /* Needed by freeze_importlib */ - char *allocator; } _PyCoreConfig; -#define _PyCoreConfig_INIT {0, -1, 0, 0, NULL} +#define _PyCoreConfig_INIT {0, -1, 0, 0} /* Placeholders while working on the new configuration API * @@ -58,19 +57,6 @@ typedef struct _is { PyObject *builtins; PyObject *importlib; - /* Used in Python/sysmodule.c. */ - int check_interval; - PyObject *warnoptions; - PyObject *xoptions; - - /* Used in Modules/_threadmodule.c. */ - long num_threads; - /* Support for runtime thread stack size tuning. - A value of 0 means using the platform's default stack size - or the size specified by the THREAD_STACK_SIZE macro. */ - /* Used in Python/thread.c. */ - size_t pythread_stacksize; - PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; @@ -199,6 +185,9 @@ typedef struct _ts { #endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyInterpreterState_Init(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); @@ -257,7 +246,7 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE -# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current +PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else @@ -312,6 +301,10 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API +/* Issue #26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ +PyAPI_DATA(int) _PyGILState_check_enabled; + /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. @@ -347,6 +340,11 @@ PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); #endif +/* hook for PyEval_GetFrame(), requested for Psyco */ +#ifndef Py_LIMITED_API +PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; +#endif + #ifdef __cplusplus } #endif diff --git a/Makefile.pre.in b/Makefile.pre.in index d6ebf854eda..57d2ab72ba9 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -987,13 +987,6 @@ PYTHON_HEADERS= \ pyconfig.h \ $(PARSER_HEADERS) \ $(srcdir)/Include/Python-ast.h \ - $(srcdir)/Include/internal/_Python.h \ - $(srcdir)/Include/internal/_ceval.h \ - $(srcdir)/Include/internal/_gil.h \ - $(srcdir)/Include/internal/_mem.h \ - $(srcdir)/Include/internal/_pymalloc.h \ - $(srcdir)/Include/internal/_pystate.h \ - $(srcdir)/Include/internal/_warnings.h \ $(DTRACE_HEADERS) $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst deleted file mode 100644 index d8e9d5eeea1..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Consolidate CPython's global runtime state under a single struct. This -improves discoverability of the runtime state. diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 3f57041855d..189b1cd8442 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -279,7 +279,7 @@ _enter_buffered_busy(buffered *self) "reentrant call inside %R", self); return 0; } - relax_locking = _Py_IS_FINALIZING(); + relax_locking = (_Py_Finalizing != NULL); Py_BEGIN_ALLOW_THREADS if (!relax_locking) st = PyThread_acquire_lock(self->lock, 1); diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 89be96c313f..da750c01cd9 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -14,6 +14,7 @@ #include "pythread.h" static PyObject *ThreadError; +static long nb_threads = 0; static PyObject *str_dict; _Py_IDENTIFIER(stderr); @@ -992,7 +993,7 @@ t_bootstrap(void *boot_raw) tstate->thread_id = PyThread_get_thread_ident(); _PyThreadState_Init(tstate); PyEval_AcquireThread(tstate); - tstate->interp->num_threads++; + nb_threads++; res = PyObject_Call(boot->func, boot->args, boot->keyw); if (res == NULL) { if (PyErr_ExceptionMatches(PyExc_SystemExit)) @@ -1019,7 +1020,7 @@ t_bootstrap(void *boot_raw) Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - tstate->interp->num_threads--; + nb_threads--; PyThreadState_Clear(tstate); PyThreadState_DeleteCurrent(); PyThread_exit_thread(); @@ -1158,8 +1159,7 @@ A thread's identity may be reused for another thread after it exits."); static PyObject * thread__count(PyObject *self) { - PyThreadState *tstate = PyThreadState_Get(); - return PyLong_FromLong(tstate->interp->num_threads); + return PyLong_FromLong(nb_threads); } PyDoc_STRVAR(_count_doc, @@ -1352,7 +1352,6 @@ PyInit__thread(void) PyObject *m, *d, *v; double time_max; double timeout_max; - PyThreadState *tstate = PyThreadState_Get(); /* Initialize types: */ if (PyType_Ready(&localdummytype) < 0) @@ -1397,7 +1396,7 @@ PyInit__thread(void) if (PyModule_AddObject(m, "_local", (PyObject *)&localtype) < 0) return NULL; - tstate->interp->num_threads = 0; + nb_threads = 0; str_dict = PyUnicode_InternFromString("__dict__"); if (str_dict == NULL) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 6556d99ea8e..682d0a3cdd8 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -114,7 +114,7 @@ overlapped_dealloc(OverlappedObject *self) { /* The operation is no longer pending -- nothing to do. */ } - else if _Py_IS_FINALIZING() + else if (_Py_Finalizing == NULL) { /* The operation is still pending -- give a warning. This will probably only happen on Windows XP. */ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index fa67f7f5439..4e5acf305b9 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -39,9 +39,133 @@ module gc /* Get the object given the GC head */ #define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) +/*** Global GC state ***/ + +struct gc_generation { + PyGC_Head head; + int threshold; /* collection threshold */ + int count; /* count of allocations or collections of younger + generations */ +}; + +/* If we change this, we need to change the default value in the signature of + gc.collect. */ +#define NUM_GENERATIONS 3 +#define GEN_HEAD(n) (&generations[n].head) + +/* linked lists of container objects */ +static struct gc_generation generations[NUM_GENERATIONS] = { + /* PyGC_Head, threshold, count */ + {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, + {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, + {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, +}; + +PyGC_Head *_PyGC_generation0 = GEN_HEAD(0); + +static int enabled = 1; /* automatic collection enabled? */ + +/* true if we are currently running the collector */ +static int collecting = 0; + +/* list of uncollectable objects */ +static PyObject *garbage = NULL; + /* Python string to use if unhandled exception occurs */ static PyObject *gc_str = NULL; +/* a list of callbacks to be invoked when collection is performed */ +static PyObject *callbacks = NULL; + +/* This is the number of objects that survived the last full collection. It + approximates the number of long lived objects tracked by the GC. + + (by "full collection", we mean a collection of the oldest generation). +*/ +static Py_ssize_t long_lived_total = 0; + +/* This is the number of objects that survived all "non-full" collections, + and are awaiting to undergo a full collection for the first time. + +*/ +static Py_ssize_t long_lived_pending = 0; + +/* + NOTE: about the counting of long-lived objects. + + To limit the cost of garbage collection, there are two strategies; + - make each collection faster, e.g. by scanning fewer objects + - do less collections + This heuristic is about the latter strategy. + + In addition to the various configurable thresholds, we only trigger a + full collection if the ratio + long_lived_pending / long_lived_total + is above a given value (hardwired to 25%). + + The reason is that, while "non-full" collections (i.e., collections of + the young and middle generations) will always examine roughly the same + number of objects -- determined by the aforementioned thresholds --, + the cost of a full collection is proportional to the total number of + long-lived objects, which is virtually unbounded. + + Indeed, it has been remarked that doing a full collection every + of object creations entails a dramatic performance + degradation in workloads which consist in creating and storing lots of + long-lived objects (e.g. building a large list of GC-tracked objects would + show quadratic performance, instead of linear as expected: see issue #4074). + + Using the above ratio, instead, yields amortized linear performance in + the total number of objects (the effect of which can be summarized + thusly: "each full garbage collection is more and more costly as the + number of objects grows, but we do fewer and fewer of them"). + + This heuristic was suggested by Martin von L?wis on python-dev in + June 2008. His original analysis and proposal can be found at: + http://mail.python.org/pipermail/python-dev/2008-June/080579.html +*/ + +/* + NOTE: about untracking of mutable objects. + + Certain types of container cannot participate in a reference cycle, and + so do not need to be tracked by the garbage collector. Untracking these + objects reduces the cost of garbage collections. However, determining + which objects may be untracked is not free, and the costs must be + weighed against the benefits for garbage collection. + + There are two possible strategies for when to untrack a container: + + i) When the container is created. + ii) When the container is examined by the garbage collector. + + Tuples containing only immutable objects (integers, strings etc, and + recursively, tuples of immutable objects) do not need to be tracked. + The interpreter creates a large number of tuples, many of which will + not survive until garbage collection. It is therefore not worthwhile + to untrack eligible tuples at creation time. + + Instead, all tuples except the empty tuple are tracked when created. + During garbage collection it is determined whether any surviving tuples + can be untracked. A tuple can be untracked if all of its contents are + already not tracked. Tuples are examined for untracking in all garbage + collection cycles. It may take more than one cycle to untrack a tuple. + + Dictionaries containing only immutable objects also do not need to be + tracked. Dictionaries are untracked when created. If a tracked item is + inserted into a dictionary (either as a key or value), the dictionary + becomes tracked. During a full garbage collection (all generations), + the collector will untrack any dictionaries whose contents are not + tracked. + + The module provides the python function is_tracked(obj), which returns + the CURRENT tracking status of the object. Subsequent garbage + collections may change the tracking status of the object. + + Untracking of certain containers was introduced in issue #4688, and + the algorithm was refined in response to issue #14775. +*/ + /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ #define DEBUG_COLLECTABLE (1<<1) /* print collectable objects */ @@ -50,26 +174,19 @@ static PyObject *gc_str = NULL; #define DEBUG_LEAK DEBUG_COLLECTABLE | \ DEBUG_UNCOLLECTABLE | \ DEBUG_SAVEALL +static int debug; + +/* Running stats per generation */ +struct gc_generation_stats { + /* total number of collections */ + Py_ssize_t collections; + /* total number of collected objects */ + Py_ssize_t collected; + /* total number of uncollectable objects (put into gc.garbage) */ + Py_ssize_t uncollectable; +}; -#define GEN_HEAD(n) (&_PyRuntime.gc.generations[n].head) - -void -_PyGC_Initialize(struct _gc_runtime_state *state) -{ - state->enabled = 1; /* automatic collection enabled? */ - -#define _GEN_HEAD(n) (&state->generations[n].head) - struct gc_generation generations[NUM_GENERATIONS] = { - /* PyGC_Head, threshold, count */ - {{{_GEN_HEAD(0), _GEN_HEAD(0), 0}}, 700, 0}, - {{{_GEN_HEAD(1), _GEN_HEAD(1), 0}}, 10, 0}, - {{{_GEN_HEAD(2), _GEN_HEAD(2), 0}}, 10, 0}, - }; - for (int i = 0; i < NUM_GENERATIONS; i++) { - state->generations[i] = generations[i]; - }; - state->generation0 = GEN_HEAD(0); -} +static struct gc_generation_stats generation_stats[NUM_GENERATIONS]; /*-------------------------------------------------------------------------- gc_refs values. @@ -649,16 +766,16 @@ handle_legacy_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc = finalizers->gc.gc_next; - if (_PyRuntime.gc.garbage == NULL) { - _PyRuntime.gc.garbage = PyList_New(0); - if (_PyRuntime.gc.garbage == NULL) + if (garbage == NULL) { + garbage = PyList_New(0); + if (garbage == NULL) Py_FatalError("gc couldn't create gc.garbage list"); } for (; gc != finalizers; gc = gc->gc.gc_next) { PyObject *op = FROM_GC(gc); - if ((_PyRuntime.gc.debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { - if (PyList_Append(_PyRuntime.gc.garbage, op) < 0) + if ((debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { + if (PyList_Append(garbage, op) < 0) return -1; } } @@ -748,8 +865,8 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old) PyGC_Head *gc = collectable->gc.gc_next; PyObject *op = FROM_GC(gc); - if (_PyRuntime.gc.debug & DEBUG_SAVEALL) { - PyList_Append(_PyRuntime.gc.garbage, op); + if (debug & DEBUG_SAVEALL) { + PyList_Append(garbage, op); } else { if ((clear = Py_TYPE(op)->tp_clear) != NULL) { @@ -802,9 +919,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, PyGC_Head *gc; _PyTime_t t1 = 0; /* initialize to prevent a compiler warning */ - struct gc_generation_stats *stats = &_PyRuntime.gc.generation_stats[generation]; + struct gc_generation_stats *stats = &generation_stats[generation]; - if (_PyRuntime.gc.debug & DEBUG_STATS) { + if (debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", generation); PySys_WriteStderr("gc: objects in each generation:"); @@ -821,9 +938,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* update collection and allocation counters */ if (generation+1 < NUM_GENERATIONS) - _PyRuntime.gc.generations[generation+1].count += 1; + generations[generation+1].count += 1; for (i = 0; i <= generation; i++) - _PyRuntime.gc.generations[i].count = 0; + generations[i].count = 0; /* merge younger generations with one we are currently collecting */ for (i = 0; i < generation; i++) { @@ -857,7 +974,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* Move reachable objects to next generation. */ if (young != old) { if (generation == NUM_GENERATIONS - 2) { - _PyRuntime.gc.long_lived_pending += gc_list_size(young); + long_lived_pending += gc_list_size(young); } gc_list_merge(young, old); } @@ -865,8 +982,8 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* We only untrack dicts in full collections, to avoid quadratic dict build-up. See issue #14775. */ untrack_dicts(young); - _PyRuntime.gc.long_lived_pending = 0; - _PyRuntime.gc.long_lived_total = gc_list_size(young); + long_lived_pending = 0; + long_lived_total = gc_list_size(young); } /* All objects in unreachable are trash, but objects reachable from @@ -886,7 +1003,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; - if (_PyRuntime.gc.debug & DEBUG_COLLECTABLE) { + if (debug & DEBUG_COLLECTABLE) { debug_cycle("collectable", FROM_GC(gc)); } } @@ -915,10 +1032,10 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, gc != &finalizers; gc = gc->gc.gc_next) { n++; - if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) + if (debug & DEBUG_UNCOLLECTABLE) debug_cycle("uncollectable", FROM_GC(gc)); } - if (_PyRuntime.gc.debug & DEBUG_STATS) { + if (debug & DEBUG_STATS) { _PyTime_t t2 = _PyTime_GetMonotonicClock(); if (m == 0 && n == 0) @@ -981,11 +1098,11 @@ invoke_gc_callback(const char *phase, int generation, PyObject *info = NULL; /* we may get called very early */ - if (_PyRuntime.gc.callbacks == NULL) + if (callbacks == NULL) return; /* The local variable cannot be rebound, check it for sanity */ - assert(_PyRuntime.gc.callbacks != NULL && PyList_CheckExact(_PyRuntime.gc.callbacks)); - if (PyList_GET_SIZE(_PyRuntime.gc.callbacks) != 0) { + assert(callbacks != NULL && PyList_CheckExact(callbacks)); + if (PyList_GET_SIZE(callbacks) != 0) { info = Py_BuildValue("{sisnsn}", "generation", generation, "collected", collected, @@ -995,8 +1112,8 @@ invoke_gc_callback(const char *phase, int generation, return; } } - for (i=0; i= 0; i--) { - if (_PyRuntime.gc.generations[i].count > _PyRuntime.gc.generations[i].threshold) { + if (generations[i].count > generations[i].threshold) { /* Avoid quadratic performance degradation in number of tracked objects. See comments at the beginning of this file, and issue #4074. */ if (i == NUM_GENERATIONS - 1 - && _PyRuntime.gc.long_lived_pending < _PyRuntime.gc.long_lived_total / 4) + && long_lived_pending < long_lived_total / 4) continue; n = collect_with_callback(i); break; @@ -1057,7 +1174,7 @@ static PyObject * gc_enable_impl(PyObject *module) /*[clinic end generated code: output=45a427e9dce9155c input=81ac4940ca579707]*/ { - _PyRuntime.gc.enabled = 1; + enabled = 1; Py_RETURN_NONE; } @@ -1071,7 +1188,7 @@ static PyObject * gc_disable_impl(PyObject *module) /*[clinic end generated code: output=97d1030f7aa9d279 input=8c2e5a14e800d83b]*/ { - _PyRuntime.gc.enabled = 0; + enabled = 0; Py_RETURN_NONE; } @@ -1085,7 +1202,7 @@ static int gc_isenabled_impl(PyObject *module) /*[clinic end generated code: output=1874298331c49130 input=30005e0422373b31]*/ { - return _PyRuntime.gc.enabled; + return enabled; } /*[clinic input] @@ -1113,12 +1230,12 @@ gc_collect_impl(PyObject *module, int generation) return -1; } - if (_PyRuntime.gc.collecting) + if (collecting) n = 0; /* already collecting, don't do anything */ else { - _PyRuntime.gc.collecting = 1; + collecting = 1; n = collect_with_callback(generation); - _PyRuntime.gc.collecting = 0; + collecting = 0; } return n; @@ -1146,7 +1263,7 @@ static PyObject * gc_set_debug_impl(PyObject *module, int flags) /*[clinic end generated code: output=7c8366575486b228 input=5e5ce15e84fbed15]*/ { - _PyRuntime.gc.debug = flags; + debug = flags; Py_RETURN_NONE; } @@ -1161,7 +1278,7 @@ static int gc_get_debug_impl(PyObject *module) /*[clinic end generated code: output=91242f3506cd1e50 input=91a101e1c3b98366]*/ { - return _PyRuntime.gc.debug; + return debug; } PyDoc_STRVAR(gc_set_thresh__doc__, @@ -1175,13 +1292,13 @@ gc_set_thresh(PyObject *self, PyObject *args) { int i; if (!PyArg_ParseTuple(args, "i|ii:set_threshold", - &_PyRuntime.gc.generations[0].threshold, - &_PyRuntime.gc.generations[1].threshold, - &_PyRuntime.gc.generations[2].threshold)) + &generations[0].threshold, + &generations[1].threshold, + &generations[2].threshold)) return NULL; for (i = 2; i < NUM_GENERATIONS; i++) { /* generations higher than 2 get the same threshold */ - _PyRuntime.gc.generations[i].threshold = _PyRuntime.gc.generations[2].threshold; + generations[i].threshold = generations[2].threshold; } Py_RETURN_NONE; @@ -1198,9 +1315,9 @@ gc_get_threshold_impl(PyObject *module) /*[clinic end generated code: output=7902bc9f41ecbbd8 input=286d79918034d6e6]*/ { return Py_BuildValue("(iii)", - _PyRuntime.gc.generations[0].threshold, - _PyRuntime.gc.generations[1].threshold, - _PyRuntime.gc.generations[2].threshold); + generations[0].threshold, + generations[1].threshold, + generations[2].threshold); } /*[clinic input] @@ -1214,9 +1331,9 @@ gc_get_count_impl(PyObject *module) /*[clinic end generated code: output=354012e67b16398f input=a392794a08251751]*/ { return Py_BuildValue("(iii)", - _PyRuntime.gc.generations[0].count, - _PyRuntime.gc.generations[1].count, - _PyRuntime.gc.generations[2].count); + generations[0].count, + generations[1].count, + generations[2].count); } static int @@ -1347,7 +1464,7 @@ gc_get_stats_impl(PyObject *module) /* To get consistent values despite allocations while constructing the result list, we use a snapshot of the running stats. */ for (i = 0; i < NUM_GENERATIONS; i++) { - stats[i] = _PyRuntime.gc.generation_stats[i]; + stats[i] = generation_stats[i]; } result = PyList_New(0); @@ -1464,22 +1581,22 @@ PyInit_gc(void) if (m == NULL) return NULL; - if (_PyRuntime.gc.garbage == NULL) { - _PyRuntime.gc.garbage = PyList_New(0); - if (_PyRuntime.gc.garbage == NULL) + if (garbage == NULL) { + garbage = PyList_New(0); + if (garbage == NULL) return NULL; } - Py_INCREF(_PyRuntime.gc.garbage); - if (PyModule_AddObject(m, "garbage", _PyRuntime.gc.garbage) < 0) + Py_INCREF(garbage); + if (PyModule_AddObject(m, "garbage", garbage) < 0) return NULL; - if (_PyRuntime.gc.callbacks == NULL) { - _PyRuntime.gc.callbacks = PyList_New(0); - if (_PyRuntime.gc.callbacks == NULL) + if (callbacks == NULL) { + callbacks = PyList_New(0); + if (callbacks == NULL) return NULL; } - Py_INCREF(_PyRuntime.gc.callbacks); - if (PyModule_AddObject(m, "callbacks", _PyRuntime.gc.callbacks) < 0) + Py_INCREF(callbacks); + if (PyModule_AddObject(m, "callbacks", callbacks) < 0) return NULL; #define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return NULL @@ -1498,12 +1615,12 @@ PyGC_Collect(void) { Py_ssize_t n; - if (_PyRuntime.gc.collecting) + if (collecting) n = 0; /* already collecting, don't do anything */ else { - _PyRuntime.gc.collecting = 1; + collecting = 1; n = collect_with_callback(NUM_GENERATIONS - 1); - _PyRuntime.gc.collecting = 0; + collecting = 0; } return n; @@ -1512,7 +1629,7 @@ PyGC_Collect(void) Py_ssize_t _PyGC_CollectIfEnabled(void) { - if (!_PyRuntime.gc.enabled) + if (!enabled) return 0; return PyGC_Collect(); @@ -1529,12 +1646,12 @@ _PyGC_CollectNoFail(void) during interpreter shutdown (and then never finish it). See http://bugs.python.org/issue8713#msg195178 for an example. */ - if (_PyRuntime.gc.collecting) + if (collecting) n = 0; else { - _PyRuntime.gc.collecting = 1; + collecting = 1; n = collect(NUM_GENERATIONS - 1, NULL, NULL, 1); - _PyRuntime.gc.collecting = 0; + collecting = 0; } return n; } @@ -1542,10 +1659,10 @@ _PyGC_CollectNoFail(void) void _PyGC_DumpShutdownStats(void) { - if (!(_PyRuntime.gc.debug & DEBUG_SAVEALL) - && _PyRuntime.gc.garbage != NULL && PyList_GET_SIZE(_PyRuntime.gc.garbage) > 0) { + if (!(debug & DEBUG_SAVEALL) + && garbage != NULL && PyList_GET_SIZE(garbage) > 0) { char *message; - if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) + if (debug & DEBUG_UNCOLLECTABLE) message = "gc: %zd uncollectable objects at " \ "shutdown"; else @@ -1556,13 +1673,13 @@ _PyGC_DumpShutdownStats(void) already. */ if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0, "gc", NULL, message, - PyList_GET_SIZE(_PyRuntime.gc.garbage))) + PyList_GET_SIZE(garbage))) PyErr_WriteUnraisable(NULL); - if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) { + if (debug & DEBUG_UNCOLLECTABLE) { PyObject *repr = NULL, *bytes = NULL; - repr = PyObject_Repr(_PyRuntime.gc.garbage); + repr = PyObject_Repr(garbage); if (!repr || !(bytes = PyUnicode_EncodeFSDefault(repr))) - PyErr_WriteUnraisable(_PyRuntime.gc.garbage); + PyErr_WriteUnraisable(garbage); else { PySys_WriteStderr( " %s\n", @@ -1578,7 +1695,7 @@ _PyGC_DumpShutdownStats(void) void _PyGC_Fini(void) { - Py_CLEAR(_PyRuntime.gc.callbacks); + Py_CLEAR(callbacks); } /* for debugging */ @@ -1629,15 +1746,15 @@ _PyObject_GC_Alloc(int use_calloc, size_t basicsize) return PyErr_NoMemory(); g->gc.gc_refs = 0; _PyGCHead_SET_REFS(g, GC_UNTRACKED); - _PyRuntime.gc.generations[0].count++; /* number of allocated GC objects */ - if (_PyRuntime.gc.generations[0].count > _PyRuntime.gc.generations[0].threshold && - _PyRuntime.gc.enabled && - _PyRuntime.gc.generations[0].threshold && - !_PyRuntime.gc.collecting && + generations[0].count++; /* number of allocated GC objects */ + if (generations[0].count > generations[0].threshold && + enabled && + generations[0].threshold && + !collecting && !PyErr_Occurred()) { - _PyRuntime.gc.collecting = 1; + collecting = 1; collect_generations(); - _PyRuntime.gc.collecting = 0; + collecting = 0; } op = FROM_GC(g); return op; @@ -1702,8 +1819,8 @@ PyObject_GC_Del(void *op) PyGC_Head *g = AS_GC(op); if (IS_TRACKED(op)) gc_list_remove(g); - if (_PyRuntime.gc.generations[0].count > 0) { - _PyRuntime.gc.generations[0].count--; + if (generations[0].count > 0) { + generations[0].count--; } PyObject_FREE(g); } diff --git a/Modules/main.c b/Modules/main.c index 3e347dc8e24..08b22760de1 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -598,10 +598,16 @@ Py_Main(int argc, wchar_t **argv) } } + char *pymalloc = Py_GETENV("PYTHONMALLOC"); + if (_PyMem_SetupAllocators(pymalloc) < 0) { + fprintf(stderr, + "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", pymalloc); + exit(1); + } + /* Initialize the core language runtime */ Py_IgnoreEnvironmentFlag = core_config.ignore_environment; core_config._disable_importlib = 0; - core_config.allocator = Py_GETENV("PYTHONMALLOC"); _Py_InitializeCore(&core_config); /* Reprocess the command line with the language runtime available */ diff --git a/Objects/object.c b/Objects/object.c index 68a90c23107..2ba6e572ea6 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2028,6 +2028,14 @@ Py_ReprLeave(PyObject *obj) /* Trashcan support. */ +/* Current call-stack depth of tp_dealloc calls. */ +int _PyTrash_delete_nesting = 0; + +/* List of objects that still need to be cleaned up, singly linked via their + * gc headers' gc_prev pointers. + */ +PyObject *_PyTrash_delete_later = NULL; + /* Add op to the _PyTrash_delete_later list. Called when the current * call-stack depth gets large. op must be a currently untracked gc'ed * object, with refcount 0. Py_DECREF must already have been called on it. @@ -2038,8 +2046,8 @@ _PyTrash_deposit_object(PyObject *op) assert(PyObject_IS_GC(op)); assert(_PyGC_REFS(op) == _PyGC_REFS_UNTRACKED); assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyRuntime.gc.trash_delete_later; - _PyRuntime.gc.trash_delete_later = op; + _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; + _PyTrash_delete_later = op; } /* The equivalent API, using per-thread state recursion info */ @@ -2060,11 +2068,11 @@ _PyTrash_thread_deposit_object(PyObject *op) void _PyTrash_destroy_chain(void) { - while (_PyRuntime.gc.trash_delete_later) { - PyObject *op = _PyRuntime.gc.trash_delete_later; + while (_PyTrash_delete_later) { + PyObject *op = _PyTrash_delete_later; destructor dealloc = Py_TYPE(op)->tp_dealloc; - _PyRuntime.gc.trash_delete_later = + _PyTrash_delete_later = (PyObject*) _Py_AS_GC(op)->gc.gc_prev; /* Call the deallocator directly. This used to try to @@ -2074,9 +2082,9 @@ _PyTrash_destroy_chain(void) * up distorting allocation statistics. */ assert(op->ob_refcnt == 0); - ++_PyRuntime.gc.trash_delete_nesting; + ++_PyTrash_delete_nesting; (*dealloc)(op); - --_PyRuntime.gc.trash_delete_nesting; + --_PyTrash_delete_nesting; } } diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 3698cfc260e..32e7ecbe1e0 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -178,9 +178,7 @@ static struct { #define PYDBG_FUNCS \ _PyMem_DebugMalloc, _PyMem_DebugCalloc, _PyMem_DebugRealloc, _PyMem_DebugFree - -#define _PyMem_Raw _PyRuntime.mem.allocators.raw -static const PyMemAllocatorEx _pymem_raw = { +static PyMemAllocatorEx _PyMem_Raw = { #ifdef Py_DEBUG &_PyMem_Debug.raw, PYRAWDBG_FUNCS #else @@ -188,8 +186,7 @@ static const PyMemAllocatorEx _pymem_raw = { #endif }; -#define _PyMem _PyRuntime.mem.allocators.mem -static const PyMemAllocatorEx _pymem = { +static PyMemAllocatorEx _PyMem = { #ifdef Py_DEBUG &_PyMem_Debug.mem, PYDBG_FUNCS #else @@ -197,8 +194,7 @@ static const PyMemAllocatorEx _pymem = { #endif }; -#define _PyObject _PyRuntime.mem.allocators.obj -static const PyMemAllocatorEx _pyobject = { +static PyMemAllocatorEx _PyObject = { #ifdef Py_DEBUG &_PyMem_Debug.obj, PYDBG_FUNCS #else @@ -271,7 +267,7 @@ _PyMem_SetupAllocators(const char *opt) #undef PYRAWDBG_FUNCS #undef PYDBG_FUNCS -static const PyObjectArenaAllocator _PyObject_Arena = {NULL, +static PyObjectArenaAllocator _PyObject_Arena = {NULL, #ifdef MS_WINDOWS _PyObject_ArenaVirtualAlloc, _PyObject_ArenaVirtualFree #elif defined(ARENAS_USE_MMAP) @@ -281,34 +277,6 @@ static const PyObjectArenaAllocator _PyObject_Arena = {NULL, #endif }; -void -_PyObject_Initialize(struct _pyobj_runtime_state *state) -{ - state->allocator_arenas = _PyObject_Arena; -} - -void -_PyMem_Initialize(struct _pymem_runtime_state *state) -{ - state->allocators.raw = _pymem_raw; - state->allocators.mem = _pymem; - state->allocators.obj = _pyobject; - -#ifdef WITH_PYMALLOC - for (int i = 0; i < 8; i++) { - if (NB_SMALL_SIZE_CLASSES <= i * 8) - break; - for (int j = 0; j < 8; j++) { - int x = i * 8 + j; - poolp *addr = &(state->usedpools[2*(x)]); - poolp val = (poolp)((uint8_t *)addr - 2*sizeof(pyblock *)); - state->usedpools[x * 2] = val; - state->usedpools[x * 2 + 1] = val; - }; - }; -#endif /* WITH_PYMALLOC */ -} - #ifdef WITH_PYMALLOC static int _PyMem_DebugEnabled(void) @@ -395,13 +363,13 @@ PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator) void PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator) { - *allocator = _PyRuntime.obj.allocator_arenas; + *allocator = _PyObject_Arena; } void PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator) { - _PyRuntime.obj.allocator_arenas = *allocator; + _PyObject_Arena = *allocator; } void * @@ -436,8 +404,7 @@ PyMem_RawRealloc(void *ptr, size_t new_size) return _PyMem_Raw.realloc(_PyMem_Raw.ctx, ptr, new_size); } -void -PyMem_RawFree(void *ptr) +void PyMem_RawFree(void *ptr) { _PyMem_Raw.free(_PyMem_Raw.ctx, ptr); } @@ -554,10 +521,497 @@ PyObject_Free(void *ptr) static int running_on_valgrind = -1; #endif +/* An object allocator for Python. + + Here is an introduction to the layers of the Python memory architecture, + showing where the object allocator is actually used (layer +2), It is + called for every object allocation and deallocation (PyObject_New/Del), + unless the object-specific allocators implement a proprietary allocation + scheme (ex.: ints use a simple free list). This is also the place where + the cyclic garbage collector operates selectively on container objects. + + + Object-specific allocators + _____ ______ ______ ________ + [ int ] [ dict ] [ list ] ... [ string ] Python core | ++3 | <----- Object-specific memory -----> | <-- Non-object memory --> | + _______________________________ | | + [ Python's object allocator ] | | ++2 | ####### Object memory ####### | <------ Internal buffers ------> | + ______________________________________________________________ | + [ Python's raw memory allocator (PyMem_ API) ] | ++1 | <----- Python memory (under PyMem manager's control) ------> | | + __________________________________________________________________ + [ Underlying general-purpose allocator (ex: C library malloc) ] + 0 | <------ Virtual memory allocated for the python process -------> | + + ========================================================================= + _______________________________________________________________________ + [ OS-specific Virtual Memory Manager (VMM) ] +-1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | + __________________________________ __________________________________ + [ ] [ ] +-2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | + +*/ +/*==========================================================================*/ + +/* A fast, special-purpose memory allocator for small blocks, to be used + on top of a general-purpose malloc -- heavily based on previous art. */ + +/* Vladimir Marangozov -- August 2000 */ + +/* + * "Memory management is where the rubber meets the road -- if we do the wrong + * thing at any level, the results will not be good. And if we don't make the + * levels work well together, we are in serious trouble." (1) + * + * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, + * "Dynamic Storage Allocation: A Survey and Critical Review", + * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. + */ + +/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ + +/*==========================================================================*/ + +/* + * Allocation strategy abstract: + * + * For small requests, the allocator sub-allocates blocks of memory. + * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the + * system's allocator. + * + * Small requests are grouped in size classes spaced 8 bytes apart, due + * to the required valid alignment of the returned address. Requests of + * a particular size are serviced from memory pools of 4K (one VMM page). + * Pools are fragmented on demand and contain free lists of blocks of one + * particular size class. In other words, there is a fixed-size allocator + * for each size class. Free pools are shared by the different allocators + * thus minimizing the space reserved for a particular size class. + * + * This allocation strategy is a variant of what is known as "simple + * segregated storage based on array of free lists". The main drawback of + * simple segregated storage is that we might end up with lot of reserved + * memory for the different free lists, which degenerate in time. To avoid + * this, we partition each free list in pools and we share dynamically the + * reserved space between all free lists. This technique is quite efficient + * for memory intensive programs which allocate mainly small-sized blocks. + * + * For small requests we have the following table: + * + * Request in bytes Size of allocated block Size class idx + * ---------------------------------------------------------------- + * 1-8 8 0 + * 9-16 16 1 + * 17-24 24 2 + * 25-32 32 3 + * 33-40 40 4 + * 41-48 48 5 + * 49-56 56 6 + * 57-64 64 7 + * 65-72 72 8 + * ... ... ... + * 497-504 504 62 + * 505-512 512 63 + * + * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying + * allocator. + */ + +/*==========================================================================*/ + +/* + * -- Main tunable settings section -- + */ + +/* + * Alignment of addresses returned to the user. 8-bytes alignment works + * on most current architectures (with 32-bit or 64-bit address busses). + * The alignment value is also used for grouping small requests in size + * classes spaced ALIGNMENT bytes apart. + * + * You shouldn't change this unless you know what you are doing. + */ +#define ALIGNMENT 8 /* must be 2^N */ +#define ALIGNMENT_SHIFT 3 + +/* Return the number of bytes in size class I, as a uint. */ +#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) + +/* + * Max size threshold below which malloc requests are considered to be + * small enough in order to use preallocated memory pools. You can tune + * this value according to your application behaviour and memory needs. + * + * Note: a size threshold of 512 guarantees that newly created dictionaries + * will be allocated from preallocated memory pools on 64-bit. + * + * The following invariants must hold: + * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 + * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT + * + * Although not required, for better performance and space efficiency, + * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. + */ +#define SMALL_REQUEST_THRESHOLD 512 +#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) + +/* + * The system's VMM page size can be obtained on most unices with a + * getpagesize() call or deduced from various header files. To make + * things simpler, we assume that it is 4K, which is OK for most systems. + * It is probably better if this is the native page size, but it doesn't + * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page + * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation + * violation fault. 4K is apparently OK for all the platforms that python + * currently targets. + */ +#define SYSTEM_PAGE_SIZE (4 * 1024) +#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) + +/* + * Maximum amount of memory managed by the allocator for small requests. + */ +#ifdef WITH_MEMORY_LIMITS +#ifndef SMALL_MEMORY_LIMIT +#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ +#endif +#endif + +/* + * The allocator sub-allocates blocks of memory (called arenas) aligned + * on a page boundary. This is a reserved virtual address space for the + * current process (obtained through a malloc()/mmap() call). In no way this + * means that the memory arenas will be used entirely. A malloc() is + * usually an address range reservation for bytes, unless all pages within + * this space are referenced subsequently. So malloc'ing big blocks and not + * using them does not mean "wasting memory". It's an addressable range + * wastage... + * + * Arenas are allocated with mmap() on systems supporting anonymous memory + * mappings to reduce heap fragmentation. + */ +#define ARENA_SIZE (256 << 10) /* 256KB */ + +#ifdef WITH_MEMORY_LIMITS +#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) +#endif + +/* + * Size of the pools used for small blocks. Should be a power of 2, + * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. + */ +#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ +#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK + +/* + * -- End of tunable settings section -- + */ + +/*==========================================================================*/ + +/* + * Locking + * + * To reduce lock contention, it would probably be better to refine the + * crude function locking with per size class locking. I'm not positive + * however, whether it's worth switching to such locking policy because + * of the performance penalty it might introduce. + * + * The following macros describe the simplest (should also be the fastest) + * lock object on a particular platform and the init/fini/lock/unlock + * operations on it. The locks defined here are not expected to be recursive + * because it is assumed that they will always be called in the order: + * INIT, [LOCK, UNLOCK]*, FINI. + */ + +/* + * Python's threads are serialized, so object malloc locking is disabled. + */ +#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ +#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ +#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ +#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ +#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ + +/* When you say memory, my mind reasons in terms of (pointers to) blocks */ +typedef uint8_t block; + +/* Pool for small blocks. */ +struct pool_header { + union { block *_padding; + uint count; } ref; /* number of allocated blocks */ + block *freeblock; /* pool's free list head */ + struct pool_header *nextpool; /* next pool of this size class */ + struct pool_header *prevpool; /* previous pool "" */ + uint arenaindex; /* index into arenas of base adr */ + uint szidx; /* block size class index */ + uint nextoffset; /* bytes to virgin block */ + uint maxnextoffset; /* largest valid nextoffset */ +}; + +typedef struct pool_header *poolp; + +/* Record keeping for arenas. */ +struct arena_object { + /* The address of the arena, as returned by malloc. Note that 0 + * will never be returned by a successful malloc, and is used + * here to mark an arena_object that doesn't correspond to an + * allocated arena. + */ + uintptr_t address; + + /* Pool-aligned pointer to the next pool to be carved off. */ + block* pool_address; + + /* The number of available pools in the arena: free pools + never- + * allocated pools. + */ + uint nfreepools; + + /* The total number of pools in the arena, whether or not available. */ + uint ntotalpools; + + /* Singly-linked list of available pools. */ + struct pool_header* freepools; + + /* Whenever this arena_object is not associated with an allocated + * arena, the nextarena member is used to link all unassociated + * arena_objects in the singly-linked `unused_arena_objects` list. + * The prevarena member is unused in this case. + * + * When this arena_object is associated with an allocated arena + * with at least one available pool, both members are used in the + * doubly-linked `usable_arenas` list, which is maintained in + * increasing order of `nfreepools` values. + * + * Else this arena_object is associated with an allocated arena + * all of whose pools are in use. `nextarena` and `prevarena` + * are both meaningless in this case. + */ + struct arena_object* nextarena; + struct arena_object* prevarena; +}; + +#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) + +#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ + +/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ +#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) + +/* Return total number of blocks in pool of size index I, as a uint. */ +#define NUMBLOCKS(I) ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) + +/*==========================================================================*/ + +/* + * This malloc lock + */ +SIMPLELOCK_DECL(_malloc_lock) +#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) +#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) +#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) +#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) + +/* + * Pool table -- headed, circular, doubly-linked lists of partially used pools. + +This is involved. For an index i, usedpools[i+i] is the header for a list of +all partially used pools holding small blocks with "size class idx" i. So +usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size +16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to +the start of a singly-linked list of free blocks within the pool. When a +block is freed, it's inserted at the front of its pool's freeblock list. Note +that the available blocks in a pool are *not* linked all together when a pool +is initialized. Instead only "the first two" (lowest addresses) blocks are +set up, returning the first such block, and setting pool->freeblock to a +one-block list holding the second such block. This is consistent with that +pymalloc strives at all levels (arena, pool, and block) never to touch a piece +of memory until it's actually needed. + +So long as a pool is in the used state, we're certain there *is* a block +available for allocating, and pool->freeblock is not NULL. If pool->freeblock +points to the end of the free list before we've carved the entire pool into +blocks, that means we simply haven't yet gotten to one of the higher-address +blocks. The offset from the pool_header to the start of "the next" virgin +block is stored in the pool_header nextoffset member, and the largest value +of nextoffset that makes sense is stored in the maxnextoffset member when a +pool is initialized. All the blocks in a pool have been passed out at least +once when and only when nextoffset > maxnextoffset. + + +Major obscurity: While the usedpools vector is declared to have poolp +entries, it doesn't really. It really contains two pointers per (conceptual) +poolp entry, the nextpool and prevpool members of a pool_header. The +excruciating initialization code below fools C so that + + usedpool[i+i] + +"acts like" a genuine poolp, but only so long as you only reference its +nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is +compensating for that a pool_header's nextpool and prevpool members +immediately follow a pool_header's first two members: + + union { block *_padding; + uint count; } ref; + block *freeblock; + +each of which consume sizeof(block *) bytes. So what usedpools[i+i] really +contains is a fudged-up pointer p such that *if* C believes it's a poolp +pointer, then p->nextpool and p->prevpool are both p (meaning that the headed +circular list is empty). + +It's unclear why the usedpools setup is so convoluted. It could be to +minimize the amount of cache required to hold this heavily-referenced table +(which only *needs* the two interpool pointer members of a pool_header). OTOH, +referencing code has to remember to "double the index" and doing so isn't +free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying +on that C doesn't insert any padding anywhere in a pool_header at or before +the prevpool member. +**************************************************************************** */ + +#define PTA(x) ((poolp )((uint8_t *)&(usedpools[2*(x)]) - 2*sizeof(block *))) +#define PT(x) PTA(x), PTA(x) + +static poolp usedpools[2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8] = { + PT(0), PT(1), PT(2), PT(3), PT(4), PT(5), PT(6), PT(7) +#if NB_SMALL_SIZE_CLASSES > 8 + , PT(8), PT(9), PT(10), PT(11), PT(12), PT(13), PT(14), PT(15) +#if NB_SMALL_SIZE_CLASSES > 16 + , PT(16), PT(17), PT(18), PT(19), PT(20), PT(21), PT(22), PT(23) +#if NB_SMALL_SIZE_CLASSES > 24 + , PT(24), PT(25), PT(26), PT(27), PT(28), PT(29), PT(30), PT(31) +#if NB_SMALL_SIZE_CLASSES > 32 + , PT(32), PT(33), PT(34), PT(35), PT(36), PT(37), PT(38), PT(39) +#if NB_SMALL_SIZE_CLASSES > 40 + , PT(40), PT(41), PT(42), PT(43), PT(44), PT(45), PT(46), PT(47) +#if NB_SMALL_SIZE_CLASSES > 48 + , PT(48), PT(49), PT(50), PT(51), PT(52), PT(53), PT(54), PT(55) +#if NB_SMALL_SIZE_CLASSES > 56 + , PT(56), PT(57), PT(58), PT(59), PT(60), PT(61), PT(62), PT(63) +#if NB_SMALL_SIZE_CLASSES > 64 +#error "NB_SMALL_SIZE_CLASSES should be less than 64" +#endif /* NB_SMALL_SIZE_CLASSES > 64 */ +#endif /* NB_SMALL_SIZE_CLASSES > 56 */ +#endif /* NB_SMALL_SIZE_CLASSES > 48 */ +#endif /* NB_SMALL_SIZE_CLASSES > 40 */ +#endif /* NB_SMALL_SIZE_CLASSES > 32 */ +#endif /* NB_SMALL_SIZE_CLASSES > 24 */ +#endif /* NB_SMALL_SIZE_CLASSES > 16 */ +#endif /* NB_SMALL_SIZE_CLASSES > 8 */ +}; + +/*========================================================================== +Arena management. + +`arenas` is a vector of arena_objects. It contains maxarenas entries, some of +which may not be currently used (== they're arena_objects that aren't +currently associated with an allocated arena). Note that arenas proper are +separately malloc'ed. + +Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, +we do try to free() arenas, and use some mild heuristic strategies to increase +the likelihood that arenas eventually can be freed. + +unused_arena_objects + + This is a singly-linked list of the arena_objects that are currently not + being used (no arena is associated with them). Objects are taken off the + head of the list in new_arena(), and are pushed on the head of the list in + PyObject_Free() when the arena is empty. Key invariant: an arena_object + is on this list if and only if its .address member is 0. + +usable_arenas + + This is a doubly-linked list of the arena_objects associated with arenas + that have pools available. These pools are either waiting to be reused, + or have not been used before. The list is sorted to have the most- + allocated arenas first (ascending order based on the nfreepools member). + This means that the next allocation will come from a heavily used arena, + which gives the nearly empty arenas a chance to be returned to the system. + In my unscientific tests this dramatically improved the number of arenas + that could be freed. + +Note that an arena_object associated with an arena all of whose pools are +currently in use isn't on either list. +*/ + +/* Array of objects used to track chunks of memory (arenas). */ +static struct arena_object* arenas = NULL; +/* Number of slots currently allocated in the `arenas` vector. */ +static uint maxarenas = 0; + +/* The head of the singly-linked, NULL-terminated list of available + * arena_objects. + */ +static struct arena_object* unused_arena_objects = NULL; + +/* The head of the doubly-linked, NULL-terminated at each end, list of + * arena_objects associated with arenas that have pools available. + */ +static struct arena_object* usable_arenas = NULL; + +/* How many arena_objects do we initially allocate? + * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the + * `arenas` vector. + */ +#define INITIAL_ARENA_OBJECTS 16 + +/* Number of arenas allocated that haven't been free()'d. */ +static size_t narenas_currently_allocated = 0; + +/* Total number of times malloc() called to allocate an arena. */ +static size_t ntimes_arena_allocated = 0; +/* High water mark (max value ever seen) for narenas_currently_allocated. */ +static size_t narenas_highwater = 0; + +static Py_ssize_t _Py_AllocatedBlocks = 0; + Py_ssize_t _Py_GetAllocatedBlocks(void) { - return _PyRuntime.mem.num_allocated_blocks; + return _Py_AllocatedBlocks; } @@ -581,7 +1035,7 @@ new_arena(void) if (debug_stats) _PyObject_DebugMallocStats(stderr); - if (_PyRuntime.mem.unused_arena_objects == NULL) { + if (unused_arena_objects == NULL) { uint i; uint numarenas; size_t nbytes; @@ -589,18 +1043,18 @@ new_arena(void) /* Double the number of arena objects on each allocation. * Note that it's possible for `numarenas` to overflow. */ - numarenas = _PyRuntime.mem.maxarenas ? _PyRuntime.mem.maxarenas << 1 : INITIAL_ARENA_OBJECTS; - if (numarenas <= _PyRuntime.mem.maxarenas) + numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; + if (numarenas <= maxarenas) return NULL; /* overflow */ #if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > SIZE_MAX / sizeof(*_PyRuntime.mem.arenas)) + if (numarenas > SIZE_MAX / sizeof(*arenas)) return NULL; /* overflow */ #endif - nbytes = numarenas * sizeof(*_PyRuntime.mem.arenas); - arenaobj = (struct arena_object *)PyMem_RawRealloc(_PyRuntime.mem.arenas, nbytes); + nbytes = numarenas * sizeof(*arenas); + arenaobj = (struct arena_object *)PyMem_RawRealloc(arenas, nbytes); if (arenaobj == NULL) return NULL; - _PyRuntime.mem.arenas = arenaobj; + arenas = arenaobj; /* We might need to fix pointers that were copied. However, * new_arena only gets called when all the pages in the @@ -608,45 +1062,45 @@ new_arena(void) * into the old array. Thus, we don't have to worry about * invalid pointers. Just to be sure, some asserts: */ - assert(_PyRuntime.mem.usable_arenas == NULL); - assert(_PyRuntime.mem.unused_arena_objects == NULL); + assert(usable_arenas == NULL); + assert(unused_arena_objects == NULL); /* Put the new arenas on the unused_arena_objects list. */ - for (i = _PyRuntime.mem.maxarenas; i < numarenas; ++i) { - _PyRuntime.mem.arenas[i].address = 0; /* mark as unassociated */ - _PyRuntime.mem.arenas[i].nextarena = i < numarenas - 1 ? - &_PyRuntime.mem.arenas[i+1] : NULL; + for (i = maxarenas; i < numarenas; ++i) { + arenas[i].address = 0; /* mark as unassociated */ + arenas[i].nextarena = i < numarenas - 1 ? + &arenas[i+1] : NULL; } /* Update globals. */ - _PyRuntime.mem.unused_arena_objects = &_PyRuntime.mem.arenas[_PyRuntime.mem.maxarenas]; - _PyRuntime.mem.maxarenas = numarenas; + unused_arena_objects = &arenas[maxarenas]; + maxarenas = numarenas; } /* Take the next available arena object off the head of the list. */ - assert(_PyRuntime.mem.unused_arena_objects != NULL); - arenaobj = _PyRuntime.mem.unused_arena_objects; - _PyRuntime.mem.unused_arena_objects = arenaobj->nextarena; + assert(unused_arena_objects != NULL); + arenaobj = unused_arena_objects; + unused_arena_objects = arenaobj->nextarena; assert(arenaobj->address == 0); - address = _PyRuntime.obj.allocator_arenas.alloc(_PyRuntime.obj.allocator_arenas.ctx, ARENA_SIZE); + address = _PyObject_Arena.alloc(_PyObject_Arena.ctx, ARENA_SIZE); if (address == NULL) { /* The allocation failed: return NULL after putting the * arenaobj back. */ - arenaobj->nextarena = _PyRuntime.mem.unused_arena_objects; - _PyRuntime.mem.unused_arena_objects = arenaobj; + arenaobj->nextarena = unused_arena_objects; + unused_arena_objects = arenaobj; return NULL; } arenaobj->address = (uintptr_t)address; - ++_PyRuntime.mem.narenas_currently_allocated; - ++_PyRuntime.mem.ntimes_arena_allocated; - if (_PyRuntime.mem.narenas_currently_allocated > _PyRuntime.mem.narenas_highwater) - _PyRuntime.mem.narenas_highwater = _PyRuntime.mem.narenas_currently_allocated; + ++narenas_currently_allocated; + ++ntimes_arena_allocated; + if (narenas_currently_allocated > narenas_highwater) + narenas_highwater = narenas_currently_allocated; arenaobj->freepools = NULL; /* pool_address <- first pool-aligned address in the arena nfreepools <- number of whole pools that fit after alignment */ - arenaobj->pool_address = (pyblock*)arenaobj->address; + arenaobj->pool_address = (block*)arenaobj->address; arenaobj->nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * arenaobj->nfreepools == ARENA_SIZE); excess = (uint)(arenaobj->address & POOL_SIZE_MASK); @@ -743,9 +1197,9 @@ address_in_range(void *p, poolp pool) // the GIL. The following dance forces the compiler to read pool->arenaindex // only once. uint arenaindex = *((volatile uint *)&pool->arenaindex); - return arenaindex < _PyRuntime.mem.maxarenas && - (uintptr_t)p - _PyRuntime.mem.arenas[arenaindex].address < ARENA_SIZE && - _PyRuntime.mem.arenas[arenaindex].address != 0; + return arenaindex < maxarenas && + (uintptr_t)p - arenas[arenaindex].address < ARENA_SIZE && + arenas[arenaindex].address != 0; } /*==========================================================================*/ @@ -766,12 +1220,12 @@ static void * _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) { size_t nbytes; - pyblock *bp; + block *bp; poolp pool; poolp next; uint size; - _PyRuntime.mem.num_allocated_blocks++; + _Py_AllocatedBlocks++; assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize); nbytes = nelem * elsize; @@ -792,7 +1246,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * Most frequent paths first */ size = (uint)(nbytes - 1) >> ALIGNMENT_SHIFT; - pool = _PyRuntime.mem.usedpools[size + size]; + pool = usedpools[size + size]; if (pool != pool->nextpool) { /* * There is a used pool for this size class. @@ -801,7 +1255,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) ++pool->ref.count; bp = pool->freeblock; assert(bp != NULL); - if ((pool->freeblock = *(pyblock **)bp) != NULL) { + if ((pool->freeblock = *(block **)bp) != NULL) { UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -812,10 +1266,10 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ if (pool->nextoffset <= pool->maxnextoffset) { /* There is room for another block. */ - pool->freeblock = (pyblock*)pool + + pool->freeblock = (block*)pool + pool->nextoffset; pool->nextoffset += INDEX2SIZE(size); - *(pyblock **)(pool->freeblock) = NULL; + *(block **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -835,29 +1289,29 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) /* There isn't a pool of the right size class immediately * available: use a free pool. */ - if (_PyRuntime.mem.usable_arenas == NULL) { + if (usable_arenas == NULL) { /* No arena has a free pool: allocate a new arena. */ #ifdef WITH_MEMORY_LIMITS - if (_PyRuntime.mem.narenas_currently_allocated >= MAX_ARENAS) { + if (narenas_currently_allocated >= MAX_ARENAS) { UNLOCK(); goto redirect; } #endif - _PyRuntime.mem.usable_arenas = new_arena(); - if (_PyRuntime.mem.usable_arenas == NULL) { + usable_arenas = new_arena(); + if (usable_arenas == NULL) { UNLOCK(); goto redirect; } - _PyRuntime.mem.usable_arenas->nextarena = - _PyRuntime.mem.usable_arenas->prevarena = NULL; + usable_arenas->nextarena = + usable_arenas->prevarena = NULL; } - assert(_PyRuntime.mem.usable_arenas->address != 0); + assert(usable_arenas->address != 0); /* Try to get a cached free pool. */ - pool = _PyRuntime.mem.usable_arenas->freepools; + pool = usable_arenas->freepools; if (pool != NULL) { /* Unlink from cached pools. */ - _PyRuntime.mem.usable_arenas->freepools = pool->nextpool; + usable_arenas->freepools = pool->nextpool; /* This arena already had the smallest nfreepools * value, so decreasing nfreepools doesn't change @@ -866,18 +1320,18 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * become wholly allocated, we need to remove its * arena_object from usable_arenas. */ - --_PyRuntime.mem.usable_arenas->nfreepools; - if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { + --usable_arenas->nfreepools; + if (usable_arenas->nfreepools == 0) { /* Wholly allocated: remove. */ - assert(_PyRuntime.mem.usable_arenas->freepools == NULL); - assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || - _PyRuntime.mem.usable_arenas->nextarena->prevarena == - _PyRuntime.mem.usable_arenas); - - _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; - if (_PyRuntime.mem.usable_arenas != NULL) { - _PyRuntime.mem.usable_arenas->prevarena = NULL; - assert(_PyRuntime.mem.usable_arenas->address != 0); + assert(usable_arenas->freepools == NULL); + assert(usable_arenas->nextarena == NULL || + usable_arenas->nextarena->prevarena == + usable_arenas); + + usable_arenas = usable_arenas->nextarena; + if (usable_arenas != NULL) { + usable_arenas->prevarena = NULL; + assert(usable_arenas->address != 0); } } else { @@ -886,14 +1340,14 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * off all the arena's pools for the first * time. */ - assert(_PyRuntime.mem.usable_arenas->freepools != NULL || - _PyRuntime.mem.usable_arenas->pool_address <= - (pyblock*)_PyRuntime.mem.usable_arenas->address + + assert(usable_arenas->freepools != NULL || + usable_arenas->pool_address <= + (block*)usable_arenas->address + ARENA_SIZE - POOL_SIZE); } init_pool: /* Frontlink to used pools. */ - next = _PyRuntime.mem.usedpools[size + size]; /* == prev */ + next = usedpools[size + size]; /* == prev */ pool->nextpool = next; pool->prevpool = next; next->nextpool = pool; @@ -906,7 +1360,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ bp = pool->freeblock; assert(bp != NULL); - pool->freeblock = *(pyblock **)bp; + pool->freeblock = *(block **)bp; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -919,11 +1373,11 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ pool->szidx = size; size = INDEX2SIZE(size); - bp = (pyblock *)pool + POOL_OVERHEAD; + bp = (block *)pool + POOL_OVERHEAD; pool->nextoffset = POOL_OVERHEAD + (size << 1); pool->maxnextoffset = POOL_SIZE - size; pool->freeblock = bp + size; - *(pyblock **)(pool->freeblock) = NULL; + *(block **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -931,26 +1385,26 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) } /* Carve off a new pool. */ - assert(_PyRuntime.mem.usable_arenas->nfreepools > 0); - assert(_PyRuntime.mem.usable_arenas->freepools == NULL); - pool = (poolp)_PyRuntime.mem.usable_arenas->pool_address; - assert((pyblock*)pool <= (pyblock*)_PyRuntime.mem.usable_arenas->address + - ARENA_SIZE - POOL_SIZE); - pool->arenaindex = (uint)(_PyRuntime.mem.usable_arenas - _PyRuntime.mem.arenas); - assert(&_PyRuntime.mem.arenas[pool->arenaindex] == _PyRuntime.mem.usable_arenas); + assert(usable_arenas->nfreepools > 0); + assert(usable_arenas->freepools == NULL); + pool = (poolp)usable_arenas->pool_address; + assert((block*)pool <= (block*)usable_arenas->address + + ARENA_SIZE - POOL_SIZE); + pool->arenaindex = (uint)(usable_arenas - arenas); + assert(&arenas[pool->arenaindex] == usable_arenas); pool->szidx = DUMMY_SIZE_IDX; - _PyRuntime.mem.usable_arenas->pool_address += POOL_SIZE; - --_PyRuntime.mem.usable_arenas->nfreepools; + usable_arenas->pool_address += POOL_SIZE; + --usable_arenas->nfreepools; - if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { - assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || - _PyRuntime.mem.usable_arenas->nextarena->prevarena == - _PyRuntime.mem.usable_arenas); + if (usable_arenas->nfreepools == 0) { + assert(usable_arenas->nextarena == NULL || + usable_arenas->nextarena->prevarena == + usable_arenas); /* Unlink the arena: it is completely allocated. */ - _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; - if (_PyRuntime.mem.usable_arenas != NULL) { - _PyRuntime.mem.usable_arenas->prevarena = NULL; - assert(_PyRuntime.mem.usable_arenas->address != 0); + usable_arenas = usable_arenas->nextarena; + if (usable_arenas != NULL) { + usable_arenas->prevarena = NULL; + assert(usable_arenas->address != 0); } } @@ -972,7 +1426,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) else result = PyMem_RawMalloc(nbytes); if (!result) - _PyRuntime.mem.num_allocated_blocks--; + _Py_AllocatedBlocks--; return result; } } @@ -995,14 +1449,14 @@ static void _PyObject_Free(void *ctx, void *p) { poolp pool; - pyblock *lastfree; + block *lastfree; poolp next, prev; uint size; if (p == NULL) /* free(NULL) has no effect */ return; - _PyRuntime.mem.num_allocated_blocks--; + _Py_AllocatedBlocks--; #ifdef WITH_VALGRIND if (UNLIKELY(running_on_valgrind > 0)) @@ -1020,8 +1474,8 @@ _PyObject_Free(void *ctx, void *p) * list in any case). */ assert(pool->ref.count > 0); /* else it was empty */ - *(pyblock **)p = lastfree = pool->freeblock; - pool->freeblock = (pyblock *)p; + *(block **)p = lastfree = pool->freeblock; + pool->freeblock = (block *)p; if (lastfree) { struct arena_object* ao; uint nf; /* ao->nfreepools */ @@ -1047,7 +1501,7 @@ _PyObject_Free(void *ctx, void *p) /* Link the pool to freepools. This is a singly-linked * list, and pool->prevpool isn't used there. */ - ao = &_PyRuntime.mem.arenas[pool->arenaindex]; + ao = &arenas[pool->arenaindex]; pool->nextpool = ao->freepools; ao->freepools = pool; nf = ++ao->nfreepools; @@ -1076,9 +1530,9 @@ _PyObject_Free(void *ctx, void *p) * usable_arenas pointer. */ if (ao->prevarena == NULL) { - _PyRuntime.mem.usable_arenas = ao->nextarena; - assert(_PyRuntime.mem.usable_arenas == NULL || - _PyRuntime.mem.usable_arenas->address != 0); + usable_arenas = ao->nextarena; + assert(usable_arenas == NULL || + usable_arenas->address != 0); } else { assert(ao->prevarena->nextarena == ao); @@ -1094,14 +1548,14 @@ _PyObject_Free(void *ctx, void *p) /* Record that this arena_object slot is * available to be reused. */ - ao->nextarena = _PyRuntime.mem.unused_arena_objects; - _PyRuntime.mem.unused_arena_objects = ao; + ao->nextarena = unused_arena_objects; + unused_arena_objects = ao; /* Free the entire arena. */ - _PyRuntime.obj.allocator_arenas.free(_PyRuntime.obj.allocator_arenas.ctx, + _PyObject_Arena.free(_PyObject_Arena.ctx, (void *)ao->address, ARENA_SIZE); ao->address = 0; /* mark unassociated */ - --_PyRuntime.mem.narenas_currently_allocated; + --narenas_currently_allocated; UNLOCK(); return; @@ -1112,12 +1566,12 @@ _PyObject_Free(void *ctx, void *p) * ao->nfreepools was 0 before, ao isn't * currently on the usable_arenas list. */ - ao->nextarena = _PyRuntime.mem.usable_arenas; + ao->nextarena = usable_arenas; ao->prevarena = NULL; - if (_PyRuntime.mem.usable_arenas) - _PyRuntime.mem.usable_arenas->prevarena = ao; - _PyRuntime.mem.usable_arenas = ao; - assert(_PyRuntime.mem.usable_arenas->address != 0); + if (usable_arenas) + usable_arenas->prevarena = ao; + usable_arenas = ao; + assert(usable_arenas->address != 0); UNLOCK(); return; @@ -1147,8 +1601,8 @@ _PyObject_Free(void *ctx, void *p) } else { /* ao is at the head of the list */ - assert(_PyRuntime.mem.usable_arenas == ao); - _PyRuntime.mem.usable_arenas = ao->nextarena; + assert(usable_arenas == ao); + usable_arenas = ao->nextarena; } ao->nextarena->prevarena = ao->prevarena; @@ -1177,7 +1631,7 @@ _PyObject_Free(void *ctx, void *p) nf > ao->prevarena->nfreepools); assert(ao->nextarena == NULL || ao->nextarena->prevarena == ao); - assert((_PyRuntime.mem.usable_arenas == ao && + assert((usable_arenas == ao && ao->prevarena == NULL) || ao->prevarena->nextarena == ao); @@ -1193,7 +1647,7 @@ _PyObject_Free(void *ctx, void *p) --pool->ref.count; assert(pool->ref.count > 0); /* else the pool is empty */ size = pool->szidx; - next = _PyRuntime.mem.usedpools[size + size]; + next = usedpools[size + size]; prev = next->prevpool; /* insert pool before next: prev <-> pool <-> next */ pool->nextpool = next; @@ -1315,13 +1769,15 @@ _Py_GetAllocatedBlocks(void) #define DEADBYTE 0xDB /* dead (newly freed) memory */ #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ +static size_t serialno = 0; /* incremented on each debug {m,re}alloc */ + /* serialno is always incremented via calling this routine. The point is * to supply a single place to set a breakpoint. */ static void bumpserialno(void) { - ++_PyRuntime.mem.serialno; + ++serialno; } #define SST SIZEOF_SIZE_T @@ -1412,7 +1868,7 @@ _PyMem_DebugRawAlloc(int use_calloc, void *ctx, size_t nbytes) /* at tail, write pad (SST bytes) and serialno (SST bytes) */ tail = p + 2*SST + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, _PyRuntime.mem.serialno); + write_size_t(tail + SST, serialno); return p + 2*SST; } @@ -1497,7 +1953,7 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes) tail = q + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, _PyRuntime.mem.serialno); + write_size_t(tail + SST, serialno); if (nbytes > original_nbytes) { /* growing: mark new extra memory clean */ @@ -1829,16 +2285,16 @@ _PyObject_DebugMallocStats(FILE *out) * to march over all the arenas. If we're lucky, most of the memory * will be living in full pools -- would be a shame to miss them. */ - for (i = 0; i < _PyRuntime.mem.maxarenas; ++i) { + for (i = 0; i < maxarenas; ++i) { uint j; - uintptr_t base = _PyRuntime.mem.arenas[i].address; + uintptr_t base = arenas[i].address; /* Skip arenas which are not allocated. */ - if (_PyRuntime.mem.arenas[i].address == (uintptr_t)NULL) + if (arenas[i].address == (uintptr_t)NULL) continue; narenas += 1; - numfreepools += _PyRuntime.mem.arenas[i].nfreepools; + numfreepools += arenas[i].nfreepools; /* round up to pool alignment */ if (base & (uintptr_t)POOL_SIZE_MASK) { @@ -1848,8 +2304,8 @@ _PyObject_DebugMallocStats(FILE *out) } /* visit every pool in the arena */ - assert(base <= (uintptr_t) _PyRuntime.mem.arenas[i].pool_address); - for (j = 0; base < (uintptr_t) _PyRuntime.mem.arenas[i].pool_address; + assert(base <= (uintptr_t) arenas[i].pool_address); + for (j = 0; base < (uintptr_t) arenas[i].pool_address; ++j, base += POOL_SIZE) { poolp p = (poolp)base; const uint sz = p->szidx; @@ -1858,7 +2314,7 @@ _PyObject_DebugMallocStats(FILE *out) if (p->ref.count == 0) { /* currently unused */ #ifdef Py_DEBUG - assert(pool_is_in_list(p, _PyRuntime.mem.arenas[i].freepools)); + assert(pool_is_in_list(p, arenas[i].freepools)); #endif continue; } @@ -1868,11 +2324,11 @@ _PyObject_DebugMallocStats(FILE *out) numfreeblocks[sz] += freeblocks; #ifdef Py_DEBUG if (freeblocks > 0) - assert(pool_is_in_list(p, _PyRuntime.mem.usedpools[sz + sz])); + assert(pool_is_in_list(p, usedpools[sz + sz])); #endif } } - assert(narenas == _PyRuntime.mem.narenas_currently_allocated); + assert(narenas == narenas_currently_allocated); fputc('\n', out); fputs("class size num pools blocks in use avail blocks\n" @@ -1900,10 +2356,10 @@ _PyObject_DebugMallocStats(FILE *out) } fputc('\n', out); if (_PyMem_DebugEnabled()) - (void)printone(out, "# times object malloc called", _PyRuntime.mem.serialno); - (void)printone(out, "# arenas allocated total", _PyRuntime.mem.ntimes_arena_allocated); - (void)printone(out, "# arenas reclaimed", _PyRuntime.mem.ntimes_arena_allocated - narenas); - (void)printone(out, "# arenas highwater mark", _PyRuntime.mem.narenas_highwater); + (void)printone(out, "# times object malloc called", serialno); + (void)printone(out, "# arenas allocated total", ntimes_arena_allocated); + (void)printone(out, "# arenas reclaimed", ntimes_arena_allocated - narenas); + (void)printone(out, "# arenas highwater mark", narenas_highwater); (void)printone(out, "# arenas allocated current", narenas); PyOS_snprintf(buf, sizeof(buf), diff --git a/Objects/setobject.c b/Objects/setobject.c index 6001f7b6f43..219e81d0baf 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1115,7 +1115,6 @@ frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } /* The empty frozenset is a singleton */ if (emptyfrozenset == NULL) - /* There is a possible (relatively harmless) race here. */ emptyfrozenset = make_new_set(type, NULL); Py_XINCREF(emptyfrozenset); return emptyfrozenset; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6bf474a7d1f..1d963aae3f8 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1157,10 +1157,10 @@ subtype_dealloc(PyObject *self) /* UnTrack and re-Track around the trashcan macro, alas */ /* See explanation at end of function for full disclosure */ PyObject_GC_UnTrack(self); - ++_PyRuntime.gc.trash_delete_nesting; + ++_PyTrash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_BEGIN(self); - --_PyRuntime.gc.trash_delete_nesting; + --_PyTrash_delete_nesting; -- tstate->trash_delete_nesting; /* Find the nearest base with a different tp_dealloc */ @@ -1254,10 +1254,10 @@ subtype_dealloc(PyObject *self) Py_DECREF(type); endlabel: - ++_PyRuntime.gc.trash_delete_nesting; + ++_PyTrash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_END(self); - --_PyRuntime.gc.trash_delete_nesting; + --_PyTrash_delete_nesting; -- tstate->trash_delete_nesting; /* Explanation of the weirdness around the trashcan macros: @@ -1297,7 +1297,7 @@ subtype_dealloc(PyObject *self) a subtle disaster. Q. Why the bizarre (net-zero) manipulation of - _PyRuntime.trash_delete_nesting around the trashcan macros? + _PyTrash_delete_nesting around the trashcan macros? A. Some base classes (e.g. list) also use the trashcan mechanism. The following scenario used to be possible: diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 5db80b6cf7c..8ebb22e0e2b 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -106,14 +106,6 @@ - - - - - - - - diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index e5a9b6293c8..cbe1a3943ff 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -129,30 +129,6 @@ Include - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - Include diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c index fd927c0a96b..e386248c2f8 100644 --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -21,12 +21,10 @@ #include "node.h" #include "parsetok.h" #include "pgen.h" -#include "internal/_mem.h" int Py_DebugFlag; int Py_VerboseFlag; int Py_IgnoreEnvironmentFlag; -struct pyruntimestate _PyRuntime = {}; /* Forward */ grammar *getgrammar(const char *filename); @@ -63,8 +61,6 @@ main(int argc, char **argv) filename = argv[1]; graminit_h = argv[2]; graminit_c = argv[3]; - _PyObject_Initialize(&_PyRuntime.obj); - _PyMem_Initialize(&_PyRuntime.mem); g = getgrammar(filename); fp = fopen(graminit_c, "w"); if (fp == NULL) { diff --git a/Python/_warnings.c b/Python/_warnings.c index a5e42a31dc4..8616195c4e3 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -8,6 +8,13 @@ PyDoc_STRVAR(warnings__doc__, MODULE_NAME " provides basic warning filtering support.\n" "It is a helper module to speed up interpreter start-up."); +/* Both 'filters' and 'onceregistry' can be set in warnings.py; + get_warnings_attr() will reset these variables accordingly. */ +static PyObject *_filters; /* List */ +static PyObject *_once_registry; /* Dict */ +static PyObject *_default_action; /* String */ +static long _filters_version; + _Py_IDENTIFIER(argv); _Py_IDENTIFIER(stderr); @@ -46,7 +53,7 @@ get_warnings_attr(const char *attr, int try_import) } /* don't try to import after the start of the Python finallization */ - if (try_import && !_Py_IS_FINALIZING()) { + if (try_import && _Py_Finalizing == NULL) { warnings_module = PyImport_Import(warnings_str); if (warnings_module == NULL) { /* Fallback to the C implementation if we cannot get @@ -83,10 +90,10 @@ get_once_registry(void) if (registry == NULL) { if (PyErr_Occurred()) return NULL; - return _PyRuntime.warnings.once_registry; + return _once_registry; } - Py_DECREF(_PyRuntime.warnings.once_registry); - _PyRuntime.warnings.once_registry = registry; + Py_DECREF(_once_registry); + _once_registry = registry; return registry; } @@ -101,11 +108,11 @@ get_default_action(void) if (PyErr_Occurred()) { return NULL; } - return _PyRuntime.warnings.default_action; + return _default_action; } - Py_DECREF(_PyRuntime.warnings.default_action); - _PyRuntime.warnings.default_action = default_action; + Py_DECREF(_default_action); + _default_action = default_action; return default_action; } @@ -125,24 +132,23 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, return NULL; } else { - Py_DECREF(_PyRuntime.warnings.filters); - _PyRuntime.warnings.filters = warnings_filters; + Py_DECREF(_filters); + _filters = warnings_filters; } - PyObject *filters = _PyRuntime.warnings.filters; - if (filters == NULL || !PyList_Check(filters)) { + if (_filters == NULL || !PyList_Check(_filters)) { PyErr_SetString(PyExc_ValueError, MODULE_NAME ".filters must be a list"); return NULL; } - /* _PyRuntime.warnings.filters could change while we are iterating over it. */ - for (i = 0; i < PyList_GET_SIZE(filters); i++) { + /* _filters could change while we are iterating over it. */ + for (i = 0; i < PyList_GET_SIZE(_filters); i++) { PyObject *tmp_item, *action, *msg, *cat, *mod, *ln_obj; Py_ssize_t ln; int is_subclass, good_msg, good_mod; - tmp_item = PyList_GET_ITEM(filters, i); + tmp_item = PyList_GET_ITEM(_filters, i); if (!PyTuple_Check(tmp_item) || PyTuple_GET_SIZE(tmp_item) != 5) { PyErr_Format(PyExc_ValueError, MODULE_NAME ".filters item %zd isn't a 5-tuple", i); @@ -214,9 +220,9 @@ already_warned(PyObject *registry, PyObject *key, int should_set) version_obj = _PyDict_GetItemId(registry, &PyId_version); if (version_obj == NULL || !PyLong_CheckExact(version_obj) - || PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) { + || PyLong_AsLong(version_obj) != _filters_version) { PyDict_Clear(registry); - version_obj = PyLong_FromLong(_PyRuntime.warnings.filters_version); + version_obj = PyLong_FromLong(_filters_version); if (version_obj == NULL) return -1; if (_PyDict_SetItemId(registry, &PyId_version, version_obj) < 0) { @@ -514,7 +520,7 @@ warn_explicit(PyObject *category, PyObject *message, if (registry == NULL) goto cleanup; } - /* _PyRuntime.warnings.once_registry[(text, category)] = 1 */ + /* _once_registry[(text, category)] = 1 */ rc = update_registry(registry, text, category, 0); } else if (_PyUnicode_EqualToASCIIString(action, "module")) { @@ -904,7 +910,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) static PyObject * warnings_filters_mutated(PyObject *self, PyObject *args) { - _PyRuntime.warnings.filters_version++; + _filters_version++; Py_RETURN_NONE; } @@ -1154,8 +1160,7 @@ create_filter(PyObject *category, const char *action) } /* This assumes the line number is zero for now. */ - return PyTuple_Pack(5, action_obj, Py_None, - category, Py_None, _PyLong_Zero); + return PyTuple_Pack(5, action_obj, Py_None, category, Py_None, _PyLong_Zero); } static PyObject * @@ -1223,35 +1228,33 @@ _PyWarnings_Init(void) if (m == NULL) return NULL; - if (_PyRuntime.warnings.filters == NULL) { - _PyRuntime.warnings.filters = init_filters(); - if (_PyRuntime.warnings.filters == NULL) + if (_filters == NULL) { + _filters = init_filters(); + if (_filters == NULL) return NULL; } - Py_INCREF(_PyRuntime.warnings.filters); - if (PyModule_AddObject(m, "filters", _PyRuntime.warnings.filters) < 0) + Py_INCREF(_filters); + if (PyModule_AddObject(m, "filters", _filters) < 0) return NULL; - if (_PyRuntime.warnings.once_registry == NULL) { - _PyRuntime.warnings.once_registry = PyDict_New(); - if (_PyRuntime.warnings.once_registry == NULL) + if (_once_registry == NULL) { + _once_registry = PyDict_New(); + if (_once_registry == NULL) return NULL; } - Py_INCREF(_PyRuntime.warnings.once_registry); - if (PyModule_AddObject(m, "_onceregistry", - _PyRuntime.warnings.once_registry) < 0) + Py_INCREF(_once_registry); + if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) return NULL; - if (_PyRuntime.warnings.default_action == NULL) { - _PyRuntime.warnings.default_action = PyUnicode_FromString("default"); - if (_PyRuntime.warnings.default_action == NULL) + if (_default_action == NULL) { + _default_action = PyUnicode_FromString("default"); + if (_default_action == NULL) return NULL; } - Py_INCREF(_PyRuntime.warnings.default_action); - if (PyModule_AddObject(m, "_defaultaction", - _PyRuntime.warnings.default_action) < 0) + Py_INCREF(_default_action); + if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) return NULL; - _PyRuntime.warnings.filters_version = 0; + _filters_version = 0; return m; } diff --git a/Python/ceval.c b/Python/ceval.c index 9741c15b892..436e5cad25f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -36,8 +36,7 @@ extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **); typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *); /* Forward declarations */ -Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, - PyObject *); +Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *); static PyObject * do_call_core(PyObject *, PyObject *, PyObject *); #ifdef LLTRACE @@ -53,15 +52,13 @@ static int call_trace_protected(Py_tracefunc, PyObject *, static void call_exc_trace(Py_tracefunc, PyObject *, PyThreadState *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, - PyThreadState *, PyFrameObject *, - int *, int *, int *); + PyThreadState *, PyFrameObject *, int *, int *, int *); static void maybe_dtrace_line(PyFrameObject *, int *, int *, int *); static void dtrace_function_entry(PyFrameObject *); static void dtrace_function_return(PyFrameObject *); static PyObject * cmp_outcome(int, PyObject *, PyObject *); -static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, - PyObject *); +static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, PyObject *); static PyObject * import_from(PyObject *, PyObject *); static int import_all_from(PyObject *, PyObject *); static void format_exc_check_arg(PyObject *, const char *, PyObject *); @@ -91,7 +88,7 @@ static long dxp[256]; #endif #ifdef WITH_THREAD -#define GIL_REQUEST _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) +#define GIL_REQUEST _Py_atomic_load_relaxed(&gil_drop_request) #else #define GIL_REQUEST 0 #endif @@ -101,22 +98,22 @@ static long dxp[256]; the GIL eventually anyway. */ #define COMPUTE_EVAL_BREAKER() \ _Py_atomic_store_relaxed( \ - &_PyRuntime.ceval.eval_breaker, \ + &eval_breaker, \ GIL_REQUEST | \ - _Py_atomic_load_relaxed(&_PyRuntime.ceval.pending.calls_to_do) | \ - _PyRuntime.ceval.pending.async_exc) + _Py_atomic_load_relaxed(&pendingcalls_to_do) | \ + pending_async_exc) #ifdef WITH_THREAD #define SET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 1); \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ + _Py_atomic_store_relaxed(&gil_drop_request, 1); \ + _Py_atomic_store_relaxed(&eval_breaker, 1); \ } while (0) #define RESET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 0); \ + _Py_atomic_store_relaxed(&gil_drop_request, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) @@ -125,35 +122,47 @@ static long dxp[256]; /* Pending calls are only modified under pending_lock */ #define SIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 1); \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ + _Py_atomic_store_relaxed(&pendingcalls_to_do, 1); \ + _Py_atomic_store_relaxed(&eval_breaker, 1); \ } while (0) #define UNSIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 0); \ + _Py_atomic_store_relaxed(&pendingcalls_to_do, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) #define SIGNAL_ASYNC_EXC() \ do { \ - _PyRuntime.ceval.pending.async_exc = 1; \ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ + pending_async_exc = 1; \ + _Py_atomic_store_relaxed(&eval_breaker, 1); \ } while (0) #define UNSIGNAL_ASYNC_EXC() \ - do { \ - _PyRuntime.ceval.pending.async_exc = 0; \ - COMPUTE_EVAL_BREAKER(); \ - } while (0) + do { pending_async_exc = 0; COMPUTE_EVAL_BREAKER(); } while (0) +/* This single variable consolidates all requests to break out of the fast path + in the eval loop. */ +static _Py_atomic_int eval_breaker = {0}; +/* Request for running pending calls. */ +static _Py_atomic_int pendingcalls_to_do = {0}; +/* Request for looking at the `async_exc` field of the current thread state. + Guarded by the GIL. */ +static int pending_async_exc = 0; + #ifdef WITH_THREAD #ifdef HAVE_ERRNO_H #include #endif #include "pythread.h" + +static PyThread_type_lock pending_lock = 0; /* for pending calls */ +static unsigned long main_thread = 0; +/* Request for dropping the GIL */ +static _Py_atomic_int gil_drop_request = {0}; + #include "ceval_gil.h" int @@ -169,9 +178,9 @@ PyEval_InitThreads(void) return; create_gil(); take_gil(PyThreadState_GET()); - _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); - if (!_PyRuntime.ceval.pending.lock) - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + main_thread = PyThread_get_thread_ident(); + if (!pending_lock) + pending_lock = PyThread_allocate_lock(); } void @@ -239,9 +248,9 @@ PyEval_ReInitThreads(void) if (!gil_created()) return; recreate_gil(); - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + pending_lock = PyThread_allocate_lock(); take_gil(current_tstate); - _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); + main_thread = PyThread_get_thread_ident(); /* Destroy all threads except the current one */ _PyThreadState_DeleteExcept(current_tstate); @@ -285,7 +294,7 @@ PyEval_RestoreThread(PyThreadState *tstate) int err = errno; take_gil(tstate); /* _Py_Finalizing is protected by the GIL */ - if (_Py_IS_FINALIZING() && !_Py_CURRENTLY_FINALIZING(tstate)) { + if (_Py_Finalizing && tstate != _Py_Finalizing) { drop_gil(tstate); PyThread_exit_thread(); assert(0); /* unreachable */ @@ -337,11 +346,19 @@ _PyEval_SignalReceived(void) callback. */ +#define NPENDINGCALLS 32 +static struct { + int (*func)(void *); + void *arg; +} pendingcalls[NPENDINGCALLS]; +static int pendingfirst = 0; +static int pendinglast = 0; + int Py_AddPendingCall(int (*func)(void *), void *arg) { int i, j, result=0; - PyThread_type_lock lock = _PyRuntime.ceval.pending.lock; + PyThread_type_lock lock = pending_lock; /* try a few times for the lock. Since this mechanism is used * for signal handling (on the main thread), there is a (slim) @@ -363,14 +380,14 @@ Py_AddPendingCall(int (*func)(void *), void *arg) return -1; } - i = _PyRuntime.ceval.pending.last; + i = pendinglast; j = (i + 1) % NPENDINGCALLS; - if (j == _PyRuntime.ceval.pending.first) { + if (j == pendingfirst) { result = -1; /* Queue full */ } else { - _PyRuntime.ceval.pending.calls[i].func = func; - _PyRuntime.ceval.pending.calls[i].arg = arg; - _PyRuntime.ceval.pending.last = j; + pendingcalls[i].func = func; + pendingcalls[i].arg = arg; + pendinglast = j; } /* signal main loop */ SIGNAL_PENDING_CALLS(); @@ -388,19 +405,16 @@ Py_MakePendingCalls(void) assert(PyGILState_Check()); - if (!_PyRuntime.ceval.pending.lock) { + if (!pending_lock) { /* initial allocation of the lock */ - _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); - if (_PyRuntime.ceval.pending.lock == NULL) + pending_lock = PyThread_allocate_lock(); + if (pending_lock == NULL) return -1; } /* only service pending calls on main thread */ - if (_PyRuntime.ceval.pending.main_thread && - PyThread_get_thread_ident() != _PyRuntime.ceval.pending.main_thread) - { + if (main_thread && PyThread_get_thread_ident() != main_thread) return 0; - } /* don't perform recursive pending calls */ if (busy) return 0; @@ -422,16 +436,16 @@ Py_MakePendingCalls(void) void *arg = NULL; /* pop one item off the queue while holding the lock */ - PyThread_acquire_lock(_PyRuntime.ceval.pending.lock, WAIT_LOCK); - j = _PyRuntime.ceval.pending.first; - if (j == _PyRuntime.ceval.pending.last) { + PyThread_acquire_lock(pending_lock, WAIT_LOCK); + j = pendingfirst; + if (j == pendinglast) { func = NULL; /* Queue empty */ } else { - func = _PyRuntime.ceval.pending.calls[j].func; - arg = _PyRuntime.ceval.pending.calls[j].arg; - _PyRuntime.ceval.pending.first = (j + 1) % NPENDINGCALLS; + func = pendingcalls[j].func; + arg = pendingcalls[j].arg; + pendingfirst = (j + 1) % NPENDINGCALLS; } - PyThread_release_lock(_PyRuntime.ceval.pending.lock); + PyThread_release_lock(pending_lock); /* having released the lock, perform the callback */ if (func == NULL) break; @@ -475,6 +489,14 @@ Py_MakePendingCalls(void) The two threads could theoretically wiggle around the "busy" variable. */ +#define NPENDINGCALLS 32 +static struct { + int (*func)(void *); + void *arg; +} pendingcalls[NPENDINGCALLS]; +static volatile int pendingfirst = 0; +static volatile int pendinglast = 0; + int Py_AddPendingCall(int (*func)(void *), void *arg) { @@ -484,15 +506,15 @@ Py_AddPendingCall(int (*func)(void *), void *arg) if (busy) return -1; busy = 1; - i = _PyRuntime.ceval.pending.last; + i = pendinglast; j = (i + 1) % NPENDINGCALLS; - if (j == _PyRuntime.ceval.pending.first) { + if (j == pendingfirst) { busy = 0; return -1; /* Queue full */ } - _PyRuntime.ceval.pending.calls[i].func = func; - _PyRuntime.ceval.pending.calls[i].arg = arg; - _PyRuntime.ceval.pending.last = j; + pendingcalls[i].func = func; + pendingcalls[i].arg = arg; + pendinglast = j; SIGNAL_PENDING_CALLS(); busy = 0; @@ -521,12 +543,12 @@ Py_MakePendingCalls(void) int i; int (*func)(void *); void *arg; - i = _PyRuntime.ceval.pending.first; - if (i == _PyRuntime.ceval.pending.last) + i = pendingfirst; + if (i == pendinglast) break; /* Queue empty */ - func = _PyRuntime.ceval.pending.calls[i].func; - arg = _PyRuntime.ceval.pending.calls[i].arg; - _PyRuntime.ceval.pending.first = (i + 1) % NPENDINGCALLS; + func = pendingcalls[i].func; + arg = pendingcalls[i].arg; + pendingfirst = (i + 1) % NPENDINGCALLS; if (func(arg) < 0) { goto error; } @@ -548,32 +570,20 @@ Py_MakePendingCalls(void) #ifndef Py_DEFAULT_RECURSION_LIMIT #define Py_DEFAULT_RECURSION_LIMIT 1000 #endif - -void -_PyEval_Initialize(struct _ceval_runtime_state *state) -{ - state->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; - state->check_recursion_limit = Py_DEFAULT_RECURSION_LIMIT; - _gil_initialize(&state->gil); -} - -int -_PyEval_CheckRecursionLimit(void) -{ - return _PyRuntime.ceval.check_recursion_limit; -} +static int recursion_limit = Py_DEFAULT_RECURSION_LIMIT; +int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; int Py_GetRecursionLimit(void) { - return _PyRuntime.ceval.recursion_limit; + return recursion_limit; } void Py_SetRecursionLimit(int new_limit) { - _PyRuntime.ceval.recursion_limit = new_limit; - _PyRuntime.ceval.check_recursion_limit = _PyRuntime.ceval.recursion_limit; + recursion_limit = new_limit; + _Py_CheckRecursionLimit = recursion_limit; } /* the macro Py_EnterRecursiveCall() only calls _Py_CheckRecursiveCall() @@ -585,7 +595,6 @@ int _Py_CheckRecursiveCall(const char *where) { PyThreadState *tstate = PyThreadState_GET(); - int recursion_limit = _PyRuntime.ceval.recursion_limit; #ifdef USE_STACKCHECK if (PyOS_CheckStack()) { @@ -594,7 +603,7 @@ _Py_CheckRecursiveCall(const char *where) return -1; } #endif - _PyRuntime.ceval.check_recursion_limit = recursion_limit; + _Py_CheckRecursionLimit = recursion_limit; if (tstate->recursion_critical) /* Somebody asked that we don't check for recursion. */ return 0; @@ -633,7 +642,13 @@ static void restore_and_clear_exc_state(PyThreadState *, PyFrameObject *); static int do_raise(PyObject *, PyObject *); static int unpack_iterable(PyObject *, int, int, PyObject **); -#define _Py_TracingPossible _PyRuntime.ceval.tracing_possible +/* Records whether tracing is on for any thread. Counts the number of + threads for which tstate->c_tracefunc is non-NULL, so if the value + is 0, we know we don't have to check this thread's c_tracefunc. + This speeds up the if statement in PyEval_EvalFrameEx() after + fast_next_opcode*/ +static int _Py_TracingPossible = 0; + PyObject * @@ -764,7 +779,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) #define DISPATCH() \ { \ - if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \ + if (!_Py_atomic_load_relaxed(&eval_breaker)) { \ FAST_DISPATCH(); \ } \ continue; \ @@ -812,8 +827,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) /* Code access macros */ /* The integer overflow is checked by an assertion below. */ -#define INSTR_OFFSET() \ - (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) +#define INSTR_OFFSET() (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) #define NEXTOPARG() do { \ _Py_CODEUNIT word = *next_instr; \ opcode = _Py_OPCODE(word); \ @@ -1066,7 +1080,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ - if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { + if (_Py_atomic_load_relaxed(&eval_breaker)) { if (_Py_OPCODE(*next_instr) == SETUP_FINALLY || _Py_OPCODE(*next_instr) == YIELD_FROM) { /* Two cases where we skip running signal handlers and other @@ -1083,16 +1097,12 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) */ goto fast_next_opcode; } - if (_Py_atomic_load_relaxed( - &_PyRuntime.ceval.pending.calls_to_do)) - { + if (_Py_atomic_load_relaxed(&pendingcalls_to_do)) { if (Py_MakePendingCalls() < 0) goto error; } #ifdef WITH_THREAD - if (_Py_atomic_load_relaxed( - &_PyRuntime.ceval.gil_drop_request)) - { + if (_Py_atomic_load_relaxed(&gil_drop_request)) { /* Give another thread a chance */ if (PyThreadState_Swap(NULL) != tstate) Py_FatalError("ceval: tstate mix-up"); @@ -1103,9 +1113,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) take_gil(tstate); /* Check if we should make a quick exit. */ - if (_Py_IS_FINALIZING() && - !_Py_CURRENTLY_FINALIZING(tstate)) - { + if (_Py_Finalizing && _Py_Finalizing != tstate) { drop_gil(tstate); PyThread_exit_thread(); } diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index ef5189068e0..a3b450bd5c4 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -8,13 +8,20 @@ /* First some general settings */ -#define INTERVAL (_PyRuntime.ceval.gil.interval >= 1 ? _PyRuntime.ceval.gil.interval : 1) +/* microseconds (the Python API uses seconds, though) */ +#define DEFAULT_INTERVAL 5000 +static unsigned long gil_interval = DEFAULT_INTERVAL; +#define INTERVAL (gil_interval >= 1 ? gil_interval : 1) + +/* Enable if you want to force the switching of threads at least every `gil_interval` */ +#undef FORCE_SWITCHING +#define FORCE_SWITCHING /* Notes about the implementation: - - The GIL is just a boolean variable (locked) whose access is protected + - The GIL is just a boolean variable (gil_locked) whose access is protected by a mutex (gil_mutex), and whose changes are signalled by a condition variable (gil_cond). gil_mutex is taken for short periods of time, and therefore mostly uncontended. @@ -41,7 +48,7 @@ - When a thread releases the GIL and gil_drop_request is set, that thread ensures that another GIL-awaiting thread gets scheduled. It does so by waiting on a condition variable (switch_cond) until - the value of last_holder is changed to something else than its + the value of gil_last_holder is changed to something else than its own thread state pointer, indicating that another thread was able to take the GIL. @@ -53,7 +60,11 @@ */ #include "condvar.h" +#ifndef Py_HAVE_CONDVAR +#error You need either a POSIX-compatible or a Windows system! +#endif +#define MUTEX_T PyMUTEX_T #define MUTEX_INIT(mut) \ if (PyMUTEX_INIT(&(mut))) { \ Py_FatalError("PyMUTEX_INIT(" #mut ") failed"); }; @@ -67,6 +78,7 @@ if (PyMUTEX_UNLOCK(&(mut))) { \ Py_FatalError("PyMUTEX_UNLOCK(" #mut ") failed"); }; +#define COND_T PyCOND_T #define COND_INIT(cond) \ if (PyCOND_INIT(&(cond))) { \ Py_FatalError("PyCOND_INIT(" #cond ") failed"); }; @@ -91,36 +103,48 @@ } \ -#define DEFAULT_INTERVAL 5000 -static void _gil_initialize(struct _gil_runtime_state *state) -{ - _Py_atomic_int uninitialized = {-1}; - state->locked = uninitialized; - state->interval = DEFAULT_INTERVAL; -} +/* Whether the GIL is already taken (-1 if uninitialized). This is atomic + because it can be read without any lock taken in ceval.c. */ +static _Py_atomic_int gil_locked = {-1}; +/* Number of GIL switches since the beginning. */ +static unsigned long gil_switch_number = 0; +/* Last PyThreadState holding / having held the GIL. This helps us know + whether anyone else was scheduled after we dropped the GIL. */ +static _Py_atomic_address gil_last_holder = {0}; + +/* This condition variable allows one or several threads to wait until + the GIL is released. In addition, the mutex also protects the above + variables. */ +static COND_T gil_cond; +static MUTEX_T gil_mutex; + +#ifdef FORCE_SWITCHING +/* This condition variable helps the GIL-releasing thread wait for + a GIL-awaiting thread to be scheduled and take the GIL. */ +static COND_T switch_cond; +static MUTEX_T switch_mutex; +#endif + static int gil_created(void) { - return (_Py_atomic_load_explicit(&_PyRuntime.ceval.gil.locked, - _Py_memory_order_acquire) - ) >= 0; + return _Py_atomic_load_explicit(&gil_locked, _Py_memory_order_acquire) >= 0; } static void create_gil(void) { - MUTEX_INIT(_PyRuntime.ceval.gil.mutex); + MUTEX_INIT(gil_mutex); #ifdef FORCE_SWITCHING - MUTEX_INIT(_PyRuntime.ceval.gil.switch_mutex); + MUTEX_INIT(switch_mutex); #endif - COND_INIT(_PyRuntime.ceval.gil.cond); + COND_INIT(gil_cond); #ifdef FORCE_SWITCHING - COND_INIT(_PyRuntime.ceval.gil.switch_cond); + COND_INIT(switch_cond); #endif - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, 0); - _Py_ANNOTATE_RWLOCK_CREATE(&_PyRuntime.ceval.gil.locked); - _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, 0, - _Py_memory_order_release); + _Py_atomic_store_relaxed(&gil_last_holder, 0); + _Py_ANNOTATE_RWLOCK_CREATE(&gil_locked); + _Py_atomic_store_explicit(&gil_locked, 0, _Py_memory_order_release); } static void destroy_gil(void) @@ -128,62 +152,54 @@ static void destroy_gil(void) /* some pthread-like implementations tie the mutex to the cond * and must have the cond destroyed first. */ - COND_FINI(_PyRuntime.ceval.gil.cond); - MUTEX_FINI(_PyRuntime.ceval.gil.mutex); + COND_FINI(gil_cond); + MUTEX_FINI(gil_mutex); #ifdef FORCE_SWITCHING - COND_FINI(_PyRuntime.ceval.gil.switch_cond); - MUTEX_FINI(_PyRuntime.ceval.gil.switch_mutex); + COND_FINI(switch_cond); + MUTEX_FINI(switch_mutex); #endif - _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, -1, - _Py_memory_order_release); - _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); + _Py_atomic_store_explicit(&gil_locked, -1, _Py_memory_order_release); + _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); } static void recreate_gil(void) { - _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); + _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); /* XXX should we destroy the old OS resources here? */ create_gil(); } static void drop_gil(PyThreadState *tstate) { - if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) + if (!_Py_atomic_load_relaxed(&gil_locked)) Py_FatalError("drop_gil: GIL is not locked"); /* tstate is allowed to be NULL (early interpreter init) */ if (tstate != NULL) { /* Sub-interpreter support: threads might have been switched under our feet using PyThreadState_Swap(). Fix the GIL last holder variable so that our heuristics work. */ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, - (uintptr_t)tstate); + _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); } - MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); - _Py_ANNOTATE_RWLOCK_RELEASED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 0); - COND_SIGNAL(_PyRuntime.ceval.gil.cond); - MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); + MUTEX_LOCK(gil_mutex); + _Py_ANNOTATE_RWLOCK_RELEASED(&gil_locked, /*is_write=*/1); + _Py_atomic_store_relaxed(&gil_locked, 0); + COND_SIGNAL(gil_cond); + MUTEX_UNLOCK(gil_mutex); #ifdef FORCE_SWITCHING - if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) && - tstate != NULL) - { - MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); + if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) { + MUTEX_LOCK(switch_mutex); /* Not switched yet => wait */ - if (((PyThreadState*)_Py_atomic_load_relaxed( - &_PyRuntime.ceval.gil.last_holder) - ) == tstate) - { + if ((PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder) == tstate) { RESET_GIL_DROP_REQUEST(); /* NOTE: if COND_WAIT does not atomically start waiting when releasing the mutex, another thread can run through, take the GIL and drop it again, and reset the condition before we even had a chance to wait for it. */ - COND_WAIT(_PyRuntime.ceval.gil.switch_cond, - _PyRuntime.ceval.gil.switch_mutex); + COND_WAIT(switch_cond, switch_mutex); } - MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); + MUTEX_UNLOCK(switch_mutex); } #endif } @@ -195,65 +211,60 @@ static void take_gil(PyThreadState *tstate) Py_FatalError("take_gil: NULL tstate"); err = errno; - MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); + MUTEX_LOCK(gil_mutex); - if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) + if (!_Py_atomic_load_relaxed(&gil_locked)) goto _ready; - while (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) { + while (_Py_atomic_load_relaxed(&gil_locked)) { int timed_out = 0; unsigned long saved_switchnum; - saved_switchnum = _PyRuntime.ceval.gil.switch_number; - COND_TIMED_WAIT(_PyRuntime.ceval.gil.cond, _PyRuntime.ceval.gil.mutex, - INTERVAL, timed_out); + saved_switchnum = gil_switch_number; + COND_TIMED_WAIT(gil_cond, gil_mutex, INTERVAL, timed_out); /* If we timed out and no switch occurred in the meantime, it is time to ask the GIL-holding thread to drop it. */ if (timed_out && - _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked) && - _PyRuntime.ceval.gil.switch_number == saved_switchnum) { + _Py_atomic_load_relaxed(&gil_locked) && + gil_switch_number == saved_switchnum) { SET_GIL_DROP_REQUEST(); } } _ready: #ifdef FORCE_SWITCHING - /* This mutex must be taken before modifying - _PyRuntime.ceval.gil.last_holder (see drop_gil()). */ - MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); + /* This mutex must be taken before modifying gil_last_holder (see drop_gil()). */ + MUTEX_LOCK(switch_mutex); #endif /* We now hold the GIL */ - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 1); - _Py_ANNOTATE_RWLOCK_ACQUIRED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); - - if (tstate != (PyThreadState*)_Py_atomic_load_relaxed( - &_PyRuntime.ceval.gil.last_holder)) - { - _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, - (uintptr_t)tstate); - ++_PyRuntime.ceval.gil.switch_number; + _Py_atomic_store_relaxed(&gil_locked, 1); + _Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1); + + if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) { + _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); + ++gil_switch_number; } #ifdef FORCE_SWITCHING - COND_SIGNAL(_PyRuntime.ceval.gil.switch_cond); - MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); + COND_SIGNAL(switch_cond); + MUTEX_UNLOCK(switch_mutex); #endif - if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request)) { + if (_Py_atomic_load_relaxed(&gil_drop_request)) { RESET_GIL_DROP_REQUEST(); } if (tstate->async_exc != NULL) { _PyEval_SignalAsyncExc(); } - MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); + MUTEX_UNLOCK(gil_mutex); errno = err; } void _PyEval_SetSwitchInterval(unsigned long microseconds) { - _PyRuntime.ceval.gil.interval = microseconds; + gil_interval = microseconds; } unsigned long _PyEval_GetSwitchInterval() { - return _PyRuntime.ceval.gil.interval; + return gil_interval; } diff --git a/Python/condvar.h b/Python/condvar.h index aaa8043585f..9a71b17738f 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -37,16 +37,27 @@ * Condition Variable. */ -#ifndef _CONDVAR_IMPL_H_ -#define _CONDVAR_IMPL_H_ +#ifndef _CONDVAR_H_ +#define _CONDVAR_H_ #include "Python.h" -#include "internal/_condvar.h" + +#ifndef _POSIX_THREADS +/* This means pthreads are not implemented in libc headers, hence the macro + not present in unistd.h. But they still can be implemented as an external + library (e.g. gnu pth in pthread emulation) */ +# ifdef HAVE_PTHREAD_H +# include /* _POSIX_THREADS */ +# endif +#endif #ifdef _POSIX_THREADS /* * POSIX support */ +#define Py_HAVE_CONDVAR + +#include #define PyCOND_ADD_MICROSECONDS(tv, interval) \ do { /* TODO: add overflow and truncation checks */ \ @@ -63,11 +74,13 @@ do { /* TODO: add overflow and truncation checks */ \ #endif /* The following functions return 0 on success, nonzero on error */ +#define PyMUTEX_T pthread_mutex_t #define PyMUTEX_INIT(mut) pthread_mutex_init((mut), NULL) #define PyMUTEX_FINI(mut) pthread_mutex_destroy(mut) #define PyMUTEX_LOCK(mut) pthread_mutex_lock(mut) #define PyMUTEX_UNLOCK(mut) pthread_mutex_unlock(mut) +#define PyCOND_T pthread_cond_t #define PyCOND_INIT(cond) pthread_cond_init((cond), NULL) #define PyCOND_FINI(cond) pthread_cond_destroy(cond) #define PyCOND_SIGNAL(cond) pthread_cond_signal(cond) @@ -103,11 +116,45 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) * Emulated condition variables ones that work with XP and later, plus * example native support on VISTA and onwards. */ +#define Py_HAVE_CONDVAR + + +/* include windows if it hasn't been done before */ +#define WIN32_LEAN_AND_MEAN +#include + +/* options */ +/* non-emulated condition variables are provided for those that want + * to target Windows Vista. Modify this macro to enable them. + */ +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ +#endif + +/* fall back to emulation if not targeting Vista */ +#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif + #if _PY_EMULATED_WIN_CV /* The mutex is a CriticalSection object and The condition variables is emulated with the help of a semaphore. + Semaphores are available on Windows XP (2003 server) and later. + We use a Semaphore rather than an auto-reset event, because although + an auto-resent event might appear to solve the lost-wakeup bug (race + condition between releasing the outer lock and waiting) because it + maintains state even though a wait hasn't happened, there is still + a lost wakeup problem if more than one thread are interrupted in the + critical place. A semaphore solves that, because its state is counted, + not Boolean. + Because it is ok to signal a condition variable with no one + waiting, we need to keep track of the number of + waiting threads. Otherwise, the semaphore's state could rise + without bound. This also helps reduce the number of "spurious wakeups" + that would otherwise happen. This implementation still has the problem that the threads woken with a "signal" aren't necessarily those that are already @@ -121,6 +168,8 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) http://www.cse.wustl.edu/~schmidt/win32-cv-1.html */ +typedef CRITICAL_SECTION PyMUTEX_T; + Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) { @@ -149,6 +198,15 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) return 0; } +/* The ConditionVariable object. From XP onwards it is easily emulated with + * a Semaphore + */ + +typedef struct _PyCOND_T +{ + HANDLE sem; + int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ +} PyCOND_T; Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) @@ -246,7 +304,12 @@ PyCOND_BROADCAST(PyCOND_T *cv) return 0; } -#else /* !_PY_EMULATED_WIN_CV */ +#else + +/* Use native Win7 primitives if build target is Win7 or higher */ + +/* SRWLOCK is faster and better than CriticalSection */ +typedef SRWLOCK PyMUTEX_T; Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) @@ -276,6 +339,8 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) } +typedef CONDITION_VARIABLE PyCOND_T; + Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) { @@ -322,4 +387,4 @@ PyCOND_BROADCAST(PyCOND_T *cv) #endif /* _POSIX_THREADS, NT_THREADS */ -#endif /* _CONDVAR_IMPL_H_ */ +#endif /* _CONDVAR_H_ */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 3f405b1225a..662405bdeb3 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -77,30 +77,6 @@ extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); #endif /* WITH_THREAD */ -_PyRuntimeState _PyRuntime = {0, 0}; - -void -_PyRuntime_Initialize(void) -{ - /* XXX We only initialize once in the process, which aligns with - the static initialization of the former globals now found in - _PyRuntime. However, _PyRuntime *should* be initialized with - every Py_Initialize() call, but doing so breaks the runtime. - This is because the runtime state is not properly finalized - currently. */ - static int initialized = 0; - if (initialized) - return; - initialized = 1; - _PyRuntimeState_Init(&_PyRuntime); -} - -void -_PyRuntime_Finalize(void) -{ - _PyRuntimeState_Fini(&_PyRuntime); -} - /* Global configuration variable declarations are in pydebug.h */ /* XXX (ncoghlan): move those declarations to pylifecycle.h? */ int Py_DebugFlag; /* Needed by parser.c */ @@ -124,6 +100,8 @@ int Py_LegacyWindowsFSEncodingFlag = 0; /* Uses mbcs instead of utf-8 */ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */ #endif +PyThreadState *_Py_Finalizing = NULL; + /* Hack to force loading of object files */ int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \ PyOS_mystrnicmp; /* Python/pystrcmp.o */ @@ -141,17 +119,19 @@ PyModule_GetWarningsModule(void) * * Can be called prior to Py_Initialize. */ +int _Py_CoreInitialized = 0; +int _Py_Initialized = 0; int _Py_IsCoreInitialized(void) { - return _PyRuntime.core_initialized; + return _Py_CoreInitialized; } int Py_IsInitialized(void) { - return _PyRuntime.initialized; + return _Py_Initialized; } /* Helper to allow an embedding application to override the normal @@ -564,16 +544,14 @@ void _Py_InitializeCore(const _PyCoreConfig *config) _PyCoreConfig core_config = _PyCoreConfig_INIT; _PyMainInterpreterConfig preinit_config = _PyMainInterpreterConfig_INIT; - _PyRuntime_Initialize(); - if (config != NULL) { core_config = *config; } - if (_PyRuntime.initialized) { + if (_Py_Initialized) { Py_FatalError("Py_InitializeCore: main interpreter already initialized"); } - if (_PyRuntime.core_initialized) { + if (_Py_CoreInitialized) { Py_FatalError("Py_InitializeCore: runtime core already initialized"); } @@ -586,14 +564,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) * threads still hanging around from a previous Py_Initialize/Finalize * pair :( */ - _PyRuntime.finalizing = NULL; - - if (_PyMem_SetupAllocators(core_config.allocator) < 0) { - fprintf(stderr, - "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", - core_config.allocator); - exit(1); - } + _Py_Finalizing = NULL; #ifdef __ANDROID__ /* Passing "" to setlocale() on Android requests the C locale rather @@ -635,7 +606,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) Py_HashRandomizationFlag = 1; } - _PyInterpreterState_Enable(&_PyRuntime); + _PyInterpreterState_Init(); interp = PyInterpreterState_New(); if (interp == NULL) Py_FatalError("Py_InitializeCore: can't make main interpreter"); @@ -727,7 +698,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) } /* Only when we get here is the runtime core fully initialized */ - _PyRuntime.core_initialized = 1; + _Py_CoreInitialized = 1; } /* Read configuration settings from standard locations @@ -768,10 +739,10 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) PyInterpreterState *interp; PyThreadState *tstate; - if (!_PyRuntime.core_initialized) { + if (!_Py_CoreInitialized) { Py_FatalError("Py_InitializeMainInterpreter: runtime core not initialized"); } - if (_PyRuntime.initialized) { + if (_Py_Initialized) { Py_FatalError("Py_InitializeMainInterpreter: main interpreter already initialized"); } @@ -792,7 +763,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) * This means anything which needs support from extension modules * or pure Python code in the standard library won't work. */ - _PyRuntime.initialized = 1; + _Py_Initialized = 1; return 0; } /* TODO: Report exceptions rather than fatal errors below here */ @@ -837,7 +808,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) Py_XDECREF(warnings_module); } - _PyRuntime.initialized = 1; + _Py_Initialized = 1; if (!Py_NoSiteFlag) initsite(); /* Module site */ @@ -953,7 +924,7 @@ Py_FinalizeEx(void) PyThreadState *tstate; int status = 0; - if (!_PyRuntime.initialized) + if (!_Py_Initialized) return status; wait_for_thread_shutdown(); @@ -975,9 +946,9 @@ Py_FinalizeEx(void) /* Remaining threads (e.g. daemon threads) will automatically exit after taking the GIL (in PyEval_RestoreThread()). */ - _PyRuntime.finalizing = tstate; - _PyRuntime.initialized = 0; - _PyRuntime.core_initialized = 0; + _Py_Finalizing = tstate; + _Py_Initialized = 0; + _Py_CoreInitialized = 0; /* Flush sys.stdout and sys.stderr */ if (flush_std_files() < 0) { @@ -1139,7 +1110,6 @@ Py_FinalizeEx(void) #endif call_ll_exitfuncs(); - _PyRuntime_Finalize(); return status; } @@ -1169,7 +1139,7 @@ Py_NewInterpreter(void) PyThreadState *tstate, *save_tstate; PyObject *bimod, *sysmod; - if (!_PyRuntime.initialized) + if (!_Py_Initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); #ifdef WITH_THREAD @@ -1884,19 +1854,20 @@ Py_FatalError(const char *msg) # include "pythread.h" #endif +static void (*pyexitfunc)(void) = NULL; /* For the atexit module. */ void _Py_PyAtExit(void (*func)(void)) { - _PyRuntime.pyexitfunc = func; + pyexitfunc = func; } static void call_py_exitfuncs(void) { - if (_PyRuntime.pyexitfunc == NULL) + if (pyexitfunc == NULL) return; - (*_PyRuntime.pyexitfunc)(); + (*pyexitfunc)(); PyErr_Clear(); } @@ -1929,19 +1900,22 @@ wait_for_thread_shutdown(void) } #define NEXITFUNCS 32 +static void (*exitfuncs[NEXITFUNCS])(void); +static int nexitfuncs = 0; + int Py_AtExit(void (*func)(void)) { - if (_PyRuntime.nexitfuncs >= NEXITFUNCS) + if (nexitfuncs >= NEXITFUNCS) return -1; - _PyRuntime.exitfuncs[_PyRuntime.nexitfuncs++] = func; + exitfuncs[nexitfuncs++] = func; return 0; } static void call_ll_exitfuncs(void) { - while (_PyRuntime.nexitfuncs > 0) - (*_PyRuntime.exitfuncs[--_PyRuntime.nexitfuncs])(); + while (nexitfuncs > 0) + (*exitfuncs[--nexitfuncs])(); fflush(stdout); fflush(stderr); diff --git a/Python/pystate.c b/Python/pystate.c index 2d926372fd6..30a372212ed 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -34,65 +34,55 @@ to avoid the expense of doing their own locking). extern "C" { #endif -void -_PyRuntimeState_Init(_PyRuntimeState *runtime) -{ - memset(runtime, 0, sizeof(*runtime)); - - _PyObject_Initialize(&runtime->obj); - _PyMem_Initialize(&runtime->mem); - _PyGC_Initialize(&runtime->gc); - _PyEval_Initialize(&runtime->ceval); - - runtime->gilstate.check_enabled = 1; - runtime->gilstate.autoTLSkey = -1; +int _PyGILState_check_enabled = 1; #ifdef WITH_THREAD - runtime->interpreters.mutex = PyThread_allocate_lock(); - if (runtime->interpreters.mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); -#endif - runtime->interpreters.next_id = -1; -} - -void -_PyRuntimeState_Fini(_PyRuntimeState *runtime) -{ -#ifdef WITH_THREAD - if (runtime->interpreters.mutex != NULL) { - PyThread_free_lock(runtime->interpreters.mutex); - runtime->interpreters.mutex = NULL; - } -#endif -} - -#ifdef WITH_THREAD -#define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \ - WAIT_LOCK) -#define HEAD_UNLOCK() PyThread_release_lock(_PyRuntime.interpreters.mutex) +#include "pythread.h" +static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ +#define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) +#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK) +#define HEAD_UNLOCK() PyThread_release_lock(head_mutex) + +/* The single PyInterpreterState used by this process' + GILState implementation +*/ +/* TODO: Given interp_main, it may be possible to kill this ref */ +static PyInterpreterState *autoInterpreterState = NULL; +static int autoTLSkey = -1; #else +#define HEAD_INIT() /* Nothing */ #define HEAD_LOCK() /* Nothing */ #define HEAD_UNLOCK() /* Nothing */ #endif +static PyInterpreterState *interp_head = NULL; +static PyInterpreterState *interp_main = NULL; + +/* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ +_Py_atomic_address _PyThreadState_Current = {0}; +PyThreadFrameGetter _PyThreadState_GetFrame = NULL; + #ifdef WITH_THREAD static void _PyGILState_NoteThreadState(PyThreadState* tstate); #endif +/* _next_interp_id is an auto-numbered sequence of small integers. + It gets initialized in _PyInterpreterState_Init(), which is called + in Py_Initialize(), and used in PyInterpreterState_New(). A negative + interpreter ID indicates an error occurred. The main interpreter + will always have an ID of 0. Overflow results in a RuntimeError. + If that becomes a problem later then we can adjust, e.g. by using + a Python int. + + We initialize this to -1 so that the pre-Py_Initialize() value + results in an error. */ +static int64_t _next_interp_id = -1; + void -_PyInterpreterState_Enable(_PyRuntimeState *runtime) +_PyInterpreterState_Init(void) { - runtime->interpreters.next_id = 0; -#ifdef WITH_THREAD - /* Since we only call _PyRuntimeState_Init() once per process - (see _PyRuntime_Initialize()), we make sure the mutex is - initialized here. */ - if (runtime->interpreters.mutex == NULL) { - runtime->interpreters.mutex = PyThread_allocate_lock(); - if (runtime->interpreters.mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); - } -#endif + _next_interp_id = 0; } PyInterpreterState * @@ -102,16 +92,16 @@ PyInterpreterState_New(void) PyMem_RawMalloc(sizeof(PyInterpreterState)); if (interp != NULL) { + HEAD_INIT(); +#ifdef WITH_THREAD + if (head_mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); +#endif interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; interp->builtins_copy = NULL; interp->tstate_head = NULL; - interp->check_interval = 100; - interp->warnoptions = NULL; - interp->xoptions = NULL; - interp->num_threads = 0; - interp->pythread_stacksize = 0; interp->codec_search_path = NULL; interp->codec_search_cache = NULL; interp->codec_error_registry = NULL; @@ -135,19 +125,19 @@ PyInterpreterState_New(void) #endif HEAD_LOCK(); - interp->next = _PyRuntime.interpreters.head; - if (_PyRuntime.interpreters.main == NULL) { - _PyRuntime.interpreters.main = interp; + interp->next = interp_head; + if (interp_main == NULL) { + interp_main = interp; } - _PyRuntime.interpreters.head = interp; - if (_PyRuntime.interpreters.next_id < 0) { + interp_head = interp; + if (_next_interp_id < 0) { /* overflow or Py_Initialize() not called! */ PyErr_SetString(PyExc_RuntimeError, "failed to get an interpreter ID"); interp = NULL; } else { - interp->id = _PyRuntime.interpreters.next_id; - _PyRuntime.interpreters.next_id += 1; + interp->id = _next_interp_id; + _next_interp_id += 1; } HEAD_UNLOCK(); } @@ -199,7 +189,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp) PyInterpreterState **p; zapthreads(interp); HEAD_LOCK(); - for (p = &_PyRuntime.interpreters.head; ; p = &(*p)->next) { + for (p = &interp_head; ; p = &(*p)->next) { if (*p == NULL) Py_FatalError( "PyInterpreterState_Delete: invalid interp"); @@ -209,13 +199,19 @@ PyInterpreterState_Delete(PyInterpreterState *interp) if (interp->tstate_head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining threads"); *p = interp->next; - if (_PyRuntime.interpreters.main == interp) { - _PyRuntime.interpreters.main = NULL; - if (_PyRuntime.interpreters.head != NULL) + if (interp_main == interp) { + interp_main = NULL; + if (interp_head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining subinterpreters"); } HEAD_UNLOCK(); PyMem_RawFree(interp); +#ifdef WITH_THREAD + if (interp_head == NULL && head_mutex != NULL) { + PyThread_free_lock(head_mutex); + head_mutex = NULL; + } +#endif } @@ -503,11 +499,8 @@ PyThreadState_Delete(PyThreadState *tstate) if (tstate == GET_TSTATE()) Py_FatalError("PyThreadState_Delete: tstate is still current"); #ifdef WITH_THREAD - if (_PyRuntime.gilstate.autoInterpreterState && - PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) - { - PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); - } + if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) + PyThread_delete_key_value(autoTLSkey); #endif /* WITH_THREAD */ tstate_delete_common(tstate); } @@ -522,11 +515,8 @@ PyThreadState_DeleteCurrent() Py_FatalError( "PyThreadState_DeleteCurrent: no current tstate"); tstate_delete_common(tstate); - if (_PyRuntime.gilstate.autoInterpreterState && - PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) - { - PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); - } + if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) + PyThread_delete_key_value(autoTLSkey); SET_TSTATE(NULL); PyEval_ReleaseLock(); } @@ -686,13 +676,13 @@ PyThreadState_SetAsyncExc(unsigned long id, PyObject *exc) PyInterpreterState * PyInterpreterState_Head(void) { - return _PyRuntime.interpreters.head; + return interp_head; } PyInterpreterState * PyInterpreterState_Main(void) { - return _PyRuntime.interpreters.main; + return interp_main; } PyInterpreterState * @@ -732,7 +722,7 @@ _PyThread_CurrentFrames(void) * need to grab head_mutex for the duration. */ HEAD_LOCK(); - for (i = _PyRuntime.interpreters.head; i != NULL; i = i->next) { + for (i = interp_head; i != NULL; i = i->next) { PyThreadState *t; for (t = i->tstate_head; t != NULL; t = t->next) { PyObject *id; @@ -784,11 +774,11 @@ void _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) { assert(i && t); /* must init with valid states */ - _PyRuntime.gilstate.autoTLSkey = PyThread_create_key(); - if (_PyRuntime.gilstate.autoTLSkey == -1) + autoTLSkey = PyThread_create_key(); + if (autoTLSkey == -1) Py_FatalError("Could not allocate TLS entry"); - _PyRuntime.gilstate.autoInterpreterState = i; - assert(PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL); + autoInterpreterState = i; + assert(PyThread_get_key_value(autoTLSkey) == NULL); assert(t->gilstate_counter == 0); _PyGILState_NoteThreadState(t); @@ -797,15 +787,15 @@ _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) PyInterpreterState * _PyGILState_GetInterpreterStateUnsafe(void) { - return _PyRuntime.gilstate.autoInterpreterState; + return autoInterpreterState; } void _PyGILState_Fini(void) { - PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); - _PyRuntime.gilstate.autoTLSkey = -1; - _PyRuntime.gilstate.autoInterpreterState = NULL; + PyThread_delete_key(autoTLSkey); + autoTLSkey = -1; + autoInterpreterState = NULL; } /* Reset the TLS key - called by PyOS_AfterFork_Child(). @@ -816,19 +806,17 @@ void _PyGILState_Reinit(void) { #ifdef WITH_THREAD - _PyRuntime.interpreters.mutex = PyThread_allocate_lock(); - if (_PyRuntime.interpreters.mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); + head_mutex = NULL; + HEAD_INIT(); #endif PyThreadState *tstate = PyGILState_GetThisThreadState(); - PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); - if ((_PyRuntime.gilstate.autoTLSkey = PyThread_create_key()) == -1) + PyThread_delete_key(autoTLSkey); + if ((autoTLSkey = PyThread_create_key()) == -1) Py_FatalError("Could not allocate TLS entry"); /* If the thread had an associated auto thread state, reassociate it with * the new key. */ - if (tstate && PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, - (void *)tstate) < 0) + if (tstate && PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) Py_FatalError("Couldn't create autoTLSkey mapping"); } @@ -843,7 +831,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) /* If autoTLSkey isn't initialized, this must be the very first threadstate created in Py_Initialize(). Don't do anything for now (we'll be back here when _PyGILState_Init is called). */ - if (!_PyRuntime.gilstate.autoInterpreterState) + if (!autoInterpreterState) return; /* Stick the thread state for this thread in thread local storage. @@ -858,13 +846,9 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) The first thread state created for that given OS level thread will "win", which seems reasonable behaviour. */ - if (PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL) { - if ((PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, - (void *)tstate) - ) < 0) - { + if (PyThread_get_key_value(autoTLSkey) == NULL) { + if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) Py_FatalError("Couldn't create autoTLSkey mapping"); - } } /* PyGILState_Release must not try to delete this thread state. */ @@ -875,10 +859,9 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) PyThreadState * PyGILState_GetThisThreadState(void) { - if (_PyRuntime.gilstate.autoInterpreterState == NULL) + if (autoInterpreterState == NULL) return NULL; - return (PyThreadState *)PyThread_get_key_value( - _PyRuntime.gilstate.autoTLSkey); + return (PyThreadState *)PyThread_get_key_value(autoTLSkey); } int @@ -889,7 +872,7 @@ PyGILState_Check(void) if (!_PyGILState_check_enabled) return 1; - if (_PyRuntime.gilstate.autoTLSkey == -1) + if (autoTLSkey == -1) return 1; tstate = GET_TSTATE(); @@ -909,10 +892,8 @@ PyGILState_Ensure(void) spells out other issues. Embedders are expected to have called Py_Initialize() and usually PyEval_InitThreads(). */ - /* Py_Initialize() hasn't been called! */ - assert(_PyRuntime.gilstate.autoInterpreterState); - tcur = (PyThreadState *)PyThread_get_key_value( - _PyRuntime.gilstate.autoTLSkey); + assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ + tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); if (tcur == NULL) { /* At startup, Python has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the first time, we need the create the @@ -920,7 +901,7 @@ PyGILState_Ensure(void) PyEval_InitThreads(); /* Create a new thread state for this thread */ - tcur = PyThreadState_New(_PyRuntime.gilstate.autoInterpreterState); + tcur = PyThreadState_New(autoInterpreterState); if (tcur == NULL) Py_FatalError("Couldn't create thread-state for new thread"); /* This is our thread state! We'll need to delete it in the @@ -945,7 +926,7 @@ void PyGILState_Release(PyGILState_STATE oldstate) { PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value( - _PyRuntime.gilstate.autoTLSkey); + autoTLSkey); if (tcur == NULL) Py_FatalError("auto-releasing thread-state, " "but no thread-state for this thread"); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 080c541c6df..852babbed78 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -519,6 +519,8 @@ Return the profiling function set with sys.setprofile.\n\ See the profiler chapter in the library manual." ); +static int _check_interval = 100; + static PyObject * sys_setcheckinterval(PyObject *self, PyObject *args) { @@ -527,8 +529,7 @@ sys_setcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.setswitchinterval() " "instead.", 1) < 0) return NULL; - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (!PyArg_ParseTuple(args, "i:setcheckinterval", &interp->check_interval)) + if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval)) return NULL; Py_RETURN_NONE; } @@ -548,8 +549,7 @@ sys_getcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.getswitchinterval() " "instead.", 1) < 0) return NULL; - PyInterpreterState *interp = PyThreadState_GET()->interp; - return PyLong_FromLong(interp->check_interval); + return PyLong_FromLong(_check_interval); } PyDoc_STRVAR(getcheckinterval_doc, @@ -1339,7 +1339,7 @@ Clear the internal type lookup cache."); static PyObject * sys_is_finalizing(PyObject* self, PyObject* args) { - return PyBool_FromLong(_Py_IS_FINALIZING()); + return PyBool_FromLong(_Py_Finalizing != NULL); } PyDoc_STRVAR(is_finalizing_doc, @@ -1479,24 +1479,11 @@ list_builtin_module_names(void) return list; } -static PyObject * -get_warnoptions(void) -{ - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; - if (warnoptions == NULL || !PyList_Check(warnoptions)) { - Py_XDECREF(warnoptions); - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return NULL; - PyThreadState_GET()->interp->warnoptions = warnoptions; - } - return warnoptions; -} +static PyObject *warnoptions = NULL; void PySys_ResetWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1505,9 +1492,12 @@ PySys_ResetWarnOptions(void) void PySys_AddWarnOptionUnicode(PyObject *unicode) { - PyObject *warnoptions = get_warnoptions(); - if (warnoptions == NULL) - return; + if (warnoptions == NULL || !PyList_Check(warnoptions)) { + Py_XDECREF(warnoptions); + warnoptions = PyList_New(0); + if (warnoptions == NULL) + return; + } PyList_Append(warnoptions, unicode); } @@ -1525,20 +1515,17 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } +static PyObject *xoptions = NULL; + static PyObject * get_xoptions(void) { - PyObject *xoptions = PyThreadState_GET()->interp->xoptions; if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); - if (xoptions == NULL) - return NULL; - PyThreadState_GET()->interp->xoptions = xoptions; } return xoptions; } @@ -2143,15 +2130,17 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - PyObject *warnoptions = get_warnoptions(); - if (warnoptions == NULL) - return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); + if (warnoptions == NULL) { + warnoptions = PyList_New(0); + if (warnoptions == NULL) + return -1; + } - PyObject *xoptions = get_xoptions(); - if (xoptions == NULL) - return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); + SET_SYS_FROM_STRING_INT_RESULT("warnoptions", + PyList_GetSlice(warnoptions, + 0, Py_SIZE(warnoptions))); + + SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", get_xoptions()); if (PyErr_Occurred()) return -1; diff --git a/Python/thread.c b/Python/thread.c index 6fd594fd301..4d2f2c32a19 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -76,6 +76,11 @@ PyThread_init_thread(void) PyThread__init_thread(); } +/* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ +static size_t _pythread_stacksize = 0; + #if defined(_POSIX_THREADS) # define PYTHREAD_NAME "pthread" # include "thread_pthread.h" @@ -91,7 +96,7 @@ PyThread_init_thread(void) size_t PyThread_get_stacksize(void) { - return PyThreadState_GET()->interp->pythread_stacksize; + return _pythread_stacksize; } /* Only platforms defining a THREAD_SET_STACKSIZE() macro diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 2f3a71b86ad..47eb4b6e94c 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -189,10 +189,9 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; obj->func = func; obj->arg = arg; - PyThreadState *tstate = PyThreadState_GET(); - size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; hThread = (HANDLE)_beginthreadex(0, - Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int), + Py_SAFE_DOWNCAST(_pythread_stacksize, + Py_ssize_t, unsigned int), bootstrap, obj, 0, &threadID); if (hThread == 0) { @@ -333,13 +332,13 @@ _pythread_nt_set_stacksize(size_t size) { /* set to default */ if (size == 0) { - PyThreadState_GET()->interp->pythread_stacksize = 0; + _pythread_stacksize = 0; return 0; } /* valid range? */ if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) { - PyThreadState_GET()->interp->pythread_stacksize = size; + _pythread_stacksize = size; return 0; } diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index ea05b6fbcfe..268dec41168 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -205,9 +205,8 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; #endif #if defined(THREAD_STACK_SIZE) - PyThreadState *tstate = PyThreadState_GET(); - size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; - tss = (stacksize != 0) ? stacksize : THREAD_STACK_SIZE; + tss = (_pythread_stacksize != 0) ? _pythread_stacksize + : THREAD_STACK_SIZE; if (tss != 0) { if (pthread_attr_setstacksize(&attrs, tss) != 0) { pthread_attr_destroy(&attrs); @@ -579,7 +578,7 @@ _pythread_pthread_set_stacksize(size_t size) /* set to default */ if (size == 0) { - PyThreadState_GET()->interp->pythread_stacksize = 0; + _pythread_stacksize = 0; return 0; } @@ -596,7 +595,7 @@ _pythread_pthread_set_stacksize(size_t size) rc = pthread_attr_setstacksize(&attrs, size); pthread_attr_destroy(&attrs); if (rc == 0) { - PyThreadState_GET()->interp->pythread_stacksize = size; + _pythread_stacksize = size; return 0; } } diff --git a/Tools/c-globals/README b/Tools/c-globals/README deleted file mode 100644 index d0e6e8eba06..00000000000 --- a/Tools/c-globals/README +++ /dev/null @@ -1,41 +0,0 @@ -####################################### -# C Globals and CPython Runtime State. - -CPython's C code makes extensive use of global variables. Each global -falls into one of several categories: - -* (effectively) constants (incl. static types) -* globals used exclusively in main or in the REPL -* freelists, caches, and counters -* process-global state -* module state -* Python runtime state - -The ignored-globals.txt file is organized similarly. Of the different -categories, the last two are problematic and generally should not exist -in the codebase. - -Globals that hold module state (i.e. in Modules/*.c) cause problems -when multiple interpreters are in use. For more info, see PEP 3121, -which addresses the situation for extension modules in general. - -Globals in the last category should be avoided as well. The problem -isn't with the Python runtime having state. Rather, the problem is with -that state being spread thoughout the codebase in dozens of individual -globals. Unlike the other globals, the runtime state represents a set -of values that are constantly shifting in a complex way. When they are -spread out it's harder to get a clear picture of what the runtime -involves. Furthermore, when they are spread out it complicates efforts -that change the runtime. - -Consequently, the globals for Python's runtime state have been -consolidated under a single top-level _PyRuntime global. No new globals -should be added for runtime state. Instead, they should be added to -_PyRuntimeState or one of its sub-structs. The check-c-globals script -should be run to ensure that no new globals have been added: - - python3 Tools/c-globals/check-c-globals.py - -If it reports any globals then they should be resolved. If the globals -are runtime state then they should be folded into _PyRuntimeState. -Otherwise they should be added to ignored-globals.txt. diff --git a/Tools/c-globals/check-c-globals.py b/Tools/c-globals/check-c-globals.py deleted file mode 100644 index 1de69a8751c..00000000000 --- a/Tools/c-globals/check-c-globals.py +++ /dev/null @@ -1,446 +0,0 @@ - -from collections import namedtuple -import glob -import os.path -import re -import shutil -import sys -import subprocess - - -VERBOSITY = 2 - -C_GLOBALS_DIR = os.path.abspath(os.path.dirname(__file__)) -TOOLS_DIR = os.path.dirname(C_GLOBALS_DIR) -ROOT_DIR = os.path.dirname(TOOLS_DIR) -GLOBALS_FILE = os.path.join(C_GLOBALS_DIR, 'ignored-globals.txt') - -SOURCE_DIRS = ['Include', 'Objects', 'Modules', 'Parser', 'Python'] - -CAPI_REGEX = re.compile(r'^ *PyAPI_DATA\([^)]*\) \W*(_?Py\w+(?:, \w+)*\w).*;.*$') - - -IGNORED_VARS = { - '_DYNAMIC', - '_GLOBAL_OFFSET_TABLE_', - '__JCR_LIST__', - '__JCR_END__', - '__TMC_END__', - '__bss_start', - '__data_start', - '__dso_handle', - '_edata', - '_end', - } - - -def find_capi_vars(root): - capi_vars = {} - for dirname in SOURCE_DIRS: - for filename in glob.glob(os.path.join(ROOT_DIR, dirname, '**/*.[hc]'), - recursive=True): - with open(filename) as file: - for name in _find_capi_vars(file): - if name in capi_vars: - assert not filename.endswith('.c') - assert capi_vars[name].endswith('.c') - capi_vars[name] = filename - return capi_vars - - -def _find_capi_vars(lines): - for line in lines: - if not line.startswith('PyAPI_DATA'): - continue - assert '{' not in line - match = CAPI_REGEX.match(line) - assert match - names, = match.groups() - for name in names.split(', '): - yield name - - -def _read_global_names(filename): - # These variables are shared between all interpreters in the process. - with open(filename) as file: - return {line.partition('#')[0].strip() - for line in file - if line.strip() and not line.startswith('#')} - - -def _is_global_var(name, globalnames): - if _is_autogen_var(name): - return True - if _is_type_var(name): - return True - if _is_module(name): - return True - if _is_exception(name): - return True - if _is_compiler(name): - return True - return name in globalnames - - -def _is_autogen_var(name): - return ( - name.startswith('PyId_') or - '.' in name or - # Objects/typeobject.c - name.startswith('op_id.') or - name.startswith('rop_id.') or - # Python/graminit.c - name.startswith('arcs_') or - name.startswith('states_') - ) - - -def _is_type_var(name): - if name.endswith(('Type', '_Type', '_type')): # XXX Always a static type? - return True - if name.endswith('_desc'): # for structseq types - return True - return ( - name.startswith('doc_') or - name.endswith(('_doc', '__doc__', '_docstring')) or - name.endswith('_methods') or - name.endswith('_fields') or - name.endswith(('_memberlist', '_members')) or - name.endswith('_slots') or - name.endswith(('_getset', '_getsets', '_getsetlist')) or - name.endswith('_as_mapping') or - name.endswith('_as_number') or - name.endswith('_as_sequence') or - name.endswith('_as_buffer') or - name.endswith('_as_async') - ) - - -def _is_module(name): - if name.endswith(('_functions', 'Methods', '_Methods')): - return True - if name == 'module_def': - return True - if name == 'initialized': - return True - return name.endswith(('module', '_Module')) - - -def _is_exception(name): - # Other vars are enumerated in globals-core.txt. - if not name.startswith(('PyExc_', '_PyExc_')): - return False - return name.endswith(('Error', 'Warning')) - - -def _is_compiler(name): - return ( - # Python/Pythyon-ast.c - name.endswith('_type') or - name.endswith('_singleton') or - name.endswith('_attributes') - ) - - -class Var(namedtuple('Var', 'name kind scope capi filename')): - - @classmethod - def parse_nm(cls, line, expected, ignored, capi_vars, globalnames): - _, _, line = line.partition(' ') # strip off the address - line = line.strip() - kind, _, line = line.partition(' ') - if kind in ignored or (): - return None - elif kind not in expected or (): - raise RuntimeError('unsupported NM type {!r}'.format(kind)) - - name, _, filename = line.partition('\t') - name = name.strip() - if _is_autogen_var(name): - return None - if _is_global_var(name, globalnames): - scope = 'global' - else: - scope = None - capi = (name in capi_vars or ()) - if filename: - filename = os.path.relpath(filename.partition(':')[0]) - return cls(name, kind, scope, capi, filename or '~???~') - - @property - def external(self): - return self.kind.isupper() - - -def find_vars(root, globals_filename=GLOBALS_FILE): - python = os.path.join(root, 'python') - if not os.path.exists(python): - raise RuntimeError('python binary missing (need to build it first?)') - capi_vars = find_capi_vars(root) - globalnames = _read_global_names(globals_filename) - - nm = shutil.which('nm') - if nm is None: - # XXX Use dumpbin.exe /SYMBOLS on Windows. - raise NotImplementedError - else: - yield from (var - for var in _find_var_symbols(python, nm, capi_vars, - globalnames) - if var.name not in IGNORED_VARS) - - -NM_FUNCS = set('Tt') -NM_PUBLIC_VARS = set('BD') -NM_PRIVATE_VARS = set('bd') -NM_VARS = NM_PUBLIC_VARS | NM_PRIVATE_VARS -NM_DATA = set('Rr') -NM_OTHER = set('ACGgiINpSsuUVvWw-?') -NM_IGNORED = NM_FUNCS | NM_DATA | NM_OTHER - - -def _find_var_symbols(python, nm, capi_vars, globalnames): - args = [nm, - '--line-numbers', - python] - out = subprocess.check_output(args) - for line in out.decode('utf-8').splitlines(): - var = Var.parse_nm(line, NM_VARS, NM_IGNORED, capi_vars, globalnames) - if var is None: - continue - yield var - - -####################################### - -class Filter(namedtuple('Filter', 'name op value action')): - - @classmethod - def parse(cls, raw): - action = '+' - if raw.startswith(('+', '-')): - action = raw[0] - raw = raw[1:] - # XXX Support < and >? - name, op, value = raw.partition('=') - return cls(name, op, value, action) - - def check(self, var): - value = getattr(var, self.name, None) - if not self.op: - matched = bool(value) - elif self.op == '=': - matched = (value == self.value) - else: - raise NotImplementedError - - if self.action == '+': - return matched - elif self.action == '-': - return not matched - else: - raise NotImplementedError - - -def filter_var(var, filters): - for filter in filters: - if not filter.check(var): - return False - return True - - -def make_sort_key(spec): - columns = [(col.strip('_'), '_' if col.startswith('_') else '') - for col in spec] - def sort_key(var): - return tuple(getattr(var, col).lstrip(prefix) - for col, prefix in columns) - return sort_key - - -def make_groups(allvars, spec): - group = spec - groups = {} - for var in allvars: - value = getattr(var, group) - key = '{}: {}'.format(group, value) - try: - groupvars = groups[key] - except KeyError: - groupvars = groups[key] = [] - groupvars.append(var) - return groups - - -def format_groups(groups, columns, fmts, widths): - for group in sorted(groups): - groupvars = groups[group] - yield '', 0 - yield ' # {}'.format(group), 0 - yield from format_vars(groupvars, columns, fmts, widths) - - -def format_vars(allvars, columns, fmts, widths): - fmt = ' '.join(fmts[col] for col in columns) - fmt = ' ' + fmt.replace(' ', ' ') + ' ' # for div margin - header = fmt.replace(':', ':^').format(*(col.upper() for col in columns)) - yield header, 0 - div = ' '.join('-'*(widths[col]+2) for col in columns) - yield div, 0 - for var in allvars: - values = (getattr(var, col) for col in columns) - row = fmt.format(*('X' if val is True else val or '' - for val in values)) - yield row, 1 - yield div, 0 - - -####################################### - -COLUMNS = 'name,external,capi,scope,filename' -COLUMN_NAMES = COLUMNS.split(',') - -COLUMN_WIDTHS = {col: len(col) - for col in COLUMN_NAMES} -COLUMN_WIDTHS.update({ - 'name': 50, - 'scope': 7, - 'filename': 40, - }) -COLUMN_FORMATS = {col: '{:%s}' % width - for col, width in COLUMN_WIDTHS.items()} -for col in COLUMN_FORMATS: - if COLUMN_WIDTHS[col] == len(col): - COLUMN_FORMATS[col] = COLUMN_FORMATS[col].replace(':', ':^') - - -def _parse_filters_arg(raw, error): - filters = [] - for value in raw.split(','): - value=value.strip() - if not value: - continue - try: - filter = Filter.parse(value) - if filter.name not in COLUMN_NAMES: - raise Exception('unsupported column {!r}'.format(filter.name)) - except Exception as e: - error('bad filter {!r}: {}'.format(raw, e)) - filters.append(filter) - return filters - - -def _parse_columns_arg(raw, error): - columns = raw.split(',') - for column in columns: - if column not in COLUMN_NAMES: - error('unsupported column {!r}'.format(column)) - return columns - - -def _parse_sort_arg(raw, error): - sort = raw.split(',') - for column in sort: - if column.lstrip('_') not in COLUMN_NAMES: - error('unsupported column {!r}'.format(column)) - return sort - - -def _parse_group_arg(raw, error): - if not raw: - return raw - group = raw - if group not in COLUMN_NAMES: - error('unsupported column {!r}'.format(group)) - if group != 'filename': - error('unsupported group {!r}'.format(group)) - return group - - -def parse_args(argv=None): - if argv is None: - argv = sys.argv[1:] - - import argparse - parser = argparse.ArgumentParser() - - parser.add_argument('-v', '--verbose', action='count', default=0) - parser.add_argument('-q', '--quiet', action='count', default=0) - - parser.add_argument('--filters', default='-scope', - help='[[-][=]] ...') - - parser.add_argument('--columns', default=COLUMNS, - help='a comma-separated list of columns to show') - parser.add_argument('--sort', default='filename,_name', - help='a comma-separated list of columns to sort') - parser.add_argument('--group', - help='group by the given column name (- to not group)') - - parser.add_argument('--rc-on-match', dest='rc', type=int) - - parser.add_argument('filename', nargs='?', default=GLOBALS_FILE) - - args = parser.parse_args(argv) - - verbose = vars(args).pop('verbose', 0) - quiet = vars(args).pop('quiet', 0) - args.verbosity = max(0, VERBOSITY + verbose - quiet) - - if args.sort.startswith('filename') and not args.group: - args.group = 'filename' - - if args.rc is None: - if '-scope=core' in args.filters or 'core' not in args.filters: - args.rc = 0 - else: - args.rc = 1 - - args.filters = _parse_filters_arg(args.filters, parser.error) - args.columns = _parse_columns_arg(args.columns, parser.error) - args.sort = _parse_sort_arg(args.sort, parser.error) - args.group = _parse_group_arg(args.group, parser.error) - - return args - - -def main(root=ROOT_DIR, filename=GLOBALS_FILE, - filters=None, columns=COLUMN_NAMES, sort=None, group=None, - verbosity=VERBOSITY, rc=1): - - log = lambda msg: ... - if verbosity >= 2: - log = lambda msg: print(msg) - - allvars = (var - for var in find_vars(root, filename) - if filter_var(var, filters)) - if sort: - allvars = sorted(allvars, key=make_sort_key(sort)) - - if group: - try: - columns.remove(group) - except ValueError: - pass - grouped = make_groups(allvars, group) - lines = format_groups(grouped, columns, COLUMN_FORMATS, COLUMN_WIDTHS) - else: - lines = format_vars(allvars, columns, COLUMN_FORMATS, COLUMN_WIDTHS) - - total = 0 - for line, count in lines: - total += count - log(line) - log('\ntotal: {}'.format(total)) - - if total and rc: - print('ERROR: found unsafe globals', file=sys.stderr) - return rc - return 0 - - -if __name__ == '__main__': - args = parse_args() - sys.exit( - main(**vars(args))) diff --git a/Tools/c-globals/ignored-globals.txt b/Tools/c-globals/ignored-globals.txt deleted file mode 100644 index 4fafba6eefa..00000000000 --- a/Tools/c-globals/ignored-globals.txt +++ /dev/null @@ -1,494 +0,0 @@ -# All variables declared here are shared between all interpreters -# in a single process. That means that they must not be changed -# unless that change should apply to all interpreters. -# -# See check-c-globals.py. -# -# Many generic names are handled via the script: -# -# * most exceptions and all warnings handled via _is_exception() -# * for builtin modules, generic names are handled via _is_module() -# * generic names for static types handled via _is_type_var() -# * AST vars handled via _is_compiler() - - -####################################### -# main - -# Modules/getpath.c -exec_prefix -module_search_path -prefix -progpath - -# Modules/main.c -orig_argc -orig_argv - -# Python/getopt.c -opt_ptr -_PyOS_optarg -_PyOS_opterr -_PyOS_optind - - -####################################### -# REPL - -# Parser/myreadline.c -PyOS_InputHook -PyOS_ReadlineFunctionPointer -_PyOS_ReadlineLock -_PyOS_ReadlineTState - - -####################################### -# state - -# Python/dtoa.c -p5s -pmem_next # very slight race -private_mem # very slight race - -# Python/import.c -# For the moment the import lock stays global. Ultimately there should -# be a global lock for extension modules and a per-interpreter lock. -import_lock -import_lock_level -import_lock_thread - -# Python/pylifecycle.c -_PyRuntime - - -#--------------------------------- -# module globals (PyObject) - -# Modules/_functoolsmodule.c -kwd_mark - -# Modules/_localemodule.c -Error - -# Modules/_threadmodule.c -ThreadError - -# Modules/_tracemalloc.c -unknown_filename - -# Modules/gcmodule.c -gc_str - -# Modules/posixmodule.c -billion -posix_putenv_garbage - -# Modules/signalmodule.c -DefaultHandler -IgnoreHandler -IntHandler -ItimerError - -# Modules/zipimport.c -ZipImportError -zip_directory_cache - - -#--------------------------------- -# module globals (other) - -# Modules/_tracemalloc.c -allocators -tables_lock -tracemalloc_config -tracemalloc_empty_traceback -tracemalloc_filenames -tracemalloc_peak_traced_memory -tracemalloc_reentrant_key -tracemalloc_traceback -tracemalloc_tracebacks -tracemalloc_traced_memory -tracemalloc_traces - -# Modules/faulthandler.c -fatal_error -faulthandler_handlers -old_stack -stack -thread -user_signals - -# Modules/posixmodule.c -posix_constants_confstr -posix_constants_pathconf -posix_constants_sysconf -_stat_float_times # deprecated, __main__-only -structseq_new -ticks_per_second - -# Modules/signalmodule.c -Handlers # main thread only -is_tripped # main thread only -main_pid -main_thread -old_siginthandler -wakeup_fd # main thread only - -# Modules/zipimport.c -zip_searchorder - -# Python/bltinmodule.c -Py_FileSystemDefaultEncodeErrors -Py_FileSystemDefaultEncoding -Py_HasFileSystemDefaultEncoding - -# Python/sysmodule.c -_PySys_ImplCacheTag -_PySys_ImplName - - -#--------------------------------- -# freelists - -# Modules/_collectionsmodule.c -freeblocks -numfreeblocks - -# Objects/classobject.c -free_list -numfree - -# Objects/dictobject.c -free_list -keys_free_list -numfree -numfreekeys - -# Objects/exceptions.c -memerrors_freelist -memerrors_numfree - -# Objects/floatobject.c -free_list -numfree - -# Objects/frameobject.c -free_list -numfree - -# Objects/genobject.c -ag_asend_freelist -ag_asend_freelist_free -ag_value_freelist -ag_value_freelist_free - -# Objects/listobject.c -free_list -numfree - -# Objects/methodobject.c -free_list -numfree - -# Objects/sliceobject.c -slice_cache # slight race - -# Objects/tupleobject.c -free_list -numfree - -# Python/dtoa.c -freelist # very slight race - - -#--------------------------------- -# caches (PyObject) - -# Objects/typeobject.c -method_cache # only for static types -next_version_tag # only for static types - -# Python/dynload_shlib.c -handles # slight race during import -nhandles # slight race during import - -# Python/import.c -extensions # slight race on init during import - - -#--------------------------------- -# caches (other) - -# Python/bootstrap_hash.c -urandom_cache - -# Python/modsupport.c -_Py_PackageContext # Slight race during import! Move to PyThreadState? - - -#--------------------------------- -# counters - -# Objects/bytesobject.c -null_strings -one_strings - -# Objects/dictobject.c -pydict_global_version - -# Objects/moduleobject.c -max_module_number # slight race during import - - -####################################### -# constants - -#--------------------------------- -# singletons - -# Objects/boolobject.c -_Py_FalseStruct -_Py_TrueStruct - -# Objects/object.c -_Py_NoneStruct -_Py_NotImplementedStruct - -# Objects/sliceobject.c -_Py_EllipsisObject - - -#--------------------------------- -# constants (other) - -# Modules/config.c -_PyImport_Inittab - -# Objects/bytearrayobject.c -_PyByteArray_empty_string - -# Objects/dictobject.c -empty_keys_struct -empty_values - -# Objects/floatobject.c -detected_double_format -detected_float_format -double_format -float_format - -# Objects/longobject.c -_PyLong_DigitValue - -# Objects/object.c -_Py_SwappedOp - -# Objects/obmalloc.c -_PyMem_Debug - -# Objects/setobject.c -_dummy_struct - -# Objects/structseq.c -PyStructSequence_UnnamedField - -# Objects/typeobject.c -name_op -slotdefs # almost -slotdefs_initialized # almost -subtype_getsets_dict_only -subtype_getsets_full -subtype_getsets_weakref_only -tp_new_methoddef - -# Objects/unicodeobject.c -bloom_linebreak -static_strings # slight race - -# Parser/tokenizer.c -_PyParser_TokenNames - -# Python/Python-ast.c -alias_fields - -# Python/codecs.c -Py_hexdigits -ucnhash_CAPI # slight performance-only race - -# Python/dynload_shlib.c -_PyImport_DynLoadFiletab - -# Python/fileutils.c -_Py_open_cloexec_works -force_ascii - -# Python/frozen.c -M___hello__ -PyImport_FrozenModules - -# Python/graminit.c -_PyParser_Grammar -dfas -labels - -# Python/import.c -PyImport_Inittab - -# Python/pylifecycle.c -_TARGET_LOCALES - - -#--------------------------------- -# initialized (PyObject) - -# Objects/bytesobject.c -characters -nullstring - -# Objects/exceptions.c -PyExc_RecursionErrorInst -errnomap - -# Objects/longobject.c -_PyLong_One -_PyLong_Zero -small_ints - -# Objects/setobject.c -emptyfrozenset - -# Objects/unicodeobject.c -interned # slight race on init in PyUnicode_InternInPlace() -unicode_empty -unicode_latin1 - - -#--------------------------------- -# initialized (other) - -# Python/getargs.c -static_arg_parsers - -# Python/pyhash.c -PyHash_Func -_Py_HashSecret -_Py_HashSecret_Initialized - -# Python/pylifecycle.c -_Py_StandardStreamEncoding -_Py_StandardStreamErrors -default_home -env_home -progname -Py_BytesWarningFlag -Py_DebugFlag -Py_DontWriteBytecodeFlag -Py_FrozenFlag -Py_HashRandomizationFlag -Py_IgnoreEnvironmentFlag -Py_InspectFlag -Py_InteractiveFlag -Py_IsolatedFlag -Py_NoSiteFlag -Py_NoUserSiteDirectory -Py_OptimizeFlag -Py_QuietFlag -Py_UnbufferedStdioFlag -Py_UseClassExceptionsFlag -Py_VerboseFlag - - -#--------------------------------- -# types - -# Modules/_threadmodule.c -Locktype -RLocktype -localdummytype -localtype - -# Objects/exceptions.c -PyExc_BaseException -PyExc_Exception -PyExc_GeneratorExit -PyExc_KeyboardInterrupt -PyExc_StopAsyncIteration -PyExc_StopIteration -PyExc_SystemExit -_PyExc_BaseException -_PyExc_Exception -_PyExc_GeneratorExit -_PyExc_KeyboardInterrupt -_PyExc_StopAsyncIteration -_PyExc_StopIteration -_PyExc_SystemExit - -# Objects/structseq.c -_struct_sequence_template - - -#--------------------------------- -# interned strings/bytes - -# Modules/_io/_iomodule.c -_PyIO_empty_bytes -_PyIO_empty_str -_PyIO_str_close -_PyIO_str_closed -_PyIO_str_decode -_PyIO_str_encode -_PyIO_str_fileno -_PyIO_str_flush -_PyIO_str_getstate -_PyIO_str_isatty -_PyIO_str_newlines -_PyIO_str_nl -_PyIO_str_read -_PyIO_str_read1 -_PyIO_str_readable -_PyIO_str_readall -_PyIO_str_readinto -_PyIO_str_readline -_PyIO_str_reset -_PyIO_str_seek -_PyIO_str_seekable -_PyIO_str_setstate -_PyIO_str_tell -_PyIO_str_truncate -_PyIO_str_writable -_PyIO_str_write - -# Modules/_threadmodule.c -str_dict - -# Objects/boolobject.c -false_str -true_str - -# Objects/listobject.c -indexerr - -# Python/symtable.c -__class__ -dictcomp -genexpr -lambda -listcomp -setcomp -top - -# Python/sysmodule.c -whatstrings - - -####################################### -# hacks - -# Objects/object.c -_Py_abstract_hack - -# Objects/setobject.c -_PySet_Dummy - -# Python/pylifecycle.c -_PyOS_mystrnicmp_hack From webhook-mailer at python.org Wed Sep 6 00:43:22 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 06 Sep 2017 04:43:22 -0000 Subject: [Python-checkins] [3.6] _pickle: Fix whichmodule() (GH-3358) (#3361) Message-ID: https://github.com/python/cpython/commit/c3c3062169fad11e0e74aa85ff1f3d69c0170d42 commit: c3c3062169fad11e0e74aa85ff1f3d69c0170d42 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-05T21:43:19-07:00 summary: [3.6] _pickle: Fix whichmodule() (GH-3358) (#3361) _PyUnicode_FromId() can return NULL: replace Py_INCREF() with Py_XINCREF(). Fix coverity report: CID 1417269. (cherry picked from commit af46eb8) files: M Modules/_pickle.c diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 920b46fc285..ef0a03b1079 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1705,7 +1705,7 @@ whichmodule(PyObject *global, PyObject *dotted_path) /* If no module is found, use __main__. */ module_name = _PyUnicode_FromId(&PyId___main__); - Py_INCREF(module_name); + Py_XINCREF(module_name); return module_name; } From webhook-mailer at python.org Wed Sep 6 00:43:49 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 06 Sep 2017 04:43:49 -0000 Subject: [Python-checkins] Stop test_xmlrpc from writing to sys.stderr (#3359) Message-ID: https://github.com/python/cpython/commit/3463ee3972e0d14351ee18bce60ecfbf7ac96772 commit: 3463ee3972e0d14351ee18bce60ecfbf7ac96772 branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T21:43:46-07:00 summary: Stop test_xmlrpc from writing to sys.stderr (#3359) One test case of test_xmlrpc uses HTTPServer with a subclass of BaseHTTPRequestHandler. The BaseRequestHandler class logs to sys.stderr by default. Override log_message() to not clobber test output. Signed-off-by: Christian Heimes files: M Lib/test/test_xmlrpc.py diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 74a46ba883a..a609eef503f 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -328,6 +328,10 @@ def do_POST(self): self.handled = True self.close_connection = False + def log_message(self, format, *args): + # don't clobber sys.stderr + pass + def run_server(): server.socket.settimeout(float(1)) # Don't hang if client fails server.handle_request() # First request and attempt at second From webhook-mailer at python.org Wed Sep 6 00:55:44 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 06 Sep 2017 04:55:44 -0000 Subject: [Python-checkins] bpo-29781: Fix SSLObject.version before handshake (#3364) Message-ID: https://github.com/python/cpython/commit/6877111648ac3e042ee5d0458cbeb65dd1a84b2d commit: 6877111648ac3e042ee5d0458cbeb65dd1a84b2d branch: master author: Christian Heimes committer: GitHub date: 2017-09-05T21:55:40-07:00 summary: bpo-29781: Fix SSLObject.version before handshake (#3364) SSLObject.version() now correctly returns None when handshake over BIO has not been performed yet. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index a8ffef0944f..16cad9de80b 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1746,6 +1746,7 @@ def test_bio_handshake(self): sslobj = ctx.wrap_bio(incoming, outgoing, False, 'localhost') self.assertIs(sslobj._sslobj.owner, sslobj) self.assertIsNone(sslobj.cipher()) + self.assertIsNone(sslobj.version()) self.assertIsNotNone(sslobj.shared_ciphers()) self.assertRaises(ValueError, sslobj.getpeercert) if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES: @@ -1753,6 +1754,7 @@ def test_bio_handshake(self): self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake) self.assertTrue(sslobj.cipher()) self.assertIsNotNone(sslobj.shared_ciphers()) + self.assertIsNotNone(sslobj.version()) self.assertTrue(sslobj.getpeercert()) if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES: self.assertTrue(sslobj.get_channel_binding('tls-unique')) diff --git a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst new file mode 100644 index 00000000000..b9106a5f744 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst @@ -0,0 +1,2 @@ +SSLObject.version() now correctly returns None when handshake over BIO has +not been performed yet. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b001bca99d9..2fa6bd28cdc 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1706,6 +1706,10 @@ _ssl__SSLSocket_version_impl(PySSLSocket *self) if (self->ssl == NULL) Py_RETURN_NONE; + if (!SSL_is_init_finished(self->ssl)) { + /* handshake not finished */ + Py_RETURN_NONE; + } version = SSL_get_version(self->ssl); if (!strcmp(version, "unknown")) Py_RETURN_NONE; From webhook-mailer at python.org Wed Sep 6 02:41:33 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Wed, 06 Sep 2017 06:41:33 -0000 Subject: [Python-checkins] bpo-31178: Avoid concatenating bytes with str in subprocess error (#3066) Message-ID: https://github.com/python/cpython/commit/3fc499bca18454b9f432b9b0106cab662bfeb549 commit: 3fc499bca18454b9f432b9b0106cab662bfeb549 branch: master author: Ammar Askar committer: Gregory P. Smith date: 2017-09-05T23:41:30-07:00 summary: bpo-31178: Avoid concatenating bytes with str in subprocess error (#3066) Avoid concatenating bytes with str in the typically rare subprocess error path (exec failed). Includes a mock based unittest to exercise the codepath. files: A Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst M Lib/subprocess.py M Lib/test/test_subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index bafb501fcf1..25e56984933 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1313,15 +1313,18 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) + # The encoding here should match the encoding + # written in by the subprocess implementations + # like _posixsubprocess + err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' - err_msg = (b'Bad exception data from child: ' + - repr(errpipe_data)) + err_msg = 'Bad exception data from child: {!r}'.format( + bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) - err_msg = err_msg.decode(errors="surrogatepass") if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index a0d3dcd069a..b7079b1d6d9 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1542,6 +1542,53 @@ def test_exception_bad_args_0(self): else: self.fail("Expected OSError: %s" % desired_exception) + # We mock the __del__ method for Popen in the next two tests + # because it does cleanup based on the pid returned by fork_exec + # along with issuing a resource warning if it still exists. Since + # we don't actually spawn a process in these tests we can forego + # the destructor. An alternative would be to set _child_created to + # False before the destructor is called but there is no easy way + # to do that + class PopenNoDestructor(subprocess.Popen): + def __del__(self): + pass + + @mock.patch("subprocess._posixsubprocess.fork_exec") + def test_exception_errpipe_normal(self, fork_exec): + """Test error passing done through errpipe_write in the good case""" + def proper_error(*args): + errpipe_write = args[13] + # Write the hex for the error code EISDIR: 'is a directory' + err_code = '{:x}'.format(errno.EISDIR).encode() + os.write(errpipe_write, b"OSError:" + err_code + b":") + return 0 + + fork_exec.side_effect = proper_error + + with self.assertRaises(IsADirectoryError): + self.PopenNoDestructor(["non_existent_command"]) + + @mock.patch("subprocess._posixsubprocess.fork_exec") + def test_exception_errpipe_bad_data(self, fork_exec): + """Test error passing done through errpipe_write where its not + in the expected format""" + error_data = b"\xFF\x00\xDE\xAD" + def bad_error(*args): + errpipe_write = args[13] + # Anything can be in the pipe, no assumptions should + # be made about its encoding, so we'll write some + # arbitrary hex bytes to test it out + os.write(errpipe_write, error_data) + return 0 + + fork_exec.side_effect = bad_error + + with self.assertRaises(subprocess.SubprocessError) as e: + self.PopenNoDestructor(["non_existent_command"]) + + self.assertIn(repr(error_data), str(e.exception)) + + def test_restore_signals(self): # Code coverage for both values of restore_signals to make sure it # at least does not blow up. diff --git a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst new file mode 100644 index 00000000000..df018e0c37e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst @@ -0,0 +1 @@ +Fix string concatenation bug in rare error path in the subprocess module From solipsis at pitrou.net Wed Sep 6 05:19:07 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 06 Sep 2017 09:19:07 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170906091906.123743.97DF93A635E9F64E@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogilwitN', '--timeout', '7200'] From webhook-mailer at python.org Wed Sep 6 07:31:13 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Wed, 06 Sep 2017 11:31:13 -0000 Subject: [Python-checkins] Revert "pytime: include winsock2, so we can have a complete timeval type (#3377)" (#3383) Message-ID: https://github.com/python/cpython/commit/bcaac8188b1a1e67d2cc155609f0f883f036df33 commit: bcaac8188b1a1e67d2cc155609f0f883f036df33 branch: master author: Antoine Pitrou committer: GitHub date: 2017-09-06T13:31:09+02:00 summary: Revert "pytime: include winsock2, so we can have a complete timeval type (#3377)" (#3383) This reverts commit 833860615bedfd2484ac0623d6f01ff0578ba09f, as it broke Windows builds. files: M Python/pytime.c diff --git a/Python/pytime.c b/Python/pytime.c index b7d6e84101d..8979adc2191 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -1,7 +1,6 @@ #include "Python.h" #ifdef MS_WINDOWS #include -#include /* struct timeval */ #endif #if defined(__APPLE__) From webhook-mailer at python.org Wed Sep 6 09:42:34 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 06 Sep 2017 13:42:34 -0000 Subject: [Python-checkins] [3.6] bpo-29781: Fix SSLObject.version before handshake (GH-3364) (#3381) Message-ID: https://github.com/python/cpython/commit/6da379bde345926e1f7318ead973767f4d791d3e commit: 6da379bde345926e1f7318ead973767f4d791d3e branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-06T06:42:30-07:00 summary: [3.6] bpo-29781: Fix SSLObject.version before handshake (GH-3364) (#3381) SSLObject.version() now correctly returns None when handshake over BIO has not been performed yet. Signed-off-by: Christian Heimes (cherry picked from commit 6877111) files: A Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 29d4b4083da..4191d9036e4 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1736,6 +1736,7 @@ def test_bio_handshake(self): sslobj = ctx.wrap_bio(incoming, outgoing, False, 'localhost') self.assertIs(sslobj._sslobj.owner, sslobj) self.assertIsNone(sslobj.cipher()) + self.assertIsNone(sslobj.version()) self.assertIsNotNone(sslobj.shared_ciphers()) self.assertRaises(ValueError, sslobj.getpeercert) if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES: @@ -1743,6 +1744,7 @@ def test_bio_handshake(self): self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake) self.assertTrue(sslobj.cipher()) self.assertIsNotNone(sslobj.shared_ciphers()) + self.assertIsNotNone(sslobj.version()) self.assertTrue(sslobj.getpeercert()) if 'tls-unique' in ssl.CHANNEL_BINDING_TYPES: self.assertTrue(sslobj.get_channel_binding('tls-unique')) diff --git a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst new file mode 100644 index 00000000000..b9106a5f744 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst @@ -0,0 +1,2 @@ +SSLObject.version() now correctly returns None when handshake over BIO has +not been performed yet. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b5eab0f1c4b..25fb8090f43 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1695,6 +1695,10 @@ _ssl__SSLSocket_version_impl(PySSLSocket *self) if (self->ssl == NULL) Py_RETURN_NONE; + if (!SSL_is_init_finished(self->ssl)) { + /* handshake not finished */ + Py_RETURN_NONE; + } version = SSL_get_version(self->ssl); if (!strcmp(version, "unknown")) Py_RETURN_NONE; From webhook-mailer at python.org Wed Sep 6 13:01:41 2017 From: webhook-mailer at python.org (Steve Dower) Date: Wed, 06 Sep 2017 17:01:41 -0000 Subject: [Python-checkins] bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (#3311) Message-ID: https://github.com/python/cpython/commit/5fcd5e64eec9ed67613b8fe7356fb8288151ceba commit: 5fcd5e64eec9ed67613b8fe7356fb8288151ceba branch: master author: Steve Dower committer: GitHub date: 2017-09-06T10:01:38-07:00 summary: bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (#3311) files: A Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst M .github/appveyor.yml M Doc/make.bat M Lib/distutils/command/bdist_wininst.py M PCbuild/pyproject.props M PCbuild/python.props M PCbuild/python.vcxproj M PCbuild/pythoncore.vcxproj M Tools/msi/exe/exe.wixproj M Tools/msi/exe/exe_files.wxs diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 6a79a621e09..98b32c977d1 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -14,6 +14,8 @@ test_script: - cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 --fail-env-changed -j0 environment: HOST_PYTHON: C:\Python36\python.exe +image: +- Visual Studio 2017 # Only trigger AppVeyor if actual code or its configuration changes only_commits: diff --git a/Doc/make.bat b/Doc/make.bat index b03372aade7..c43135d75be 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -16,8 +16,19 @@ if not defined SPHINXBUILD if defined PYTHON ( set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()" ) +if not defined BLURB if defined PYTHON ( + %PYTHON% -c "import blurb" > nul 2> nul + if errorlevel 1 ( + echo Installing blurb with %PYTHON% + %PYTHON% -m pip install blurb + if errorlevel 1 exit /B + ) + set BLURB=%PYTHON% -m blurb +) + if not defined PYTHON set PYTHON=py if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build +if not defined BLURB set BLURB=blurb if "%1" NEQ "htmlhelp" goto :skiphhcsearch if exist "%HTMLHELP%" goto :skiphhcsearch @@ -96,6 +107,19 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build +if exist ..\Misc\NEWS ( + echo.Copying Misc\NEWS to build\NEWS + copy ..\Misc\NEWS build\NEWS > nul +) else if exist ..\Misc\NEWS.D ( + if defined BLURB ( + echo.Merging Misc/NEWS with %BLURB% + %BLURB% merge -f build\NEWS + ) else ( + echo.No Misc/NEWS file and Blurb is not available. + exit /B 1 + ) +) + if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index d3e1d3af22c..6309c3e248c 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -318,26 +318,30 @@ def get_exe_bytes(self): # string compares seem wrong, but are what sysconfig.py itself uses if self.target_version and self.target_version < cur_version: if self.target_version < "2.4": - bv = 6.0 + bv = '6.0' elif self.target_version == "2.4": - bv = 7.1 + bv = '7.1' elif self.target_version == "2.5": - bv = 8.0 + bv = '8.0' elif self.target_version <= "3.2": - bv = 9.0 + bv = '9.0' elif self.target_version <= "3.4": - bv = 10.0 + bv = '10.0' else: - bv = 14.0 + bv = '14.0' else: # for current version - use authoritative check. try: from msvcrt import CRT_ASSEMBLY_VERSION except ImportError: # cross-building, so assume the latest version - bv = 14.0 + bv = '14.0' else: - bv = float('.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2])) + bv = '.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2]) + if bv == '14.11': + # v141 and v140 are binary compatible, + # so keep using the 14.0 stub. + bv = '14.0' # wininst-x.y.exe is in the same directory as this file @@ -353,7 +357,7 @@ def get_exe_bytes(self): else: sfix = '' - filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix)) + filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix)) f = open(filename, "rb") try: return f.read() diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst new file mode 100644 index 00000000000..065596fcc85 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst @@ -0,0 +1 @@ +Change to building with MSVC v141 (included with Visual Studio 2017) diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 6ab9b6533f2..aed8f34583b 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -147,8 +147,24 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses Targets="CleanAll" /> + + + <_PGCFiles Include="$(OutDir)instrumented\$(TargetName)!*.pgc" /> + <_PGDFile Include="$(OutDir)instrumented\$(TargetName).pgd" /> + <_CopyFiles Include="@(_PGCFiles);@(_PGDFile)" Condition="Exists(%(FullPath))" /> + + + + + + - $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot81)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A at InstallationFolder)\Bin\ diff --git a/PCbuild/python.props b/PCbuild/python.props index c81cd94fe40..c2baebc06c7 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -10,6 +10,7 @@ We set BasePlatformToolset for ICC's benefit, it's otherwise ignored. --> + v141 v140 v120 v110 @@ -39,6 +40,7 @@ $(BuildPath64) $(PySourcePath)PCBuild\$(ArchName)\ $(BuildPath)\ + $(BuildPath)instrumented\ $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index 2786ac2ebf7..ab9fb05adea 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -96,6 +96,7 @@ set PYTHONPATH=$(PySourcePath)Lib <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64 + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(VC_PGO_RunTime_Dir) != ''">@set PATH=%PATH%%3B$(VC_PGO_RunTime_Dir) <_Content>@rem This script invokes the most recently built Python with all arguments @rem passed through to the interpreter. This file is generated by the @rem build process and any changes *will* be thrown away by the next diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 8ebb22e0e2b..763540e1736 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -49,6 +49,7 @@ true + true @@ -429,7 +430,7 @@ - + diff --git a/Tools/msi/exe/exe.wixproj b/Tools/msi/exe/exe.wixproj index 50f6f882460..8eaf494c4d4 100644 --- a/Tools/msi/exe/exe.wixproj +++ b/Tools/msi/exe/exe.wixproj @@ -39,6 +39,28 @@ Overwrite="true" Lines="@(_LicenseFiles->'%(Content)')" /> - + + + + + + + + + + + + + + + + + @(HostPython) + $(HostPython.Remove($(HostPython.IndexOf(';')))) + + + + + \ No newline at end of file diff --git a/Tools/msi/exe/exe_files.wxs b/Tools/msi/exe/exe_files.wxs index e675c21c897..394b4de4735 100644 --- a/Tools/msi/exe/exe_files.wxs +++ b/Tools/msi/exe/exe_files.wxs @@ -6,7 +6,7 @@ - + From webhook-mailer at python.org Wed Sep 6 13:22:17 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Wed, 06 Sep 2017 17:22:17 -0000 Subject: [Python-checkins] [3.6] Stop test_xmlrpc from writing to sys.stderr (GH-3359) (#3380) Message-ID: https://github.com/python/cpython/commit/3aea3c298b510fffac0f33195c7380a19c60f4e2 commit: 3aea3c298b510fffac0f33195c7380a19c60f4e2 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2017-09-06T10:22:14-07:00 summary: [3.6] Stop test_xmlrpc from writing to sys.stderr (GH-3359) (#3380) One test case of test_xmlrpc uses HTTPServer with a subclass of BaseHTTPRequestHandler. The BaseRequestHandler class logs to sys.stderr by default. Override log_message() to not clobber test output. Signed-off-by: Christian Heimes (cherry picked from commit 3463ee3972e0d14351ee18bce60ecfbf7ac96772) files: M Lib/test/test_xmlrpc.py diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 30025e388dd..e98a3a7160f 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -328,6 +328,10 @@ def do_POST(self): self.handled = True self.close_connection = False + def log_message(self, format, *args): + # don't clobber sys.stderr + pass + def run_server(): server.socket.settimeout(float(1)) # Don't hang if client fails server.handle_request() # First request and attempt at second From webhook-mailer at python.org Wed Sep 6 14:15:42 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Wed, 06 Sep 2017 18:15:42 -0000 Subject: [Python-checkins] bpo-29505: Add fuzz tests for float(str), int(str), unicode(str) (#2878) Message-ID: https://github.com/python/cpython/commit/c5bace2bf7874cf47ef56e1d8d19f79ad892eef5 commit: c5bace2bf7874cf47ef56e1d8d19f79ad892eef5 branch: master author: Devin Jeanpierre committer: Gregory P. Smith date: 2017-09-06T11:15:35-07:00 summary: bpo-29505: Add fuzz tests for float(str), int(str), unicode(str) (#2878) Add basic fuzz tests for a few common builtin functions. This is an easy place to start, and these functions are probably safe. We'll want to add more fuzz tests later. Lets bootstrap using these. While the fuzz tests are included in CPython and compiled / tested on a very basic level inside CPython itself, the actual fuzzing happens as part of oss-fuzz (https://github.com/google/oss-fuzz). The reason to include the tests in CPython is to make sure that they're maintained as part of the CPython project, especially when (as some eventually will) they use internal implementation details in the test. (This will be necessary sometimes because e.g. the fuzz test should never enter Python's interpreter loop, whereas some APIs only expose themselves publicly as Python functions.) This particular set of changes is part of testing Python's builtins, tracked internally at Google by b/37562550. The _xxtestfuzz module that this change adds need not be shipped with binary distributions of Python. files: A Lib/test/test_xxtestfuzz.py A Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst A Modules/_xxtestfuzz/README.rst A Modules/_xxtestfuzz/_xxtestfuzz.c A Modules/_xxtestfuzz/fuzz_tests.txt A Modules/_xxtestfuzz/fuzzer.c M setup.py diff --git a/Lib/test/test_xxtestfuzz.py b/Lib/test/test_xxtestfuzz.py new file mode 100644 index 00000000000..532f5fe72aa --- /dev/null +++ b/Lib/test/test_xxtestfuzz.py @@ -0,0 +1,23 @@ +import faulthandler +import test.support +import unittest + +_xxtestfuzz = test.support.import_module('_xxtestfuzz') + + +class TestFuzzer(unittest.TestCase): + """To keep our https://github.com/google/oss-fuzz API working.""" + + def test_sample_input_smoke_test(self): + """This is only a regression test: Check that it doesn't crash.""" + _xxtestfuzz.run(b"") + _xxtestfuzz.run(b"\0") + _xxtestfuzz.run(b"{") + _xxtestfuzz.run(b" ") + _xxtestfuzz.run(b"x") + _xxtestfuzz.run(b"1") + + +if __name__ == "__main__": + faulthandler.enable() + unittest.main() diff --git a/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst b/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst new file mode 100644 index 00000000000..9a0fb16f9ee --- /dev/null +++ b/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst @@ -0,0 +1 @@ +Add fuzz tests for float(str), int(str), unicode(str); for oss-fuzz. diff --git a/Modules/_xxtestfuzz/README.rst b/Modules/_xxtestfuzz/README.rst new file mode 100644 index 00000000000..b48f3c89a42 --- /dev/null +++ b/Modules/_xxtestfuzz/README.rst @@ -0,0 +1,46 @@ +Fuzz Tests for CPython +====================== + +These fuzz tests are designed to be included in Google's `oss-fuzz`_ project. + +oss-fuzz works against a library exposing a function of the form +``int LLVMFuzzerTestOneInput(const uint8_t* data, size_t length)``. We provide +that library (``fuzzer.c``), and include a ``_fuzz`` module for testing with +some toy values -- no fuzzing occurs in Python's test suite. + +oss-fuzz will regularly pull from CPython, discover all the tests in +``fuzz_tests.txt``, and run them -- so adding a new test here means it will +automatically be run in oss-fuzz, while also being smoke-tested as part of +CPython's test suite. + +Adding a new fuzz test +---------------------- + +Add the test name on a new line in ``fuzz_tests.txt``. + +In ``fuzzer.c``, add a function to be run:: + + int $test_name (const char* data, size_t size) { + ... + return 0; + } + + +And invoke it from ``LLVMFuzzerTestOneInput``:: + + #if _Py_FUZZ_YES(fuzz_builtin_float) + rv |= _run_fuzz(data, size, fuzz_builtin_float); + #endif + +``LLVMFuzzerTestOneInput`` will run in oss-fuzz, with each test in +``fuzz_tests.txt`` run separately. + +What makes a good fuzz test +--------------------------- + +Libraries written in C that might handle untrusted data are worthwhile. The +more complex the logic (e.g. parsing), the more likely this is to be a useful +fuzz test. See the existing examples for reference, and refer to the +`oss-fuzz`_ docs. + +.. _oss-fuzz: https://github.com/google/oss-fuzz diff --git a/Modules/_xxtestfuzz/_xxtestfuzz.c b/Modules/_xxtestfuzz/_xxtestfuzz.c new file mode 100644 index 00000000000..781dd23500a --- /dev/null +++ b/Modules/_xxtestfuzz/_xxtestfuzz.c @@ -0,0 +1,53 @@ +#define PY_SSIZE_T_CLEAN +#include +#include +#include + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); + +static PyObject* _fuzz_run(PyObject* self, PyObject* args) { + const char* buf; + Py_ssize_t size; + if (!PyArg_ParseTuple(args, "s#", &buf, &size)) { + return NULL; + } + int rv = LLVMFuzzerTestOneInput((const uint8_t*)buf, size); + if (PyErr_Occurred()) { + return NULL; + } + if (rv != 0) { + // Nonzero return codes are reserved for future use. + PyErr_Format( + PyExc_RuntimeError, "Nonzero return code from fuzzer: %d", rv); + return NULL; + } + Py_RETURN_NONE; +} + +static PyMethodDef module_methods[] = { + {"run", (PyCFunction)_fuzz_run, METH_VARARGS, ""}, + {NULL}, +}; + +static struct PyModuleDef _fuzzmodule = { + PyModuleDef_HEAD_INIT, + "_fuzz", + NULL, + 0, + module_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC +PyInit__xxtestfuzz(void) +{ + PyObject *m = NULL; + + if ((m = PyModule_Create(&_fuzzmodule)) == NULL) { + return NULL; + } + return m; +} diff --git a/Modules/_xxtestfuzz/fuzz_tests.txt b/Modules/_xxtestfuzz/fuzz_tests.txt new file mode 100644 index 00000000000..2e53bfdc716 --- /dev/null +++ b/Modules/_xxtestfuzz/fuzz_tests.txt @@ -0,0 +1,3 @@ +fuzz_builtin_float +fuzz_builtin_int +fuzz_builtin_unicode diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c new file mode 100644 index 00000000000..36f721ee626 --- /dev/null +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -0,0 +1,120 @@ +/* A fuzz test for CPython. + + The only exposed function is LLVMFuzzerTestOneInput, which is called by + fuzzers and by the _fuzz module for smoke tests. + + To build exactly one fuzz test, as when running in oss-fuzz etc., + build with -D _Py_FUZZ_ONE and -D _Py_FUZZ_. e.g. to build + LLVMFuzzerTestOneInput to only run "fuzz_builtin_float", build this file with + -D _Py_FUZZ_ONE -D _Py_FUZZ_fuzz_builtin_float. + + See the source code for LLVMFuzzerTestOneInput for details. */ + +#include +#include +#include + +/* Fuzz PyFloat_FromString as a proxy for float(str). */ +static int fuzz_builtin_float(const char* data, size_t size) { + PyObject* s = PyBytes_FromStringAndSize(data, size); + if (s == NULL) return 0; + PyObject* f = PyFloat_FromString(s); + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_ValueError)) { + PyErr_Clear(); + } + + Py_XDECREF(f); + Py_DECREF(s); + return 0; +} + +/* Fuzz PyLong_FromUnicodeObject as a proxy for int(str). */ +static int fuzz_builtin_int(const char* data, size_t size) { + /* Pick a random valid base. (When the fuzzed function takes extra + parameters, it's somewhat normal to hash the input to generate those + parameters. We want to exercise all code paths, so we do so here.) */ + int base = _Py_HashBytes(data, size) % 37; + if (base == 1) { + // 1 is the only number between 0 and 36 that is not a valid base. + base = 0; + } + if (base == -1) { + return 0; // An error occurred, bail early. + } + if (base < 0) { + base = -base; + } + + PyObject* s = PyUnicode_FromStringAndSize(data, size); + if (s == NULL) { + if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { + PyErr_Clear(); + } + return 0; + } + PyObject* l = PyLong_FromUnicodeObject(s, base); + if (l == NULL && PyErr_ExceptionMatches(PyExc_ValueError)) { + PyErr_Clear(); + } + PyErr_Clear(); + Py_XDECREF(l); + Py_DECREF(s); + return 0; +} + +/* Fuzz PyUnicode_FromStringAndSize as a proxy for unicode(str). */ +static int fuzz_builtin_unicode(const char* data, size_t size) { + PyObject* s = PyUnicode_FromStringAndSize(data, size); + if (s == NULL && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { + PyErr_Clear(); + } + Py_XDECREF(s); + return 0; +} + +/* Run fuzzer and abort on failure. */ +static int _run_fuzz(const uint8_t *data, size_t size, int(*fuzzer)(const char* , size_t)) { + int rv = fuzzer((const char*) data, size); + if (PyErr_Occurred()) { + /* Fuzz tests should handle expected errors for themselves. + This is last-ditch check in case they didn't. */ + PyErr_Print(); + abort(); + } + /* Someday the return value might mean something, propagate it. */ + return rv; +} + +/* CPython generates a lot of leak warnings for whatever reason. */ +int __lsan_is_turned_off(void) { return 1; } + +/* Fuzz test interface. + This returns the bitwise or of all fuzz test's return values. + + All fuzz tests must return 0, as all nonzero return codes are reserved for + future use -- we propagate the return values for that future case. + (And we bitwise or when running multiple tests to verify that normally we + only return 0.) */ +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + if (!Py_IsInitialized()) { + /* LLVMFuzzerTestOneInput is called repeatedly from the same process, + with no separate initialization phase, sadly, so we need to + initialize CPython ourselves on the first run. */ + Py_InitializeEx(0); + } + + int rv = 0; + +#define _Py_FUZZ_YES(test_name) (defined(_Py_FUZZ_##test_name) || !defined(_Py_FUZZ_ONE)) +#if _Py_FUZZ_YES(fuzz_builtin_float) + rv |= _run_fuzz(data, size, fuzz_builtin_float); +#endif +#if _Py_FUZZ_YES(fuzz_builtin_int) + rv |= _run_fuzz(data, size, fuzz_builtin_int); +#endif +#if _Py_FUZZ_YES(fuzz_builtin_unicode) + rv |= _run_fuzz(data, size, fuzz_builtin_unicode); +#endif +#undef _Py_FUZZ_YES + return rv; +} diff --git a/setup.py b/setup.py index 36a52bc6aac..3c7c9049ed6 100644 --- a/setup.py +++ b/setup.py @@ -715,6 +715,12 @@ def detect_modules(self): # syslog daemon interface exts.append( Extension('syslog', ['syslogmodule.c']) ) + # Fuzz tests. + exts.append( Extension( + '_xxtestfuzz', + ['_xxtestfuzz/_xxtestfuzz.c', '_xxtestfuzz/fuzzer.c']) + ) + # # Here ends the simple stuff. From here on, modules need certain # libraries, are platform-specific, or present other surprises. From webhook-mailer at python.org Wed Sep 6 16:19:22 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Wed, 06 Sep 2017 20:19:22 -0000 Subject: [Python-checkins] bpo-30912: Don't check the content of ffi.h (GH-2687) Message-ID: https://github.com/python/cpython/commit/6d51b876121e472d4372496d609a26d7e3081c51 commit: 6d51b876121e472d4372496d609a26d7e3081c51 branch: master author: Shlomi Fish committer: Zachary Ware date: 2017-09-06T13:19:19-07:00 summary: bpo-30912: Don't check the content of ffi.h (GH-2687) Various platforms have various methods of handling multiarch libffi which probably won't match the previously looked-for defines. Now we just make sure that ffi.h is available. files: M setup.py diff --git a/setup.py b/setup.py index 3c7c9049ed6..79f96989a40 100644 --- a/setup.py +++ b/setup.py @@ -2021,16 +2021,9 @@ def detect_ctypes(self, inc_dirs, lib_dirs): ffi_inc = find_file('ffi.h', [], inc_dirs) if ffi_inc is not None: ffi_h = ffi_inc[0] + '/ffi.h' - with open(ffi_h) as f: - for line in f: - line = line.strip() - if line.startswith(('#define LIBFFI_H', - '#define ffi_wrapper_h')): - break - else: - ffi_inc = None - print('Header file {} does not define LIBFFI_H or ' - 'ffi_wrapper_h'.format(ffi_h)) + if not os.path.exists(ffi_h): + ffi_inc = None + print('Header file {} does not exist'.format(ffi_h)) ffi_lib = None if ffi_inc is not None: for lib_name in ('ffi', 'ffi_pic'): From webhook-mailer at python.org Wed Sep 6 16:34:20 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Wed, 06 Sep 2017 20:34:20 -0000 Subject: [Python-checkins] [3.6] bpo-31178: Avoid concatenating bytes with str in subprocess error (GH-3066) (#3388) Message-ID: https://github.com/python/cpython/commit/3bad1650a03fdc8cfdd4cce154e1b2c07e3e4fa0 commit: 3bad1650a03fdc8cfdd4cce154e1b2c07e3e4fa0 branch: 3.6 author: Gregory P. Smith committer: GitHub date: 2017-09-06T13:34:17-07:00 summary: [3.6] bpo-31178: Avoid concatenating bytes with str in subprocess error (GH-3066) (#3388) Avoid concatenating bytes with str in the typically rare subprocess error path (exec failed). Includes a mock based unittest to exercise the codepath. (cherry picked from commit 3fc499bca18454b9f432b9b0106cab662bfeb549) files: A Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst M Lib/subprocess.py M Lib/test/test_subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index d0132342462..575413d9870 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1314,15 +1314,18 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) + # The encoding here should match the encoding + # written in by the subprocess implementations + # like _posixsubprocess + err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' - err_msg = (b'Bad exception data from child: ' + - repr(errpipe_data)) + err_msg = 'Bad exception data from child: {!r}'.format( + bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) - err_msg = err_msg.decode(errors="surrogatepass") if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 83abe9d67f7..df3f7506a93 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1545,6 +1545,53 @@ def test_exception_bad_args_0(self): else: self.fail("Expected OSError: %s" % desired_exception) + # We mock the __del__ method for Popen in the next two tests + # because it does cleanup based on the pid returned by fork_exec + # along with issuing a resource warning if it still exists. Since + # we don't actually spawn a process in these tests we can forego + # the destructor. An alternative would be to set _child_created to + # False before the destructor is called but there is no easy way + # to do that + class PopenNoDestructor(subprocess.Popen): + def __del__(self): + pass + + @mock.patch("subprocess._posixsubprocess.fork_exec") + def test_exception_errpipe_normal(self, fork_exec): + """Test error passing done through errpipe_write in the good case""" + def proper_error(*args): + errpipe_write = args[13] + # Write the hex for the error code EISDIR: 'is a directory' + err_code = '{:x}'.format(errno.EISDIR).encode() + os.write(errpipe_write, b"OSError:" + err_code + b":") + return 0 + + fork_exec.side_effect = proper_error + + with self.assertRaises(IsADirectoryError): + self.PopenNoDestructor(["non_existent_command"]) + + @mock.patch("subprocess._posixsubprocess.fork_exec") + def test_exception_errpipe_bad_data(self, fork_exec): + """Test error passing done through errpipe_write where its not + in the expected format""" + error_data = b"\xFF\x00\xDE\xAD" + def bad_error(*args): + errpipe_write = args[13] + # Anything can be in the pipe, no assumptions should + # be made about its encoding, so we'll write some + # arbitrary hex bytes to test it out + os.write(errpipe_write, error_data) + return 0 + + fork_exec.side_effect = bad_error + + with self.assertRaises(subprocess.SubprocessError) as e: + self.PopenNoDestructor(["non_existent_command"]) + + self.assertIn(repr(error_data), str(e.exception)) + + def test_restore_signals(self): # Code coverage for both values of restore_signals to make sure it # at least does not blow up. diff --git a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst new file mode 100644 index 00000000000..df018e0c37e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst @@ -0,0 +1 @@ +Fix string concatenation bug in rare error path in the subprocess module From webhook-mailer at python.org Wed Sep 6 16:55:47 2017 From: webhook-mailer at python.org (Steve Dower) Date: Wed, 06 Sep 2017 20:55:47 -0000 Subject: [Python-checkins] Fixes Tix build by correcting the directories used by Tcl and Tk. (#3391) Message-ID: https://github.com/python/cpython/commit/5d578442ed5ba5025e465b384341cb8646ffd819 commit: 5d578442ed5ba5025e465b384341cb8646ffd819 branch: master author: Steve Dower committer: GitHub date: 2017-09-06T13:55:42-07:00 summary: Fixes Tix build by correcting the directories used by Tcl and Tk. (#3391) files: M PCbuild/tcl.vcxproj M PCbuild/tcltk.props M PCbuild/tk.vcxproj diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index c940ab186f7..4536cbc925b 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -53,7 +53,7 @@ msvcrt symbols,msvcrt - INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" + BUILDDIRTOP="$(BuildDirTop)" INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" WARNINGS="-W3 -wd4311 -wd4312" setlocal diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props index b913d34b0bd..cad52b8f022 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props @@ -36,6 +36,7 @@ Release Debug $(BuildDirTop)_$(TclMachine) + $(BuildDirTop)_VC13 $(BuildDirTop)_VC13 $(BuildDirTop)_VC12 $(BuildDirTop)_VC11 diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index a1b8b9e10e8..70b5459a081 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -54,7 +54,7 @@ msvcrt symbols,msvcrt - TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" + BUILDDIRTOP="$(BuildDirTop)" TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" WARNINGS="-W3 -wd4244 -wd4267 -wd4311 -wd4312 -wd4334" setlocal From webhook-mailer at python.org Wed Sep 6 17:29:08 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 06 Sep 2017 21:29:08 -0000 Subject: [Python-checkins] [3.6] bpo-30737: Update DevGuide links to new URL (GH-3228) (GH-3390) Message-ID: https://github.com/python/cpython/commit/98ceece8f4cd797ec28078b6247529f01549687d commit: 98ceece8f4cd797ec28078b6247529f01549687d branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-06T14:29:04-07:00 summary: [3.6] bpo-30737: Update DevGuide links to new URL (GH-3228) (GH-3390) Update old devguide links from https://docs.python.org/devguide to https://devguide.python.org (cherry picked from commit 384899dfaeb83db38a6d3846d3cbc2f58a6605cd) files: M Doc/README.rst M Doc/bugs.rst M Doc/faq/general.rst M Doc/howto/curses.rst M Doc/using/unix.rst M Doc/using/windows.rst M Doc/whatsnew/2.6.rst M Doc/whatsnew/3.4.rst M Grammar/Grammar M Mac/README M Misc/ACKS M Misc/Porting M Misc/python.man M README.rst diff --git a/Doc/README.rst b/Doc/README.rst index dcd3d6e80ff..9156e7df672 100644 --- a/Doc/README.rst +++ b/Doc/README.rst @@ -7,7 +7,7 @@ available `_. Documentation on authoring Python documentation, including information about both style and markup, is available in the "`Documenting Python -`_" chapter of the +`_" chapter of the developers guide. @@ -109,10 +109,10 @@ see the make targets above). Contributing ============ -Bugs in the content should be reported to the +Bugs in the content should be reported to the `Python bug tracker `_. -Bugs in the toolset should be reported in the +Bugs in the toolset should be reported in the `Sphinx bug tracker `_. You can also send a mail to the Python Documentation Team at docs at python.org, diff --git a/Doc/bugs.rst b/Doc/bugs.rst index 1b0a5a9a937..bc1d10f379c 100644 --- a/Doc/bugs.rst +++ b/Doc/bugs.rst @@ -88,5 +88,5 @@ the `core-mentorship mailing list`_ is a friendly place to get answers to any and all questions pertaining to the process of fixing issues in Python. .. _Documentation bugs: https://bugs.python.org/issue?@filter=status&@filter=components&components=4&status=1&@columns=id,activity,title,status&@sort=-activity -.. _Python Developer's Guide: https://docs.python.org/devguide/ +.. _Python Developer's Guide: https://devguide.python.org/ .. _core-mentorship mailing list: https://mail.python.org/mailman/listinfo/core-mentorship/ diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst index 8f6a907a8a2..d4a97fd81af 100644 --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -167,7 +167,7 @@ several useful pieces of freely distributable software. The source will compile and run out of the box on most UNIX platforms. Consult the `Getting Started section of the Python Developer's Guide -`__ for more +`__ for more information on getting the source code and compiling it. @@ -223,7 +223,7 @@ newsgroups and on the Python home page at https://www.python.org/; an RSS feed o news is available. You can also access the development version of Python through Git. See -`The Python Developer's Guide `_ for details. +`The Python Developer's Guide `_ for details. How do I submit bug reports and patches for Python? @@ -239,7 +239,7 @@ report bugs to Python, you can obtain your Roundup password through Roundup's `password reset procedure `_. For more information on how Python is developed, consult `the Python Developer's -Guide `_. +Guide `_. Are there any published articles about Python that I can reference? diff --git a/Doc/howto/curses.rst b/Doc/howto/curses.rst index cbff84160ff..1d3bfb87dc0 100644 --- a/Doc/howto/curses.rst +++ b/Doc/howto/curses.rst @@ -538,7 +538,7 @@ the Python interface. Often this isn't because they're difficult to implement, but because no one has needed them yet. Also, Python doesn't yet support the menu library associated with ncurses. Patches adding support for these would be welcome; see -`the Python Developer's Guide `_ to +`the Python Developer's Guide `_ to learn more about submitting patches to Python. * `Writing Programs with NCURSES `_: diff --git a/Doc/using/unix.rst b/Doc/using/unix.rst index 604688ce94c..8b96ebea396 100644 --- a/Doc/using/unix.rst +++ b/Doc/using/unix.rst @@ -67,7 +67,7 @@ Building Python If you want to compile CPython yourself, first thing you should do is get the `source `_. You can download either the latest release's source or just grab a fresh `clone -`_. (If you want +`_. (If you want to contribute patches, you will need a clone.) The build process consists in the usual :: @@ -140,4 +140,4 @@ Many editors and IDEs provide syntax highlighting, debugging tools, and PEP-8 ch Please go to `Python Editors `_ and `Integrated Development Environments `_ -for a comprehensive list. \ No newline at end of file +for a comprehensive list. diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 68687e9f3ec..3d47d7c5154 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -896,7 +896,7 @@ Compiling Python on Windows If you want to compile CPython yourself, first thing you should do is get the `source `_. You can download either the latest release's source or just grab a fresh `checkout -`_. +`_. The source tree contains a build solution and project files for Microsoft Visual Studio 2015, which is the compiler used to build the official Python diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index cc2fa3dcfa5..45b0ab9f345 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -232,7 +232,7 @@ have adopted Sphinx as their documentation tool. .. seealso:: - `Documenting Python `__ + `Documenting Python `__ Describes how to write for Python's documentation. `Sphinx `__ diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 72398f9250f..65971700c8b 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -1960,7 +1960,7 @@ Other Improvements ``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.) * A new ``make`` target `coverage-report - `_ + `_ will build python, run the test suite, and generate an HTML coverage report for the C codebase using ``gcov`` and `lcov `_. @@ -2176,7 +2176,7 @@ The following obsolete and previously deprecated APIs and features have been removed: * The unmaintained ``Misc/TextMate`` and ``Misc/vim`` directories have been - removed (see the `devguide `_ + removed (see the `devguide `_ for suggestions on what to use instead). * The ``SO`` makefile macro is removed (it was replaced by the diff --git a/Grammar/Grammar b/Grammar/Grammar index 59c807ef0c8..90582434bee 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -1,7 +1,7 @@ # Grammar for Python # NOTE WELL: You should also follow all the steps listed at -# https://docs.python.org/devguide/grammar.html +# https://devguide.python.org/grammar/ # Start symbols for the grammar: # single_input is a single interactive statement; diff --git a/Mac/README b/Mac/README index 07f09fa8366..d4194747ebb 100644 --- a/Mac/README +++ b/Mac/README @@ -98,7 +98,7 @@ In general, universal builds depend on specific features provided by the Apple-supplied compilers and other build tools included in Apple's Xcode development tools. You should install Xcode and the command line tools component appropriate for the OS X release you are running on. See the -Python Developer's Guide (http://docs.python.org/devguide/setup.html) +Python Developer's Guide (https://devguide.python.org/setup/) for more information. 2.1 Flavors of universal binaries @@ -355,4 +355,4 @@ Resources * http://www.python.org/community/sigs/current/pythonmac-sig/ - * http://docs.python.org/devguide/ \ No newline at end of file + * https://devguide.python.org/ diff --git a/Misc/ACKS b/Misc/ACKS index a67eb0a557e..3b246c1eea0 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -620,6 +620,7 @@ Thomas Herve Bernhard Herzog Magnus L. Hetland Raymond Hettinger +Lisa Hewus Fresh Kevan Heydon Wouter van Heyst Kelsey Hightower diff --git a/Misc/Porting b/Misc/Porting index c43b1129788..f16c4600521 100644 --- a/Misc/Porting +++ b/Misc/Porting @@ -1 +1 @@ -This document is moved to https://docs.python.org/devguide/faq.html#how-do-i-port-python-to-a-new-platform +This document is moved to https://devguide.python.org/porting/ diff --git a/Misc/python.man b/Misc/python.man index 385b6546c8a..075b974e904 100644 --- a/Misc/python.man +++ b/Misc/python.man @@ -438,7 +438,7 @@ Main website: https://www.python.org/ .br Documentation: https://docs.python.org/ .br -Developer resources: https://docs.python.org/devguide/ +Developer resources: https://devguide.python.org/ .br Downloads: https://www.python.org/downloads/ .br diff --git a/README.rst b/README.rst index 4cbffcdb756..82d61f7a2e2 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ General Information - Source code: https://github.com/python/cpython - Issue tracker: https://bugs.python.org - Documentation: https://docs.python.org -- Developer's Guide: https://docs.python.org/devguide/ +- Developer's Guide: https://devguide.python.org/ Contributing to CPython ----------------------- @@ -34,7 +34,7 @@ Contributing to CPython For more complete instructions on contributing to CPython development, see the `Developer Guide`_. -.. _Developer Guide: https://docs.python.org/devguide/ +.. _Developer Guide: https://devguide.python.org/ Using Python ------------ From webhook-mailer at python.org Wed Sep 6 18:00:29 2017 From: webhook-mailer at python.org (Steve Dower) Date: Wed, 06 Sep 2017 22:00:29 -0000 Subject: [Python-checkins] [3.6] Fixes Tix build by correcting the directories used by Tcl and Tk. (GH-3391) (#3392) Message-ID: https://github.com/python/cpython/commit/34c67614c170a79bbe168ed2f3df5556c34f162b commit: 34c67614c170a79bbe168ed2f3df5556c34f162b branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Steve Dower date: 2017-09-06T15:00:26-07:00 summary: [3.6] Fixes Tix build by correcting the directories used by Tcl and Tk. (GH-3391) (#3392) files: M PCbuild/tcl.vcxproj M PCbuild/tcltk.props M PCbuild/tk.vcxproj diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index 3dfd155810f..28b9270e946 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -63,7 +63,7 @@ msvcrt symbols,msvcrt - INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" + BUILDDIRTOP="$(BuildDirTop)" INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" setlocal @(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props index 57bb98aeebe..4261073bcb8 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props @@ -37,6 +37,7 @@ Release Debug $(BuildDirTop)_$(TclMachine) + $(BuildDirTop)_VC13 $(BuildDirTop)_VC13 $(BuildDirTop)_VC12 $(BuildDirTop)_VC11 diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index a26318bbe78..747a8ff6241 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -62,7 +62,7 @@ msvcrt symbols,msvcrt - TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" + BUILDDIRTOP="$(BuildDirTop)" TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" setlocal @(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' From webhook-mailer at python.org Wed Sep 6 18:18:13 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 06 Sep 2017 22:18:13 -0000 Subject: [Python-checkins] bpo-27584: New addition of vSockets to the python socket module (#2489) Message-ID: https://github.com/python/cpython/commit/effc12f8e9e20d0951d2ba5883587666bd8218e3 commit: effc12f8e9e20d0951d2ba5883587666bd8218e3 branch: master author: caavery committer: Christian Heimes date: 2017-09-06T15:18:10-07:00 summary: bpo-27584: New addition of vSockets to the python socket module (#2489) * bpo-27584: New addition of vSockets to the python socket module Support for AF_VSOCK on Linux only * bpo-27584: Fixes for V2 Fixed syntax and naming problems. Fixed #ifdef AF_VSOCK checking Restored original aclocal.m4 * bpo-27584: Fixes for V3 Added checking for fcntl and thread modules. * bpo-27584: Fixes for V4 Fixed white space error * bpo-27584: Fixes for V5 Added back comma in (CID, port). * bpo-27584: Fixes for V6 Added news file. socket.rst now reflects first Linux introduction of AF_VSOCK. Fixed get_cid in test_socket.py. Replaced PyLong_FromLong with PyLong_FromUnsignedLong in socketmodule.c Got rid of extra AF_VSOCK #define. Added sockaddr_vm to sock_addr. * bpo-27584: Fixes for V7 Minor cleanup. * bpo-27584: Fixes for V8 Put back #undef AF_VSOCK as it is necessary when vm_sockets.h is not installed. files: A Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst M Doc/library/socket.rst M Lib/test/test_socket.py M Misc/ACKS M Modules/socketmodule.c M Modules/socketmodule.h M configure M configure.ac M pyconfig.h.in diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index c5064e92c21..42fd7ea0f0b 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -153,6 +153,14 @@ created. Socket addresses are represented as follows: .. versionadded:: 3.6 +- :const:`AF_VSOCK` allows communication between virtual machines and + their hosts. The sockets are represented as a ``(CID, port)`` tuple + where the context ID or CID and port are integers. + + Availability: Linux >= 4.8 QEMU >= 2.8 ESX >= 4.0 ESX Workstation >= 6.5 + + .. versionadded:: 3.7 + - Certain other address families (:const:`AF_PACKET`, :const:`AF_CAN`) support specific representations. @@ -395,6 +403,18 @@ Constants .. versionadded:: 3.6 + +.. data:: AF_VSOCK + IOCTL_VM_SOCKETS_GET_LOCAL_CID + VMADDR* + SO_VM* + + Constants for Linux host/guest communication. + + Availability: Linux >= 4.8. + + .. versionadded:: 3.7 + .. data:: AF_LINK Availability: BSD, OSX. diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 84234887747..50016ab615a 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -33,6 +33,8 @@ HOST = support.HOST MSG = 'Michael Gilfix was here\u1234\r\n'.encode('utf-8') ## test unicode string and carriage return +VSOCKPORT = 1234 + try: import _thread as thread import threading @@ -44,6 +46,16 @@ except ImportError: _socket = None +def get_cid(): + if fcntl is None: + return None + try: + with open("/dev/vsock", "rb") as f: + r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ") + except OSError: + return None + else: + return struct.unpack("I", r)[0] def _have_socket_can(): """Check whether CAN sockets are supported on this host.""" @@ -85,6 +97,11 @@ def _have_socket_alg(): s.close() return True +def _have_socket_vsock(): + """Check whether AF_VSOCK sockets are supported on this host.""" + ret = get_cid() is not None + return ret + HAVE_SOCKET_CAN = _have_socket_can() HAVE_SOCKET_CAN_ISOTP = _have_socket_can_isotp() @@ -93,6 +110,8 @@ def _have_socket_alg(): HAVE_SOCKET_ALG = _have_socket_alg() +HAVE_SOCKET_VSOCK = _have_socket_vsock() + # Size in bytes of the int type SIZEOF_INT = array.array("i").itemsize @@ -387,6 +406,42 @@ def clientTearDown(self): self.cli = None ThreadableTest.clientTearDown(self) + at unittest.skipIf(fcntl is None, "need fcntl") + at unittest.skipUnless(thread, 'Threading required for this test.') + at unittest.skipUnless(HAVE_SOCKET_VSOCK, + 'VSOCK sockets required for this test.') + at unittest.skipUnless(get_cid() != 2, + "This test can only be run on a virtual guest.") +class ThreadedVSOCKSocketStreamTest(unittest.TestCase, ThreadableTest): + + def __init__(self, methodName='runTest'): + unittest.TestCase.__init__(self, methodName=methodName) + ThreadableTest.__init__(self) + + def setUp(self): + self.serv = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) + self.addCleanup(self.serv.close) + self.serv.bind((socket.VMADDR_CID_ANY, VSOCKPORT)) + self.serv.listen() + self.serverExplicitReady() + self.conn, self.connaddr = self.serv.accept() + self.addCleanup(self.conn.close) + + def clientSetUp(self): + time.sleep(0.1) + self.cli = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) + self.addCleanup(self.cli.close) + cid = get_cid() + self.cli.connect((cid, VSOCKPORT)) + + def testStream(self): + msg = self.conn.recv(1024) + self.assertEqual(msg, MSG) + + def _testStream(self): + self.cli.send(MSG) + self.cli.close() + class SocketConnectedTest(ThreadedTCPSocketTest): """Socket tests for client-server connection. @@ -1874,6 +1929,54 @@ def _testCongestion(self): self.assertIn(self.serv, r) + at unittest.skipIf(fcntl is None, "need fcntl") + at unittest.skipUnless(HAVE_SOCKET_VSOCK, + 'VSOCK sockets required for this test.') +class BasicVSOCKTest(unittest.TestCase): + + def testCrucialConstants(self): + socket.AF_VSOCK + + def testVSOCKConstants(self): + socket.SO_VM_SOCKETS_BUFFER_SIZE + socket.SO_VM_SOCKETS_BUFFER_MIN_SIZE + socket.SO_VM_SOCKETS_BUFFER_MAX_SIZE + socket.VMADDR_CID_ANY + socket.VMADDR_PORT_ANY + socket.VMADDR_CID_HOST + socket.VM_SOCKETS_INVALID_VERSION + socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID + + def testCreateSocket(self): + with socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) as s: + pass + + def testSocketBufferSize(self): + with socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) as s: + orig_max = s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MAX_SIZE) + orig = s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_SIZE) + orig_min = s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MIN_SIZE) + + s.setsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MAX_SIZE, orig_max * 2) + s.setsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_SIZE, orig * 2) + s.setsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MIN_SIZE, orig_min * 2) + + self.assertEqual(orig_max * 2, + s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MAX_SIZE)) + self.assertEqual(orig * 2, + s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_SIZE)) + self.assertEqual(orig_min * 2, + s.getsockopt(socket.AF_VSOCK, + socket.SO_VM_SOCKETS_BUFFER_MIN_SIZE)) + @unittest.skipUnless(thread, 'Threading required for this test.') class BasicTCPTest(SocketConnectedTest): @@ -5682,6 +5785,10 @@ def test_main(): tests.extend([BasicRDSTest, RDSTest]) tests.append(LinuxKernelCryptoAPI) tests.extend([ + BasicVSOCKTest, + ThreadedVSOCKSocketStreamTest, + ]) + tests.extend([ CmsgMacroTests, SendmsgUDPTest, RecvmsgUDPTest, diff --git a/Misc/ACKS b/Misc/ACKS index e1127bcc72b..eadc5d34c40 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -65,6 +65,7 @@ David Ascher Ammar Askar Chris AtLee Aymeric Augustin +Cathy Avery John Aycock Donovan Baarda Arne Babenhauserheide diff --git a/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst b/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst new file mode 100644 index 00000000000..af4c583e186 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst @@ -0,0 +1,2 @@ +``AF_VSOCK`` has been added to the socket interface which allows +communication between virtual machines and their host. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 37626e67cb0..a431e254d57 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1225,6 +1225,14 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto) } #endif /* AF_NETLINK */ +#if defined(AF_VSOCK) + case AF_VSOCK: + { + struct sockaddr_vm *a = (struct sockaddr_vm *) addr; + return Py_BuildValue("II", a->svm_cid, a->svm_port); + } +#endif /* AF_VSOCK */ + #ifdef ENABLE_IPV6 case AF_INET6: { @@ -1586,6 +1594,32 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, } #endif +#if defined(AF_VSOCK) + case AF_VSOCK: + { + struct sockaddr_vm* addr; + int port, cid; + addr = (struct sockaddr_vm *)addr_ret; + memset(addr, 0, sizeof(struct sockaddr_vm)); + if (!PyTuple_Check(args)) { + PyErr_Format( + PyExc_TypeError, + "getsockaddrarg: " + "AF_VSOCK address must be tuple, not %.500s", + Py_TYPE(args)->tp_name); + return 0; + } + if (!PyArg_ParseTuple(args, "II:getsockaddrarg", &cid, &port)) + return 0; + addr->svm_family = s->sock_family; + addr->svm_port = port; + addr->svm_cid = cid; + *len_ret = sizeof(*addr); + return 1; + } +#endif + + #ifdef AF_RDS case AF_RDS: /* RDS sockets use sockaddr_in: fall-through */ @@ -2103,6 +2137,14 @@ getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret) } #endif +#if defined(AF_VSOCK) + case AF_VSOCK: + { + *len_ret = sizeof (struct sockaddr_vm); + return 1; + } +#endif + #ifdef AF_RDS case AF_RDS: /* RDS sockets use sockaddr_in: fall-through */ @@ -2598,6 +2640,21 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args) unsigned int optlen; PyObject *none; +#ifdef AF_VSOCK + if (s->sock_family == AF_VSOCK) { + uint64_t vflag; // Must be set width of 64 bits + /* setsockopt(level, opt, flag) */ + if (PyArg_ParseTuple(args, "iiK:setsockopt", + &level, &optname, &vflag)) { + // level should always be set to AF_VSOCK + res = setsockopt(s->sock_fd, level, optname, + (void*)&vflag, sizeof vflag); + goto done; + } + return NULL; + } +#endif + /* setsockopt(level, opt, flag) */ if (PyArg_ParseTuple(args, "iii:setsockopt", &level, &optname, &flag)) { @@ -2668,20 +2725,39 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args) int res; PyObject *buf; socklen_t buflen = 0; + int flag = 0; + socklen_t flagsize; if (!PyArg_ParseTuple(args, "ii|i:getsockopt", &level, &optname, &buflen)) return NULL; if (buflen == 0) { - int flag = 0; - socklen_t flagsize = sizeof flag; +#ifdef AF_VSOCK + if (s->sock_family == AF_VSOCK) { + uint64_t vflag = 0; // Must be set width of 64 bits + flagsize = sizeof vflag; + res = getsockopt(s->sock_fd, level, optname, + (void *)&vflag, &flagsize); + if (res < 0) + return s->errorhandler(); + return PyLong_FromUnsignedLong(vflag); + } +#endif + flagsize = sizeof flag; res = getsockopt(s->sock_fd, level, optname, (void *)&flag, &flagsize); if (res < 0) return s->errorhandler(); return PyLong_FromLong(flag); } +#ifdef AF_VSOCK + if (s->sock_family == AF_VSOCK) { + PyErr_SetString(PyExc_OSError, + "getsockopt string buffer not allowed"); + return NULL; + } +#endif if (buflen <= 0 || buflen > 1024) { PyErr_SetString(PyExc_OSError, "getsockopt buflen out of range"); @@ -6645,6 +6721,19 @@ PyInit__socket(void) PyModule_AddIntMacro(m, NETLINK_CRYPTO); #endif #endif /* AF_NETLINK */ + +#ifdef AF_VSOCK + PyModule_AddIntConstant(m, "AF_VSOCK", AF_VSOCK); + PyModule_AddIntConstant(m, "SO_VM_SOCKETS_BUFFER_SIZE", 0); + PyModule_AddIntConstant(m, "SO_VM_SOCKETS_BUFFER_MIN_SIZE", 1); + PyModule_AddIntConstant(m, "SO_VM_SOCKETS_BUFFER_MAX_SIZE", 2); + PyModule_AddIntConstant(m, "VMADDR_CID_ANY", 0xffffffff); + PyModule_AddIntConstant(m, "VMADDR_PORT_ANY", 0xffffffff); + PyModule_AddIntConstant(m, "VMADDR_CID_HOST", 2); + PyModule_AddIntConstant(m, "VM_SOCKETS_INVALID_VERSION", 0xffffffff); + PyModule_AddIntConstant(m, "IOCTL_VM_SOCKETS_GET_LOCAL_CID", _IO(7, 0xb9)); +#endif + #ifdef AF_ROUTE /* Alias to emulate 4.4BSD */ PyModule_AddIntMacro(m, AF_ROUTE); diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 03f982b9108..03dbf18f7bd 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -107,6 +107,12 @@ typedef int socklen_t; #define SOL_ALG 279 #endif +#ifdef HAVE_LINUX_VM_SOCKETS_H +# include +#else +# undef AF_VSOCK +#endif + /* Linux 3.19 */ #ifndef ALG_SET_AEAD_ASSOCLEN #define ALG_SET_AEAD_ASSOCLEN 4 @@ -193,6 +199,9 @@ typedef union sock_addr { #ifdef HAVE_SOCKADDR_ALG struct sockaddr_alg alg; #endif +#ifdef AF_VSOCK + struct sockaddr_vm vm; +#endif } sock_addr_t; /* The object holding a socket. It holds some extra information, diff --git a/configure b/configure index 3880421dba1..75d64324e6b 100755 --- a/configure +++ b/configure @@ -8088,6 +8088,24 @@ fi done +for ac_header in linux/vm_sockets.h +do : + ac_fn_c_check_header_compile "$LINENO" "linux/vm_sockets.h" "ac_cv_header_linux_vm_sockets_h" " +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +" +if test "x$ac_cv_header_linux_vm_sockets_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINUX_VM_SOCKETS_H 1 +_ACEOF + +fi + +done + + # On Linux, can.h and can/raw.h require sys/socket.h for ac_header in linux/can.h linux/can/raw.h linux/can/bcm.h do : diff --git a/configure.ac b/configure.ac index 3bf01386d66..00d5abaaaed 100644 --- a/configure.ac +++ b/configure.ac @@ -2097,6 +2097,12 @@ AC_CHECK_HEADERS(linux/netlink.h,,,[ #endif ]) +AC_CHECK_HEADERS(linux/vm_sockets.h,,,[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]) + # On Linux, can.h and can/raw.h require sys/socket.h AC_CHECK_HEADERS(linux/can.h linux/can/raw.h linux/can/bcm.h,,,[ #ifdef HAVE_SYS_SOCKET_H diff --git a/pyconfig.h.in b/pyconfig.h.in index 69033ef9e2e..1356eb58ab4 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -574,6 +574,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TIPC_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VM_SOCKETS_H + /* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ #undef HAVE_LOCKF From webhook-mailer at python.org Wed Sep 6 18:31:39 2017 From: webhook-mailer at python.org (R. David Murray) Date: Wed, 06 Sep 2017 22:31:39 -0000 Subject: [Python-checkins] [2.7] bpo-30824: Add mimetype for .json (GH-3048) (#3394) Message-ID: https://github.com/python/cpython/commit/47e5f791223773dd46273153e9fa5b48f848f0c9 commit: 47e5f791223773dd46273153e9fa5b48f848f0c9 branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: R. David Murray date: 2017-09-06T18:31:36-04:00 summary: [2.7] bpo-30824: Add mimetype for .json (GH-3048) (#3394) (cherry picked from commit 8204b903683f9e0f037ccfaa87622716019914d7) files: M Lib/mimetypes.py diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 157d455521d..caecc11c37c 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -442,6 +442,7 @@ def _default_mime_types(): '.jpeg' : 'image/jpeg', '.jpg' : 'image/jpeg', '.js' : 'application/javascript', + '.json' : 'application/json', '.ksh' : 'text/plain', '.latex' : 'application/x-latex', '.m1v' : 'video/mpeg', From webhook-mailer at python.org Wed Sep 6 18:45:28 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Wed, 06 Sep 2017 22:45:28 -0000 Subject: [Python-checkins] Remove all mention of Windows IA-64 support (GH-3389) Message-ID: https://github.com/python/cpython/commit/49ce74efe845a8a91939ff3990a5f233262d3e1f commit: 49ce74efe845a8a91939ff3990a5f233262d3e1f branch: master author: Zachary Ware committer: GitHub date: 2017-09-06T15:45:25-07:00 summary: Remove all mention of Windows IA-64 support (GH-3389) It was mostly removed long ago. files: M Doc/distutils/apiref.rst M Doc/distutils/builtdist.rst M Doc/library/sysconfig.rst M Lib/distutils/command/build_ext.py M Lib/distutils/msvc9compiler.py M Lib/distutils/msvccompiler.py M Lib/distutils/tests/test_util.py M Lib/distutils/util.py M Lib/msilib/__init__.py M Lib/sysconfig.py M Lib/test/test_sysconfig.py M PC/config.c M PC/pyconfig.h diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 622c7d1708f..7cde1a0701e 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -814,13 +814,13 @@ This module provides the :class:`UnixCCompiler` class, a subclass of .. module:: distutils.msvccompiler :synopsis: Microsoft Compiler +.. XXX: This is *waaaaay* out of date! This module provides :class:`MSVCCompiler`, an implementation of the abstract :class:`CCompiler` class for Microsoft Visual Studio. Typically, extension modules need to be compiled with the same compiler that was used to compile Python. For Python 2.3 and earlier, the compiler was Visual Studio 6. For Python -2.4 and 2.5, the compiler is Visual Studio .NET 2003. The AMD64 and Itanium -binaries are created using the Platform SDK. +2.4 and 2.5, the compiler is Visual Studio .NET 2003. :class:`MSVCCompiler` will normally choose the right compiler, linker etc. on its own. To override this choice, the environment variables *DISTUTILS_USE_SDK* diff --git a/Doc/distutils/builtdist.rst b/Doc/distutils/builtdist.rst index bbd2a8ce831..dc3a50cb032 100644 --- a/Doc/distutils/builtdist.rst +++ b/Doc/distutils/builtdist.rst @@ -351,8 +351,8 @@ installed, you can use a 32bit version of Windows to create 64bit extensions and vice-versa. To build for an alternate platform, specify the :option:`!--plat-name` option -to the build command. Valid values are currently 'win32', 'win-amd64' and -'win-ia64'. For example, on a 32bit version of Windows, you could execute:: +to the build command. Valid values are currently 'win32', and 'win-amd64'. +For example, on a 32bit version of Windows, you could execute:: python setup.py build --plat-name=win-amd64 diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 84f56463a11..9f549fbc513 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -186,7 +186,6 @@ Other functions Windows will return one of: - win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - - win-ia64 (64bit Windows on Itanium) - win32 (all others - specifically, sys.platform is returned) Mac OS X can return: diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 9155626a471..74445655621 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -208,7 +208,7 @@ def finalize_options(self): if self.plat_name == 'win32': suffix = 'win32' else: - # win-amd64 or win-ia64 + # win-amd64 suffix = self.plat_name[4:] new_lib = os.path.join(sys.exec_prefix, 'PCbuild') if suffix: diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index c401ddc86eb..4c0036a0f13 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -55,7 +55,6 @@ PLAT_TO_VCVARS = { 'win32' : 'x86', 'win-amd64' : 'amd64', - 'win-ia64' : 'ia64', } class Reg: @@ -344,7 +343,7 @@ def initialize(self, plat_name=None): if plat_name is None: plat_name = get_platform() # sanity check for platforms to prevent obscure errors later. - ok_plats = 'win32', 'win-amd64', 'win-ia64' + ok_plats = 'win32', 'win-amd64' if plat_name not in ok_plats: raise DistutilsPlatformError("--plat-name must be one of %s" % (ok_plats,)) @@ -362,7 +361,6 @@ def initialize(self, plat_name=None): # to cross compile, you use 'x86_amd64'. # On AMD64, 'vcvars32.bat amd64' is a native build env; to cross # compile use 'x86' (ie, it runs the x86 compiler directly) - # No idea how itanium handles this, if at all. if plat_name == get_platform() or plat_name == 'win32': # native build or cross-compile to win32 plat_spec = PLAT_TO_VCVARS[plat_name] diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 1048cd41593..d1de2fbfcb9 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -172,7 +172,7 @@ def get_build_version(): def get_build_architecture(): """Return the processor architecture. - Possible results are "Intel", "Itanium", or "AMD64". + Possible results are "Intel" or "AMD64". """ prefix = " bit (" diff --git a/Lib/distutils/tests/test_util.py b/Lib/distutils/tests/test_util.py index 4e9d79b7c6c..e2fc3809587 100644 --- a/Lib/distutils/tests/test_util.py +++ b/Lib/distutils/tests/test_util.py @@ -78,13 +78,6 @@ def test_get_platform(self): sys.platform = 'win32' self.assertEqual(get_platform(), 'win-amd64') - # windows XP, itanium - os.name = 'nt' - sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) ' - '[MSC v.1310 32 bit (Itanium)]') - sys.platform = 'win32' - self.assertEqual(get_platform(), 'win-ia64') - # macbook os.name = 'posix' sys.version = ('2.5 (r25:51918, Sep 19 2006, 08:49:13) ' diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py index b8a69114c8f..9394c1e0564 100644 --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -30,24 +30,14 @@ def get_platform (): Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name == 'nt': - # sniff sys.version for architecture. - prefix = " bit (" - i = sys.version.find(prefix) - if i == -1: - return sys.platform - j = sys.version.find(")", i) - look = sys.version[i+len(prefix):j].lower() - if look == 'amd64': + if 'amd64' in sys.version.lower(): return 'win-amd64' - if look == 'itanium': - return 'win-ia64' return sys.platform # Set for cross builds explicitly diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py index f0370c2a0fe..7ab8bcc52c6 100644 --- a/Lib/msilib/__init__.py +++ b/Lib/msilib/__init__.py @@ -8,8 +8,6 @@ import sys AMD64 = "AMD64" in sys.version -Itanium = "Itanium" in sys.version -Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -150,9 +148,7 @@ def init_database(name, schema, si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Itanium: - si.SetProperty(PID_TEMPLATE, "Intel64;1033") - elif AMD64: + if AMD64: si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") @@ -272,7 +268,7 @@ def start_component(self, component = None, feature = None, flags = None, keyfil if component is None: component = self.logical self.component = component - if Win64: + if AMD64: flags |= 256 if keyfile: keyid = self.cab.gen_id(self.absolute, keyfile) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index fc3e03b2a2d..8dfe1a714d5 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -611,24 +611,14 @@ def get_platform(): Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name == 'nt': - # sniff sys.version for architecture. - prefix = " bit (" - i = sys.version.find(prefix) - if i == -1: - return sys.platform - j = sys.version.find(")", i) - look = sys.version[i+len(prefix):j].lower() - if look == 'amd64': + if 'amd64' in sys.version.lower(): return 'win-amd64' - if look == 'itanium': - return 'win-ia64' return sys.platform if os.name != "posix" or not hasattr(os, 'uname'): diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 694435f56c3..20252be0a41 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -119,13 +119,6 @@ def test_get_platform(self): sys.platform = 'win32' self.assertEqual(get_platform(), 'win-amd64') - # windows XP, itanium - os.name = 'nt' - sys.version = ('2.4.4 (#71, Oct 18 2006, 08:34:43) ' - '[MSC v.1310 32 bit (Itanium)]') - sys.platform = 'win32' - self.assertEqual(get_platform(), 'win-ia64') - # macbook os.name = 'posix' sys.version = ('2.5 (r25:51918, Sep 19 2006, 08:49:13) ' diff --git a/PC/config.c b/PC/config.c index 43d9e208cca..f5aa332a5c6 100644 --- a/PC/config.c +++ b/PC/config.c @@ -6,9 +6,7 @@ #include "Python.h" extern PyObject* PyInit_array(void); -#ifndef MS_WINI64 extern PyObject* PyInit_audioop(void); -#endif extern PyObject* PyInit_binascii(void); extern PyObject* PyInit_cmath(void); extern PyObject* PyInit_errno(void); @@ -80,11 +78,7 @@ struct _inittab _PyImport_Inittab[] = { {"array", PyInit_array}, {"_ast", PyInit__ast}, -#ifdef MS_WINDOWS -#ifndef MS_WINI64 {"audioop", PyInit_audioop}, -#endif -#endif {"binascii", PyInit_binascii}, {"cmath", PyInit_cmath}, {"errno", PyInit_errno}, diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 46ff6f0fe56..0da68418cc0 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -112,8 +112,6 @@ WIN32 is still required for the locale module. defined on Win32 *and* Win64. Win32 only code must therefore be guarded as follows: #if defined(MS_WIN32) && !defined(MS_WIN64) - Some modules are disabled on Itanium processors, therefore we - have MS_WINI64 set for those targets, otherwise MS_WINX64 */ #ifdef _WIN64 #define MS_WIN64 @@ -121,17 +119,12 @@ WIN32 is still required for the locale module. /* set the COMPILER */ #ifdef MS_WIN64 -#if defined(_M_IA64) -#define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") -#define MS_WINI64 -#define PYD_PLATFORM_TAG "win_ia64" -#elif defined(_M_X64) || defined(_M_AMD64) +#if defined(_M_X64) || defined(_M_AMD64) #if defined(__INTEL_COMPILER) #define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]") #else #define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") #endif /* __INTEL_COMPILER */ -#define MS_WINX64 #define PYD_PLATFORM_TAG "win_amd64" #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") From webhook-mailer at python.org Wed Sep 6 18:55:34 2017 From: webhook-mailer at python.org (Steve Dower) Date: Wed, 06 Sep 2017 22:55:34 -0000 Subject: [Python-checkins] [3.6] bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (GH-3311) (#3386) Message-ID: https://github.com/python/cpython/commit/fd645ec6f5696e841e6d49075f9fd81e54e74d91 commit: fd645ec6f5696e841e6d49075f9fd81e54e74d91 branch: 3.6 author: Steve Dower committer: GitHub date: 2017-09-06T15:55:25-07:00 summary: [3.6] bpo-31340: Change to building with MSVC v141 (included with Visual Studio 2017) (GH-3311) (#3386) files: A Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst M .github/appveyor.yml M Doc/make.bat M Lib/distutils/command/bdist_wininst.py M PCbuild/build.bat M PCbuild/find_msbuild.bat M PCbuild/pyproject.props M PCbuild/python.props M PCbuild/python.vcxproj M PCbuild/pythoncore.vcxproj M Tools/msi/exe/exe.wixproj M Tools/msi/exe/exe_files.wxs diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 0936469370e..96674ce84d8 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -14,6 +14,9 @@ test_script: - cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 environment: HOST_PYTHON: C:\Python36\python.exe +image: +- Visual Studio 2015 +- Visual Studio 2017 # Only trigger AppVeyor if actual code or its configuration changes only_commits: diff --git a/Doc/make.bat b/Doc/make.bat index b9e8a759c51..0472a3de82f 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -6,18 +6,29 @@ pushd %~dp0 set this=%~n0 call ..\PCBuild\find_python.bat %PYTHON% -if "%SPHINXBUILD%" EQU "" if "%PYTHON%" NEQ "" ( - set SPHINXBUILD=%PYTHON%\..\Scripts\sphinx-build.exe - rem Cannot use %SPHINXBUILD% in the same block where we set it - if not exist "%PYTHON%\..\Scripts\sphinx-build.exe" ( +if not defined SPHINXBUILD if defined PYTHON ( + %PYTHON% -c "import sphinx" > nul 2> nul + if errorlevel 1 ( echo Installing sphinx with %PYTHON% - "%PYTHON%" -m pip install sphinx + %PYTHON% -m pip install sphinx if errorlevel 1 exit /B ) + set SPHINXBUILD=%PYTHON% -c "import sphinx, sys; sys.argv[0] = 'sphinx-build'; sphinx.main()" ) -if "%PYTHON%" EQU "" set PYTHON=py -if "%SPHINXBUILD%" EQU "" set SPHINXBUILD=sphinx-build +if not defined BLURB if defined PYTHON ( + %PYTHON% -c "import blurb" > nul 2> nul + if errorlevel 1 ( + echo Installing blurb with %PYTHON% + %PYTHON% -m pip install blurb + if errorlevel 1 exit /B + ) + set BLURB=%PYTHON% -m blurb +) + +if not defined PYTHON set PYTHON=py +if not defined SPHINXBUILD set SPHINXBUILD=sphinx-build +if not defined BLURB set BLURB=blurb if "%1" NEQ "htmlhelp" goto :skiphhcsearch if exist "%HTMLHELP%" goto :skiphhcsearch @@ -96,6 +107,19 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build +if exist ..\Misc\NEWS ( + echo.Copying Misc\NEWS to build\NEWS + copy ..\Misc\NEWS build\NEWS > nul +) else if exist ..\Misc\NEWS.D ( + if defined BLURB ( + echo.Merging Misc/NEWS with %BLURB% + %BLURB% merge -f build\NEWS + ) else ( + echo.No Misc/NEWS file and Blurb is not available. + exit /B 1 + ) +) + if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index d3e1d3af22c..6309c3e248c 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -318,26 +318,30 @@ def get_exe_bytes(self): # string compares seem wrong, but are what sysconfig.py itself uses if self.target_version and self.target_version < cur_version: if self.target_version < "2.4": - bv = 6.0 + bv = '6.0' elif self.target_version == "2.4": - bv = 7.1 + bv = '7.1' elif self.target_version == "2.5": - bv = 8.0 + bv = '8.0' elif self.target_version <= "3.2": - bv = 9.0 + bv = '9.0' elif self.target_version <= "3.4": - bv = 10.0 + bv = '10.0' else: - bv = 14.0 + bv = '14.0' else: # for current version - use authoritative check. try: from msvcrt import CRT_ASSEMBLY_VERSION except ImportError: # cross-building, so assume the latest version - bv = 14.0 + bv = '14.0' else: - bv = float('.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2])) + bv = '.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2]) + if bv == '14.11': + # v141 and v140 are binary compatible, + # so keep using the 14.0 stub. + bv = '14.0' # wininst-x.y.exe is in the same directory as this file @@ -353,7 +357,7 @@ def get_exe_bytes(self): else: sfix = '' - filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix)) + filename = os.path.join(directory, "wininst-%s%s.exe" % (bv, sfix)) f = open(filename, "rb") try: return f.read() diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst new file mode 100644 index 00000000000..065596fcc85 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst @@ -0,0 +1 @@ +Change to building with MSVC v141 (included with Visual Studio 2017) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 81e500d5544..2e6b0a94bb5 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -104,7 +104,7 @@ if "%kill%"=="true" call :Kill if "%do_pgo%"=="true" ( set conf=PGInstrument - call :Build + call :Build %1 %2 %3 %4 %5 %6 %7 %8 %9 del /s "%dir%\*.pgc" del /s "%dir%\..\Lib\*.pyc" echo on diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat index 1877906e00a..2b7413fbcde 100644 --- a/PCbuild/find_msbuild.bat +++ b/PCbuild/find_msbuild.bat @@ -29,20 +29,21 @@ @where msbuild > "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc" @if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found - at rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. - at reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul - at if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( - @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") -) - at if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found - @rem VS 2015 and earlier register MSBuild separately, so we can find it. + at rem Prefer MSBuild 14.0 over MSBuild 15.0, since the latter may not be able to find a VC14 install. @reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32 >nul 2>nul @if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32') DO @( @if "%%i"=="MSBuildToolsPath" @if exist "%%k\msbuild.exe" @(set MSBUILD="%%k\msbuild.exe") ) @if exist %MSBUILD% (set _Py_MSBuild_Source=registry) & goto :found + at rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. + at reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul + at if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( + @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") +) + at if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found + @exit /b 1 diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index 7012170e0c7..3d46a0fcba8 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -147,13 +147,28 @@ foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses Targets="CleanAll" /> + + + <_PGCFiles Include="$(OutDir)instrumented\$(TargetName)!*.pgc" /> + <_PGDFile Include="$(OutDir)instrumented\$(TargetName).pgd" /> + <_CopyFiles Include="@(_PGCFiles);@(_PGDFile)" Condition="Exists(%(FullPath))" /> + + + + + + - $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\$(DefaultWindowsSDKVersion)\x86 + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot10)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot81)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots at KitsRoot)\bin\x86 $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A at InstallationFolder)\Bin\ - <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" - <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe" + <_SignCommand Condition="Exists($(SdkBinPath)) and '$(SigningCertificate)' != '' and $(SupportSigning)">"$(SdkBinPath)\signtool.exe" sign /q /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" <_MakeCatCommand Condition="Exists($(SdkBinPath))">"$(SdkBinPath)\makecat.exe" diff --git a/PCbuild/python.props b/PCbuild/python.props index d6bfd0877e0..c26f642a953 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -10,6 +10,7 @@ We set BasePlatformToolset for ICC's benefit, it's otherwise ignored. --> + v141 v140 v120 v110 @@ -39,6 +40,7 @@ $(BuildPath64) $(PySourcePath)PCBuild\$(ArchName)\ $(BuildPath)\ + $(BuildPath)instrumented\ $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) @@ -62,7 +64,24 @@ $(BuildPath)python$(PyDebugExt).exe - + + + + 10.0.15063.0 + 10.0.15063.0 + 10.0.14393.0 + 10.0.14393.0 + 10.0.10586.0 + 10.0.10586.0 + 10.0.10240.0 + 10.0.10240.0 + + _d diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 763540e1736..b0d2e9be8a4 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -66,8 +66,10 @@ /Zm200 %(AdditionalOptions) - $(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) + $(PySourcePath)Python;%(AdditionalIncludeDirectories) + $(zlibDir);%(AdditionalIncludeDirectories) _USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions) + _Py_HAVE_ZLIB;%(PreprocessorDefinitions) version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies) @@ -175,17 +177,6 @@ - - - - - - - - - - - @@ -213,6 +204,19 @@ + + + + + + + + + + + + + @@ -264,7 +268,6 @@ - @@ -273,17 +276,6 @@ - - - - - - - - - - - @@ -398,6 +390,20 @@ + + + + + + + + + + + + + + @@ -433,4 +439,7 @@ + + + From webhook-mailer at python.org Wed Sep 6 20:31:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 07 Sep 2017 00:31:34 -0000 Subject: [Python-checkins] [3.6] bpo-21649: Add RFC 7525 and Mozilla server side TLS (GH-3387) (GH-3399) Message-ID: https://github.com/python/cpython/commit/1fc47b40af3e3e80902100a2baa472b19dd47010 commit: 1fc47b40af3e3e80902100a2baa472b19dd47010 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-06T17:31:30-07:00 summary: [3.6] bpo-21649: Add RFC 7525 and Mozilla server side TLS (GH-3387) (GH-3399) Signed-off-by: Christian Heimes (cherry picked from commit ad0ffa033ea79f7c7cb14b1b1cc10888ea9e9913) files: A Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 357f65a3faf..0f09b3f0662 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -2321,3 +2321,9 @@ successful call of :func:`~ssl.RAND_add`, :func:`~ssl.RAND_bytes` or `IANA TLS: Transport Layer Security (TLS) Parameters `_ IANA + + `RFC 7525: Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) `_ + IETF + + `Mozilla's Server Side TLS recommendations `_ + Mozilla diff --git a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst new file mode 100644 index 00000000000..a09985aa3d8 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst @@ -0,0 +1 @@ +Add RFC 7525 and Mozilla server side TLS links to SSL documentation. From webhook-mailer at python.org Wed Sep 6 20:31:50 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 07 Sep 2017 00:31:50 -0000 Subject: [Python-checkins] [2.7] bpo-21649: Add RFC 7525 and Mozilla server side TLS (GH-3387) (GH-3400) Message-ID: https://github.com/python/cpython/commit/ab4894bba6e51105706f9fa016821434256585cd commit: ab4894bba6e51105706f9fa016821434256585cd branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-06T17:31:48-07:00 summary: [2.7] bpo-21649: Add RFC 7525 and Mozilla server side TLS (GH-3387) (GH-3400) Signed-off-by: Christian Heimes (cherry picked from commit ad0ffa033ea79f7c7cb14b1b1cc10888ea9e9913) files: A Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 183c17bb560..36beb1777cf 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1810,3 +1810,9 @@ successful call of :func:`~ssl.RAND_add`, :func:`~ssl.RAND_bytes` or `IANA TLS: Transport Layer Security (TLS) Parameters `_ IANA + + `RFC 7525: Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) `_ + IETF + + `Mozilla's Server Side TLS recommendations `_ + Mozilla diff --git a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst new file mode 100644 index 00000000000..a09985aa3d8 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst @@ -0,0 +1 @@ +Add RFC 7525 and Mozilla server side TLS links to SSL documentation. From lp_benchmark_robot at intel.com Wed Sep 6 20:34:59 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 6 Sep 2017 17:34:59 -0700 Subject: [Python-checkins] [1 down, 64 flat] Results for Python (master branch) 2017-09-06 Message-ID: Results for project python/master, build date: 2017-09-06 03:04:47-07:00. - commit: 3fc499b - previous commit: 75b9618 - revision date: 2017-09-05 23:41:30-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.184% | +0.532% | +3.318% | +8.216% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.454% | +0.188% | +21.028% | +11.168% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.520% | +0.180% | +21.919% | +10.749% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.811% | -0.038% | +21.878% | +5.311% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.178% | -0.575% | +0.391% | +18.040% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.280% | +1.010% | +12.090% | +8.605% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 1.064% | +0.250% | +8.332% | +9.667% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.670% | +0.121% | +4.293% | +6.389% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 1.841% | +0.389% | +9.596% | +16.409% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.240% | +6.397% | +8.801% | +12.650% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.361% | -0.126% | +1.927% | +8.012% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 1.351% | -0.797% | +6.409% | +3.700% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.721% | +0.624% | +3.438% | +4.788% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.980% | -0.322% | +8.262% | +10.801% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.385% | -0.203% | +5.980% | +9.135% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.773% | +0.268% | +6.887% | +9.567% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.529% | -0.054% | +8.633% | +11.332% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.298% | +1.166% | +6.813% | +10.411% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 0.847% | +0.619% | +2.748% | +9.842% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 4.435% | -0.437% | +0.003% | +12.276% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.478% | +1.171% | +6.723% | +11.056% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.964% | -0.885% | +46.433% | +10.805% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.894% | +1.132% | +7.885% | +12.403% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.365% | +0.243% | +18.962% | +10.936% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 5.101% | +0.863% | +6.996% | +12.051% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.165% | -0.777% | +3.262% | +5.310% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.341% | +0.214% | -1.851% | +3.565% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.818% | -0.173% | +1.371% | +7.813% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.247% | +2.506% | +1.954% | +9.700% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.582% | +0.427% | +0.241% | +23.331% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_dict| 0.175% | -4.898% | +0.006% | +24.826% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.071% | +1.064% | +4.945% | +21.875% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 4.967% | +0.305% | +10.035% | +10.813% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.154% | +0.081% | +0.345% | +9.718% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.132% | +0.288% | +9.288% | +4.769% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.093% | +0.258% | +1.578% | +4.726% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 0.955% | +0.281% | +9.802% | +12.437% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.650% | -0.527% | -8.973% | +12.487% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 1.496% | -0.058% | +1.990% | +9.671% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.000% | -0.786% | -2.725% | +7.455% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 0.679% | +0.620% | +9.955% | +3.455% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.623% | -0.155% | +7.513% | +14.290% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.514% | -0.225% | +2.284% | +0.281% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 3.053% | +0.846% | +25.375% | +10.005% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.887% | -0.304% | +5.658% | +3.632% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.726% | -0.238% | +15.146% | +7.731% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 9.293% | -0.854% | +1.212% | -5.204% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.445% | -0.096% | +7.558% | +1.378% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.001% | -0.012% | +3.815% | +8.748% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.892% | +1.142% | +5.639% | +4.381% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.189% | +0.747% | +4.344% | +7.463% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.598% | -0.256% | +11.826% | +9.149% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.741% | +0.767% | +9.787% | +7.269% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.895% | -1.005% | +10.394% | +11.125% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.096% | -0.219% | +11.066% | +11.800% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.363% | -0.542% | +23.387% | +8.528% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.144% | +0.191% | +5.933% | +6.928% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.053% | -0.528% | +2.374% | +1.773% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 5.647% | +0.103% | +9.016% | +19.711% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.828% | -0.346% | -0.851% | +15.262% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.243% | +0.279% | +7.217% | +6.813% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.132% | -0.222% | +5.841% | +7.844% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.413% | -1.179% | +1.781% | +6.618% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.515% | -0.987% | -5.657% | +11.872% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.236% | +0.391% | +6.907% | +7.307% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-64-flat-results-for-python-master-branch-2017-09-06 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Wed Sep 6 20:38:53 2017 From: webhook-mailer at python.org (Nick Coghlan) Date: Thu, 07 Sep 2017 00:38:53 -0000 Subject: [Python-checkins] [3.6] Update `make patchcheck` for blurb and NEWS.d (GH-3406) Message-ID: https://github.com/python/cpython/commit/e00e1b812c31f093a98fc85281687c78162eb445 commit: e00e1b812c31f093a98fc85281687c78162eb445 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Nick Coghlan date: 2017-09-07T10:38:51+10:00 summary: [3.6] Update `make patchcheck` for blurb and NEWS.d (GH-3406) (cherry picked from commit 1ba9469e9fdff0c52ba19b1e13a9c4b7235fc9eb) files: M Tools/scripts/patchcheck.py diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py index 5a1c94edee8..1154b815da3 100755 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -211,10 +211,11 @@ def credit_given(file_paths): return os.path.join('Misc', 'ACKS') in file_paths - at status("Misc/NEWS updated", modal=True) + at status("Misc/NEWS.d updated with `blurb`", modal=True) def reported_news(file_paths): - """Check if Misc/NEWS has been changed.""" - return os.path.join('Misc', 'NEWS') in file_paths + """Check if Misc/NEWS.d has been changed.""" + return any(p.startswith(os.path.join('Misc', 'NEWS.d', 'next')) + for p in file_paths) @status("configure regenerated", modal=True, info=str) def regenerated_configure(file_paths): @@ -260,8 +261,7 @@ def main(): c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))] doc_files = [fn for fn in file_paths if fn.startswith('Doc') and fn.endswith(('.rst', '.inc'))] - misc_files = {os.path.join('Misc', 'ACKS'), os.path.join('Misc', 'NEWS')}\ - & set(file_paths) + misc_files = {p for p in file_paths if p.startswith('Misc')} # PEP 8 whitespace rules enforcement. normalize_whitespace(python_files) # C rules enforcement. From webhook-mailer at python.org Wed Sep 6 20:39:26 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Thu, 07 Sep 2017 00:39:26 -0000 Subject: [Python-checkins] bpo-22635: subprocess.getstatusoutput doc update. (#3398) Message-ID: https://github.com/python/cpython/commit/738b7d9766e1a794aaaabfba0d515a467ba833ca commit: 738b7d9766e1a794aaaabfba0d515a467ba833ca branch: master author: Gregory P. Smith committer: GitHub date: 2017-09-06T17:39:23-07:00 summary: bpo-22635: subprocess.getstatusoutput doc update. (#3398) The `subprocess.getstatusoutput` API was inadvertently changed in Python 3.3.4. Document the change, it is too late to undo the API change now as it has shipped in many stable releases. files: M Doc/library/subprocess.rst diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index a4e234e62ae..21b1299d6f8 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -1165,27 +1165,32 @@ handling consistency are valid for these functions. .. function:: getstatusoutput(cmd) - Return ``(status, output)`` of executing *cmd* in a shell. + Return ``(exitcode, output)`` of executing *cmd* in a shell. Execute the string *cmd* in a shell with :meth:`Popen.check_output` and - return a 2-tuple ``(status, output)``. The locale encoding is used; + return a 2-tuple ``(exitcode, output)``. The locale encoding is used; see the notes on :ref:`frequently-used-arguments` for more details. A trailing newline is stripped from the output. - The exit status for the command can be interpreted - according to the rules for the C function :c:func:`wait`. Example:: + The exit code for the command can be interpreted as the return code + of subprocess. Example:: >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') - (256, 'cat: /bin/junk: No such file or directory') + (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') - (256, 'sh: /bin/junk: not found') + (127, 'sh: /bin/junk: not found') + >>> subprocess.getstatusoutput('/bin/kill $$') + (-15, '') Availability: POSIX & Windows .. versionchanged:: 3.3.4 - Windows support added + Windows support was added. + + The function now returns (exitcode, output) instead of (status, output) + as it did in Python 3.3.3 and earlier. See :func:`WEXITSTATUS`. .. function:: getoutput(cmd) From webhook-mailer at python.org Wed Sep 6 21:00:51 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Thu, 07 Sep 2017 01:00:51 -0000 Subject: [Python-checkins] Avoid UB in test selection macro. (#3407) Message-ID: https://github.com/python/cpython/commit/78ebc73f9b17373d25eb35e9f9511b2cb63825ff commit: 78ebc73f9b17373d25eb35e9f9511b2cb63825ff branch: master author: Devin Jeanpierre committer: Gregory P. Smith date: 2017-09-06T18:00:47-07:00 summary: Avoid UB in test selection macro. (#3407) This fixes the gcc "warning: this use of "defined" may not be portable [-Wexpansion-to-defined]" See discussion in http://bugs.python.org/issue29505 files: M Modules/_xxtestfuzz/fuzzer.c diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index 36f721ee626..b50eb651271 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -105,16 +105,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int rv = 0; -#define _Py_FUZZ_YES(test_name) (defined(_Py_FUZZ_##test_name) || !defined(_Py_FUZZ_ONE)) -#if _Py_FUZZ_YES(fuzz_builtin_float) +#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_float) rv |= _run_fuzz(data, size, fuzz_builtin_float); #endif -#if _Py_FUZZ_YES(fuzz_builtin_int) +#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_int) rv |= _run_fuzz(data, size, fuzz_builtin_int); #endif -#if _Py_FUZZ_YES(fuzz_builtin_unicode) +#if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_builtin_unicode) rv |= _run_fuzz(data, size, fuzz_builtin_unicode); #endif -#undef _Py_FUZZ_YES return rv; } From webhook-mailer at python.org Wed Sep 6 21:59:24 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 01:59:24 -0000 Subject: [Python-checkins] Update multissl test helper (#3349) Message-ID: https://github.com/python/cpython/commit/d3b9f97e6d92bbfcf956638344fd827a40837b96 commit: d3b9f97e6d92bbfcf956638344fd827a40837b96 branch: master author: Christian Heimes committer: GitHub date: 2017-09-06T18:59:22-07:00 summary: Update multissl test helper (#3349) Signed-off-by: Christian Heimes files: A Tools/ssl/multissltests.py D Tools/ssl/test_multiple_versions.py M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 57d2ab72ba9..f8a0dbcb667 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1051,6 +1051,13 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ quicktest: @DEF_MAKE_RULE@ platform $(TESTRUNNER) $(QUICKTESTOPTS) +# SSL tests +.PHONY: multisslcompile multissltest +multisslcompile: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py --compile-only + +multissltest: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@ if test "x$(ENSUREPIP)" != "xno" ; then \ diff --git a/Tools/ssl/multissltests.py b/Tools/ssl/multissltests.py new file mode 100755 index 00000000000..994e420818e --- /dev/null +++ b/Tools/ssl/multissltests.py @@ -0,0 +1,430 @@ +#!./python +"""Run Python tests against multiple installations of OpenSSL and LibreSSL + +The script + + (1) downloads OpenSSL / LibreSSL tar bundle + (2) extracts it to ./src + (3) compiles OpenSSL / LibreSSL + (4) installs OpenSSL / LibreSSL into ../multissl/$LIB/$VERSION/ + (5) forces a recompilation of Python modules using the + header and library files from ../multissl/$LIB/$VERSION/ + (6) runs Python's test suite + +The script must be run with Python's build directory as current working +directory. + +The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend +search paths for header files and shared libraries. It's known to work on +Linux with GCC and clang. + +Please keep this script compatible with Python 2.7, and 3.4 to 3.7. + +(c) 2013-2017 Christian Heimes +""" +from __future__ import print_function + +import argparse +from datetime import datetime +import logging +import os +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen +import subprocess +import shutil +import sys +import tarfile + + +log = logging.getLogger("multissl") + +OPENSSL_OLD_VERSIONS = [ + "0.9.8zc", + "0.9.8zh", + "1.0.1u", +] + +OPENSSL_RECENT_VERSIONS = [ + "1.0.2", + "1.0.2l", + "1.1.0f", +] + +LIBRESSL_OLD_VERSIONS = [ + "2.3.10", + "2.4.5", +] + +LIBRESSL_RECENT_VERSIONS = [ + "2.5.3", + "2.5.5", +] + +# store files in ../multissl +HERE = os.path.abspath(os.getcwd()) +MULTISSL_DIR = os.path.abspath(os.path.join(HERE, '..', 'multissl')) + +parser = argparse.ArgumentParser( + prog='multissl', + description=( + "Run CPython tests with multiple OpenSSL and LibreSSL " + "versions." + ) +) +parser.add_argument( + '--debug', + action='store_true', + help="Enable debug mode", +) +parser.add_argument( + '--disable-ancient', + action='store_true', + help="Don't test OpenSSL < 1.0.2 and LibreSSL < 2.5.3.", +) +parser.add_argument( + '--openssl', + nargs='+', + default=(), + help=( + "OpenSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(OPENSSL_RECENT_VERSIONS, OPENSSL_OLD_VERSIONS) +) +parser.add_argument( + '--libressl', + nargs='+', + default=(), + help=( + "LibreSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(LIBRESSL_RECENT_VERSIONS, LIBRESSL_OLD_VERSIONS) +) +parser.add_argument( + '--tests', + nargs='*', + default=(), + help="Python tests to run, defaults to all SSL related tests.", +) +parser.add_argument( + '--base-directory', + default=MULTISSL_DIR, + help="Base directory for OpenSSL / LibreSSL sources and builds." +) +parser.add_argument( + '--no-network', + action='store_false', + dest='network', + help="Disable network tests." +) +parser.add_argument( + '--compile-only', + action='store_true', + help="Don't run tests, only compile _ssl.c and _hashopenssl.c." +) + + +class AbstractBuilder(object): + library = None + url_template = None + src_template = None + build_template = None + + module_files = ("Modules/_ssl.c", + "Modules/_hashopenssl.c") + module_libs = ("_ssl", "_hashlib") + + def __init__(self, version, compile_args=(), + basedir=MULTISSL_DIR): + self.version = version + self.compile_args = compile_args + # installation directory + self.install_dir = os.path.join( + os.path.join(basedir, self.library.lower()), version + ) + # source file + self.src_dir = os.path.join(basedir, 'src') + self.src_file = os.path.join( + self.src_dir, self.src_template.format(version)) + # build directory (removed after install) + self.build_dir = os.path.join( + self.src_dir, self.build_template.format(version)) + + def __str__(self): + return "<{0.__class__.__name__} for {0.version}>".format(self) + + def __eq__(self, other): + if not isinstance(other, AbstractBuilder): + return NotImplemented + return ( + self.library == other.library + and self.version == other.version + ) + + def __hash__(self): + return hash((self.library, self.version)) + + @property + def openssl_cli(self): + """openssl CLI binary""" + return os.path.join(self.install_dir, "bin", "openssl") + + @property + def openssl_version(self): + """output of 'bin/openssl version'""" + cmd = [self.openssl_cli, "version"] + return self._subprocess_output(cmd) + + @property + def pyssl_version(self): + """Value of ssl.OPENSSL_VERSION""" + cmd = [ + sys.executable, + '-c', 'import ssl; print(ssl.OPENSSL_VERSION)' + ] + return self._subprocess_output(cmd) + + @property + def include_dir(self): + return os.path.join(self.install_dir, "include") + + @property + def lib_dir(self): + return os.path.join(self.install_dir, "lib") + + @property + def has_openssl(self): + return os.path.isfile(self.openssl_cli) + + @property + def has_src(self): + return os.path.isfile(self.src_file) + + def _subprocess_call(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + return subprocess.check_call(cmd, env=env, **kwargs) + + def _subprocess_output(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + if env is None: + env = os.environ.copy() + env["LD_LIBRARY_PATH"] = self.lib_dir + out = subprocess.check_output(cmd, env=env, **kwargs) + return out.strip().decode("utf-8") + + def _download_src(self): + """Download sources""" + src_dir = os.path.dirname(self.src_file) + if not os.path.isdir(src_dir): + os.makedirs(src_dir) + url = self.url_template.format(self.version) + log.info("Downloading from {}".format(url)) + req = urlopen(url) + # KISS, read all, write all + data = req.read() + log.info("Storing {}".format(self.src_file)) + with open(self.src_file, "wb") as f: + f.write(data) + + def _unpack_src(self): + """Unpack tar.gz bundle""" + # cleanup + if os.path.isdir(self.build_dir): + shutil.rmtree(self.build_dir) + os.makedirs(self.build_dir) + + tf = tarfile.open(self.src_file) + name = self.build_template.format(self.version) + base = name + '/' + # force extraction into build dir + members = tf.getmembers() + for member in list(members): + if member.name == name: + members.remove(member) + elif not member.name.startswith(base): + raise ValueError(member.name, base) + member.name = member.name[len(base):].lstrip('/') + log.info("Unpacking files to {}".format(self.build_dir)) + tf.extractall(self.build_dir, members) + + def _build_src(self): + """Now build openssl""" + log.info("Running build in {}".format(self.build_dir)) + cwd = self.build_dir + cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] + cmd.extend(self.compile_args) + self._subprocess_call(cmd, cwd=cwd) + # Old OpenSSL versions do not support parallel builds. + self._subprocess_call(["make", "-j1"], cwd=cwd) + + def _make_install(self, remove=True): + self._subprocess_call(["make", "-j1", "install"], cwd=self.build_dir) + if remove: + shutil.rmtree(self.build_dir) + + def install(self): + log.info(self.openssl_cli) + if not self.has_openssl: + if not self.has_src: + self._download_src() + else: + log.debug("Already has src {}".format(self.src_file)) + self._unpack_src() + self._build_src() + self._make_install() + else: + log.info("Already has installation {}".format(self.install_dir)) + # validate installation + version = self.openssl_version + if self.version not in version: + raise ValueError(version) + + def recompile_pymods(self): + log.warning("Using build from {}".format(self.build_dir)) + # force a rebuild of all modules that use OpenSSL APIs + for fname in self.module_files: + os.utime(fname, None) + # remove all build artefacts + for root, dirs, files in os.walk('build'): + for filename in files: + if filename.startswith(self.module_libs): + os.unlink(os.path.join(root, filename)) + + # overwrite header and library search paths + env = os.environ.copy() + env["CPPFLAGS"] = "-I{}".format(self.include_dir) + env["LDFLAGS"] = "-L{}".format(self.lib_dir) + # set rpath + env["LD_RUN_PATH"] = self.lib_dir + + log.info("Rebuilding Python modules") + cmd = [sys.executable, "setup.py", "build"] + self._subprocess_call(cmd, env=env) + self.check_imports() + + def check_imports(self): + cmd = [sys.executable, "-c", "import _ssl; import _hashlib"] + self._subprocess_call(cmd) + + def check_pyssl(self): + version = self.pyssl_version + if self.version not in version: + raise ValueError(version) + + def run_python_tests(self, tests, network=True): + if not tests: + cmd = [sys.executable, 'Lib/test/ssltests.py', '-j0'] + elif sys.version_info < (3, 3): + cmd = [sys.executable, '-m', 'test.regrtest'] + else: + cmd = [sys.executable, '-m', 'test', '-j0'] + if network: + cmd.extend(['-u', 'network', '-u', 'urlfetch']) + cmd.extend(['-w', '-r']) + cmd.extend(tests) + self._subprocess_call(cmd, stdout=None) + + +class BuildOpenSSL(AbstractBuilder): + library = "OpenSSL" + url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" + src_template = "openssl-{}.tar.gz" + build_template = "openssl-{}" + + +class BuildLibreSSL(AbstractBuilder): + library = "LibreSSL" + url_template = ( + "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-{}.tar.gz") + src_template = "libressl-{}.tar.gz" + build_template = "libressl-{}" + + +def configure_make(): + if not os.path.isfile('Makefile'): + log.info('Running ./configure') + subprocess.check_call([ + './configure', '--config-cache', '--quiet', + '--with-pydebug' + ]) + + log.info('Running make') + subprocess.check_call(['make', '--quiet']) + + +def main(): + args = parser.parse_args() + if not args.openssl and not args.libressl: + args.openssl = list(OPENSSL_RECENT_VERSIONS) + args.libressl = list(LIBRESSL_RECENT_VERSIONS) + if not args.disable_ancient: + args.openssl.extend(OPENSSL_OLD_VERSIONS) + args.libressl.extend(LIBRESSL_OLD_VERSIONS) + + logging.basicConfig( + level=logging.DEBUG if args.debug else logging.INFO, + format="*** %(levelname)s %(message)s" + ) + + start = datetime.now() + + for name in ['python', 'setup.py', 'Modules/_ssl.c']: + if not os.path.isfile(name): + parser.error( + "Must be executed from CPython build dir" + ) + if not os.path.samefile('python', sys.executable): + parser.error( + "Must be executed with ./python from CPython build dir" + ) + + # check for configure and run make + configure_make() + + # download and register builder + builds = [] + + for version in args.openssl: + build = BuildOpenSSL(version) + build.install() + builds.append(build) + + for version in args.libressl: + build = BuildLibreSSL(version) + build.install() + builds.append(build) + + for build in builds: + try: + build.recompile_pymods() + build.check_pyssl() + if not args.compile_only: + build.run_python_tests( + tests=args.tests, + network=args.network, + ) + except Exception as e: + log.exception("%s failed", build) + print("{} failed: {}".format(build, e), file=sys.stderr) + sys.exit(2) + + print("\n{} finished in {}".format( + "Tests" if not args.compile_only else "Builds", + datetime.now() - start + )) + print('Python: ', sys.version) + if args.compile_only: + print('Build only') + elif args.tests: + print('Executed Tests:', ' '.join(args.tests)) + else: + print('Executed all SSL tests.') + + print('OpenSSL / LibreSSL versions:') + for build in builds: + print(" * {0.library} {0.version}".format(build)) + + +if __name__ == "__main__": + main() diff --git a/Tools/ssl/test_multiple_versions.py b/Tools/ssl/test_multiple_versions.py deleted file mode 100644 index 30d5fcf2e0b..00000000000 --- a/Tools/ssl/test_multiple_versions.py +++ /dev/null @@ -1,241 +0,0 @@ -#./python -"""Run Python tests with multiple installations of OpenSSL - -The script - - (1) downloads OpenSSL tar bundle - (2) extracts it to ../openssl/src/openssl-VERSION/ - (3) compiles OpenSSL - (4) installs OpenSSL into ../openssl/VERSION/ - (5) forces a recompilation of Python modules using the - header and library files from ../openssl/VERSION/ - (6) runs Python's test suite - -The script must be run with Python's build directory as current working -directory: - - ./python Tools/ssl/test_multiple_versions.py - -The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend -search paths for header files and shared libraries. It's known to work on -Linux with GCC 4.x. - -(c) 2013 Christian Heimes -""" -import logging -import os -import tarfile -import shutil -import subprocess -import sys -from urllib.request import urlopen - -log = logging.getLogger("multissl") - -OPENSSL_VERSIONS = [ - "0.9.7m", "0.9.8i", "0.9.8l", "0.9.8m", "0.9.8y", "1.0.0k", "1.0.1e" -] -FULL_TESTS = [ - "test_asyncio", "test_ftplib", "test_hashlib", "test_httplib", - "test_imaplib", "test_nntplib", "test_poplib", "test_smtplib", - "test_smtpnet", "test_urllib2_localnet", "test_venv" -] -MINIMAL_TESTS = ["test_ssl", "test_hashlib"] -CADEFAULT = True -HERE = os.path.abspath(os.getcwd()) -DEST_DIR = os.path.abspath(os.path.join(HERE, os.pardir, "openssl")) - - -class BuildSSL: - url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" - - module_files = ["Modules/_ssl.c", - "Modules/socketmodule.c", - "Modules/_hashopenssl.c"] - - def __init__(self, version, openssl_compile_args=(), destdir=DEST_DIR): - self._check_python_builddir() - self.version = version - self.openssl_compile_args = openssl_compile_args - # installation directory - self.install_dir = os.path.join(destdir, version) - # source file - self.src_file = os.path.join(destdir, "src", - "openssl-{}.tar.gz".format(version)) - # build directory (removed after install) - self.build_dir = os.path.join(destdir, "src", - "openssl-{}".format(version)) - - @property - def openssl_cli(self): - """openssl CLI binary""" - return os.path.join(self.install_dir, "bin", "openssl") - - @property - def openssl_version(self): - """output of 'bin/openssl version'""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = [self.openssl_cli, "version"] - return self._subprocess_output(cmd, env=env) - - @property - def pyssl_version(self): - """Value of ssl.OPENSSL_VERSION""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = ["./python", "-c", "import ssl; print(ssl.OPENSSL_VERSION)"] - return self._subprocess_output(cmd, env=env) - - @property - def include_dir(self): - return os.path.join(self.install_dir, "include") - - @property - def lib_dir(self): - return os.path.join(self.install_dir, "lib") - - @property - def has_openssl(self): - return os.path.isfile(self.openssl_cli) - - @property - def has_src(self): - return os.path.isfile(self.src_file) - - def _subprocess_call(self, cmd, stdout=subprocess.DEVNULL, env=None, - **kwargs): - log.debug("Call '%s'", " ".join(cmd)) - return subprocess.check_call(cmd, stdout=stdout, env=env, **kwargs) - - def _subprocess_output(self, cmd, env=None, **kwargs): - log.debug("Call '%s'", " ".join(cmd)) - out = subprocess.check_output(cmd, env=env) - return out.strip().decode("utf-8") - - def _check_python_builddir(self): - if not os.path.isfile("python") or not os.path.isfile("setup.py"): - raise ValueError("Script must be run in Python build directory") - - def _download_openssl(self): - """Download OpenSSL source dist""" - src_dir = os.path.dirname(self.src_file) - if not os.path.isdir(src_dir): - os.makedirs(src_dir) - url = self.url_template.format(self.version) - log.info("Downloading OpenSSL from {}".format(url)) - req = urlopen(url, cadefault=CADEFAULT) - # KISS, read all, write all - data = req.read() - log.info("Storing {}".format(self.src_file)) - with open(self.src_file, "wb") as f: - f.write(data) - - def _unpack_openssl(self): - """Unpack tar.gz bundle""" - # cleanup - if os.path.isdir(self.build_dir): - shutil.rmtree(self.build_dir) - os.makedirs(self.build_dir) - - tf = tarfile.open(self.src_file) - base = "openssl-{}/".format(self.version) - # force extraction into build dir - members = tf.getmembers() - for member in members: - if not member.name.startswith(base): - raise ValueError(member.name) - member.name = member.name[len(base):] - log.info("Unpacking files to {}".format(self.build_dir)) - tf.extractall(self.build_dir, members) - - def _build_openssl(self): - """Now build openssl""" - log.info("Running build in {}".format(self.install_dir)) - cwd = self.build_dir - cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] - cmd.extend(self.openssl_compile_args) - self._subprocess_call(cmd, cwd=cwd) - self._subprocess_call(["make"], cwd=cwd) - - def _install_openssl(self, remove=True): - self._subprocess_call(["make", "install"], cwd=self.build_dir) - if remove: - shutil.rmtree(self.build_dir) - - def install_openssl(self): - if not self.has_openssl: - if not self.has_src: - self._download_openssl() - else: - log.debug("Already has src %s", self.src_file) - self._unpack_openssl() - self._build_openssl() - self._install_openssl() - else: - log.info("Already has installation {}".format(self.install_dir)) - # validate installation - version = self.openssl_version - if self.version not in version: - raise ValueError(version) - - def touch_pymods(self): - # force a rebuild of all modules that use OpenSSL APIs - for fname in self.module_files: - os.utime(fname) - - def recompile_pymods(self): - log.info("Using OpenSSL build from {}".format(self.build_dir)) - # overwrite header and library search paths - env = os.environ.copy() - env["CPPFLAGS"] = "-I{}".format(self.include_dir) - env["LDFLAGS"] = "-L{}".format(self.lib_dir) - # set rpath - env["LD_RUN_PATH"] = self.lib_dir - - log.info("Rebuilding Python modules") - self.touch_pymods() - cmd = ["./python", "setup.py", "build"] - self._subprocess_call(cmd, env=env) - - def check_pyssl(self): - version = self.pyssl_version - if self.version not in version: - raise ValueError(version) - - def run_pytests(self, *args): - cmd = ["./python", "-m", "test"] - cmd.extend(args) - self._subprocess_call(cmd, stdout=None) - - def run_python_tests(self, *args): - self.recompile_pymods() - self.check_pyssl() - self.run_pytests(*args) - - -def main(*args): - builders = [] - for version in OPENSSL_VERSIONS: - if version in ("0.9.8i", "0.9.8l"): - openssl_compile_args = ("no-asm",) - else: - openssl_compile_args = () - builder = BuildSSL(version, openssl_compile_args) - builder.install_openssl() - builders.append(builder) - - for builder in builders: - builder.run_python_tests(*args) - # final touch - builder.touch_pymods() - - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO, - format="*** %(levelname)s %(message)s") - args = sys.argv[1:] - if not args: - args = ["-unetwork", "-v"] - args.extend(FULL_TESTS) - main(*args) From webhook-mailer at python.org Wed Sep 6 22:29:13 2017 From: webhook-mailer at python.org (Steve Dower) Date: Thu, 07 Sep 2017 02:29:13 -0000 Subject: [Python-checkins] Add props file for nuget packages (#3410) Message-ID: https://github.com/python/cpython/commit/1f06a680de465be0c24a78ea3b610053955daa99 commit: 1f06a680de465be0c24a78ea3b610053955daa99 branch: master author: Steve Dower committer: GitHub date: 2017-09-06T19:29:10-07:00 summary: Add props file for nuget packages (#3410) files: A Tools/nuget/python.props M Tools/nuget/make_pkg.proj M Tools/nuget/python.nuspec M Tools/nuget/pythondaily.nuspec M Tools/nuget/pythonx86.nuspec diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj index f21d21ee693..9843bc97ccd 100644 --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -51,6 +51,20 @@ + + + <_PropsContents>$([System.IO.File]::ReadAllText('python.props')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TAG$$', '$(MajorVersionNumber).$(MinorVersionNumber)')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_VERSION$$', '$(NuspecVersion)')) + <_PropsContents Condition="$(Platform) == 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', 'Win32')) + <_PropsContents Condition="$(Platform) != 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', '$(Platform)')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TARGET$$', '_GetPythonRuntimeFilesDependsOn$(MajorVersionNumber)$(MinorVersionNumber)_$(Platform)')) + <_ExistingContents Condition="Exists('$(IntermediateOutputPath)\python.props')">$([System.IO.File]::ReadAllText('$(IntermediateOutputPath)\python.props')) + + + diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec index b3c5c3487ad..d5f3e632423 100644 --- a/Tools/nuget/python.nuspec +++ b/Tools/nuget/python.nuspec @@ -13,6 +13,7 @@ python - + + diff --git a/Tools/nuget/python.props b/Tools/nuget/python.props new file mode 100644 index 00000000000..4cc70083ebe --- /dev/null +++ b/Tools/nuget/python.props @@ -0,0 +1,56 @@ + + + + $(MSBuildThisFileDirectory)\..\..\tools + $(PythonHome)\include + $(PythonHome)\libs + $$PYTHON_TAG$$ + $$PYTHON_VERSION$$ + + true + false + false + false + + $$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn) + + + + + $(PythonInclude);%(AdditionalIncludeDirectories) + MultiThreadedDLL + + + $(PythonLibs);%(AdditionalLibraryDirectories) + + + + + + + + <_PythonRuntimeExe Include="$(PythonHome)\python*.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\vcruntime140.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" /> + <_PythonRuntimeExe> + %(Filename)%(Extension) + + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" /> + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" /> + <_PythonRuntimeDlls> + DLLs\%(Filename)%(Extension) + + <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib> + Lib\%(RecursiveDir)%(Filename)%(Extension) + + + + + + + diff --git a/Tools/nuget/pythondaily.nuspec b/Tools/nuget/pythondaily.nuspec index 2634ed14a88..ee3343bbb7b 100644 --- a/Tools/nuget/pythondaily.nuspec +++ b/Tools/nuget/pythondaily.nuspec @@ -13,6 +13,7 @@ python - + + diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec index b55c8799c0f..ebfcd6c92a4 100644 --- a/Tools/nuget/pythonx86.nuspec +++ b/Tools/nuget/pythonx86.nuspec @@ -13,6 +13,7 @@ python - + + From webhook-mailer at python.org Wed Sep 6 22:43:07 2017 From: webhook-mailer at python.org (ericvsmith) Date: Thu, 07 Sep 2017 02:43:07 -0000 Subject: [Python-checkins] bpo-30465: Fix lineno and col_offset in fstring AST nodes (GH-1800) (gh-3409) Message-ID: https://github.com/python/cpython/commit/aa1afc72c1ee1f090e6302198d9a0295f1ce1c05 commit: aa1afc72c1ee1f090e6302198d9a0295f1ce1c05 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: ericvsmith date: 2017-09-06T19:43:04-07:00 summary: bpo-30465: Fix lineno and col_offset in fstring AST nodes (GH-1800) (gh-3409) For f-string ast nodes, fix the line and columns so that tools such as flake8 can identify them correctly. (cherry picked from commit e7c566caf177afe43b57f0b2723e723d880368e8) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst M Lib/test/test_fstring.py M Python/ast.c diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index 3d762b5aa9b..5e7efe25e39 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -70,6 +70,253 @@ def __call__(self): # Make sure x was called. self.assertTrue(x.called) + def test_ast_line_numbers(self): + expr = """ +a = 10 +f'{a * x()}'""" + t = ast.parse(expr) + self.assertEqual(type(t), ast.Module) + self.assertEqual(len(t.body), 2) + # check `a = 10` + self.assertEqual(type(t.body[0]), ast.Assign) + self.assertEqual(t.body[0].lineno, 2) + # check `f'...'` + self.assertEqual(type(t.body[1]), ast.Expr) + self.assertEqual(type(t.body[1].value), ast.JoinedStr) + self.assertEqual(len(t.body[1].value.values), 1) + self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) + self.assertEqual(t.body[1].lineno, 3) + self.assertEqual(t.body[1].value.lineno, 3) + self.assertEqual(t.body[1].value.values[0].lineno, 3) + # check the binop location + binop = t.body[1].value.values[0].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.Call) + self.assertEqual(binop.lineno, 3) + self.assertEqual(binop.left.lineno, 3) + self.assertEqual(binop.right.lineno, 3) + self.assertEqual(binop.col_offset, 3) + self.assertEqual(binop.left.col_offset, 3) + self.assertEqual(binop.right.col_offset, 7) + + def test_ast_line_numbers_multiple_formattedvalues(self): + expr = """ +f'no formatted values' +f'eggs {a * x()} spam {b + y()}'""" + t = ast.parse(expr) + self.assertEqual(type(t), ast.Module) + self.assertEqual(len(t.body), 2) + # check `f'no formatted value'` + self.assertEqual(type(t.body[0]), ast.Expr) + self.assertEqual(type(t.body[0].value), ast.JoinedStr) + self.assertEqual(t.body[0].lineno, 2) + # check `f'...'` + self.assertEqual(type(t.body[1]), ast.Expr) + self.assertEqual(type(t.body[1].value), ast.JoinedStr) + self.assertEqual(len(t.body[1].value.values), 4) + self.assertEqual(type(t.body[1].value.values[0]), ast.Str) + self.assertEqual(type(t.body[1].value.values[1]), ast.FormattedValue) + self.assertEqual(type(t.body[1].value.values[2]), ast.Str) + self.assertEqual(type(t.body[1].value.values[3]), ast.FormattedValue) + self.assertEqual(t.body[1].lineno, 3) + self.assertEqual(t.body[1].value.lineno, 3) + self.assertEqual(t.body[1].value.values[0].lineno, 3) + self.assertEqual(t.body[1].value.values[1].lineno, 3) + self.assertEqual(t.body[1].value.values[2].lineno, 3) + self.assertEqual(t.body[1].value.values[3].lineno, 3) + # check the first binop location + binop1 = t.body[1].value.values[1].value + self.assertEqual(type(binop1), ast.BinOp) + self.assertEqual(type(binop1.left), ast.Name) + self.assertEqual(type(binop1.op), ast.Mult) + self.assertEqual(type(binop1.right), ast.Call) + self.assertEqual(binop1.lineno, 3) + self.assertEqual(binop1.left.lineno, 3) + self.assertEqual(binop1.right.lineno, 3) + self.assertEqual(binop1.col_offset, 8) + self.assertEqual(binop1.left.col_offset, 8) + self.assertEqual(binop1.right.col_offset, 12) + # check the second binop location + binop2 = t.body[1].value.values[3].value + self.assertEqual(type(binop2), ast.BinOp) + self.assertEqual(type(binop2.left), ast.Name) + self.assertEqual(type(binop2.op), ast.Add) + self.assertEqual(type(binop2.right), ast.Call) + self.assertEqual(binop2.lineno, 3) + self.assertEqual(binop2.left.lineno, 3) + self.assertEqual(binop2.right.lineno, 3) + self.assertEqual(binop2.col_offset, 23) + self.assertEqual(binop2.left.col_offset, 23) + self.assertEqual(binop2.right.col_offset, 27) + + def test_ast_line_numbers_nested(self): + expr = """ +a = 10 +f'{a * f"-{x()}-"}'""" + t = ast.parse(expr) + self.assertEqual(type(t), ast.Module) + self.assertEqual(len(t.body), 2) + # check `a = 10` + self.assertEqual(type(t.body[0]), ast.Assign) + self.assertEqual(t.body[0].lineno, 2) + # check `f'...'` + self.assertEqual(type(t.body[1]), ast.Expr) + self.assertEqual(type(t.body[1].value), ast.JoinedStr) + self.assertEqual(len(t.body[1].value.values), 1) + self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) + self.assertEqual(t.body[1].lineno, 3) + self.assertEqual(t.body[1].value.lineno, 3) + self.assertEqual(t.body[1].value.values[0].lineno, 3) + # check the binop location + binop = t.body[1].value.values[0].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.JoinedStr) + self.assertEqual(binop.lineno, 3) + self.assertEqual(binop.left.lineno, 3) + self.assertEqual(binop.right.lineno, 3) + self.assertEqual(binop.col_offset, 3) + self.assertEqual(binop.left.col_offset, 3) + self.assertEqual(binop.right.col_offset, 7) + # check the nested call location + self.assertEqual(len(binop.right.values), 3) + self.assertEqual(type(binop.right.values[0]), ast.Str) + self.assertEqual(type(binop.right.values[1]), ast.FormattedValue) + self.assertEqual(type(binop.right.values[2]), ast.Str) + self.assertEqual(binop.right.values[0].lineno, 3) + self.assertEqual(binop.right.values[1].lineno, 3) + self.assertEqual(binop.right.values[2].lineno, 3) + call = binop.right.values[1].value + self.assertEqual(type(call), ast.Call) + self.assertEqual(call.lineno, 3) + self.assertEqual(call.col_offset, 11) + + def test_ast_line_numbers_duplicate_expression(self): + """Duplicate expression + + NOTE: this is currently broken, always sets location of the first + expression. + """ + expr = """ +a = 10 +f'{a * x()} {a * x()} {a * x()}' +""" + t = ast.parse(expr) + self.assertEqual(type(t), ast.Module) + self.assertEqual(len(t.body), 2) + # check `a = 10` + self.assertEqual(type(t.body[0]), ast.Assign) + self.assertEqual(t.body[0].lineno, 2) + # check `f'...'` + self.assertEqual(type(t.body[1]), ast.Expr) + self.assertEqual(type(t.body[1].value), ast.JoinedStr) + self.assertEqual(len(t.body[1].value.values), 5) + self.assertEqual(type(t.body[1].value.values[0]), ast.FormattedValue) + self.assertEqual(type(t.body[1].value.values[1]), ast.Str) + self.assertEqual(type(t.body[1].value.values[2]), ast.FormattedValue) + self.assertEqual(type(t.body[1].value.values[3]), ast.Str) + self.assertEqual(type(t.body[1].value.values[4]), ast.FormattedValue) + self.assertEqual(t.body[1].lineno, 3) + self.assertEqual(t.body[1].value.lineno, 3) + self.assertEqual(t.body[1].value.values[0].lineno, 3) + self.assertEqual(t.body[1].value.values[1].lineno, 3) + self.assertEqual(t.body[1].value.values[2].lineno, 3) + self.assertEqual(t.body[1].value.values[3].lineno, 3) + self.assertEqual(t.body[1].value.values[4].lineno, 3) + # check the first binop location + binop = t.body[1].value.values[0].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.Call) + self.assertEqual(binop.lineno, 3) + self.assertEqual(binop.left.lineno, 3) + self.assertEqual(binop.right.lineno, 3) + self.assertEqual(binop.col_offset, 3) + self.assertEqual(binop.left.col_offset, 3) + self.assertEqual(binop.right.col_offset, 7) + # check the second binop location + binop = t.body[1].value.values[2].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.Call) + self.assertEqual(binop.lineno, 3) + self.assertEqual(binop.left.lineno, 3) + self.assertEqual(binop.right.lineno, 3) + self.assertEqual(binop.col_offset, 3) # FIXME: this is wrong + self.assertEqual(binop.left.col_offset, 3) # FIXME: this is wrong + self.assertEqual(binop.right.col_offset, 7) # FIXME: this is wrong + # check the third binop location + binop = t.body[1].value.values[4].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.Call) + self.assertEqual(binop.lineno, 3) + self.assertEqual(binop.left.lineno, 3) + self.assertEqual(binop.right.lineno, 3) + self.assertEqual(binop.col_offset, 3) # FIXME: this is wrong + self.assertEqual(binop.left.col_offset, 3) # FIXME: this is wrong + self.assertEqual(binop.right.col_offset, 7) # FIXME: this is wrong + + def test_ast_line_numbers_multiline_fstring(self): + # FIXME: This test demonstrates invalid behavior due to JoinedStr's + # immediate child nodes containing the wrong lineno. The enclosed + # expressions have valid line information and column offsets. + # See bpo-16806 and bpo-30465 for details. + expr = """ +a = 10 +f''' + {a + * + x()} +non-important content +''' +""" + t = ast.parse(expr) + self.assertEqual(type(t), ast.Module) + self.assertEqual(len(t.body), 2) + # check `a = 10` + self.assertEqual(type(t.body[0]), ast.Assign) + self.assertEqual(t.body[0].lineno, 2) + # check `f'...'` + self.assertEqual(type(t.body[1]), ast.Expr) + self.assertEqual(type(t.body[1].value), ast.JoinedStr) + self.assertEqual(len(t.body[1].value.values), 3) + self.assertEqual(type(t.body[1].value.values[0]), ast.Str) + self.assertEqual(type(t.body[1].value.values[1]), ast.FormattedValue) + self.assertEqual(type(t.body[1].value.values[2]), ast.Str) + # NOTE: the following invalid behavior is described in bpo-16806. + # - line number should be the *first* line (3), not the *last* (8) + # - column offset should not be -1 + self.assertEqual(t.body[1].lineno, 8) + self.assertEqual(t.body[1].value.lineno, 8) + self.assertEqual(t.body[1].value.values[0].lineno, 8) + self.assertEqual(t.body[1].value.values[1].lineno, 8) + self.assertEqual(t.body[1].value.values[2].lineno, 8) + self.assertEqual(t.body[1].col_offset, -1) + self.assertEqual(t.body[1].value.col_offset, -1) + self.assertEqual(t.body[1].value.values[0].col_offset, -1) + self.assertEqual(t.body[1].value.values[1].col_offset, -1) + self.assertEqual(t.body[1].value.values[2].col_offset, -1) + # NOTE: the following lineno information and col_offset is correct for + # expressions within FormattedValues. + binop = t.body[1].value.values[1].value + self.assertEqual(type(binop), ast.BinOp) + self.assertEqual(type(binop.left), ast.Name) + self.assertEqual(type(binop.op), ast.Mult) + self.assertEqual(type(binop.right), ast.Call) + self.assertEqual(binop.lineno, 4) + self.assertEqual(binop.left.lineno, 4) + self.assertEqual(binop.right.lineno, 6) + self.assertEqual(binop.col_offset, 3) + self.assertEqual(binop.left.col_offset, 3) + self.assertEqual(binop.right.col_offset, 7) + def test_docstring(self): def f(): f'''Not a docstring''' @@ -786,5 +1033,6 @@ def test_backslash_char(self): self.assertEqual(eval('f"\\\n"'), '') self.assertEqual(eval('f"\\\r"'), '') + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst new file mode 100644 index 00000000000..0d9138ed82d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst @@ -0,0 +1,3 @@ +Location information (``lineno`` and ``col_offset``) in f-strings is now +(mostly) correct. This fixes tools like flake8 from showing warnings on the +wrong line (typically the first line of the file). diff --git a/Python/ast.c b/Python/ast.c index 8d53736f081..4fa68a371d4 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -8,6 +8,7 @@ #include "node.h" #include "ast.h" #include "token.h" +#include "pythonrun.h" #include @@ -4240,6 +4241,55 @@ decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s, return result; } +/* Shift locations for the given node and all its children by adding `lineno` + and `col_offset` to existing locations. */ +static void fstring_shift_node_locations(node *n, int lineno, int col_offset) +{ + n->n_col_offset = n->n_col_offset + col_offset; + for (int i = 0; i < NCH(n); ++i) { + if (n->n_lineno && n->n_lineno < CHILD(n, i)->n_lineno) { + /* Shifting column offsets unnecessary if there's been newlines. */ + col_offset = 0; + } + fstring_shift_node_locations(CHILD(n, i), lineno, col_offset); + } + n->n_lineno = n->n_lineno + lineno; +} + +/* Fix locations for the given node and its children. + + `parent` is the enclosing node. + `n` is the node which locations are going to be fixed relative to parent. + `expr_str` is the child node's string representation, incuding braces. +*/ +static void +fstring_fix_node_location(const node *parent, node *n, char *expr_str) +{ + char *substr = NULL; + char *start; + int lines = LINENO(parent) - 1; + int cols = parent->n_col_offset; + /* Find the full fstring to fix location information in `n`. */ + while (parent && parent->n_type != STRING) + parent = parent->n_child; + if (parent && parent->n_str) { + substr = strstr(parent->n_str, expr_str); + if (substr) { + start = substr; + while (start > parent->n_str) { + if (start[0] == '\n') + break; + start--; + } + cols += substr - start; + /* Fix lineno in mulitline strings. */ + while ((substr = strchr(substr + 1, '\n'))) + lines--; + } + } + fstring_shift_node_locations(n, lines, cols); +} + /* Compile this expression in to an expr_ty. Add parens around the expression, in order to allow leading spaces in the expression. */ static expr_ty @@ -4248,6 +4298,7 @@ fstring_compile_expr(const char *expr_start, const char *expr_end, { PyCompilerFlags cf; + node *mod_n; mod_ty mod; char *str; Py_ssize_t len; @@ -4257,9 +4308,10 @@ fstring_compile_expr(const char *expr_start, const char *expr_end, assert(*(expr_start-1) == '{'); assert(*expr_end == '}' || *expr_end == '!' || *expr_end == ':'); - /* If the substring is all whitespace, it's an error. We need to catch - this here, and not when we call PyParser_ASTFromString, because turning - the expression '' in to '()' would go from being invalid to valid. */ + /* If the substring is all whitespace, it's an error. We need to catch this + here, and not when we call PyParser_SimpleParseStringFlagsFilename, + because turning the expression '' in to '()' would go from being invalid + to valid. */ for (s = expr_start; s != expr_end; s++) { char c = *s; /* The Python parser ignores only the following whitespace @@ -4285,9 +4337,19 @@ fstring_compile_expr(const char *expr_start, const char *expr_end, str[len+2] = 0; cf.cf_flags = PyCF_ONLY_AST; - mod = PyParser_ASTFromString(str, "", - Py_eval_input, &cf, c->c_arena); + mod_n = PyParser_SimpleParseStringFlagsFilename(str, "", + Py_eval_input, 0); + if (!mod_n) { + PyMem_RawFree(str); + return NULL; + } + /* Reuse str to find the correct column offset. */ + str[0] = '{'; + str[len+1] = '}'; + fstring_fix_node_location(n, mod_n, str); + mod = PyAST_FromNode(mod_n, &cf, "", c->c_arena); PyMem_RawFree(str); + PyNode_Free(mod_n); if (!mod) return NULL; return mod->v.Expression.body; From webhook-mailer at python.org Wed Sep 6 22:57:54 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 02:57:54 -0000 Subject: [Python-checkins] [3.6] bpo-22635: subprocess.getstatusoutput doc update. (GH-3398) (#3411) Message-ID: https://github.com/python/cpython/commit/dee54f6010ee2df60322c350a5f1dc8bfcf367d6 commit: dee54f6010ee2df60322c350a5f1dc8bfcf367d6 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Christian Heimes date: 2017-09-06T19:57:52-07:00 summary: [3.6] bpo-22635: subprocess.getstatusoutput doc update. (GH-3398) (#3411) The `subprocess.getstatusoutput` API was inadvertently changed in Python 3.3.4. Document the change, it is too late to undo the API change now as it has shipped in many stable releases. (cherry picked from commit 738b7d9766e1a794aaaabfba0d515a467ba833ca) files: M Doc/library/subprocess.rst diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 663e232851b..27f3e825961 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -1166,27 +1166,32 @@ handling consistency are valid for these functions. .. function:: getstatusoutput(cmd) - Return ``(status, output)`` of executing *cmd* in a shell. + Return ``(exitcode, output)`` of executing *cmd* in a shell. Execute the string *cmd* in a shell with :meth:`Popen.check_output` and - return a 2-tuple ``(status, output)``. The locale encoding is used; + return a 2-tuple ``(exitcode, output)``. The locale encoding is used; see the notes on :ref:`frequently-used-arguments` for more details. A trailing newline is stripped from the output. - The exit status for the command can be interpreted - according to the rules for the C function :c:func:`wait`. Example:: + The exit code for the command can be interpreted as the return code + of subprocess. Example:: >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') - (256, 'cat: /bin/junk: No such file or directory') + (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') - (256, 'sh: /bin/junk: not found') + (127, 'sh: /bin/junk: not found') + >>> subprocess.getstatusoutput('/bin/kill $$') + (-15, '') Availability: POSIX & Windows .. versionchanged:: 3.3.4 - Windows support added + Windows support was added. + + The function now returns (exitcode, output) instead of (status, output) + as it did in Python 3.3.3 and earlier. See :func:`WEXITSTATUS`. .. function:: getoutput(cmd) From webhook-mailer at python.org Wed Sep 6 23:18:04 2017 From: webhook-mailer at python.org (Ned Deily) Date: Thu, 07 Sep 2017 03:18:04 -0000 Subject: [Python-checkins] Link to generated changelog, not website. Message-ID: https://github.com/python/cpython/commit/b368e4e8ce78f5f5cd2d31c20b4f728ef73d2e92 commit: b368e4e8ce78f5f5cd2d31c20b4f728ef73d2e92 branch: 3.6 author: Ned Deily committer: Ned Deily date: 2017-09-06T20:17:09-07:00 summary: Link to generated changelog, not website. files: M Doc/whatsnew/3.6.rst diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 1e71bc3b10a..1301f4ca1d8 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -45,9 +45,8 @@ when researching a change. This article explains the new features in Python 3.6, compared to 3.5. -Python 3.6 was released on December 23, 2016. ?See the -`changelog `_ for a full -list of changes. +Python 3.6 was released on December 23, 2016. +For full details, see the :ref:`changelog `. .. seealso:: From webhook-mailer at python.org Wed Sep 6 23:41:36 2017 From: webhook-mailer at python.org (Steve Dower) Date: Thu, 07 Sep 2017 03:41:36 -0000 Subject: [Python-checkins] Add props file for nuget packages (#3410) (#3413) Message-ID: https://github.com/python/cpython/commit/cb44b626da0295e64a34360475201e672df2467a commit: cb44b626da0295e64a34360475201e672df2467a branch: 3.6 author: Steve Dower committer: GitHub date: 2017-09-06T20:41:32-07:00 summary: Add props file for nuget packages (#3410) (#3413) files: A Tools/nuget/python.props M Tools/nuget/make_pkg.proj M Tools/nuget/python.nuspec M Tools/nuget/pythondaily.nuspec M Tools/nuget/pythonx86.nuspec diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj index 3750d8dcc86..9843bc97ccd 100644 --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -30,8 +30,8 @@ "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) - "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" - $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" -BasePath "$(IntermediateOutputPath)" + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).symbols.nuspec" -BasePath "$(BuildPath.TrimEnd(`\`))" $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" $(NugetArguments) -Version "$(NuspecVersion)" $(NugetArguments) -NoPackageAnalysis -NonInteractive @@ -51,7 +51,22 @@ - + + + <_PropsContents>$([System.IO.File]::ReadAllText('python.props')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TAG$$', '$(MajorVersionNumber).$(MinorVersionNumber)')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_VERSION$$', '$(NuspecVersion)')) + <_PropsContents Condition="$(Platform) == 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', 'Win32')) + <_PropsContents Condition="$(Platform) != 'x86'">$(_PropsContents.Replace('$$PYTHON_PLATFORM$$', '$(Platform)')) + <_PropsContents>$(_PropsContents.Replace('$$PYTHON_TARGET$$', '_GetPythonRuntimeFilesDependsOn$(MajorVersionNumber)$(MinorVersionNumber)_$(Platform)')) + <_ExistingContents Condition="Exists('$(IntermediateOutputPath)\python.props')">$([System.IO.File]::ReadAllText('$(IntermediateOutputPath)\python.props')) + + + + + diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec index b3c5c3487ad..d5f3e632423 100644 --- a/Tools/nuget/python.nuspec +++ b/Tools/nuget/python.nuspec @@ -13,6 +13,7 @@ python - + + diff --git a/Tools/nuget/python.props b/Tools/nuget/python.props new file mode 100644 index 00000000000..4cc70083ebe --- /dev/null +++ b/Tools/nuget/python.props @@ -0,0 +1,56 @@ + + + + $(MSBuildThisFileDirectory)\..\..\tools + $(PythonHome)\include + $(PythonHome)\libs + $$PYTHON_TAG$$ + $$PYTHON_VERSION$$ + + true + false + false + false + + $$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn) + + + + + $(PythonInclude);%(AdditionalIncludeDirectories) + MultiThreadedDLL + + + $(PythonLibs);%(AdditionalLibraryDirectories) + + + + + + + + <_PythonRuntimeExe Include="$(PythonHome)\python*.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\vcruntime140.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" /> + <_PythonRuntimeExe> + %(Filename)%(Extension) + + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.pyd" /> + <_PythonRuntimeDlls Include="$(PythonHome)\DLLs\*.dll" /> + <_PythonRuntimeDlls> + DLLs\%(Filename)%(Extension) + + <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\distutils\**\*" Condition="$(IncludeDistutils) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" /> + <_PythonRuntimeLib> + Lib\%(RecursiveDir)%(Filename)%(Extension) + + + + + + + diff --git a/Tools/nuget/pythondaily.nuspec b/Tools/nuget/pythondaily.nuspec index 2634ed14a88..ee3343bbb7b 100644 --- a/Tools/nuget/pythondaily.nuspec +++ b/Tools/nuget/pythondaily.nuspec @@ -13,6 +13,7 @@ python - + + diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec index b55c8799c0f..ebfcd6c92a4 100644 --- a/Tools/nuget/pythonx86.nuspec +++ b/Tools/nuget/pythonx86.nuspec @@ -13,6 +13,7 @@ python - + + From solipsis at pitrou.net Thu Sep 7 05:19:38 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 07 Sep 2017 09:19:38 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-21 Message-ID: <20170907091936.7888.FFA2C604427BB430@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_logging leaked [-27, 1, 0] memory blocks, sum=-26 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogXFGdOO', '--timeout', '7200'] From webhook-mailer at python.org Thu Sep 7 12:56:29 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 07 Sep 2017 16:56:29 -0000 Subject: [Python-checkins] bpo-31370: Remove support for threads-less builds (#3385) Message-ID: https://github.com/python/cpython/commit/a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 commit: a6a4dc816d68df04a7d592e0b6af8c7ecc4d4344 branch: master author: Antoine Pitrou committer: Victor Stinner date: 2017-09-07T18:56:24+02:00 summary: bpo-31370: Remove support for threads-less builds (#3385) * Remove Setup.config * Always define WITH_THREAD for compatibility. files: A Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst D Lib/_dummy_thread.py D Lib/dummy_threading.py D Lib/test/test_dummy_thread.py D Lib/test/test_dummy_threading.py D Modules/Setup.config.in M Doc/whatsnew/3.7.rst M Include/Python.h M Include/ceval.h M Include/import.h M Include/pyport.h M Include/pystate.h M Lib/_pydecimal.py M Lib/_pyio.py M Lib/_strptime.py M Lib/bz2.py M Lib/ctypes/test/test_errno.py M Lib/functools.py M Lib/http/cookiejar.py M Lib/logging/__init__.py M Lib/logging/config.py M Lib/logging/handlers.py M Lib/queue.py M Lib/reprlib.py M Lib/sched.py M Lib/socketserver.py M Lib/sqlite3/test/dbapi.py M Lib/subprocess.py M Lib/tempfile.py M Lib/test/fork_wait.py M Lib/test/libregrtest/runtest_mp.py M Lib/test/libregrtest/save_env.py M Lib/test/support/__init__.py M Lib/test/test_asynchat.py M Lib/test/test_asyncio/__init__.py M Lib/test/test_asyncore.py M Lib/test/test_bz2.py M Lib/test/test_capi.py M Lib/test/test_concurrent_futures.py M Lib/test/test_contextlib.py M Lib/test/test_decimal.py M Lib/test/test_docxmlrpc.py M Lib/test/test_email/test_email.py M Lib/test/test_enum.py M Lib/test/test_faulthandler.py M Lib/test/test_fork1.py M Lib/test/test_ftplib.py M Lib/test/test_functools.py M Lib/test/test_gc.py M Lib/test/test_gdb.py M Lib/test/test_hashlib.py M Lib/test/test_httpservers.py M Lib/test/test_idle.py M Lib/test/test_imaplib.py M Lib/test/test_imp.py M Lib/test/test_importlib/test_locks.py M Lib/test/test_io.py M Lib/test/test_logging.py M Lib/test/test_nntplib.py M Lib/test/test_os.py M Lib/test/test_pdb.py M Lib/test/test_poll.py M Lib/test/test_poplib.py M Lib/test/test_pydoc.py M Lib/test/test_queue.py M Lib/test/test_regrtest.py M Lib/test/test_robotparser.py M Lib/test/test_sched.py M Lib/test/test_signal.py M Lib/test/test_smtplib.py M Lib/test/test_socket.py M Lib/test/test_socketserver.py M Lib/test/test_ssl.py M Lib/test/test_subprocess.py M Lib/test/test_sys.py M Lib/test/test_telnetlib.py M Lib/test/test_threaded_import.py M Lib/test/test_threadedtempfile.py M Lib/test/test_threading.py M Lib/test/test_threading_local.py M Lib/test/test_time.py M Lib/test/test_tracemalloc.py M Lib/test/test_urllib2_localnet.py M Lib/test/test_venv.py M Lib/test/test_weakref.py M Lib/test/test_xmlrpc.py M Lib/threading.py M Lib/trace.py M Lib/zipfile.py M Makefile.pre.in M Modules/Setup.dist M Modules/_blake2/blake2b_impl.c M Modules/_blake2/blake2s_impl.c M Modules/_bz2module.c M Modules/_ctypes/_ctypes.c M Modules/_ctypes/callbacks.c M Modules/_ctypes/callproc.c M Modules/_hashopenssl.c M Modules/_io/bufferedio.c M Modules/_lzmamodule.c M Modules/_sha3/sha3module.c M Modules/_sqlite/connection.c M Modules/_sqlite/module.c M Modules/_ssl.c M Modules/_testcapimodule.c M Modules/_threadmodule.c M Modules/_tkinter.c M Modules/_tracemalloc.c M Modules/clinic/signalmodule.c.h M Modules/faulthandler.c M Modules/hashlib.h M Modules/posixmodule.c M Modules/readline.c M Modules/signalmodule.c M Modules/socketmodule.c M Modules/zlibmodule.c M Objects/object.c M Objects/obmalloc.c M PC/config.c M Parser/myreadline.c M Parser/pgenmain.c M Programs/_testembed.c M Python/ceval.c M Python/fileutils.c M Python/import.c M Python/mystrtoul.c M Python/pylifecycle.c M Python/pystate.c M Python/sysmodule.c M Python/traceback.c M aclocal.m4 M configure M configure.ac M pyconfig.h.in M setup.py diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 48c59b2cd7f..14c2182e26c 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -344,6 +344,9 @@ Build and C API Changes download a copy of 32-bit Python for this purpose. (Contributed by Zachary Ware in :issue:`30450`.) +* Support for building ``--without-threads`` is removed. + (Contributed by Antoine Pitrou in :issue:`31370`.). + Deprecated ========== diff --git a/Include/Python.h b/Include/Python.h index 061d693f34b..20051e7ff08 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -18,7 +18,7 @@ #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) +#if defined(__sgi) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif diff --git a/Include/ceval.h b/Include/ceval.h index b2d57cbd6f7..2028a9ef5bc 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -183,8 +183,6 @@ PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(struct _frame *f, int exc); PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); -#ifdef WITH_THREAD - PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); PyAPI_FUNC(void) PyEval_InitThreads(void); #ifndef Py_LIMITED_API @@ -213,15 +211,6 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ } -#else /* !WITH_THREAD */ - -#define Py_BEGIN_ALLOW_THREADS { -#define Py_BLOCK_THREADS -#define Py_UNBLOCK_THREADS -#define Py_END_ALLOW_THREADS } - -#endif /* !WITH_THREAD */ - #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); diff --git a/Include/import.h b/Include/import.h index 4ab14d72816..5463c0cb960 100644 --- a/Include/import.h +++ b/Include/import.h @@ -100,13 +100,8 @@ PyAPI_FUNC(int) PyImport_ImportFrozenModule( ); #ifndef Py_LIMITED_API -#ifdef WITH_THREAD PyAPI_FUNC(void) _PyImport_AcquireLock(void); PyAPI_FUNC(int) _PyImport_ReleaseLock(void); -#else -#define _PyImport_AcquireLock() -#define _PyImport_ReleaseLock() 1 -#endif PyAPI_FUNC(void) _PyImport_ReInitLock(void); diff --git a/Include/pyport.h b/Include/pyport.h index e3c4f899c0a..6c91898b44f 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -797,4 +797,12 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler; #include #endif +/* This macro used to tell whether Python was built with multithreading + * enabled. Now multithreading is always enabled, but keep the macro + * for compatibility. + */ +#ifndef WITH_THREAD +#define WITH_THREAD +#endif + #endif /* Py_PYPORT_H */ diff --git a/Include/pystate.h b/Include/pystate.h index 8a92f3ec3ed..6229236972a 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -218,12 +218,10 @@ PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyThreadState_DeleteExcept(PyThreadState *tstate); #endif /* !Py_LIMITED_API */ -#ifdef WITH_THREAD PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyGILState_Reinit(void); #endif /* !Py_LIMITED_API */ -#endif /* Return the current thread state. The global interpreter lock must be held. * When the current thread state is NULL, this issues a fatal error (so that @@ -257,7 +255,6 @@ typedef enum {PyGILState_LOCKED, PyGILState_UNLOCKED} PyGILState_STATE; -#ifdef WITH_THREAD /* Ensure that the current thread is ready to call the Python C API, regardless of the current state of Python, or of its @@ -319,7 +316,6 @@ PyAPI_FUNC(int) PyGILState_Check(void); PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); #endif -#endif /* #ifdef WITH_THREAD */ /* The implementation of sys._current_frames() Returns a dict mapping thread id to that thread's current frame. diff --git a/Lib/_dummy_thread.py b/Lib/_dummy_thread.py deleted file mode 100644 index a2cae54b058..00000000000 --- a/Lib/_dummy_thread.py +++ /dev/null @@ -1,163 +0,0 @@ -"""Drop-in replacement for the thread module. - -Meant to be used as a brain-dead substitute so that threaded code does -not need to be rewritten for when the thread module is not present. - -Suggested usage is:: - - try: - import _thread - except ImportError: - import _dummy_thread as _thread - -""" -# Exports only things specified by thread documentation; -# skipping obsolete synonyms allocate(), start_new(), exit_thread(). -__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', - 'interrupt_main', 'LockType'] - -# A dummy value -TIMEOUT_MAX = 2**31 - -# NOTE: this module can be imported early in the extension building process, -# and so top level imports of other modules should be avoided. Instead, all -# imports are done when needed on a function-by-function basis. Since threads -# are disabled, the import lock should not be an issue anyway (??). - -error = RuntimeError - -def start_new_thread(function, args, kwargs={}): - """Dummy implementation of _thread.start_new_thread(). - - Compatibility is maintained by making sure that ``args`` is a - tuple and ``kwargs`` is a dictionary. If an exception is raised - and it is SystemExit (which can be done by _thread.exit()) it is - caught and nothing is done; all other exceptions are printed out - by using traceback.print_exc(). - - If the executed function calls interrupt_main the KeyboardInterrupt will be - raised when the function returns. - - """ - if type(args) != type(tuple()): - raise TypeError("2nd arg must be a tuple") - if type(kwargs) != type(dict()): - raise TypeError("3rd arg must be a dict") - global _main - _main = False - try: - function(*args, **kwargs) - except SystemExit: - pass - except: - import traceback - traceback.print_exc() - _main = True - global _interrupt - if _interrupt: - _interrupt = False - raise KeyboardInterrupt - -def exit(): - """Dummy implementation of _thread.exit().""" - raise SystemExit - -def get_ident(): - """Dummy implementation of _thread.get_ident(). - - Since this module should only be used when _threadmodule is not - available, it is safe to assume that the current process is the - only thread. Thus a constant can be safely returned. - """ - return 1 - -def allocate_lock(): - """Dummy implementation of _thread.allocate_lock().""" - return LockType() - -def stack_size(size=None): - """Dummy implementation of _thread.stack_size().""" - if size is not None: - raise error("setting thread stack size not supported") - return 0 - -def _set_sentinel(): - """Dummy implementation of _thread._set_sentinel().""" - return LockType() - -class LockType(object): - """Class implementing dummy implementation of _thread.LockType. - - Compatibility is maintained by maintaining self.locked_status - which is a boolean that stores the state of the lock. Pickling of - the lock, though, should not be done since if the _thread module is - then used with an unpickled ``lock()`` from here problems could - occur from this class not having atomic methods. - - """ - - def __init__(self): - self.locked_status = False - - def acquire(self, waitflag=None, timeout=-1): - """Dummy implementation of acquire(). - - For blocking calls, self.locked_status is automatically set to - True and returned appropriately based on value of - ``waitflag``. If it is non-blocking, then the value is - actually checked and not set if it is already acquired. This - is all done so that threading.Condition's assert statements - aren't triggered and throw a little fit. - - """ - if waitflag is None or waitflag: - self.locked_status = True - return True - else: - if not self.locked_status: - self.locked_status = True - return True - else: - if timeout > 0: - import time - time.sleep(timeout) - return False - - __enter__ = acquire - - def __exit__(self, typ, val, tb): - self.release() - - def release(self): - """Release the dummy lock.""" - # XXX Perhaps shouldn't actually bother to test? Could lead - # to problems for complex, threaded code. - if not self.locked_status: - raise error - self.locked_status = False - return True - - def locked(self): - return self.locked_status - - def __repr__(self): - return "<%s %s.%s object at %s>" % ( - "locked" if self.locked_status else "unlocked", - self.__class__.__module__, - self.__class__.__qualname__, - hex(id(self)) - ) - -# Used to signal that interrupt_main was called in a "thread" -_interrupt = False -# True when not executing in a "thread" -_main = True - -def interrupt_main(): - """Set _interrupt flag to True to have start_new_thread raise - KeyboardInterrupt upon exiting.""" - if _main: - raise KeyboardInterrupt - else: - global _interrupt - _interrupt = True diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index edabf72aa7a..a43c75fc3e5 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -436,75 +436,34 @@ class FloatOperation(DecimalException, TypeError): # work for older Pythons. If threads are not part of the build, create a # mock threading object with threading.local() returning the module namespace. -try: - import threading -except ImportError: - # Python was compiled without threads; create a mock object instead - class MockThreading(object): - def local(self, sys=sys): - return sys.modules[__xname__] - threading = MockThreading() - del MockThreading - -try: - threading.local - -except AttributeError: - - # To fix reloading, force it to create a new context - # Old contexts have different exceptions in their dicts, making problems. - if hasattr(threading.current_thread(), '__decimal_context__'): - del threading.current_thread().__decimal_context__ - - def setcontext(context): - """Set this thread's context to context.""" - if context in (DefaultContext, BasicContext, ExtendedContext): - context = context.copy() - context.clear_flags() - threading.current_thread().__decimal_context__ = context - - def getcontext(): - """Returns this thread's context. - - If this thread does not yet have a context, returns - a new context and sets this thread's context. - New contexts are copies of DefaultContext. - """ - try: - return threading.current_thread().__decimal_context__ - except AttributeError: - context = Context() - threading.current_thread().__decimal_context__ = context - return context +import threading -else: +local = threading.local() +if hasattr(local, '__decimal_context__'): + del local.__decimal_context__ - local = threading.local() - if hasattr(local, '__decimal_context__'): - del local.__decimal_context__ +def getcontext(_local=local): + """Returns this thread's context. - def getcontext(_local=local): - """Returns this thread's context. - - If this thread does not yet have a context, returns - a new context and sets this thread's context. - New contexts are copies of DefaultContext. - """ - try: - return _local.__decimal_context__ - except AttributeError: - context = Context() - _local.__decimal_context__ = context - return context - - def setcontext(context, _local=local): - """Set this thread's context to context.""" - if context in (DefaultContext, BasicContext, ExtendedContext): - context = context.copy() - context.clear_flags() + If this thread does not yet have a context, returns + a new context and sets this thread's context. + New contexts are copies of DefaultContext. + """ + try: + return _local.__decimal_context__ + except AttributeError: + context = Context() _local.__decimal_context__ = context + return context + +def setcontext(context, _local=local): + """Set this thread's context to context.""" + if context in (DefaultContext, BasicContext, ExtendedContext): + context = context.copy() + context.clear_flags() + _local.__decimal_context__ = context - del threading, local # Don't contaminate the namespace +del threading, local # Don't contaminate the namespace def localcontext(ctx=None): """Return a context manager for a copy of the supplied context diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 4653847bcb1..1e105f27734 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -9,10 +9,7 @@ import stat import sys # Import _thread instead of threading to reduce startup cost -try: - from _thread import allocate_lock as Lock -except ImportError: - from _dummy_thread import allocate_lock as Lock +from _thread import allocate_lock as Lock if sys.platform in {'win32', 'cygwin'}: from msvcrt import setmode as _setmode else: diff --git a/Lib/_strptime.py b/Lib/_strptime.py index fe9436115ac..284175d0cfe 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -19,10 +19,7 @@ from datetime import (date as datetime_date, timedelta as datetime_timedelta, timezone as datetime_timezone) -try: - from _thread import allocate_lock as _thread_allocate_lock -except ImportError: - from _dummy_thread import allocate_lock as _thread_allocate_lock +from _thread import allocate_lock as _thread_allocate_lock __all__ = [] diff --git a/Lib/bz2.py b/Lib/bz2.py index 6f56328b9b2..3924aaed167 100644 --- a/Lib/bz2.py +++ b/Lib/bz2.py @@ -14,11 +14,7 @@ import os import warnings import _compression - -try: - from threading import RLock -except ImportError: - from dummy_threading import RLock +from threading import RLock from _bz2 import BZ2Compressor, BZ2Decompressor diff --git a/Lib/ctypes/test/test_errno.py b/Lib/ctypes/test/test_errno.py index 4690a0d8717..3685164dde6 100644 --- a/Lib/ctypes/test/test_errno.py +++ b/Lib/ctypes/test/test_errno.py @@ -1,10 +1,8 @@ import unittest, os, errno +import threading + from ctypes import * from ctypes.util import find_library -try: - import threading -except ImportError: - threading = None class Test(unittest.TestCase): def test_open(self): @@ -25,25 +23,24 @@ def test_open(self): self.assertEqual(set_errno(32), errno.ENOENT) self.assertEqual(get_errno(), 32) - if threading: - def _worker(): - set_errno(0) + def _worker(): + set_errno(0) - libc = CDLL(libc_name, use_errno=False) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - libc_open.argtypes = c_char_p, c_int - self.assertEqual(libc_open(b"", 0), -1) - self.assertEqual(get_errno(), 0) + libc = CDLL(libc_name, use_errno=False) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + libc_open.argtypes = c_char_p, c_int + self.assertEqual(libc_open(b"", 0), -1) + self.assertEqual(get_errno(), 0) - t = threading.Thread(target=_worker) - t.start() - t.join() + t = threading.Thread(target=_worker) + t.start() + t.join() - self.assertEqual(get_errno(), 32) - set_errno(0) + self.assertEqual(get_errno(), 32) + set_errno(0) @unittest.skipUnless(os.name == "nt", 'Test specific to Windows') def test_GetLastError(self): diff --git a/Lib/dummy_threading.py b/Lib/dummy_threading.py deleted file mode 100644 index 1bb7eee338a..00000000000 --- a/Lib/dummy_threading.py +++ /dev/null @@ -1,78 +0,0 @@ -"""Faux ``threading`` version using ``dummy_thread`` instead of ``thread``. - -The module ``_dummy_threading`` is added to ``sys.modules`` in order -to not have ``threading`` considered imported. Had ``threading`` been -directly imported it would have made all subsequent imports succeed -regardless of whether ``_thread`` was available which is not desired. - -""" -from sys import modules as sys_modules - -import _dummy_thread - -# Declaring now so as to not have to nest ``try``s to get proper clean-up. -holding_thread = False -holding_threading = False -holding__threading_local = False - -try: - # Could have checked if ``_thread`` was not in sys.modules and gone - # a different route, but decided to mirror technique used with - # ``threading`` below. - if '_thread' in sys_modules: - held_thread = sys_modules['_thread'] - holding_thread = True - # Must have some module named ``_thread`` that implements its API - # in order to initially import ``threading``. - sys_modules['_thread'] = sys_modules['_dummy_thread'] - - if 'threading' in sys_modules: - # If ``threading`` is already imported, might as well prevent - # trying to import it more than needed by saving it if it is - # already imported before deleting it. - held_threading = sys_modules['threading'] - holding_threading = True - del sys_modules['threading'] - - if '_threading_local' in sys_modules: - # If ``_threading_local`` is already imported, might as well prevent - # trying to import it more than needed by saving it if it is - # already imported before deleting it. - held__threading_local = sys_modules['_threading_local'] - holding__threading_local = True - del sys_modules['_threading_local'] - - import threading - # Need a copy of the code kept somewhere... - sys_modules['_dummy_threading'] = sys_modules['threading'] - del sys_modules['threading'] - sys_modules['_dummy__threading_local'] = sys_modules['_threading_local'] - del sys_modules['_threading_local'] - from _dummy_threading import * - from _dummy_threading import __all__ - -finally: - # Put back ``threading`` if we overwrote earlier - - if holding_threading: - sys_modules['threading'] = held_threading - del held_threading - del holding_threading - - # Put back ``_threading_local`` if we overwrote earlier - - if holding__threading_local: - sys_modules['_threading_local'] = held__threading_local - del held__threading_local - del holding__threading_local - - # Put back ``thread`` if we overwrote, else del the entry we made - if holding_thread: - sys_modules['_thread'] = held_thread - del held_thread - else: - del sys_modules['_thread'] - del holding_thread - - del _dummy_thread - del sys_modules diff --git a/Lib/functools.py b/Lib/functools.py index 23ad1609300..25075de5b40 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -22,13 +22,7 @@ from types import MappingProxyType from weakref import WeakKeyDictionary from reprlib import recursive_repr -try: - from _thread import RLock -except ImportError: - class RLock: - 'Dummy reentrant lock for builds without threads' - def __enter__(self): pass - def __exit__(self, exctype, excinst, exctb): pass +from _thread import RLock ################################################################################ diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index adf956d66a0..e0f1032b281 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -33,10 +33,7 @@ import re import time import urllib.parse, urllib.request -try: - import threading as _threading -except ImportError: - import dummy_threading as _threading +import threading as _threading import http.client # only for the default HTTP port from calendar import timegm diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 83db8273380..19b96b813cf 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -37,10 +37,7 @@ 'warn', 'warning', 'getLogRecordFactory', 'setLogRecordFactory', 'lastResort', 'raiseExceptions'] -try: - import threading -except ImportError: #pragma: no cover - threading = None +import threading __author__ = "Vinay Sajip " __status__ = "production" @@ -210,11 +207,7 @@ def _checkLevel(level): #the lock would already have been acquired - so we need an RLock. #The same argument applies to Loggers and Manager.loggerDict. # -if threading: - _lock = threading.RLock() -else: #pragma: no cover - _lock = None - +_lock = threading.RLock() def _acquireLock(): """ @@ -295,7 +288,7 @@ def __init__(self, name, level, pathname, lineno, self.created = ct self.msecs = (ct - int(ct)) * 1000 self.relativeCreated = (self.created - _startTime) * 1000 - if logThreads and threading: + if logThreads: self.thread = threading.get_ident() self.threadName = threading.current_thread().name else: # pragma: no cover @@ -799,10 +792,7 @@ def createLock(self): """ Acquire a thread lock for serializing access to the underlying I/O. """ - if threading: - self.lock = threading.RLock() - else: #pragma: no cover - self.lock = None + self.lock = threading.RLock() def acquire(self): """ diff --git a/Lib/logging/config.py b/Lib/logging/config.py index b3f4e28796a..c16a75a0f1e 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -31,14 +31,9 @@ import re import struct import sys +import threading import traceback -try: - import _thread as thread - import threading -except ImportError: #pragma: no cover - thread = None - from socketserver import ThreadingTCPServer, StreamRequestHandler @@ -816,8 +811,6 @@ def listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None): normal. Note that you can return transformed bytes, e.g. by decrypting the bytes passed in. """ - if not thread: #pragma: no cover - raise NotImplementedError("listen() needs threading to work") class ConfigStreamHandler(StreamRequestHandler): """ diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index b5fdfbc6839..a815f033e60 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -26,10 +26,7 @@ import logging, socket, os, pickle, struct, time, re from stat import ST_DEV, ST_INO, ST_MTIME import queue -try: - import threading -except ImportError: #pragma: no cover - threading = None +import threading # # Some constants... @@ -1395,110 +1392,110 @@ def emit(self, record): except Exception: self.handleError(record) -if threading: - class QueueListener(object): - """ - This class implements an internal threaded listener which watches for - LogRecords being added to a queue, removes them and passes them to a - list of handlers for processing. - """ - _sentinel = None - - def __init__(self, queue, *handlers, respect_handler_level=False): - """ - Initialise an instance with the specified queue and - handlers. - """ - self.queue = queue - self.handlers = handlers - self._thread = None - self.respect_handler_level = respect_handler_level - - def dequeue(self, block): - """ - Dequeue a record and return it, optionally blocking. - - The base implementation uses get. You may want to override this method - if you want to use timeouts or work with custom queue implementations. - """ - return self.queue.get(block) - - def start(self): - """ - Start the listener. - - This starts up a background thread to monitor the queue for - LogRecords to process. - """ - self._thread = t = threading.Thread(target=self._monitor) - t.daemon = True - t.start() - - def prepare(self , record): - """ - Prepare a record for handling. - - This method just returns the passed-in record. You may want to - override this method if you need to do any custom marshalling or - manipulation of the record before passing it to the handlers. - """ - return record - - def handle(self, record): - """ - Handle a record. - - This just loops through the handlers offering them the record - to handle. - """ - record = self.prepare(record) - for handler in self.handlers: - if not self.respect_handler_level: - process = True - else: - process = record.levelno >= handler.level - if process: - handler.handle(record) - - def _monitor(self): - """ - Monitor the queue for records, and ask the handler - to deal with them. - - This method runs on a separate, internal thread. - The thread will terminate if it sees a sentinel object in the queue. - """ - q = self.queue - has_task_done = hasattr(q, 'task_done') - while True: - try: - record = self.dequeue(True) - if record is self._sentinel: - break - self.handle(record) - if has_task_done: - q.task_done() - except queue.Empty: + +class QueueListener(object): + """ + This class implements an internal threaded listener which watches for + LogRecords being added to a queue, removes them and passes them to a + list of handlers for processing. + """ + _sentinel = None + + def __init__(self, queue, *handlers, respect_handler_level=False): + """ + Initialise an instance with the specified queue and + handlers. + """ + self.queue = queue + self.handlers = handlers + self._thread = None + self.respect_handler_level = respect_handler_level + + def dequeue(self, block): + """ + Dequeue a record and return it, optionally blocking. + + The base implementation uses get. You may want to override this method + if you want to use timeouts or work with custom queue implementations. + """ + return self.queue.get(block) + + def start(self): + """ + Start the listener. + + This starts up a background thread to monitor the queue for + LogRecords to process. + """ + self._thread = t = threading.Thread(target=self._monitor) + t.daemon = True + t.start() + + def prepare(self , record): + """ + Prepare a record for handling. + + This method just returns the passed-in record. You may want to + override this method if you need to do any custom marshalling or + manipulation of the record before passing it to the handlers. + """ + return record + + def handle(self, record): + """ + Handle a record. + + This just loops through the handlers offering them the record + to handle. + """ + record = self.prepare(record) + for handler in self.handlers: + if not self.respect_handler_level: + process = True + else: + process = record.levelno >= handler.level + if process: + handler.handle(record) + + def _monitor(self): + """ + Monitor the queue for records, and ask the handler + to deal with them. + + This method runs on a separate, internal thread. + The thread will terminate if it sees a sentinel object in the queue. + """ + q = self.queue + has_task_done = hasattr(q, 'task_done') + while True: + try: + record = self.dequeue(True) + if record is self._sentinel: break + self.handle(record) + if has_task_done: + q.task_done() + except queue.Empty: + break + + def enqueue_sentinel(self): + """ + This is used to enqueue the sentinel record. + + The base implementation uses put_nowait. You may want to override this + method if you want to use timeouts or work with custom queue + implementations. + """ + self.queue.put_nowait(self._sentinel) - def enqueue_sentinel(self): - """ - This is used to enqueue the sentinel record. - - The base implementation uses put_nowait. You may want to override this - method if you want to use timeouts or work with custom queue - implementations. - """ - self.queue.put_nowait(self._sentinel) - - def stop(self): - """ - Stop the listener. - - This asks the thread to terminate, and then waits for it to do so. - Note that if you don't call this before your application exits, there - may be some records still left on the queue, which won't be processed. - """ - self.enqueue_sentinel() - self._thread.join() - self._thread = None + def stop(self): + """ + Stop the listener. + + This asks the thread to terminate, and then waits for it to do so. + Note that if you don't call this before your application exits, there + may be some records still left on the queue, which won't be processed. + """ + self.enqueue_sentinel() + self._thread.join() + self._thread = None diff --git a/Lib/queue.py b/Lib/queue.py index 572425e844c..c803b96deb0 100644 --- a/Lib/queue.py +++ b/Lib/queue.py @@ -1,9 +1,6 @@ '''A multi-producer, multi-consumer queue.''' -try: - import threading -except ImportError: - import dummy_threading as threading +import threading from collections import deque from heapq import heappush, heappop from time import monotonic as time diff --git a/Lib/reprlib.py b/Lib/reprlib.py index 40d991fa364..616b3439b5d 100644 --- a/Lib/reprlib.py +++ b/Lib/reprlib.py @@ -4,10 +4,7 @@ import builtins from itertools import islice -try: - from _thread import get_ident -except ImportError: - from _dummy_thread import get_ident +from _thread import get_ident def recursive_repr(fillvalue='...'): 'Decorator to make a repr function return fillvalue for a recursive call' diff --git a/Lib/sched.py b/Lib/sched.py index 3d8c011a5cf..ff87874a3a4 100644 --- a/Lib/sched.py +++ b/Lib/sched.py @@ -26,10 +26,7 @@ import time import heapq from collections import namedtuple -try: - import threading -except ImportError: - import dummy_threading as threading +import threading from time import monotonic as _time __all__ = ["scheduler"] diff --git a/Lib/socketserver.py b/Lib/socketserver.py index df171149501..721eb50fbe6 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -127,10 +127,7 @@ class will essentially render the service "deaf" while one request is import selectors import os import sys -try: - import threading -except ImportError: - import dummy_threading as threading +import threading from io import BufferedIOBase from time import monotonic as time diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py index cb85814ab85..12c9fb460fd 100644 --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -21,12 +21,9 @@ # misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. +import threading import unittest import sqlite3 as sqlite -try: - import threading -except ImportError: - threading = None from test.support import TESTFN, unlink @@ -503,7 +500,6 @@ def CheckLastRowIDInsertOR(self): self.assertEqual(results, expected) - at unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): def setUp(self): self.con = sqlite.connect(":memory:") diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 25e56984933..f61ff0c3946 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -138,10 +138,7 @@ def __init__(self, *, dwFlags=0, hStdInput=None, hStdOutput=None, import _posixsubprocess import select import selectors - try: - import threading - except ImportError: - import dummy_threading as threading + import threading # When select or poll has indicated that the file is writable, # we can write up to _PIPE_BUF bytes without risk of blocking. diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 61462357c72..71ecafa5305 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -44,11 +44,7 @@ import errno as _errno from random import Random as _Random import weakref as _weakref - -try: - import _thread -except ImportError: - import _dummy_thread as _thread +import _thread _allocate_lock = _thread.allocate_lock _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 6af79ad5d4d..9850b06a318 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -10,9 +10,9 @@ """ import os, sys, time, unittest +import threading import test.support as support -threading = support.import_module('threading') LONGSLEEP = 2 SHORTSLEEP = 0.5 diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py index 779ff01a649..31b830d75f4 100644 --- a/Lib/test/libregrtest/runtest_mp.py +++ b/Lib/test/libregrtest/runtest_mp.py @@ -3,15 +3,11 @@ import os import queue import sys +import threading import time import traceback import types from test import support -try: - import threading -except ImportError: - print("Multiprocess option requires thread support") - sys.exit(2) from test.libregrtest.runtest import ( runtest, INTERRUPTED, CHILD_ERROR, PROGRESS_MIN_TIME, diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py index 3c45621390b..45b365d4563 100644 --- a/Lib/test/libregrtest/save_env.py +++ b/Lib/test/libregrtest/save_env.py @@ -5,13 +5,10 @@ import shutil import sys import sysconfig +import threading import warnings from test import support try: - import threading -except ImportError: - threading = None -try: import _multiprocessing, multiprocessing.process except ImportError: multiprocessing = None @@ -181,13 +178,9 @@ def restore_sys_warnoptions(self, saved_options): # Controlling dangling references to Thread objects can make it easier # to track reference leaks. def get_threading__dangling(self): - if not threading: - return None # This copies the weakrefs without making any strong reference return threading._dangling.copy() def restore_threading__dangling(self, saved): - if not threading: - return threading._dangling.clear() threading._dangling.update(saved) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 0235498e2a9..bfceba151a1 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -25,6 +25,8 @@ import sys import sysconfig import tempfile +import _thread +import threading import time import types import unittest @@ -32,11 +34,6 @@ import warnings try: - import _thread, threading -except ImportError: - _thread = None - threading = None -try: import multiprocessing.process except ImportError: multiprocessing = None @@ -2028,16 +2025,11 @@ def modules_cleanup(oldmodules): # at the end of a test run. def threading_setup(): - if _thread: - return _thread._count(), threading._dangling.copy() - else: - return 1, () + return _thread._count(), threading._dangling.copy() def threading_cleanup(*original_values): global environment_altered - if not _thread: - return _MAX_COUNT = 100 t0 = time.monotonic() for count in range(_MAX_COUNT): @@ -2061,9 +2053,6 @@ def reap_threads(func): ensure that the threads are cleaned up even when the test fails. If threading is unavailable this function does nothing. """ - if not _thread: - return func - @functools.wraps(func) def decorator(*args): key = threading_setup() diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 0eba76db478..2362834b85f 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -2,110 +2,104 @@ from test import support -# If this fails, the test will be skipped. -thread = support.import_module('_thread') - import asynchat import asyncore import errno import socket import sys +import _thread as thread +import threading import time import unittest import unittest.mock -try: - import threading -except ImportError: - threading = None HOST = support.HOST SERVER_QUIT = b'QUIT\n' TIMEOUT = 3.0 -if threading: - class echo_server(threading.Thread): - # parameter to determine the number of bytes passed back to the - # client each send - chunk_size = 1 - - def __init__(self, event): - threading.Thread.__init__(self) - self.event = event - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = support.bind_port(self.sock) - # This will be set if the client wants us to wait before echoing - # data back. - self.start_resend_event = None - - def run(self): - self.sock.listen() - self.event.set() - conn, client = self.sock.accept() - self.buffer = b"" - # collect data until quit message is seen - while SERVER_QUIT not in self.buffer: - data = conn.recv(1) - if not data: - break - self.buffer = self.buffer + data - - # remove the SERVER_QUIT message - self.buffer = self.buffer.replace(SERVER_QUIT, b'') - - if self.start_resend_event: - self.start_resend_event.wait() - - # re-send entire set of collected data - try: - # this may fail on some tests, such as test_close_when_done, - # since the client closes the channel when it's done sending - while self.buffer: - n = conn.send(self.buffer[:self.chunk_size]) - time.sleep(0.001) - self.buffer = self.buffer[n:] - except: - pass - - conn.close() - self.sock.close() - class echo_client(asynchat.async_chat): - - def __init__(self, terminator, server_port): - asynchat.async_chat.__init__(self) - self.contents = [] - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.connect((HOST, server_port)) - self.set_terminator(terminator) - self.buffer = b"" - - def handle_connect(self): +class echo_server(threading.Thread): + # parameter to determine the number of bytes passed back to the + # client each send + chunk_size = 1 + + def __init__(self, event): + threading.Thread.__init__(self) + self.event = event + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = support.bind_port(self.sock) + # This will be set if the client wants us to wait before echoing + # data back. + self.start_resend_event = None + + def run(self): + self.sock.listen() + self.event.set() + conn, client = self.sock.accept() + self.buffer = b"" + # collect data until quit message is seen + while SERVER_QUIT not in self.buffer: + data = conn.recv(1) + if not data: + break + self.buffer = self.buffer + data + + # remove the SERVER_QUIT message + self.buffer = self.buffer.replace(SERVER_QUIT, b'') + + if self.start_resend_event: + self.start_resend_event.wait() + + # re-send entire set of collected data + try: + # this may fail on some tests, such as test_close_when_done, + # since the client closes the channel when it's done sending + while self.buffer: + n = conn.send(self.buffer[:self.chunk_size]) + time.sleep(0.001) + self.buffer = self.buffer[n:] + except: + pass + + conn.close() + self.sock.close() + +class echo_client(asynchat.async_chat): + + def __init__(self, terminator, server_port): + asynchat.async_chat.__init__(self) + self.contents = [] + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.connect((HOST, server_port)) + self.set_terminator(terminator) + self.buffer = b"" + + def handle_connect(self): + pass + + if sys.platform == 'darwin': + # select.poll returns a select.POLLHUP at the end of the tests + # on darwin, so just ignore it + def handle_expt(self): pass - if sys.platform == 'darwin': - # select.poll returns a select.POLLHUP at the end of the tests - # on darwin, so just ignore it - def handle_expt(self): - pass - - def collect_incoming_data(self, data): - self.buffer += data + def collect_incoming_data(self, data): + self.buffer += data - def found_terminator(self): - self.contents.append(self.buffer) - self.buffer = b"" + def found_terminator(self): + self.contents.append(self.buffer) + self.buffer = b"" - def start_echo_server(): - event = threading.Event() - s = echo_server(event) - s.start() - event.wait() - event.clear() - time.sleep(0.01) # Give server time to start accepting. - return s, event +def start_echo_server(): + event = threading.Event() + s = echo_server(event) + s.start() + event.wait() + event.clear() + time.sleep(0.01) # Give server time to start accepting. + return s, event - at unittest.skipUnless(threading, 'Threading required for this test.') class TestAsynchat(unittest.TestCase): usepoll = False diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py index 80a9eeaa8ea..c77c7a81278 100644 --- a/Lib/test/test_asyncio/__init__.py +++ b/Lib/test/test_asyncio/__init__.py @@ -1,8 +1,6 @@ import os from test.support import load_package_tests, import_module -# Skip tests if we don't have threading. -import_module('threading') # Skip tests if we don't have concurrent.futures. import_module('concurrent.futures') diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 07edf2275be..c8e97276ff6 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -7,6 +7,7 @@ import time import errno import struct +import threading from test import support from io import BytesIO @@ -14,10 +15,6 @@ if support.PGO: raise unittest.SkipTest("test is not helpful for PGO") -try: - import threading -except ImportError: - threading = None TIMEOUT = 3 HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX') @@ -326,7 +323,6 @@ def setUp(self): def tearDown(self): asyncore.close_all() - @unittest.skipUnless(threading, 'Threading required for this test.') @support.reap_threads def test_send(self): evt = threading.Event() @@ -776,7 +772,6 @@ def test_set_reuse_addr(self): self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)) - @unittest.skipUnless(threading, 'Threading required for this test.') @support.reap_threads def test_quick_connect(self): # see: http://bugs.python.org/issue10340 diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py index e76b2832613..58dbf96d3c8 100644 --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -10,13 +10,10 @@ import random import shutil import subprocess +import threading from test.support import unlink import _compression -try: - import threading -except ImportError: - threading = None # Skip tests if the bz2 module doesn't exist. bz2 = support.import_module('bz2') @@ -491,7 +488,6 @@ def testContextProtocol(self): else: self.fail("1/0 didn't raise an exception") - @unittest.skipUnless(threading, 'Threading required for this test.') def testThreading(self): # Issue #7205: Using a BZ2File from several threads shouldn't deadlock. data = b"1" * 2**20 @@ -504,13 +500,6 @@ def comp(): with support.start_threads(threads): pass - def testWithoutThreading(self): - module = support.import_fresh_module("bz2", blocked=("threading",)) - with module.BZ2File(self.filename, "wb") as f: - f.write(b"abc") - with module.BZ2File(self.filename, "rb") as f: - self.assertEqual(f.read(), b"abc") - def testMixedIterationAndReads(self): self.createTempFile() linelen = len(self.TEXT_LINES[0]) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index c3a04b49df6..1b826ee8d9a 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -11,6 +11,7 @@ import sys import sysconfig import textwrap +import threading import time import unittest from test import support @@ -20,10 +21,7 @@ import _posixsubprocess except ImportError: _posixsubprocess = None -try: - import threading -except ImportError: - threading = None + # Skip this test if the _testcapi module isn't available. _testcapi = support.import_module('_testcapi') @@ -52,7 +50,6 @@ def test_instancemethod(self): self.assertEqual(testfunction.attribute, "test") self.assertRaises(AttributeError, setattr, inst.testfunction, "attribute", "test") - @unittest.skipUnless(threading, 'Threading required for this test.') def test_no_FatalError_infinite_loop(self): with support.SuppressCrashReport(): p = subprocess.Popen([sys.executable, "-c", @@ -276,7 +273,6 @@ class C(): pass self.assertIn(b'MemoryError 3 30', out) - at unittest.skipUnless(threading, 'Threading required for this test.') class TestPendingCalls(unittest.TestCase): def pendingcalls_submit(self, l, n): @@ -685,7 +681,6 @@ def test_positional_only(self): parse((1,), {}, 'O|OO', ['', 'a', '']) - at unittest.skipUnless(threading, 'Threading required for this test.') class TestThreadState(unittest.TestCase): @support.reap_threads @@ -762,7 +757,6 @@ def test_api_misuse(self): regex = regex.format(ptr=self.PTR_REGEX) self.assertRegex(out, regex) - @unittest.skipUnless(threading, 'Test requires a GIL (multithreading)') def check_malloc_without_gil(self, code): out = self.check(code) expected = ('Fatal Python error: Python memory allocator called ' diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 03f8d1d7112..a888dcacc49 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -4,10 +4,6 @@ test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') -# import threading after _multiprocessing to raise a more relevant error -# message: "No module named _multiprocessing". _multiprocessing is not compiled -# without thread support. -test.support.import_module('threading') from test.support.script_helper import assert_python_ok diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index 2301f759d80..64b6578ff94 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -3,13 +3,10 @@ import io import sys import tempfile +import threading import unittest from contextlib import * # Tests __all__ from test import support -try: - import threading -except ImportError: - threading = None class TestAbstractContextManager(unittest.TestCase): @@ -275,7 +272,6 @@ def testWithOpen(self): finally: support.unlink(tfn) - at unittest.skipUnless(threading, 'Threading required for this test.') class LockContextTestCase(unittest.TestCase): def boilerPlate(self, lock, locked): diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 53f71caa3f7..5d9da0e3745 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -38,10 +38,7 @@ run_with_locale, cpython_only) import random import inspect -try: - import threading -except ImportError: - threading = None +import threading C = import_fresh_module('decimal', fresh=['_decimal']) @@ -1625,10 +1622,10 @@ def test_threading(self): DefaultContext.Emax = save_emax DefaultContext.Emin = save_emin - at unittest.skipUnless(threading, 'threading required') + class CThreadingTest(ThreadingTest): decimal = C - at unittest.skipUnless(threading, 'threading required') + class PyThreadingTest(ThreadingTest): decimal = P diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py index 00903337c07..f077f05f5b4 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -1,8 +1,8 @@ from xmlrpc.server import DocXMLRPCServer import http.client import sys +import threading from test import support -threading = support.import_module('threading') import unittest def make_request_and_skipIf(condition, reason): diff --git a/Lib/test/test_dummy_thread.py b/Lib/test/test_dummy_thread.py deleted file mode 100644 index 0840be67d56..00000000000 --- a/Lib/test/test_dummy_thread.py +++ /dev/null @@ -1,255 +0,0 @@ -import _dummy_thread as _thread -import time -import queue -import random -import unittest -from test import support -from unittest import mock - -DELAY = 0 - - -class LockTests(unittest.TestCase): - """Test lock objects.""" - - def setUp(self): - # Create a lock - self.lock = _thread.allocate_lock() - - def test_initlock(self): - #Make sure locks start locked - self.assertFalse(self.lock.locked(), - "Lock object is not initialized unlocked.") - - def test_release(self): - # Test self.lock.release() - self.lock.acquire() - self.lock.release() - self.assertFalse(self.lock.locked(), - "Lock object did not release properly.") - - def test_LockType_context_manager(self): - with _thread.LockType(): - pass - self.assertFalse(self.lock.locked(), - "Acquired Lock was not released") - - def test_improper_release(self): - #Make sure release of an unlocked thread raises RuntimeError - self.assertRaises(RuntimeError, self.lock.release) - - def test_cond_acquire_success(self): - #Make sure the conditional acquiring of the lock works. - self.assertTrue(self.lock.acquire(0), - "Conditional acquiring of the lock failed.") - - def test_cond_acquire_fail(self): - #Test acquiring locked lock returns False - self.lock.acquire(0) - self.assertFalse(self.lock.acquire(0), - "Conditional acquiring of a locked lock incorrectly " - "succeeded.") - - def test_uncond_acquire_success(self): - #Make sure unconditional acquiring of a lock works. - self.lock.acquire() - self.assertTrue(self.lock.locked(), - "Uncondional locking failed.") - - def test_uncond_acquire_return_val(self): - #Make sure that an unconditional locking returns True. - self.assertIs(self.lock.acquire(1), True, - "Unconditional locking did not return True.") - self.assertIs(self.lock.acquire(), True) - - def test_uncond_acquire_blocking(self): - #Make sure that unconditional acquiring of a locked lock blocks. - def delay_unlock(to_unlock, delay): - """Hold on to lock for a set amount of time before unlocking.""" - time.sleep(delay) - to_unlock.release() - - self.lock.acquire() - start_time = int(time.time()) - _thread.start_new_thread(delay_unlock,(self.lock, DELAY)) - if support.verbose: - print() - print("*** Waiting for thread to release the lock "\ - "(approx. %s sec.) ***" % DELAY) - self.lock.acquire() - end_time = int(time.time()) - if support.verbose: - print("done") - self.assertGreaterEqual(end_time - start_time, DELAY, - "Blocking by unconditional acquiring failed.") - - @mock.patch('time.sleep') - def test_acquire_timeout(self, mock_sleep): - """Test invoking acquire() with a positive timeout when the lock is - already acquired. Ensure that time.sleep() is invoked with the given - timeout and that False is returned.""" - - self.lock.acquire() - retval = self.lock.acquire(waitflag=0, timeout=1) - self.assertTrue(mock_sleep.called) - mock_sleep.assert_called_once_with(1) - self.assertEqual(retval, False) - - def test_lock_representation(self): - self.lock.acquire() - self.assertIn("locked", repr(self.lock)) - self.lock.release() - self.assertIn("unlocked", repr(self.lock)) - - -class MiscTests(unittest.TestCase): - """Miscellaneous tests.""" - - def test_exit(self): - self.assertRaises(SystemExit, _thread.exit) - - def test_ident(self): - self.assertIsInstance(_thread.get_ident(), int, - "_thread.get_ident() returned a non-integer") - self.assertGreater(_thread.get_ident(), 0) - - def test_LockType(self): - self.assertIsInstance(_thread.allocate_lock(), _thread.LockType, - "_thread.LockType is not an instance of what " - "is returned by _thread.allocate_lock()") - - def test_set_sentinel(self): - self.assertIsInstance(_thread._set_sentinel(), _thread.LockType, - "_thread._set_sentinel() did not return a " - "LockType instance.") - - def test_interrupt_main(self): - #Calling start_new_thread with a function that executes interrupt_main - # should raise KeyboardInterrupt upon completion. - def call_interrupt(): - _thread.interrupt_main() - - self.assertRaises(KeyboardInterrupt, - _thread.start_new_thread, - call_interrupt, - tuple()) - - def test_interrupt_in_main(self): - self.assertRaises(KeyboardInterrupt, _thread.interrupt_main) - - def test_stack_size_None(self): - retval = _thread.stack_size(None) - self.assertEqual(retval, 0) - - def test_stack_size_not_None(self): - with self.assertRaises(_thread.error) as cm: - _thread.stack_size("") - self.assertEqual(cm.exception.args[0], - "setting thread stack size not supported") - - -class ThreadTests(unittest.TestCase): - """Test thread creation.""" - - def test_arg_passing(self): - #Make sure that parameter passing works. - def arg_tester(queue, arg1=False, arg2=False): - """Use to test _thread.start_new_thread() passes args properly.""" - queue.put((arg1, arg2)) - - testing_queue = queue.Queue(1) - _thread.start_new_thread(arg_tester, (testing_queue, True, True)) - result = testing_queue.get() - self.assertTrue(result[0] and result[1], - "Argument passing for thread creation " - "using tuple failed") - - _thread.start_new_thread( - arg_tester, - tuple(), - {'queue':testing_queue, 'arg1':True, 'arg2':True}) - - result = testing_queue.get() - self.assertTrue(result[0] and result[1], - "Argument passing for thread creation " - "using kwargs failed") - - _thread.start_new_thread( - arg_tester, - (testing_queue, True), - {'arg2':True}) - - result = testing_queue.get() - self.assertTrue(result[0] and result[1], - "Argument passing for thread creation using both tuple" - " and kwargs failed") - - def test_multi_thread_creation(self): - def queue_mark(queue, delay): - time.sleep(delay) - queue.put(_thread.get_ident()) - - thread_count = 5 - testing_queue = queue.Queue(thread_count) - - if support.verbose: - print() - print("*** Testing multiple thread creation " - "(will take approx. %s to %s sec.) ***" % ( - DELAY, thread_count)) - - for count in range(thread_count): - if DELAY: - local_delay = round(random.random(), 1) - else: - local_delay = 0 - _thread.start_new_thread(queue_mark, - (testing_queue, local_delay)) - time.sleep(DELAY) - if support.verbose: - print('done') - self.assertEqual(testing_queue.qsize(), thread_count, - "Not all %s threads executed properly " - "after %s sec." % (thread_count, DELAY)) - - def test_args_not_tuple(self): - """ - Test invoking start_new_thread() with a non-tuple value for "args". - Expect TypeError with a meaningful error message to be raised. - """ - with self.assertRaises(TypeError) as cm: - _thread.start_new_thread(mock.Mock(), []) - self.assertEqual(cm.exception.args[0], "2nd arg must be a tuple") - - def test_kwargs_not_dict(self): - """ - Test invoking start_new_thread() with a non-dict value for "kwargs". - Expect TypeError with a meaningful error message to be raised. - """ - with self.assertRaises(TypeError) as cm: - _thread.start_new_thread(mock.Mock(), tuple(), kwargs=[]) - self.assertEqual(cm.exception.args[0], "3rd arg must be a dict") - - def test_SystemExit(self): - """ - Test invoking start_new_thread() with a function that raises - SystemExit. - The exception should be discarded. - """ - func = mock.Mock(side_effect=SystemExit()) - try: - _thread.start_new_thread(func, tuple()) - except SystemExit: - self.fail("start_new_thread raised SystemExit.") - - @mock.patch('traceback.print_exc') - def test_RaiseException(self, mock_print_exc): - """ - Test invoking start_new_thread() with a function that raises exception. - - The exception should be discarded and the traceback should be printed - via traceback.print_exc() - """ - func = mock.Mock(side_effect=Exception) - _thread.start_new_thread(func, tuple()) - self.assertTrue(mock_print_exc.called) diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py deleted file mode 100644 index a0c2972a60e..00000000000 --- a/Lib/test/test_dummy_threading.py +++ /dev/null @@ -1,60 +0,0 @@ -from test import support -import unittest -import dummy_threading as _threading -import time - -class DummyThreadingTestCase(unittest.TestCase): - - class TestThread(_threading.Thread): - - def run(self): - global running - global sema - global mutex - # Uncomment if testing another module, such as the real 'threading' - # module. - #delay = random.random() * 2 - delay = 0 - if support.verbose: - print('task', self.name, 'will run for', delay, 'sec') - sema.acquire() - mutex.acquire() - running += 1 - if support.verbose: - print(running, 'tasks are running') - mutex.release() - time.sleep(delay) - if support.verbose: - print('task', self.name, 'done') - mutex.acquire() - running -= 1 - if support.verbose: - print(self.name, 'is finished.', running, 'tasks are running') - mutex.release() - sema.release() - - def setUp(self): - self.numtasks = 10 - global sema - sema = _threading.BoundedSemaphore(value=3) - global mutex - mutex = _threading.RLock() - global running - running = 0 - self.threads = [] - - def test_tasks(self): - for i in range(self.numtasks): - t = self.TestThread(name=""%i) - self.threads.append(t) - t.start() - - if support.verbose: - print('waiting for all tasks to complete') - for t in self.threads: - t.join() - if support.verbose: - print('all tasks done') - -if __name__ == '__main__': - unittest.main() diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py index f97ccc6711c..621754cf753 100644 --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -12,10 +12,7 @@ from itertools import chain from random import choice from socket import getfqdn -try: - from threading import Thread -except ImportError: - from dummy_threading import Thread +from threading import Thread import email import email.policy diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index ea52de7a5f3..e6324d4d8c8 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -2,15 +2,12 @@ import inspect import pydoc import unittest +import threading from collections import OrderedDict from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support -try: - import threading -except ImportError: - threading = None # for pickle tests @@ -1988,7 +1985,6 @@ class Bizarre(Flag): d = 6 self.assertEqual(repr(Bizarre(7)), '') - @unittest.skipUnless(threading, 'Threading required for this test.') @support.reap_threads def test_unique_composite(self): # override __eq__ to be identity only @@ -2339,7 +2335,6 @@ def test_bool(self): for f in Open: self.assertEqual(bool(f.value), bool(f)) - @unittest.skipUnless(threading, 'Threading required for this test.') @support.reap_threads def test_unique_composite(self): # override __eq__ to be identity only diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index e2fcb2b852d..889e6414e39 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -8,15 +8,11 @@ from test import support from test.support import script_helper, is_android, requires_android_level import tempfile +import threading import unittest from textwrap import dedent try: - import threading - HAVE_THREADS = True -except ImportError: - HAVE_THREADS = False -try: import _testcapi except ImportError: _testcapi = None @@ -154,7 +150,6 @@ def test_sigsegv(self): 3, 'Segmentation fault') - @unittest.skipIf(not HAVE_THREADS, 'need threads') def test_fatal_error_c_thread(self): self.check_fatal_error(""" import faulthandler @@ -231,7 +226,7 @@ def test_fatal_error_without_gil(self): 2, 'xyz') - @unittest.skipIf(sys.platform.startswith('openbsd') and HAVE_THREADS, + @unittest.skipIf(sys.platform.startswith('openbsd'), "Issue #12868: sigaltstack() doesn't work on " "OpenBSD if Python is compiled with pthread") @unittest.skipIf(not hasattr(faulthandler, '_stack_overflow'), @@ -456,7 +451,6 @@ def {func_name}(): self.assertEqual(trace, expected) self.assertEqual(exitcode, 0) - @unittest.skipIf(not HAVE_THREADS, 'need threads') def check_dump_traceback_threads(self, filename): """ Call explicitly dump_traceback(all_threads=True) and check the output. diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py index da46fe565dc..9ca9724c4c9 100644 --- a/Lib/test/test_fork1.py +++ b/Lib/test/test_fork1.py @@ -5,6 +5,7 @@ import os import signal import sys +import threading import time import unittest @@ -12,7 +13,6 @@ from test.support import (reap_children, get_attribute, import_module, verbose) -threading = import_module('threading') # Skip test if fork does not exist. get_attribute(os, 'fork') diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 24ea382ff29..151e0919066 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -10,6 +10,7 @@ import io import errno import os +import threading import time try: import ssl @@ -19,7 +20,6 @@ from unittest import TestCase, skipUnless from test import support from test.support import HOST, HOSTv6 -threading = support.import_module('threading') TIMEOUT = 3 # the dummy data returned by server over the data channel when diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 3acfb92be4a..f7a11666133 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -8,15 +8,12 @@ from random import choice import sys from test import support +import threading import time import unittest import unittest.mock from weakref import proxy import contextlib -try: - import threading -except ImportError: - threading = None import functools @@ -1406,7 +1403,6 @@ def f(zomg: 'zomg_annotation'): for attr in self.module.WRAPPER_ASSIGNMENTS: self.assertEqual(getattr(g, attr), getattr(f, attr)) - @unittest.skipUnless(threading, 'This test requires threading.') def test_lru_cache_threaded(self): n, m = 5, 11 def orig(x, y): @@ -1455,7 +1451,6 @@ def clear(): finally: sys.setswitchinterval(orig_si) - @unittest.skipUnless(threading, 'This test requires threading.') def test_lru_cache_threaded2(self): # Simultaneous call with the same arguments n, m = 5, 7 @@ -1483,7 +1478,6 @@ def test(): pause.reset() self.assertEqual(f.cache_info(), (0, (i+1)*n, m*n, i+1)) - @unittest.skipUnless(threading, 'This test requires threading.') def test_lru_cache_threaded3(self): @self.module.lru_cache(maxsize=2) def f(x): diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index e7274998d52..914efec3d3e 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -8,11 +8,7 @@ import time import gc import weakref - -try: - import threading -except ImportError: - threading = None +import threading try: from _testcapi import with_tp_del @@ -352,7 +348,6 @@ def __del__(self): v = {1: v, 2: Ouch()} gc.disable() - @unittest.skipUnless(threading, "test meaningless on builds without threads") def test_trashcan_threads(self): # Issue #13992: trashcan mechanism should be thread-safe NESTING = 60 diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 46736f62d58..9e0eaea8c8f 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -12,12 +12,6 @@ import textwrap import unittest -# Is this Python configured to support threads? -try: - import _thread -except ImportError: - _thread = None - from test import support from test.support import run_unittest, findfile, python_is_optimized @@ -755,8 +749,6 @@ def test_bt_full(self): foo\(1, 2, 3\) ''') - @unittest.skipUnless(_thread, - "Python was compiled without thread support") def test_threads(self): 'Verify that "py-bt" indicates threads that are waiting for the GIL' cmd = ''' @@ -794,8 +786,6 @@ def run(self): # Some older versions of gdb will fail with # "Cannot find new threads: generic error" # unless we add LD_PRELOAD=PATH-TO-libpthread.so.1 as a workaround - @unittest.skipUnless(_thread, - "Python was compiled without thread support") def test_gc(self): 'Verify that "py-bt" indicates if a thread is garbage-collecting' cmd = ('from gc import collect\n' @@ -822,8 +812,6 @@ def test_gc(self): # Some older versions of gdb will fail with # "Cannot find new threads: generic error" # unless we add LD_PRELOAD=PATH-TO-libpthread.so.1 as a workaround - @unittest.skipUnless(_thread, - "Python was compiled without thread support") def test_pycfunction(self): 'Verify that "py-bt" displays invocations of PyCFunction instances' # Tested function must not be defined with METH_NOARGS or METH_O, diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index f748b461907..5c8f090116f 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -12,10 +12,7 @@ import itertools import os import sys -try: - import threading -except ImportError: - threading = None +import threading import unittest import warnings from test import support @@ -738,7 +735,6 @@ def test_gil(self): m = hashlib.md5(b'x' * gil_minsize) self.assertEqual(m.hexdigest(), 'cfb767f225d58469c5de3632a8803958') - @unittest.skipUnless(threading, 'Threading required for this test.') @support.reap_threads def test_threaded_hashing(self): # Updating the same hash object from several threads at once diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 8cddcdc4384..20e6f66766f 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -22,12 +22,13 @@ import tempfile import time import datetime +import threading from unittest import mock from io import BytesIO import unittest from test import support -threading = support.import_module('threading') + class NoLogRequestHandler: def log_message(self, *args): diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py index da05da50f33..b7ef70ddbaf 100644 --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -3,7 +3,6 @@ # Skip test if _thread or _tkinter wasn't built, if idlelib is missing, # or if tcl/tk is not the 8.5+ needed for ttk widgets. -import_module('threading') # imported by PyShell, imports _thread tk = import_module('tkinter') # imports _tkinter if tk.TkVersion < 8.5: raise unittest.SkipTest("IDLE requires tk 8.5 or later.") diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 7c124380b14..132c58624fe 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -1,8 +1,4 @@ from test import support -# If we end up with a significant number of tests that don't require -# threading, this test module should be split. Right now we skip -# them all if we don't have threading. -threading = support.import_module('threading') from contextlib import contextmanager import imaplib @@ -10,6 +6,7 @@ import socketserver import time import calendar +import threading from test.support import (reap_threads, verbose, transient_internet, run_with_tz, run_with_locale, cpython_only) diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 6f35f49487c..3bfcb095894 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -1,7 +1,3 @@ -try: - import _thread -except ImportError: - _thread = None import importlib import importlib.util import os @@ -23,7 +19,6 @@ def requires_load_dynamic(meth): 'imp.load_dynamic() required')(meth) - at unittest.skipIf(_thread is None, '_thread module is required') class LockTests(unittest.TestCase): """Very basic test of import lock functions.""" diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py index dbce9c2dfdf..d86172ab583 100644 --- a/Lib/test/test_importlib/test_locks.py +++ b/Lib/test/test_importlib/test_locks.py @@ -3,134 +3,112 @@ init = test_util.import_importlib('importlib') import sys +import threading import unittest import weakref from test import support - -try: - import threading -except ImportError: - threading = None -else: - from test import lock_tests - -if threading is not None: - class ModuleLockAsRLockTests: - locktype = classmethod(lambda cls: cls.LockType("some_lock")) - - # _is_owned() unsupported - test__is_owned = None - # acquire(blocking=False) unsupported - test_try_acquire = None - test_try_acquire_contended = None - # `with` unsupported - test_with = None - # acquire(timeout=...) unsupported - test_timeout = None - # _release_save() unsupported - test_release_save_unacquired = None - # lock status in repr unsupported - test_repr = None - test_locked_repr = None - - LOCK_TYPES = {kind: splitinit._bootstrap._ModuleLock - for kind, splitinit in init.items()} - - (Frozen_ModuleLockAsRLockTests, - Source_ModuleLockAsRLockTests - ) = test_util.test_both(ModuleLockAsRLockTests, lock_tests.RLockTests, - LockType=LOCK_TYPES) -else: - LOCK_TYPES = {} - - class Frozen_ModuleLockAsRLockTests(unittest.TestCase): - pass - - class Source_ModuleLockAsRLockTests(unittest.TestCase): - pass - - -if threading is not None: - class DeadlockAvoidanceTests: - - def setUp(self): +from test import lock_tests + + +class ModuleLockAsRLockTests: + locktype = classmethod(lambda cls: cls.LockType("some_lock")) + + # _is_owned() unsupported + test__is_owned = None + # acquire(blocking=False) unsupported + test_try_acquire = None + test_try_acquire_contended = None + # `with` unsupported + test_with = None + # acquire(timeout=...) unsupported + test_timeout = None + # _release_save() unsupported + test_release_save_unacquired = None + # lock status in repr unsupported + test_repr = None + test_locked_repr = None + +LOCK_TYPES = {kind: splitinit._bootstrap._ModuleLock + for kind, splitinit in init.items()} + +(Frozen_ModuleLockAsRLockTests, + Source_ModuleLockAsRLockTests + ) = test_util.test_both(ModuleLockAsRLockTests, lock_tests.RLockTests, + LockType=LOCK_TYPES) + + +class DeadlockAvoidanceTests: + + def setUp(self): + try: + self.old_switchinterval = sys.getswitchinterval() + support.setswitchinterval(0.000001) + except AttributeError: + self.old_switchinterval = None + + def tearDown(self): + if self.old_switchinterval is not None: + sys.setswitchinterval(self.old_switchinterval) + + def run_deadlock_avoidance_test(self, create_deadlock): + NLOCKS = 10 + locks = [self.LockType(str(i)) for i in range(NLOCKS)] + pairs = [(locks[i], locks[(i+1)%NLOCKS]) for i in range(NLOCKS)] + if create_deadlock: + NTHREADS = NLOCKS + else: + NTHREADS = NLOCKS - 1 + barrier = threading.Barrier(NTHREADS) + results = [] + + def _acquire(lock): + """Try to acquire the lock. Return True on success, + False on deadlock.""" try: - self.old_switchinterval = sys.getswitchinterval() - support.setswitchinterval(0.000001) - except AttributeError: - self.old_switchinterval = None - - def tearDown(self): - if self.old_switchinterval is not None: - sys.setswitchinterval(self.old_switchinterval) - - def run_deadlock_avoidance_test(self, create_deadlock): - NLOCKS = 10 - locks = [self.LockType(str(i)) for i in range(NLOCKS)] - pairs = [(locks[i], locks[(i+1)%NLOCKS]) for i in range(NLOCKS)] - if create_deadlock: - NTHREADS = NLOCKS + lock.acquire() + except self.DeadlockError: + return False else: - NTHREADS = NLOCKS - 1 - barrier = threading.Barrier(NTHREADS) - results = [] - - def _acquire(lock): - """Try to acquire the lock. Return True on success, - False on deadlock.""" - try: - lock.acquire() - except self.DeadlockError: - return False - else: - return True - - def f(): - a, b = pairs.pop() - ra = _acquire(a) - barrier.wait() - rb = _acquire(b) - results.append((ra, rb)) - if rb: - b.release() - if ra: - a.release() - lock_tests.Bunch(f, NTHREADS).wait_for_finished() - self.assertEqual(len(results), NTHREADS) - return results - - def test_deadlock(self): - results = self.run_deadlock_avoidance_test(True) - # At least one of the threads detected a potential deadlock on its - # second acquire() call. It may be several of them, because the - # deadlock avoidance mechanism is conservative. - nb_deadlocks = results.count((True, False)) - self.assertGreaterEqual(nb_deadlocks, 1) - self.assertEqual(results.count((True, True)), len(results) - nb_deadlocks) - - def test_no_deadlock(self): - results = self.run_deadlock_avoidance_test(False) - self.assertEqual(results.count((True, False)), 0) - self.assertEqual(results.count((True, True)), len(results)) - - - DEADLOCK_ERRORS = {kind: splitinit._bootstrap._DeadlockError - for kind, splitinit in init.items()} - - (Frozen_DeadlockAvoidanceTests, - Source_DeadlockAvoidanceTests - ) = test_util.test_both(DeadlockAvoidanceTests, - LockType=LOCK_TYPES, - DeadlockError=DEADLOCK_ERRORS) -else: - DEADLOCK_ERRORS = {} - - class Frozen_DeadlockAvoidanceTests(unittest.TestCase): - pass - - class Source_DeadlockAvoidanceTests(unittest.TestCase): - pass + return True + + def f(): + a, b = pairs.pop() + ra = _acquire(a) + barrier.wait() + rb = _acquire(b) + results.append((ra, rb)) + if rb: + b.release() + if ra: + a.release() + lock_tests.Bunch(f, NTHREADS).wait_for_finished() + self.assertEqual(len(results), NTHREADS) + return results + + def test_deadlock(self): + results = self.run_deadlock_avoidance_test(True) + # At least one of the threads detected a potential deadlock on its + # second acquire() call. It may be several of them, because the + # deadlock avoidance mechanism is conservative. + nb_deadlocks = results.count((True, False)) + self.assertGreaterEqual(nb_deadlocks, 1) + self.assertEqual(results.count((True, True)), len(results) - nb_deadlocks) + + def test_no_deadlock(self): + results = self.run_deadlock_avoidance_test(False) + self.assertEqual(results.count((True, False)), 0) + self.assertEqual(results.count((True, True)), len(results)) + + +DEADLOCK_ERRORS = {kind: splitinit._bootstrap._DeadlockError + for kind, splitinit in init.items()} + +(Frozen_DeadlockAvoidanceTests, + Source_DeadlockAvoidanceTests + ) = test_util.test_both(DeadlockAvoidanceTests, + LockType=LOCK_TYPES, + DeadlockError=DEADLOCK_ERRORS) class LifetimeTests: diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 48270c88be6..d4685dd22e1 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -28,6 +28,7 @@ import random import signal import sys +import threading import time import unittest import warnings @@ -40,10 +41,6 @@ import codecs import io # C implementation of io import _pyio as pyio # Python implementation of io -try: - import threading -except ImportError: - threading = None try: import ctypes @@ -443,8 +440,6 @@ class UnseekableWriter(self.MockUnseekableIO): (self.BytesIO, "rws"), (self.StringIO, "rws"), ) for [test, abilities] in tests: - if test is pipe_writer and not threading: - continue # Skip subtest that uses a background thread with self.subTest(test), test() as obj: readable = "r" in abilities self.assertEqual(obj.readable(), readable) @@ -1337,7 +1332,6 @@ def test_read_all(self): self.assertEqual(b"abcdefg", bufio.read()) - @unittest.skipUnless(threading, 'Threading required for this test.') @support.requires_resource('cpu') def test_threads(self): try: @@ -1664,7 +1658,6 @@ def test_truncate(self): with self.open(support.TESTFN, "rb", buffering=0) as f: self.assertEqual(f.read(), b"abc") - @unittest.skipUnless(threading, 'Threading required for this test.') @support.requires_resource('cpu') def test_threads(self): try: @@ -3053,7 +3046,6 @@ def test_errors_property(self): self.assertEqual(f.errors, "replace") @support.no_tracing - @unittest.skipUnless(threading, 'Threading required for this test.') def test_threads_write(self): # Issue6750: concurrent writes could duplicate data event = threading.Event() @@ -3804,7 +3796,6 @@ def read(self, n=-1): b = bytearray(2) self.assertRaises(ValueError, bufio.readinto, b) - @unittest.skipUnless(threading, 'Threading required for this test.') def check_daemon_threads_shutdown_deadlock(self, stream_name): # Issue #23309: deadlocks at shutdown should be avoided when a # daemon thread and the main thread both write to a file. @@ -3868,7 +3859,6 @@ def tearDown(self): def alarm_interrupt(self, sig, frame): 1/0 - @unittest.skipUnless(threading, 'Threading required for this test.') def check_interrupted_write(self, item, bytes, **fdopen_kwargs): """Check that a partial write, when it gets interrupted, properly invokes the signal handler, and bubbles up the exception raised @@ -3990,7 +3980,6 @@ def test_interrupted_read_retry_text(self): self.check_interrupted_read_retry(lambda x: x, mode="r") - @unittest.skipUnless(threading, 'Threading required for this test.') def check_interrupted_write_retry(self, item, **fdopen_kwargs): """Check that a buffered write, when it gets interrupted (either returning a partial result or EINTR), properly invokes the signal diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index f4aef9f8962..9c3816ada77 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -42,22 +42,19 @@ from test.support.script_helper import assert_python_ok from test import support import textwrap +import threading import time import unittest import warnings import weakref -try: - import threading - # The following imports are needed only for tests which - # require threading - import asyncore - from http.server import HTTPServer, BaseHTTPRequestHandler - import smtpd - from urllib.parse import urlparse, parse_qs - from socketserver import (ThreadingUDPServer, DatagramRequestHandler, - ThreadingTCPServer, StreamRequestHandler) -except ImportError: - threading = None + +import asyncore +from http.server import HTTPServer, BaseHTTPRequestHandler +import smtpd +from urllib.parse import urlparse, parse_qs +from socketserver import (ThreadingUDPServer, DatagramRequestHandler, + ThreadingTCPServer, StreamRequestHandler) + try: import win32evtlog, win32evtlogutil, pywintypes except ImportError: @@ -625,7 +622,6 @@ def test_path_objects(self): os.unlink(fn) @unittest.skipIf(os.name == 'nt', 'WatchedFileHandler not appropriate for Windows.') - @unittest.skipUnless(threading, 'Threading required for this test.') def test_race(self): # Issue #14632 refers. def remove_loop(fname, tries): @@ -719,276 +715,274 @@ def test_stream_setting(self): # -- The following section could be moved into a server_helper.py module # -- if it proves to be of wider utility than just test_logging -if threading: - class TestSMTPServer(smtpd.SMTPServer): +class TestSMTPServer(smtpd.SMTPServer): + """ + This class implements a test SMTP server. + + :param addr: A (host, port) tuple which the server listens on. + You can specify a port value of zero: the server's + *port* attribute will hold the actual port number + used, which can be used in client connections. + :param handler: A callable which will be called to process + incoming messages. The handler will be passed + the client address tuple, who the message is from, + a list of recipients and the message data. + :param poll_interval: The interval, in seconds, used in the underlying + :func:`select` or :func:`poll` call by + :func:`asyncore.loop`. + :param sockmap: A dictionary which will be used to hold + :class:`asyncore.dispatcher` instances used by + :func:`asyncore.loop`. This avoids changing the + :mod:`asyncore` module's global state. + """ + + def __init__(self, addr, handler, poll_interval, sockmap): + smtpd.SMTPServer.__init__(self, addr, None, map=sockmap, + decode_data=True) + self.port = self.socket.getsockname()[1] + self._handler = handler + self._thread = None + self.poll_interval = poll_interval + + def process_message(self, peer, mailfrom, rcpttos, data): + """ + Delegates to the handler passed in to the server's constructor. + + Typically, this will be a test case method. + :param peer: The client (host, port) tuple. + :param mailfrom: The address of the sender. + :param rcpttos: The addresses of the recipients. + :param data: The message. """ - This class implements a test SMTP server. - - :param addr: A (host, port) tuple which the server listens on. - You can specify a port value of zero: the server's - *port* attribute will hold the actual port number - used, which can be used in client connections. - :param handler: A callable which will be called to process - incoming messages. The handler will be passed - the client address tuple, who the message is from, - a list of recipients and the message data. + self._handler(peer, mailfrom, rcpttos, data) + + def start(self): + """ + Start the server running on a separate daemon thread. + """ + self._thread = t = threading.Thread(target=self.serve_forever, + args=(self.poll_interval,)) + t.setDaemon(True) + t.start() + + def serve_forever(self, poll_interval): + """ + Run the :mod:`asyncore` loop until normal termination + conditions arise. :param poll_interval: The interval, in seconds, used in the underlying :func:`select` or :func:`poll` call by :func:`asyncore.loop`. - :param sockmap: A dictionary which will be used to hold - :class:`asyncore.dispatcher` instances used by - :func:`asyncore.loop`. This avoids changing the - :mod:`asyncore` module's global state. """ + try: + asyncore.loop(poll_interval, map=self._map) + except OSError: + # On FreeBSD 8, closing the server repeatably + # raises this error. We swallow it if the + # server has been closed. + if self.connected or self.accepting: + raise - def __init__(self, addr, handler, poll_interval, sockmap): - smtpd.SMTPServer.__init__(self, addr, None, map=sockmap, - decode_data=True) - self.port = self.socket.getsockname()[1] - self._handler = handler - self._thread = None - self.poll_interval = poll_interval + def stop(self, timeout=None): + """ + Stop the thread by closing the server instance. + Wait for the server thread to terminate. - def process_message(self, peer, mailfrom, rcpttos, data): - """ - Delegates to the handler passed in to the server's constructor. + :param timeout: How long to wait for the server thread + to terminate. + """ + self.close() + self._thread.join(timeout) + asyncore.close_all(map=self._map, ignore_all=True) - Typically, this will be a test case method. - :param peer: The client (host, port) tuple. - :param mailfrom: The address of the sender. - :param rcpttos: The addresses of the recipients. - :param data: The message. - """ - self._handler(peer, mailfrom, rcpttos, data) + alive = self._thread.is_alive() + self._thread = None + if alive: + self.fail("join() timed out") - def start(self): - """ - Start the server running on a separate daemon thread. - """ - self._thread = t = threading.Thread(target=self.serve_forever, - args=(self.poll_interval,)) - t.setDaemon(True) - t.start() +class ControlMixin(object): + """ + This mixin is used to start a server on a separate thread, and + shut it down programmatically. Request handling is simplified - instead + of needing to derive a suitable RequestHandler subclass, you just + provide a callable which will be passed each received request to be + processed. + + :param handler: A handler callable which will be called with a + single parameter - the request - in order to + process the request. This handler is called on the + server thread, effectively meaning that requests are + processed serially. While not quite Web scale ;-), + this should be fine for testing applications. + :param poll_interval: The polling interval in seconds. + """ + def __init__(self, handler, poll_interval): + self._thread = None + self.poll_interval = poll_interval + self._handler = handler + self.ready = threading.Event() - def serve_forever(self, poll_interval): - """ - Run the :mod:`asyncore` loop until normal termination - conditions arise. - :param poll_interval: The interval, in seconds, used in the underlying - :func:`select` or :func:`poll` call by - :func:`asyncore.loop`. - """ - try: - asyncore.loop(poll_interval, map=self._map) - except OSError: - # On FreeBSD 8, closing the server repeatably - # raises this error. We swallow it if the - # server has been closed. - if self.connected or self.accepting: - raise - - def stop(self, timeout=None): - """ - Stop the thread by closing the server instance. - Wait for the server thread to terminate. + def start(self): + """ + Create a daemon thread to run the server, and start it. + """ + self._thread = t = threading.Thread(target=self.serve_forever, + args=(self.poll_interval,)) + t.setDaemon(True) + t.start() - :param timeout: How long to wait for the server thread - to terminate. - """ - self.close() - self._thread.join(timeout) - asyncore.close_all(map=self._map, ignore_all=True) + def serve_forever(self, poll_interval): + """ + Run the server. Set the ready flag before entering the + service loop. + """ + self.ready.set() + super(ControlMixin, self).serve_forever(poll_interval) + def stop(self, timeout=None): + """ + Tell the server thread to stop, and wait for it to do so. + + :param timeout: How long to wait for the server thread + to terminate. + """ + self.shutdown() + if self._thread is not None: + self._thread.join(timeout) alive = self._thread.is_alive() self._thread = None if alive: self.fail("join() timed out") + self.server_close() + self.ready.clear() - class ControlMixin(object): - """ - This mixin is used to start a server on a separate thread, and - shut it down programmatically. Request handling is simplified - instead - of needing to derive a suitable RequestHandler subclass, you just - provide a callable which will be passed each received request to be - processed. - - :param handler: A handler callable which will be called with a - single parameter - the request - in order to - process the request. This handler is called on the - server thread, effectively meaning that requests are - processed serially. While not quite Web scale ;-), - this should be fine for testing applications. - :param poll_interval: The polling interval in seconds. - """ - def __init__(self, handler, poll_interval): - self._thread = None - self.poll_interval = poll_interval - self._handler = handler - self.ready = threading.Event() +class TestHTTPServer(ControlMixin, HTTPServer): + """ + An HTTP server which is controllable using :class:`ControlMixin`. + + :param addr: A tuple with the IP address and port to listen on. + :param handler: A handler callable which will be called with a + single parameter - the request - in order to + process the request. + :param poll_interval: The polling interval in seconds. + :param log: Pass ``True`` to enable log messages. + """ + def __init__(self, addr, handler, poll_interval=0.5, + log=False, sslctx=None): + class DelegatingHTTPRequestHandler(BaseHTTPRequestHandler): + def __getattr__(self, name, default=None): + if name.startswith('do_'): + return self.process_request + raise AttributeError(name) + + def process_request(self): + self.server._handler(self) + + def log_message(self, format, *args): + if log: + super(DelegatingHTTPRequestHandler, + self).log_message(format, *args) + HTTPServer.__init__(self, addr, DelegatingHTTPRequestHandler) + ControlMixin.__init__(self, handler, poll_interval) + self.sslctx = sslctx + + def get_request(self): + try: + sock, addr = self.socket.accept() + if self.sslctx: + sock = self.sslctx.wrap_socket(sock, server_side=True) + except OSError as e: + # socket errors are silenced by the caller, print them here + sys.stderr.write("Got an error:\n%s\n" % e) + raise + return sock, addr - def start(self): - """ - Create a daemon thread to run the server, and start it. - """ - self._thread = t = threading.Thread(target=self.serve_forever, - args=(self.poll_interval,)) - t.setDaemon(True) - t.start() +class TestTCPServer(ControlMixin, ThreadingTCPServer): + """ + A TCP server which is controllable using :class:`ControlMixin`. + + :param addr: A tuple with the IP address and port to listen on. + :param handler: A handler callable which will be called with a single + parameter - the request - in order to process the request. + :param poll_interval: The polling interval in seconds. + :bind_and_activate: If True (the default), binds the server and starts it + listening. If False, you need to call + :meth:`server_bind` and :meth:`server_activate` at + some later time before calling :meth:`start`, so that + the server will set up the socket and listen on it. + """ - def serve_forever(self, poll_interval): - """ - Run the server. Set the ready flag before entering the - service loop. - """ - self.ready.set() - super(ControlMixin, self).serve_forever(poll_interval) + allow_reuse_address = True - def stop(self, timeout=None): - """ - Tell the server thread to stop, and wait for it to do so. + def __init__(self, addr, handler, poll_interval=0.5, + bind_and_activate=True): + class DelegatingTCPRequestHandler(StreamRequestHandler): - :param timeout: How long to wait for the server thread - to terminate. - """ - self.shutdown() - if self._thread is not None: - self._thread.join(timeout) - alive = self._thread.is_alive() - self._thread = None - if alive: - self.fail("join() timed out") - self.server_close() - self.ready.clear() - - class TestHTTPServer(ControlMixin, HTTPServer): - """ - An HTTP server which is controllable using :class:`ControlMixin`. - - :param addr: A tuple with the IP address and port to listen on. - :param handler: A handler callable which will be called with a - single parameter - the request - in order to - process the request. - :param poll_interval: The polling interval in seconds. - :param log: Pass ``True`` to enable log messages. - """ - def __init__(self, addr, handler, poll_interval=0.5, - log=False, sslctx=None): - class DelegatingHTTPRequestHandler(BaseHTTPRequestHandler): - def __getattr__(self, name, default=None): - if name.startswith('do_'): - return self.process_request - raise AttributeError(name) - - def process_request(self): - self.server._handler(self) - - def log_message(self, format, *args): - if log: - super(DelegatingHTTPRequestHandler, - self).log_message(format, *args) - HTTPServer.__init__(self, addr, DelegatingHTTPRequestHandler) - ControlMixin.__init__(self, handler, poll_interval) - self.sslctx = sslctx - - def get_request(self): - try: - sock, addr = self.socket.accept() - if self.sslctx: - sock = self.sslctx.wrap_socket(sock, server_side=True) - except OSError as e: - # socket errors are silenced by the caller, print them here - sys.stderr.write("Got an error:\n%s\n" % e) - raise - return sock, addr + def handle(self): + self.server._handler(self) + ThreadingTCPServer.__init__(self, addr, DelegatingTCPRequestHandler, + bind_and_activate) + ControlMixin.__init__(self, handler, poll_interval) - class TestTCPServer(ControlMixin, ThreadingTCPServer): - """ - A TCP server which is controllable using :class:`ControlMixin`. - - :param addr: A tuple with the IP address and port to listen on. - :param handler: A handler callable which will be called with a single - parameter - the request - in order to process the request. - :param poll_interval: The polling interval in seconds. - :bind_and_activate: If True (the default), binds the server and starts it - listening. If False, you need to call - :meth:`server_bind` and :meth:`server_activate` at - some later time before calling :meth:`start`, so that - the server will set up the socket and listen on it. - """ + def server_bind(self): + super(TestTCPServer, self).server_bind() + self.port = self.socket.getsockname()[1] - allow_reuse_address = True +class TestUDPServer(ControlMixin, ThreadingUDPServer): + """ + A UDP server which is controllable using :class:`ControlMixin`. + + :param addr: A tuple with the IP address and port to listen on. + :param handler: A handler callable which will be called with a + single parameter - the request - in order to + process the request. + :param poll_interval: The polling interval for shutdown requests, + in seconds. + :bind_and_activate: If True (the default), binds the server and + starts it listening. If False, you need to + call :meth:`server_bind` and + :meth:`server_activate` at some later time + before calling :meth:`start`, so that the server will + set up the socket and listen on it. + """ + def __init__(self, addr, handler, poll_interval=0.5, + bind_and_activate=True): + class DelegatingUDPRequestHandler(DatagramRequestHandler): - def __init__(self, addr, handler, poll_interval=0.5, - bind_and_activate=True): - class DelegatingTCPRequestHandler(StreamRequestHandler): + def handle(self): + self.server._handler(self) - def handle(self): - self.server._handler(self) - ThreadingTCPServer.__init__(self, addr, DelegatingTCPRequestHandler, - bind_and_activate) - ControlMixin.__init__(self, handler, poll_interval) + def finish(self): + data = self.wfile.getvalue() + if data: + try: + super(DelegatingUDPRequestHandler, self).finish() + except OSError: + if not self.server._closed: + raise - def server_bind(self): - super(TestTCPServer, self).server_bind() - self.port = self.socket.getsockname()[1] + ThreadingUDPServer.__init__(self, addr, + DelegatingUDPRequestHandler, + bind_and_activate) + ControlMixin.__init__(self, handler, poll_interval) + self._closed = False - class TestUDPServer(ControlMixin, ThreadingUDPServer): - """ - A UDP server which is controllable using :class:`ControlMixin`. - - :param addr: A tuple with the IP address and port to listen on. - :param handler: A handler callable which will be called with a - single parameter - the request - in order to - process the request. - :param poll_interval: The polling interval for shutdown requests, - in seconds. - :bind_and_activate: If True (the default), binds the server and - starts it listening. If False, you need to - call :meth:`server_bind` and - :meth:`server_activate` at some later time - before calling :meth:`start`, so that the server will - set up the socket and listen on it. - """ - def __init__(self, addr, handler, poll_interval=0.5, - bind_and_activate=True): - class DelegatingUDPRequestHandler(DatagramRequestHandler): - - def handle(self): - self.server._handler(self) - - def finish(self): - data = self.wfile.getvalue() - if data: - try: - super(DelegatingUDPRequestHandler, self).finish() - except OSError: - if not self.server._closed: - raise - - ThreadingUDPServer.__init__(self, addr, - DelegatingUDPRequestHandler, - bind_and_activate) - ControlMixin.__init__(self, handler, poll_interval) - self._closed = False - - def server_bind(self): - super(TestUDPServer, self).server_bind() - self.port = self.socket.getsockname()[1] - - def server_close(self): - super(TestUDPServer, self).server_close() - self._closed = True + def server_bind(self): + super(TestUDPServer, self).server_bind() + self.port = self.socket.getsockname()[1] - if hasattr(socket, "AF_UNIX"): - class TestUnixStreamServer(TestTCPServer): - address_family = socket.AF_UNIX + def server_close(self): + super(TestUDPServer, self).server_close() + self._closed = True - class TestUnixDatagramServer(TestUDPServer): - address_family = socket.AF_UNIX +if hasattr(socket, "AF_UNIX"): + class TestUnixStreamServer(TestTCPServer): + address_family = socket.AF_UNIX + + class TestUnixDatagramServer(TestUDPServer): + address_family = socket.AF_UNIX # - end of server_helper section - at unittest.skipUnless(threading, 'Threading required for this test.') class SMTPHandlerTest(BaseTest): TIMEOUT = 8.0 @@ -1472,14 +1466,12 @@ def test_logger_disabling(self): @unittest.skipIf(True, "FIXME: bpo-30830") - at unittest.skipUnless(threading, 'Threading required for this test.') class SocketHandlerTest(BaseTest): """Test for SocketHandler objects.""" - if threading: - server_class = TestTCPServer - address = ('localhost', 0) + server_class = TestTCPServer + address = ('localhost', 0) def setUp(self): """Set up a TCP server to receive log messages, and a SocketHandler @@ -1573,12 +1565,11 @@ def _get_temp_domain_socket(): @unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") - at unittest.skipUnless(threading, 'Threading required for this test.') class UnixSocketHandlerTest(SocketHandlerTest): """Test for SocketHandler with unix sockets.""" - if threading and hasattr(socket, "AF_UNIX"): + if hasattr(socket, "AF_UNIX"): server_class = TestUnixStreamServer def setUp(self): @@ -1591,14 +1582,12 @@ def tearDown(self): support.unlink(self.address) @unittest.skipIf(True, "FIXME: bpo-30830") - at unittest.skipUnless(threading, 'Threading required for this test.') class DatagramHandlerTest(BaseTest): """Test for DatagramHandler.""" - if threading: - server_class = TestUDPServer - address = ('localhost', 0) + server_class = TestUDPServer + address = ('localhost', 0) def setUp(self): """Set up a UDP server to receive log messages, and a DatagramHandler @@ -1659,12 +1648,11 @@ def test_output(self): @unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") - at unittest.skipUnless(threading, 'Threading required for this test.') class UnixDatagramHandlerTest(DatagramHandlerTest): """Test for DatagramHandler using Unix sockets.""" - if threading and hasattr(socket, "AF_UNIX"): + if hasattr(socket, "AF_UNIX"): server_class = TestUnixDatagramServer def setUp(self): @@ -1676,14 +1664,12 @@ def tearDown(self): DatagramHandlerTest.tearDown(self) support.unlink(self.address) - at unittest.skipUnless(threading, 'Threading required for this test.') class SysLogHandlerTest(BaseTest): """Test for SysLogHandler using UDP.""" - if threading: - server_class = TestUDPServer - address = ('localhost', 0) + server_class = TestUDPServer + address = ('localhost', 0) def setUp(self): """Set up a UDP server to receive log messages, and a SysLogHandler @@ -1747,12 +1733,11 @@ def test_output(self): @unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") - at unittest.skipUnless(threading, 'Threading required for this test.') class UnixSysLogHandlerTest(SysLogHandlerTest): """Test for SysLogHandler with Unix sockets.""" - if threading and hasattr(socket, "AF_UNIX"): + if hasattr(socket, "AF_UNIX"): server_class = TestUnixDatagramServer def setUp(self): @@ -1767,7 +1752,6 @@ def tearDown(self): @unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 support required for this test.') - at unittest.skipUnless(threading, 'Threading required for this test.') class IPv6SysLogHandlerTest(SysLogHandlerTest): """Test for SysLogHandler with IPv6 host.""" @@ -1783,7 +1767,6 @@ def tearDown(self): self.server_class.address_family = socket.AF_INET super(IPv6SysLogHandlerTest, self).tearDown() - at unittest.skipUnless(threading, 'Threading required for this test.') class HTTPHandlerTest(BaseTest): """Test for HTTPHandler.""" @@ -2892,7 +2875,6 @@ def test_config14_ok(self): # listen() uses ConfigSocketReceiver which is based # on socketserver.ThreadingTCPServer @unittest.skipIf(True, "FIXME: bpo-30830") - @unittest.skipUnless(threading, 'listen() needs threading to work') def setup_via_listener(self, text, verify=None): text = text.encode("utf-8") # Ask for a randomly assigned port (by using port 0) @@ -2923,7 +2905,6 @@ def setup_via_listener(self, text, verify=None): if t.is_alive(): self.fail("join() timed out") - @unittest.skipUnless(threading, 'Threading required for this test.') def test_listen_config_10_ok(self): with support.captured_stdout() as output: self.setup_via_listener(json.dumps(self.config10)) @@ -2943,7 +2924,6 @@ def test_listen_config_10_ok(self): ('ERROR', '4'), ], stream=output) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_listen_config_1_ok(self): with support.captured_stdout() as output: self.setup_via_listener(textwrap.dedent(ConfigFileTest.config1)) @@ -2958,7 +2938,6 @@ def test_listen_config_1_ok(self): # Original logger output is empty. self.assert_log_lines([]) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_listen_verify(self): def verify_fail(stuff): @@ -3713,9 +3692,8 @@ def test_multiprocessing(self): def test_optional(self): r = logging.makeLogRecord({}) NOT_NONE = self.assertIsNotNone - if threading: - NOT_NONE(r.thread) - NOT_NONE(r.threadName) + NOT_NONE(r.thread) + NOT_NONE(r.threadName) NOT_NONE(r.process) NOT_NONE(r.processName) log_threads = logging.logThreads diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index e2cd36a4d04..bb780bfa004 100644 --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -6,6 +6,8 @@ import functools import contextlib import os.path +import threading + from test import support from nntplib import NNTP, GroupInfo import nntplib @@ -14,10 +16,7 @@ import ssl except ImportError: ssl = None -try: - import threading -except ImportError: - threading = None + TIMEOUT = 30 certfile = os.path.join(os.path.dirname(__file__), 'keycert3.pem') @@ -1520,7 +1519,7 @@ class MockSslTests(MockSocketTests): def nntp_class(*pos, **kw): return nntplib.NNTP_SSL(*pos, ssl_context=bypass_context, **kw) - at unittest.skipUnless(threading, 'requires multithreading') + class LocalServerTests(unittest.TestCase): def setUp(self): sock = socket.socket() diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 234f701a115..c3c82381abf 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -22,15 +22,13 @@ import subprocess import sys import sysconfig +import threading import time import unittest import uuid import warnings from test import support -try: - import threading -except ImportError: - threading = None + try: import resource except ImportError: @@ -2516,92 +2514,90 @@ def test_set_get_priority(self): raise -if threading is not None: - class SendfileTestServer(asyncore.dispatcher, threading.Thread): - - class Handler(asynchat.async_chat): +class SendfileTestServer(asyncore.dispatcher, threading.Thread): - def __init__(self, conn): - asynchat.async_chat.__init__(self, conn) - self.in_buffer = [] - self.closed = False - self.push(b"220 ready\r\n") + class Handler(asynchat.async_chat): - def handle_read(self): - data = self.recv(4096) - self.in_buffer.append(data) + def __init__(self, conn): + asynchat.async_chat.__init__(self, conn) + self.in_buffer = [] + self.closed = False + self.push(b"220 ready\r\n") - def get_data(self): - return b''.join(self.in_buffer) + def handle_read(self): + data = self.recv(4096) + self.in_buffer.append(data) - def handle_close(self): - self.close() - self.closed = True + def get_data(self): + return b''.join(self.in_buffer) - def handle_error(self): - raise - - def __init__(self, address): - threading.Thread.__init__(self) - asyncore.dispatcher.__init__(self) - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.bind(address) - self.listen(5) - self.host, self.port = self.socket.getsockname()[:2] - self.handler_instance = None - self._active = False - self._active_lock = threading.Lock() - - # --- public API - - @property - def running(self): - return self._active - - def start(self): - assert not self.running - self.__flag = threading.Event() - threading.Thread.start(self) - self.__flag.wait() - - def stop(self): - assert self.running - self._active = False - self.join() - - def wait(self): - # wait for handler connection to be closed, then stop the server - while not getattr(self.handler_instance, "closed", False): - time.sleep(0.001) - self.stop() - - # --- internals - - def run(self): - self._active = True - self.__flag.set() - while self._active and asyncore.socket_map: - self._active_lock.acquire() - asyncore.loop(timeout=0.001, count=1) - self._active_lock.release() - asyncore.close_all() - - def handle_accept(self): - conn, addr = self.accept() - self.handler_instance = self.Handler(conn) - - def handle_connect(self): + def handle_close(self): self.close() - handle_read = handle_connect - - def writable(self): - return 0 + self.closed = True def handle_error(self): raise + def __init__(self, address): + threading.Thread.__init__(self) + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.bind(address) + self.listen(5) + self.host, self.port = self.socket.getsockname()[:2] + self.handler_instance = None + self._active = False + self._active_lock = threading.Lock() + + # --- public API + + @property + def running(self): + return self._active + + def start(self): + assert not self.running + self.__flag = threading.Event() + threading.Thread.start(self) + self.__flag.wait() + + def stop(self): + assert self.running + self._active = False + self.join() + + def wait(self): + # wait for handler connection to be closed, then stop the server + while not getattr(self.handler_instance, "closed", False): + time.sleep(0.001) + self.stop() + + # --- internals + + def run(self): + self._active = True + self.__flag.set() + while self._active and asyncore.socket_map: + self._active_lock.acquire() + asyncore.loop(timeout=0.001, count=1) + self._active_lock.release() + asyncore.close_all() + + def handle_accept(self): + conn, addr = self.accept() + self.handler_instance = self.Handler(conn) + + def handle_connect(self): + self.close() + handle_read = handle_connect + + def writable(self): + return 0 + + def handle_error(self): + raise + - at unittest.skipUnless(threading is not None, "test needs threading module") @unittest.skipUnless(hasattr(os, 'sendfile'), "test needs os.sendfile()") class TestSendfile(unittest.TestCase): diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 0ea2af55417..755d265d5c8 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1040,9 +1040,6 @@ def test_issue13210(self): # invoking "continue" on a non-main thread triggered an exception # inside signal.signal - # raises SkipTest if python was built without threads - support.import_module('threading') - with open(support.TESTFN, 'wb') as f: f.write(textwrap.dedent(""" import threading diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py index 6a2bf6ea7b7..16c2d2e123b 100644 --- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -4,10 +4,7 @@ import subprocess import random import select -try: - import threading -except ImportError: - threading = None +import threading import time import unittest from test.support import TESTFN, run_unittest, reap_threads, cpython_only @@ -179,7 +176,6 @@ def test_poll_c_limits(self): self.assertRaises(OverflowError, pollster.poll, INT_MAX + 1) self.assertRaises(OverflowError, pollster.poll, UINT_MAX + 1) - @unittest.skipUnless(threading, 'Threading required for this test.') @reap_threads def test_threaded_poll(self): r, w = os.pipe() diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index e5b16dc98a4..92febbf83fc 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -9,10 +9,10 @@ import socket import os import errno +import threading from unittest import TestCase, skipUnless from test import support as test_support -threading = test_support.import_module('threading') HOST = test_support.HOST PORT = 0 diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index d68ab5595e8..1ac08edb48e 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -20,6 +20,7 @@ import xml.etree import xml.etree.ElementTree import textwrap +import threading from io import StringIO from collections import namedtuple from test.support.script_helper import assert_python_ok @@ -30,10 +31,6 @@ ) from test import pydoc_mod -try: - import threading -except ImportError: - threading = None class nonascii: '?? ?? ????????' @@ -902,7 +899,6 @@ def test_module_level_callable(self): "stat(path, *, dir_fd=None, follow_symlinks=True)") - at unittest.skipUnless(threading, 'Threading required for this test.') class PydocServerTest(unittest.TestCase): """Tests for pydoc._start_server""" diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 4ccaa39adff..718ed671b92 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -1,10 +1,11 @@ # Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import queue +import threading import time import unittest from test import support -threading = support.import_module('threading') + QUEUE_SIZE = 5 diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index b756839748a..8364767b3a3 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -15,6 +15,7 @@ import sysconfig import tempfile import textwrap +import threading import unittest from test import libregrtest from test import support @@ -741,12 +742,7 @@ def test_slow_interrupted(self): code = TEST_INTERRUPTED test = self.create_test("sigint", code=code) - try: - import threading - tests = (False, True) - except ImportError: - tests = (False,) - for multiprocessing in tests: + for multiprocessing in (False, True): if multiprocessing: args = ("--slowest", "-j2", test) else: diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py index 0f64ba8b060..5c1a571f1b6 100644 --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -1,14 +1,11 @@ import io import os +import threading import unittest import urllib.robotparser from collections import namedtuple from test import support from http.server import BaseHTTPRequestHandler, HTTPServer -try: - import threading -except ImportError: - threading = None class BaseRobotTest: @@ -255,7 +252,6 @@ def log_message(self, format, *args): pass - at unittest.skipUnless(threading, 'threading required for this test') class PasswordProtectedSiteTestCase(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index ebf88564627..794c6374c45 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -1,11 +1,9 @@ import queue import sched +import threading import time import unittest -try: - import threading -except ImportError: - threading = None + TIMEOUT = 10 @@ -58,7 +56,6 @@ def test_enterabs(self): scheduler.run() self.assertEqual(l, [0.01, 0.02, 0.03, 0.04, 0.05]) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_enter_concurrent(self): q = queue.Queue() fun = q.put @@ -113,7 +110,6 @@ def test_cancel(self): scheduler.run() self.assertEqual(l, [0.02, 0.03, 0.04]) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_cancel_concurrent(self): q = queue.Queue() fun = q.put diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 0e1d06706d6..dc048e56665 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -5,15 +5,12 @@ import statistics import subprocess import sys +import threading import time import unittest from test import support from test.support.script_helper import assert_python_ok, spawn_python try: - import threading -except ImportError: - threading = None -try: import _testcapi except ImportError: _testcapi = None @@ -21,7 +18,6 @@ class GenericTests(unittest.TestCase): - @unittest.skipIf(threading is None, "test needs threading module") def test_enums(self): for name in dir(signal): sig = getattr(signal, name) @@ -807,7 +803,6 @@ def test_sigtimedwait_negative_timeout(self): 'need signal.sigwait()') @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') - @unittest.skipIf(threading is None, "test needs threading module") def test_sigwait_thread(self): # Check that calling sigwait() from a thread doesn't suspend the whole # process. A new interpreter is spawned to avoid problems when mixing diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 28539f360f5..42f4266b249 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -15,14 +15,11 @@ import select import errno import textwrap +import threading import unittest from test import support, mock_socket -try: - import threading -except ImportError: - threading = None HOST = support.HOST @@ -191,7 +188,6 @@ def debugging_server(serv, serv_evt, client_evt): # test server times out, causing the test to fail. # Test behavior of smtpd.DebuggingServer - at unittest.skipUnless(threading, 'Threading required for this test.') class DebuggingServerTests(unittest.TestCase): maxDiff = None @@ -570,7 +566,6 @@ def testNonnumericPort(self): # test response of client to a non-successful HELO message - at unittest.skipUnless(threading, 'Threading required for this test.') class BadHELOServerTests(unittest.TestCase): def setUp(self): @@ -590,7 +585,6 @@ def testFailingHELO(self): HOST, self.port, 'localhost', 3) - at unittest.skipUnless(threading, 'Threading required for this test.') class TooLongLineTests(unittest.TestCase): respdata = b'250 OK' + (b'.' * smtplib._MAXLINE * 2) + b'\n' @@ -835,7 +829,6 @@ def handle_error(self): # Test various SMTP & ESMTP commands/behaviors that require a simulated server # (i.e., something with more features than DebuggingServer) - at unittest.skipUnless(threading, 'Threading required for this test.') class SMTPSimTests(unittest.TestCase): def setUp(self): @@ -1091,7 +1084,6 @@ def process_message(self, peer, mailfrom, rcpttos, data, mail_options=None, self.last_rcpt_options = rcpt_options - at unittest.skipUnless(threading, 'Threading required for this test.') class SMTPUTF8SimTests(unittest.TestCase): maxDiff = None @@ -1227,7 +1219,6 @@ class SimSMTPAUTHInitialResponseServer(SimSMTPServer): channel_class = SimSMTPAUTHInitialResponseChannel - at unittest.skipUnless(threading, 'Threading required for this test.') class SMTPAUTHInitialResponseSimTests(unittest.TestCase): def setUp(self): self.real_getfqdn = socket.getfqdn diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 50016ab615a..27d9d4944e1 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -21,6 +21,8 @@ import struct import random import string +import _thread as thread +import threading try: import multiprocessing except ImportError: @@ -36,12 +38,6 @@ VSOCKPORT = 1234 try: - import _thread as thread - import threading -except ImportError: - thread = None - threading = None -try: import _socket except ImportError: _socket = None @@ -143,18 +139,17 @@ class ThreadSafeCleanupTestCase(unittest.TestCase): with a recursive lock. """ - if threading: - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._cleanup_lock = threading.RLock() + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._cleanup_lock = threading.RLock() - def addCleanup(self, *args, **kwargs): - with self._cleanup_lock: - return super().addCleanup(*args, **kwargs) + def addCleanup(self, *args, **kwargs): + with self._cleanup_lock: + return super().addCleanup(*args, **kwargs) - def doCleanups(self, *args, **kwargs): - with self._cleanup_lock: - return super().doCleanups(*args, **kwargs) + def doCleanups(self, *args, **kwargs): + with self._cleanup_lock: + return super().doCleanups(*args, **kwargs) class SocketCANTest(unittest.TestCase): @@ -407,7 +402,6 @@ def clientTearDown(self): ThreadableTest.clientTearDown(self) @unittest.skipIf(fcntl is None, "need fcntl") - at unittest.skipUnless(thread, 'Threading required for this test.') @unittest.skipUnless(HAVE_SOCKET_VSOCK, 'VSOCK sockets required for this test.') @unittest.skipUnless(get_cid() != 2, @@ -1684,7 +1678,6 @@ def testFilter(self): @unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.') - at unittest.skipUnless(thread, 'Threading required for this test.') class CANTest(ThreadedCANSocketTest): def __init__(self, methodName='runTest'): @@ -1838,7 +1831,6 @@ def testSocketBufferSize(self): @unittest.skipUnless(HAVE_SOCKET_RDS, 'RDS sockets required for this test.') - at unittest.skipUnless(thread, 'Threading required for this test.') class RDSTest(ThreadedRDSSocketTest): def __init__(self, methodName='runTest'): @@ -1977,7 +1969,7 @@ def testSocketBufferSize(self): s.getsockopt(socket.AF_VSOCK, socket.SO_VM_SOCKETS_BUFFER_MIN_SIZE)) - at unittest.skipUnless(thread, 'Threading required for this test.') + class BasicTCPTest(SocketConnectedTest): def __init__(self, methodName='runTest'): @@ -2100,7 +2092,7 @@ def testDetach(self): def _testDetach(self): self.serv_conn.send(MSG) - at unittest.skipUnless(thread, 'Threading required for this test.') + class BasicUDPTest(ThreadedUDPSocketTest): def __init__(self, methodName='runTest'): @@ -3697,17 +3689,14 @@ class SendrecvmsgUDPTestBase(SendrecvmsgDgramFlagsBase, pass @requireAttrs(socket.socket, "sendmsg") - at unittest.skipUnless(thread, 'Threading required for this test.') class SendmsgUDPTest(SendmsgConnectionlessTests, SendrecvmsgUDPTestBase): pass @requireAttrs(socket.socket, "recvmsg") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgUDPTest(RecvmsgTests, SendrecvmsgUDPTestBase): pass @requireAttrs(socket.socket, "recvmsg_into") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoUDPTest(RecvmsgIntoTests, SendrecvmsgUDPTestBase): pass @@ -3724,21 +3713,18 @@ def checkRecvmsgAddress(self, addr1, addr2): @requireAttrs(socket.socket, "sendmsg") @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') @requireSocket("AF_INET6", "SOCK_DGRAM") - at unittest.skipUnless(thread, 'Threading required for this test.') class SendmsgUDP6Test(SendmsgConnectionlessTests, SendrecvmsgUDP6TestBase): pass @requireAttrs(socket.socket, "recvmsg") @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') @requireSocket("AF_INET6", "SOCK_DGRAM") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgUDP6Test(RecvmsgTests, SendrecvmsgUDP6TestBase): pass @requireAttrs(socket.socket, "recvmsg_into") @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') @requireSocket("AF_INET6", "SOCK_DGRAM") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoUDP6Test(RecvmsgIntoTests, SendrecvmsgUDP6TestBase): pass @@ -3746,7 +3732,6 @@ class RecvmsgIntoUDP6Test(RecvmsgIntoTests, SendrecvmsgUDP6TestBase): @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') @requireAttrs(socket, "IPPROTO_IPV6") @requireSocket("AF_INET6", "SOCK_DGRAM") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgRFC3542AncillaryUDP6Test(RFC3542AncillaryTest, SendrecvmsgUDP6TestBase): pass @@ -3755,7 +3740,6 @@ class RecvmsgRFC3542AncillaryUDP6Test(RFC3542AncillaryTest, @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') @requireAttrs(socket, "IPPROTO_IPV6") @requireSocket("AF_INET6", "SOCK_DGRAM") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoRFC3542AncillaryUDP6Test(RecvmsgIntoMixin, RFC3542AncillaryTest, SendrecvmsgUDP6TestBase): @@ -3767,18 +3751,15 @@ class SendrecvmsgTCPTestBase(SendrecvmsgConnectedBase, pass @requireAttrs(socket.socket, "sendmsg") - at unittest.skipUnless(thread, 'Threading required for this test.') class SendmsgTCPTest(SendmsgStreamTests, SendrecvmsgTCPTestBase): pass @requireAttrs(socket.socket, "recvmsg") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgTCPTest(RecvmsgTests, RecvmsgGenericStreamTests, SendrecvmsgTCPTestBase): pass @requireAttrs(socket.socket, "recvmsg_into") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoTCPTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, SendrecvmsgTCPTestBase): pass @@ -3791,13 +3772,11 @@ class SendrecvmsgSCTPStreamTestBase(SendrecvmsgSCTPFlagsBase, @requireAttrs(socket.socket, "sendmsg") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") - at unittest.skipUnless(thread, 'Threading required for this test.') class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase): pass @requireAttrs(socket.socket, "recvmsg") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgSCTPStreamTest(RecvmsgTests, RecvmsgGenericStreamTests, SendrecvmsgSCTPStreamTestBase): @@ -3811,7 +3790,6 @@ def testRecvmsgEOF(self): @requireAttrs(socket.socket, "recvmsg_into") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoSCTPStreamTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, SendrecvmsgSCTPStreamTestBase): @@ -3830,33 +3808,28 @@ class SendrecvmsgUnixStreamTestBase(SendrecvmsgConnectedBase, @requireAttrs(socket.socket, "sendmsg") @requireAttrs(socket, "AF_UNIX") - at unittest.skipUnless(thread, 'Threading required for this test.') class SendmsgUnixStreamTest(SendmsgStreamTests, SendrecvmsgUnixStreamTestBase): pass @requireAttrs(socket.socket, "recvmsg") @requireAttrs(socket, "AF_UNIX") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgUnixStreamTest(RecvmsgTests, RecvmsgGenericStreamTests, SendrecvmsgUnixStreamTestBase): pass @requireAttrs(socket.socket, "recvmsg_into") @requireAttrs(socket, "AF_UNIX") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoUnixStreamTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, SendrecvmsgUnixStreamTestBase): pass @requireAttrs(socket.socket, "sendmsg", "recvmsg") @requireAttrs(socket, "AF_UNIX", "SOL_SOCKET", "SCM_RIGHTS") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgSCMRightsStreamTest(SCMRightsTest, SendrecvmsgUnixStreamTestBase): pass @requireAttrs(socket.socket, "sendmsg", "recvmsg_into") @requireAttrs(socket, "AF_UNIX", "SOL_SOCKET", "SCM_RIGHTS") - at unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoSCMRightsStreamTest(RecvmsgIntoMixin, SCMRightsTest, SendrecvmsgUnixStreamTestBase): pass @@ -3944,7 +3917,6 @@ def testInterruptedRecvmsgIntoTimeout(self): @requireAttrs(signal, "siginterrupt") @unittest.skipUnless(hasattr(signal, "alarm") or hasattr(signal, "setitimer"), "Don't have signal.alarm or signal.setitimer") - at unittest.skipUnless(thread, 'Threading required for this test.') class InterruptedSendTimeoutTest(InterruptedTimeoutBase, ThreadSafeCleanupTestCase, SocketListeningTestMixin, TCPTestBase): @@ -3997,7 +3969,6 @@ def testInterruptedSendmsgTimeout(self): self.checkInterruptedSend(self.serv_conn.sendmsg, [b"a"*512]) - at unittest.skipUnless(thread, 'Threading required for this test.') class TCPCloserTest(ThreadedTCPSocketTest): def testClose(self): @@ -4017,7 +3988,7 @@ def _testClose(self): self.cli.connect((HOST, self.port)) time.sleep(1.0) - at unittest.skipUnless(thread, 'Threading required for this test.') + class BasicSocketPairTest(SocketPairTest): def __init__(self, methodName='runTest'): @@ -4052,7 +4023,7 @@ def _testSend(self): msg = self.cli.recv(1024) self.assertEqual(msg, MSG) - at unittest.skipUnless(thread, 'Threading required for this test.') + class NonBlockingTCPTests(ThreadedTCPSocketTest): def __init__(self, methodName='runTest'): @@ -4180,7 +4151,7 @@ def _testRecv(self): time.sleep(0.1) self.cli.send(MSG) - at unittest.skipUnless(thread, 'Threading required for this test.') + class FileObjectClassTestCase(SocketConnectedTest): """Unit tests for the object returned by socket.makefile() @@ -4564,7 +4535,6 @@ def test_create_connection_timeout(self): socket.create_connection((HOST, 1234)) - at unittest.skipUnless(thread, 'Threading required for this test.') class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): def __init__(self, methodName='runTest'): @@ -4633,7 +4603,7 @@ def _testTimeoutValueNonamed(self): self.addCleanup(self.cli.close) self.assertEqual(self.cli.gettimeout(), 30) - at unittest.skipUnless(thread, 'Threading required for this test.') + class NetworkConnectionBehaviourTest(SocketTCPTest, ThreadableTest): def __init__(self, methodName='runTest'): @@ -4877,7 +4847,7 @@ def testUnencodableAddr(self): self.addCleanup(support.unlink, path) self.assertEqual(self.sock.getsockname(), path) - at unittest.skipUnless(thread, 'Threading required for this test.') + class BufferIOTest(SocketConnectedTest): """ Test the buffer versions of socket.recv() and socket.send(). @@ -5050,7 +5020,6 @@ def _testStream(self): self.cli.close() - at unittest.skipUnless(thread, 'Threading required for this test.') class ContextManagersTest(ThreadedTCPSocketTest): def _testSocketClass(self): @@ -5312,7 +5281,6 @@ def testTypes(self): source.close() - at unittest.skipUnless(thread, 'Threading required for this test.') class SendfileUsingSendTest(ThreadedTCPSocketTest): """ Test the send() implementation of socket.sendfile(). @@ -5570,7 +5538,6 @@ def test_errors(self): meth, file, count=-1) - at unittest.skipUnless(thread, 'Threading required for this test.') @unittest.skipUnless(hasattr(os, "sendfile"), 'os.sendfile() required for this test.') class SendfileUsingSendfileTest(SendfileUsingSendTest): diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 3d93566607d..a23373fbdf3 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -9,15 +9,13 @@ import signal import socket import tempfile +import threading import unittest import socketserver import test.support from test.support import reap_children, reap_threads, verbose -try: - import threading -except ImportError: - threading = None + test.support.requires("network") @@ -68,7 +66,6 @@ def simple_subprocess(testcase): testcase.assertEqual(72 << 8, status) - at unittest.skipUnless(threading, 'Threading required for this test.') class SocketServerTest(unittest.TestCase): """Test all socket servers.""" @@ -306,12 +303,10 @@ def test_sync_not_handled(self): BaseErrorTestServer(SystemExit) self.check_result(handled=False) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_threading_handled(self): ThreadingErrorTestServer(ValueError) self.check_result(handled=True) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_threading_not_handled(self): ThreadingErrorTestServer(SystemExit) self.check_result(handled=False) @@ -396,7 +391,6 @@ def handle(self): self.assertIsInstance(server.wfile, io.BufferedIOBase) self.assertEqual(server.wfile_fileno, server.request_fileno) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_write(self): # Test that wfile.write() sends data immediately, and that it does # not truncate sends when interrupted by a Unix signal diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 16cad9de80b..89b4609282f 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -12,6 +12,7 @@ import errno import pprint import urllib.request +import threading import traceback import asyncore import weakref @@ -20,12 +21,6 @@ ssl = support.import_module("ssl") -try: - import threading -except ImportError: - _have_threads = False -else: - _have_threads = True PROTOCOLS = sorted(ssl._PROTOCOL_NAMES) HOST = support.HOST @@ -1468,7 +1463,6 @@ def test_error_types(self): self.assertRaises(TypeError, bio.write, 1) - at unittest.skipUnless(_have_threads, "Needs threading module") class SimpleBackgroundTests(unittest.TestCase): """Tests that connect to a simple server running in the background""" @@ -1828,1744 +1822,1743 @@ def _test_get_server_certificate_fail(test, host, port): test.fail("Got server certificate %s for %s:%s!" % (pem, host, port)) -if _have_threads: - from test.ssl_servers import make_https_server +from test.ssl_servers import make_https_server - class ThreadedEchoServer(threading.Thread): +class ThreadedEchoServer(threading.Thread): - class ConnectionHandler(threading.Thread): + class ConnectionHandler(threading.Thread): - """A mildly complicated class, because we want it to work both - with and without the SSL wrapper around the socket connection, so - that we can test the STARTTLS functionality.""" + """A mildly complicated class, because we want it to work both + with and without the SSL wrapper around the socket connection, so + that we can test the STARTTLS functionality.""" - def __init__(self, server, connsock, addr): - self.server = server + def __init__(self, server, connsock, addr): + self.server = server + self.running = False + self.sock = connsock + self.addr = addr + self.sock.setblocking(1) + self.sslconn = None + threading.Thread.__init__(self) + self.daemon = True + + def wrap_conn(self): + try: + self.sslconn = self.server.context.wrap_socket( + self.sock, server_side=True) + self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol()) + self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol()) + except (ssl.SSLError, ConnectionResetError, OSError) as e: + # We treat ConnectionResetError as though it were an + # SSLError - OpenSSL on Ubuntu abruptly closes the + # connection when asked to use an unsupported protocol. + # + # OSError may occur with wrong protocols, e.g. both + # sides use PROTOCOL_TLS_SERVER. + # + # XXX Various errors can have happened here, for example + # a mismatching protocol version, an invalid certificate, + # or a low-level bug. This should be made more discriminating. + # + # bpo-31323: Store the exception as string to prevent + # a reference leak: server -> conn_errors -> exception + # -> traceback -> self (ConnectionHandler) -> server + self.server.conn_errors.append(str(e)) + if self.server.chatty: + handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") self.running = False - self.sock = connsock - self.addr = addr - self.sock.setblocking(1) - self.sslconn = None - threading.Thread.__init__(self) - self.daemon = True - - def wrap_conn(self): - try: - self.sslconn = self.server.context.wrap_socket( - self.sock, server_side=True) - self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol()) - self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol()) - except (ssl.SSLError, ConnectionResetError, OSError) as e: - # We treat ConnectionResetError as though it were an - # SSLError - OpenSSL on Ubuntu abruptly closes the - # connection when asked to use an unsupported protocol. - # - # OSError may occur with wrong protocols, e.g. both - # sides use PROTOCOL_TLS_SERVER. - # - # XXX Various errors can have happened here, for example - # a mismatching protocol version, an invalid certificate, - # or a low-level bug. This should be made more discriminating. - # - # bpo-31323: Store the exception as string to prevent - # a reference leak: server -> conn_errors -> exception - # -> traceback -> self (ConnectionHandler) -> server - self.server.conn_errors.append(str(e)) - if self.server.chatty: - handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") - self.running = False - self.server.stop() - self.close() - return False - else: - self.server.shared_ciphers.append(self.sslconn.shared_ciphers()) - if self.server.context.verify_mode == ssl.CERT_REQUIRED: - cert = self.sslconn.getpeercert() - if support.verbose and self.server.chatty: - sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") - cert_binary = self.sslconn.getpeercert(True) - if support.verbose and self.server.chatty: - sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") - cipher = self.sslconn.cipher() + self.server.stop() + self.close() + return False + else: + self.server.shared_ciphers.append(self.sslconn.shared_ciphers()) + if self.server.context.verify_mode == ssl.CERT_REQUIRED: + cert = self.sslconn.getpeercert() if support.verbose and self.server.chatty: - sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") - sys.stdout.write(" server: selected protocol is now " - + str(self.sslconn.selected_npn_protocol()) + "\n") - return True - - def read(self): - if self.sslconn: - return self.sslconn.read() - else: - return self.sock.recv(1024) + sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") + cert_binary = self.sslconn.getpeercert(True) + if support.verbose and self.server.chatty: + sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") + cipher = self.sslconn.cipher() + if support.verbose and self.server.chatty: + sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") + sys.stdout.write(" server: selected protocol is now " + + str(self.sslconn.selected_npn_protocol()) + "\n") + return True + + def read(self): + if self.sslconn: + return self.sslconn.read() + else: + return self.sock.recv(1024) - def write(self, bytes): - if self.sslconn: - return self.sslconn.write(bytes) - else: - return self.sock.send(bytes) + def write(self, bytes): + if self.sslconn: + return self.sslconn.write(bytes) + else: + return self.sock.send(bytes) - def close(self): - if self.sslconn: - self.sslconn.close() - else: - self.sock.close() + def close(self): + if self.sslconn: + self.sslconn.close() + else: + self.sock.close() - def run(self): - self.running = True - if not self.server.starttls_server: - if not self.wrap_conn(): - return - while self.running: - try: - msg = self.read() - stripped = msg.strip() - if not stripped: - # eof, so quit this handler - self.running = False - try: - self.sock = self.sslconn.unwrap() - except OSError: - # Many tests shut the TCP connection down - # without an SSL shutdown. This causes - # unwrap() to raise OSError with errno=0! - pass - else: - self.sslconn = None - self.close() - elif stripped == b'over': - if support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: client closed connection\n") - self.close() - return - elif (self.server.starttls_server and - stripped == b'STARTTLS'): - if support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: read STARTTLS from client, sending OK...\n") - self.write(b"OK\n") - if not self.wrap_conn(): - return - elif (self.server.starttls_server and self.sslconn - and stripped == b'ENDTLS'): - if support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: read ENDTLS from client, sending OK...\n") - self.write(b"OK\n") + def run(self): + self.running = True + if not self.server.starttls_server: + if not self.wrap_conn(): + return + while self.running: + try: + msg = self.read() + stripped = msg.strip() + if not stripped: + # eof, so quit this handler + self.running = False + try: self.sock = self.sslconn.unwrap() - self.sslconn = None - if support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: connection is now unencrypted...\n") - elif stripped == b'CB tls-unique': - if support.verbose and self.server.connectionchatty: - sys.stdout.write(" server: read CB tls-unique from client, sending our CB data...\n") - data = self.sslconn.get_channel_binding("tls-unique") - self.write(repr(data).encode("us-ascii") + b"\n") + except OSError: + # Many tests shut the TCP connection down + # without an SSL shutdown. This causes + # unwrap() to raise OSError with errno=0! + pass else: - if (support.verbose and - self.server.connectionchatty): - ctype = (self.sslconn and "encrypted") or "unencrypted" - sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n" - % (msg, ctype, msg.lower(), ctype)) - self.write(msg.lower()) - except OSError: - if self.server.chatty: - handle_error("Test server failure:\n") + self.sslconn = None self.close() - self.running = False - # normally, we'd just stop here, but for the test - # harness, we want to stop the server - self.server.stop() - - def __init__(self, certificate=None, ssl_version=None, - certreqs=None, cacerts=None, - chatty=True, connectionchatty=False, starttls_server=False, - npn_protocols=None, alpn_protocols=None, - ciphers=None, context=None): - if context: - self.context = context - else: - self.context = ssl.SSLContext(ssl_version - if ssl_version is not None - else ssl.PROTOCOL_TLSv1) - self.context.verify_mode = (certreqs if certreqs is not None - else ssl.CERT_NONE) - if cacerts: - self.context.load_verify_locations(cacerts) - if certificate: - self.context.load_cert_chain(certificate) - if npn_protocols: - self.context.set_npn_protocols(npn_protocols) - if alpn_protocols: - self.context.set_alpn_protocols(alpn_protocols) - if ciphers: - self.context.set_ciphers(ciphers) - self.chatty = chatty - self.connectionchatty = connectionchatty - self.starttls_server = starttls_server - self.sock = socket.socket() - self.port = support.bind_port(self.sock) - self.flag = None - self.active = False - self.selected_npn_protocols = [] - self.selected_alpn_protocols = [] - self.shared_ciphers = [] - self.conn_errors = [] - threading.Thread.__init__(self) - self.daemon = True - - def __enter__(self): - self.start(threading.Event()) - self.flag.wait() - return self - - def __exit__(self, *args): - self.stop() - self.join() - - def start(self, flag=None): - self.flag = flag - threading.Thread.start(self) + elif stripped == b'over': + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: client closed connection\n") + self.close() + return + elif (self.server.starttls_server and + stripped == b'STARTTLS'): + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read STARTTLS from client, sending OK...\n") + self.write(b"OK\n") + if not self.wrap_conn(): + return + elif (self.server.starttls_server and self.sslconn + and stripped == b'ENDTLS'): + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read ENDTLS from client, sending OK...\n") + self.write(b"OK\n") + self.sock = self.sslconn.unwrap() + self.sslconn = None + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: connection is now unencrypted...\n") + elif stripped == b'CB tls-unique': + if support.verbose and self.server.connectionchatty: + sys.stdout.write(" server: read CB tls-unique from client, sending our CB data...\n") + data = self.sslconn.get_channel_binding("tls-unique") + self.write(repr(data).encode("us-ascii") + b"\n") + else: + if (support.verbose and + self.server.connectionchatty): + ctype = (self.sslconn and "encrypted") or "unencrypted" + sys.stdout.write(" server: read %r (%s), sending back %r (%s)...\n" + % (msg, ctype, msg.lower(), ctype)) + self.write(msg.lower()) + except OSError: + if self.server.chatty: + handle_error("Test server failure:\n") + self.close() + self.running = False + # normally, we'd just stop here, but for the test + # harness, we want to stop the server + self.server.stop() - def run(self): - self.sock.settimeout(0.05) - self.sock.listen() - self.active = True - if self.flag: - # signal an event - self.flag.set() - while self.active: - try: - newconn, connaddr = self.sock.accept() - if support.verbose and self.chatty: - sys.stdout.write(' server: new connection from ' - + repr(connaddr) + '\n') - handler = self.ConnectionHandler(self, newconn, connaddr) - handler.start() - handler.join() - except socket.timeout: - pass - except KeyboardInterrupt: - self.stop() - self.sock.close() + def __init__(self, certificate=None, ssl_version=None, + certreqs=None, cacerts=None, + chatty=True, connectionchatty=False, starttls_server=False, + npn_protocols=None, alpn_protocols=None, + ciphers=None, context=None): + if context: + self.context = context + else: + self.context = ssl.SSLContext(ssl_version + if ssl_version is not None + else ssl.PROTOCOL_TLSv1) + self.context.verify_mode = (certreqs if certreqs is not None + else ssl.CERT_NONE) + if cacerts: + self.context.load_verify_locations(cacerts) + if certificate: + self.context.load_cert_chain(certificate) + if npn_protocols: + self.context.set_npn_protocols(npn_protocols) + if alpn_protocols: + self.context.set_alpn_protocols(alpn_protocols) + if ciphers: + self.context.set_ciphers(ciphers) + self.chatty = chatty + self.connectionchatty = connectionchatty + self.starttls_server = starttls_server + self.sock = socket.socket() + self.port = support.bind_port(self.sock) + self.flag = None + self.active = False + self.selected_npn_protocols = [] + self.selected_alpn_protocols = [] + self.shared_ciphers = [] + self.conn_errors = [] + threading.Thread.__init__(self) + self.daemon = True + + def __enter__(self): + self.start(threading.Event()) + self.flag.wait() + return self + + def __exit__(self, *args): + self.stop() + self.join() + + def start(self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + self.sock.settimeout(0.05) + self.sock.listen() + self.active = True + if self.flag: + # signal an event + self.flag.set() + while self.active: + try: + newconn, connaddr = self.sock.accept() + if support.verbose and self.chatty: + sys.stdout.write(' server: new connection from ' + + repr(connaddr) + '\n') + handler = self.ConnectionHandler(self, newconn, connaddr) + handler.start() + handler.join() + except socket.timeout: + pass + except KeyboardInterrupt: + self.stop() + self.sock.close() - def stop(self): - self.active = False + def stop(self): + self.active = False - class AsyncoreEchoServer(threading.Thread): +class AsyncoreEchoServer(threading.Thread): - # this one's based on asyncore.dispatcher + # this one's based on asyncore.dispatcher - class EchoServer (asyncore.dispatcher): + class EchoServer (asyncore.dispatcher): - class ConnectionHandler(asyncore.dispatcher_with_send): + class ConnectionHandler(asyncore.dispatcher_with_send): - def __init__(self, conn, certfile): - self.socket = test_wrap_socket(conn, server_side=True, - certfile=certfile, - do_handshake_on_connect=False) - asyncore.dispatcher_with_send.__init__(self, self.socket) - self._ssl_accepting = True - self._do_ssl_handshake() + def __init__(self, conn, certfile): + self.socket = test_wrap_socket(conn, server_side=True, + certfile=certfile, + do_handshake_on_connect=False) + asyncore.dispatcher_with_send.__init__(self, self.socket) + self._ssl_accepting = True + self._do_ssl_handshake() - def readable(self): - if isinstance(self.socket, ssl.SSLSocket): - while self.socket.pending() > 0: - self.handle_read_event() - return True + def readable(self): + if isinstance(self.socket, ssl.SSLSocket): + while self.socket.pending() > 0: + self.handle_read_event() + return True - def _do_ssl_handshake(self): - try: - self.socket.do_handshake() - except (ssl.SSLWantReadError, ssl.SSLWantWriteError): - return - except ssl.SSLEOFError: + def _do_ssl_handshake(self): + try: + self.socket.do_handshake() + except (ssl.SSLWantReadError, ssl.SSLWantWriteError): + return + except ssl.SSLEOFError: + return self.handle_close() + except ssl.SSLError: + raise + except OSError as err: + if err.args[0] == errno.ECONNABORTED: return self.handle_close() - except ssl.SSLError: - raise - except OSError as err: - if err.args[0] == errno.ECONNABORTED: - return self.handle_close() - else: - self._ssl_accepting = False - - def handle_read(self): - if self._ssl_accepting: - self._do_ssl_handshake() - else: - data = self.recv(1024) - if support.verbose: - sys.stdout.write(" server: read %s from client\n" % repr(data)) - if not data: - self.close() - else: - self.send(data.lower()) + else: + self._ssl_accepting = False - def handle_close(self): - self.close() + def handle_read(self): + if self._ssl_accepting: + self._do_ssl_handshake() + else: + data = self.recv(1024) if support.verbose: - sys.stdout.write(" server: closed connection %s\n" % self.socket) - - def handle_error(self): - raise - - def __init__(self, certfile): - self.certfile = certfile - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = support.bind_port(sock, '') - asyncore.dispatcher.__init__(self, sock) - self.listen(5) + sys.stdout.write(" server: read %s from client\n" % repr(data)) + if not data: + self.close() + else: + self.send(data.lower()) - def handle_accepted(self, sock_obj, addr): + def handle_close(self): + self.close() if support.verbose: - sys.stdout.write(" server: new connection from %s:%s\n" %addr) - self.ConnectionHandler(sock_obj, self.certfile) + sys.stdout.write(" server: closed connection %s\n" % self.socket) def handle_error(self): raise def __init__(self, certfile): - self.flag = None - self.active = False - self.server = self.EchoServer(certfile) - self.port = self.server.port - threading.Thread.__init__(self) - self.daemon = True + self.certfile = certfile + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = support.bind_port(sock, '') + asyncore.dispatcher.__init__(self, sock) + self.listen(5) - def __str__(self): - return "<%s %s>" % (self.__class__.__name__, self.server) + def handle_accepted(self, sock_obj, addr): + if support.verbose: + sys.stdout.write(" server: new connection from %s:%s\n" %addr) + self.ConnectionHandler(sock_obj, self.certfile) - def __enter__(self): - self.start(threading.Event()) - self.flag.wait() - return self + def handle_error(self): + raise - def __exit__(self, *args): - if support.verbose: - sys.stdout.write(" cleanup: stopping server.\n") - self.stop() - if support.verbose: - sys.stdout.write(" cleanup: joining server thread.\n") - self.join() - if support.verbose: - sys.stdout.write(" cleanup: successfully joined.\n") - # make sure that ConnectionHandler is removed from socket_map - asyncore.close_all(ignore_all=True) + def __init__(self, certfile): + self.flag = None + self.active = False + self.server = self.EchoServer(certfile) + self.port = self.server.port + threading.Thread.__init__(self) + self.daemon = True - def start (self, flag=None): - self.flag = flag - threading.Thread.start(self) + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) - def run(self): - self.active = True - if self.flag: - self.flag.set() - while self.active: - try: - asyncore.loop(1) - except: - pass + def __enter__(self): + self.start(threading.Event()) + self.flag.wait() + return self - def stop(self): - self.active = False - self.server.close() + def __exit__(self, *args): + if support.verbose: + sys.stdout.write(" cleanup: stopping server.\n") + self.stop() + if support.verbose: + sys.stdout.write(" cleanup: joining server thread.\n") + self.join() + if support.verbose: + sys.stdout.write(" cleanup: successfully joined.\n") + # make sure that ConnectionHandler is removed from socket_map + asyncore.close_all(ignore_all=True) + + def start (self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run(self): + self.active = True + if self.flag: + self.flag.set() + while self.active: + try: + asyncore.loop(1) + except: + pass - def server_params_test(client_context, server_context, indata=b"FOO\n", - chatty=True, connectionchatty=False, sni_name=None, - session=None): - """ - Launch a server, connect a client to it and try various reads - and writes. - """ - stats = {} - server = ThreadedEchoServer(context=server_context, - chatty=chatty, - connectionchatty=False) - with server: - with client_context.wrap_socket(socket.socket(), - server_hostname=sni_name, session=session) as s: - s.connect((HOST, server.port)) - for arg in [indata, bytearray(indata), memoryview(indata)]: - if connectionchatty: - if support.verbose: - sys.stdout.write( - " client: sending %r...\n" % indata) - s.write(arg) - outdata = s.read() - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: read %r\n" % outdata) - if outdata != indata.lower(): - raise AssertionError( - "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" - % (outdata[:20], len(outdata), - indata[:20].lower(), len(indata))) - s.write(b"over\n") + def stop(self): + self.active = False + self.server.close() + +def server_params_test(client_context, server_context, indata=b"FOO\n", + chatty=True, connectionchatty=False, sni_name=None, + session=None): + """ + Launch a server, connect a client to it and try various reads + and writes. + """ + stats = {} + server = ThreadedEchoServer(context=server_context, + chatty=chatty, + connectionchatty=False) + with server: + with client_context.wrap_socket(socket.socket(), + server_hostname=sni_name, session=session) as s: + s.connect((HOST, server.port)) + for arg in [indata, bytearray(indata), memoryview(indata)]: if connectionchatty: if support.verbose: - sys.stdout.write(" client: closing connection.\n") - stats.update({ - 'compression': s.compression(), - 'cipher': s.cipher(), - 'peercert': s.getpeercert(), - 'client_alpn_protocol': s.selected_alpn_protocol(), - 'client_npn_protocol': s.selected_npn_protocol(), - 'version': s.version(), - 'session_reused': s.session_reused, - 'session': s.session, - }) - s.close() - stats['server_alpn_protocols'] = server.selected_alpn_protocols - stats['server_npn_protocols'] = server.selected_npn_protocols - stats['server_shared_ciphers'] = server.shared_ciphers - return stats + sys.stdout.write( + " client: sending %r...\n" % indata) + s.write(arg) + outdata = s.read() + if connectionchatty: + if support.verbose: + sys.stdout.write(" client: read %r\n" % outdata) + if outdata != indata.lower(): + raise AssertionError( + "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" + % (outdata[:20], len(outdata), + indata[:20].lower(), len(indata))) + s.write(b"over\n") + if connectionchatty: + if support.verbose: + sys.stdout.write(" client: closing connection.\n") + stats.update({ + 'compression': s.compression(), + 'cipher': s.cipher(), + 'peercert': s.getpeercert(), + 'client_alpn_protocol': s.selected_alpn_protocol(), + 'client_npn_protocol': s.selected_npn_protocol(), + 'version': s.version(), + 'session_reused': s.session_reused, + 'session': s.session, + }) + s.close() + stats['server_alpn_protocols'] = server.selected_alpn_protocols + stats['server_npn_protocols'] = server.selected_npn_protocols + stats['server_shared_ciphers'] = server.shared_ciphers + return stats + +def try_protocol_combo(server_protocol, client_protocol, expect_success, + certsreqs=None, server_options=0, client_options=0): + """ + Try to SSL-connect using *client_protocol* to *server_protocol*. + If *expect_success* is true, assert that the connection succeeds, + if it's false, assert that the connection fails. + Also, if *expect_success* is a string, assert that it is the protocol + version actually used by the connection. + """ + if certsreqs is None: + certsreqs = ssl.CERT_NONE + certtype = { + ssl.CERT_NONE: "CERT_NONE", + ssl.CERT_OPTIONAL: "CERT_OPTIONAL", + ssl.CERT_REQUIRED: "CERT_REQUIRED", + }[certsreqs] + if support.verbose: + formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n" + sys.stdout.write(formatstr % + (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol), + certtype)) + client_context = ssl.SSLContext(client_protocol) + client_context.options |= client_options + server_context = ssl.SSLContext(server_protocol) + server_context.options |= server_options + + # NOTE: we must enable "ALL" ciphers on the client, otherwise an + # SSLv23 client will send an SSLv3 hello (rather than SSLv2) + # starting from OpenSSL 1.0.0 (see issue #8322). + if client_context.protocol == ssl.PROTOCOL_SSLv23: + client_context.set_ciphers("ALL") + + for ctx in (client_context, server_context): + ctx.verify_mode = certsreqs + ctx.load_cert_chain(CERTFILE) + ctx.load_verify_locations(CERTFILE) + try: + stats = server_params_test(client_context, server_context, + chatty=False, connectionchatty=False) + # Protocol mismatch can result in either an SSLError, or a + # "Connection reset by peer" error. + except ssl.SSLError: + if expect_success: + raise + except OSError as e: + if expect_success or e.errno != errno.ECONNRESET: + raise + else: + if not expect_success: + raise AssertionError( + "Client protocol %s succeeded with server protocol %s!" + % (ssl.get_protocol_name(client_protocol), + ssl.get_protocol_name(server_protocol))) + elif (expect_success is not True + and expect_success != stats['version']): + raise AssertionError("version mismatch: expected %r, got %r" + % (expect_success, stats['version'])) - def try_protocol_combo(server_protocol, client_protocol, expect_success, - certsreqs=None, server_options=0, client_options=0): - """ - Try to SSL-connect using *client_protocol* to *server_protocol*. - If *expect_success* is true, assert that the connection succeeds, - if it's false, assert that the connection fails. - Also, if *expect_success* is a string, assert that it is the protocol - version actually used by the connection. - """ - if certsreqs is None: - certsreqs = ssl.CERT_NONE - certtype = { - ssl.CERT_NONE: "CERT_NONE", - ssl.CERT_OPTIONAL: "CERT_OPTIONAL", - ssl.CERT_REQUIRED: "CERT_REQUIRED", - }[certsreqs] - if support.verbose: - formatstr = (expect_success and " %s->%s %s\n") or " {%s->%s} %s\n" - sys.stdout.write(formatstr % - (ssl.get_protocol_name(client_protocol), - ssl.get_protocol_name(server_protocol), - certtype)) - client_context = ssl.SSLContext(client_protocol) - client_context.options |= client_options - server_context = ssl.SSLContext(server_protocol) - server_context.options |= server_options - - # NOTE: we must enable "ALL" ciphers on the client, otherwise an - # SSLv23 client will send an SSLv3 hello (rather than SSLv2) - # starting from OpenSSL 1.0.0 (see issue #8322). - if client_context.protocol == ssl.PROTOCOL_SSLv23: - client_context.set_ciphers("ALL") - - for ctx in (client_context, server_context): - ctx.verify_mode = certsreqs - ctx.load_cert_chain(CERTFILE) - ctx.load_verify_locations(CERTFILE) - try: - stats = server_params_test(client_context, server_context, - chatty=False, connectionchatty=False) - # Protocol mismatch can result in either an SSLError, or a - # "Connection reset by peer" error. - except ssl.SSLError: - if expect_success: - raise - except OSError as e: - if expect_success or e.errno != errno.ECONNRESET: - raise - else: - if not expect_success: - raise AssertionError( - "Client protocol %s succeeded with server protocol %s!" - % (ssl.get_protocol_name(client_protocol), - ssl.get_protocol_name(server_protocol))) - elif (expect_success is not True - and expect_success != stats['version']): - raise AssertionError("version mismatch: expected %r, got %r" - % (expect_success, stats['version'])) - - - class ThreadedTests(unittest.TestCase): - - @skip_if_broken_ubuntu_ssl - def test_echo(self): - """Basic test of an SSL client connecting to a server""" - if support.verbose: - sys.stdout.write("\n") - for protocol in PROTOCOLS: - if protocol in {ssl.PROTOCOL_TLS_CLIENT, ssl.PROTOCOL_TLS_SERVER}: - continue - with self.subTest(protocol=ssl._PROTOCOL_NAMES[protocol]): - context = ssl.SSLContext(protocol) - context.load_cert_chain(CERTFILE) - server_params_test(context, context, - chatty=True, connectionchatty=True) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - client_context.load_verify_locations(SIGNING_CA) - server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) - # server_context.load_verify_locations(SIGNING_CA) - server_context.load_cert_chain(SIGNED_CERTFILE2) +class ThreadedTests(unittest.TestCase): - with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER): - server_params_test(client_context=client_context, - server_context=server_context, + @skip_if_broken_ubuntu_ssl + def test_echo(self): + """Basic test of an SSL client connecting to a server""" + if support.verbose: + sys.stdout.write("\n") + for protocol in PROTOCOLS: + if protocol in {ssl.PROTOCOL_TLS_CLIENT, ssl.PROTOCOL_TLS_SERVER}: + continue + with self.subTest(protocol=ssl._PROTOCOL_NAMES[protocol]): + context = ssl.SSLContext(protocol) + context.load_cert_chain(CERTFILE) + server_params_test(context, context, + chatty=True, connectionchatty=True) + + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + client_context.load_verify_locations(SIGNING_CA) + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + # server_context.load_verify_locations(SIGNING_CA) + server_context.load_cert_chain(SIGNED_CERTFILE2) + + with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER): + server_params_test(client_context=client_context, + server_context=server_context, + chatty=True, connectionchatty=True, + sni_name='fakehostname') + + client_context.check_hostname = False + with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT): + with self.assertRaises(ssl.SSLError) as e: + server_params_test(client_context=server_context, + server_context=client_context, chatty=True, connectionchatty=True, sni_name='fakehostname') + self.assertIn('called a function you should not call', + str(e.exception)) - client_context.check_hostname = False - with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT): - with self.assertRaises(ssl.SSLError) as e: - server_params_test(client_context=server_context, - server_context=client_context, - chatty=True, connectionchatty=True, - sni_name='fakehostname') - self.assertIn('called a function you should not call', - str(e.exception)) - - with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER): - with self.assertRaises(ssl.SSLError) as e: - server_params_test(client_context=server_context, - server_context=server_context, - chatty=True, connectionchatty=True) - self.assertIn('called a function you should not call', - str(e.exception)) + with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER): + with self.assertRaises(ssl.SSLError) as e: + server_params_test(client_context=server_context, + server_context=server_context, + chatty=True, connectionchatty=True) + self.assertIn('called a function you should not call', + str(e.exception)) - with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT): - with self.assertRaises(ssl.SSLError) as e: - server_params_test(client_context=server_context, - server_context=client_context, - chatty=True, connectionchatty=True) - self.assertIn('called a function you should not call', - str(e.exception)) + with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT): + with self.assertRaises(ssl.SSLError) as e: + server_params_test(client_context=server_context, + server_context=client_context, + chatty=True, connectionchatty=True) + self.assertIn('called a function you should not call', + str(e.exception)) - def test_getpeercert(self): + def test_getpeercert(self): + if support.verbose: + sys.stdout.write("\n") + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(CERTFILE) + context.load_cert_chain(CERTFILE) + server = ThreadedEchoServer(context=context, chatty=False) + with server: + s = context.wrap_socket(socket.socket(), + do_handshake_on_connect=False) + s.connect((HOST, server.port)) + # getpeercert() raise ValueError while the handshake isn't + # done. + with self.assertRaises(ValueError): + s.getpeercert() + s.do_handshake() + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") + cipher = s.cipher() if support.verbose: - sys.stdout.write("\n") - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = ThreadedEchoServer(context=context, chatty=False) - with server: - s = context.wrap_socket(socket.socket(), - do_handshake_on_connect=False) + sys.stdout.write(pprint.pformat(cert) + '\n') + sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') + if 'subject' not in cert: + self.fail("No subject field in certificate: %s." % + pprint.pformat(cert)) + if ((('organizationName', 'Python Software Foundation'),) + not in cert['subject']): + self.fail( + "Missing or invalid 'organizationName' field in certificate subject; " + "should be 'Python Software Foundation'.") + self.assertIn('notBefore', cert) + self.assertIn('notAfter', cert) + before = ssl.cert_time_to_seconds(cert['notBefore']) + after = ssl.cert_time_to_seconds(cert['notAfter']) + self.assertLess(before, after) + s.close() + + @unittest.skipUnless(have_verify_flags(), + "verify_flags need OpenSSL > 0.9.8") + def test_crl_check(self): + if support.verbose: + sys.stdout.write("\n") + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(SIGNED_CERTFILE) + + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(SIGNING_CA) + tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0) + self.assertEqual(context.verify_flags, ssl.VERIFY_DEFAULT | tf) + + # VERIFY_DEFAULT should pass + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket()) as s: s.connect((HOST, server.port)) - # getpeercert() raise ValueError while the handshake isn't - # done. - with self.assertRaises(ValueError): - s.getpeercert() - s.do_handshake() cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") - cipher = s.cipher() - if support.verbose: - sys.stdout.write(pprint.pformat(cert) + '\n') - sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') - if 'subject' not in cert: - self.fail("No subject field in certificate: %s." % - pprint.pformat(cert)) - if ((('organizationName', 'Python Software Foundation'),) - not in cert['subject']): - self.fail( - "Missing or invalid 'organizationName' field in certificate subject; " - "should be 'Python Software Foundation'.") - self.assertIn('notBefore', cert) - self.assertIn('notAfter', cert) - before = ssl.cert_time_to_seconds(cert['notBefore']) - after = ssl.cert_time_to_seconds(cert['notAfter']) - self.assertLess(before, after) - s.close() - @unittest.skipUnless(have_verify_flags(), - "verify_flags need OpenSSL > 0.9.8") - def test_crl_check(self): - if support.verbose: - sys.stdout.write("\n") + # VERIFY_CRL_CHECK_LEAF without a loaded CRL file fails + context.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(SIGNING_CA) - tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0) - self.assertEqual(context.verify_flags, ssl.VERIFY_DEFAULT | tf) - - # VERIFY_DEFAULT should pass - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with context.wrap_socket(socket.socket()) as s: + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket()) as s: + with self.assertRaisesRegex(ssl.SSLError, + "certificate verify failed"): s.connect((HOST, server.port)) - cert = s.getpeercert() - self.assertTrue(cert, "Can't get peer certificate.") - # VERIFY_CRL_CHECK_LEAF without a loaded CRL file fails - context.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF + # now load a CRL file. The CRL file is signed by the CA. + context.load_verify_locations(CRLFILE) - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with context.wrap_socket(socket.socket()) as s: - with self.assertRaisesRegex(ssl.SSLError, - "certificate verify failed"): - s.connect((HOST, server.port)) + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") - # now load a CRL file. The CRL file is signed by the CA. - context.load_verify_locations(CRLFILE) + def test_check_hostname(self): + if support.verbose: + sys.stdout.write("\n") - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with context.wrap_socket(socket.socket()) as s: - s.connect((HOST, server.port)) - cert = s.getpeercert() - self.assertTrue(cert, "Can't get peer certificate.") + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(SIGNED_CERTFILE) - def test_check_hostname(self): - if support.verbose: - sys.stdout.write("\n") + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.verify_mode = ssl.CERT_REQUIRED + context.check_hostname = True + context.load_verify_locations(SIGNING_CA) - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED - context.check_hostname = True - context.load_verify_locations(SIGNING_CA) - - # correct hostname should verify - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with context.wrap_socket(socket.socket(), - server_hostname="localhost") as s: + # correct hostname should verify + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket(), + server_hostname="localhost") as s: + s.connect((HOST, server.port)) + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") + + # incorrect hostname should raise an exception + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket(), + server_hostname="invalid") as s: + with self.assertRaisesRegex(ssl.CertificateError, + "hostname 'invalid' doesn't match 'localhost'"): s.connect((HOST, server.port)) - cert = s.getpeercert() - self.assertTrue(cert, "Can't get peer certificate.") - - # incorrect hostname should raise an exception - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with context.wrap_socket(socket.socket(), - server_hostname="invalid") as s: - with self.assertRaisesRegex(ssl.CertificateError, - "hostname 'invalid' doesn't match 'localhost'"): - s.connect((HOST, server.port)) - - # missing server_hostname arg should cause an exception, too - server = ThreadedEchoServer(context=server_context, chatty=True) - with server: - with socket.socket() as s: - with self.assertRaisesRegex(ValueError, - "check_hostname requires server_hostname"): - context.wrap_socket(s) - - def test_wrong_cert(self): - """Connecting when the server rejects the client's certificate - - Launch a server with CERT_REQUIRED, and check that trying to - connect to it with a wrong client certificate fails. - """ - certfile = os.path.join(os.path.dirname(__file__) or os.curdir, - "wrongcert.pem") - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_REQUIRED, - cacerts=CERTFILE, chatty=False, - connectionchatty=False) - with server, \ - socket.socket() as sock, \ - test_wrap_socket(sock, - certfile=certfile, - ssl_version=ssl.PROTOCOL_TLSv1) as s: + + # missing server_hostname arg should cause an exception, too + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with socket.socket() as s: + with self.assertRaisesRegex(ValueError, + "check_hostname requires server_hostname"): + context.wrap_socket(s) + + def test_wrong_cert(self): + """Connecting when the server rejects the client's certificate + + Launch a server with CERT_REQUIRED, and check that trying to + connect to it with a wrong client certificate fails. + """ + certfile = os.path.join(os.path.dirname(__file__) or os.curdir, + "wrongcert.pem") + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_REQUIRED, + cacerts=CERTFILE, chatty=False, + connectionchatty=False) + with server, \ + socket.socket() as sock, \ + test_wrap_socket(sock, + certfile=certfile, + ssl_version=ssl.PROTOCOL_TLSv1) as s: + try: + # Expect either an SSL error about the server rejecting + # the connection, or a low-level connection reset (which + # sometimes happens on Windows) + s.connect((HOST, server.port)) + except ssl.SSLError as e: + if support.verbose: + sys.stdout.write("\nSSLError is %r\n" % e) + except OSError as e: + if e.errno != errno.ECONNRESET: + raise + if support.verbose: + sys.stdout.write("\nsocket.error is %r\n" % e) + else: + self.fail("Use of invalid cert should have failed!") + + def test_rude_shutdown(self): + """A brutal shutdown of an SSL server should raise an OSError + in the client when attempting handshake. + """ + listener_ready = threading.Event() + listener_gone = threading.Event() + + s = socket.socket() + port = support.bind_port(s, HOST) + + # `listener` runs in a thread. It sits in an 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.listen() + listener_ready.set() + newsock, addr = s.accept() + newsock.close() + s.close() + listener_gone.set() + + def connector(): + listener_ready.wait() + with socket.socket() as c: + c.connect((HOST, port)) + listener_gone.wait() try: - # Expect either an SSL error about the server rejecting - # the connection, or a low-level connection reset (which - # sometimes happens on Windows) - s.connect((HOST, server.port)) - except ssl.SSLError as e: - if support.verbose: - sys.stdout.write("\nSSLError is %r\n" % e) - except OSError as e: - if e.errno != errno.ECONNRESET: - raise - if support.verbose: - sys.stdout.write("\nsocket.error is %r\n" % e) + ssl_sock = test_wrap_socket(c) + except OSError: + pass else: - self.fail("Use of invalid cert should have failed!") + self.fail('connecting to closed SSL socket should have failed') - def test_rude_shutdown(self): - """A brutal shutdown of an SSL server should raise an OSError - in the client when attempting handshake. - """ - listener_ready = threading.Event() - listener_gone = threading.Event() + t = threading.Thread(target=listener) + t.start() + try: + connector() + finally: + t.join() - s = socket.socket() - port = support.bind_port(s, HOST) - - # `listener` runs in a thread. It sits in an 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.listen() - listener_ready.set() - newsock, addr = s.accept() - newsock.close() - s.close() - listener_gone.set() - - def connector(): - listener_ready.wait() - with socket.socket() as c: - c.connect((HOST, port)) - listener_gone.wait() - try: - ssl_sock = test_wrap_socket(c) - except OSError: - pass - else: - self.fail('connecting to closed SSL socket should have failed') + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), + "OpenSSL is compiled without SSLv2 support") + def test_protocol_sslv2(self): + """Connecting to an SSLv2 server with various client options""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False) + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) + # SSLv23 client with specific SSL options + if no_sslv2_implies_sslv3_hello(): + # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_SSLv2) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_SSLv3) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1) - t = threading.Thread(target=listener) - t.start() + @skip_if_broken_ubuntu_ssl + def test_protocol_sslv23(self): + """Connecting to an SSLv23 server with various client options""" + if support.verbose: + sys.stdout.write("\n") + if hasattr(ssl, 'PROTOCOL_SSLv2'): try: - connector() - finally: - t.join() + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) + except OSError as x: + # this fails on some older versions of OpenSSL (0.9.7l, for instance) + if support.verbose: + sys.stdout.write( + " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" + % str(x)) + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1') + + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) + + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) + + # Server with specific SSL options + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, + server_options=ssl.OP_NO_SSLv3) + # Will choose TLSv1 + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, + server_options=ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, False, + server_options=ssl.OP_NO_TLSv1) + + + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv3'), + "OpenSSL is compiled without SSLv3 support") + def test_protocol_sslv3(self): + """Connecting to an SSLv3 server with various client options""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3') + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_REQUIRED) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_SSLv3) + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) + if no_sslv2_implies_sslv3_hello(): + # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, + False, client_options=ssl.OP_NO_SSLv2) + + @skip_if_broken_ubuntu_ssl + def test_protocol_tlsv1(self): + """Connecting to a TLSv1 server with various client options""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1') + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1) + + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_1"), + "TLS version 1.1 not supported.") + def test_protocol_tlsv1_1(self): + """Connecting to a TLSv1.1 server with various client options. + Testing against older TLS versions.""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv2, False) + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1_1) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_1, False) - @skip_if_broken_ubuntu_ssl - @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), - "OpenSSL is compiled without SSLv2 support") - def test_protocol_sslv2(self): - """Connecting to an SSLv2 server with various client options""" - if support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False) - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) - # SSLv23 client with specific SSL options - if no_sslv2_implies_sslv3_hello(): - # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_SSLv2) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_SSLv3) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_TLSv1) - @skip_if_broken_ubuntu_ssl - def test_protocol_sslv23(self): - """Connecting to an SSLv23 server with various client options""" + @skip_if_broken_ubuntu_ssl + @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_2"), + "TLS version 1.2 not supported.") + def test_protocol_tlsv1_2(self): + """Connecting to a TLSv1.2 server with various client options. + Testing against older TLS versions.""" + if support.verbose: + sys.stdout.write("\n") + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2', + server_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2, + client_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2,) + if hasattr(ssl, 'PROTOCOL_SSLv2'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv2, False) + if hasattr(ssl, 'PROTOCOL_SSLv3'): + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv23, False, + client_options=ssl.OP_NO_TLSv1_2) + + try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2') + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_2, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False) + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_2, False) + + def test_starttls(self): + """Switching from clear text to encrypted and back again.""" + msgs = (b"msg 1", b"MSG 2", b"STARTTLS", b"MSG 3", b"msg 4", b"ENDTLS", b"msg 5", b"msg 6") + + server = ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_TLSv1, + starttls_server=True, + chatty=True, + connectionchatty=True) + wrapped = False + with server: + s = socket.socket() + s.setblocking(1) + s.connect((HOST, server.port)) if support.verbose: sys.stdout.write("\n") - if hasattr(ssl, 'PROTOCOL_SSLv2'): - try: - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) - except OSError as x: - # this fails on some older versions of OpenSSL (0.9.7l, for instance) + for indata in msgs: + if support.verbose: + sys.stdout.write( + " client: sending %r...\n" % indata) + if wrapped: + conn.write(indata) + outdata = conn.read() + else: + s.send(indata) + outdata = s.recv(1024) + msg = outdata.strip().lower() + if indata == b"STARTTLS" and msg.startswith(b"ok"): + # STARTTLS ok, switch to secure mode if support.verbose: sys.stdout.write( - " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" - % str(x)) - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1') - - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) - - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) - - # Server with specific SSL options - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, - server_options=ssl.OP_NO_SSLv3) - # Will choose TLSv1 - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, - server_options=ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, False, - server_options=ssl.OP_NO_TLSv1) - - - @skip_if_broken_ubuntu_ssl - @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv3'), - "OpenSSL is compiled without SSLv3 support") - def test_protocol_sslv3(self): - """Connecting to an SSLv3 server with various client options""" - if support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3') - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_REQUIRED) - if hasattr(ssl, 'PROTOCOL_SSLv2'): - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_SSLv3) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) - if no_sslv2_implies_sslv3_hello(): - # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, - False, client_options=ssl.OP_NO_SSLv2) - - @skip_if_broken_ubuntu_ssl - def test_protocol_tlsv1(self): - """Connecting to a TLSv1 server with various client options""" - if support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1') - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) - if hasattr(ssl, 'PROTOCOL_SSLv2'): - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_TLSv1) - - @skip_if_broken_ubuntu_ssl - @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_1"), - "TLS version 1.1 not supported.") - def test_protocol_tlsv1_1(self): - """Connecting to a TLSv1.1 server with various client options. - Testing against older TLS versions.""" - if support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') - if hasattr(ssl, 'PROTOCOL_SSLv2'): - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv2, False) - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_TLSv1_1) - - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_1, False) - - - @skip_if_broken_ubuntu_ssl - @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_2"), - "TLS version 1.2 not supported.") - def test_protocol_tlsv1_2(self): - """Connecting to a TLSv1.2 server with various client options. - Testing against older TLS versions.""" - if support.verbose: - sys.stdout.write("\n") - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2', - server_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2, - client_options=ssl.OP_NO_SSLv3|ssl.OP_NO_SSLv2,) - if hasattr(ssl, 'PROTOCOL_SSLv2'): - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv2, False) - if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_TLSv1_2) - - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2') - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_2, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1_2, False) - - def test_starttls(self): - """Switching from clear text to encrypted and back again.""" - msgs = (b"msg 1", b"MSG 2", b"STARTTLS", b"MSG 3", b"msg 4", b"ENDTLS", b"msg 5", b"msg 6") - - server = ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_TLSv1, - starttls_server=True, - chatty=True, - connectionchatty=True) - wrapped = False - with server: - s = socket.socket() - s.setblocking(1) - s.connect((HOST, server.port)) - if support.verbose: - sys.stdout.write("\n") - for indata in msgs: + " client: read %r from server, starting TLS...\n" + % msg) + conn = test_wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) + wrapped = True + elif indata == b"ENDTLS" and msg.startswith(b"ok"): + # ENDTLS ok, switch back to clear text if support.verbose: sys.stdout.write( - " client: sending %r...\n" % indata) - if wrapped: - conn.write(indata) - outdata = conn.read() - else: - s.send(indata) - outdata = s.recv(1024) - msg = outdata.strip().lower() - if indata == b"STARTTLS" and msg.startswith(b"ok"): - # STARTTLS ok, switch to secure mode - if support.verbose: - sys.stdout.write( - " client: read %r from server, starting TLS...\n" - % msg) - conn = test_wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) - wrapped = True - elif indata == b"ENDTLS" and msg.startswith(b"ok"): - # ENDTLS ok, switch back to clear text - if support.verbose: - sys.stdout.write( - " client: read %r from server, ending TLS...\n" - % msg) - s = conn.unwrap() - wrapped = False - else: - if support.verbose: - sys.stdout.write( - " client: read %r from server\n" % msg) - if support.verbose: - sys.stdout.write(" client: closing connection.\n") - if wrapped: - conn.write(b"over\n") + " client: read %r from server, ending TLS...\n" + % msg) + s = conn.unwrap() + wrapped = False else: - s.send(b"over\n") - if wrapped: - conn.close() - else: - s.close() - - def test_socketserver(self): - """Using socketserver to create and manage SSL connections.""" - server = make_https_server(self, certfile=CERTFILE) - # try to connect - if support.verbose: - sys.stdout.write('\n') - with open(CERTFILE, 'rb') as f: - d1 = f.read() - d2 = '' - # now fetch the same data from the HTTPS server - url = 'https://localhost:%d/%s' % ( - server.port, os.path.split(CERTFILE)[1]) - context = ssl.create_default_context(cafile=CERTFILE) - f = urllib.request.urlopen(url, context=context) - try: - dlen = f.info().get("content-length") - if dlen and (int(dlen) > 0): - d2 = f.read(int(dlen)) if support.verbose: sys.stdout.write( - " client: read %d bytes from remote server '%s'\n" - % (len(d2), server)) - finally: - f.close() - self.assertEqual(d1, d2) - - def test_asyncore_server(self): - """Check the example asyncore integration.""" + " client: read %r from server\n" % msg) if support.verbose: - sys.stdout.write("\n") + sys.stdout.write(" client: closing connection.\n") + if wrapped: + conn.write(b"over\n") + else: + s.send(b"over\n") + if wrapped: + conn.close() + else: + s.close() - indata = b"FOO\n" - server = AsyncoreEchoServer(CERTFILE) - with server: - s = test_wrap_socket(socket.socket()) - s.connect(('127.0.0.1', server.port)) + def test_socketserver(self): + """Using socketserver to create and manage SSL connections.""" + server = make_https_server(self, certfile=CERTFILE) + # try to connect + if support.verbose: + sys.stdout.write('\n') + with open(CERTFILE, 'rb') as f: + d1 = f.read() + d2 = '' + # now fetch the same data from the HTTPS server + url = 'https://localhost:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) + context = ssl.create_default_context(cafile=CERTFILE) + f = urllib.request.urlopen(url, context=context) + try: + dlen = f.info().get("content-length") + if dlen and (int(dlen) > 0): + d2 = f.read(int(dlen)) if support.verbose: sys.stdout.write( - " client: sending %r...\n" % indata) - s.write(indata) - outdata = s.read() - if support.verbose: - sys.stdout.write(" client: read %r\n" % outdata) - if outdata != indata.lower(): - self.fail( - "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" - % (outdata[:20], len(outdata), - indata[:20].lower(), len(indata))) - s.write(b"over\n") - if support.verbose: - sys.stdout.write(" client: closing connection.\n") - s.close() - if support.verbose: - sys.stdout.write(" client: connection closed.\n") + " client: read %d bytes from remote server '%s'\n" + % (len(d2), server)) + finally: + f.close() + self.assertEqual(d1, d2) - def test_recv_send(self): - """Test recv(), send() and friends.""" + def test_asyncore_server(self): + """Check the example asyncore integration.""" + if support.verbose: + sys.stdout.write("\n") + + indata = b"FOO\n" + server = AsyncoreEchoServer(CERTFILE) + with server: + s = test_wrap_socket(socket.socket()) + s.connect(('127.0.0.1', server.port)) if support.verbose: - sys.stdout.write("\n") + sys.stdout.write( + " client: sending %r...\n" % indata) + s.write(indata) + outdata = s.read() + if support.verbose: + sys.stdout.write(" client: read %r\n" % outdata) + if outdata != indata.lower(): + self.fail( + "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" + % (outdata[:20], len(outdata), + indata[:20].lower(), len(indata))) + s.write(b"over\n") + if support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + if support.verbose: + sys.stdout.write(" client: connection closed.\n") - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, - cacerts=CERTFILE, - chatty=True, - connectionchatty=False) - with server: - s = test_wrap_socket(socket.socket(), - server_side=False, - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) - s.connect((HOST, server.port)) - # helper methods for standardising recv* method signatures - def _recv_into(): - b = bytearray(b"\0"*100) - count = s.recv_into(b) - return b[:count] - - def _recvfrom_into(): - b = bytearray(b"\0"*100) - count, addr = s.recvfrom_into(b) - return b[:count] - - # (name, method, expect success?, *args, return value func) - send_methods = [ - ('send', s.send, True, [], len), - ('sendto', s.sendto, False, ["some.address"], len), - ('sendall', s.sendall, True, [], lambda x: None), - ] - # (name, method, whether to expect success, *args) - recv_methods = [ - ('recv', s.recv, True, []), - ('recvfrom', s.recvfrom, False, ["some.address"]), - ('recv_into', _recv_into, True, []), - ('recvfrom_into', _recvfrom_into, False, []), - ] - data_prefix = "PREFIX_" - - for (meth_name, send_meth, expect_success, args, - ret_val_meth) in send_methods: - indata = (data_prefix + meth_name).encode('ascii') - try: - ret = send_meth(indata, *args) - msg = "sending with {}".format(meth_name) - self.assertEqual(ret, ret_val_meth(indata), msg=msg) - outdata = s.read() - if outdata != indata.lower(): - self.fail( - "While sending with <<{name:s}>> bad data " - "<<{outdata:r}>> ({nout:d}) received; " - "expected <<{indata:r}>> ({nin:d})\n".format( - name=meth_name, outdata=outdata[:20], - nout=len(outdata), - indata=indata[:20], nin=len(indata) - ) - ) - except ValueError as e: - if expect_success: - self.fail( - "Failed to send with method <<{name:s}>>; " - "expected to succeed.\n".format(name=meth_name) + def test_recv_send(self): + """Test recv(), send() and friends.""" + if support.verbose: + sys.stdout.write("\n") + + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + with server: + s = test_wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + # helper methods for standardising recv* method signatures + def _recv_into(): + b = bytearray(b"\0"*100) + count = s.recv_into(b) + return b[:count] + + def _recvfrom_into(): + b = bytearray(b"\0"*100) + count, addr = s.recvfrom_into(b) + return b[:count] + + # (name, method, expect success?, *args, return value func) + send_methods = [ + ('send', s.send, True, [], len), + ('sendto', s.sendto, False, ["some.address"], len), + ('sendall', s.sendall, True, [], lambda x: None), + ] + # (name, method, whether to expect success, *args) + recv_methods = [ + ('recv', s.recv, True, []), + ('recvfrom', s.recvfrom, False, ["some.address"]), + ('recv_into', _recv_into, True, []), + ('recvfrom_into', _recvfrom_into, False, []), + ] + data_prefix = "PREFIX_" + + for (meth_name, send_meth, expect_success, args, + ret_val_meth) in send_methods: + indata = (data_prefix + meth_name).encode('ascii') + try: + ret = send_meth(indata, *args) + msg = "sending with {}".format(meth_name) + self.assertEqual(ret, ret_val_meth(indata), msg=msg) + outdata = s.read() + if outdata != indata.lower(): + self.fail( + "While sending with <<{name:s}>> bad data " + "<<{outdata:r}>> ({nout:d}) received; " + "expected <<{indata:r}>> ({nin:d})\n".format( + name=meth_name, outdata=outdata[:20], + nout=len(outdata), + indata=indata[:20], nin=len(indata) ) - if not str(e).startswith(meth_name): - self.fail( - "Method <<{name:s}>> failed with unexpected " - "exception message: {exp:s}\n".format( - name=meth_name, exp=e - ) + ) + except ValueError as e: + if expect_success: + self.fail( + "Failed to send with method <<{name:s}>>; " + "expected to succeed.\n".format(name=meth_name) + ) + if not str(e).startswith(meth_name): + self.fail( + "Method <<{name:s}>> failed with unexpected " + "exception message: {exp:s}\n".format( + name=meth_name, exp=e ) + ) - for meth_name, recv_meth, expect_success, args in recv_methods: - indata = (data_prefix + meth_name).encode('ascii') - try: - s.send(indata) - outdata = recv_meth(*args) - if outdata != indata.lower(): - self.fail( - "While receiving with <<{name:s}>> bad data " - "<<{outdata:r}>> ({nout:d}) received; " - "expected <<{indata:r}>> ({nin:d})\n".format( - name=meth_name, outdata=outdata[:20], - nout=len(outdata), - indata=indata[:20], nin=len(indata) - ) - ) - except ValueError as e: - if expect_success: - self.fail( - "Failed to receive with method <<{name:s}>>; " - "expected to succeed.\n".format(name=meth_name) + for meth_name, recv_meth, expect_success, args in recv_methods: + indata = (data_prefix + meth_name).encode('ascii') + try: + s.send(indata) + outdata = recv_meth(*args) + if outdata != indata.lower(): + self.fail( + "While receiving with <<{name:s}>> bad data " + "<<{outdata:r}>> ({nout:d}) received; " + "expected <<{indata:r}>> ({nin:d})\n".format( + name=meth_name, outdata=outdata[:20], + nout=len(outdata), + indata=indata[:20], nin=len(indata) ) - if not str(e).startswith(meth_name): - self.fail( - "Method <<{name:s}>> failed with unexpected " - "exception message: {exp:s}\n".format( - name=meth_name, exp=e - ) + ) + except ValueError as e: + if expect_success: + self.fail( + "Failed to receive with method <<{name:s}>>; " + "expected to succeed.\n".format(name=meth_name) + ) + if not str(e).startswith(meth_name): + self.fail( + "Method <<{name:s}>> failed with unexpected " + "exception message: {exp:s}\n".format( + name=meth_name, exp=e ) - # consume data - s.read() + ) + # consume data + s.read() - # read(-1, buffer) is supported, even though read(-1) is not - data = b"data" - s.send(data) - buffer = bytearray(len(data)) - self.assertEqual(s.read(-1, buffer), len(data)) - self.assertEqual(buffer, data) + # read(-1, buffer) is supported, even though read(-1) is not + data = b"data" + s.send(data) + buffer = bytearray(len(data)) + self.assertEqual(s.read(-1, buffer), len(data)) + self.assertEqual(buffer, data) - # Make sure sendmsg et al are disallowed to avoid - # inadvertent disclosure of data and/or corruption - # of the encrypted data stream - self.assertRaises(NotImplementedError, s.sendmsg, [b"data"]) - self.assertRaises(NotImplementedError, s.recvmsg, 100) - self.assertRaises(NotImplementedError, - s.recvmsg_into, bytearray(100)) + # Make sure sendmsg et al are disallowed to avoid + # inadvertent disclosure of data and/or corruption + # of the encrypted data stream + self.assertRaises(NotImplementedError, s.sendmsg, [b"data"]) + self.assertRaises(NotImplementedError, s.recvmsg, 100) + self.assertRaises(NotImplementedError, + s.recvmsg_into, bytearray(100)) - s.write(b"over\n") + s.write(b"over\n") - self.assertRaises(ValueError, s.recv, -1) - self.assertRaises(ValueError, s.read, -1) + self.assertRaises(ValueError, s.recv, -1) + self.assertRaises(ValueError, s.read, -1) - s.close() + s.close() - def test_recv_zero(self): - server = ThreadedEchoServer(CERTFILE) - server.__enter__() - self.addCleanup(server.__exit__, None, None) - s = socket.create_connection((HOST, server.port)) - self.addCleanup(s.close) - s = test_wrap_socket(s, suppress_ragged_eofs=False) - self.addCleanup(s.close) + def test_recv_zero(self): + server = ThreadedEchoServer(CERTFILE) + server.__enter__() + self.addCleanup(server.__exit__, None, None) + s = socket.create_connection((HOST, server.port)) + self.addCleanup(s.close) + s = test_wrap_socket(s, suppress_ragged_eofs=False) + self.addCleanup(s.close) - # recv/read(0) should return no data - s.send(b"data") - self.assertEqual(s.recv(0), b"") - self.assertEqual(s.read(0), b"") - self.assertEqual(s.read(), b"data") + # recv/read(0) should return no data + s.send(b"data") + self.assertEqual(s.recv(0), b"") + self.assertEqual(s.read(0), b"") + self.assertEqual(s.read(), b"data") + + # Should not block if the other end sends no data + s.setblocking(False) + self.assertEqual(s.recv(0), b"") + self.assertEqual(s.recv_into(bytearray()), 0) - # Should not block if the other end sends no data + def test_nonblocking_send(self): + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + with server: + s = test_wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) s.setblocking(False) - self.assertEqual(s.recv(0), b"") - self.assertEqual(s.recv_into(bytearray()), 0) - - def test_nonblocking_send(self): - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, - cacerts=CERTFILE, - chatty=True, - connectionchatty=False) - with server: - s = test_wrap_socket(socket.socket(), - server_side=False, - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) - s.connect((HOST, server.port)) - s.setblocking(False) - - # If we keep sending data, at some point the buffers - # will be full and the call will block - buf = bytearray(8192) - def fill_buffer(): - while True: - s.send(buf) - self.assertRaises((ssl.SSLWantWriteError, - ssl.SSLWantReadError), fill_buffer) - - # Now read all the output and discard it - s.setblocking(True) - s.close() - def test_handshake_timeout(self): - # Issue #5103: SSL handshake must respect the socket timeout - server = socket.socket(socket.AF_INET) - host = "127.0.0.1" - port = support.bind_port(server) - started = threading.Event() - finish = False - - def serve(): - server.listen() - started.set() - conns = [] - while not finish: - r, w, e = select.select([server], [], [], 0.1) - if server in r: - # Let the socket hang around rather than having - # it closed by garbage collection. - conns.append(server.accept()[0]) - for sock in conns: - sock.close() - - t = threading.Thread(target=serve) - t.start() - started.wait() + # If we keep sending data, at some point the buffers + # will be full and the call will block + buf = bytearray(8192) + def fill_buffer(): + while True: + s.send(buf) + self.assertRaises((ssl.SSLWantWriteError, + ssl.SSLWantReadError), fill_buffer) + + # Now read all the output and discard it + s.setblocking(True) + s.close() + + def test_handshake_timeout(self): + # Issue #5103: SSL handshake must respect the socket timeout + server = socket.socket(socket.AF_INET) + host = "127.0.0.1" + port = support.bind_port(server) + started = threading.Event() + finish = False + + def serve(): + server.listen() + started.set() + conns = [] + while not finish: + r, w, e = select.select([server], [], [], 0.1) + if server in r: + # Let the socket hang around rather than having + # it closed by garbage collection. + conns.append(server.accept()[0]) + for sock in conns: + sock.close() + + t = threading.Thread(target=serve) + t.start() + started.wait() + try: try: - try: - c = socket.socket(socket.AF_INET) - c.settimeout(0.2) - c.connect((host, port)) - # Will attempt handshake and time out - self.assertRaisesRegex(socket.timeout, "timed out", - test_wrap_socket, c) - finally: - c.close() - try: - c = socket.socket(socket.AF_INET) - c = test_wrap_socket(c) - c.settimeout(0.2) - # Will attempt handshake and time out - self.assertRaisesRegex(socket.timeout, "timed out", - c.connect, (host, port)) - finally: - c.close() + c = socket.socket(socket.AF_INET) + c.settimeout(0.2) + c.connect((host, port)) + # Will attempt handshake and time out + self.assertRaisesRegex(socket.timeout, "timed out", + test_wrap_socket, c) finally: - finish = True - t.join() - server.close() - - def test_server_accept(self): - # Issue #16357: accept() on a SSLSocket created through - # SSLContext.wrap_socket(). - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = socket.socket(socket.AF_INET) - host = "127.0.0.1" - port = support.bind_port(server) - server = context.wrap_socket(server, server_side=True) - self.assertTrue(server.server_side) - - evt = threading.Event() - remote = None - peer = None - def serve(): - nonlocal remote, peer - server.listen() - # Block on the accept and wait on the connection to close. - evt.set() - remote, peer = server.accept() - remote.recv(1) - - t = threading.Thread(target=serve) - t.start() - # Client wait until server setup and perform a connect. - evt.wait() - client = context.wrap_socket(socket.socket()) - client.connect((host, port)) - client_addr = client.getsockname() - client.close() + c.close() + try: + c = socket.socket(socket.AF_INET) + c = test_wrap_socket(c) + c.settimeout(0.2) + # Will attempt handshake and time out + self.assertRaisesRegex(socket.timeout, "timed out", + c.connect, (host, port)) + finally: + c.close() + finally: + finish = True t.join() - remote.close() server.close() - # Sanity checks. - self.assertIsInstance(remote, ssl.SSLSocket) - self.assertEqual(peer, client_addr) - - def test_getpeercert_enotconn(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - with context.wrap_socket(socket.socket()) as sock: - with self.assertRaises(OSError) as cm: - sock.getpeercert() - self.assertEqual(cm.exception.errno, errno.ENOTCONN) - - def test_do_handshake_enotconn(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - with context.wrap_socket(socket.socket()) as sock: - with self.assertRaises(OSError) as cm: - sock.do_handshake() - self.assertEqual(cm.exception.errno, errno.ENOTCONN) - - def test_default_ciphers(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - try: - # Force a set of weak ciphers on our client context - context.set_ciphers("DES") - except ssl.SSLError: - self.skipTest("no DES cipher available") - with ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_SSLv23, - chatty=False) as server: - with context.wrap_socket(socket.socket()) as s: - with self.assertRaises(OSError): - s.connect((HOST, server.port)) - self.assertIn("no shared cipher", server.conn_errors[0]) - - def test_version_basic(self): - """ - Basic tests for SSLSocket.version(). - More tests are done in the test_protocol_*() methods. - """ - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - with ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_TLSv1, - chatty=False) as server: - with context.wrap_socket(socket.socket()) as s: - self.assertIs(s.version(), None) - s.connect((HOST, server.port)) - self.assertEqual(s.version(), 'TLSv1') - self.assertIs(s.version(), None) - @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") - def test_default_ecdh_curve(self): - # Issue #21015: elliptic curve-based Diffie Hellman key exchange - # should be enabled by default on SSL contexts. - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.load_cert_chain(CERTFILE) - # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled - # explicitly using the 'ECCdraft' cipher alias. Otherwise, - # our default cipher list should prefer ECDH-based ciphers - # automatically. - if ssl.OPENSSL_VERSION_INFO < (1, 0, 0): - context.set_ciphers("ECCdraft:ECDH") - with ThreadedEchoServer(context=context) as server: - with context.wrap_socket(socket.socket()) as s: + def test_server_accept(self): + # Issue #16357: accept() on a SSLSocket created through + # SSLContext.wrap_socket(). + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(CERTFILE) + context.load_cert_chain(CERTFILE) + server = socket.socket(socket.AF_INET) + host = "127.0.0.1" + port = support.bind_port(server) + server = context.wrap_socket(server, server_side=True) + self.assertTrue(server.server_side) + + evt = threading.Event() + remote = None + peer = None + def serve(): + nonlocal remote, peer + server.listen() + # Block on the accept and wait on the connection to close. + evt.set() + remote, peer = server.accept() + remote.recv(1) + + t = threading.Thread(target=serve) + t.start() + # Client wait until server setup and perform a connect. + evt.wait() + client = context.wrap_socket(socket.socket()) + client.connect((host, port)) + client_addr = client.getsockname() + client.close() + t.join() + remote.close() + server.close() + # Sanity checks. + self.assertIsInstance(remote, ssl.SSLSocket) + self.assertEqual(peer, client_addr) + + def test_getpeercert_enotconn(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + with context.wrap_socket(socket.socket()) as sock: + with self.assertRaises(OSError) as cm: + sock.getpeercert() + self.assertEqual(cm.exception.errno, errno.ENOTCONN) + + def test_do_handshake_enotconn(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + with context.wrap_socket(socket.socket()) as sock: + with self.assertRaises(OSError) as cm: + sock.do_handshake() + self.assertEqual(cm.exception.errno, errno.ENOTCONN) + + def test_default_ciphers(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + try: + # Force a set of weak ciphers on our client context + context.set_ciphers("DES") + except ssl.SSLError: + self.skipTest("no DES cipher available") + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_SSLv23, + chatty=False) as server: + with context.wrap_socket(socket.socket()) as s: + with self.assertRaises(OSError): s.connect((HOST, server.port)) - self.assertIn("ECDH", s.cipher()[0]) + self.assertIn("no shared cipher", server.conn_errors[0]) - @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, - "'tls-unique' channel binding not available") - def test_tls_unique_channel_binding(self): - """Test tls-unique channel binding.""" - if support.verbose: - sys.stdout.write("\n") - - server = ThreadedEchoServer(CERTFILE, - certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, - cacerts=CERTFILE, - chatty=True, - connectionchatty=False) - with server: - s = test_wrap_socket(socket.socket(), - server_side=False, - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + def test_version_basic(self): + """ + Basic tests for SSLSocket.version(). + More tests are done in the test_protocol_*() methods. + """ + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_TLSv1, + chatty=False) as server: + with context.wrap_socket(socket.socket()) as s: + self.assertIs(s.version(), None) s.connect((HOST, server.port)) - # get the data - cb_data = s.get_channel_binding("tls-unique") - if support.verbose: - sys.stdout.write(" got channel binding data: {0!r}\n" - .format(cb_data)) - - # check if it is sane - self.assertIsNotNone(cb_data) - self.assertEqual(len(cb_data), 12) # True for TLSv1 - - # and compare with the peers version - s.write(b"CB tls-unique\n") - peer_data_repr = s.read().strip() - self.assertEqual(peer_data_repr, - repr(cb_data).encode("us-ascii")) - s.close() - - # now, again - s = test_wrap_socket(socket.socket(), - server_side=False, - certfile=CERTFILE, - ca_certs=CERTFILE, - cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + self.assertEqual(s.version(), 'TLSv1') + self.assertIs(s.version(), None) + + @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") + def test_default_ecdh_curve(self): + # Issue #21015: elliptic curve-based Diffie Hellman key exchange + # should be enabled by default on SSL contexts. + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.load_cert_chain(CERTFILE) + # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled + # explicitly using the 'ECCdraft' cipher alias. Otherwise, + # our default cipher list should prefer ECDH-based ciphers + # automatically. + if ssl.OPENSSL_VERSION_INFO < (1, 0, 0): + context.set_ciphers("ECCdraft:ECDH") + with ThreadedEchoServer(context=context) as server: + with context.wrap_socket(socket.socket()) as s: s.connect((HOST, server.port)) - new_cb_data = s.get_channel_binding("tls-unique") - if support.verbose: - sys.stdout.write(" got another channel binding data: {0!r}\n" - .format(new_cb_data)) - # is it really unique - self.assertNotEqual(cb_data, new_cb_data) - self.assertIsNotNone(cb_data) - self.assertEqual(len(cb_data), 12) # True for TLSv1 - s.write(b"CB tls-unique\n") - peer_data_repr = s.read().strip() - self.assertEqual(peer_data_repr, - repr(new_cb_data).encode("us-ascii")) - s.close() + self.assertIn("ECDH", s.cipher()[0]) - def test_compression(self): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) - if support.verbose: - sys.stdout.write(" got compression: {!r}\n".format(stats['compression'])) - self.assertIn(stats['compression'], { None, 'ZLIB', 'RLE' }) - - @unittest.skipUnless(hasattr(ssl, 'OP_NO_COMPRESSION'), - "ssl.OP_NO_COMPRESSION needed for this test") - def test_compression_disabled(self): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - context.options |= ssl.OP_NO_COMPRESSION - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) - self.assertIs(stats['compression'], None) - - def test_dh_params(self): - # Check we can get a connection with ephemeral Diffie-Hellman - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - context.load_dh_params(DHFILE) - context.set_ciphers("kEDH") - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) - cipher = stats["cipher"][0] - parts = cipher.split("-") - if "ADH" not in parts and "EDH" not in parts and "DHE" not in parts: - self.fail("Non-DH cipher: " + cipher[0]) - - def test_selected_alpn_protocol(self): - # selected_alpn_protocol() is None unless ALPN is used. - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) - self.assertIs(stats['client_alpn_protocol'], None) + @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, + "'tls-unique' channel binding not available") + def test_tls_unique_channel_binding(self): + """Test tls-unique channel binding.""" + if support.verbose: + sys.stdout.write("\n") - @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support required") - def test_selected_alpn_protocol_if_server_uses_alpn(self): - # selected_alpn_protocol() is None unless ALPN is used by the client. - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.load_verify_locations(CERTFILE) - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server = ThreadedEchoServer(CERTFILE, + certreqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1, + cacerts=CERTFILE, + chatty=True, + connectionchatty=False) + with server: + s = test_wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + # get the data + cb_data = s.get_channel_binding("tls-unique") + if support.verbose: + sys.stdout.write(" got channel binding data: {0!r}\n" + .format(cb_data)) + + # check if it is sane + self.assertIsNotNone(cb_data) + self.assertEqual(len(cb_data), 12) # True for TLSv1 + + # and compare with the peers version + s.write(b"CB tls-unique\n") + peer_data_repr = s.read().strip() + self.assertEqual(peer_data_repr, + repr(cb_data).encode("us-ascii")) + s.close() + + # now, again + s = test_wrap_socket(socket.socket(), + server_side=False, + certfile=CERTFILE, + ca_certs=CERTFILE, + cert_reqs=ssl.CERT_NONE, + ssl_version=ssl.PROTOCOL_TLSv1) + s.connect((HOST, server.port)) + new_cb_data = s.get_channel_binding("tls-unique") + if support.verbose: + sys.stdout.write(" got another channel binding data: {0!r}\n" + .format(new_cb_data)) + # is it really unique + self.assertNotEqual(cb_data, new_cb_data) + self.assertIsNotNone(cb_data) + self.assertEqual(len(cb_data), 12) # True for TLSv1 + s.write(b"CB tls-unique\n") + peer_data_repr = s.read().strip() + self.assertEqual(peer_data_repr, + repr(new_cb_data).encode("us-ascii")) + s.close() + + def test_compression(self): + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.load_cert_chain(CERTFILE) + stats = server_params_test(context, context, + chatty=True, connectionchatty=True) + if support.verbose: + sys.stdout.write(" got compression: {!r}\n".format(stats['compression'])) + self.assertIn(stats['compression'], { None, 'ZLIB', 'RLE' }) + + @unittest.skipUnless(hasattr(ssl, 'OP_NO_COMPRESSION'), + "ssl.OP_NO_COMPRESSION needed for this test") + def test_compression_disabled(self): + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.load_cert_chain(CERTFILE) + context.options |= ssl.OP_NO_COMPRESSION + stats = server_params_test(context, context, + chatty=True, connectionchatty=True) + self.assertIs(stats['compression'], None) + + def test_dh_params(self): + # Check we can get a connection with ephemeral Diffie-Hellman + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.load_cert_chain(CERTFILE) + context.load_dh_params(DHFILE) + context.set_ciphers("kEDH") + stats = server_params_test(context, context, + chatty=True, connectionchatty=True) + cipher = stats["cipher"][0] + parts = cipher.split("-") + if "ADH" not in parts and "EDH" not in parts and "DHE" not in parts: + self.fail("Non-DH cipher: " + cipher[0]) + + def test_selected_alpn_protocol(self): + # selected_alpn_protocol() is None unless ALPN is used. + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.load_cert_chain(CERTFILE) + stats = server_params_test(context, context, + chatty=True, connectionchatty=True) + self.assertIs(stats['client_alpn_protocol'], None) + + @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support required") + def test_selected_alpn_protocol_if_server_uses_alpn(self): + # selected_alpn_protocol() is None unless ALPN is used by the client. + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + client_context.load_verify_locations(CERTFILE) + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(CERTFILE) + server_context.set_alpn_protocols(['foo', 'bar']) + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True) + self.assertIs(stats['client_alpn_protocol'], None) + + @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support needed for this test") + def test_alpn_protocols(self): + server_protocols = ['foo', 'bar', 'milkshake'] + protocol_tests = [ + (['foo', 'bar'], 'foo'), + (['bar', 'foo'], 'foo'), + (['milkshake'], 'milkshake'), + (['http/3.0', 'http/4.0'], None) + ] + for client_protocols, expected in protocol_tests: + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) server_context.load_cert_chain(CERTFILE) - server_context.set_alpn_protocols(['foo', 'bar']) - stats = server_params_test(client_context, server_context, - chatty=True, connectionchatty=True) - self.assertIs(stats['client_alpn_protocol'], None) - - @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support needed for this test") - def test_alpn_protocols(self): - server_protocols = ['foo', 'bar', 'milkshake'] - protocol_tests = [ - (['foo', 'bar'], 'foo'), - (['bar', 'foo'], 'foo'), - (['milkshake'], 'milkshake'), - (['http/3.0', 'http/4.0'], None) - ] - for client_protocols, expected in protocol_tests: - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - server_context.load_cert_chain(CERTFILE) - server_context.set_alpn_protocols(server_protocols) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - client_context.load_cert_chain(CERTFILE) - client_context.set_alpn_protocols(client_protocols) + server_context.set_alpn_protocols(server_protocols) + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) + client_context.load_cert_chain(CERTFILE) + client_context.set_alpn_protocols(client_protocols) - try: - stats = server_params_test(client_context, - server_context, - chatty=True, - connectionchatty=True) - except ssl.SSLError as e: - stats = e - - if (expected is None and IS_OPENSSL_1_1 - and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)): - # OpenSSL 1.1.0 to 1.1.0e raises handshake error - self.assertIsInstance(stats, ssl.SSLError) - else: - msg = "failed trying %s (s) and %s (c).\n" \ - "was expecting %s, but got %%s from the %%s" \ - % (str(server_protocols), str(client_protocols), - str(expected)) - client_result = stats['client_alpn_protocol'] - self.assertEqual(client_result, expected, - msg % (client_result, "client")) - server_result = stats['server_alpn_protocols'][-1] \ - if len(stats['server_alpn_protocols']) else 'nothing' - self.assertEqual(server_result, expected, - msg % (server_result, "server")) - - def test_selected_npn_protocol(self): - # selected_npn_protocol() is None unless NPN is used - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) - self.assertIs(stats['client_npn_protocol'], None) - - @unittest.skipUnless(ssl.HAS_NPN, "NPN support needed for this test") - def test_npn_protocols(self): - server_protocols = ['http/1.1', 'spdy/2'] - protocol_tests = [ - (['http/1.1', 'spdy/2'], 'http/1.1'), - (['spdy/2', 'http/1.1'], 'http/1.1'), - (['spdy/2', 'test'], 'spdy/2'), - (['abc', 'def'], 'abc') - ] - for client_protocols, expected in protocol_tests: - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(CERTFILE) - server_context.set_npn_protocols(server_protocols) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.load_cert_chain(CERTFILE) - client_context.set_npn_protocols(client_protocols) - stats = server_params_test(client_context, server_context, - chatty=True, connectionchatty=True) + try: + stats = server_params_test(client_context, + server_context, + chatty=True, + connectionchatty=True) + except ssl.SSLError as e: + stats = e + if (expected is None and IS_OPENSSL_1_1 + and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)): + # OpenSSL 1.1.0 to 1.1.0e raises handshake error + self.assertIsInstance(stats, ssl.SSLError) + else: msg = "failed trying %s (s) and %s (c).\n" \ - "was expecting %s, but got %%s from the %%s" \ - % (str(server_protocols), str(client_protocols), - str(expected)) - client_result = stats['client_npn_protocol'] - self.assertEqual(client_result, expected, msg % (client_result, "client")) - server_result = stats['server_npn_protocols'][-1] \ - if len(stats['server_npn_protocols']) else 'nothing' - self.assertEqual(server_result, expected, msg % (server_result, "server")) - - def sni_contexts(self): + "was expecting %s, but got %%s from the %%s" \ + % (str(server_protocols), str(client_protocols), + str(expected)) + client_result = stats['client_alpn_protocol'] + self.assertEqual(client_result, expected, + msg % (client_result, "client")) + server_result = stats['server_alpn_protocols'][-1] \ + if len(stats['server_alpn_protocols']) else 'nothing' + self.assertEqual(server_result, expected, + msg % (server_result, "server")) + + def test_selected_npn_protocol(self): + # selected_npn_protocol() is None unless NPN is used + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.load_cert_chain(CERTFILE) + stats = server_params_test(context, context, + chatty=True, connectionchatty=True) + self.assertIs(stats['client_npn_protocol'], None) + + @unittest.skipUnless(ssl.HAS_NPN, "NPN support needed for this test") + def test_npn_protocols(self): + server_protocols = ['http/1.1', 'spdy/2'] + protocol_tests = [ + (['http/1.1', 'spdy/2'], 'http/1.1'), + (['spdy/2', 'http/1.1'], 'http/1.1'), + (['spdy/2', 'test'], 'spdy/2'), + (['abc', 'def'], 'abc') + ] + for client_protocols, expected in protocol_tests: server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - other_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - other_context.load_cert_chain(SIGNED_CERTFILE2) + server_context.load_cert_chain(CERTFILE) + server_context.set_npn_protocols(server_protocols) client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED - client_context.load_verify_locations(SIGNING_CA) - return server_context, other_context, client_context + client_context.load_cert_chain(CERTFILE) + client_context.set_npn_protocols(client_protocols) + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True) - def check_common_name(self, stats, name): - cert = stats['peercert'] - self.assertIn((('commonName', name),), cert['subject']) + msg = "failed trying %s (s) and %s (c).\n" \ + "was expecting %s, but got %%s from the %%s" \ + % (str(server_protocols), str(client_protocols), + str(expected)) + client_result = stats['client_npn_protocol'] + self.assertEqual(client_result, expected, msg % (client_result, "client")) + server_result = stats['server_npn_protocols'][-1] \ + if len(stats['server_npn_protocols']) else 'nothing' + self.assertEqual(server_result, expected, msg % (server_result, "server")) + + def sni_contexts(self): + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(SIGNED_CERTFILE) + other_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + other_context.load_cert_chain(SIGNED_CERTFILE2) + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + client_context.verify_mode = ssl.CERT_REQUIRED + client_context.load_verify_locations(SIGNING_CA) + return server_context, other_context, client_context + + def check_common_name(self, stats, name): + cert = stats['peercert'] + self.assertIn((('commonName', name),), cert['subject']) + + @needs_sni + def test_sni_callback(self): + calls = [] + server_context, other_context, client_context = self.sni_contexts() + + def servername_cb(ssl_sock, server_name, initial_context): + calls.append((server_name, initial_context)) + if server_name is not None: + ssl_sock.context = other_context + server_context.set_servername_callback(servername_cb) + + stats = server_params_test(client_context, server_context, + chatty=True, + sni_name='supermessage') + # The hostname was fetched properly, and the certificate was + # changed for the connection. + self.assertEqual(calls, [("supermessage", server_context)]) + # CERTFILE4 was selected + self.check_common_name(stats, 'fakehostname') + + calls = [] + # The callback is called with server_name=None + stats = server_params_test(client_context, server_context, + chatty=True, + sni_name=None) + self.assertEqual(calls, [(None, server_context)]) + self.check_common_name(stats, 'localhost') + + # Check disabling the callback + calls = [] + server_context.set_servername_callback(None) + + stats = server_params_test(client_context, server_context, + chatty=True, + sni_name='notfunny') + # Certificate didn't change + self.check_common_name(stats, 'localhost') + self.assertEqual(calls, []) - @needs_sni - def test_sni_callback(self): - calls = [] - server_context, other_context, client_context = self.sni_contexts() + @needs_sni + def test_sni_callback_alert(self): + # Returning a TLS alert is reflected to the connecting client + server_context, other_context, client_context = self.sni_contexts() - def servername_cb(ssl_sock, server_name, initial_context): - calls.append((server_name, initial_context)) - if server_name is not None: - ssl_sock.context = other_context - server_context.set_servername_callback(servername_cb) + def cb_returning_alert(ssl_sock, server_name, initial_context): + return ssl.ALERT_DESCRIPTION_ACCESS_DENIED + server_context.set_servername_callback(cb_returning_alert) + with self.assertRaises(ssl.SSLError) as cm: stats = server_params_test(client_context, server_context, - chatty=True, + chatty=False, sni_name='supermessage') - # The hostname was fetched properly, and the certificate was - # changed for the connection. - self.assertEqual(calls, [("supermessage", server_context)]) - # CERTFILE4 was selected - self.check_common_name(stats, 'fakehostname') - - calls = [] - # The callback is called with server_name=None + self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED') + + @needs_sni + def test_sni_callback_raising(self): + # Raising fails the connection with a TLS handshake failure alert. + server_context, other_context, client_context = self.sni_contexts() + + def cb_raising(ssl_sock, server_name, initial_context): + 1/0 + server_context.set_servername_callback(cb_raising) + + with self.assertRaises(ssl.SSLError) as cm, \ + support.captured_stderr() as stderr: stats = server_params_test(client_context, server_context, - chatty=True, - sni_name=None) - self.assertEqual(calls, [(None, server_context)]) - self.check_common_name(stats, 'localhost') + chatty=False, + sni_name='supermessage') + self.assertEqual(cm.exception.reason, 'SSLV3_ALERT_HANDSHAKE_FAILURE') + self.assertIn("ZeroDivisionError", stderr.getvalue()) + + @needs_sni + def test_sni_callback_wrong_return_type(self): + # Returning the wrong return type terminates the TLS connection + # with an internal error alert. + server_context, other_context, client_context = self.sni_contexts() - # Check disabling the callback - calls = [] - server_context.set_servername_callback(None) + def cb_wrong_return_type(ssl_sock, server_name, initial_context): + return "foo" + server_context.set_servername_callback(cb_wrong_return_type) + with self.assertRaises(ssl.SSLError) as cm, \ + support.captured_stderr() as stderr: stats = server_params_test(client_context, server_context, - chatty=True, - sni_name='notfunny') - # Certificate didn't change - self.check_common_name(stats, 'localhost') - self.assertEqual(calls, []) - - @needs_sni - def test_sni_callback_alert(self): - # Returning a TLS alert is reflected to the connecting client - server_context, other_context, client_context = self.sni_contexts() - - def cb_returning_alert(ssl_sock, server_name, initial_context): - return ssl.ALERT_DESCRIPTION_ACCESS_DENIED - server_context.set_servername_callback(cb_returning_alert) - - with self.assertRaises(ssl.SSLError) as cm: - stats = server_params_test(client_context, server_context, - chatty=False, - sni_name='supermessage') - self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED') - - @needs_sni - def test_sni_callback_raising(self): - # Raising fails the connection with a TLS handshake failure alert. - server_context, other_context, client_context = self.sni_contexts() - - def cb_raising(ssl_sock, server_name, initial_context): - 1/0 - server_context.set_servername_callback(cb_raising) - - with self.assertRaises(ssl.SSLError) as cm, \ - support.captured_stderr() as stderr: - stats = server_params_test(client_context, server_context, - chatty=False, - sni_name='supermessage') - self.assertEqual(cm.exception.reason, 'SSLV3_ALERT_HANDSHAKE_FAILURE') - self.assertIn("ZeroDivisionError", stderr.getvalue()) - - @needs_sni - def test_sni_callback_wrong_return_type(self): - # Returning the wrong return type terminates the TLS connection - # with an internal error alert. - server_context, other_context, client_context = self.sni_contexts() - - def cb_wrong_return_type(ssl_sock, server_name, initial_context): - return "foo" - server_context.set_servername_callback(cb_wrong_return_type) - - with self.assertRaises(ssl.SSLError) as cm, \ - support.captured_stderr() as stderr: - stats = server_params_test(client_context, server_context, - chatty=False, - sni_name='supermessage') - self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_INTERNAL_ERROR') - self.assertIn("TypeError", stderr.getvalue()) - - def test_shared_ciphers(self): - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED - client_context.load_verify_locations(SIGNING_CA) - if ssl.OPENSSL_VERSION_INFO >= (1, 0, 2): - client_context.set_ciphers("AES128:AES256") - server_context.set_ciphers("AES256") - alg1 = "AES256" - alg2 = "AES-256" - else: - client_context.set_ciphers("AES:3DES") - server_context.set_ciphers("3DES") - alg1 = "3DES" - alg2 = "DES-CBC3" - - stats = server_params_test(client_context, server_context) - ciphers = stats['server_shared_ciphers'][0] - self.assertGreater(len(ciphers), 0) - for name, tls_version, bits in ciphers: - if not alg1 in name.split("-") and alg2 not in name: - self.fail(name) - - def test_read_write_after_close_raises_valuerror(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = ThreadedEchoServer(context=context, chatty=False) - - with server: - s = context.wrap_socket(socket.socket()) + chatty=False, + sni_name='supermessage') + self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_INTERNAL_ERROR') + self.assertIn("TypeError", stderr.getvalue()) + + def test_shared_ciphers(self): + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(SIGNED_CERTFILE) + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + client_context.verify_mode = ssl.CERT_REQUIRED + client_context.load_verify_locations(SIGNING_CA) + if ssl.OPENSSL_VERSION_INFO >= (1, 0, 2): + client_context.set_ciphers("AES128:AES256") + server_context.set_ciphers("AES256") + alg1 = "AES256" + alg2 = "AES-256" + else: + client_context.set_ciphers("AES:3DES") + server_context.set_ciphers("3DES") + alg1 = "3DES" + alg2 = "DES-CBC3" + + stats = server_params_test(client_context, server_context) + ciphers = stats['server_shared_ciphers'][0] + self.assertGreater(len(ciphers), 0) + for name, tls_version, bits in ciphers: + if not alg1 in name.split("-") and alg2 not in name: + self.fail(name) + + def test_read_write_after_close_raises_valuerror(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(CERTFILE) + context.load_cert_chain(CERTFILE) + server = ThreadedEchoServer(context=context, chatty=False) + + with server: + s = context.wrap_socket(socket.socket()) + s.connect((HOST, server.port)) + s.close() + + self.assertRaises(ValueError, s.read, 1024) + self.assertRaises(ValueError, s.write, b'hello') + + def test_sendfile(self): + TEST_DATA = b"x" * 512 + with open(support.TESTFN, 'wb') as f: + f.write(TEST_DATA) + self.addCleanup(support.unlink, support.TESTFN) + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(CERTFILE) + context.load_cert_chain(CERTFILE) + server = ThreadedEchoServer(context=context, chatty=False) + with server: + with context.wrap_socket(socket.socket()) as s: s.connect((HOST, server.port)) - s.close() + with open(support.TESTFN, 'rb') as file: + s.sendfile(file) + self.assertEqual(s.recv(1024), TEST_DATA) + + def test_session(self): + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context.load_cert_chain(SIGNED_CERTFILE) + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + client_context.verify_mode = ssl.CERT_REQUIRED + client_context.load_verify_locations(SIGNING_CA) + + # first connection without session + stats = server_params_test(client_context, server_context) + session = stats['session'] + self.assertTrue(session.id) + self.assertGreater(session.time, 0) + self.assertGreater(session.timeout, 0) + self.assertTrue(session.has_ticket) + if ssl.OPENSSL_VERSION_INFO > (1, 0, 1): + self.assertGreater(session.ticket_lifetime_hint, 0) + self.assertFalse(stats['session_reused']) + sess_stat = server_context.session_stats() + self.assertEqual(sess_stat['accept'], 1) + self.assertEqual(sess_stat['hits'], 0) + + # reuse session + stats = server_params_test(client_context, server_context, session=session) + sess_stat = server_context.session_stats() + self.assertEqual(sess_stat['accept'], 2) + self.assertEqual(sess_stat['hits'], 1) + self.assertTrue(stats['session_reused']) + session2 = stats['session'] + self.assertEqual(session2.id, session.id) + self.assertEqual(session2, session) + self.assertIsNot(session2, session) + self.assertGreaterEqual(session2.time, session.time) + self.assertGreaterEqual(session2.timeout, session.timeout) + + # another one without session + stats = server_params_test(client_context, server_context) + self.assertFalse(stats['session_reused']) + session3 = stats['session'] + self.assertNotEqual(session3.id, session.id) + self.assertNotEqual(session3, session) + sess_stat = server_context.session_stats() + self.assertEqual(sess_stat['accept'], 3) + self.assertEqual(sess_stat['hits'], 1) + + # reuse session again + stats = server_params_test(client_context, server_context, session=session) + self.assertTrue(stats['session_reused']) + session4 = stats['session'] + self.assertEqual(session4.id, session.id) + self.assertEqual(session4, session) + self.assertGreaterEqual(session4.time, session.time) + self.assertGreaterEqual(session4.timeout, session.timeout) + sess_stat = server_context.session_stats() + self.assertEqual(sess_stat['accept'], 4) + self.assertEqual(sess_stat['hits'], 2) + + def test_session_handling(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.verify_mode = ssl.CERT_REQUIRED + context.load_verify_locations(CERTFILE) + context.load_cert_chain(CERTFILE) + + context2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context2.verify_mode = ssl.CERT_REQUIRED + context2.load_verify_locations(CERTFILE) + context2.load_cert_chain(CERTFILE) + + server = ThreadedEchoServer(context=context, chatty=False) + with server: + with context.wrap_socket(socket.socket()) as s: + # session is None before handshake + self.assertEqual(s.session, None) + self.assertEqual(s.session_reused, None) + s.connect((HOST, server.port)) + session = s.session + self.assertTrue(session) + with self.assertRaises(TypeError) as e: + s.session = object + self.assertEqual(str(e.exception), 'Value is not a SSLSession.') - self.assertRaises(ValueError, s.read, 1024) - self.assertRaises(ValueError, s.write, b'hello') - - def test_sendfile(self): - TEST_DATA = b"x" * 512 - with open(support.TESTFN, 'wb') as f: - f.write(TEST_DATA) - self.addCleanup(support.unlink, support.TESTFN) - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = ThreadedEchoServer(context=context, chatty=False) - with server: - with context.wrap_socket(socket.socket()) as s: - s.connect((HOST, server.port)) - with open(support.TESTFN, 'rb') as file: - s.sendfile(file) - self.assertEqual(s.recv(1024), TEST_DATA) + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + # cannot set session after handshake + with self.assertRaises(ValueError) as e: + s.session = session + self.assertEqual(str(e.exception), + 'Cannot set session after handshake.') - def test_session(self): - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED - client_context.load_verify_locations(SIGNING_CA) - - # first connection without session - stats = server_params_test(client_context, server_context) - session = stats['session'] - self.assertTrue(session.id) - self.assertGreater(session.time, 0) - self.assertGreater(session.timeout, 0) - self.assertTrue(session.has_ticket) - if ssl.OPENSSL_VERSION_INFO > (1, 0, 1): - self.assertGreater(session.ticket_lifetime_hint, 0) - self.assertFalse(stats['session_reused']) - sess_stat = server_context.session_stats() - self.assertEqual(sess_stat['accept'], 1) - self.assertEqual(sess_stat['hits'], 0) - - # reuse session - stats = server_params_test(client_context, server_context, session=session) - sess_stat = server_context.session_stats() - self.assertEqual(sess_stat['accept'], 2) - self.assertEqual(sess_stat['hits'], 1) - self.assertTrue(stats['session_reused']) - session2 = stats['session'] - self.assertEqual(session2.id, session.id) - self.assertEqual(session2, session) - self.assertIsNot(session2, session) - self.assertGreaterEqual(session2.time, session.time) - self.assertGreaterEqual(session2.timeout, session.timeout) - - # another one without session - stats = server_params_test(client_context, server_context) - self.assertFalse(stats['session_reused']) - session3 = stats['session'] - self.assertNotEqual(session3.id, session.id) - self.assertNotEqual(session3, session) - sess_stat = server_context.session_stats() - self.assertEqual(sess_stat['accept'], 3) - self.assertEqual(sess_stat['hits'], 1) - - # reuse session again - stats = server_params_test(client_context, server_context, session=session) - self.assertTrue(stats['session_reused']) - session4 = stats['session'] - self.assertEqual(session4.id, session.id) - self.assertEqual(session4, session) - self.assertGreaterEqual(session4.time, session.time) - self.assertGreaterEqual(session4.timeout, session.timeout) - sess_stat = server_context.session_stats() - self.assertEqual(sess_stat['accept'], 4) - self.assertEqual(sess_stat['hits'], 2) - - def test_session_handling(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - - context2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context2.verify_mode = ssl.CERT_REQUIRED - context2.load_verify_locations(CERTFILE) - context2.load_cert_chain(CERTFILE) - - server = ThreadedEchoServer(context=context, chatty=False) - with server: - with context.wrap_socket(socket.socket()) as s: - # session is None before handshake - self.assertEqual(s.session, None) - self.assertEqual(s.session_reused, None) - s.connect((HOST, server.port)) - session = s.session - self.assertTrue(session) - with self.assertRaises(TypeError) as e: - s.session = object - self.assertEqual(str(e.exception), 'Value is not a SSLSession.') + with context.wrap_socket(socket.socket()) as s: + # can set session before handshake and before the + # connection was established + s.session = session + s.connect((HOST, server.port)) + self.assertEqual(s.session.id, session.id) + self.assertEqual(s.session, session) + self.assertEqual(s.session_reused, True) - with context.wrap_socket(socket.socket()) as s: - s.connect((HOST, server.port)) - # cannot set session after handshake - with self.assertRaises(ValueError) as e: - s.session = session - self.assertEqual(str(e.exception), - 'Cannot set session after handshake.') - - with context.wrap_socket(socket.socket()) as s: - # can set session before handshake and before the - # connection was established + with context2.wrap_socket(socket.socket()) as s: + # cannot re-use session with a different SSLContext + with self.assertRaises(ValueError) as e: s.session = session s.connect((HOST, server.port)) - self.assertEqual(s.session.id, session.id) - self.assertEqual(s.session, session) - self.assertEqual(s.session_reused, True) - - with context2.wrap_socket(socket.socket()) as s: - # cannot re-use session with a different SSLContext - with self.assertRaises(ValueError) as e: - s.session = session - s.connect((HOST, server.port)) - self.assertEqual(str(e.exception), - 'Session refers to a different SSLContext.') + self.assertEqual(str(e.exception), + 'Session refers to a different SSLContext.') def test_main(verbose=False): @@ -3610,22 +3603,17 @@ def test_main(verbose=False): tests = [ ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests, - SimpleBackgroundTests, + SimpleBackgroundTests, ThreadedTests, ] if support.is_resource_enabled('network'): tests.append(NetworkedTests) - if _have_threads: - thread_info = support.threading_setup() - if thread_info: - tests.append(ThreadedTests) - + thread_info = support.threading_setup() try: support.run_unittest(*tests) finally: - if _have_threads: - support.threading_cleanup(*thread_info) + support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index b7079b1d6d9..10ef87b8495 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -14,6 +14,7 @@ import sysconfig import select import shutil +import threading import gc import textwrap @@ -25,11 +26,6 @@ import ctypes.util try: - import threading -except ImportError: - threading = None - -try: import _testcapi except ImportError: _testcapi = None @@ -1196,7 +1192,6 @@ def test_nonexisting_with_pipes(self): self.assertEqual(stderr, "") self.assertEqual(proc.returncode, 0) - @unittest.skipIf(threading is None, "threading required") def test_double_close_on_error(self): # Issue #18851 fds = [] @@ -1226,7 +1221,6 @@ def open_fds(): if exc is not None: raise exc - @unittest.skipIf(threading is None, "threading required") def test_threadsafe_wait(self): """Issue21291: Popen.wait() needs to be threadsafe for returncode.""" proc = subprocess.Popen([sys.executable, '-c', diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 3844812ba28..04550e58b23 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -10,15 +10,12 @@ import gc import sysconfig import locale +import threading # count the number of test runs, used to create unique # strings to intern in test_intern() numruns = 0 -try: - import threading -except ImportError: - threading = None class SysModuleTest(unittest.TestCase): @@ -172,7 +169,6 @@ def test_setcheckinterval(self): sys.setcheckinterval(n) self.assertEqual(sys.getcheckinterval(), n) - @unittest.skipUnless(threading, 'Threading required for this test.') def test_switchinterval(self): self.assertRaises(TypeError, sys.setswitchinterval) self.assertRaises(TypeError, sys.setswitchinterval, "a") @@ -348,21 +344,8 @@ def test_getframe(self): ) # sys._current_frames() is a CPython-only gimmick. - def test_current_frames(self): - have_threads = True - try: - import _thread - except ImportError: - have_threads = False - - if have_threads: - self.current_frames_with_threads() - else: - self.current_frames_without_threads() - - # Test sys._current_frames() in a WITH_THREADS build. @test.support.reap_threads - def current_frames_with_threads(self): + def test_current_frames(self): import threading import traceback @@ -426,15 +409,6 @@ def g456(): leave_g.set() t.join() - # Test sys._current_frames() when thread support doesn't exist. - def current_frames_without_threads(self): - # Not much happens here: there is only one thread, with artificial - # "thread id" 0. - d = sys._current_frames() - self.assertEqual(len(d), 1) - self.assertIn(0, d) - self.assertTrue(d[0] is sys._getframe()) - def test_attributes(self): self.assertIsInstance(sys.api_version, int) self.assertIsInstance(sys.argv, list) @@ -516,8 +490,6 @@ def test_attributes(self): if not sys.platform.startswith('win'): self.assertIsInstance(sys.abiflags, str) - @unittest.skipUnless(hasattr(sys, 'thread_info'), - 'Threading required for this test.') def test_thread_info(self): info = sys.thread_info self.assertEqual(len(info), 3) diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py index 51d82e11589..414c328b79f 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -1,11 +1,11 @@ import socket import selectors import telnetlib +import threading import contextlib from test import support import unittest -threading = support.import_module('threading') HOST = support.HOST diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index 75c66b0ac75..035344be4b8 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -11,12 +11,12 @@ import sys import time import shutil +import threading import unittest from unittest import mock from test.support import ( verbose, import_module, run_unittest, TESTFN, reap_threads, forget, unlink, rmtree, start_threads) -threading = import_module('threading') def task(N, done, done_tasks, errors): try: diff --git a/Lib/test/test_threadedtempfile.py b/Lib/test/test_threadedtempfile.py index b7420360eae..f3d4ba36377 100644 --- a/Lib/test/test_threadedtempfile.py +++ b/Lib/test/test_threadedtempfile.py @@ -19,9 +19,9 @@ import tempfile from test.support import start_threads, import_module -threading = import_module('threading') import unittest import io +import threading from traceback import print_exc startEvent = threading.Event() diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 800d26f71b2..912eb3fa67a 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -9,8 +9,8 @@ import random import sys -_thread = import_module('_thread') -threading = import_module('threading') +import _thread +import threading import time import unittest import weakref diff --git a/Lib/test/test_threading_local.py b/Lib/test/test_threading_local.py index 4092cf33d3d..984f8dda374 100644 --- a/Lib/test/test_threading_local.py +++ b/Lib/test/test_threading_local.py @@ -5,8 +5,8 @@ import gc # Modules under test -_thread = support.import_module('_thread') -threading = support.import_module('threading') +import _thread +import threading import _threading_local diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 810ec37b111..42323b90ec6 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -9,10 +9,6 @@ import time import unittest try: - import threading -except ImportError: - threading = None -try: import _testcapi except ImportError: _testcapi = None diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py index 742259b4396..780942a8061 100644 --- a/Lib/test/test_tracemalloc.py +++ b/Lib/test/test_tracemalloc.py @@ -7,10 +7,7 @@ from test.support.script_helper import (assert_python_ok, assert_python_failure, interpreter_requires_environment) from test import support -try: - import threading -except ImportError: - threading = None + try: import _testcapi except ImportError: diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index f83f9ccb786..741d136a92c 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -4,13 +4,12 @@ import urllib.parse import urllib.request import http.server +import threading import unittest import hashlib from test import support -threading = support.import_module('threading') - try: import ssl except ImportError: @@ -276,7 +275,6 @@ def do_GET(self): # Test cases - at unittest.skipUnless(threading, "Threading required for this test.") class BasicAuthTests(unittest.TestCase): USER = "testUser" PASSWD = "testPass" @@ -317,7 +315,6 @@ def test_basic_auth_httperror(self): self.assertRaises(urllib.error.HTTPError, urllib.request.urlopen, self.server_url) - at unittest.skipUnless(threading, "Threading required for this test.") class ProxyAuthTests(unittest.TestCase): URL = "http://localhost" @@ -439,7 +436,6 @@ def log_message(self, *args): return FakeHTTPRequestHandler - at unittest.skipUnless(threading, "Threading required for this test.") class TestUrlopen(unittest.TestCase): """Tests urllib.request.urlopen using the network. diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index 2691632ff4f..aac010b3aaf 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -15,15 +15,10 @@ import tempfile from test.support import (captured_stdout, captured_stderr, can_symlink, EnvironmentVarGuard, rmtree) +import threading import unittest import venv - -try: - import threading -except ImportError: - threading = None - try: import ctypes except ImportError: @@ -420,8 +415,6 @@ def do_test_with_pip(self, system_site_packages): if not system_site_packages: self.assert_pip_not_installed() - @unittest.skipUnless(threading, 'some dependencies of pip import threading' - ' module unconditionally') # Issue #26610: pip/pep425tags.py requires ctypes @unittest.skipUnless(ctypes, 'pip requires ctypes') def test_with_pip(self): diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 43cf2c0fc2e..0384a9fdf01 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -6,6 +6,7 @@ import operator import contextlib import copy +import threading import time from test import support @@ -78,7 +79,6 @@ def collect_in_thread(period=0.0001): """ Ensure GC collections happen in a different thread, at a high frequency. """ - threading = support.import_module('threading') please_stop = False def collect(): diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index a609eef503f..f2b496ac9a6 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -10,6 +10,7 @@ import http.client import http, http.server import socket +import threading import re import io import contextlib @@ -19,10 +20,6 @@ import gzip except ImportError: gzip = None -try: - import threading -except ImportError: - threading = None alist = [{'astring': 'foo at bar.baz.spam', 'afloat': 7283.43, @@ -307,7 +304,6 @@ def test_ssl_presence(self): except OSError: self.assertTrue(has_ssl) - @unittest.skipUnless(threading, "Threading required for this test.") def test_keepalive_disconnect(self): class RequestHandler(http.server.BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" @@ -747,7 +743,6 @@ def make_request_and_skip(self): return make_request_and_skip return decorator - at unittest.skipUnless(threading, 'Threading required for this test.') class BaseServerTestCase(unittest.TestCase): requestHandler = None request_count = 1 @@ -1206,7 +1201,6 @@ def get(self, key, failobj=None): return super().get(key, failobj) - at unittest.skipUnless(threading, 'Threading required for this test.') class FailingServerTestCase(unittest.TestCase): def setUp(self): self.evt = threading.Event() diff --git a/Lib/threading.py b/Lib/threading.py index 06dbc682834..e4bf974495b 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -990,38 +990,12 @@ def _stop(self): def _delete(self): "Remove current thread from the dict of currently running threads." - - # Notes about running with _dummy_thread: - # - # Must take care to not raise an exception if _dummy_thread is being - # used (and thus this module is being used as an instance of - # dummy_threading). _dummy_thread.get_ident() always returns 1 since - # there is only one thread if _dummy_thread is being used. Thus - # len(_active) is always <= 1 here, and any Thread instance created - # overwrites the (if any) thread currently registered in _active. - # - # An instance of _MainThread is always created by 'threading'. This - # gets overwritten the instant an instance of Thread is created; both - # threads return 1 from _dummy_thread.get_ident() and thus have the - # same key in the dict. So when the _MainThread instance created by - # 'threading' tries to clean itself up when atexit calls this method - # it gets a KeyError if another Thread instance was created. - # - # This all means that KeyError from trying to delete something from - # _active if dummy_threading is being used is a red herring. But - # since it isn't if dummy_threading is *not* being used then don't - # hide the exception. - - try: - with _active_limbo_lock: - del _active[get_ident()] - # There must not be any python code between the previous line - # and after the lock is released. Otherwise a tracing function - # could try to acquire the lock again in the same thread, (in - # current_thread()), and would block. - except KeyError: - if 'dummy_threading' not in _sys.modules: - raise + with _active_limbo_lock: + del _active[get_ident()] + # There must not be any python code between the previous line + # and after the lock is released. Otherwise a tracing function + # could try to acquire the lock again in the same thread, (in + # current_thread()), and would block. def join(self, timeout=None): """Wait until the thread terminates. diff --git a/Lib/trace.py b/Lib/trace.py index e443edd6061..48a1d1b6a91 100755 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -61,21 +61,15 @@ import pickle from time import monotonic as _time -try: - import threading -except ImportError: - _settrace = sys.settrace - - def _unsettrace(): - sys.settrace(None) -else: - def _settrace(func): - threading.settrace(func) - sys.settrace(func) - - def _unsettrace(): - sys.settrace(None) - threading.settrace(None) +import threading + +def _settrace(func): + threading.settrace(func) + sys.settrace(func) + +def _unsettrace(): + sys.settrace(None) + threading.settrace(None) PRAGMA_NOCOVER = "#pragma NO COVER" diff --git a/Lib/zipfile.py b/Lib/zipfile.py index cc46a6c1d9c..37ce3281e09 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -12,11 +12,7 @@ import shutil import struct import binascii - -try: - import threading -except ImportError: - import dummy_threading as threading +import threading try: import zlib # We may need its compression method diff --git a/Makefile.pre.in b/Makefile.pre.in index f8a0dbcb667..5f83e048760 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -220,7 +220,6 @@ LIBC= @LIBC@ SYSLIBS= $(LIBM) $(LIBC) SHLIBS= @SHLIBS@ -THREADOBJ= @THREADOBJ@ DLINCLDIR= @DLINCLDIR@ DYNLOADFILE= @DYNLOADFILE@ MACHDEP_OBJS= @MACHDEP_OBJS@ @@ -354,6 +353,7 @@ PYTHON_OBJS= \ Python/structmember.o \ Python/symtable.o \ Python/sysmodule.o \ + Python/thread.o \ Python/traceback.o \ Python/getopt.o \ Python/pystrcmp.o \ @@ -365,7 +365,6 @@ PYTHON_OBJS= \ Python/$(DYNLOADFILE) \ $(LIBOBJS) \ $(MACHDEP_OBJS) \ - $(THREADOBJ) \ $(DTRACE_OBJS) @@ -655,12 +654,10 @@ oldsharedmods: $(SHAREDMODS) Makefile Modules/config.c: Makefile.pre \ $(srcdir)/Modules/config.c.in \ $(MAKESETUP) \ - Modules/Setup.config \ Modules/Setup \ Modules/Setup.local $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ -s Modules \ - Modules/Setup.config \ Modules/Setup.local \ Modules/Setup @mv config.c Modules @@ -1421,7 +1418,6 @@ libainstall: @DEF_MAKE_RULE@ python-config $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local - $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh @@ -1642,7 +1638,7 @@ distclean: clobber if test "$$file" != "$(srcdir)/Lib/test/data/README"; then rm "$$file"; fi; \ done -rm -f core Makefile Makefile.pre config.status \ - Modules/Setup Modules/Setup.local Modules/Setup.config \ + Modules/Setup Modules/Setup.local \ Modules/ld_so_aix Modules/python.exp Misc/python.pc \ Misc/python-config.sh -rm -f python*-gdb.py diff --git a/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst b/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst new file mode 100644 index 00000000000..3e66eadcdb7 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst @@ -0,0 +1,5 @@ +Remove support for building --without-threads. + +This option is not really useful anymore in the 21st century. Removing lots +of conditional paths allows us to simplify the code base, including in +difficult to maintain low-level internal code. diff --git a/Modules/Setup.config.in b/Modules/Setup.config.in deleted file mode 100644 index 645052873da..00000000000 --- a/Modules/Setup.config.in +++ /dev/null @@ -1,10 +0,0 @@ -# This file is transmogrified into Setup.config by config.status. - -# The purpose of this file is to conditionally enable certain modules -# based on configure-time options. - -# Threading - at USE_THREAD_MODULE@_thread _threadmodule.c - -# The rest of the modules previously listed in this file are built -# by the setup.py script in Python 2.1 and later. diff --git a/Modules/Setup.dist b/Modules/Setup.dist index dd533ef5c90..9c3e1bed30c 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -123,6 +123,7 @@ atexit atexitmodule.c # Register functions to be run at interpreter-shutdow _signal signalmodule.c _stat _stat.c # stat.h interface time timemodule.c # -lm # time operations and variables +_thread _threadmodule.c # low-level threading interface # access to ISO C locale support _locale _localemodule.c # -lintl @@ -216,8 +217,6 @@ _symtable symtablemodule.c # The crypt module is now disabled by default because it breaks builds # on many systems (where -lcrypt is needed), e.g. Linux (I believe). -# -# First, look at Setup.config; configure may have set this for you. #_crypt _cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems @@ -308,8 +307,6 @@ _symtable symtablemodule.c # Curses support, requiring the System V version of curses, often # provided by the ncurses library. e.g. on Linux, link with -lncurses # instead of -lcurses). -# -# First, look at Setup.config; configure may have set this for you. #_curses _cursesmodule.c -lcurses -ltermcap # Wrapper for the panel library that's part of ncurses and SYSV curses. @@ -323,18 +320,9 @@ _symtable symtablemodule.c # implementation independent wrapper for these; dbm/dumb.py provides # similar functionality (but slower of course) implemented in Python. -# The standard Unix dbm module has been moved to Setup.config so that -# it will be compiled as a shared library by default. Compiling it as -# a built-in module causes conflicts with the pybsddb3 module since it -# creates a static dependency on an out-of-date version of db.so. -# -# First, look at Setup.config; configure may have set this for you. - #_dbm _dbmmodule.c # dbm(3) may require -lndbm or similar # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: -# -# First, look at Setup.config; configure may have set this for you. #_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm diff --git a/Modules/_blake2/blake2b_impl.c b/Modules/_blake2/blake2b_impl.c index ec9e3c14b0b..b1ae3e9b628 100644 --- a/Modules/_blake2/blake2b_impl.c +++ b/Modules/_blake2/blake2b_impl.c @@ -15,9 +15,7 @@ #include "Python.h" #include "pystrhex.h" -#ifdef WITH_THREAD #include "pythread.h" -#endif #include "../hashlib.h" #include "blake2ns.h" @@ -41,9 +39,7 @@ typedef struct { PyObject_HEAD blake2b_param param; blake2b_state state; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } BLAKE2bObject; #include "clinic/blake2b_impl.c.h" @@ -60,11 +56,9 @@ new_BLAKE2bObject(PyTypeObject *type) { BLAKE2bObject *self; self = (BLAKE2bObject *)type->tp_alloc(type, 0); -#ifdef WITH_THREAD if (self != NULL) { self->lock = NULL; } -#endif return self; } @@ -292,7 +286,6 @@ _blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj) GET_BUFFER_VIEW_OR_ERROUT(obj, &buf); -#ifdef WITH_THREAD if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) self->lock = PyThread_allocate_lock(); @@ -305,9 +298,6 @@ _blake2b_blake2b_update(BLAKE2bObject *self, PyObject *obj) } else { blake2b_update(&self->state, buf.buf, buf.len); } -#else - blake2b_update(&self->state, buf.buf, buf.len); -#endif /* !WITH_THREAD */ PyBuffer_Release(&buf); Py_RETURN_NONE; @@ -407,12 +397,10 @@ py_blake2b_dealloc(PyObject *self) /* Try not to leave state in memory. */ secure_zero_memory(&obj->param, sizeof(obj->param)); secure_zero_memory(&obj->state, sizeof(obj->state)); -#ifdef WITH_THREAD if (obj->lock) { PyThread_free_lock(obj->lock); obj->lock = NULL; } -#endif PyObject_Del(self); } diff --git a/Modules/_blake2/blake2s_impl.c b/Modules/_blake2/blake2s_impl.c index 42257a24fdf..3615a383db3 100644 --- a/Modules/_blake2/blake2s_impl.c +++ b/Modules/_blake2/blake2s_impl.c @@ -15,9 +15,7 @@ #include "Python.h" #include "pystrhex.h" -#ifdef WITH_THREAD #include "pythread.h" -#endif #include "../hashlib.h" #include "blake2ns.h" @@ -41,9 +39,7 @@ typedef struct { PyObject_HEAD blake2s_param param; blake2s_state state; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } BLAKE2sObject; #include "clinic/blake2s_impl.c.h" @@ -60,11 +56,9 @@ new_BLAKE2sObject(PyTypeObject *type) { BLAKE2sObject *self; self = (BLAKE2sObject *)type->tp_alloc(type, 0); -#ifdef WITH_THREAD if (self != NULL) { self->lock = NULL; } -#endif return self; } @@ -292,7 +286,6 @@ _blake2s_blake2s_update(BLAKE2sObject *self, PyObject *obj) GET_BUFFER_VIEW_OR_ERROUT(obj, &buf); -#ifdef WITH_THREAD if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) self->lock = PyThread_allocate_lock(); @@ -305,9 +298,6 @@ _blake2s_blake2s_update(BLAKE2sObject *self, PyObject *obj) } else { blake2s_update(&self->state, buf.buf, buf.len); } -#else - blake2s_update(&self->state, buf.buf, buf.len); -#endif /* !WITH_THREAD */ PyBuffer_Release(&buf); Py_RETURN_NONE; @@ -407,12 +397,10 @@ py_blake2s_dealloc(PyObject *self) /* Try not to leave state in memory. */ secure_zero_memory(&obj->param, sizeof(obj->param)); secure_zero_memory(&obj->state, sizeof(obj->state)); -#ifdef WITH_THREAD if (obj->lock) { PyThread_free_lock(obj->lock); obj->lock = NULL; } -#endif PyObject_Del(self); } diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index 409522f9728..dba0e19384a 100644 --- a/Modules/_bz2module.c +++ b/Modules/_bz2module.c @@ -5,9 +5,7 @@ #include "Python.h" #include "structmember.h" -#ifdef WITH_THREAD #include "pythread.h" -#endif #include #include @@ -23,7 +21,6 @@ #endif /* ! BZ_CONFIG_ERROR */ -#ifdef WITH_THREAD #define ACQUIRE_LOCK(obj) do { \ if (!PyThread_acquire_lock((obj)->lock, 0)) { \ Py_BEGIN_ALLOW_THREADS \ @@ -31,19 +28,13 @@ Py_END_ALLOW_THREADS \ } } while (0) #define RELEASE_LOCK(obj) PyThread_release_lock((obj)->lock) -#else -#define ACQUIRE_LOCK(obj) -#define RELEASE_LOCK(obj) -#endif typedef struct { PyObject_HEAD bz_stream bzs; int flushed; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } BZ2Compressor; typedef struct { @@ -59,9 +50,7 @@ typedef struct { separately. Conversion and looping is encapsulated in decompress_buf() */ size_t bzs_avail_in_real; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } BZ2Decompressor; static PyTypeObject BZ2Compressor_Type; @@ -325,13 +314,11 @@ _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel) return -1; } -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return -1; } -#endif self->bzs.opaque = NULL; self->bzs.bzalloc = BZ2_Malloc; @@ -343,10 +330,8 @@ _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel) return 0; error: -#ifdef WITH_THREAD PyThread_free_lock(self->lock); self->lock = NULL; -#endif return -1; } @@ -354,10 +339,8 @@ static void BZ2Compressor_dealloc(BZ2Compressor *self) { BZ2_bzCompressEnd(&self->bzs); -#ifdef WITH_THREAD if (self->lock != NULL) PyThread_free_lock(self->lock); -#endif Py_TYPE(self)->tp_free((PyObject *)self); } @@ -651,13 +634,11 @@ _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self) { int bzerror; -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return -1; } -#endif self->needs_input = 1; self->bzs_avail_in_real = 0; @@ -675,10 +656,8 @@ _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self) error: Py_CLEAR(self->unused_data); -#ifdef WITH_THREAD PyThread_free_lock(self->lock); self->lock = NULL; -#endif return -1; } @@ -689,10 +668,8 @@ BZ2Decompressor_dealloc(BZ2Decompressor *self) PyMem_Free(self->input_buffer); BZ2_bzDecompressEnd(&self->bzs); Py_CLEAR(self->unused_data); -#ifdef WITH_THREAD if (self->lock != NULL) PyThread_free_lock(self->lock); -#endif Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 0255f76b8a0..1942c63c815 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -5410,9 +5410,7 @@ PyInit__ctypes(void) ob_type is the metatype (the 'type'), defaults to PyType_Type, tp_base is the base type, defaults to 'object' aka PyBaseObject_Type. */ -#ifdef WITH_THREAD PyEval_InitThreads(); -#endif m = PyModule_Create(&_ctypesmodule); if (!m) return NULL; diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index a11ae047638..d579291b62f 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -137,9 +137,7 @@ static void _CallPythonObject(void *mem, Py_ssize_t nArgs; PyObject *error_object = NULL; int *space; -#ifdef WITH_THREAD PyGILState_STATE state = PyGILState_Ensure(); -#endif nArgs = PySequence_Length(converters); /* Hm. What to return in case of error? @@ -281,9 +279,7 @@ if (x == NULL) _PyTraceback_Add(what, "_ctypes/callbacks.c", __LINE__ - 1), PyEr Py_XDECREF(result); Done: Py_XDECREF(arglist); -#ifdef WITH_THREAD PyGILState_Release(state); -#endif } static void closure_fcn(ffi_cif *cif, @@ -347,7 +343,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, assert(CThunk_CheckExact((PyObject *)p)); p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure), - &p->pcl_exec); + &p->pcl_exec); if (p->pcl_write == NULL) { PyErr_NoMemory(); goto error; @@ -397,8 +393,8 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, result = ffi_prep_closure(p->pcl_write, &p->cif, closure_fcn, p); #else result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn, - p, - p->pcl_exec); + p, + p->pcl_exec); #endif if (result != FFI_OK) { PyErr_Format(PyExc_RuntimeError, @@ -422,9 +418,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable, static void LoadPython(void) { if (!Py_IsInitialized()) { -#ifdef WITH_THREAD PyEval_InitThreads(); -#endif Py_Initialize(); } } @@ -495,18 +489,12 @@ STDAPI DllGetClassObject(REFCLSID rclsid, LPVOID *ppv) { long result; -#ifdef WITH_THREAD PyGILState_STATE state; -#endif LoadPython(); -#ifdef WITH_THREAD state = PyGILState_Ensure(); -#endif result = Call_GetClassObject(rclsid, riid, ppv); -#ifdef WITH_THREAD PyGILState_Release(state); -#endif return result; } @@ -558,13 +546,9 @@ long Call_CanUnloadNow(void) STDAPI DllCanUnloadNow(void) { long result; -#ifdef WITH_THREAD PyGILState_STATE state = PyGILState_Ensure(); -#endif result = Call_CanUnloadNow(); -#ifdef WITH_THREAD PyGILState_Release(state); -#endif return result; } diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index be757ef6f85..3a6ad86e87e 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -745,9 +745,7 @@ static int _call_function_pointer(int flags, void *resmem, int argcount) { -#ifdef WITH_THREAD PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */ -#endif PyObject *error_object = NULL; int *space; ffi_cif cif; @@ -786,10 +784,8 @@ static int _call_function_pointer(int flags, if (error_object == NULL) return -1; } -#ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_UNBLOCK_THREADS -#endif if (flags & FUNCFLAG_USE_ERRNO) { int temp = space[0]; space[0] = errno; @@ -826,10 +822,8 @@ static int _call_function_pointer(int flags, space[0] = errno; errno = temp; } -#ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_BLOCK_THREADS -#endif Py_XDECREF(error_object); #ifdef MS_WIN32 #ifndef DONT_USE_SEH @@ -982,9 +976,7 @@ GetComError(HRESULT errcode, GUID *riid, IUnknown *pIunk) /* We absolutely have to release the GIL during COM method calls, otherwise we may get a deadlock! */ -#ifdef WITH_THREAD Py_BEGIN_ALLOW_THREADS -#endif hr = pIunk->lpVtbl->QueryInterface(pIunk, &IID_ISupportErrorInfo, (void **)&psei); if (FAILED(hr)) @@ -1008,9 +1000,7 @@ GetComError(HRESULT errcode, GUID *riid, IUnknown *pIunk) pei->lpVtbl->Release(pei); failed: -#ifdef WITH_THREAD Py_END_ALLOW_THREADS -#endif progid = NULL; ProgIDFromCLSID(&guid, &progid); diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 8ef8c54bfd6..01f1671a8f5 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -53,9 +53,7 @@ typedef struct { PyObject_HEAD PyObject *name; /* name of this hash algorithm */ EVP_MD_CTX *ctx; /* OpenSSL message digest context */ -#ifdef WITH_THREAD PyThread_type_lock lock; /* OpenSSL context lock */ -#endif } EVPobject; @@ -122,9 +120,7 @@ newEVPobject(PyObject *name) /* save the name for .name to return */ Py_INCREF(name); retval->name = name; -#ifdef WITH_THREAD retval->lock = NULL; -#endif return retval; } @@ -153,10 +149,8 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len) static void EVP_dealloc(EVPobject *self) { -#ifdef WITH_THREAD if (self->lock != NULL) PyThread_free_lock(self->lock); -#endif EVP_MD_CTX_free(self->ctx); Py_XDECREF(self->name); PyObject_Del(self); @@ -267,7 +261,6 @@ EVP_update(EVPobject *self, PyObject *args) GET_BUFFER_VIEW_OR_ERROUT(obj, &view); -#ifdef WITH_THREAD if (self->lock == NULL && view.len >= HASHLIB_GIL_MINSIZE) { self->lock = PyThread_allocate_lock(); /* fail? lock = NULL and we fail over to non-threaded code. */ @@ -282,9 +275,6 @@ EVP_update(EVPobject *self, PyObject *args) } else { EVP_hash(self, view.buf, view.len); } -#else - EVP_hash(self, view.buf, view.len); -#endif PyBuffer_Release(&view); Py_RETURN_NONE; diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 189b1cd8442..ba0932c5d81 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -230,10 +230,8 @@ typedef struct { isn't ready for writing. */ Py_off_t write_end; -#ifdef WITH_THREAD PyThread_type_lock lock; volatile unsigned long owner; -#endif Py_ssize_t buffer_size; Py_ssize_t buffer_mask; @@ -267,8 +265,6 @@ typedef struct { /* These macros protect the buffered object against concurrent operations. */ -#ifdef WITH_THREAD - static int _enter_buffered_busy(buffered *self) { @@ -315,11 +311,6 @@ _enter_buffered_busy(buffered *self) PyThread_release_lock(self->lock); \ } while(0); -#else -#define ENTER_BUFFERED(self) 1 -#define LEAVE_BUFFERED(self) -#endif - #define CHECK_INITIALIZED(self) \ if (self->ok <= 0) { \ if (self->detached) { \ @@ -401,12 +392,10 @@ buffered_dealloc(buffered *self) PyMem_Free(self->buffer); self->buffer = NULL; } -#ifdef WITH_THREAD if (self->lock) { PyThread_free_lock(self->lock); self->lock = NULL; } -#endif Py_CLEAR(self->dict); Py_TYPE(self)->tp_free((PyObject *)self); } @@ -753,7 +742,6 @@ _buffered_init(buffered *self) PyErr_NoMemory(); return -1; } -#ifdef WITH_THREAD if (self->lock) PyThread_free_lock(self->lock); self->lock = PyThread_allocate_lock(); @@ -762,7 +750,6 @@ _buffered_init(buffered *self) return -1; } self->owner = 0; -#endif /* Find out whether buffer_size is a power of 2 */ /* XXX is this optimization useful? */ for (n = self->buffer_size - 1; n & 1; n >>= 1) diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index 26bfa0b4ebb..fd3bbb80bce 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -9,16 +9,13 @@ #include "Python.h" #include "structmember.h" -#ifdef WITH_THREAD #include "pythread.h" -#endif #include #include #include -#ifdef WITH_THREAD #define ACQUIRE_LOCK(obj) do { \ if (!PyThread_acquire_lock((obj)->lock, 0)) { \ Py_BEGIN_ALLOW_THREADS \ @@ -26,10 +23,6 @@ Py_END_ALLOW_THREADS \ } } while (0) #define RELEASE_LOCK(obj) PyThread_release_lock((obj)->lock) -#else -#define ACQUIRE_LOCK(obj) -#define RELEASE_LOCK(obj) -#endif /* Container formats: */ @@ -48,9 +41,7 @@ typedef struct { lzma_allocator alloc; lzma_stream lzs; int flushed; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } Compressor; typedef struct { @@ -63,9 +54,7 @@ typedef struct { char needs_input; uint8_t *input_buffer; size_t input_buffer_size; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } Decompressor; /* LZMAError class object. */ @@ -757,13 +746,11 @@ Compressor_init(Compressor *self, PyObject *args, PyObject *kwargs) self->alloc.free = PyLzma_Free; self->lzs.allocator = &self->alloc; -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return -1; } -#endif self->flushed = 0; switch (format) { @@ -790,10 +777,8 @@ Compressor_init(Compressor *self, PyObject *args, PyObject *kwargs) break; } -#ifdef WITH_THREAD PyThread_free_lock(self->lock); self->lock = NULL; -#endif return -1; } @@ -801,10 +786,8 @@ static void Compressor_dealloc(Compressor *self) { lzma_end(&self->lzs); -#ifdef WITH_THREAD if (self->lock != NULL) PyThread_free_lock(self->lock); -#endif Py_TYPE(self)->tp_free((PyObject *)self); } @@ -1180,13 +1163,11 @@ _lzma_LZMADecompressor___init___impl(Decompressor *self, int format, self->lzs.allocator = &self->alloc; self->lzs.next_in = NULL; -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return -1; } -#endif self->check = LZMA_CHECK_UNKNOWN; self->needs_input = 1; @@ -1230,10 +1211,8 @@ _lzma_LZMADecompressor___init___impl(Decompressor *self, int format, error: Py_CLEAR(self->unused_data); -#ifdef WITH_THREAD PyThread_free_lock(self->lock); self->lock = NULL; -#endif return -1; } @@ -1245,10 +1224,8 @@ Decompressor_dealloc(Decompressor *self) lzma_end(&self->lzs); Py_CLEAR(self->unused_data); -#ifdef WITH_THREAD if (self->lock != NULL) PyThread_free_lock(self->lock); -#endif Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c index 33b77b15bd2..970ce1616e5 100644 --- a/Modules/_sha3/sha3module.c +++ b/Modules/_sha3/sha3module.c @@ -139,9 +139,7 @@ class _sha3.shake_256 "SHA3object *" "&SHAKE256type" typedef struct { PyObject_HEAD SHA3_state hash_state; -#ifdef WITH_THREAD PyThread_type_lock lock; -#endif } SHA3object; static PyTypeObject SHA3_224type; @@ -167,9 +165,7 @@ newSHA3object(PyTypeObject *type) if (newobj == NULL) { return NULL; } -#ifdef WITH_THREAD newobj->lock = NULL; -#endif return newobj; } @@ -224,7 +220,6 @@ py_sha3_new_impl(PyTypeObject *type, PyObject *data) if (data) { GET_BUFFER_VIEW_OR_ERROR(data, &buf, goto error); -#ifdef WITH_THREAD if (buf.len >= HASHLIB_GIL_MINSIZE) { /* invariant: New objects can't be accessed by other code yet, * thus it's safe to release the GIL without locking the object. @@ -236,9 +231,6 @@ py_sha3_new_impl(PyTypeObject *type, PyObject *data) else { res = SHA3_process(&self->hash_state, buf.buf, buf.len * 8); } -#else - res = SHA3_process(&self->hash_state, buf.buf, buf.len * 8); -#endif if (res != SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "internal error in SHA3 Update()"); @@ -265,11 +257,9 @@ py_sha3_new_impl(PyTypeObject *type, PyObject *data) static void SHA3_dealloc(SHA3object *self) { -#ifdef WITH_THREAD if (self->lock) { PyThread_free_lock(self->lock); } -#endif PyObject_Del(self); } @@ -373,7 +363,6 @@ _sha3_sha3_224_update(SHA3object *self, PyObject *obj) GET_BUFFER_VIEW_OR_ERROUT(obj, &buf); /* add new data, the function takes the length in bits not bytes */ -#ifdef WITH_THREAD if (self->lock == NULL && buf.len >= HASHLIB_GIL_MINSIZE) { self->lock = PyThread_allocate_lock(); } @@ -391,9 +380,6 @@ _sha3_sha3_224_update(SHA3object *self, PyObject *obj) else { res = SHA3_process(&self->hash_state, buf.buf, buf.len * 8); } -#else - res = SHA3_process(&self->hash_state, buf.buf, buf.len * 8); -#endif if (res != SUCCESS) { PyBuffer_Release(&buf); diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index e2ba758be68..f596bcf7aca 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -170,9 +170,7 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject self->detect_types = detect_types; self->timeout = timeout; (void)sqlite3_busy_timeout(self->db, (int)(timeout*1000)); -#ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); -#endif if (!check_same_thread && sqlite3_libversion_number() < 3003001) { PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); return -1; @@ -592,11 +590,9 @@ void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** PyObject* py_retval = NULL; int ok; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif py_func = (PyObject*)sqlite3_user_data(context); @@ -620,9 +616,7 @@ void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value** _sqlite3_result_error(context, "user-defined function raised exception", -1); } -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif } static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_value** params) @@ -633,11 +627,9 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ PyObject** aggregate_instance; PyObject* stepmethod = NULL; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif aggregate_class = (PyObject*)sqlite3_user_data(context); @@ -684,9 +676,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_ Py_XDECREF(stepmethod); Py_XDECREF(function_result); -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif } void _pysqlite_final_callback(sqlite3_context* context) @@ -698,11 +688,9 @@ void _pysqlite_final_callback(sqlite3_context* context) PyObject *exception, *value, *tb; int restore; -#ifdef WITH_THREAD PyGILState_STATE threadstate; threadstate = PyGILState_Ensure(); -#endif aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); if (!*aggregate_instance) { @@ -746,12 +734,7 @@ void _pysqlite_final_callback(sqlite3_context* context) } error: -#ifdef WITH_THREAD PyGILState_Release(threadstate); -#endif - /* explicit return to avoid a compilation error if WITH_THREAD - is not defined */ - return; } static void _pysqlite_drop_unused_statement_references(pysqlite_Connection* self) @@ -884,11 +867,9 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co { PyObject *ret; int rc; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source); @@ -917,9 +898,7 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co Py_DECREF(ret); } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return rc; } @@ -927,11 +906,9 @@ static int _progress_handler(void* user_arg) { int rc; PyObject *ret; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif ret = _PyObject_CallNoArg((PyObject*)user_arg); if (!ret) { @@ -948,9 +925,7 @@ static int _progress_handler(void* user_arg) Py_DECREF(ret); } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return rc; } @@ -959,11 +934,9 @@ static void _trace_callback(void* user_arg, const char* statement_string) PyObject *py_statement = NULL; PyObject *ret = NULL; -#ifdef WITH_THREAD PyGILState_STATE gilstate; gilstate = PyGILState_Ensure(); -#endif py_statement = PyUnicode_DecodeUTF8(statement_string, strlen(statement_string), "replace"); if (py_statement) { @@ -981,9 +954,7 @@ static void _trace_callback(void* user_arg, const char* statement_string) } } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif } static PyObject* pysqlite_connection_set_authorizer(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) @@ -1120,7 +1091,6 @@ static PyObject* pysqlite_load_extension(pysqlite_Connection* self, PyObject* ar int pysqlite_check_thread(pysqlite_Connection* self) { -#ifdef WITH_THREAD if (self->check_same_thread) { if (PyThread_get_thread_ident() != self->thread_ident) { PyErr_Format(pysqlite_ProgrammingError, @@ -1131,7 +1101,6 @@ int pysqlite_check_thread(pysqlite_Connection* self) } } -#endif return 1; } @@ -1365,15 +1334,11 @@ pysqlite_collation_callback( PyObject* callback = (PyObject*)context; PyObject* string1 = 0; PyObject* string2 = 0; -#ifdef WITH_THREAD PyGILState_STATE gilstate; -#endif PyObject* retval = NULL; long longval; int result = 0; -#ifdef WITH_THREAD gilstate = PyGILState_Ensure(); -#endif if (PyErr_Occurred()) { goto finally; @@ -1409,9 +1374,7 @@ pysqlite_collation_callback( Py_XDECREF(string1); Py_XDECREF(string2); Py_XDECREF(retval); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return result; } diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 59406e1d77f..5f8aaf96b59 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -478,9 +478,7 @@ PyMODINIT_FUNC PyInit__sqlite3(void) * threads have already been initialized. * (see pybsddb-users mailing list post on 2002-08-07) */ -#ifdef WITH_THREAD PyEval_InitThreads(); -#endif error: if (PyErr_Occurred()) diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 2fa6bd28cdc..b8509acc3f1 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -18,7 +18,6 @@ #include "Python.h" -#ifdef WITH_THREAD #include "pythread.h" /* Redefined below for Windows debug builds after important #includes */ @@ -35,17 +34,6 @@ #define PySSL_UNBLOCK_THREADS PySSL_BEGIN_ALLOW_THREADS_S(_save); #define PySSL_END_ALLOW_THREADS PySSL_END_ALLOW_THREADS_S(_save); } -#else /* no WITH_THREAD */ - -#define PySSL_BEGIN_ALLOW_THREADS_S(save) -#define PySSL_END_ALLOW_THREADS_S(save) -#define PySSL_BEGIN_ALLOW_THREADS -#define PySSL_BLOCK_THREADS -#define PySSL_UNBLOCK_THREADS -#define PySSL_END_ALLOW_THREADS - -#endif - /* Include symbols from _socket module */ #include "socketmodule.h" @@ -171,9 +159,7 @@ static void _PySSLFixErrno(void) { #define OPENSSL_NO_SSL2 #endif #else /* OpenSSL < 1.1.0 */ -#if defined(WITH_THREAD) #define HAVE_OPENSSL_CRYPTO_LOCK -#endif #define TLS_method SSLv23_method #define TLS_client_method SSLv23_client_method @@ -285,15 +271,11 @@ enum py_ssl_version { PY_SSL_VERSION_TLS_SERVER, }; -#ifdef WITH_THREAD - /* serves as a flag to see whether we've initialized the SSL thread support. */ /* 0 means no, greater than 0 means yes */ static unsigned int _ssl_locks_count = 0; -#endif /* def WITH_THREAD */ - /* SSL socket object */ #define X509_NAME_MAXLEN 256 @@ -3768,16 +3750,12 @@ _servername_callback(SSL *s, int *al, void *args) /* The high-level ssl.SSLSocket object */ PyObject *ssl_socket; const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); -#ifdef WITH_THREAD PyGILState_STATE gstate = PyGILState_Ensure(); -#endif if (ssl_ctx->set_hostname == NULL) { /* remove race condition in this the call back while if removing the * callback is in progress */ -#ifdef WITH_THREAD PyGILState_Release(gstate); -#endif return SSL_TLSEXT_ERR_OK; } @@ -3846,18 +3824,14 @@ _servername_callback(SSL *s, int *al, void *args) Py_DECREF(result); } -#ifdef WITH_THREAD PyGILState_Release(gstate); -#endif return ret; error: Py_DECREF(ssl_socket); *al = SSL_AD_INTERNAL_ERROR; ret = SSL_TLSEXT_ERR_ALERT_FATAL; -#ifdef WITH_THREAD PyGILState_Release(gstate); -#endif return ret; } #endif @@ -5117,7 +5091,7 @@ static int _setup_ssl_threads(void) { return 1; } -#endif /* HAVE_OPENSSL_CRYPTO_LOCK for WITH_THREAD && OpenSSL < 1.1.0 */ +#endif /* HAVE_OPENSSL_CRYPTO_LOCK for OpenSSL < 1.1.0 */ PyDoc_STRVAR(module_doc, "Implementation module for SSL socket operations. See the socket module\n\ @@ -5193,7 +5167,6 @@ PyInit__ssl(void) SSL_library_init(); #endif -#ifdef WITH_THREAD #ifdef HAVE_OPENSSL_CRYPTO_LOCK /* note that this will start threading if not already started */ if (!_setup_ssl_threads()) { @@ -5203,7 +5176,6 @@ PyInit__ssl(void) /* OpenSSL 1.1.0 builtin thread support is enabled */ _ssl_locks_count++; #endif -#endif /* WITH_THREAD */ /* Add symbols to module dict */ sslerror_type_slots[0].pfunc = PyExc_OSError; diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 2952317e76d..1a296214739 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -22,9 +22,7 @@ #include /* For W_STOPCODE */ #endif -#ifdef WITH_THREAD #include "pythread.h" -#endif /* WITH_THREAD */ static PyObject *TestError; /* set to exception object in init */ /* Raise TestError with test_name + ": " + msg, and return NULL. */ @@ -2229,8 +2227,6 @@ test_datetime_capi(PyObject *self, PyObject *args) { } -#ifdef WITH_THREAD - /* test_thread_state spawns a thread of its own, and that thread releases * `thread_done` when it's finished. The driver code has to know when the * thread finishes, because the thread uses a PyObject (the callable) that @@ -2348,7 +2344,6 @@ PyObject *pending_threadfunc(PyObject *self, PyObject *arg) } Py_RETURN_TRUE; } -#endif /* Some tests of PyUnicode_FromFormat(). This needs more tests. */ static PyObject * @@ -3617,7 +3612,6 @@ PyDoc_STRVAR(docstring_with_signature_with_defaults, "and the parameters take defaults of varying types." ); -#ifdef WITH_THREAD typedef struct { PyThread_type_lock start_event; PyThread_type_lock exit_event; @@ -3704,7 +3698,6 @@ call_in_temporary_c_thread(PyObject *self, PyObject *callback) PyThread_free_lock(test_c_thread.exit_event); return res; } -#endif /* WITH_THREAD */ static PyObject* test_raise_signal(PyObject* self, PyObject *args) @@ -4420,10 +4413,8 @@ static PyMethodDef TestMethods[] = { {"unicode_encodedecimal", unicode_encodedecimal, METH_VARARGS}, {"unicode_transformdecimaltoascii", unicode_transformdecimaltoascii, METH_VARARGS}, {"unicode_legacy_string", unicode_legacy_string, METH_VARARGS}, -#ifdef WITH_THREAD {"_test_thread_state", test_thread_state, METH_VARARGS}, {"_pending_threadfunc", pending_threadfunc, METH_VARARGS}, -#endif #ifdef HAVE_GETTIMEOFDAY {"profile_int", profile_int, METH_NOARGS}, #endif @@ -4483,10 +4474,8 @@ static PyMethodDef TestMethods[] = { docstring_with_signature_with_defaults}, {"raise_signal", (PyCFunction)test_raise_signal, METH_VARARGS}, -#ifdef WITH_THREAD {"call_in_temporary_c_thread", call_in_temporary_c_thread, METH_O, PyDoc_STR("set_error_class(error_class) -> None")}, -#endif {"pymarshal_write_long_to_file", pymarshal_write_long_to_file, METH_VARARGS}, {"pymarshal_write_object_to_file", diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index da750c01cd9..d58ebc32926 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -4,13 +4,6 @@ #include "Python.h" #include "structmember.h" /* offsetof */ - -#ifndef WITH_THREAD -#error "Error! The rest of Python is not compiled with thread support." -#error "Rerun configure, adding a --with-threads option." -#error "Then run `make clean' followed by `make'." -#endif - #include "pythread.h" static PyObject *ThreadError; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 7ed2b0254bd..91d3dd583ed 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -26,9 +26,7 @@ Copyright (C) 1994 Steen Lumholt. #include "Python.h" #include -#ifdef WITH_THREAD #include "pythread.h" -#endif #ifdef MS_WINDOWS #include @@ -161,8 +159,6 @@ _get_tcl_lib_path() } #endif /* MS_WINDOWS */ -#ifdef WITH_THREAD - /* The threading situation is complicated. Tcl is not thread-safe, except when configured with --enable-threads. @@ -264,18 +260,6 @@ static PyThreadState *tcl_tstate = NULL; return 0; \ } -#else - -#define ENTER_TCL -#define LEAVE_TCL -#define ENTER_OVERLAP -#define LEAVE_OVERLAP_TCL -#define ENTER_PYTHON -#define LEAVE_PYTHON -#define CHECK_TCL_APPARTMENT - -#endif - #ifndef FREECAST #define FREECAST (char *) #endif @@ -340,7 +324,6 @@ Tkinter_Error(PyObject *v) static int Tkinter_busywaitinterval = 20; -#ifdef WITH_THREAD #ifndef MS_WINDOWS /* Millisecond sleep() for Unix platforms. */ @@ -374,7 +357,6 @@ WaitForMainloop(TkappObject* self) PyErr_SetString(PyExc_RuntimeError, "main thread is not in main loop"); return 0; } -#endif /* WITH_THREAD */ @@ -652,13 +634,11 @@ Tkapp_New(const char *screenName, const char *className, return 0; } #endif -#ifdef WITH_THREAD if (v->threaded && tcl_lock) { /* If Tcl is threaded, we don't need the lock. */ PyThread_free_lock(tcl_lock); tcl_lock = NULL; } -#endif v->OldBooleanType = Tcl_GetObjType("boolean"); v->BooleanType = Tcl_GetObjType("booleanString"); @@ -790,7 +770,6 @@ Tkapp_New(const char *screenName, const char *className, } -#ifdef WITH_THREAD static void Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev, Tcl_Condition *cond, Tcl_Mutex *mutex) @@ -803,7 +782,6 @@ Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev, Tcl_MutexUnlock(mutex); Py_END_ALLOW_THREADS } -#endif /** Tcl Eval **/ @@ -1340,7 +1318,6 @@ FromObj(PyObject* tkapp, Tcl_Obj *value) return newPyTclObject(value); } -#ifdef WITH_THREAD /* This mutex synchronizes inter-thread command calls. */ TCL_DECLARE_MUTEX(call_mutex) @@ -1353,7 +1330,6 @@ typedef struct Tkapp_CallEvent { PyObject **exc_type, **exc_value, **exc_tb; Tcl_Condition *done; } Tkapp_CallEvent; -#endif void Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) @@ -1444,7 +1420,6 @@ Tkapp_CallResult(TkappObject *self) return res; } -#ifdef WITH_THREAD /* Tkapp_CallProc is the event procedure that is executed in the context of the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't @@ -1490,7 +1465,6 @@ Tkapp_CallProc(Tkapp_CallEvent *e, int flags) return 1; } -#endif /* This is the main entry point for calling a Tcl command. It supports three cases, with regard to threading: @@ -1520,7 +1494,6 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) if (PyTuple_Check(item)) args = item; } -#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { /* We cannot call the command directly. Instead, we must marshal the parameters to the interpreter thread. */ @@ -1554,7 +1527,6 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) Tcl_ConditionFinalize(&cond); } else -#endif { objv = Tkapp_CallArgs(args, objStore, &objc); @@ -1695,7 +1667,6 @@ _tkinter_tkapp_adderrinfo_impl(TkappObject *self, const char *msg) typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags); -#ifdef WITH_THREAD TCL_DECLARE_MUTEX(var_mutex) typedef struct VarEvent { @@ -1709,7 +1680,6 @@ typedef struct VarEvent { PyObject **exc_val; Tcl_Condition *cond; } VarEvent; -#endif /*[python] @@ -1765,7 +1735,6 @@ varname_converter(PyObject *in, void *_out) return 0; } -#ifdef WITH_THREAD static void var_perform(VarEvent *ev) @@ -1794,12 +1763,10 @@ var_proc(VarEvent* ev, int flags) return 1; } -#endif static PyObject* var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags) { -#ifdef WITH_THREAD TkappObject *self = (TkappObject*)selfptr; if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { VarEvent *ev; @@ -1836,7 +1803,6 @@ var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags) } return res; } -#endif /* Tcl is not threaded, or this is the interpreter thread. */ return func(selfptr, args, flags); } @@ -2455,7 +2421,6 @@ PythonCmdDelete(ClientData clientData) -#ifdef WITH_THREAD TCL_DECLARE_MUTEX(command_mutex) typedef struct CommandEvent{ @@ -2482,7 +2447,6 @@ Tkapp_CommandProc(CommandEvent *ev, int flags) Tcl_MutexUnlock(&command_mutex); return 1; } -#endif /*[clinic input] _tkinter.tkapp.createcommand @@ -2507,11 +2471,9 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, return NULL; } -#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread() && !WaitForMainloop(self)) return NULL; -#endif data = PyMem_NEW(PythonCmd_ClientData, 1); if (!data) @@ -2520,7 +2482,6 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, Py_INCREF(func); data->self = (PyObject *) self; data->func = func; -#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { Tcl_Condition cond = NULL; CommandEvent *ev = (CommandEvent*)attemptckalloc(sizeof(CommandEvent)); @@ -2540,7 +2501,6 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name, Tcl_ConditionFinalize(&cond); } else -#endif { ENTER_TCL err = Tcl_CreateCommand( @@ -2575,7 +2535,6 @@ _tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name) CHECK_STRING_LENGTH(name); -#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { Tcl_Condition cond = NULL; CommandEvent *ev; @@ -2595,7 +2554,6 @@ _tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name) Tcl_ConditionFinalize(&cond); } else -#endif { ENTER_TCL err = Tcl_DeleteCommand(self->interp, name); @@ -2898,9 +2856,7 @@ static PyObject * _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold) /*[clinic end generated code: output=0ba8eabbe57841b0 input=036bcdcf03d5eca0]*/ { -#ifdef WITH_THREAD PyThreadState *tstate = PyThreadState_Get(); -#endif CHECK_TCL_APPARTMENT; self->dispatching = 1; @@ -2912,7 +2868,6 @@ _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold) { int result; -#ifdef WITH_THREAD if (self->threaded) { /* Allow other Python threads to run. */ ENTER_TCL @@ -2930,9 +2885,6 @@ _tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold) Sleep(Tkinter_busywaitinterval); Py_END_ALLOW_THREADS } -#else - result = Tcl_DoOneEvent(0); -#endif if (PyErr_CheckSignals() != 0) { self->dispatching = 0; @@ -3366,9 +3318,7 @@ MyFileProc(void *clientData, int mask) } #endif -#ifdef WITH_THREAD static PyThreadState *event_tstate = NULL; -#endif static int EventHook(void) @@ -3376,9 +3326,7 @@ EventHook(void) #ifndef MS_WINDOWS int tfile; #endif -#ifdef WITH_THREAD PyEval_RestoreThread(event_tstate); -#endif stdin_ready = 0; errorInCmd = 0; #ifndef MS_WINDOWS @@ -3393,7 +3341,6 @@ EventHook(void) break; } #endif -#if defined(WITH_THREAD) || defined(MS_WINDOWS) Py_BEGIN_ALLOW_THREADS if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = event_tstate; @@ -3405,9 +3352,6 @@ EventHook(void) if (result == 0) Sleep(Tkinter_busywaitinterval); Py_END_ALLOW_THREADS -#else - result = Tcl_DoOneEvent(0); -#endif if (result < 0) break; @@ -3421,9 +3365,7 @@ EventHook(void) excInCmd = valInCmd = trbInCmd = NULL; PyErr_Print(); } -#ifdef WITH_THREAD PyEval_SaveThread(); -#endif return 0; } @@ -3434,9 +3376,7 @@ EnableEventHook(void) { #ifdef WAIT_FOR_STDIN if (PyOS_InputHook == NULL) { -#ifdef WITH_THREAD event_tstate = PyThreadState_Get(); -#endif PyOS_InputHook = EventHook; } #endif @@ -3470,11 +3410,9 @@ PyInit__tkinter(void) { PyObject *m, *uexe, *cexe, *o; -#ifdef WITH_THREAD tcl_lock = PyThread_allocate_lock(); if (tcl_lock == NULL) return NULL; -#endif m = PyModule_Create(&_tkintermodule); if (m == NULL) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 6966b86a48a..feb32a09078 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -51,7 +51,7 @@ static struct { int use_domain; } tracemalloc_config = {TRACEMALLOC_NOT_INITIALIZED, 0, 1, 0}; -#if defined(TRACE_RAW_MALLOC) && defined(WITH_THREAD) +#if defined(TRACE_RAW_MALLOC) /* This lock is needed because tracemalloc_free() is called without the GIL held from PyMem_RawFree(). It cannot acquire the lock because it would introduce a deadlock in PyThreadState_DeleteCurrent(). */ @@ -164,7 +164,7 @@ tracemalloc_error(const char *format, ...) #endif -#if defined(WITH_THREAD) && defined(TRACE_RAW_MALLOC) +#if defined(TRACE_RAW_MALLOC) #define REENTRANT_THREADLOCAL /* If your OS does not provide native thread local storage, you can implement @@ -212,8 +212,7 @@ set_reentrant(int reentrant) #else -/* WITH_THREAD not defined: Python compiled without threads, - or TRACE_RAW_MALLOC not defined: variable protected by the GIL */ +/* TRACE_RAW_MALLOC not defined: variable protected by the GIL */ static int tracemalloc_reentrant = 0; static int @@ -455,11 +454,7 @@ traceback_get_frames(traceback_t *traceback) PyThreadState *tstate; PyFrameObject *pyframe; -#ifdef WITH_THREAD tstate = PyGILState_GetThisThreadState(); -#else - tstate = PyThreadState_Get(); -#endif if (tstate == NULL) { #ifdef TRACE_DEBUG tracemalloc_error("failed to get the current thread state"); @@ -483,9 +478,7 @@ traceback_new(void) traceback_t *traceback; _Py_hashtable_entry_t *entry; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif /* get frames */ traceback = tracemalloc_traceback; @@ -848,9 +841,7 @@ tracemalloc_realloc_gil(void *ctx, void *ptr, size_t new_size) static void* tracemalloc_raw_alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) { -#ifdef WITH_THREAD PyGILState_STATE gil_state; -#endif void *ptr; if (get_reentrant()) { @@ -866,13 +857,9 @@ tracemalloc_raw_alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) disabled. */ set_reentrant(1); -#ifdef WITH_THREAD gil_state = PyGILState_Ensure(); ptr = tracemalloc_alloc(use_calloc, ctx, nelem, elsize); PyGILState_Release(gil_state); -#else - ptr = tracemalloc_alloc(use_calloc, ctx, nelem, elsize); -#endif set_reentrant(0); return ptr; @@ -896,9 +883,7 @@ tracemalloc_raw_calloc(void *ctx, size_t nelem, size_t elsize) static void* tracemalloc_raw_realloc(void *ctx, void *ptr, size_t new_size) { -#ifdef WITH_THREAD PyGILState_STATE gil_state; -#endif void *ptr2; if (get_reentrant()) { @@ -920,13 +905,9 @@ tracemalloc_raw_realloc(void *ctx, void *ptr, size_t new_size) not disabled. */ set_reentrant(1); -#ifdef WITH_THREAD gil_state = PyGILState_Ensure(); ptr2 = tracemalloc_realloc(ctx, ptr, new_size); PyGILState_Release(gil_state); -#else - ptr2 = tracemalloc_realloc(ctx, ptr, new_size); -#endif set_reentrant(0); return ptr2; @@ -962,10 +943,8 @@ traceback_free_traceback(_Py_hashtable_t *ht, _Py_hashtable_entry_t *entry, static void tracemalloc_clear_traces(void) { -#ifdef WITH_THREAD /* The GIL protects variables againt concurrent access */ assert(PyGILState_Check()); -#endif TABLES_LOCK(); _Py_hashtable_clear(tracemalloc_traces); @@ -1007,7 +986,7 @@ tracemalloc_init(void) } #endif -#if defined(WITH_THREAD) && defined(TRACE_RAW_MALLOC) +#if defined(TRACE_RAW_MALLOC) if (tables_lock == NULL) { tables_lock = PyThread_allocate_lock(); if (tables_lock == NULL) { @@ -1074,7 +1053,7 @@ tracemalloc_deinit(void) _Py_hashtable_destroy(tracemalloc_filenames); _Py_hashtable_destroy(tracemalloc_traces); -#if defined(WITH_THREAD) && defined(TRACE_RAW_MALLOC) +#if defined(TRACE_RAW_MALLOC) if (tables_lock != NULL) { PyThread_free_lock(tables_lock); tables_lock = NULL; @@ -1723,9 +1702,7 @@ _PyTraceMalloc_Init(void) char *p; int nframe; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif if ((p = Py_GETENV("PYTHONTRACEMALLOC")) && *p != '\0') { char *endptr = p; @@ -1778,9 +1755,7 @@ _PyTraceMalloc_Init(void) void _PyTraceMalloc_Fini(void) { -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif tracemalloc_deinit(); } @@ -1789,26 +1764,20 @@ PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr, size_t size) { int res; -#ifdef WITH_THREAD PyGILState_STATE gil_state; -#endif if (!tracemalloc_config.tracing) { /* tracemalloc is not tracing: do nothing */ return -2; } -#ifdef WITH_THREAD gil_state = PyGILState_Ensure(); -#endif TABLES_LOCK(); res = tracemalloc_add_trace(domain, ptr, size); TABLES_UNLOCK(); -#ifdef WITH_THREAD PyGILState_Release(gil_state); -#endif return res; } diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index 4405d606a0f..a4542cc45a0 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -363,7 +363,7 @@ signal_sigtimedwait(PyObject *module, PyObject **args, Py_ssize_t nargs) #endif /* defined(HAVE_SIGTIMEDWAIT) */ -#if (defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD)) +#if defined(HAVE_PTHREAD_KILL) PyDoc_STRVAR(signal_pthread_kill__doc__, "pthread_kill($module, thread_id, signalnum, /)\n" @@ -395,7 +395,7 @@ signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs) return return_value; } -#endif /* (defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD)) */ +#endif /* defined(HAVE_PTHREAD_KILL) */ #ifndef SIGNAL_ALARM_METHODDEF #define SIGNAL_ALARM_METHODDEF @@ -440,4 +440,4 @@ signal_pthread_kill(PyObject *module, PyObject **args, Py_ssize_t nargs) #ifndef SIGNAL_PTHREAD_KILL_METHODDEF #define SIGNAL_PTHREAD_KILL_METHODDEF #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */ -/*[clinic end generated code: output=9403ef0c5d0f7ee0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3f6e6298696f1b75 input=a9049054013a1b77]*/ diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 39b70bcf3a1..4f3d971bc52 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -17,9 +17,7 @@ /* Allocate at maximum 100 MB of the stack to raise the stack overflow */ #define STACK_OVERFLOW_MAX_SIZE (100*1024*1024) -#ifdef WITH_THREAD -# define FAULTHANDLER_LATER -#endif +#define FAULTHANDLER_LATER #ifndef MS_WINDOWS /* register() is useless on Windows, because only SIGSEGV, SIGABRT and @@ -228,7 +226,6 @@ faulthandler_dump_traceback(int fd, int all_threads, reentrant = 1; -#ifdef WITH_THREAD /* SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL are synchronous signals and are thus delivered to the thread that caused the fault. Get the Python thread state of the current thread. @@ -238,9 +235,6 @@ faulthandler_dump_traceback(int fd, int all_threads, used. Read the thread local storage (TLS) instead: call PyGILState_GetThisThreadState(). */ tstate = PyGILState_GetThisThreadState(); -#else - tstate = _PyThreadState_UncheckedGet(); -#endif if (all_threads) { (void)_Py_DumpTracebackThreads(fd, NULL, tstate); @@ -977,7 +971,6 @@ faulthandler_sigsegv(PyObject *self, PyObject *args) Py_RETURN_NONE; } -#ifdef WITH_THREAD static void faulthandler_fatal_error_thread(void *plock) { @@ -1027,7 +1020,6 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args) Py_RETURN_NONE; } -#endif static PyObject * faulthandler_sigfpe(PyObject *self, PyObject *args) @@ -1198,11 +1190,9 @@ static PyMethodDef module_methods[] = { "a SIGSEGV or SIGBUS signal depending on the platform")}, {"_sigsegv", faulthandler_sigsegv, METH_VARARGS, PyDoc_STR("_sigsegv(release_gil=False): raise a SIGSEGV signal")}, -#ifdef WITH_THREAD {"_fatal_error_c_thread", faulthandler_fatal_error_c_thread, METH_NOARGS, PyDoc_STR("fatal_error_c_thread(): " "call Py_FatalError() in a new C thread.")}, -#endif {"_sigabrt", faulthandler_sigabrt, METH_NOARGS, PyDoc_STR("_sigabrt(): raise a SIGABRT signal")}, {"_sigfpe", (PyCFunction)faulthandler_sigfpe, METH_NOARGS, diff --git a/Modules/hashlib.h b/Modules/hashlib.h index 530b6b1723c..978593e2f1a 100644 --- a/Modules/hashlib.h +++ b/Modules/hashlib.h @@ -39,24 +39,19 @@ * an operation. */ -#ifdef WITH_THREAD #include "pythread.h" - #define ENTER_HASHLIB(obj) \ - if ((obj)->lock) { \ - if (!PyThread_acquire_lock((obj)->lock, 0)) { \ - Py_BEGIN_ALLOW_THREADS \ - PyThread_acquire_lock((obj)->lock, 1); \ - Py_END_ALLOW_THREADS \ - } \ - } - #define LEAVE_HASHLIB(obj) \ - if ((obj)->lock) { \ - PyThread_release_lock((obj)->lock); \ - } -#else - #define ENTER_HASHLIB(obj) - #define LEAVE_HASHLIB(obj) -#endif +#define ENTER_HASHLIB(obj) \ + if ((obj)->lock) { \ + if (!PyThread_acquire_lock((obj)->lock, 0)) { \ + Py_BEGIN_ALLOW_THREADS \ + PyThread_acquire_lock((obj)->lock, 1); \ + Py_END_ALLOW_THREADS \ + } \ + } +#define LEAVE_HASHLIB(obj) \ + if ((obj)->lock) { \ + PyThread_release_lock((obj)->lock); \ + } /* TODO(gps): We should probably make this a module or EVPobject attribute * to allow the user to optimize based on the platform they're using. */ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 7b57d8bda3e..83135e536a5 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -359,7 +359,7 @@ static int win32_can_symlink = 0; /* Don't use the "_r" form if we don't need it (also, won't have a prototype for it, at least on Solaris -- maybe others as well?). */ -#if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) +#if defined(HAVE_CTERMID_R) #define USE_CTERMID_R #endif @@ -454,14 +454,12 @@ PyOS_AfterFork_Parent(void) void PyOS_AfterFork_Child(void) { -#ifdef WITH_THREAD /* PyThread_ReInitTLS() must be called early, to make sure that the TLS API * can be called safely. */ PyThread_ReInitTLS(); _PyGILState_Reinit(); PyEval_ReInitThreads(); _PyImport_ReInitLock(); -#endif _PySignal_AfterFork(); run_at_forkers(PyThreadState_Get()->interp->after_forkers_child, 0); diff --git a/Modules/readline.c b/Modules/readline.c index f4a5e5adcb0..951bc82b16d 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -896,13 +896,9 @@ on_startup_hook() #endif { int r; -#ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); -#endif r = on_hook(readlinestate_global->startup_hook); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return r; } @@ -915,13 +911,9 @@ on_pre_input_hook() #endif { int r; -#ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); -#endif r = on_hook(readlinestate_global->pre_input_hook); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return r; } #endif @@ -936,9 +928,7 @@ on_completion_display_matches_hook(char **matches, { int i; PyObject *sub, *m=NULL, *s=NULL, *r=NULL; -#ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); -#endif m = PyList_New(num_matches); if (m == NULL) goto error; @@ -967,9 +957,7 @@ on_completion_display_matches_hook(char **matches, Py_XDECREF(m); Py_XDECREF(r); } -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif } #endif @@ -1002,9 +990,7 @@ on_completion(const char *text, int state) char *result = NULL; if (readlinestate_global->completer != NULL) { PyObject *r = NULL, *t; -#ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); -#endif rl_attempted_completion_over = 1; t = decode(text); r = PyObject_CallFunction(readlinestate_global->completer, "Ni", t, state); @@ -1026,9 +1012,7 @@ on_completion(const char *text, int state) PyErr_Clear(); Py_XDECREF(r); done: -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return result; } return result; @@ -1045,9 +1029,7 @@ flex_complete(const char *text, int start, int end) char saved; size_t start_size, end_size; wchar_t *s; -#ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); -#endif #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER rl_completion_append_character ='\0'; #endif @@ -1080,9 +1062,7 @@ flex_complete(const char *text, int start, int end) readlinestate_global->begidx = PyLong_FromLong((long) start); readlinestate_global->endidx = PyLong_FromLong((long) end); result = completion_matches((char *)text, *on_completion); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif return result; } @@ -1234,13 +1214,9 @@ readline_until_enter_or_signal(const char *prompt, int *signal) } else if (err == EINTR) { int s; -#ifdef WITH_THREAD PyEval_RestoreThread(_PyOS_ReadlineTState); -#endif s = PyErr_CheckSignals(); -#ifdef WITH_THREAD PyEval_SaveThread(); -#endif if (s < 0) { rl_free_line_state(); #if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION >= 0x0700 diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 1c827ac26da..66331088176 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -85,12 +85,10 @@ module signal thread. XXX This is a hack. */ -#ifdef WITH_THREAD #include /* For pid_t */ #include "pythread.h" static unsigned long main_thread; static pid_t main_pid; -#endif static volatile struct { _Py_atomic_int tripped; @@ -316,10 +314,8 @@ signal_handler(int sig_num) { int save_errno = errno; -#ifdef WITH_THREAD /* See NOTES section above */ if (getpid() == main_pid) -#endif { trip_signal(sig_num); } @@ -439,13 +435,11 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler) return NULL; } #endif -#ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) { PyErr_SetString(PyExc_ValueError, "signal only works in main thread"); return NULL; } -#endif if (signalnum < 1 || signalnum >= NSIG) { PyErr_SetString(PyExc_ValueError, "signal number out of range"); @@ -571,13 +565,11 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args) return NULL; #endif -#ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) { PyErr_SetString(PyExc_ValueError, "set_wakeup_fd only works in main thread"); return NULL; } -#endif #ifdef MS_WINDOWS is_socket = 0; @@ -1104,7 +1096,7 @@ signal_sigtimedwait_impl(PyObject *module, PyObject *sigset, #endif /* #ifdef HAVE_SIGTIMEDWAIT */ -#if defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD) +#if defined(HAVE_PTHREAD_KILL) /*[clinic input] signal.pthread_kill @@ -1137,7 +1129,7 @@ signal_pthread_kill_impl(PyObject *module, unsigned long thread_id, Py_RETURN_NONE; } -#endif /* #if defined(HAVE_PTHREAD_KILL) && defined(WITH_THREAD) */ +#endif /* #if defined(HAVE_PTHREAD_KILL) */ @@ -1217,10 +1209,8 @@ PyInit__signal(void) PyObject *m, *d, *x; int i; -#ifdef WITH_THREAD main_thread = PyThread_get_thread_ident(); main_pid = getpid(); -#endif /* Create the module and add the functions */ m = PyModule_Create(&signalmodule); @@ -1523,10 +1513,8 @@ PyErr_CheckSignals(void) if (!_Py_atomic_load(&is_tripped)) return 0; -#ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) return 0; -#endif /* * The is_tripped variable is meant to speed up the calls to @@ -1599,10 +1587,8 @@ int PyOS_InterruptOccurred(void) { if (_Py_atomic_load_relaxed(&Handlers[SIGINT].tripped)) { -#ifdef WITH_THREAD if (PyThread_get_thread_ident() != main_thread) return 0; -#endif _Py_atomic_store_relaxed(&Handlers[SIGINT].tripped, 0); return 1; } @@ -1628,20 +1614,14 @@ _PySignal_AfterFork(void) * in both processes if they came in just before the fork() but before * the interpreter had an opportunity to call the handlers. issue9535. */ _clear_pending_signals(); -#ifdef WITH_THREAD main_thread = PyThread_get_thread_ident(); main_pid = getpid(); -#endif } int _PyOS_IsMainThread(void) { -#ifdef WITH_THREAD return PyThread_get_thread_ident() == main_thread; -#else - return 1; -#endif } #ifdef MS_WINDOWS diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index a431e254d57..2c2f98d4ac3 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -163,10 +163,6 @@ if_indextoname(index) -- return the corresponding interface name\n\ # include #endif -#if !defined(WITH_THREAD) -# undef HAVE_GETHOSTBYNAME_R -#endif - #if defined(__ANDROID__) && __ANDROID_API__ < 23 # undef HAVE_GETHOSTBYNAME_R #endif @@ -185,8 +181,7 @@ if_indextoname(index) -- return the corresponding interface name\n\ # endif #endif -#if !defined(HAVE_GETHOSTBYNAME_R) && defined(WITH_THREAD) && \ - !defined(MS_WINDOWS) +#if !defined(HAVE_GETHOSTBYNAME_R) && !defined(MS_WINDOWS) # define USE_GETHOSTBYNAME_LOCK #endif @@ -210,8 +205,7 @@ if_indextoname(index) -- return the corresponding interface name\n\ http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&r2=1.83 */ -#if defined(WITH_THREAD) && ( \ - (defined(__APPLE__) && \ +#if ((defined(__APPLE__) && \ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || \ (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \ (defined(__OpenBSD__) && OpenBSD+0 < 201311) || \ @@ -656,10 +650,8 @@ internal_select(PySocketSockObject *s, int writing, _PyTime_t interval, struct timeval tv, *tvp; #endif -#ifdef WITH_THREAD /* must be called with the GIL held */ assert(PyGILState_Check()); -#endif /* Error condition is for output only */ assert(!(connect && !writing)); @@ -758,10 +750,8 @@ sock_call_ex(PySocketSockObject *s, int deadline_initialized = 0; int res; -#ifdef WITH_THREAD /* sock_call() must be called with the GIL held. */ assert(PyGILState_Check()); -#endif /* outer loop to retry select() when select() is interrupted by a signal or to retry select()+sock_func() on false positive (see above) */ diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 32dd8174347..cf086de7573 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -10,17 +10,12 @@ #include "zlib.h" -#ifdef WITH_THREAD - #include "pythread.h" - #define ENTER_ZLIB(obj) \ - Py_BEGIN_ALLOW_THREADS; \ - PyThread_acquire_lock((obj)->lock, 1); \ - Py_END_ALLOW_THREADS; - #define LEAVE_ZLIB(obj) PyThread_release_lock((obj)->lock); -#else - #define ENTER_ZLIB(obj) - #define LEAVE_ZLIB(obj) -#endif +#include "pythread.h" +#define ENTER_ZLIB(obj) \ + Py_BEGIN_ALLOW_THREADS; \ + PyThread_acquire_lock((obj)->lock, 1); \ + Py_END_ALLOW_THREADS; +#define LEAVE_ZLIB(obj) PyThread_release_lock((obj)->lock); #if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221 # define AT_LEAST_ZLIB_1_2_2_1 @@ -51,9 +46,7 @@ typedef struct char eof; int is_initialised; PyObject *zdict; - #ifdef WITH_THREAD - PyThread_type_lock lock; - #endif + PyThread_type_lock lock; } compobject; static void @@ -112,14 +105,12 @@ newcompobject(PyTypeObject *type) Py_DECREF(self); return NULL; } -#ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); if (self->lock == NULL) { Py_DECREF(self); PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock"); return NULL; } -#endif return self; } @@ -615,9 +606,7 @@ zlib_decompressobj_impl(PyObject *module, int wbits, PyObject *zdict) static void Dealloc(compobject *self) { -#ifdef WITH_THREAD PyThread_free_lock(self->lock); -#endif Py_XDECREF(self->unused_data); Py_XDECREF(self->unconsumed_tail); Py_XDECREF(self->zdict); diff --git a/Objects/object.c b/Objects/object.c index 2ba6e572ea6..638f7e7c9ba 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -428,23 +428,17 @@ _PyObject_Dump(PyObject* op) if (op == NULL) fprintf(stderr, "NULL\n"); else { -#ifdef WITH_THREAD PyGILState_STATE gil; -#endif PyObject *error_type, *error_value, *error_traceback; fprintf(stderr, "object : "); -#ifdef WITH_THREAD gil = PyGILState_Ensure(); -#endif PyErr_Fetch(&error_type, &error_value, &error_traceback); (void)PyObject_Print(op, stderr, 0); PyErr_Restore(error_type, error_value, error_traceback); -#ifdef WITH_THREAD PyGILState_Release(gil); -#endif /* XXX(twouters) cast refcount to long until %zd is universally available */ fprintf(stderr, "\n" diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 32e7ecbe1e0..af9cf7b92c0 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1967,11 +1967,9 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes) static void _PyMem_DebugCheckGIL(void) { -#ifdef WITH_THREAD if (!PyGILState_Check()) Py_FatalError("Python memory allocator called " "without holding the GIL"); -#endif } static void * diff --git a/PC/config.c b/PC/config.c index 5f426004eb9..f14e06886e2 100644 --- a/PC/config.c +++ b/PC/config.c @@ -97,9 +97,7 @@ struct _inittab _PyImport_Inittab[] = { {"_sha3", PyInit__sha3}, {"_blake2", PyInit__blake2}, {"time", PyInit_time}, -#ifdef WITH_THREAD {"_thread", PyInit__thread}, -#endif #ifdef WIN32 {"msvcrt", PyInit_msvcrt}, {"_locale", PyInit__locale}, diff --git a/Parser/myreadline.c b/Parser/myreadline.c index 9f3c2e343c0..1b63f7863fa 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -18,10 +18,8 @@ PyThreadState* _PyOS_ReadlineTState; -#ifdef WITH_THREAD #include "pythread.h" static PyThread_type_lock _PyOS_ReadlineLock = NULL; -#endif int (*PyOS_InputHook)(void) = NULL; @@ -77,13 +75,9 @@ my_fgets(char *buf, int len, FILE *fp) #ifdef EINTR if (err == EINTR) { int s; -#ifdef WITH_THREAD PyEval_RestoreThread(_PyOS_ReadlineTState); -#endif s = PyErr_CheckSignals(); -#ifdef WITH_THREAD PyEval_SaveThread(); -#endif if (s < 0) return 1; /* try again */ @@ -133,13 +127,9 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn) if (WaitForSingleObjectEx(hInterruptEvent, 100, FALSE) == WAIT_OBJECT_0) { ResetEvent(hInterruptEvent); -#ifdef WITH_THREAD PyEval_RestoreThread(_PyOS_ReadlineTState); -#endif s = PyErr_CheckSignals(); -#ifdef WITH_THREAD PyEval_SaveThread(); -#endif if (s < 0) goto exit; } @@ -178,13 +168,9 @@ _PyOS_WindowsConsoleReadline(HANDLE hStdIn) PyMem_RawFree(wbuf); if (err) { -#ifdef WITH_THREAD PyEval_RestoreThread(_PyOS_ReadlineTState); -#endif PyErr_SetFromWindowsErr(err); -#ifdef WITH_THREAD PyEval_SaveThread(); -#endif } return buf; @@ -319,17 +305,13 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; } -#ifdef WITH_THREAD if (_PyOS_ReadlineLock == NULL) { _PyOS_ReadlineLock = PyThread_allocate_lock(); } -#endif _PyOS_ReadlineTState = PyThreadState_GET(); Py_BEGIN_ALLOW_THREADS -#ifdef WITH_THREAD PyThread_acquire_lock(_PyOS_ReadlineLock, 1); -#endif /* This is needed to handle the unlikely case that the * interpreter is in interactive mode *and* stdin/out are not @@ -343,9 +325,7 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) prompt); Py_END_ALLOW_THREADS -#ifdef WITH_THREAD PyThread_release_lock(_PyOS_ReadlineLock); -#endif _PyOS_ReadlineTState = NULL; diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c index e386248c2f8..ce66ebca0cc 100644 --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -37,11 +37,9 @@ Py_Exit(int sts) exit(sts); } -#ifdef WITH_THREAD /* Needed by obmalloc.c */ int PyGILState_Check(void) { return 1; } -#endif void _PyMem_DumpTraceback(int fd, const void *ptr) {} diff --git a/Programs/_testembed.c b/Programs/_testembed.c index c7660f95819..94a3c3d9c8f 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -41,9 +41,7 @@ static void print_subinterp(void) static int test_repeated_init_and_subinterpreters(void) { PyThreadState *mainstate, *substate; -#ifdef WITH_THREAD PyGILState_STATE gilstate; -#endif int i, j; for (i=0; i<15; i++) { @@ -51,12 +49,10 @@ static int test_repeated_init_and_subinterpreters(void) _testembed_Py_Initialize(); mainstate = PyThreadState_Get(); -#ifdef WITH_THREAD PyEval_InitThreads(); PyEval_ReleaseThread(mainstate); gilstate = PyGILState_Ensure(); -#endif print_subinterp(); PyThreadState_Swap(NULL); @@ -68,9 +64,7 @@ static int test_repeated_init_and_subinterpreters(void) PyThreadState_Swap(mainstate); print_subinterp(); -#ifdef WITH_THREAD PyGILState_Release(gilstate); -#endif PyEval_RestoreThread(mainstate); Py_Finalize(); diff --git a/Python/ceval.c b/Python/ceval.c index 436e5cad25f..8fc65cdcc04 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -87,11 +87,7 @@ static long dxp[256]; #endif #endif -#ifdef WITH_THREAD #define GIL_REQUEST _Py_atomic_load_relaxed(&gil_drop_request) -#else -#define GIL_REQUEST 0 -#endif /* This can set eval_breaker to 0 even though gil_drop_request became 1. We believe this is all right because the eval loop will release @@ -103,8 +99,6 @@ static long dxp[256]; _Py_atomic_load_relaxed(&pendingcalls_to_do) | \ pending_async_exc) -#ifdef WITH_THREAD - #define SET_GIL_DROP_REQUEST() \ do { \ _Py_atomic_store_relaxed(&gil_drop_request, 1); \ @@ -117,8 +111,6 @@ static long dxp[256]; COMPUTE_EVAL_BREAKER(); \ } while (0) -#endif - /* Pending calls are only modified under pending_lock */ #define SIGNAL_PENDING_CALLS() \ do { \ @@ -151,8 +143,6 @@ static _Py_atomic_int pendingcalls_to_do = {0}; Guarded by the GIL. */ static int pending_async_exc = 0; -#ifdef WITH_THREAD - #ifdef HAVE_ERRNO_H #include #endif @@ -256,8 +246,6 @@ PyEval_ReInitThreads(void) _PyThreadState_DeleteExcept(current_tstate); } -#endif /* WITH_THREAD */ - /* This function is used to signal that async exceptions are waiting to be raised, therefore it is also useful in non-threaded builds. */ @@ -277,10 +265,8 @@ PyEval_SaveThread(void) PyThreadState *tstate = PyThreadState_Swap(NULL); if (tstate == NULL) Py_FatalError("PyEval_SaveThread: NULL tstate"); -#ifdef WITH_THREAD if (gil_created()) drop_gil(tstate); -#endif return tstate; } @@ -289,7 +275,6 @@ PyEval_RestoreThread(PyThreadState *tstate) { if (tstate == NULL) Py_FatalError("PyEval_RestoreThread: NULL tstate"); -#ifdef WITH_THREAD if (gil_created()) { int err = errno; take_gil(tstate); @@ -301,7 +286,6 @@ PyEval_RestoreThread(PyThreadState *tstate) } errno = err; } -#endif PyThreadState_Swap(tstate); } @@ -320,14 +304,12 @@ PyEval_RestoreThread(PyThreadState *tstate) Note that because registry may occur from within signal handlers, or other asynchronous events, calling malloc() is unsafe! -#ifdef WITH_THREAD Any thread can schedule pending calls, but only the main thread will execute them. There is no facility to schedule calls to a particular thread, but that should be easy to change, should that ever be required. In that case, the static variables here should go into the python threadstate. -#endif */ void @@ -339,9 +321,7 @@ _PyEval_SignalReceived(void) SIGNAL_PENDING_CALLS(); } -#ifdef WITH_THREAD - -/* The WITH_THREAD implementation is thread-safe. It allows +/* This implementation is thread-safe. It allows scheduling to be made from any thread, and even from an executing callback. */ @@ -464,106 +444,6 @@ Py_MakePendingCalls(void) return -1; } -#else /* if ! defined WITH_THREAD */ - -/* - WARNING! ASYNCHRONOUSLY EXECUTING CODE! - This code is used for signal handling in python that isn't built - with WITH_THREAD. - Don't use this implementation when Py_AddPendingCalls() can happen - on a different thread! - - There are two possible race conditions: - (1) nested asynchronous calls to Py_AddPendingCall() - (2) AddPendingCall() calls made while pending calls are being processed. - - (1) is very unlikely because typically signal delivery - is blocked during signal handling. So it should be impossible. - (2) is a real possibility. - The current code is safe against (2), but not against (1). - The safety against (2) is derived from the fact that only one - thread is present, interrupted by signals, and that the critical - section is protected with the "busy" variable. On Windows, which - delivers SIGINT on a system thread, this does not hold and therefore - Windows really shouldn't use this version. - The two threads could theoretically wiggle around the "busy" variable. -*/ - -#define NPENDINGCALLS 32 -static struct { - int (*func)(void *); - void *arg; -} pendingcalls[NPENDINGCALLS]; -static volatile int pendingfirst = 0; -static volatile int pendinglast = 0; - -int -Py_AddPendingCall(int (*func)(void *), void *arg) -{ - static volatile int busy = 0; - int i, j; - /* XXX Begin critical section */ - if (busy) - return -1; - busy = 1; - i = pendinglast; - j = (i + 1) % NPENDINGCALLS; - if (j == pendingfirst) { - busy = 0; - return -1; /* Queue full */ - } - pendingcalls[i].func = func; - pendingcalls[i].arg = arg; - pendinglast = j; - - SIGNAL_PENDING_CALLS(); - busy = 0; - /* XXX End critical section */ - return 0; -} - -int -Py_MakePendingCalls(void) -{ - static int busy = 0; - if (busy) - return 0; - busy = 1; - - /* unsignal before starting to call callbacks, so that any callback - added in-between re-signals */ - UNSIGNAL_PENDING_CALLS(); - /* Python signal handler doesn't really queue a callback: it only signals - that a signal was received, see _PyEval_SignalReceived(). */ - if (PyErr_CheckSignals() < 0) { - goto error; - } - - for (;;) { - int i; - int (*func)(void *); - void *arg; - i = pendingfirst; - if (i == pendinglast) - break; /* Queue empty */ - func = pendingcalls[i].func; - arg = pendingcalls[i].arg; - pendingfirst = (i + 1) % NPENDINGCALLS; - if (func(arg) < 0) { - goto error; - } - } - busy = 0; - return 0; - -error: - busy = 0; - SIGNAL_PENDING_CALLS(); /* We're not done yet */ - return -1; -} - -#endif /* WITH_THREAD */ - /* The interpreter's recursion limit */ @@ -1101,7 +981,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) if (Py_MakePendingCalls() < 0) goto error; } -#ifdef WITH_THREAD if (_Py_atomic_load_relaxed(&gil_drop_request)) { /* Give another thread a chance */ if (PyThreadState_Swap(NULL) != tstate) @@ -1121,7 +1000,6 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) if (PyThreadState_Swap(tstate) != NULL) Py_FatalError("ceval: orphan tstate"); } -#endif /* Check for asynchronous exceptions. */ if (tstate->async_exc != NULL) { PyObject *exc = tstate->async_exc; diff --git a/Python/fileutils.c b/Python/fileutils.c index 97505e5bc6d..1cd8ac5302c 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -680,9 +680,7 @@ _Py_fstat(int fd, struct _Py_stat_struct *status) { int res; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif Py_BEGIN_ALLOW_THREADS res = _Py_fstat_noraise(fd, status); @@ -999,10 +997,8 @@ _Py_open_impl(const char *pathname, int flags, int gil_held) int _Py_open(const char *pathname, int flags) { -#ifdef WITH_THREAD /* _Py_open() must be called with the GIL held. */ assert(PyGILState_Check()); -#endif return _Py_open_impl(pathname, flags, 1); } @@ -1095,9 +1091,7 @@ _Py_fopen_obj(PyObject *path, const char *mode) wchar_t wmode[10]; int usize; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif if (!PyUnicode_Check(path)) { PyErr_Format(PyExc_TypeError, @@ -1125,9 +1119,7 @@ _Py_fopen_obj(PyObject *path, const char *mode) PyObject *bytes; char *path_bytes; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif if (!PyUnicode_FSConverter(path, &bytes)) return NULL; @@ -1177,9 +1169,7 @@ _Py_read(int fd, void *buf, size_t count) int err; int async_err = 0; -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif /* _Py_read() must not be called with an exception set, otherwise the * caller may think that read() was interrupted by a signal and the signal @@ -1318,9 +1308,7 @@ _Py_write_impl(int fd, const void *buf, size_t count, int gil_held) Py_ssize_t _Py_write(int fd, const void *buf, size_t count) { -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif /* _Py_write() must not be called with an exception set, otherwise the * caller may think that write() was interrupted by a signal and the signal @@ -1471,9 +1459,7 @@ _Py_dup(int fd) DWORD ftype; #endif -#ifdef WITH_THREAD assert(PyGILState_Check()); -#endif #ifdef MS_WINDOWS _Py_BEGIN_SUPPRESS_IPH diff --git a/Python/import.c b/Python/import.c index 542a91b9e6c..a406db31032 100644 --- a/Python/import.c +++ b/Python/import.c @@ -142,8 +142,6 @@ _PyImportZip_Init(void) in different threads to return with a partially loaded module. These calls are serialized by the global interpreter lock. */ -#ifdef WITH_THREAD - #include "pythread.h" static PyThread_type_lock import_lock = 0; @@ -224,8 +222,6 @@ _PyImport_ReInitLock(void) } } -#endif - /*[clinic input] _imp.lock_held @@ -238,11 +234,7 @@ static PyObject * _imp_lock_held_impl(PyObject *module) /*[clinic end generated code: output=8b89384b5e1963fc input=9b088f9b217d9bdf]*/ { -#ifdef WITH_THREAD return PyBool_FromLong(import_lock_thread != PYTHREAD_INVALID_THREAD_ID); -#else - Py_RETURN_FALSE; -#endif } /*[clinic input] @@ -258,9 +250,7 @@ static PyObject * _imp_acquire_lock_impl(PyObject *module) /*[clinic end generated code: output=1aff58cb0ee1b026 input=4a2d4381866d5fdc]*/ { -#ifdef WITH_THREAD _PyImport_AcquireLock(); -#endif Py_RETURN_NONE; } @@ -276,13 +266,11 @@ static PyObject * _imp_release_lock_impl(PyObject *module) /*[clinic end generated code: output=7faab6d0be178b0a input=934fb11516dd778b]*/ { -#ifdef WITH_THREAD if (_PyImport_ReleaseLock() < 0) { PyErr_SetString(PyExc_RuntimeError, "not holding the import lock"); return NULL; } -#endif Py_RETURN_NONE; } @@ -290,12 +278,10 @@ void _PyImport_Fini(void) { Py_CLEAR(extensions); -#ifdef WITH_THREAD if (import_lock != NULL) { PyThread_free_lock(import_lock); import_lock = NULL; } -#endif } /* Helper for sys */ diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c index a85790e1bfe..7ab5814272d 100644 --- a/Python/mystrtoul.c +++ b/Python/mystrtoul.c @@ -1,7 +1,7 @@ #include "Python.h" -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) +#if defined(__sgi) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE #endif diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 662405bdeb3..7798dfe9c2c 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -72,10 +72,8 @@ extern int _PyTraceMalloc_Init(void); extern int _PyTraceMalloc_Fini(void); extern void _Py_ReadyTypes(void); -#ifdef WITH_THREAD extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); -#endif /* WITH_THREAD */ /* Global configuration variable declarations are in pydebug.h */ /* XXX (ncoghlan): move those declarations to pylifecycle.h? */ @@ -618,7 +616,6 @@ void _Py_InitializeCore(const _PyCoreConfig *config) Py_FatalError("Py_InitializeCore: can't make first thread"); (void) PyThreadState_Swap(tstate); -#ifdef WITH_THREAD /* We can't call _PyEval_FiniThreads() in Py_FinalizeEx because destroying the GIL might fail when it is being referenced from another running thread (see issue #9901). @@ -627,7 +624,6 @@ void _Py_InitializeCore(const _PyCoreConfig *config) _PyEval_FiniThreads(); /* Auto-thread-state API */ _PyGILState_Init(interp, tstate); -#endif /* WITH_THREAD */ _Py_ReadyTypes(); @@ -1084,9 +1080,7 @@ Py_FinalizeEx(void) PyGrammar_RemoveAccelerators(&_PyParser_Grammar); /* Cleanup auto-thread-state */ -#ifdef WITH_THREAD _PyGILState_Fini(); -#endif /* WITH_THREAD */ /* Delete current thread. After this, many C API calls become crashy. */ PyThreadState_Swap(NULL); @@ -1142,11 +1136,9 @@ Py_NewInterpreter(void) if (!_Py_Initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); -#ifdef WITH_THREAD /* Issue #10915, #15751: The GIL API doesn't work with multiple interpreters: disable PyGILState_Check(). */ _PyGILState_check_enabled = 0; -#endif interp = PyInterpreterState_New(); if (interp == NULL) @@ -1850,9 +1842,7 @@ Py_FatalError(const char *msg) /* Clean up and exit */ -#ifdef WITH_THREAD # include "pythread.h" -#endif static void (*pyexitfunc)(void) = NULL; /* For the atexit module. */ @@ -1878,7 +1868,6 @@ call_py_exitfuncs(void) static void wait_for_thread_shutdown(void) { -#ifdef WITH_THREAD _Py_IDENTIFIER(_shutdown); PyObject *result; PyObject *threading = _PyImport_GetModuleId(&PyId_threading); @@ -1896,7 +1885,6 @@ wait_for_thread_shutdown(void) Py_DECREF(result); } Py_DECREF(threading); -#endif } #define NEXITFUNCS 32 diff --git a/Python/pystate.c b/Python/pystate.c index 30a372212ed..379e5a39c5a 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -36,7 +36,6 @@ extern "C" { int _PyGILState_check_enabled = 1; -#ifdef WITH_THREAD #include "pythread.h" static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ #define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) @@ -49,11 +48,6 @@ static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ /* TODO: Given interp_main, it may be possible to kill this ref */ static PyInterpreterState *autoInterpreterState = NULL; static int autoTLSkey = -1; -#else -#define HEAD_INIT() /* Nothing */ -#define HEAD_LOCK() /* Nothing */ -#define HEAD_UNLOCK() /* Nothing */ -#endif static PyInterpreterState *interp_head = NULL; static PyInterpreterState *interp_main = NULL; @@ -63,9 +57,7 @@ static PyInterpreterState *interp_main = NULL; _Py_atomic_address _PyThreadState_Current = {0}; PyThreadFrameGetter _PyThreadState_GetFrame = NULL; -#ifdef WITH_THREAD static void _PyGILState_NoteThreadState(PyThreadState* tstate); -#endif /* _next_interp_id is an auto-numbered sequence of small integers. It gets initialized in _PyInterpreterState_Init(), which is called @@ -93,10 +85,8 @@ PyInterpreterState_New(void) if (interp != NULL) { HEAD_INIT(); -#ifdef WITH_THREAD if (head_mutex == NULL) Py_FatalError("Can't initialize threads for interpreter"); -#endif interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; @@ -206,12 +196,10 @@ PyInterpreterState_Delete(PyInterpreterState *interp) } HEAD_UNLOCK(); PyMem_RawFree(interp); -#ifdef WITH_THREAD if (interp_head == NULL && head_mutex != NULL) { PyThread_free_lock(head_mutex); head_mutex = NULL; } -#endif } @@ -252,11 +240,7 @@ new_threadstate(PyInterpreterState *interp, int init) tstate->use_tracing = 0; tstate->gilstate_counter = 0; tstate->async_exc = NULL; -#ifdef WITH_THREAD tstate->thread_id = PyThread_get_thread_ident(); -#else - tstate->thread_id = 0; -#endif tstate->dict = NULL; @@ -314,9 +298,7 @@ _PyThreadState_Prealloc(PyInterpreterState *interp) void _PyThreadState_Init(PyThreadState *tstate) { -#ifdef WITH_THREAD _PyGILState_NoteThreadState(tstate); -#endif } PyObject* @@ -498,15 +480,12 @@ PyThreadState_Delete(PyThreadState *tstate) { if (tstate == GET_TSTATE()) Py_FatalError("PyThreadState_Delete: tstate is still current"); -#ifdef WITH_THREAD if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) PyThread_delete_key_value(autoTLSkey); -#endif /* WITH_THREAD */ tstate_delete_common(tstate); } -#ifdef WITH_THREAD void PyThreadState_DeleteCurrent() { @@ -520,7 +499,6 @@ PyThreadState_DeleteCurrent() SET_TSTATE(NULL); PyEval_ReleaseLock(); } -#endif /* WITH_THREAD */ /* @@ -588,7 +566,7 @@ PyThreadState_Swap(PyThreadState *newts) to be used for a thread. Check this the best we can in debug builds. */ -#if defined(Py_DEBUG) && defined(WITH_THREAD) +#if defined(Py_DEBUG) if (newts) { /* This can be called from PyEval_RestoreThread(). Similar to it, we need to ensure errno doesn't change. @@ -749,7 +727,6 @@ _PyThread_CurrentFrames(void) } /* Python "auto thread state" API. */ -#ifdef WITH_THREAD /* Keep this as a static, as it is not reliable! It can only ever be compared to the state for the *current* thread. @@ -805,10 +782,8 @@ _PyGILState_Fini(void) void _PyGILState_Reinit(void) { -#ifdef WITH_THREAD head_mutex = NULL; HEAD_INIT(); -#endif PyThreadState *tstate = PyGILState_GetThisThreadState(); PyThread_delete_key(autoTLSkey); if ((autoTLSkey = PyThread_create_key()) == -1) @@ -960,10 +935,7 @@ PyGILState_Release(PyGILState_STATE oldstate) PyEval_SaveThread(); } -#endif /* WITH_THREAD */ #ifdef __cplusplus } #endif - - diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 852babbed78..fba7220e44c 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -556,7 +556,6 @@ PyDoc_STRVAR(getcheckinterval_doc, "getcheckinterval() -> current check interval; see setcheckinterval()." ); -#ifdef WITH_THREAD static PyObject * sys_setswitchinterval(PyObject *self, PyObject *args) { @@ -594,8 +593,6 @@ PyDoc_STRVAR(getswitchinterval_doc, "getswitchinterval() -> current thread switch interval; see setswitchinterval()." ); -#endif /* WITH_THREAD */ - static PyObject * sys_setrecursionlimit(PyObject *self, PyObject *args) { @@ -1418,12 +1415,10 @@ static PyMethodDef sys_methods[] = { setcheckinterval_doc}, {"getcheckinterval", sys_getcheckinterval, METH_NOARGS, getcheckinterval_doc}, -#ifdef WITH_THREAD {"setswitchinterval", sys_setswitchinterval, METH_VARARGS, setswitchinterval_doc}, {"getswitchinterval", sys_getswitchinterval, METH_NOARGS, getswitchinterval_doc}, -#endif #ifdef HAVE_DLOPEN {"setdlopenflags", sys_setdlopenflags, METH_VARARGS, setdlopenflags_doc}, @@ -2055,9 +2050,7 @@ _PySys_BeginInit(void) PyUnicode_FromString("legacy")); #endif -#ifdef WITH_THREAD SET_SYS_FROM_STRING("thread_info", PyThread_GetInfo()); -#endif /* initialize asyncgen_hooks */ if (AsyncGenHooksType.tp_name == NULL) { diff --git a/Python/traceback.c b/Python/traceback.c index b52385ef12f..cd30d56b94a 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -749,7 +749,6 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp, PyThreadState *tstate; unsigned int nthreads; -#ifdef WITH_THREAD if (current_tstate == NULL) { /* _Py_DumpTracebackThreads() is called from signal handlers by faulthandler. @@ -777,21 +776,6 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp, interp = current_tstate->interp; } } -#else - if (current_tstate == NULL) { - /* Call _PyThreadState_UncheckedGet() instead of PyThreadState_Get() - to not fail with a fatal error if the thread state is NULL. */ - current_tstate = _PyThreadState_UncheckedGet(); - } - - if (interp == NULL) { - if (current_tstate == NULL) { - /* We need the interpreter state to get Python threads */ - return "unable to get the interpreter state"; - } - interp = current_tstate->interp; - } -#endif assert(interp != NULL); /* Get the current interpreter from the current thread */ diff --git a/aclocal.m4 b/aclocal.m4 index 5fadcb1e445..2a745e57466 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -12,9 +12,9 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 11 (pkg-config-0.29.1) - +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29.1) +dnl dnl Copyright ? 2004 Scott James Remnant . dnl Copyright ? 2012-2015 Dan Nicholson dnl @@ -288,71 +288,3 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR -dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------ -dnl -dnl Prepare a "--with-" configure option using the lowercase -dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and -dnl PKG_CHECK_MODULES in a single macro. -AC_DEFUN([PKG_WITH_MODULES], -[ -m4_pushdef([with_arg], m4_tolower([$1])) - -m4_pushdef([description], - [m4_default([$5], [build with ]with_arg[ support])]) - -m4_pushdef([def_arg], [m4_default([$6], [auto])]) -m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) -m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) - -m4_case(def_arg, - [yes],[m4_pushdef([with_without], [--without-]with_arg)], - [m4_pushdef([with_without],[--with-]with_arg)]) - -AC_ARG_WITH(with_arg, - AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, - [AS_TR_SH([with_]with_arg)=def_arg]) - -AS_CASE([$AS_TR_SH([with_]with_arg)], - [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], - [auto],[PKG_CHECK_MODULES([$1],[$2], - [m4_n([def_action_if_found]) $3], - [m4_n([def_action_if_not_found]) $4])]) - -m4_popdef([with_arg]) -m4_popdef([description]) -m4_popdef([def_arg]) - -])dnl PKG_WITH_MODULES - -dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ----------------------------------------------- -dnl -dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES -dnl check._[VARIABLE-PREFIX] is exported as make variable. -AC_DEFUN([PKG_HAVE_WITH_MODULES], -[ -PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) - -AM_CONDITIONAL([HAVE_][$1], - [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) -])dnl PKG_HAVE_WITH_MODULES - -dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------------------ -dnl -dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after -dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make -dnl and preprocessor variable. -AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], -[ -PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) - -AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], - [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) -])dnl PKG_HAVE_DEFINE_WITH_MODULES - diff --git a/configure b/configure index 75d64324e6b..12afe5e9b3c 100755 --- a/configure +++ b/configure @@ -646,9 +646,7 @@ DTRACE_OBJS DTRACE_HEADERS DFLAGS DTRACE -THREADOBJ LDLAST -USE_THREAD_MODULE TCLTK_LIBS TCLTK_INCLUDES LIBFFI_INCLUDEDIR @@ -782,6 +780,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -828,8 +827,6 @@ enable_loadable_sqlite_extensions with_tcltk_includes with_tcltk_libs with_dbmliborder -with_threads -with_thread enable_ipv6 with_doc_strings with_pymalloc @@ -895,6 +892,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1147,6 +1145,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1284,7 +1291,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1437,6 +1444,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1523,10 +1531,6 @@ Optional Packages: order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'. - --with(out)-threads[=DIRECTORY] - disable/enable thread support - --with(out)-thread[=DIRECTORY] - deprecated; use --with(out)-threads --with(out)-doc-strings disable/enable documentation strings --with(out)-pymalloc disable/enable specialized mallocs --with(out)-c-locale-coercion @@ -10148,83 +10152,39 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dbmliborder" >&5 $as_echo "$with_dbmliborder" >&6; } -# This is used to generate Setup.config - -USE_THREAD_MODULE="" - # Templates for things AC_DEFINEd more than once. # For a single AC_DEFINE, no template is needed. - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-threads" >&5 -$as_echo_n "checking for --with-threads... " >&6; } - -# Check whether --with-threads was given. -if test "${with_threads+set}" = set; then : - withval=$with_threads; -fi - - -# --with-thread is deprecated, but check for it anyway - -# Check whether --with-thread was given. -if test "${with_thread+set}" = set; then : - withval=$with_thread; with_threads=$with_thread -fi - - -if test -z "$with_threads" -then with_threads="yes" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_threads" >&5 -$as_echo "$with_threads" >&6; } - - -if test "$with_threads" = "no" +if test "$ac_cv_pthread_is_default" = yes then - USE_THREAD_MODULE="#" -elif test "$ac_cv_pthread_is_default" = yes -then - $as_echo "#define WITH_THREAD 1" >>confdefs.h - # Defining _REENTRANT on system with POSIX threads should not hurt. $as_echo "#define _REENTRANT 1" >>confdefs.h posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -Kpthread" fi - $as_echo "#define WITH_THREAD 1" >>confdefs.h - posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -Kthread" fi - $as_echo "#define WITH_THREAD 1" >>confdefs.h - posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_pthread" = "yes" then CC="$CC -pthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -pthread" fi - $as_echo "#define WITH_THREAD 1" >>confdefs.h - posix_threads=yes - THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" then LDFLAGS="$LDFLAGS -L$with_threads" @@ -10287,19 +10247,16 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define WITH_THREAD 1" >>confdefs.h - posix_threads=yes - THREADOBJ="Python/thread.o" + else LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" if test "x$ac_cv_func_pthread_detach" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes - THREADOBJ="Python/thread.o" + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 @@ -10339,11 +10296,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes LIBS="$LIBS -lpthreads" - THREADOBJ="Python/thread.o" + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 @@ -10383,11 +10339,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes LIBS="$LIBS -lc_r" - THREADOBJ="Python/thread.o" + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 @@ -10427,11 +10382,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes LIBS="$LIBS -lpthread" - THREADOBJ="Python/thread.o" + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 @@ -10471,14 +10425,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes LIBS="$LIBS -lcma" - THREADOBJ="Python/thread.o" + else - USE_THREAD_MODULE="#" + as_fn_error $? "could not find pthreads on your system" "$LINENO" 5 + fi @@ -10531,60 +10485,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE="" -fi - - if test "$posix_threads" != "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 -$as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char thr_create (); -int -main () -{ -return thr_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_thread_thr_create=yes -else - ac_cv_lib_thread_thr_create=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 -$as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : - $as_echo "#define WITH_THREAD 1" >>confdefs.h - LIBS="$LIBS -lthread" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE="" -fi - fi fi if test "$posix_threads" = "yes"; then @@ -16591,7 +16497,7 @@ $as_echo "#define HAVE_GETRANDOM 1" >>confdefs.h fi # generate output files -ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh" +ac_config_files="$ac_config_files Makefile.pre Misc/python.pc Misc/python-config.sh" ac_config_files="$ac_config_files Modules/ld_so_aix" @@ -17293,7 +17199,6 @@ do "Mac/Resources/framework/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/framework/Info.plist" ;; "Mac/Resources/app/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/app/Info.plist" ;; "Makefile.pre") CONFIG_FILES="$CONFIG_FILES Makefile.pre" ;; - "Modules/Setup.config") CONFIG_FILES="$CONFIG_FILES Modules/Setup.config" ;; "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Misc/python-config.sh") CONFIG_FILES="$CONFIG_FILES Misc/python-config.sh" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; @@ -17909,7 +17814,7 @@ fi echo "creating Makefile" >&6 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ - -s Modules Modules/Setup.config \ + -s Modules \ Modules/Setup.local Modules/Setup mv config.c Modules diff --git a/configure.ac b/configure.ac index 00d5abaaaed..9cded9f6f79 100644 --- a/configure.ac +++ b/configure.ac @@ -2885,73 +2885,39 @@ else fi]) AC_MSG_RESULT($with_dbmliborder) -# This is used to generate Setup.config -AC_SUBST(USE_THREAD_MODULE) -USE_THREAD_MODULE="" - AC_SUBST(LDLAST) # Templates for things AC_DEFINEd more than once. # For a single AC_DEFINE, no template is needed. AH_TEMPLATE(_REENTRANT, [Define to force use of thread-safe errno, h_errno, and other functions]) -AH_TEMPLATE(WITH_THREAD, - [Define if you want to compile in rudimentary thread support]) - -AC_MSG_CHECKING(for --with-threads) -dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output -AC_ARG_WITH(threads, - AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support])) - -# --with-thread is deprecated, but check for it anyway -dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output -AC_ARG_WITH(thread, - AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]), - [with_threads=$with_thread]) - -if test -z "$with_threads" -then with_threads="yes" -fi -AC_MSG_RESULT($with_threads) -AC_SUBST(THREADOBJ) -if test "$with_threads" = "no" -then - USE_THREAD_MODULE="#" -elif test "$ac_cv_pthread_is_default" = yes +if test "$ac_cv_pthread_is_default" = yes then - AC_DEFINE(WITH_THREAD) # Defining _REENTRANT on system with POSIX threads should not hurt. AC_DEFINE(_REENTRANT) posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -Kpthread" fi - AC_DEFINE(WITH_THREAD) posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -Kthread" fi - AC_DEFINE(WITH_THREAD) posix_threads=yes - THREADOBJ="Python/thread.o" elif test "$ac_cv_pthread" = "yes" then CC="$CC -pthread" if test "$ac_cv_cxx_thread" = "yes"; then CXX="$CXX -pthread" fi - AC_DEFINE(WITH_THREAD) posix_threads=yes - THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" then LDFLAGS="$LDFLAGS -L$with_threads" @@ -2987,43 +2953,36 @@ yes void * start_routine (void *arg) { exit (0); }]], [[ pthread_create (NULL, NULL, start_routine, NULL)]])],[ AC_MSG_RESULT(yes) - AC_DEFINE(WITH_THREAD) posix_threads=yes - THREADOBJ="Python/thread.o"],[ + ],[ LIBS=$_libs - AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) + AC_CHECK_FUNC(pthread_detach, [ posix_threads=yes - THREADOBJ="Python/thread.o"],[ - AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) + ],[ + AC_CHECK_LIB(pthreads, pthread_create, [ posix_threads=yes LIBS="$LIBS -lpthreads" - THREADOBJ="Python/thread.o"], [ - AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) + ], [ + AC_CHECK_LIB(c_r, pthread_create, [ posix_threads=yes LIBS="$LIBS -lc_r" - THREADOBJ="Python/thread.o"], [ - AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) + ], [ + AC_CHECK_LIB(pthread, __pthread_create_system, [ posix_threads=yes LIBS="$LIBS -lpthread" - THREADOBJ="Python/thread.o"], [ - AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) + ], [ + AC_CHECK_LIB(cma, pthread_create, [ posix_threads=yes LIBS="$LIBS -lcma" - THREADOBJ="Python/thread.o"],[ - USE_THREAD_MODULE="#"]) + ],[ + AC_MSG_ERROR([could not find pthreads on your system]) + ]) ])])])])]) - AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) + AC_CHECK_LIB(mpc, usconfig, [ LIBS="$LIBS -lmpc" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - - if test "$posix_threads" != "yes"; then - AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) - LIBS="$LIBS -lthread" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - fi + ]) + fi if test "$posix_threads" = "yes"; then @@ -5426,7 +5385,7 @@ if test "$have_getrandom" = yes; then fi # generate output files -AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh) +AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-config.sh) AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) AC_OUTPUT @@ -5444,7 +5403,7 @@ fi echo "creating Makefile" >&AS_MESSAGE_FD $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ - -s Modules Modules/Setup.config \ + -s Modules \ Modules/Setup.local Modules/Setup mv config.c Modules diff --git a/pyconfig.h.in b/pyconfig.h.in index 1356eb58ab4..4fc5a3f5a38 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1397,9 +1397,6 @@ /* Define if you want to compile in Python-specific mallocs */ #undef WITH_PYMALLOC -/* Define if you want to compile in rudimentary thread support */ -#undef WITH_THREAD - /* Define if you want pymalloc to be disabled when running under valgrind */ #undef WITH_VALGRIND diff --git a/setup.py b/setup.py index 79f96989a40..d5c58e06869 100644 --- a/setup.py +++ b/setup.py @@ -1641,12 +1641,9 @@ class db_found(Exception): pass sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')): multiprocessing_srcs.append('_multiprocessing/semaphore.c') - if sysconfig.get_config_var('WITH_THREAD'): - exts.append ( Extension('_multiprocessing', multiprocessing_srcs, - define_macros=list(macros.items()), - include_dirs=["Modules/_multiprocessing"])) - else: - missing.append('_multiprocessing') + exts.append ( Extension('_multiprocessing', multiprocessing_srcs, + define_macros=list(macros.items()), + include_dirs=["Modules/_multiprocessing"])) # End multiprocessing # Platform-specific libraries @@ -2141,10 +2138,6 @@ def _decimal_ext(self): # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html undef_macros.append('_FORTIFY_SOURCE') - # Faster version without thread local contexts: - if not sysconfig.get_config_var('WITH_THREAD'): - define_macros.append(('WITHOUT_THREADS', 1)) - # Uncomment for extra functionality: #define_macros.append(('EXTRA_FUNCTIONALITY', 1)) ext = Extension ( From webhook-mailer at python.org Thu Sep 7 13:12:05 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 17:12:05 -0000 Subject: [Python-checkins] [3.6] Update multissl test helper (GH-3349) (#3415) Message-ID: https://github.com/python/cpython/commit/2a75012b821ad82c39549310526cb4f8fcc43538 commit: 2a75012b821ad82c39549310526cb4f8fcc43538 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-07T10:12:03-07:00 summary: [3.6] Update multissl test helper (GH-3349) (#3415) Signed-off-by: Christian Heimes (cherry picked from commit d3b9f97) files: A Tools/ssl/multissltests.py D Tools/ssl/test_multiple_versions.py M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 0a8ac713017..6cb0c63e5d6 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1053,6 +1053,13 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ quicktest: @DEF_MAKE_RULE@ platform $(TESTRUNNER) $(QUICKTESTOPTS) +# SSL tests +.PHONY: multisslcompile multissltest +multisslcompile: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py --compile-only + +multissltest: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@ if test "x$(ENSUREPIP)" != "xno" ; then \ diff --git a/Tools/ssl/multissltests.py b/Tools/ssl/multissltests.py new file mode 100755 index 00000000000..994e420818e --- /dev/null +++ b/Tools/ssl/multissltests.py @@ -0,0 +1,430 @@ +#!./python +"""Run Python tests against multiple installations of OpenSSL and LibreSSL + +The script + + (1) downloads OpenSSL / LibreSSL tar bundle + (2) extracts it to ./src + (3) compiles OpenSSL / LibreSSL + (4) installs OpenSSL / LibreSSL into ../multissl/$LIB/$VERSION/ + (5) forces a recompilation of Python modules using the + header and library files from ../multissl/$LIB/$VERSION/ + (6) runs Python's test suite + +The script must be run with Python's build directory as current working +directory. + +The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend +search paths for header files and shared libraries. It's known to work on +Linux with GCC and clang. + +Please keep this script compatible with Python 2.7, and 3.4 to 3.7. + +(c) 2013-2017 Christian Heimes +""" +from __future__ import print_function + +import argparse +from datetime import datetime +import logging +import os +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen +import subprocess +import shutil +import sys +import tarfile + + +log = logging.getLogger("multissl") + +OPENSSL_OLD_VERSIONS = [ + "0.9.8zc", + "0.9.8zh", + "1.0.1u", +] + +OPENSSL_RECENT_VERSIONS = [ + "1.0.2", + "1.0.2l", + "1.1.0f", +] + +LIBRESSL_OLD_VERSIONS = [ + "2.3.10", + "2.4.5", +] + +LIBRESSL_RECENT_VERSIONS = [ + "2.5.3", + "2.5.5", +] + +# store files in ../multissl +HERE = os.path.abspath(os.getcwd()) +MULTISSL_DIR = os.path.abspath(os.path.join(HERE, '..', 'multissl')) + +parser = argparse.ArgumentParser( + prog='multissl', + description=( + "Run CPython tests with multiple OpenSSL and LibreSSL " + "versions." + ) +) +parser.add_argument( + '--debug', + action='store_true', + help="Enable debug mode", +) +parser.add_argument( + '--disable-ancient', + action='store_true', + help="Don't test OpenSSL < 1.0.2 and LibreSSL < 2.5.3.", +) +parser.add_argument( + '--openssl', + nargs='+', + default=(), + help=( + "OpenSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(OPENSSL_RECENT_VERSIONS, OPENSSL_OLD_VERSIONS) +) +parser.add_argument( + '--libressl', + nargs='+', + default=(), + help=( + "LibreSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(LIBRESSL_RECENT_VERSIONS, LIBRESSL_OLD_VERSIONS) +) +parser.add_argument( + '--tests', + nargs='*', + default=(), + help="Python tests to run, defaults to all SSL related tests.", +) +parser.add_argument( + '--base-directory', + default=MULTISSL_DIR, + help="Base directory for OpenSSL / LibreSSL sources and builds." +) +parser.add_argument( + '--no-network', + action='store_false', + dest='network', + help="Disable network tests." +) +parser.add_argument( + '--compile-only', + action='store_true', + help="Don't run tests, only compile _ssl.c and _hashopenssl.c." +) + + +class AbstractBuilder(object): + library = None + url_template = None + src_template = None + build_template = None + + module_files = ("Modules/_ssl.c", + "Modules/_hashopenssl.c") + module_libs = ("_ssl", "_hashlib") + + def __init__(self, version, compile_args=(), + basedir=MULTISSL_DIR): + self.version = version + self.compile_args = compile_args + # installation directory + self.install_dir = os.path.join( + os.path.join(basedir, self.library.lower()), version + ) + # source file + self.src_dir = os.path.join(basedir, 'src') + self.src_file = os.path.join( + self.src_dir, self.src_template.format(version)) + # build directory (removed after install) + self.build_dir = os.path.join( + self.src_dir, self.build_template.format(version)) + + def __str__(self): + return "<{0.__class__.__name__} for {0.version}>".format(self) + + def __eq__(self, other): + if not isinstance(other, AbstractBuilder): + return NotImplemented + return ( + self.library == other.library + and self.version == other.version + ) + + def __hash__(self): + return hash((self.library, self.version)) + + @property + def openssl_cli(self): + """openssl CLI binary""" + return os.path.join(self.install_dir, "bin", "openssl") + + @property + def openssl_version(self): + """output of 'bin/openssl version'""" + cmd = [self.openssl_cli, "version"] + return self._subprocess_output(cmd) + + @property + def pyssl_version(self): + """Value of ssl.OPENSSL_VERSION""" + cmd = [ + sys.executable, + '-c', 'import ssl; print(ssl.OPENSSL_VERSION)' + ] + return self._subprocess_output(cmd) + + @property + def include_dir(self): + return os.path.join(self.install_dir, "include") + + @property + def lib_dir(self): + return os.path.join(self.install_dir, "lib") + + @property + def has_openssl(self): + return os.path.isfile(self.openssl_cli) + + @property + def has_src(self): + return os.path.isfile(self.src_file) + + def _subprocess_call(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + return subprocess.check_call(cmd, env=env, **kwargs) + + def _subprocess_output(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + if env is None: + env = os.environ.copy() + env["LD_LIBRARY_PATH"] = self.lib_dir + out = subprocess.check_output(cmd, env=env, **kwargs) + return out.strip().decode("utf-8") + + def _download_src(self): + """Download sources""" + src_dir = os.path.dirname(self.src_file) + if not os.path.isdir(src_dir): + os.makedirs(src_dir) + url = self.url_template.format(self.version) + log.info("Downloading from {}".format(url)) + req = urlopen(url) + # KISS, read all, write all + data = req.read() + log.info("Storing {}".format(self.src_file)) + with open(self.src_file, "wb") as f: + f.write(data) + + def _unpack_src(self): + """Unpack tar.gz bundle""" + # cleanup + if os.path.isdir(self.build_dir): + shutil.rmtree(self.build_dir) + os.makedirs(self.build_dir) + + tf = tarfile.open(self.src_file) + name = self.build_template.format(self.version) + base = name + '/' + # force extraction into build dir + members = tf.getmembers() + for member in list(members): + if member.name == name: + members.remove(member) + elif not member.name.startswith(base): + raise ValueError(member.name, base) + member.name = member.name[len(base):].lstrip('/') + log.info("Unpacking files to {}".format(self.build_dir)) + tf.extractall(self.build_dir, members) + + def _build_src(self): + """Now build openssl""" + log.info("Running build in {}".format(self.build_dir)) + cwd = self.build_dir + cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] + cmd.extend(self.compile_args) + self._subprocess_call(cmd, cwd=cwd) + # Old OpenSSL versions do not support parallel builds. + self._subprocess_call(["make", "-j1"], cwd=cwd) + + def _make_install(self, remove=True): + self._subprocess_call(["make", "-j1", "install"], cwd=self.build_dir) + if remove: + shutil.rmtree(self.build_dir) + + def install(self): + log.info(self.openssl_cli) + if not self.has_openssl: + if not self.has_src: + self._download_src() + else: + log.debug("Already has src {}".format(self.src_file)) + self._unpack_src() + self._build_src() + self._make_install() + else: + log.info("Already has installation {}".format(self.install_dir)) + # validate installation + version = self.openssl_version + if self.version not in version: + raise ValueError(version) + + def recompile_pymods(self): + log.warning("Using build from {}".format(self.build_dir)) + # force a rebuild of all modules that use OpenSSL APIs + for fname in self.module_files: + os.utime(fname, None) + # remove all build artefacts + for root, dirs, files in os.walk('build'): + for filename in files: + if filename.startswith(self.module_libs): + os.unlink(os.path.join(root, filename)) + + # overwrite header and library search paths + env = os.environ.copy() + env["CPPFLAGS"] = "-I{}".format(self.include_dir) + env["LDFLAGS"] = "-L{}".format(self.lib_dir) + # set rpath + env["LD_RUN_PATH"] = self.lib_dir + + log.info("Rebuilding Python modules") + cmd = [sys.executable, "setup.py", "build"] + self._subprocess_call(cmd, env=env) + self.check_imports() + + def check_imports(self): + cmd = [sys.executable, "-c", "import _ssl; import _hashlib"] + self._subprocess_call(cmd) + + def check_pyssl(self): + version = self.pyssl_version + if self.version not in version: + raise ValueError(version) + + def run_python_tests(self, tests, network=True): + if not tests: + cmd = [sys.executable, 'Lib/test/ssltests.py', '-j0'] + elif sys.version_info < (3, 3): + cmd = [sys.executable, '-m', 'test.regrtest'] + else: + cmd = [sys.executable, '-m', 'test', '-j0'] + if network: + cmd.extend(['-u', 'network', '-u', 'urlfetch']) + cmd.extend(['-w', '-r']) + cmd.extend(tests) + self._subprocess_call(cmd, stdout=None) + + +class BuildOpenSSL(AbstractBuilder): + library = "OpenSSL" + url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" + src_template = "openssl-{}.tar.gz" + build_template = "openssl-{}" + + +class BuildLibreSSL(AbstractBuilder): + library = "LibreSSL" + url_template = ( + "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-{}.tar.gz") + src_template = "libressl-{}.tar.gz" + build_template = "libressl-{}" + + +def configure_make(): + if not os.path.isfile('Makefile'): + log.info('Running ./configure') + subprocess.check_call([ + './configure', '--config-cache', '--quiet', + '--with-pydebug' + ]) + + log.info('Running make') + subprocess.check_call(['make', '--quiet']) + + +def main(): + args = parser.parse_args() + if not args.openssl and not args.libressl: + args.openssl = list(OPENSSL_RECENT_VERSIONS) + args.libressl = list(LIBRESSL_RECENT_VERSIONS) + if not args.disable_ancient: + args.openssl.extend(OPENSSL_OLD_VERSIONS) + args.libressl.extend(LIBRESSL_OLD_VERSIONS) + + logging.basicConfig( + level=logging.DEBUG if args.debug else logging.INFO, + format="*** %(levelname)s %(message)s" + ) + + start = datetime.now() + + for name in ['python', 'setup.py', 'Modules/_ssl.c']: + if not os.path.isfile(name): + parser.error( + "Must be executed from CPython build dir" + ) + if not os.path.samefile('python', sys.executable): + parser.error( + "Must be executed with ./python from CPython build dir" + ) + + # check for configure and run make + configure_make() + + # download and register builder + builds = [] + + for version in args.openssl: + build = BuildOpenSSL(version) + build.install() + builds.append(build) + + for version in args.libressl: + build = BuildLibreSSL(version) + build.install() + builds.append(build) + + for build in builds: + try: + build.recompile_pymods() + build.check_pyssl() + if not args.compile_only: + build.run_python_tests( + tests=args.tests, + network=args.network, + ) + except Exception as e: + log.exception("%s failed", build) + print("{} failed: {}".format(build, e), file=sys.stderr) + sys.exit(2) + + print("\n{} finished in {}".format( + "Tests" if not args.compile_only else "Builds", + datetime.now() - start + )) + print('Python: ', sys.version) + if args.compile_only: + print('Build only') + elif args.tests: + print('Executed Tests:', ' '.join(args.tests)) + else: + print('Executed all SSL tests.') + + print('OpenSSL / LibreSSL versions:') + for build in builds: + print(" * {0.library} {0.version}".format(build)) + + +if __name__ == "__main__": + main() diff --git a/Tools/ssl/test_multiple_versions.py b/Tools/ssl/test_multiple_versions.py deleted file mode 100644 index 30d5fcf2e0b..00000000000 --- a/Tools/ssl/test_multiple_versions.py +++ /dev/null @@ -1,241 +0,0 @@ -#./python -"""Run Python tests with multiple installations of OpenSSL - -The script - - (1) downloads OpenSSL tar bundle - (2) extracts it to ../openssl/src/openssl-VERSION/ - (3) compiles OpenSSL - (4) installs OpenSSL into ../openssl/VERSION/ - (5) forces a recompilation of Python modules using the - header and library files from ../openssl/VERSION/ - (6) runs Python's test suite - -The script must be run with Python's build directory as current working -directory: - - ./python Tools/ssl/test_multiple_versions.py - -The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend -search paths for header files and shared libraries. It's known to work on -Linux with GCC 4.x. - -(c) 2013 Christian Heimes -""" -import logging -import os -import tarfile -import shutil -import subprocess -import sys -from urllib.request import urlopen - -log = logging.getLogger("multissl") - -OPENSSL_VERSIONS = [ - "0.9.7m", "0.9.8i", "0.9.8l", "0.9.8m", "0.9.8y", "1.0.0k", "1.0.1e" -] -FULL_TESTS = [ - "test_asyncio", "test_ftplib", "test_hashlib", "test_httplib", - "test_imaplib", "test_nntplib", "test_poplib", "test_smtplib", - "test_smtpnet", "test_urllib2_localnet", "test_venv" -] -MINIMAL_TESTS = ["test_ssl", "test_hashlib"] -CADEFAULT = True -HERE = os.path.abspath(os.getcwd()) -DEST_DIR = os.path.abspath(os.path.join(HERE, os.pardir, "openssl")) - - -class BuildSSL: - url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" - - module_files = ["Modules/_ssl.c", - "Modules/socketmodule.c", - "Modules/_hashopenssl.c"] - - def __init__(self, version, openssl_compile_args=(), destdir=DEST_DIR): - self._check_python_builddir() - self.version = version - self.openssl_compile_args = openssl_compile_args - # installation directory - self.install_dir = os.path.join(destdir, version) - # source file - self.src_file = os.path.join(destdir, "src", - "openssl-{}.tar.gz".format(version)) - # build directory (removed after install) - self.build_dir = os.path.join(destdir, "src", - "openssl-{}".format(version)) - - @property - def openssl_cli(self): - """openssl CLI binary""" - return os.path.join(self.install_dir, "bin", "openssl") - - @property - def openssl_version(self): - """output of 'bin/openssl version'""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = [self.openssl_cli, "version"] - return self._subprocess_output(cmd, env=env) - - @property - def pyssl_version(self): - """Value of ssl.OPENSSL_VERSION""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = ["./python", "-c", "import ssl; print(ssl.OPENSSL_VERSION)"] - return self._subprocess_output(cmd, env=env) - - @property - def include_dir(self): - return os.path.join(self.install_dir, "include") - - @property - def lib_dir(self): - return os.path.join(self.install_dir, "lib") - - @property - def has_openssl(self): - return os.path.isfile(self.openssl_cli) - - @property - def has_src(self): - return os.path.isfile(self.src_file) - - def _subprocess_call(self, cmd, stdout=subprocess.DEVNULL, env=None, - **kwargs): - log.debug("Call '%s'", " ".join(cmd)) - return subprocess.check_call(cmd, stdout=stdout, env=env, **kwargs) - - def _subprocess_output(self, cmd, env=None, **kwargs): - log.debug("Call '%s'", " ".join(cmd)) - out = subprocess.check_output(cmd, env=env) - return out.strip().decode("utf-8") - - def _check_python_builddir(self): - if not os.path.isfile("python") or not os.path.isfile("setup.py"): - raise ValueError("Script must be run in Python build directory") - - def _download_openssl(self): - """Download OpenSSL source dist""" - src_dir = os.path.dirname(self.src_file) - if not os.path.isdir(src_dir): - os.makedirs(src_dir) - url = self.url_template.format(self.version) - log.info("Downloading OpenSSL from {}".format(url)) - req = urlopen(url, cadefault=CADEFAULT) - # KISS, read all, write all - data = req.read() - log.info("Storing {}".format(self.src_file)) - with open(self.src_file, "wb") as f: - f.write(data) - - def _unpack_openssl(self): - """Unpack tar.gz bundle""" - # cleanup - if os.path.isdir(self.build_dir): - shutil.rmtree(self.build_dir) - os.makedirs(self.build_dir) - - tf = tarfile.open(self.src_file) - base = "openssl-{}/".format(self.version) - # force extraction into build dir - members = tf.getmembers() - for member in members: - if not member.name.startswith(base): - raise ValueError(member.name) - member.name = member.name[len(base):] - log.info("Unpacking files to {}".format(self.build_dir)) - tf.extractall(self.build_dir, members) - - def _build_openssl(self): - """Now build openssl""" - log.info("Running build in {}".format(self.install_dir)) - cwd = self.build_dir - cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] - cmd.extend(self.openssl_compile_args) - self._subprocess_call(cmd, cwd=cwd) - self._subprocess_call(["make"], cwd=cwd) - - def _install_openssl(self, remove=True): - self._subprocess_call(["make", "install"], cwd=self.build_dir) - if remove: - shutil.rmtree(self.build_dir) - - def install_openssl(self): - if not self.has_openssl: - if not self.has_src: - self._download_openssl() - else: - log.debug("Already has src %s", self.src_file) - self._unpack_openssl() - self._build_openssl() - self._install_openssl() - else: - log.info("Already has installation {}".format(self.install_dir)) - # validate installation - version = self.openssl_version - if self.version not in version: - raise ValueError(version) - - def touch_pymods(self): - # force a rebuild of all modules that use OpenSSL APIs - for fname in self.module_files: - os.utime(fname) - - def recompile_pymods(self): - log.info("Using OpenSSL build from {}".format(self.build_dir)) - # overwrite header and library search paths - env = os.environ.copy() - env["CPPFLAGS"] = "-I{}".format(self.include_dir) - env["LDFLAGS"] = "-L{}".format(self.lib_dir) - # set rpath - env["LD_RUN_PATH"] = self.lib_dir - - log.info("Rebuilding Python modules") - self.touch_pymods() - cmd = ["./python", "setup.py", "build"] - self._subprocess_call(cmd, env=env) - - def check_pyssl(self): - version = self.pyssl_version - if self.version not in version: - raise ValueError(version) - - def run_pytests(self, *args): - cmd = ["./python", "-m", "test"] - cmd.extend(args) - self._subprocess_call(cmd, stdout=None) - - def run_python_tests(self, *args): - self.recompile_pymods() - self.check_pyssl() - self.run_pytests(*args) - - -def main(*args): - builders = [] - for version in OPENSSL_VERSIONS: - if version in ("0.9.8i", "0.9.8l"): - openssl_compile_args = ("no-asm",) - else: - openssl_compile_args = () - builder = BuildSSL(version, openssl_compile_args) - builder.install_openssl() - builders.append(builder) - - for builder in builders: - builder.run_python_tests(*args) - # final touch - builder.touch_pymods() - - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO, - format="*** %(levelname)s %(message)s") - args = sys.argv[1:] - if not args: - args = ["-unetwork", "-v"] - args.extend(FULL_TESTS) - main(*args) From webhook-mailer at python.org Thu Sep 7 13:12:25 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 17:12:25 -0000 Subject: [Python-checkins] [2.7] Update multissl test helper (GH-3349) (#3416) Message-ID: https://github.com/python/cpython/commit/8092719e932e2a8ab8009b6c0e735530812b7fb7 commit: 8092719e932e2a8ab8009b6c0e735530812b7fb7 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-07T10:12:22-07:00 summary: [2.7] Update multissl test helper (GH-3349) (#3416) Signed-off-by: Christian Heimes . (cherry picked from commit d3b9f97e6d92bbfcf956638344fd827a40837b96) files: A Tools/ssl/multissltests.py D Tools/ssl/test_multiple_versions.py M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 54e9480e215..d0bb4c1d0e8 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -898,6 +898,14 @@ memtest: @DEF_MAKE_RULE@ platform -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS) $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS) +# SSL tests +.PHONY: multisslcompile multissltest +multisslcompile: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py --compile-only + +multissltest: build_all + $(RUNSHARED) ./$(BUILDPYTHON) Tools/ssl/multissltests.py + # Install everything install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@ if test "x$(ENSUREPIP)" != "xno" ; then \ diff --git a/Tools/ssl/multissltests.py b/Tools/ssl/multissltests.py new file mode 100755 index 00000000000..994e420818e --- /dev/null +++ b/Tools/ssl/multissltests.py @@ -0,0 +1,430 @@ +#!./python +"""Run Python tests against multiple installations of OpenSSL and LibreSSL + +The script + + (1) downloads OpenSSL / LibreSSL tar bundle + (2) extracts it to ./src + (3) compiles OpenSSL / LibreSSL + (4) installs OpenSSL / LibreSSL into ../multissl/$LIB/$VERSION/ + (5) forces a recompilation of Python modules using the + header and library files from ../multissl/$LIB/$VERSION/ + (6) runs Python's test suite + +The script must be run with Python's build directory as current working +directory. + +The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend +search paths for header files and shared libraries. It's known to work on +Linux with GCC and clang. + +Please keep this script compatible with Python 2.7, and 3.4 to 3.7. + +(c) 2013-2017 Christian Heimes +""" +from __future__ import print_function + +import argparse +from datetime import datetime +import logging +import os +try: + from urllib.request import urlopen +except ImportError: + from urllib2 import urlopen +import subprocess +import shutil +import sys +import tarfile + + +log = logging.getLogger("multissl") + +OPENSSL_OLD_VERSIONS = [ + "0.9.8zc", + "0.9.8zh", + "1.0.1u", +] + +OPENSSL_RECENT_VERSIONS = [ + "1.0.2", + "1.0.2l", + "1.1.0f", +] + +LIBRESSL_OLD_VERSIONS = [ + "2.3.10", + "2.4.5", +] + +LIBRESSL_RECENT_VERSIONS = [ + "2.5.3", + "2.5.5", +] + +# store files in ../multissl +HERE = os.path.abspath(os.getcwd()) +MULTISSL_DIR = os.path.abspath(os.path.join(HERE, '..', 'multissl')) + +parser = argparse.ArgumentParser( + prog='multissl', + description=( + "Run CPython tests with multiple OpenSSL and LibreSSL " + "versions." + ) +) +parser.add_argument( + '--debug', + action='store_true', + help="Enable debug mode", +) +parser.add_argument( + '--disable-ancient', + action='store_true', + help="Don't test OpenSSL < 1.0.2 and LibreSSL < 2.5.3.", +) +parser.add_argument( + '--openssl', + nargs='+', + default=(), + help=( + "OpenSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(OPENSSL_RECENT_VERSIONS, OPENSSL_OLD_VERSIONS) +) +parser.add_argument( + '--libressl', + nargs='+', + default=(), + help=( + "LibreSSL versions, defaults to '{}' (ancient: '{}') if no " + "OpenSSL and LibreSSL versions are given." + ).format(LIBRESSL_RECENT_VERSIONS, LIBRESSL_OLD_VERSIONS) +) +parser.add_argument( + '--tests', + nargs='*', + default=(), + help="Python tests to run, defaults to all SSL related tests.", +) +parser.add_argument( + '--base-directory', + default=MULTISSL_DIR, + help="Base directory for OpenSSL / LibreSSL sources and builds." +) +parser.add_argument( + '--no-network', + action='store_false', + dest='network', + help="Disable network tests." +) +parser.add_argument( + '--compile-only', + action='store_true', + help="Don't run tests, only compile _ssl.c and _hashopenssl.c." +) + + +class AbstractBuilder(object): + library = None + url_template = None + src_template = None + build_template = None + + module_files = ("Modules/_ssl.c", + "Modules/_hashopenssl.c") + module_libs = ("_ssl", "_hashlib") + + def __init__(self, version, compile_args=(), + basedir=MULTISSL_DIR): + self.version = version + self.compile_args = compile_args + # installation directory + self.install_dir = os.path.join( + os.path.join(basedir, self.library.lower()), version + ) + # source file + self.src_dir = os.path.join(basedir, 'src') + self.src_file = os.path.join( + self.src_dir, self.src_template.format(version)) + # build directory (removed after install) + self.build_dir = os.path.join( + self.src_dir, self.build_template.format(version)) + + def __str__(self): + return "<{0.__class__.__name__} for {0.version}>".format(self) + + def __eq__(self, other): + if not isinstance(other, AbstractBuilder): + return NotImplemented + return ( + self.library == other.library + and self.version == other.version + ) + + def __hash__(self): + return hash((self.library, self.version)) + + @property + def openssl_cli(self): + """openssl CLI binary""" + return os.path.join(self.install_dir, "bin", "openssl") + + @property + def openssl_version(self): + """output of 'bin/openssl version'""" + cmd = [self.openssl_cli, "version"] + return self._subprocess_output(cmd) + + @property + def pyssl_version(self): + """Value of ssl.OPENSSL_VERSION""" + cmd = [ + sys.executable, + '-c', 'import ssl; print(ssl.OPENSSL_VERSION)' + ] + return self._subprocess_output(cmd) + + @property + def include_dir(self): + return os.path.join(self.install_dir, "include") + + @property + def lib_dir(self): + return os.path.join(self.install_dir, "lib") + + @property + def has_openssl(self): + return os.path.isfile(self.openssl_cli) + + @property + def has_src(self): + return os.path.isfile(self.src_file) + + def _subprocess_call(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + return subprocess.check_call(cmd, env=env, **kwargs) + + def _subprocess_output(self, cmd, env=None, **kwargs): + log.debug("Call '{}'".format(" ".join(cmd))) + if env is None: + env = os.environ.copy() + env["LD_LIBRARY_PATH"] = self.lib_dir + out = subprocess.check_output(cmd, env=env, **kwargs) + return out.strip().decode("utf-8") + + def _download_src(self): + """Download sources""" + src_dir = os.path.dirname(self.src_file) + if not os.path.isdir(src_dir): + os.makedirs(src_dir) + url = self.url_template.format(self.version) + log.info("Downloading from {}".format(url)) + req = urlopen(url) + # KISS, read all, write all + data = req.read() + log.info("Storing {}".format(self.src_file)) + with open(self.src_file, "wb") as f: + f.write(data) + + def _unpack_src(self): + """Unpack tar.gz bundle""" + # cleanup + if os.path.isdir(self.build_dir): + shutil.rmtree(self.build_dir) + os.makedirs(self.build_dir) + + tf = tarfile.open(self.src_file) + name = self.build_template.format(self.version) + base = name + '/' + # force extraction into build dir + members = tf.getmembers() + for member in list(members): + if member.name == name: + members.remove(member) + elif not member.name.startswith(base): + raise ValueError(member.name, base) + member.name = member.name[len(base):].lstrip('/') + log.info("Unpacking files to {}".format(self.build_dir)) + tf.extractall(self.build_dir, members) + + def _build_src(self): + """Now build openssl""" + log.info("Running build in {}".format(self.build_dir)) + cwd = self.build_dir + cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] + cmd.extend(self.compile_args) + self._subprocess_call(cmd, cwd=cwd) + # Old OpenSSL versions do not support parallel builds. + self._subprocess_call(["make", "-j1"], cwd=cwd) + + def _make_install(self, remove=True): + self._subprocess_call(["make", "-j1", "install"], cwd=self.build_dir) + if remove: + shutil.rmtree(self.build_dir) + + def install(self): + log.info(self.openssl_cli) + if not self.has_openssl: + if not self.has_src: + self._download_src() + else: + log.debug("Already has src {}".format(self.src_file)) + self._unpack_src() + self._build_src() + self._make_install() + else: + log.info("Already has installation {}".format(self.install_dir)) + # validate installation + version = self.openssl_version + if self.version not in version: + raise ValueError(version) + + def recompile_pymods(self): + log.warning("Using build from {}".format(self.build_dir)) + # force a rebuild of all modules that use OpenSSL APIs + for fname in self.module_files: + os.utime(fname, None) + # remove all build artefacts + for root, dirs, files in os.walk('build'): + for filename in files: + if filename.startswith(self.module_libs): + os.unlink(os.path.join(root, filename)) + + # overwrite header and library search paths + env = os.environ.copy() + env["CPPFLAGS"] = "-I{}".format(self.include_dir) + env["LDFLAGS"] = "-L{}".format(self.lib_dir) + # set rpath + env["LD_RUN_PATH"] = self.lib_dir + + log.info("Rebuilding Python modules") + cmd = [sys.executable, "setup.py", "build"] + self._subprocess_call(cmd, env=env) + self.check_imports() + + def check_imports(self): + cmd = [sys.executable, "-c", "import _ssl; import _hashlib"] + self._subprocess_call(cmd) + + def check_pyssl(self): + version = self.pyssl_version + if self.version not in version: + raise ValueError(version) + + def run_python_tests(self, tests, network=True): + if not tests: + cmd = [sys.executable, 'Lib/test/ssltests.py', '-j0'] + elif sys.version_info < (3, 3): + cmd = [sys.executable, '-m', 'test.regrtest'] + else: + cmd = [sys.executable, '-m', 'test', '-j0'] + if network: + cmd.extend(['-u', 'network', '-u', 'urlfetch']) + cmd.extend(['-w', '-r']) + cmd.extend(tests) + self._subprocess_call(cmd, stdout=None) + + +class BuildOpenSSL(AbstractBuilder): + library = "OpenSSL" + url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" + src_template = "openssl-{}.tar.gz" + build_template = "openssl-{}" + + +class BuildLibreSSL(AbstractBuilder): + library = "LibreSSL" + url_template = ( + "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-{}.tar.gz") + src_template = "libressl-{}.tar.gz" + build_template = "libressl-{}" + + +def configure_make(): + if not os.path.isfile('Makefile'): + log.info('Running ./configure') + subprocess.check_call([ + './configure', '--config-cache', '--quiet', + '--with-pydebug' + ]) + + log.info('Running make') + subprocess.check_call(['make', '--quiet']) + + +def main(): + args = parser.parse_args() + if not args.openssl and not args.libressl: + args.openssl = list(OPENSSL_RECENT_VERSIONS) + args.libressl = list(LIBRESSL_RECENT_VERSIONS) + if not args.disable_ancient: + args.openssl.extend(OPENSSL_OLD_VERSIONS) + args.libressl.extend(LIBRESSL_OLD_VERSIONS) + + logging.basicConfig( + level=logging.DEBUG if args.debug else logging.INFO, + format="*** %(levelname)s %(message)s" + ) + + start = datetime.now() + + for name in ['python', 'setup.py', 'Modules/_ssl.c']: + if not os.path.isfile(name): + parser.error( + "Must be executed from CPython build dir" + ) + if not os.path.samefile('python', sys.executable): + parser.error( + "Must be executed with ./python from CPython build dir" + ) + + # check for configure and run make + configure_make() + + # download and register builder + builds = [] + + for version in args.openssl: + build = BuildOpenSSL(version) + build.install() + builds.append(build) + + for version in args.libressl: + build = BuildLibreSSL(version) + build.install() + builds.append(build) + + for build in builds: + try: + build.recompile_pymods() + build.check_pyssl() + if not args.compile_only: + build.run_python_tests( + tests=args.tests, + network=args.network, + ) + except Exception as e: + log.exception("%s failed", build) + print("{} failed: {}".format(build, e), file=sys.stderr) + sys.exit(2) + + print("\n{} finished in {}".format( + "Tests" if not args.compile_only else "Builds", + datetime.now() - start + )) + print('Python: ', sys.version) + if args.compile_only: + print('Build only') + elif args.tests: + print('Executed Tests:', ' '.join(args.tests)) + else: + print('Executed all SSL tests.') + + print('OpenSSL / LibreSSL versions:') + for build in builds: + print(" * {0.library} {0.version}".format(build)) + + +if __name__ == "__main__": + main() diff --git a/Tools/ssl/test_multiple_versions.py b/Tools/ssl/test_multiple_versions.py deleted file mode 100644 index fc7a96783b6..00000000000 --- a/Tools/ssl/test_multiple_versions.py +++ /dev/null @@ -1,241 +0,0 @@ -#./python -"""Run Python tests with multiple installations of OpenSSL - -The script - - (1) downloads OpenSSL tar bundle - (2) extracts it to ../openssl/src/openssl-VERSION/ - (3) compiles OpenSSL - (4) installs OpenSSL into ../openssl/VERSION/ - (5) forces a recompilation of Python modules using the - header and library files from ../openssl/VERSION/ - (6) runs Python's test suite - -The script must be run with Python's build directory as current working -directory: - - ./python Tools/ssl/test_multiple_versions.py - -The script uses LD_RUN_PATH, LD_LIBRARY_PATH, CPPFLAGS and LDFLAGS to bend -search paths for header files and shared libraries. It's known to work on -Linux with GCC 4.x. - -(c) 2013 Christian Heimes -""" -import logging -import os -import tarfile -import shutil -import subprocess -import sys -from urllib import urlopen - -log = logging.getLogger("multissl") - -OPENSSL_VERSIONS = [ - "0.9.7m", "0.9.8i", "0.9.8l", "0.9.8m", "0.9.8y", "1.0.0k", "1.0.1e" -] -FULL_TESTS = [ - "test_asyncio", "test_ftplib", "test_hashlib", "test_httplib", - "test_imaplib", "test_nntplib", "test_poplib", "test_smtplib", - "test_smtpnet", "test_urllib2_localnet", "test_venv" -] -MINIMAL_TESTS = ["test_ssl", "test_hashlib"] -CADEFAULT = True -HERE = os.path.abspath(os.getcwd()) -DEST_DIR = os.path.abspath(os.path.join(HERE, os.pardir, "openssl")) - - -class BuildSSL(object): - url_template = "https://www.openssl.org/source/openssl-{}.tar.gz" - - module_files = ["Modules/_ssl.c", - "Modules/socketmodule.c", - "Modules/_hashopenssl.c"] - - def __init__(self, version, openssl_compile_args=(), destdir=DEST_DIR): - self._check_python_builddir() - self.version = version - self.openssl_compile_args = openssl_compile_args - # installation directory - self.install_dir = os.path.join(destdir, version) - # source file - self.src_file = os.path.join(destdir, "src", - "openssl-{}.tar.gz".format(version)) - # build directory (removed after install) - self.build_dir = os.path.join(destdir, "src", - "openssl-{}".format(version)) - - @property - def openssl_cli(self): - """openssl CLI binary""" - return os.path.join(self.install_dir, "bin", "openssl") - - @property - def openssl_version(self): - """output of 'bin/openssl version'""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = [self.openssl_cli, "version"] - return self._subprocess_output(cmd, env=env) - - @property - def pyssl_version(self): - """Value of ssl.OPENSSL_VERSION""" - env = os.environ.copy() - env["LD_LIBRARY_PATH"] = self.lib_dir - cmd = ["./python", "-c", "import ssl; print(ssl.OPENSSL_VERSION)"] - return self._subprocess_output(cmd, env=env) - - @property - def include_dir(self): - return os.path.join(self.install_dir, "include") - - @property - def lib_dir(self): - return os.path.join(self.install_dir, "lib") - - @property - def has_openssl(self): - return os.path.isfile(self.openssl_cli) - - @property - def has_src(self): - return os.path.isfile(self.src_file) - - def _subprocess_call(self, cmd, stdout=subprocess.DEVNULL, env=None, - **kwargs): - log.debug("Call '{}'".format(" ".join(cmd))) - return subprocess.check_call(cmd, stdout=stdout, env=env, **kwargs) - - def _subprocess_output(self, cmd, env=None, **kwargs): - log.debug("Call '{}'".format(" ".join(cmd))) - out = subprocess.check_output(cmd, env=env) - return out.strip().decode("utf-8") - - def _check_python_builddir(self): - if not os.path.isfile("python") or not os.path.isfile("setup.py"): - raise ValueError("Script must be run in Python build directory") - - def _download_openssl(self): - """Download OpenSSL source dist""" - src_dir = os.path.dirname(self.src_file) - if not os.path.isdir(src_dir): - os.makedirs(src_dir) - url = self.url_template.format(self.version) - log.info("Downloading OpenSSL from {}".format(url)) - req = urlopen(url, cadefault=CADEFAULT) - # KISS, read all, write all - data = req.read() - log.info("Storing {}".format(self.src_file)) - with open(self.src_file, "wb") as f: - f.write(data) - - def _unpack_openssl(self): - """Unpack tar.gz bundle""" - # cleanup - if os.path.isdir(self.build_dir): - shutil.rmtree(self.build_dir) - os.makedirs(self.build_dir) - - tf = tarfile.open(self.src_file) - base = "openssl-{}/".format(self.version) - # force extraction into build dir - members = tf.getmembers() - for member in members: - if not member.name.startswith(base): - raise ValueError(member.name) - member.name = member.name[len(base):] - log.info("Unpacking files to {}".format(self.build_dir)) - tf.extractall(self.build_dir, members) - - def _build_openssl(self): - """Now build openssl""" - log.info("Running build in {}".format(self.install_dir)) - cwd = self.build_dir - cmd = ["./config", "shared", "--prefix={}".format(self.install_dir)] - cmd.extend(self.openssl_compile_args) - self._subprocess_call(cmd, cwd=cwd) - self._subprocess_call(["make"], cwd=cwd) - - def _install_openssl(self, remove=True): - self._subprocess_call(["make", "install"], cwd=self.build_dir) - if remove: - shutil.rmtree(self.build_dir) - - def install_openssl(self): - if not self.has_openssl: - if not self.has_src: - self._download_openssl() - else: - log.debug("Already has src {}".format(self.src_file)) - self._unpack_openssl() - self._build_openssl() - self._install_openssl() - else: - log.info("Already has installation {}".format(self.install_dir)) - # validate installation - version = self.openssl_version - if self.version not in version: - raise ValueError(version) - - def touch_pymods(self): - # force a rebuild of all modules that use OpenSSL APIs - for fname in self.module_files: - os.utime(fname) - - def recompile_pymods(self): - log.info("Using OpenSSL build from {}".format(self.build_dir)) - # overwrite header and library search paths - env = os.environ.copy() - env["CPPFLAGS"] = "-I{}".format(self.include_dir) - env["LDFLAGS"] = "-L{}".format(self.lib_dir) - # set rpath - env["LD_RUN_PATH"] = self.lib_dir - - log.info("Rebuilding Python modules") - self.touch_pymods() - cmd = ["./python", "setup.py", "build"] - self._subprocess_call(cmd, env=env) - - def check_pyssl(self): - version = self.pyssl_version - if self.version not in version: - raise ValueError(version) - - def run_pytests(self, *args): - cmd = ["./python", "-m", "test"] - cmd.extend(args) - self._subprocess_call(cmd, stdout=None) - - def run_python_tests(self, *args): - self.recompile_pymods() - self.check_pyssl() - self.run_pytests(*args) - - -def main(*args): - builders = [] - for version in OPENSSL_VERSIONS: - if version in ("0.9.8i", "0.9.8l"): - openssl_compile_args = ("no-asm",) - else: - openssl_compile_args = () - builder = BuildSSL(version, openssl_compile_args) - builder.install_openssl() - builders.append(builder) - - for builder in builders: - builder.run_python_tests(*args) - # final touch - builder.touch_pymods() - - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO, - format="*** %(levelname)s %(message)s") - args = sys.argv[1:] - if not args: - args = ["-unetwork", "-v"] - args.extend(FULL_TESTS) - main(*args) From webhook-mailer at python.org Thu Sep 7 13:49:14 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 07 Sep 2017 17:49:14 -0000 Subject: [Python-checkins] remove current_filename optimization from marshal (#3423) (closes bpo-31384) Message-ID: https://github.com/python/cpython/commit/c988ae01fec2e0510d53728e01a5e4bb06761bda commit: c988ae01fec2e0510d53728e01a5e4bb06761bda branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-07T10:49:12-07:00 summary: remove current_filename optimization from marshal (#3423) (closes bpo-31384) files: M Python/marshal.c diff --git a/Python/marshal.c b/Python/marshal.c index b6337e1450f..7b583eef1a1 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -647,7 +647,6 @@ typedef struct { FILE *fp; int depth; PyObject *readable; /* Stream-like object being read from */ - PyObject *current_filename; char *ptr; char *end; char *buf; @@ -1390,18 +1389,6 @@ r_object(RFILE *p) filename = r_object(p); if (filename == NULL) goto code_error; - if (PyUnicode_CheckExact(filename)) { - if (p->current_filename != NULL) { - if (!PyUnicode_Compare(filename, p->current_filename)) { - Py_DECREF(filename); - Py_INCREF(p->current_filename); - filename = p->current_filename; - } - } - else { - p->current_filename = filename; - } - } name = r_object(p); if (name == NULL) goto code_error; @@ -1484,7 +1471,6 @@ PyMarshal_ReadShortFromFile(FILE *fp) assert(fp); rf.readable = NULL; rf.fp = fp; - rf.current_filename = NULL; rf.end = rf.ptr = NULL; rf.buf = NULL; res = r_short(&rf); @@ -1500,7 +1486,6 @@ PyMarshal_ReadLongFromFile(FILE *fp) long res; rf.fp = fp; rf.readable = NULL; - rf.current_filename = NULL; rf.ptr = rf.end = NULL; rf.buf = NULL; res = r_long(&rf); @@ -1562,7 +1547,6 @@ PyMarshal_ReadObjectFromFile(FILE *fp) PyObject *result; rf.fp = fp; rf.readable = NULL; - rf.current_filename = NULL; rf.depth = 0; rf.ptr = rf.end = NULL; rf.buf = NULL; @@ -1583,7 +1567,6 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len) PyObject *result; rf.fp = NULL; rf.readable = NULL; - rf.current_filename = NULL; rf.ptr = (char *)str; rf.end = (char *)str + len; rf.buf = NULL; @@ -1723,7 +1706,6 @@ marshal_load(PyObject *module, PyObject *file) rf.depth = 0; rf.fp = NULL; rf.readable = file; - rf.current_filename = NULL; rf.ptr = rf.end = NULL; rf.buf = NULL; if ((rf.refs = PyList_New(0)) != NULL) { @@ -1782,7 +1764,6 @@ marshal_loads_impl(PyObject *module, Py_buffer *bytes) PyObject* result; rf.fp = NULL; rf.readable = NULL; - rf.current_filename = NULL; rf.ptr = s; rf.end = s + n; rf.depth = 0; From webhook-mailer at python.org Thu Sep 7 14:14:02 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 07 Sep 2017 18:14:02 -0000 Subject: [Python-checkins] bpo-31373: fix undefined floating-point demotions (#3396) Message-ID: https://github.com/python/cpython/commit/a853a8ba7850381d49b284295dd6f0dc491dbe44 commit: a853a8ba7850381d49b284295dd6f0dc491dbe44 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-07T11:13:59-07:00 summary: bpo-31373: fix undefined floating-point demotions (#3396) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst M Include/pymath.h M Objects/floatobject.c M Python/getargs.c M Python/pytime.c diff --git a/Include/pymath.h b/Include/pymath.h index 7216a092d17..6cf69f98acf 100644 --- a/Include/pymath.h +++ b/Include/pymath.h @@ -187,14 +187,14 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under - * any exceptional condition, but does require +- HUGE_VAL return - * values on overflow. A 754 box *probably* maps HUGE_VAL to a - * double infinity, and we're cool if that's so, unless the input - * was an infinity and an infinity is the expected result. A C89 - * system sets errno to ERANGE, so we check for that too. We're - * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or - * if the returned result is a NaN, or if a C89 box returns HUGE_VAL - * in non-overflow cases. + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * @@ -211,8 +211,20 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ - (X) == Py_HUGE_VAL || \ - (X) == -Py_HUGE_VAL)) -#endif + (X) == Py_HUGE_VAL || \ + (X) == -Py_HUGE_VAL)) +#endif + +/* Return whether integral type *type* is signed or not. */ +#define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) +/* Return the maximum value of integral type *type*. */ +#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) +/* Return the minimum value of integral type *type*. */ +#define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) +/* Check whether *v* is in the range of integral type *type*. This is most + * useful if *v* is floating-point, since demoting a floating-point *v* to an + * integral type that cannot represent *v*'s integral part is undefined + * behavior. */ +#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) #endif /* Py_PYMATH_H */ diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst new file mode 100644 index 00000000000..3ffb4093470 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst @@ -0,0 +1,2 @@ +Fix several possible instances of undefined behavior due to floating-point +demotions. diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 8c4fe74d1b8..fc1ddf40816 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -2233,13 +2233,15 @@ _PyFloat_Pack4(double x, unsigned char *p, int le) } else { - float y = (float)x; - const unsigned char *s = (unsigned char*)&y; int i, incr = 1; - if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) + if (fabs(x) > FLT_MAX && !Py_IS_INFINITY(x)) goto Overflow; + unsigned char s[sizeof(float)]; + float y = (float)x; + memcpy(s, &y, sizeof(float)); + if ((float_format == ieee_little_endian_format && !le) || (float_format == ieee_big_endian_format && le)) { p += 3; @@ -2247,7 +2249,7 @@ _PyFloat_Pack4(double x, unsigned char *p, int le) } for (i = 0; i < 4; i++) { - *p = *s++; + *p = s[i]; p += incr; } return 0; diff --git a/Python/getargs.c b/Python/getargs.c index 4b969d924a9..0b155a170f9 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -4,6 +4,7 @@ #include "Python.h" #include +#include #ifdef __cplusplus @@ -858,6 +859,10 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, double dval = PyFloat_AsDouble(arg); if (PyErr_Occurred()) RETURN_ERR_OCCURRED; + else if (dval > FLT_MAX) + *p = (float)INFINITY; + else if (dval < -FLT_MAX) + *p = (float)-INFINITY; else *p = (float) dval; break; diff --git a/Python/pytime.c b/Python/pytime.c index 8979adc2191..f3c913226ce 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -97,7 +97,7 @@ static int _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator, double denominator, _PyTime_round_t round) { - double intpart, err; + double intpart; /* volatile avoids optimization changing how numbers are rounded */ volatile double floatpart; @@ -115,14 +115,13 @@ _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator, } assert(0.0 <= floatpart && floatpart < denominator); - *sec = (time_t)intpart; - *numerator = (long)floatpart; - - err = intpart - (double)*sec; - if (err <= -1.0 || err >= 1.0) { + if (!_Py_InIntegralTypeRange(time_t, intpart)) { error_time_t_overflow(); return -1; } + *sec = (time_t)intpart; + *numerator = (long)floatpart; + return 0; } @@ -150,7 +149,7 @@ int _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) { if (PyFloat_Check(obj)) { - double intpart, err; + double intpart; /* volatile avoids optimization changing how numbers are rounded */ volatile double d; @@ -158,12 +157,11 @@ _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) d = _PyTime_Round(d, round); (void)modf(d, &intpart); - *sec = (time_t)intpart; - err = intpart - (double)*sec; - if (err <= -1.0 || err >= 1.0) { + if (!_Py_InIntegralTypeRange(time_t, intpart)) { error_time_t_overflow(); return -1; } + *sec = (time_t)intpart; return 0; } else { @@ -180,7 +178,9 @@ _PyTime_ObjectToTimespec(PyObject *obj, time_t *sec, long *nsec, { int res; res = _PyTime_ObjectToDenominator(obj, sec, nsec, 1e9, round); - assert(0 <= *nsec && *nsec < SEC_TO_NS); + if (res == 0) { + assert(0 <= *nsec && *nsec < SEC_TO_NS); + } return res; } @@ -190,7 +190,9 @@ _PyTime_ObjectToTimeval(PyObject *obj, time_t *sec, long *usec, { int res; res = _PyTime_ObjectToDenominator(obj, sec, usec, 1e6, round); - assert(0 <= *usec && *usec < SEC_TO_US); + if (res == 0) { + assert(0 <= *usec && *usec < SEC_TO_US); + } return res; } @@ -276,7 +278,6 @@ static int _PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round, long unit_to_ns) { - double err; /* volatile avoids optimization changing how numbers are rounded */ volatile double d; @@ -285,12 +286,11 @@ _PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round, d *= (double)unit_to_ns; d = _PyTime_Round(d, round); - *t = (_PyTime_t)d; - err = d - (double)*t; - if (fabs(err) >= 1.0) { + if (!_Py_InIntegralTypeRange(_PyTime_t, d)) { _PyTime_overflow(); return -1; } + *t = (_PyTime_t)d; return 0; } From webhook-mailer at python.org Thu Sep 7 14:32:10 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 07 Sep 2017 18:32:10 -0000 Subject: [Python-checkins] [3.6] bpo-30096: Use ABC in abc reference examples (GH-1220) (GH-3408) Message-ID: https://github.com/python/cpython/commit/b0d0217c0e4c1512a06ef306928b2fd8f82d046e commit: b0d0217c0e4c1512a06ef306928b2fd8f82d046e branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-07T11:32:07-07:00 summary: [3.6] bpo-30096: Use ABC in abc reference examples (GH-1220) (GH-3408) Use base class rather than metaclass in examples. (cherry picked from commit 122e88a8354e3f75aeaf6211232dac88ac296d54) files: M Doc/library/abc.rst diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index 966003bd45a..6001db32df4 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -24,7 +24,33 @@ a class or instance provides a particular interface, for example, is it hashable or a mapping. -This module provides the following classes: +This module provides the metaclass :class:`ABCMeta` for defining ABCs and +a helper class :class:`ABC` to alternatively define ABCs through inheritance: + +.. class:: ABC + + A helper class that has :class:`ABCMeta` as its metaclass. With this class, + an abstract base class can be created by simply deriving from :class:`ABC` + avoiding sometimes confusing metaclass usage, for example:: + + from abc import ABC + + class MyABC(ABC): + pass + + Note that the type of :class:`ABC` is still :class:`ABCMeta`, therefore + inheriting from :class:`ABC` requires the usual precautions regarding + metaclass usage, as multiple inheritance may lead to metaclass conflicts. + One may also define an abstract base class by passing the metaclass + keyword and using :class:`ABCMeta` directly, for example:: + + from abc import ABCMeta + + class MyABC(metaclass=ABCMeta): + pass + + .. versionadded:: 3.4 + .. class:: ABCMeta @@ -46,15 +72,15 @@ This module provides the following classes: Register *subclass* as a "virtual subclass" of this ABC. For example:: - from abc import ABCMeta + from abc import ABC - class MyABC(metaclass=ABCMeta): - pass + class MyABC(ABC): + pass - MyABC.register(tuple) + MyABC.register(tuple) - assert issubclass(tuple, MyABC) - assert isinstance((), MyABC) + assert issubclass(tuple, MyABC) + assert isinstance((), MyABC) .. versionchanged:: 3.3 Returns the registered subclass, to allow usage as a class decorator. @@ -95,7 +121,7 @@ This module provides the following classes: def get_iterator(self): return iter(self) - class MyIterable(metaclass=ABCMeta): + class MyIterable(ABC): @abstractmethod def __iter__(self): @@ -132,17 +158,6 @@ This module provides the following classes: available as a method of ``Foo``, so it is provided separately. -.. class:: ABC - - A helper class that has :class:`ABCMeta` as its metaclass. With this class, - an abstract base class can be created by simply deriving from :class:`ABC`, - avoiding sometimes confusing metaclass usage. - - Note that the type of :class:`ABC` is still :class:`ABCMeta`, therefore - inheriting from :class:`ABC` requires the usual precautions regarding metaclass - usage, as multiple inheritance may lead to metaclass conflicts. - - .. versionadded:: 3.4 The :mod:`abc` module also provides the following decorators: @@ -168,7 +183,7 @@ The :mod:`abc` module also provides the following decorators: descriptors, it should be applied as the innermost decorator, as shown in the following usage examples:: - class C(metaclass=ABCMeta): + class C(ABC): @abstractmethod def my_abstract_method(self, ...): ... @@ -230,7 +245,7 @@ The :mod:`abc` module also provides the following decorators: is now correctly identified as abstract when applied to an abstract method:: - class C(metaclass=ABCMeta): + class C(ABC): @classmethod @abstractmethod def my_abstract_classmethod(cls, ...): @@ -251,7 +266,7 @@ The :mod:`abc` module also provides the following decorators: is now correctly identified as abstract when applied to an abstract method:: - class C(metaclass=ABCMeta): + class C(ABC): @staticmethod @abstractmethod def my_abstract_staticmethod(...): @@ -278,7 +293,7 @@ The :mod:`abc` module also provides the following decorators: is now correctly identified as abstract when applied to an abstract method:: - class C(metaclass=ABCMeta): + class C(ABC): @property @abstractmethod def my_abstract_property(self): @@ -288,7 +303,7 @@ The :mod:`abc` module also provides the following decorators: read-write abstract property by appropriately marking one or more of the underlying methods as abstract:: - class C(metaclass=ABCMeta): + class C(ABC): @property def x(self): ... From webhook-mailer at python.org Thu Sep 7 14:35:06 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 07 Sep 2017 18:35:06 -0000 Subject: [Python-checkins] [3.6] fixes bpo-31373: fix undefined floating-point demotions (GH-3396) (#3424) Message-ID: https://github.com/python/cpython/commit/b03623227ed1264e3cac4e6bb4878d96b91aa484 commit: b03623227ed1264e3cac4e6bb4878d96b91aa484 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Benjamin Peterson date: 2017-09-07T11:35:03-07:00 summary: [3.6] fixes bpo-31373: fix undefined floating-point demotions (GH-3396) (#3424) (cherry picked from commit a853a8ba7850381d49b284295dd6f0dc491dbe44) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst M Include/pymath.h M Objects/floatobject.c M Python/getargs.c M Python/pytime.c diff --git a/Include/pymath.h b/Include/pymath.h index 7216a092d17..6cf69f98acf 100644 --- a/Include/pymath.h +++ b/Include/pymath.h @@ -187,14 +187,14 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); * result. * Caution: * This isn't reliable. C99 no longer requires libm to set errno under - * any exceptional condition, but does require +- HUGE_VAL return - * values on overflow. A 754 box *probably* maps HUGE_VAL to a - * double infinity, and we're cool if that's so, unless the input - * was an infinity and an infinity is the expected result. A C89 - * system sets errno to ERANGE, so we check for that too. We're - * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or - * if the returned result is a NaN, or if a C89 box returns HUGE_VAL - * in non-overflow cases. + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. * X is evaluated more than once. * Some platforms have better way to spell this, so expect some #ifdef'ery. * @@ -211,8 +211,20 @@ PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); #define Py_OVERFLOWED(X) isinf(X) #else #define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ - (X) == Py_HUGE_VAL || \ - (X) == -Py_HUGE_VAL)) -#endif + (X) == Py_HUGE_VAL || \ + (X) == -Py_HUGE_VAL)) +#endif + +/* Return whether integral type *type* is signed or not. */ +#define _Py_IntegralTypeSigned(type) ((type)(-1) < 0) +/* Return the maximum value of integral type *type*. */ +#define _Py_IntegralTypeMax(type) ((_Py_IntegralTypeSigned(type)) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0) +/* Return the minimum value of integral type *type*. */ +#define _Py_IntegralTypeMin(type) ((_Py_IntegralTypeSigned(type)) ? -_Py_IntegralTypeMax(type) - 1 : 0) +/* Check whether *v* is in the range of integral type *type*. This is most + * useful if *v* is floating-point, since demoting a floating-point *v* to an + * integral type that cannot represent *v*'s integral part is undefined + * behavior. */ +#define _Py_InIntegralTypeRange(type, v) (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type)) #endif /* Py_PYMATH_H */ diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst new file mode 100644 index 00000000000..3ffb4093470 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst @@ -0,0 +1,2 @@ +Fix several possible instances of undefined behavior due to floating-point +demotions. diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 80bf71efd21..1803a683ba0 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -2182,13 +2182,15 @@ _PyFloat_Pack4(double x, unsigned char *p, int le) } else { - float y = (float)x; - const unsigned char *s = (unsigned char*)&y; int i, incr = 1; - if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) + if (fabs(x) > FLT_MAX && !Py_IS_INFINITY(x)) goto Overflow; + unsigned char s[sizeof(float)]; + float y = (float)x; + memcpy(s, &y, sizeof(float)); + if ((float_format == ieee_little_endian_format && !le) || (float_format == ieee_big_endian_format && le)) { p += 3; @@ -2196,7 +2198,7 @@ _PyFloat_Pack4(double x, unsigned char *p, int le) } for (i = 0; i < 4; i++) { - *p = *s++; + *p = s[i]; p += incr; } return 0; diff --git a/Python/getargs.c b/Python/getargs.c index 616c6eb1073..8fb19f34ecb 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -4,6 +4,7 @@ #include "Python.h" #include +#include #ifdef __cplusplus @@ -810,6 +811,10 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, double dval = PyFloat_AsDouble(arg); if (PyErr_Occurred()) RETURN_ERR_OCCURRED; + else if (dval > FLT_MAX) + *p = (float)INFINITY; + else if (dval < -FLT_MAX) + *p = (float)-INFINITY; else *p = (float) dval; break; diff --git a/Python/pytime.c b/Python/pytime.c index 3015a6be0b8..387657af2cf 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -97,7 +97,7 @@ static int _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator, double denominator, _PyTime_round_t round) { - double intpart, err; + double intpart; /* volatile avoids optimization changing how numbers are rounded */ volatile double floatpart; @@ -115,14 +115,13 @@ _PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator, } assert(0.0 <= floatpart && floatpart < denominator); - *sec = (time_t)intpart; - *numerator = (long)floatpart; - - err = intpart - (double)*sec; - if (err <= -1.0 || err >= 1.0) { + if (!_Py_InIntegralTypeRange(time_t, intpart)) { error_time_t_overflow(); return -1; } + *sec = (time_t)intpart; + *numerator = (long)floatpart; + return 0; } @@ -150,7 +149,7 @@ int _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) { if (PyFloat_Check(obj)) { - double intpart, err; + double intpart; /* volatile avoids optimization changing how numbers are rounded */ volatile double d; @@ -158,12 +157,11 @@ _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) d = _PyTime_Round(d, round); (void)modf(d, &intpart); - *sec = (time_t)intpart; - err = intpart - (double)*sec; - if (err <= -1.0 || err >= 1.0) { + if (!_Py_InIntegralTypeRange(time_t, intpart)) { error_time_t_overflow(); return -1; } + *sec = (time_t)intpart; return 0; } else { @@ -180,7 +178,9 @@ _PyTime_ObjectToTimespec(PyObject *obj, time_t *sec, long *nsec, { int res; res = _PyTime_ObjectToDenominator(obj, sec, nsec, 1e9, round); - assert(0 <= *nsec && *nsec < SEC_TO_NS); + if (res == 0) { + assert(0 <= *nsec && *nsec < SEC_TO_NS); + } return res; } @@ -190,7 +190,9 @@ _PyTime_ObjectToTimeval(PyObject *obj, time_t *sec, long *usec, { int res; res = _PyTime_ObjectToDenominator(obj, sec, usec, 1e6, round); - assert(0 <= *usec && *usec < SEC_TO_US); + if (res == 0) { + assert(0 <= *usec && *usec < SEC_TO_US); + } return res; } @@ -276,7 +278,6 @@ static int _PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round, long unit_to_ns) { - double err; /* volatile avoids optimization changing how numbers are rounded */ volatile double d; @@ -285,12 +286,11 @@ _PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round, d *= (double)unit_to_ns; d = _PyTime_Round(d, round); - *t = (_PyTime_t)d; - err = d - (double)*t; - if (fabs(err) >= 1.0) { + if (!_Py_InIntegralTypeRange(_PyTime_t, d)) { _PyTime_overflow(); return -1; } + *t = (_PyTime_t)d; return 0; } From webhook-mailer at python.org Thu Sep 7 14:43:50 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Thu, 07 Sep 2017 18:43:50 -0000 Subject: [Python-checkins] [2.7] bpo-29766: Fix configure/.ac to match LTO/enable-optimizations behavior. (#2705) Message-ID: https://github.com/python/cpython/commit/abea972d2881a1a04ec265f993bb9b56bbc7b224 commit: abea972d2881a1a04ec265f993bb9b56bbc7b224 branch: 2.7 author: Hanno Schlichting committer: Gregory P. Smith date: 2017-09-07T11:43:45-07:00 summary: [2.7] bpo-29766: Fix configure/.ac to match LTO/enable-optimizations behavior. (#2705) See also 1f29cefc87c4c2ee629367ebe97a287d8e0b3e29. The configure.ac change was omitted from the earlier change... files: M configure.ac diff --git a/configure.ac b/configure.ac index 344d9b03673..8a31cc87526 100644 --- a/configure.ac +++ b/configure.ac @@ -1383,7 +1383,6 @@ if test "$Py_OPT" = 'true' ; then # compile working code using it and both test_distutils and test_gdb are # broken when you do managed to get a toolchain that works with it. People # who want LTO need to use --with-lto themselves. - Py_LTO='true' DEF_MAKE_ALL_RULE="profile-opt" REQUIRE_PGO="yes" DEF_MAKE_RULE="build_all" From webhook-mailer at python.org Thu Sep 7 14:49:26 2017 From: webhook-mailer at python.org (Steve Dower) Date: Thu, 07 Sep 2017 18:49:26 -0000 Subject: [Python-checkins] bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler (#1632) Message-ID: https://github.com/python/cpython/commit/05f01d85257d0f3409c7335aaf0bf6a6da7eecb7 commit: 05f01d85257d0f3409c7335aaf0bf6a6da7eecb7 branch: master author: Steve Dower committer: GitHub date: 2017-09-07T11:49:23-07:00 summary: bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler (#1632) files: A Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst A PC/_findvs.cpp A PC/external/Externals.txt A PC/external/include/Setup.Configuration.h A PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib M Include/pyatomic.h M Lib/distutils/_msvccompiler.py M Lib/distutils/tests/test_msvccompiler.py M PC/config.c M PCbuild/_lzma.vcxproj M PCbuild/build.bat M PCbuild/pythoncore.vcxproj M PCbuild/pythoncore.vcxproj.filters diff --git a/Include/pyatomic.h b/Include/pyatomic.h index 4cbc529c0d1..bd516b8bb6c 100644 --- a/Include/pyatomic.h +++ b/Include/pyatomic.h @@ -285,20 +285,20 @@ typedef struct _Py_atomic_int { a uintptr_t it will do an unsigned compare and crash */ inline intptr_t _Py_atomic_load_64bit(volatile uintptr_t* value, int order) { - uintptr_t old; + __int64 old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; - } while(_InterlockedCompareExchange64_HLEAcquire(value, old, old) != old); + } while(_InterlockedCompareExchange64_HLEAcquire((volatile __int64*)value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; - } while(_InterlockedCompareExchange64_HLERelease(value, old, old) != old); + } while(_InterlockedCompareExchange64_HLERelease((volatile __int64*)value, old, old) != old); break; } case _Py_memory_order_relaxed: @@ -308,7 +308,7 @@ inline intptr_t _Py_atomic_load_64bit(volatile uintptr_t* value, int order) { { do { old = *value; - } while(_InterlockedCompareExchange64(value, old, old) != old); + } while(_InterlockedCompareExchange64((volatile __int64*)value, old, old) != old); break; } } @@ -320,20 +320,20 @@ inline intptr_t _Py_atomic_load_64bit(volatile uintptr_t* value, int order) { #endif inline int _Py_atomic_load_32bit(volatile int* value, int order) { - int old; + long old; switch (order) { case _Py_memory_order_acquire: { do { old = *value; - } while(_InterlockedCompareExchange_HLEAcquire(value, old, old) != old); + } while(_InterlockedCompareExchange_HLEAcquire((volatile long*)value, old, old) != old); break; } case _Py_memory_order_release: { do { old = *value; - } while(_InterlockedCompareExchange_HLERelease(value, old, old) != old); + } while(_InterlockedCompareExchange_HLERelease((volatile long*)value, old, old) != old); break; } case _Py_memory_order_relaxed: @@ -343,7 +343,7 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) { { do { old = *value; - } while(_InterlockedCompareExchange(value, old, old) != old); + } while(_InterlockedCompareExchange((volatile long*)value, old, old) != old); break; } } diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py index b120273fe9e..ef1356b97d6 100644 --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -17,6 +17,7 @@ import shutil import stat import subprocess +import winreg from distutils.errors import DistutilsExecError, DistutilsPlatformError, \ CompileError, LibError, LinkError @@ -24,10 +25,9 @@ from distutils import log from distutils.util import get_platform -import winreg from itertools import count -def _find_vcvarsall(plat_spec): +def _find_vc2015(): try: key = winreg.OpenKeyEx( winreg.HKEY_LOCAL_MACHINE, @@ -38,9 +38,9 @@ def _find_vcvarsall(plat_spec): log.debug("Visual C++ is not registered") return None, None + best_version = 0 + best_dir = None with key: - best_version = 0 - best_dir = None for i in count(): try: v, vc_dir, vt = winreg.EnumValue(key, i) @@ -53,25 +53,74 @@ def _find_vcvarsall(plat_spec): continue if version >= 14 and version > best_version: best_version, best_dir = version, vc_dir - if not best_version: - log.debug("No suitable Visual C++ version found") - return None, None + return best_version, best_dir + +def _find_vc2017(): + import _findvs + import threading + + best_version = 0, # tuple for full version comparisons + best_dir = None + + # We need to call findall() on its own thread because it will + # initialize COM. + all_packages = [] + def _getall(): + all_packages.extend(_findvs.findall()) + t = threading.Thread(target=_getall) + t.start() + t.join() + + for name, version_str, path, packages in all_packages: + if 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' in packages: + vc_dir = os.path.join(path, 'VC', 'Auxiliary', 'Build') + if not os.path.isdir(vc_dir): + continue + try: + version = tuple(int(i) for i in version_str.split('.')) + except (ValueError, TypeError): + continue + if version > best_version: + best_version, best_dir = version, vc_dir + try: + best_version = best_version[0] + except IndexError: + best_version = None + return best_version, best_dir - vcvarsall = os.path.join(best_dir, "vcvarsall.bat") - if not os.path.isfile(vcvarsall): - log.debug("%s cannot be found", vcvarsall) - return None, None +def _find_vcvarsall(plat_spec): + best_version, best_dir = _find_vc2017() + vcruntime = None + vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86' + if best_version: + vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**", + "Microsoft.VC141.CRT", "vcruntime140.dll") + try: + import glob + vcruntime = glob.glob(vcredist, recursive=True)[-1] + except (ImportError, OSError, LookupError): + vcruntime = None + + if not best_version: + best_version, best_dir = _find_vc2015() + if best_version: + vcruntime = os.path.join(best_dir, 'redist', vcruntime_plat, + "Microsoft.VC140.CRT", "vcruntime140.dll") + + if not best_version: + log.debug("No suitable Visual C++ version found") + return None, None + vcvarsall = os.path.join(best_dir, "vcvarsall.bat") + if not os.path.isfile(vcvarsall): + log.debug("%s cannot be found", vcvarsall) + return None, None + + if not vcruntime or not os.path.isfile(vcruntime): + log.debug("%s cannot be found", vcruntime) vcruntime = None - vcruntime_spec = _VCVARS_PLAT_TO_VCRUNTIME_REDIST.get(plat_spec) - if vcruntime_spec: - vcruntime = os.path.join(best_dir, - vcruntime_spec.format(best_version)) - if not os.path.isfile(vcruntime): - log.debug("%s cannot be found", vcruntime) - vcruntime = None - return vcvarsall, vcruntime + return vcvarsall, vcruntime def _get_vc_env(plat_spec): if os.getenv("DISTUTILS_USE_SDK"): @@ -130,14 +179,6 @@ def _find_exe(exe, paths=None): 'win-amd64' : 'x86_amd64', } -# A map keyed by get_platform() return values to the file under -# the VC install directory containing the vcruntime redistributable. -_VCVARS_PLAT_TO_VCRUNTIME_REDIST = { - 'x86' : 'redist\\x86\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', - 'amd64' : 'redist\\x64\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', - 'x86_amd64' : 'redist\\x64\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', -} - # A set containing the DLLs that are guaranteed to be available for # all micro versions of this Python version. Known extension # dependencies that are not in this set will be copied to the output diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py index 4dc24886c82..70a9c93a4e8 100644 --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -76,12 +76,12 @@ def test_vcruntime_skip_copy(self): compiler = _msvccompiler.MSVCCompiler() compiler.initialize() dll = compiler._vcruntime_redist - self.assertTrue(os.path.isfile(dll)) + self.assertTrue(os.path.isfile(dll), dll or "") compiler._copy_vcruntime(tempdir) self.assertFalse(os.path.isfile(os.path.join( - tempdir, os.path.basename(dll)))) + tempdir, os.path.basename(dll))), dll or "") def test_get_vc_env_unicode(self): import distutils._msvccompiler as _msvccompiler @@ -101,6 +101,30 @@ def test_get_vc_env_unicode(self): if old_distutils_use_sdk: os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_get_vc2017(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2017 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2017() + if version: + self.assertGreaterEqual(version, 15) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2017 is not installed") + + def test_get_vc2015(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2015 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2015() + if version: + self.assertGreaterEqual(version, 14) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2015 is not installed") + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) diff --git a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst new file mode 100644 index 00000000000..7c72e315142 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst @@ -0,0 +1 @@ +Adds detection of Visual Studio 2017 to distutils on Windows. diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp new file mode 100644 index 00000000000..6c660115963 --- /dev/null +++ b/PC/_findvs.cpp @@ -0,0 +1,255 @@ +// +// Helper library for location Visual Studio installations +// using the COM-based query API. +// +// Copyright (c) Microsoft Corporation +// Licensed to PSF under a contributor agreement +// + +// Version history +// 2017-05: Initial contribution (Steve Dower) + +#include +#include +#include "external\include\Setup.Configuration.h" +#pragma comment(lib, "ole32.lib") +#pragma comment(lib, "oleaut32.lib") +#pragma comment(lib, "version.lib") +#pragma comment(lib, "Microsoft.VisualStudio.Setup.Configuration.Native.lib") + +#include + +static PyObject *error_from_hr(HRESULT hr) +{ + if (FAILED(hr)) + PyErr_Format(PyExc_OSError, "Error %08x", hr); + assert(PyErr_Occurred()); + return nullptr; +} + +static PyObject *get_install_name(ISetupInstance2 *inst) +{ + HRESULT hr; + BSTR name; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetDisplayName(LOCALE_USER_DEFAULT, &name))) + goto error; + str = PyUnicode_FromWideChar(name, SysStringLen(name)); + SysFreeString(name); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_install_version(ISetupInstance *inst) +{ + HRESULT hr; + BSTR ver; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetInstallationVersion(&ver))) + goto error; + str = PyUnicode_FromWideChar(ver, SysStringLen(ver)); + SysFreeString(ver); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_install_path(ISetupInstance *inst) +{ + HRESULT hr; + BSTR path; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetInstallationPath(&path))) + goto error; + str = PyUnicode_FromWideChar(path, SysStringLen(path)); + SysFreeString(path); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_installed_packages(ISetupInstance2 *inst) +{ + HRESULT hr; + PyObject *res = nullptr; + LPSAFEARRAY sa_packages = nullptr; + LONG ub = 0; + IUnknown **packages = nullptr; + PyObject *str = nullptr; + + if (FAILED(hr = inst->GetPackages(&sa_packages)) || + FAILED(hr = SafeArrayAccessData(sa_packages, (void**)&packages)) || + FAILED(SafeArrayGetUBound(sa_packages, 1, &ub)) || + !(res = PyList_New(0))) + goto error; + + for (LONG i = 0; i < ub; ++i) { + ISetupPackageReference *package = nullptr; + BSTR id = nullptr; + PyObject *str = nullptr; + + if (FAILED(hr = packages[i]->QueryInterface(&package)) || + FAILED(hr = package->GetId(&id))) + goto iter_error; + + str = PyUnicode_FromWideChar(id, SysStringLen(id)); + SysFreeString(id); + + if (!str || PyList_Append(res, str) < 0) + goto iter_error; + + Py_CLEAR(str); + package->Release(); + continue; + + iter_error: + if (package) package->Release(); + Py_XDECREF(str); + + goto error; + } + + SafeArrayUnaccessData(sa_packages); + SafeArrayDestroy(sa_packages); + + return res; +error: + if (sa_packages && packages) SafeArrayUnaccessData(sa_packages); + if (sa_packages) SafeArrayDestroy(sa_packages); + Py_XDECREF(res); + + return error_from_hr(hr); +} + +static PyObject *find_all_instances() +{ + ISetupConfiguration *sc = nullptr; + ISetupConfiguration2 *sc2 = nullptr; + IEnumSetupInstances *enm = nullptr; + ISetupInstance *inst = nullptr; + ISetupInstance2 *inst2 = nullptr; + PyObject *res = nullptr; + ULONG fetched; + HRESULT hr; + + if (!(res = PyList_New(0))) + goto error; + + if (FAILED(hr = CoCreateInstance( + __uuidof(SetupConfiguration), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(ISetupConfiguration), + (LPVOID*)&sc + )) && hr != REGDB_E_CLASSNOTREG) + goto error; + + // If the class is not registered, there are no VS instances installed + if (hr == REGDB_E_CLASSNOTREG) + return res; + + if (FAILED(hr = sc->QueryInterface(&sc2)) || + FAILED(hr = sc2->EnumAllInstances(&enm))) + goto error; + + while (SUCCEEDED(enm->Next(1, &inst, &fetched)) && fetched) { + PyObject *name = nullptr; + PyObject *version = nullptr; + PyObject *path = nullptr; + PyObject *packages = nullptr; + + if (FAILED(hr = inst->QueryInterface(&inst2)) || + !(name = get_install_name(inst2)) || + !(version = get_install_version(inst)) || + !(path = get_install_path(inst)) || + !(packages = get_installed_packages(inst2)) || + PyList_Append(res, PyTuple_Pack(4, name, version, path, packages)) < 0) + goto iter_error; + + continue; + iter_error: + if (inst2) inst2->Release(); + Py_XDECREF(packages); + Py_XDECREF(path); + Py_XDECREF(version); + Py_XDECREF(name); + goto error; + } + + enm->Release(); + sc2->Release(); + sc->Release(); + return res; + +error: + if (enm) enm->Release(); + if (sc2) sc2->Release(); + if (sc) sc->Release(); + Py_XDECREF(res); + + return error_from_hr(hr); +} + +PyDoc_STRVAR(findvs_findall_doc, "findall()\ +\ +Finds all installed versions of Visual Studio.\ +\ +This function will initialize COM temporarily. To avoid impact on other parts\ +of your application, use a new thread to make this call."); + +static PyObject *findvs_findall(PyObject *self, PyObject *args, PyObject *kwargs) +{ + HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + if (hr == RPC_E_CHANGED_MODE) + hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) + return error_from_hr(hr); + PyObject *res = find_all_instances(); + CoUninitialize(); + return res; +} + +// List of functions to add to findvs in exec_findvs(). +static PyMethodDef findvs_functions[] = { + { "findall", (PyCFunction)findvs_findall, METH_VARARGS | METH_KEYWORDS, findvs_findall_doc }, + { NULL, NULL, 0, NULL } +}; + +// Initialize findvs. May be called multiple times, so avoid +// using static state. +static int exec_findvs(PyObject *module) +{ + PyModule_AddFunctions(module, findvs_functions); + + return 0; // success +} + +PyDoc_STRVAR(findvs_doc, "The _findvs helper module"); + +static PyModuleDef_Slot findvs_slots[] = { + { Py_mod_exec, exec_findvs }, + { 0, NULL } +}; + +static PyModuleDef findvs_def = { + PyModuleDef_HEAD_INIT, + "_findvs", + findvs_doc, + 0, // m_size + NULL, // m_methods + findvs_slots, + NULL, // m_traverse + NULL, // m_clear + NULL, // m_free +}; + +extern "C" { + PyMODINIT_FUNC PyInit__findvs(void) + { + return PyModuleDef_Init(&findvs_def); + } +} \ No newline at end of file diff --git a/PC/config.c b/PC/config.c index f14e06886e2..699e1d07077 100644 --- a/PC/config.c +++ b/PC/config.c @@ -1,7 +1,7 @@ /* Module configuration */ /* This file contains the table of built-in modules. - See create_builtin() in import.c. */ + See create_builtin() in import.c. */ #include "Python.h" @@ -69,6 +69,7 @@ extern PyObject* _PyWarnings_Init(void); extern PyObject* PyInit__string(void); extern PyObject* PyInit__stat(void); extern PyObject* PyInit__opcode(void); +extern PyObject* PyInit__findvs(void); /* tools/freeze/makeconfig.py marker for additional "extern" */ /* -- ADDMODULE MARKER 1 -- */ @@ -161,6 +162,8 @@ struct _inittab _PyImport_Inittab[] = { {"_stat", PyInit__stat}, {"_opcode", PyInit__opcode}, + {"_findvs", PyInit__findvs}, + /* Sentinel */ {0, 0} }; diff --git a/PC/external/Externals.txt b/PC/external/Externals.txt new file mode 100644 index 00000000000..618fe16fd4c --- /dev/null +++ b/PC/external/Externals.txt @@ -0,0 +1,3 @@ +The files in this folder are from the Microsoft.VisualStudio.Setup.Configuration.Native package on Nuget. + +They are licensed under the MIT license. diff --git a/PC/external/include/Setup.Configuration.h b/PC/external/include/Setup.Configuration.h new file mode 100644 index 00000000000..1fb31878d7a --- /dev/null +++ b/PC/external/include/Setup.Configuration.h @@ -0,0 +1,827 @@ +// The MIT License(MIT) +// Copyright(C) Microsoft Corporation.All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// + +#pragma once + +// Constants +// +#ifndef E_NOTFOUND +#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND) +#endif + +#ifndef E_FILENOTFOUND +#define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) +#endif + +#ifndef E_NOTSUPPORTED +#define E_NOTSUPPORTED HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) +#endif + +// Enumerations +// +///

+/// The state of an instance. +/// +enum InstanceState +{ + /// + /// The instance state has not been determined. + /// + eNone = 0, + + /// + /// The instance installation path exists. + /// + eLocal = 1, + + /// + /// A product is registered to the instance. + /// + eRegistered = 2, + + /// + /// No reboot is required for the instance. + /// + eNoRebootRequired = 4, + + /// + /// No errors were reported for the instance. + /// + eNoErrors = 8, + + /// + /// The instance represents a complete install. + /// + eComplete = MAXUINT, +}; + +// Forward interface declarations +// +#ifndef __ISetupInstance_FWD_DEFINED__ +#define __ISetupInstance_FWD_DEFINED__ +typedef struct ISetupInstance ISetupInstance; +#endif + +#ifndef __ISetupInstance2_FWD_DEFINED__ +#define __ISetupInstance2_FWD_DEFINED__ +typedef struct ISetupInstance2 ISetupInstance2; +#endif + +#ifndef __ISetupLocalizedProperties_FWD_DEFINED__ +#define __ISetupLocalizedProperties_FWD_DEFINED__ +typedef struct ISetupLocalizedProperties ISetupLocalizedProperties; +#endif + +#ifndef __IEnumSetupInstances_FWD_DEFINED__ +#define __IEnumSetupInstances_FWD_DEFINED__ +typedef struct IEnumSetupInstances IEnumSetupInstances; +#endif + +#ifndef __ISetupConfiguration_FWD_DEFINED__ +#define __ISetupConfiguration_FWD_DEFINED__ +typedef struct ISetupConfiguration ISetupConfiguration; +#endif + +#ifndef __ISetupConfiguration2_FWD_DEFINED__ +#define __ISetupConfiguration2_FWD_DEFINED__ +typedef struct ISetupConfiguration2 ISetupConfiguration2; +#endif + +#ifndef __ISetupPackageReference_FWD_DEFINED__ +#define __ISetupPackageReference_FWD_DEFINED__ +typedef struct ISetupPackageReference ISetupPackageReference; +#endif + +#ifndef __ISetupHelper_FWD_DEFINED__ +#define __ISetupHelper_FWD_DEFINED__ +typedef struct ISetupHelper ISetupHelper; +#endif + +#ifndef __ISetupErrorState_FWD_DEFINED__ +#define __ISetupErrorState_FWD_DEFINED__ +typedef struct ISetupErrorState ISetupErrorState; +#endif + +#ifndef __ISetupErrorState2_FWD_DEFINED__ +#define __ISetupErrorState2_FWD_DEFINED__ +typedef struct ISetupErrorState2 ISetupErrorState2; +#endif + +#ifndef __ISetupFailedPackageReference_FWD_DEFINED__ +#define __ISetupFailedPackageReference_FWD_DEFINED__ +typedef struct ISetupFailedPackageReference ISetupFailedPackageReference; +#endif + +#ifndef __ISetupFailedPackageReference2_FWD_DEFINED__ +#define __ISetupFailedPackageReference2_FWD_DEFINED__ +typedef struct ISetupFailedPackageReference2 ISetupFailedPackageReference2; +#endif + +#ifndef __ISetupPropertyStore_FWD_DEFINED__ +#define __ISetupPropertyStore_FWD_DEFINED__ +typedef struct ISetupPropertyStore ISetupPropertyStore; +#endif + +#ifndef __ISetupLocalizedPropertyStore_FWD_DEFINED__ +#define __ISetupLocalizedPropertyStore_FWD_DEFINED__ +typedef struct ISetupLocalizedPropertyStore ISetupLocalizedPropertyStore; +#endif + +// Forward class declarations +// +#ifndef __SetupConfiguration_FWD_DEFINED__ +#define __SetupConfiguration_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SetupConfiguration SetupConfiguration; +#endif + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Interface definitions +// +EXTERN_C const IID IID_ISetupInstance; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about an instance of a product. +/// +struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown +{ + /// + /// Gets the instance identifier (should match the name of the parent instance directory). + /// + /// The instance identifier. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetInstanceId)( + _Out_ BSTR* pbstrInstanceId + ) = 0; + + /// + /// Gets the local date and time when the installation was originally installed. + /// + /// The local date and time when the installation was originally installed. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallDate)( + _Out_ LPFILETIME pInstallDate + ) = 0; + + /// + /// Gets the unique name of the installation, often indicating the branch and other information used for telemetry. + /// + /// The unique name of the installation, often indicating the branch and other information used for telemetry. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationName)( + _Out_ BSTR* pbstrInstallationName + ) = 0; + + /// + /// Gets the path to the installation root of the product. + /// + /// The path to the installation root of the product. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationPath)( + _Out_ BSTR* pbstrInstallationPath + ) = 0; + + /// + /// Gets the version of the product installed in this instance. + /// + /// The version of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationVersion)( + _Out_ BSTR* pbstrInstallationVersion + ) = 0; + + /// + /// Gets the display name (title) of the product installed in this instance. + /// + /// The LCID for the display name. + /// The display name (title) of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetDisplayName)( + _In_ LCID lcid, + _Out_ BSTR* pbstrDisplayName + ) = 0; + + /// + /// Gets the description of the product installed in this instance. + /// + /// The LCID for the description. + /// The description of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetDescription)( + _In_ LCID lcid, + _Out_ BSTR* pbstrDescription + ) = 0; + + /// + /// Resolves the optional relative path to the root path of the instance. + /// + /// A relative path within the instance to resolve, or NULL to get the root path. + /// The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(ResolvePath)( + _In_opt_z_ LPCOLESTR pwszRelativePath, + _Out_ BSTR* pbstrAbsolutePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupInstance2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about an instance of a product. +/// +struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance +{ + /// + /// Gets the state of the instance. + /// + /// The state of the instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetState)( + _Out_ InstanceState* pState + ) = 0; + + /// + /// Gets an array of package references registered to the instance. + /// + /// Pointer to an array of . + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined. + STDMETHOD(GetPackages)( + _Out_ LPSAFEARRAY* ppsaPackages + ) = 0; + + /// + /// Gets a pointer to the that represents the registered product. + /// + /// Pointer to an instance of . This may be NULL if does not return . + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined. + STDMETHOD(GetProduct)( + _Outptr_result_maybenull_ ISetupPackageReference** ppPackage + ) = 0; + + /// + /// Gets the relative path to the product application, if available. + /// + /// The relative path to the product application, if available. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetProductPath)( + _Outptr_result_maybenull_ BSTR* pbstrProductPath + ) = 0; + + /// + /// Gets the error state of the instance, if available. + /// + /// The error state of the instance, if available. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetErrors)( + _Outptr_result_maybenull_ ISetupErrorState** ppErrorState + ) = 0; + + /// + /// Gets a value indicating whether the instance can be launched. + /// + /// Whether the instance can be launched. + /// Standard HRESULT indicating success or failure. + /// + /// An instance could have had errors during install but still be launched. Some features may not work correctly, but others will. + /// + STDMETHOD(IsLaunchable)( + _Out_ VARIANT_BOOL* pfIsLaunchable + ) = 0; + + /// + /// Gets a value indicating whether the instance is complete. + /// + /// Whether the instance is complete. + /// Standard HRESULT indicating success or failure. + /// + /// An instance is complete if it had no errors during install, resume, or repair. + /// + STDMETHOD(IsComplete)( + _Out_ VARIANT_BOOL* pfIsComplete + ) = 0; + + /// + /// Gets product-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no properties are defined. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetProperties)( + _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties + ) = 0; + + /// + /// Gets the directory path to the setup engine that installed the instance. + /// + /// The directory path to the setup engine that installed the instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetEnginePath)( + _Outptr_result_maybenull_ BSTR* pbstrEnginePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupLocalizedProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides localized properties of an instance of a product. +/// +struct DECLSPEC_UUID("F4BD7382-FE27-4AB4-B974-9905B2A148B0") DECLSPEC_NOVTABLE ISetupLocalizedProperties : public IUnknown +{ + /// + /// Gets localized product-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no properties are defined. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLocalizedProperties)( + _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedProperties + ) = 0; + + /// + /// Gets localized channel-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no channel properties are defined. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLocalizedChannelProperties)( + _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedChannelProperties + ) = 0; +}; +#endif + +EXTERN_C const IID IID_IEnumSetupInstances; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// An enumerator of installed objects. +/// +struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown +{ + /// + /// Retrieves the next set of product instances in the enumeration sequence. + /// + /// The number of product instances to retrieve. + /// A pointer to an array of . + /// A pointer to the number of product instances retrieved. If is 1 this parameter may be NULL. + /// S_OK if the number of elements were fetched, S_FALSE if nothing was fetched (at end of enumeration), E_INVALIDARG if is greater than 1 and pceltFetched is NULL, or E_OUTOFMEMORY if an could not be allocated. + STDMETHOD(Next)( + _In_ ULONG celt, + _Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt, + _Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched + ) = 0; + + /// + /// Skips the next set of product instances in the enumeration sequence. + /// + /// The number of product instances to skip. + /// S_OK if the number of elements could be skipped; otherwise, S_FALSE; + STDMETHOD(Skip)( + _In_ ULONG celt + ) = 0; + + /// + /// Resets the enumeration sequence to the beginning. + /// + /// Always returns S_OK; + STDMETHOD(Reset)(void) = 0; + + /// + /// Creates a new enumeration object in the same state as the current enumeration object: the new object points to the same place in the enumeration sequence. + /// + /// A pointer to a pointer to a new interface. If the method fails, this parameter is undefined. + /// S_OK if a clone was returned; otherwise, E_OUTOFMEMORY. + STDMETHOD(Clone)( + _Deref_out_opt_ IEnumSetupInstances** ppenum + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Gets information about product instances installed on the machine. +/// +struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown +{ + /// + /// Enumerates all launchable product instances installed. + /// + /// An enumeration of completed, installed product instances. + /// Standard HRESULT indicating success or failure. + STDMETHOD(EnumInstances)( + _Out_ IEnumSetupInstances** ppEnumInstances + ) = 0; + + /// + /// Gets the instance for the current process path. + /// + /// The instance for the current process path. + /// + /// The instance for the current process path, or E_NOTFOUND if not found. + /// The may indicate the instance is invalid. + /// + /// + /// The returned instance may not be launchable. + /// +STDMETHOD(GetInstanceForCurrentProcess)( + _Out_ ISetupInstance** ppInstance + ) = 0; + + /// + /// Gets the instance for the given path. + /// + /// The instance for the given path. + /// + /// The instance for the given path, or E_NOTFOUND if not found. + /// The may indicate the instance is invalid. + /// + /// + /// The returned instance may not be launchable. + /// +STDMETHOD(GetInstanceForPath)( + _In_z_ LPCWSTR wzPath, + _Out_ ISetupInstance** ppInstance + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupConfiguration2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Gets information about product instances. +/// +struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration +{ + /// + /// Enumerates all product instances. + /// + /// An enumeration of all product instances. + /// Standard HRESULT indicating success or failure. + STDMETHOD(EnumAllInstances)( + _Out_ IEnumSetupInstances** ppEnumInstances + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupPackageReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a package. +/// +struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown +{ + /// + /// Gets the general package identifier. + /// + /// The general package identifier. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetId)( + _Out_ BSTR* pbstrId + ) = 0; + + /// + /// Gets the version of the package. + /// + /// The version of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetVersion)( + _Out_ BSTR* pbstrVersion + ) = 0; + + /// + /// Gets the target process architecture of the package. + /// + /// The target process architecture of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetChip)( + _Out_ BSTR* pbstrChip + ) = 0; + + /// + /// Gets the language and optional region identifier. + /// + /// The language and optional region identifier. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLanguage)( + _Out_ BSTR* pbstrLanguage + ) = 0; + + /// + /// Gets the build branch of the package. + /// + /// The build branch of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetBranch)( + _Out_ BSTR* pbstrBranch + ) = 0; + + /// + /// Gets the type of the package. + /// + /// The type of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetType)( + _Out_ BSTR* pbstrType + ) = 0; + + /// + /// Gets the unique identifier consisting of all defined tokens. + /// + /// The unique identifier consisting of all defined tokens. + /// Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required). + STDMETHOD(GetUniqueId)( + _Out_ BSTR* pbstrUniqueId + ) = 0; + + /// + /// Gets a value indicating whether the package refers to an external extension. + /// + /// A value indicating whether the package refers to an external extension. + /// Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required). + STDMETHOD(GetIsExtension)( + _Out_ VARIANT_BOOL* pfIsExtension + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupHelper; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Helper functions. +/// +/// +/// You can query for this interface from the class. +/// +struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown +{ + /// + /// Parses a dotted quad version string into a 64-bit unsigned integer. + /// + /// The dotted quad version string to parse, e.g. 1.2.3.4. + /// A 64-bit unsigned integer representing the version. You can compare this to other versions. + /// Standard HRESULT indicating success or failure, including E_INVALIDARG if the version is not valid. + STDMETHOD(ParseVersion)( + _In_ LPCOLESTR pwszVersion, + _Out_ PULONGLONG pullVersion + ) = 0; + + /// + /// Parses a dotted quad version string into a 64-bit unsigned integer. + /// + /// The string containing 1 or 2 dotted quad version strings to parse, e.g. [1.0,) that means 1.0.0.0 or newer. + /// A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions. + /// A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions. + /// Standard HRESULT indicating success or failure, including E_INVALIDARG if the version range is not valid. + STDMETHOD(ParseVersionRange)( + _In_ LPCOLESTR pwszVersionRange, + _Out_ PULONGLONG pullMinVersion, + _Out_ PULONGLONG pullMaxVersion + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupErrorState; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about the error state of an instance. +/// +struct DECLSPEC_UUID("46DCCD94-A287-476A-851E-DFBC2FFDBC20") DECLSPEC_NOVTABLE ISetupErrorState : public IUnknown +{ + /// + /// Gets an array of failed package references. + /// + /// Pointer to an array of , if packages have failed. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetFailedPackages)( + _Outptr_result_maybenull_ LPSAFEARRAY* ppsaFailedPackages + ) = 0; + + /// + /// Gets an array of skipped package references. + /// + /// Pointer to an array of , if packages have been skipped. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetSkippedPackages)( + _Outptr_result_maybenull_ LPSAFEARRAY* ppsaSkippedPackages + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupErrorState2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about the error state of an instance. +/// +struct DECLSPEC_UUID("9871385B-CA69-48F2-BC1F-7A37CBF0B1EF") DECLSPEC_NOVTABLE ISetupErrorState2 : public ISetupErrorState +{ + /// + /// Gets the path to the error log. + /// + /// The path to the error log. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetErrorLogFilePath)( + _Outptr_result_maybenull_ BSTR* pbstrErrorLogFilePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupFailedPackageReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a failed package. +/// +struct DECLSPEC_UUID("E73559CD-7003-4022-B134-27DC650B280F") DECLSPEC_NOVTABLE ISetupFailedPackageReference : public ISetupPackageReference +{ +}; + +#endif + +EXTERN_C const IID IID_ISetupFailedPackageReference2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a failed package. +/// +struct DECLSPEC_UUID("0FAD873E-E874-42E3-B268-4FE2F096B9CA") DECLSPEC_NOVTABLE ISetupFailedPackageReference2 : public ISetupFailedPackageReference +{ + /// + /// Gets the path to the optional package log. + /// + /// The path to the optional package log. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLogFilePath)( + _Outptr_result_maybenull_ BSTR* pbstrLogFilePath + ) = 0; + + /// + /// Gets the description of the package failure. + /// + /// The description of the package failure. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetDescription)( + _Outptr_result_maybenull_ BSTR* pbstrDescription + ) = 0; + + /// + /// Gets the signature to use for feedback reporting. + /// + /// The signature to use for feedback reporting. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetSignature)( + _Outptr_result_maybenull_ BSTR* pbstrSignature + ) = 0; + + /// + /// Gets the array of details for this package failure. + /// + /// Pointer to an array of details as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetDetails)( + _Out_ LPSAFEARRAY* ppsaDetails + ) = 0; + + /// + /// Gets an array of packages affected by this package failure. + /// + /// Pointer to an array of for packages affected by this package failure. This may be NULL. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetAffectedPackages)( + _Out_ LPSAFEARRAY* ppsaAffectedPackages + ) = 0; +}; + +#endif + +EXTERN_C const IID IID_ISetupPropertyStore; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides named properties. +/// +/// +/// You can get this from an , , or derivative. +/// +struct DECLSPEC_UUID("C601C175-A3BE-44BC-91F6-4568D230FC83") DECLSPEC_NOVTABLE ISetupPropertyStore : public IUnknown +{ + /// + /// Gets an array of property names in this property store. + /// + /// Pointer to an array of property names as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetNames)( + _Out_ LPSAFEARRAY* ppsaNames + ) = 0; + + /// + /// Gets the value of a named property in this property store. + /// + /// The name of the property to get. + /// The value of the property. + /// Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported. + STDMETHOD(GetValue)( + _In_ LPCOLESTR pwszName, + _Out_ LPVARIANT pvtValue + ) = 0; +}; + +#endif + +EXTERN_C const IID IID_ISetupLocalizedPropertyStore; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides localized named properties. +/// +/// +/// You can get this from an . +/// +struct DECLSPEC_UUID("5BB53126-E0D5-43DF-80F1-6B161E5C6F6C") DECLSPEC_NOVTABLE ISetupLocalizedPropertyStore : public IUnknown +{ + /// + /// Gets an array of property names in this property store. + /// + /// The LCID for the property names. + /// Pointer to an array of property names as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetNames)( + _In_ LCID lcid, + _Out_ LPSAFEARRAY* ppsaNames + ) = 0; + + /// + /// Gets the value of a named property in this property store. + /// + /// The name of the property to get. + /// The LCID for the property. + /// The value of the property. + /// Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported. + STDMETHOD(GetValue)( + _In_ LPCOLESTR pwszName, + _In_ LCID lcid, + _Out_ LPVARIANT pvtValue + ) = 0; +}; + +#endif + +// Class declarations +// +EXTERN_C const CLSID CLSID_SetupConfiguration; + +#ifdef __cplusplus +/// +/// This class implements , , and . +/// +class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration; +#endif + +// Function declarations +// +/// +/// Gets an that provides information about product instances installed on the machine. +/// +/// The that provides information about product instances installed on the machine. +/// Reserved for future use. +/// Standard HRESULT indicating success or failure. +STDMETHODIMP GetSetupConfiguration( + _Out_ ISetupConfiguration** ppConfiguration, + _Reserved_ LPVOID pReserved +); + +#ifdef __cplusplus +} +#endif diff --git a/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..675a501d8cb Binary files /dev/null and b/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..40f70b2682d Binary files /dev/null and b/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..675a501d8cb Binary files /dev/null and b/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..40f70b2682d Binary files /dev/null and b/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj index 7ec26920107..d8b159e6a1d 100644 --- a/PCbuild/_lzma.vcxproj +++ b/PCbuild/_lzma.vcxproj @@ -65,7 +65,7 @@ WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - $(OutDir)/liblzma$(PyDebugExt).lib + $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 99d9eadc28f..d4aebf55513 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -84,7 +84,7 @@ if "%~1"=="-E" (set IncludeExternals=false) & shift & goto CheckOpts if "%~1"=="--no-ssl" (set IncludeSSL=false) & shift & goto CheckOpts if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts -if "%IncludeExternals%"=="" set IncludeExternals=false +if "%IncludeExternals%"=="" set IncludeExternals=true if "%IncludeSSL%"=="" set IncludeSSL=true if "%IncludeTkinter%"=="" set IncludeTkinter=true diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index b0d2e9be8a4..59910951b62 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -50,6 +50,8 @@ true true + true + false @@ -73,6 +75,7 @@ version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName) 0x1e000000 @@ -218,6 +221,7 @@ + @@ -341,6 +345,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index cbe1a3943ff..115ce85edec 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -321,39 +321,6 @@ Modules\_io - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - Modules\cjkcodecs @@ -444,11 +411,41 @@ Include + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + - - Modules - Modules @@ -614,39 +611,6 @@ Modules\_io - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - Modules\cjkcodecs @@ -1001,10 +965,49 @@ Objects + + PC + + + Modules + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + Resource Files - + \ No newline at end of file From webhook-mailer at python.org Thu Sep 7 16:06:50 2017 From: webhook-mailer at python.org (R. David Murray) Date: Thu, 07 Sep 2017 20:06:50 -0000 Subject: [Python-checkins] bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (#3272) Message-ID: https://github.com/python/cpython/commit/397c467c49385023de36411194d381ac993bae1a commit: 397c467c49385023de36411194d381ac993bae1a branch: master author: Elena Oat committer: R. David Murray date: 2017-09-07T16:06:45-04:00 summary: bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (#3272) Also provide a solution if the user wants to keep multiple blank lines. files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index ab4bc92e5bd..c425be6d481 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -426,7 +426,9 @@ should not be line-wrapped:: -h, --help show this help message and exit :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text, -including argument descriptions. +including argument descriptions. However, multiple new lines are replaced with +one. If you wish to preserve multiple blank lines, add spaces between the +newlines. :class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages:: From webhook-mailer at python.org Thu Sep 7 16:53:15 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 20:53:15 -0000 Subject: [Python-checkins] bpo-31294: Fix ZeroMQSocketListener and ZeroMQSocketHandler examples (#3229) Message-ID: https://github.com/python/cpython/commit/586c0502b5eb9a39cabe0bc2707a8ff63114265c commit: 586c0502b5eb9a39cabe0bc2707a8ff63114265c branch: master author: Pablo Galindo committer: Christian Heimes date: 2017-09-07T13:53:13-07:00 summary: bpo-31294: Fix ZeroMQSocketListener and ZeroMQSocketHandler examples (#3229) * Fix ZeroMQSocketListener and ZeroMQSocketHandler examples * Use send_json and recv_json to simplify pyzmq interfacing * Add News entry files: A Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst M Doc/howto/logging-cookbook.rst M Misc/ACKS diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index 24cf76b8ba4..71ee417f2bc 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1258,8 +1258,8 @@ socket is created separately and passed to the handler (as its 'queue'):: class ZeroMQSocketHandler(QueueHandler): def enqueue(self, record): - data = json.dumps(record.__dict__) - self.queue.send(data) + self.queue.send_json(record.__dict__) + handler = ZeroMQSocketHandler(sock) @@ -1272,11 +1272,10 @@ data needed by the handler to create the socket:: self.ctx = ctx or zmq.Context() socket = zmq.Socket(self.ctx, socktype) socket.bind(uri) - QueueHandler.__init__(self, socket) + super().__init__(socket) def enqueue(self, record): - data = json.dumps(record.__dict__) - self.queue.send(data) + self.queue.send_json(record.__dict__) def close(self): self.queue.close() @@ -1292,12 +1291,13 @@ of queues, for example a ZeroMQ 'subscribe' socket. Here's an example:: def __init__(self, uri, *handlers, **kwargs): self.ctx = kwargs.get('ctx') or zmq.Context() socket = zmq.Socket(self.ctx, zmq.SUB) - socket.setsockopt(zmq.SUBSCRIBE, '') # subscribe to everything + socket.setsockopt_string(zmq.SUBSCRIBE, '') # subscribe to everything socket.connect(uri) + super().__init__(socket, *handlers, **kwargs) def dequeue(self): - msg = self.queue.recv() - return logging.makeLogRecord(json.loads(msg)) + msg = self.queue.recv_json() + return logging.makeLogRecord(msg) .. seealso:: diff --git a/Misc/ACKS b/Misc/ACKS index eadc5d34c40..462a74eb056 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1561,6 +1561,7 @@ Martin Teichmann Gustavo Temple Mikhail Terekhov Victor Terr?n +Pablo Galindo Richard M. Tew Tobias Thelen Christian Theune diff --git a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst new file mode 100644 index 00000000000..2c8f8507697 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst @@ -0,0 +1,2 @@ +Fix incomplete code snippet in the ZeroMQSocketListener and +ZeroMQSocketHandler examples and adapt them to Python 3. From webhook-mailer at python.org Thu Sep 7 17:31:12 2017 From: webhook-mailer at python.org (Steve Dower) Date: Thu, 07 Sep 2017 21:31:12 -0000 Subject: [Python-checkins] [3.6] bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler GH-1632 (#3425) Message-ID: https://github.com/python/cpython/commit/76006f285a7e146484d9296597d1d0ace778f992 commit: 76006f285a7e146484d9296597d1d0ace778f992 branch: 3.6 author: Steve Dower committer: GitHub date: 2017-09-07T13:58:07-07:00 summary: [3.6] bpo-30389 Adds detection of VS 2017 to distutils._msvccompiler GH-1632 (#3425) files: A Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst A PC/_findvs.cpp A PC/external/Externals.txt A PC/external/include/Setup.Configuration.h A PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib A PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib M Lib/distutils/_msvccompiler.py M Lib/distutils/tests/test_msvccompiler.py M PC/config.c M PCbuild/_lzma.vcxproj M PCbuild/build.bat M PCbuild/pythoncore.vcxproj diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py index b120273fe9e..ef1356b97d6 100644 --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -17,6 +17,7 @@ import shutil import stat import subprocess +import winreg from distutils.errors import DistutilsExecError, DistutilsPlatformError, \ CompileError, LibError, LinkError @@ -24,10 +25,9 @@ from distutils import log from distutils.util import get_platform -import winreg from itertools import count -def _find_vcvarsall(plat_spec): +def _find_vc2015(): try: key = winreg.OpenKeyEx( winreg.HKEY_LOCAL_MACHINE, @@ -38,9 +38,9 @@ def _find_vcvarsall(plat_spec): log.debug("Visual C++ is not registered") return None, None + best_version = 0 + best_dir = None with key: - best_version = 0 - best_dir = None for i in count(): try: v, vc_dir, vt = winreg.EnumValue(key, i) @@ -53,25 +53,74 @@ def _find_vcvarsall(plat_spec): continue if version >= 14 and version > best_version: best_version, best_dir = version, vc_dir - if not best_version: - log.debug("No suitable Visual C++ version found") - return None, None + return best_version, best_dir + +def _find_vc2017(): + import _findvs + import threading + + best_version = 0, # tuple for full version comparisons + best_dir = None + + # We need to call findall() on its own thread because it will + # initialize COM. + all_packages = [] + def _getall(): + all_packages.extend(_findvs.findall()) + t = threading.Thread(target=_getall) + t.start() + t.join() + + for name, version_str, path, packages in all_packages: + if 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' in packages: + vc_dir = os.path.join(path, 'VC', 'Auxiliary', 'Build') + if not os.path.isdir(vc_dir): + continue + try: + version = tuple(int(i) for i in version_str.split('.')) + except (ValueError, TypeError): + continue + if version > best_version: + best_version, best_dir = version, vc_dir + try: + best_version = best_version[0] + except IndexError: + best_version = None + return best_version, best_dir - vcvarsall = os.path.join(best_dir, "vcvarsall.bat") - if not os.path.isfile(vcvarsall): - log.debug("%s cannot be found", vcvarsall) - return None, None +def _find_vcvarsall(plat_spec): + best_version, best_dir = _find_vc2017() + vcruntime = None + vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86' + if best_version: + vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**", + "Microsoft.VC141.CRT", "vcruntime140.dll") + try: + import glob + vcruntime = glob.glob(vcredist, recursive=True)[-1] + except (ImportError, OSError, LookupError): + vcruntime = None + + if not best_version: + best_version, best_dir = _find_vc2015() + if best_version: + vcruntime = os.path.join(best_dir, 'redist', vcruntime_plat, + "Microsoft.VC140.CRT", "vcruntime140.dll") + + if not best_version: + log.debug("No suitable Visual C++ version found") + return None, None + vcvarsall = os.path.join(best_dir, "vcvarsall.bat") + if not os.path.isfile(vcvarsall): + log.debug("%s cannot be found", vcvarsall) + return None, None + + if not vcruntime or not os.path.isfile(vcruntime): + log.debug("%s cannot be found", vcruntime) vcruntime = None - vcruntime_spec = _VCVARS_PLAT_TO_VCRUNTIME_REDIST.get(plat_spec) - if vcruntime_spec: - vcruntime = os.path.join(best_dir, - vcruntime_spec.format(best_version)) - if not os.path.isfile(vcruntime): - log.debug("%s cannot be found", vcruntime) - vcruntime = None - return vcvarsall, vcruntime + return vcvarsall, vcruntime def _get_vc_env(plat_spec): if os.getenv("DISTUTILS_USE_SDK"): @@ -130,14 +179,6 @@ def _find_exe(exe, paths=None): 'win-amd64' : 'x86_amd64', } -# A map keyed by get_platform() return values to the file under -# the VC install directory containing the vcruntime redistributable. -_VCVARS_PLAT_TO_VCRUNTIME_REDIST = { - 'x86' : 'redist\\x86\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', - 'amd64' : 'redist\\x64\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', - 'x86_amd64' : 'redist\\x64\\Microsoft.VC{0}0.CRT\\vcruntime{0}0.dll', -} - # A set containing the DLLs that are guaranteed to be available for # all micro versions of this Python version. Known extension # dependencies that are not in this set will be copied to the output diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py index 4dc24886c82..70a9c93a4e8 100644 --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -76,12 +76,12 @@ def test_vcruntime_skip_copy(self): compiler = _msvccompiler.MSVCCompiler() compiler.initialize() dll = compiler._vcruntime_redist - self.assertTrue(os.path.isfile(dll)) + self.assertTrue(os.path.isfile(dll), dll or "") compiler._copy_vcruntime(tempdir) self.assertFalse(os.path.isfile(os.path.join( - tempdir, os.path.basename(dll)))) + tempdir, os.path.basename(dll))), dll or "") def test_get_vc_env_unicode(self): import distutils._msvccompiler as _msvccompiler @@ -101,6 +101,30 @@ def test_get_vc_env_unicode(self): if old_distutils_use_sdk: os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_get_vc2017(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2017 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2017() + if version: + self.assertGreaterEqual(version, 15) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2017 is not installed") + + def test_get_vc2015(self): + import distutils._msvccompiler as _msvccompiler + + # This function cannot be mocked, so pass it if we find VS 2015 + # and mark it skipped if we do not. + version, path = _msvccompiler._find_vc2015() + if version: + self.assertGreaterEqual(version, 14) + self.assertTrue(os.path.isdir(path)) + else: + raise unittest.SkipTest("VS 2015 is not installed") + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) diff --git a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst new file mode 100644 index 00000000000..7c72e315142 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst @@ -0,0 +1 @@ +Adds detection of Visual Studio 2017 to distutils on Windows. diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp new file mode 100644 index 00000000000..6c660115963 --- /dev/null +++ b/PC/_findvs.cpp @@ -0,0 +1,255 @@ +// +// Helper library for location Visual Studio installations +// using the COM-based query API. +// +// Copyright (c) Microsoft Corporation +// Licensed to PSF under a contributor agreement +// + +// Version history +// 2017-05: Initial contribution (Steve Dower) + +#include +#include +#include "external\include\Setup.Configuration.h" +#pragma comment(lib, "ole32.lib") +#pragma comment(lib, "oleaut32.lib") +#pragma comment(lib, "version.lib") +#pragma comment(lib, "Microsoft.VisualStudio.Setup.Configuration.Native.lib") + +#include + +static PyObject *error_from_hr(HRESULT hr) +{ + if (FAILED(hr)) + PyErr_Format(PyExc_OSError, "Error %08x", hr); + assert(PyErr_Occurred()); + return nullptr; +} + +static PyObject *get_install_name(ISetupInstance2 *inst) +{ + HRESULT hr; + BSTR name; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetDisplayName(LOCALE_USER_DEFAULT, &name))) + goto error; + str = PyUnicode_FromWideChar(name, SysStringLen(name)); + SysFreeString(name); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_install_version(ISetupInstance *inst) +{ + HRESULT hr; + BSTR ver; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetInstallationVersion(&ver))) + goto error; + str = PyUnicode_FromWideChar(ver, SysStringLen(ver)); + SysFreeString(ver); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_install_path(ISetupInstance *inst) +{ + HRESULT hr; + BSTR path; + PyObject *str = nullptr; + if (FAILED(hr = inst->GetInstallationPath(&path))) + goto error; + str = PyUnicode_FromWideChar(path, SysStringLen(path)); + SysFreeString(path); + return str; +error: + + return error_from_hr(hr); +} + +static PyObject *get_installed_packages(ISetupInstance2 *inst) +{ + HRESULT hr; + PyObject *res = nullptr; + LPSAFEARRAY sa_packages = nullptr; + LONG ub = 0; + IUnknown **packages = nullptr; + PyObject *str = nullptr; + + if (FAILED(hr = inst->GetPackages(&sa_packages)) || + FAILED(hr = SafeArrayAccessData(sa_packages, (void**)&packages)) || + FAILED(SafeArrayGetUBound(sa_packages, 1, &ub)) || + !(res = PyList_New(0))) + goto error; + + for (LONG i = 0; i < ub; ++i) { + ISetupPackageReference *package = nullptr; + BSTR id = nullptr; + PyObject *str = nullptr; + + if (FAILED(hr = packages[i]->QueryInterface(&package)) || + FAILED(hr = package->GetId(&id))) + goto iter_error; + + str = PyUnicode_FromWideChar(id, SysStringLen(id)); + SysFreeString(id); + + if (!str || PyList_Append(res, str) < 0) + goto iter_error; + + Py_CLEAR(str); + package->Release(); + continue; + + iter_error: + if (package) package->Release(); + Py_XDECREF(str); + + goto error; + } + + SafeArrayUnaccessData(sa_packages); + SafeArrayDestroy(sa_packages); + + return res; +error: + if (sa_packages && packages) SafeArrayUnaccessData(sa_packages); + if (sa_packages) SafeArrayDestroy(sa_packages); + Py_XDECREF(res); + + return error_from_hr(hr); +} + +static PyObject *find_all_instances() +{ + ISetupConfiguration *sc = nullptr; + ISetupConfiguration2 *sc2 = nullptr; + IEnumSetupInstances *enm = nullptr; + ISetupInstance *inst = nullptr; + ISetupInstance2 *inst2 = nullptr; + PyObject *res = nullptr; + ULONG fetched; + HRESULT hr; + + if (!(res = PyList_New(0))) + goto error; + + if (FAILED(hr = CoCreateInstance( + __uuidof(SetupConfiguration), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(ISetupConfiguration), + (LPVOID*)&sc + )) && hr != REGDB_E_CLASSNOTREG) + goto error; + + // If the class is not registered, there are no VS instances installed + if (hr == REGDB_E_CLASSNOTREG) + return res; + + if (FAILED(hr = sc->QueryInterface(&sc2)) || + FAILED(hr = sc2->EnumAllInstances(&enm))) + goto error; + + while (SUCCEEDED(enm->Next(1, &inst, &fetched)) && fetched) { + PyObject *name = nullptr; + PyObject *version = nullptr; + PyObject *path = nullptr; + PyObject *packages = nullptr; + + if (FAILED(hr = inst->QueryInterface(&inst2)) || + !(name = get_install_name(inst2)) || + !(version = get_install_version(inst)) || + !(path = get_install_path(inst)) || + !(packages = get_installed_packages(inst2)) || + PyList_Append(res, PyTuple_Pack(4, name, version, path, packages)) < 0) + goto iter_error; + + continue; + iter_error: + if (inst2) inst2->Release(); + Py_XDECREF(packages); + Py_XDECREF(path); + Py_XDECREF(version); + Py_XDECREF(name); + goto error; + } + + enm->Release(); + sc2->Release(); + sc->Release(); + return res; + +error: + if (enm) enm->Release(); + if (sc2) sc2->Release(); + if (sc) sc->Release(); + Py_XDECREF(res); + + return error_from_hr(hr); +} + +PyDoc_STRVAR(findvs_findall_doc, "findall()\ +\ +Finds all installed versions of Visual Studio.\ +\ +This function will initialize COM temporarily. To avoid impact on other parts\ +of your application, use a new thread to make this call."); + +static PyObject *findvs_findall(PyObject *self, PyObject *args, PyObject *kwargs) +{ + HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + if (hr == RPC_E_CHANGED_MODE) + hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) + return error_from_hr(hr); + PyObject *res = find_all_instances(); + CoUninitialize(); + return res; +} + +// List of functions to add to findvs in exec_findvs(). +static PyMethodDef findvs_functions[] = { + { "findall", (PyCFunction)findvs_findall, METH_VARARGS | METH_KEYWORDS, findvs_findall_doc }, + { NULL, NULL, 0, NULL } +}; + +// Initialize findvs. May be called multiple times, so avoid +// using static state. +static int exec_findvs(PyObject *module) +{ + PyModule_AddFunctions(module, findvs_functions); + + return 0; // success +} + +PyDoc_STRVAR(findvs_doc, "The _findvs helper module"); + +static PyModuleDef_Slot findvs_slots[] = { + { Py_mod_exec, exec_findvs }, + { 0, NULL } +}; + +static PyModuleDef findvs_def = { + PyModuleDef_HEAD_INIT, + "_findvs", + findvs_doc, + 0, // m_size + NULL, // m_methods + findvs_slots, + NULL, // m_traverse + NULL, // m_clear + NULL, // m_free +}; + +extern "C" { + PyMODINIT_FUNC PyInit__findvs(void) + { + return PyModuleDef_Init(&findvs_def); + } +} \ No newline at end of file diff --git a/PC/config.c b/PC/config.c index 43d9e208cca..f631d73268f 100644 --- a/PC/config.c +++ b/PC/config.c @@ -1,7 +1,7 @@ /* Module configuration */ /* This file contains the table of built-in modules. - See create_builtin() in import.c. */ + See create_builtin() in import.c. */ #include "Python.h" @@ -69,6 +69,7 @@ extern PyObject* _PyWarnings_Init(void); extern PyObject* PyInit__string(void); extern PyObject* PyInit__stat(void); extern PyObject* PyInit__opcode(void); +extern PyObject* PyInit__findvs(void); /* tools/freeze/makeconfig.py marker for additional "extern" */ /* -- ADDMODULE MARKER 1 -- */ @@ -165,6 +166,8 @@ struct _inittab _PyImport_Inittab[] = { {"_stat", PyInit__stat}, {"_opcode", PyInit__opcode}, + {"_findvs", PyInit__findvs}, + /* Sentinel */ {0, 0} }; diff --git a/PC/external/Externals.txt b/PC/external/Externals.txt new file mode 100644 index 00000000000..618fe16fd4c --- /dev/null +++ b/PC/external/Externals.txt @@ -0,0 +1,3 @@ +The files in this folder are from the Microsoft.VisualStudio.Setup.Configuration.Native package on Nuget. + +They are licensed under the MIT license. diff --git a/PC/external/include/Setup.Configuration.h b/PC/external/include/Setup.Configuration.h new file mode 100644 index 00000000000..1fb31878d7a --- /dev/null +++ b/PC/external/include/Setup.Configuration.h @@ -0,0 +1,827 @@ +// The MIT License(MIT) +// Copyright(C) Microsoft Corporation.All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// + +#pragma once + +// Constants +// +#ifndef E_NOTFOUND +#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND) +#endif + +#ifndef E_FILENOTFOUND +#define E_FILENOTFOUND HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) +#endif + +#ifndef E_NOTSUPPORTED +#define E_NOTSUPPORTED HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) +#endif + +// Enumerations +// +/// +/// The state of an instance. +/// +enum InstanceState +{ + /// + /// The instance state has not been determined. + /// + eNone = 0, + + /// + /// The instance installation path exists. + /// + eLocal = 1, + + /// + /// A product is registered to the instance. + /// + eRegistered = 2, + + /// + /// No reboot is required for the instance. + /// + eNoRebootRequired = 4, + + /// + /// No errors were reported for the instance. + /// + eNoErrors = 8, + + /// + /// The instance represents a complete install. + /// + eComplete = MAXUINT, +}; + +// Forward interface declarations +// +#ifndef __ISetupInstance_FWD_DEFINED__ +#define __ISetupInstance_FWD_DEFINED__ +typedef struct ISetupInstance ISetupInstance; +#endif + +#ifndef __ISetupInstance2_FWD_DEFINED__ +#define __ISetupInstance2_FWD_DEFINED__ +typedef struct ISetupInstance2 ISetupInstance2; +#endif + +#ifndef __ISetupLocalizedProperties_FWD_DEFINED__ +#define __ISetupLocalizedProperties_FWD_DEFINED__ +typedef struct ISetupLocalizedProperties ISetupLocalizedProperties; +#endif + +#ifndef __IEnumSetupInstances_FWD_DEFINED__ +#define __IEnumSetupInstances_FWD_DEFINED__ +typedef struct IEnumSetupInstances IEnumSetupInstances; +#endif + +#ifndef __ISetupConfiguration_FWD_DEFINED__ +#define __ISetupConfiguration_FWD_DEFINED__ +typedef struct ISetupConfiguration ISetupConfiguration; +#endif + +#ifndef __ISetupConfiguration2_FWD_DEFINED__ +#define __ISetupConfiguration2_FWD_DEFINED__ +typedef struct ISetupConfiguration2 ISetupConfiguration2; +#endif + +#ifndef __ISetupPackageReference_FWD_DEFINED__ +#define __ISetupPackageReference_FWD_DEFINED__ +typedef struct ISetupPackageReference ISetupPackageReference; +#endif + +#ifndef __ISetupHelper_FWD_DEFINED__ +#define __ISetupHelper_FWD_DEFINED__ +typedef struct ISetupHelper ISetupHelper; +#endif + +#ifndef __ISetupErrorState_FWD_DEFINED__ +#define __ISetupErrorState_FWD_DEFINED__ +typedef struct ISetupErrorState ISetupErrorState; +#endif + +#ifndef __ISetupErrorState2_FWD_DEFINED__ +#define __ISetupErrorState2_FWD_DEFINED__ +typedef struct ISetupErrorState2 ISetupErrorState2; +#endif + +#ifndef __ISetupFailedPackageReference_FWD_DEFINED__ +#define __ISetupFailedPackageReference_FWD_DEFINED__ +typedef struct ISetupFailedPackageReference ISetupFailedPackageReference; +#endif + +#ifndef __ISetupFailedPackageReference2_FWD_DEFINED__ +#define __ISetupFailedPackageReference2_FWD_DEFINED__ +typedef struct ISetupFailedPackageReference2 ISetupFailedPackageReference2; +#endif + +#ifndef __ISetupPropertyStore_FWD_DEFINED__ +#define __ISetupPropertyStore_FWD_DEFINED__ +typedef struct ISetupPropertyStore ISetupPropertyStore; +#endif + +#ifndef __ISetupLocalizedPropertyStore_FWD_DEFINED__ +#define __ISetupLocalizedPropertyStore_FWD_DEFINED__ +typedef struct ISetupLocalizedPropertyStore ISetupLocalizedPropertyStore; +#endif + +// Forward class declarations +// +#ifndef __SetupConfiguration_FWD_DEFINED__ +#define __SetupConfiguration_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SetupConfiguration SetupConfiguration; +#endif + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// Interface definitions +// +EXTERN_C const IID IID_ISetupInstance; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about an instance of a product. +/// +struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown +{ + /// + /// Gets the instance identifier (should match the name of the parent instance directory). + /// + /// The instance identifier. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetInstanceId)( + _Out_ BSTR* pbstrInstanceId + ) = 0; + + /// + /// Gets the local date and time when the installation was originally installed. + /// + /// The local date and time when the installation was originally installed. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallDate)( + _Out_ LPFILETIME pInstallDate + ) = 0; + + /// + /// Gets the unique name of the installation, often indicating the branch and other information used for telemetry. + /// + /// The unique name of the installation, often indicating the branch and other information used for telemetry. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationName)( + _Out_ BSTR* pbstrInstallationName + ) = 0; + + /// + /// Gets the path to the installation root of the product. + /// + /// The path to the installation root of the product. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationPath)( + _Out_ BSTR* pbstrInstallationPath + ) = 0; + + /// + /// Gets the version of the product installed in this instance. + /// + /// The version of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetInstallationVersion)( + _Out_ BSTR* pbstrInstallationVersion + ) = 0; + + /// + /// Gets the display name (title) of the product installed in this instance. + /// + /// The LCID for the display name. + /// The display name (title) of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetDisplayName)( + _In_ LCID lcid, + _Out_ BSTR* pbstrDisplayName + ) = 0; + + /// + /// Gets the description of the product installed in this instance. + /// + /// The LCID for the description. + /// The description of the product installed in this instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(GetDescription)( + _In_ LCID lcid, + _Out_ BSTR* pbstrDescription + ) = 0; + + /// + /// Resolves the optional relative path to the root path of the instance. + /// + /// A relative path within the instance to resolve, or NULL to get the root path. + /// The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the property is not defined. + STDMETHOD(ResolvePath)( + _In_opt_z_ LPCOLESTR pwszRelativePath, + _Out_ BSTR* pbstrAbsolutePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupInstance2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about an instance of a product. +/// +struct DECLSPEC_UUID("89143C9A-05AF-49B0-B717-72E218A2185C") DECLSPEC_NOVTABLE ISetupInstance2 : public ISetupInstance +{ + /// + /// Gets the state of the instance. + /// + /// The state of the instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetState)( + _Out_ InstanceState* pState + ) = 0; + + /// + /// Gets an array of package references registered to the instance. + /// + /// Pointer to an array of . + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined. + STDMETHOD(GetPackages)( + _Out_ LPSAFEARRAY* ppsaPackages + ) = 0; + + /// + /// Gets a pointer to the that represents the registered product. + /// + /// Pointer to an instance of . This may be NULL if does not return . + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist and E_NOTFOUND if the packages property is not defined. + STDMETHOD(GetProduct)( + _Outptr_result_maybenull_ ISetupPackageReference** ppPackage + ) = 0; + + /// + /// Gets the relative path to the product application, if available. + /// + /// The relative path to the product application, if available. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetProductPath)( + _Outptr_result_maybenull_ BSTR* pbstrProductPath + ) = 0; + + /// + /// Gets the error state of the instance, if available. + /// + /// The error state of the instance, if available. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetErrors)( + _Outptr_result_maybenull_ ISetupErrorState** ppErrorState + ) = 0; + + /// + /// Gets a value indicating whether the instance can be launched. + /// + /// Whether the instance can be launched. + /// Standard HRESULT indicating success or failure. + /// + /// An instance could have had errors during install but still be launched. Some features may not work correctly, but others will. + /// + STDMETHOD(IsLaunchable)( + _Out_ VARIANT_BOOL* pfIsLaunchable + ) = 0; + + /// + /// Gets a value indicating whether the instance is complete. + /// + /// Whether the instance is complete. + /// Standard HRESULT indicating success or failure. + /// + /// An instance is complete if it had no errors during install, resume, or repair. + /// + STDMETHOD(IsComplete)( + _Out_ VARIANT_BOOL* pfIsComplete + ) = 0; + + /// + /// Gets product-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no properties are defined. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetProperties)( + _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties + ) = 0; + + /// + /// Gets the directory path to the setup engine that installed the instance. + /// + /// The directory path to the setup engine that installed the instance. + /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. + STDMETHOD(GetEnginePath)( + _Outptr_result_maybenull_ BSTR* pbstrEnginePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupLocalizedProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides localized properties of an instance of a product. +/// +struct DECLSPEC_UUID("F4BD7382-FE27-4AB4-B974-9905B2A148B0") DECLSPEC_NOVTABLE ISetupLocalizedProperties : public IUnknown +{ + /// + /// Gets localized product-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no properties are defined. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLocalizedProperties)( + _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedProperties + ) = 0; + + /// + /// Gets localized channel-specific properties. + /// + /// A pointer to an instance of . This may be NULL if no channel properties are defined. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLocalizedChannelProperties)( + _Outptr_result_maybenull_ ISetupLocalizedPropertyStore** ppLocalizedChannelProperties + ) = 0; +}; +#endif + +EXTERN_C const IID IID_IEnumSetupInstances; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// An enumerator of installed objects. +/// +struct DECLSPEC_UUID("6380BCFF-41D3-4B2E-8B2E-BF8A6810C848") DECLSPEC_NOVTABLE IEnumSetupInstances : public IUnknown +{ + /// + /// Retrieves the next set of product instances in the enumeration sequence. + /// + /// The number of product instances to retrieve. + /// A pointer to an array of . + /// A pointer to the number of product instances retrieved. If is 1 this parameter may be NULL. + /// S_OK if the number of elements were fetched, S_FALSE if nothing was fetched (at end of enumeration), E_INVALIDARG if is greater than 1 and pceltFetched is NULL, or E_OUTOFMEMORY if an could not be allocated. + STDMETHOD(Next)( + _In_ ULONG celt, + _Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt, + _Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched + ) = 0; + + /// + /// Skips the next set of product instances in the enumeration sequence. + /// + /// The number of product instances to skip. + /// S_OK if the number of elements could be skipped; otherwise, S_FALSE; + STDMETHOD(Skip)( + _In_ ULONG celt + ) = 0; + + /// + /// Resets the enumeration sequence to the beginning. + /// + /// Always returns S_OK; + STDMETHOD(Reset)(void) = 0; + + /// + /// Creates a new enumeration object in the same state as the current enumeration object: the new object points to the same place in the enumeration sequence. + /// + /// A pointer to a pointer to a new interface. If the method fails, this parameter is undefined. + /// S_OK if a clone was returned; otherwise, E_OUTOFMEMORY. + STDMETHOD(Clone)( + _Deref_out_opt_ IEnumSetupInstances** ppenum + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Gets information about product instances installed on the machine. +/// +struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown +{ + /// + /// Enumerates all launchable product instances installed. + /// + /// An enumeration of completed, installed product instances. + /// Standard HRESULT indicating success or failure. + STDMETHOD(EnumInstances)( + _Out_ IEnumSetupInstances** ppEnumInstances + ) = 0; + + /// + /// Gets the instance for the current process path. + /// + /// The instance for the current process path. + /// + /// The instance for the current process path, or E_NOTFOUND if not found. + /// The may indicate the instance is invalid. + /// + /// + /// The returned instance may not be launchable. + /// +STDMETHOD(GetInstanceForCurrentProcess)( + _Out_ ISetupInstance** ppInstance + ) = 0; + + /// + /// Gets the instance for the given path. + /// + /// The instance for the given path. + /// + /// The instance for the given path, or E_NOTFOUND if not found. + /// The may indicate the instance is invalid. + /// + /// + /// The returned instance may not be launchable. + /// +STDMETHOD(GetInstanceForPath)( + _In_z_ LPCWSTR wzPath, + _Out_ ISetupInstance** ppInstance + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupConfiguration2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Gets information about product instances. +/// +struct DECLSPEC_UUID("26AAB78C-4A60-49D6-AF3B-3C35BC93365D") DECLSPEC_NOVTABLE ISetupConfiguration2 : public ISetupConfiguration +{ + /// + /// Enumerates all product instances. + /// + /// An enumeration of all product instances. + /// Standard HRESULT indicating success or failure. + STDMETHOD(EnumAllInstances)( + _Out_ IEnumSetupInstances** ppEnumInstances + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupPackageReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a package. +/// +struct DECLSPEC_UUID("da8d8a16-b2b6-4487-a2f1-594ccccd6bf5") DECLSPEC_NOVTABLE ISetupPackageReference : public IUnknown +{ + /// + /// Gets the general package identifier. + /// + /// The general package identifier. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetId)( + _Out_ BSTR* pbstrId + ) = 0; + + /// + /// Gets the version of the package. + /// + /// The version of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetVersion)( + _Out_ BSTR* pbstrVersion + ) = 0; + + /// + /// Gets the target process architecture of the package. + /// + /// The target process architecture of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetChip)( + _Out_ BSTR* pbstrChip + ) = 0; + + /// + /// Gets the language and optional region identifier. + /// + /// The language and optional region identifier. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLanguage)( + _Out_ BSTR* pbstrLanguage + ) = 0; + + /// + /// Gets the build branch of the package. + /// + /// The build branch of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetBranch)( + _Out_ BSTR* pbstrBranch + ) = 0; + + /// + /// Gets the type of the package. + /// + /// The type of the package. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetType)( + _Out_ BSTR* pbstrType + ) = 0; + + /// + /// Gets the unique identifier consisting of all defined tokens. + /// + /// The unique identifier consisting of all defined tokens. + /// Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required). + STDMETHOD(GetUniqueId)( + _Out_ BSTR* pbstrUniqueId + ) = 0; + + /// + /// Gets a value indicating whether the package refers to an external extension. + /// + /// A value indicating whether the package refers to an external extension. + /// Standard HRESULT indicating success or failure, including E_UNEXPECTED if no Id was defined (required). + STDMETHOD(GetIsExtension)( + _Out_ VARIANT_BOOL* pfIsExtension + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupHelper; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Helper functions. +/// +/// +/// You can query for this interface from the class. +/// +struct DECLSPEC_UUID("42b21b78-6192-463e-87bf-d577838f1d5c") DECLSPEC_NOVTABLE ISetupHelper : public IUnknown +{ + /// + /// Parses a dotted quad version string into a 64-bit unsigned integer. + /// + /// The dotted quad version string to parse, e.g. 1.2.3.4. + /// A 64-bit unsigned integer representing the version. You can compare this to other versions. + /// Standard HRESULT indicating success or failure, including E_INVALIDARG if the version is not valid. + STDMETHOD(ParseVersion)( + _In_ LPCOLESTR pwszVersion, + _Out_ PULONGLONG pullVersion + ) = 0; + + /// + /// Parses a dotted quad version string into a 64-bit unsigned integer. + /// + /// The string containing 1 or 2 dotted quad version strings to parse, e.g. [1.0,) that means 1.0.0.0 or newer. + /// A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions. + /// A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions. + /// Standard HRESULT indicating success or failure, including E_INVALIDARG if the version range is not valid. + STDMETHOD(ParseVersionRange)( + _In_ LPCOLESTR pwszVersionRange, + _Out_ PULONGLONG pullMinVersion, + _Out_ PULONGLONG pullMaxVersion + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupErrorState; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about the error state of an instance. +/// +struct DECLSPEC_UUID("46DCCD94-A287-476A-851E-DFBC2FFDBC20") DECLSPEC_NOVTABLE ISetupErrorState : public IUnknown +{ + /// + /// Gets an array of failed package references. + /// + /// Pointer to an array of , if packages have failed. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetFailedPackages)( + _Outptr_result_maybenull_ LPSAFEARRAY* ppsaFailedPackages + ) = 0; + + /// + /// Gets an array of skipped package references. + /// + /// Pointer to an array of , if packages have been skipped. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetSkippedPackages)( + _Outptr_result_maybenull_ LPSAFEARRAY* ppsaSkippedPackages + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupErrorState2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Information about the error state of an instance. +/// +struct DECLSPEC_UUID("9871385B-CA69-48F2-BC1F-7A37CBF0B1EF") DECLSPEC_NOVTABLE ISetupErrorState2 : public ISetupErrorState +{ + /// + /// Gets the path to the error log. + /// + /// The path to the error log. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetErrorLogFilePath)( + _Outptr_result_maybenull_ BSTR* pbstrErrorLogFilePath + ) = 0; +}; +#endif + +EXTERN_C const IID IID_ISetupFailedPackageReference; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a failed package. +/// +struct DECLSPEC_UUID("E73559CD-7003-4022-B134-27DC650B280F") DECLSPEC_NOVTABLE ISetupFailedPackageReference : public ISetupPackageReference +{ +}; + +#endif + +EXTERN_C const IID IID_ISetupFailedPackageReference2; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// A reference to a failed package. +/// +struct DECLSPEC_UUID("0FAD873E-E874-42E3-B268-4FE2F096B9CA") DECLSPEC_NOVTABLE ISetupFailedPackageReference2 : public ISetupFailedPackageReference +{ + /// + /// Gets the path to the optional package log. + /// + /// The path to the optional package log. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetLogFilePath)( + _Outptr_result_maybenull_ BSTR* pbstrLogFilePath + ) = 0; + + /// + /// Gets the description of the package failure. + /// + /// The description of the package failure. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetDescription)( + _Outptr_result_maybenull_ BSTR* pbstrDescription + ) = 0; + + /// + /// Gets the signature to use for feedback reporting. + /// + /// The signature to use for feedback reporting. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetSignature)( + _Outptr_result_maybenull_ BSTR* pbstrSignature + ) = 0; + + /// + /// Gets the array of details for this package failure. + /// + /// Pointer to an array of details as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetDetails)( + _Out_ LPSAFEARRAY* ppsaDetails + ) = 0; + + /// + /// Gets an array of packages affected by this package failure. + /// + /// Pointer to an array of for packages affected by this package failure. This may be NULL. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetAffectedPackages)( + _Out_ LPSAFEARRAY* ppsaAffectedPackages + ) = 0; +}; + +#endif + +EXTERN_C const IID IID_ISetupPropertyStore; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides named properties. +/// +/// +/// You can get this from an , , or derivative. +/// +struct DECLSPEC_UUID("C601C175-A3BE-44BC-91F6-4568D230FC83") DECLSPEC_NOVTABLE ISetupPropertyStore : public IUnknown +{ + /// + /// Gets an array of property names in this property store. + /// + /// Pointer to an array of property names as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetNames)( + _Out_ LPSAFEARRAY* ppsaNames + ) = 0; + + /// + /// Gets the value of a named property in this property store. + /// + /// The name of the property to get. + /// The value of the property. + /// Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported. + STDMETHOD(GetValue)( + _In_ LPCOLESTR pwszName, + _Out_ LPVARIANT pvtValue + ) = 0; +}; + +#endif + +EXTERN_C const IID IID_ISetupLocalizedPropertyStore; + +#if defined(__cplusplus) && !defined(CINTERFACE) +/// +/// Provides localized named properties. +/// +/// +/// You can get this from an . +/// +struct DECLSPEC_UUID("5BB53126-E0D5-43DF-80F1-6B161E5C6F6C") DECLSPEC_NOVTABLE ISetupLocalizedPropertyStore : public IUnknown +{ + /// + /// Gets an array of property names in this property store. + /// + /// The LCID for the property names. + /// Pointer to an array of property names as BSTRs. + /// Standard HRESULT indicating success or failure. + STDMETHOD(GetNames)( + _In_ LCID lcid, + _Out_ LPSAFEARRAY* ppsaNames + ) = 0; + + /// + /// Gets the value of a named property in this property store. + /// + /// The name of the property to get. + /// The LCID for the property. + /// The value of the property. + /// Standard HRESULT indicating success or failure, including E_NOTFOUND if the property is not defined or E_NOTSUPPORTED if the property type is not supported. + STDMETHOD(GetValue)( + _In_ LPCOLESTR pwszName, + _In_ LCID lcid, + _Out_ LPVARIANT pvtValue + ) = 0; +}; + +#endif + +// Class declarations +// +EXTERN_C const CLSID CLSID_SetupConfiguration; + +#ifdef __cplusplus +/// +/// This class implements , , and . +/// +class DECLSPEC_UUID("177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D") SetupConfiguration; +#endif + +// Function declarations +// +/// +/// Gets an that provides information about product instances installed on the machine. +/// +/// The that provides information about product instances installed on the machine. +/// Reserved for future use. +/// Standard HRESULT indicating success or failure. +STDMETHODIMP GetSetupConfiguration( + _Out_ ISetupConfiguration** ppConfiguration, + _Reserved_ LPVOID pReserved +); + +#ifdef __cplusplus +} +#endif diff --git a/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..675a501d8cb Binary files /dev/null and b/PC/external/v140/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..40f70b2682d Binary files /dev/null and b/PC/external/v140/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..675a501d8cb Binary files /dev/null and b/PC/external/v141/amd64/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib b/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib new file mode 100644 index 00000000000..40f70b2682d Binary files /dev/null and b/PC/external/v141/win32/Microsoft.VisualStudio.Setup.Configuration.Native.lib differ diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj index 7ec26920107..d8b159e6a1d 100644 --- a/PCbuild/_lzma.vcxproj +++ b/PCbuild/_lzma.vcxproj @@ -65,7 +65,7 @@ WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - $(OutDir)/liblzma$(PyDebugExt).lib + $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 2e6b0a94bb5..5828b518b11 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -77,7 +77,7 @@ if "%~1"=="-e" (set IncludeExternals=true) & shift & goto CheckOpts if "%~1"=="--no-ssl" (set IncludeSSL=false) & shift & goto CheckOpts if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts -if "%IncludeExternals%"=="" set IncludeExternals=false +if "%IncludeExternals%"=="" set IncludeExternals=true if "%IncludeSSL%"=="" set IncludeSSL=true if "%IncludeTkinter%"=="" set IncludeTkinter=true diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 6fd0440f4f9..0f018525874 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -71,6 +71,7 @@ version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName) 0x1e000000 @@ -214,6 +215,7 @@ + @@ -348,6 +350,7 @@ + From webhook-mailer at python.org Thu Sep 7 17:33:59 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Thu, 07 Sep 2017 21:33:59 -0000 Subject: [Python-checkins] Update copyright PSF to 2001-2017 (#3421) Message-ID: https://github.com/python/cpython/commit/0c72a0c449e69949a236452579a6820e6eaa4d87 commit: 0c72a0c449e69949a236452579a6820e6eaa4d87 branch: master author: Christian Heimes committer: Raymond Hettinger date: 2017-09-07T13:59:13-07:00 summary: Update copyright PSF to 2001-2017 (#3421) Signed-off-by: Christian Heimes files: M Doc/copyright.rst M README.rst diff --git a/Doc/copyright.rst b/Doc/copyright.rst index 22d7705846e..2b5400cd9fb 100644 --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Copyright Python and this documentation is: -Copyright ? 2001-2016 Python Software Foundation. All rights reserved. +Copyright ? 2001-2017 Python Software Foundation. All rights reserved. Copyright ? 2000 BeOpen.com. All rights reserved. diff --git a/README.rst b/README.rst index 4829271416e..b7e9eff4097 100644 --- a/README.rst +++ b/README.rst @@ -233,7 +233,8 @@ Copyright and License Information --------------------------------- Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. +2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation. All rights +reserved. Copyright (c) 2000 BeOpen.com. All rights reserved. From webhook-mailer at python.org Thu Sep 7 17:51:15 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Thu, 07 Sep 2017 21:51:15 -0000 Subject: [Python-checkins] bpo-31270: Modification of Pr 3200 (#3427) Message-ID: https://github.com/python/cpython/commit/3147b0422cbeb98065666ccf95ab6845ac800fd4 commit: 3147b0422cbeb98065666ccf95ab6845ac800fd4 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-07T14:01:44-07:00 summary: bpo-31270: Modification of Pr 3200 (#3427) * bpo-31270: Simplify documentation of itertools.zip_longest * Use repeat(). Track num_active. files: M Doc/library/itertools.rst diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index b0d0a8c8c8c..c989e464200 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -630,26 +630,25 @@ loops that truncate the stream. iterables are of uneven length, missing values are filled-in with *fillvalue*. Iteration continues until the longest iterable is exhausted. Roughly equivalent to:: - class ZipExhausted(Exception): - pass - - def zip_longest(*args, **kwds): + def zip_longest(*args, fillvalue=None): # zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D- - fillvalue = kwds.get('fillvalue') - counter = len(args) - 1 - def sentinel(): - nonlocal counter - if not counter: - raise ZipExhausted - counter -= 1 - yield fillvalue - fillers = repeat(fillvalue) - iterators = [chain(it, sentinel(), fillers) for it in args] - try: - while iterators: - yield tuple(map(next, iterators)) - except ZipExhausted: - pass + iterators = [iter(it) for it in args] + num_active = len(iterators) + if not num_active: + return + while True: + values = [] + for i, it in enumerate(iterators): + try: + value = next(it) + except StopIteration: + num_active -= 1 + if not num_active: + return + iterators[i] = repeat(fillvalue) + value = fillvalue + values.append(value) + yield tuple(values) If one of the iterables is potentially infinite, then the :func:`zip_longest` function should be wrapped with something that limits the number of calls From webhook-mailer at python.org Thu Sep 7 18:25:42 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 22:25:42 -0000 Subject: [Python-checkins] bpo-28958: Improve SSLContext error reporting. (#3414) Message-ID: https://github.com/python/cpython/commit/17c9ac927b97472dd080174fde709d9234848195 commit: 17c9ac927b97472dd080174fde709d9234848195 branch: master author: Christian Heimes committer: GitHub date: 2017-09-07T14:14:00-07:00 summary: bpo-28958: Improve SSLContext error reporting. (#3414) Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst new file mode 100644 index 00000000000..eb4e206be37 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst @@ -0,0 +1,2 @@ +ssl.SSLContext() now uses OpenSSL error information when a context cannot be +instantiated. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b8509acc3f1..5ea354a60aa 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2636,8 +2636,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version) return NULL; } if (ctx == NULL) { - PyErr_SetString(PySSLErrorObject, - "failed to allocate SSL context"); + _setSSLError(NULL, 0, __FILE__, __LINE__); return NULL; } From webhook-mailer at python.org Thu Sep 7 18:26:31 2017 From: webhook-mailer at python.org (R. David Murray) Date: Thu, 07 Sep 2017 22:26:31 -0000 Subject: [Python-checkins] [2.7] bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (GH-3272) (GH-3428) Message-ID: https://github.com/python/cpython/commit/82cae7c5be4175e2173e4d342825b5315a9d612a commit: 82cae7c5be4175e2173e4d342825b5315a9d612a branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: R. David Murray date: 2017-09-07T17:17:42-04:00 summary: [2.7] bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (GH-3272) (GH-3428) Also provide a solution if the user wants to keep multiple blank lines. (cherry picked from commit 397c467c49385023de36411194d381ac993bae1a) files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 1ea1f3fc1a5..c8a5941df72 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -419,7 +419,9 @@ should not be line-wrapped:: -h, --help show this help message and exit :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text, -including argument descriptions. +including argument descriptions. However, multiple new lines are replaced with +one. If you wish to preserve multiple blank lines, add spaces between the +newlines. The other formatter class available, :class:`ArgumentDefaultsHelpFormatter`, will add information about the default value of each of the arguments:: From webhook-mailer at python.org Thu Sep 7 18:26:38 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 22:26:38 -0000 Subject: [Python-checkins] bpo-27340: Use memoryview in SSLSocket.sendall() (#3384) Message-ID: https://github.com/python/cpython/commit/888bbdc192ec4db888a294ef758cf5510442dc9a commit: 888bbdc192ec4db888a294ef758cf5510442dc9a branch: master author: Christian Heimes committer: GitHub date: 2017-09-07T14:18:21-07:00 summary: bpo-27340: Use memoryview in SSLSocket.sendall() (#3384) * bpo-27340: Use memoryview in SSLSocket.sendall() SSLSocket.sendall() now uses memoryview to create slices of data. This fix support for all bytes-like object. It is also more efficient and avoids costly copies. Signed-off-by: Christian Heimes * Cast view to bytes, fix typo Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst M Lib/ssl.py M Lib/test/test_ssl.py diff --git a/Lib/ssl.py b/Lib/ssl.py index 8ad4a339a93..7a574dcb2b1 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -959,11 +959,12 @@ def sendall(self, data, flags=0): raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - amount = len(data) count = 0 - while (count < amount): - v = self.send(data[count:]) - count += v + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v else: return socket.sendall(self, data, flags) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 89b4609282f..747661bc6d0 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -18,6 +18,10 @@ import weakref import platform import functools +try: + import ctypes +except ImportError: + ctypes = None ssl = support.import_module("ssl") @@ -2891,6 +2895,13 @@ def _recvfrom_into(): self.assertEqual(s.read(-1, buffer), len(data)) self.assertEqual(buffer, data) + # sendall accepts bytes-like objects + if ctypes is not None: + ubyte = ctypes.c_ubyte * len(data) + byteslike = ubyte.from_buffer_copy(data) + s.sendall(byteslike) + self.assertEqual(s.read(), data) + # Make sure sendmsg et al are disallowed to avoid # inadvertent disclosure of data and/or corruption # of the encrypted data stream @@ -2898,7 +2909,6 @@ def _recvfrom_into(): self.assertRaises(NotImplementedError, s.recvmsg, 100) self.assertRaises(NotImplementedError, s.recvmsg_into, bytearray(100)) - s.write(b"over\n") self.assertRaises(ValueError, s.recv, -1) diff --git a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst new file mode 100644 index 00000000000..2d05e10fc14 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst @@ -0,0 +1,3 @@ +SSLSocket.sendall() now uses memoryview to create slices of data. This fixes +support for all bytes-like object. It is also more efficient and avoids +costly copies. From webhook-mailer at python.org Thu Sep 7 18:26:43 2017 From: webhook-mailer at python.org (R. David Murray) Date: Thu, 07 Sep 2017 22:26:43 -0000 Subject: [Python-checkins] [3.6] bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (GH-3272) (GH-3429) Message-ID: https://github.com/python/cpython/commit/e89b35dd2b87e85978b91e3e2dbdea1fc76d6be4 commit: e89b35dd2b87e85978b91e3e2dbdea1fc76d6be4 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: R. David Murray date: 2017-09-07T17:18:45-04:00 summary: [3.6] bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (GH-3272) (GH-3429) Also provide a solution if the user wants to keep multiple blank lines. (cherry picked from commit 397c467c49385023de36411194d381ac993bae1a) files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 45303048174..9411bbd4ac5 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -426,7 +426,9 @@ should not be line-wrapped:: -h, --help show this help message and exit :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text, -including argument descriptions. +including argument descriptions. However, multiple new lines are replaced with +one. If you wish to preserve multiple blank lines, add spaces between the +newlines. :class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages:: From webhook-mailer at python.org Thu Sep 7 18:28:24 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 22:28:24 -0000 Subject: [Python-checkins] [3.6] bpo-31294: Fix ZeroMQSocketListener and ZeroMQSocketHandler examples (GH-3229) (#3430) Message-ID: https://github.com/python/cpython/commit/27ce5a1b1931b670da234c30d24bfbbc93fa24d7 commit: 27ce5a1b1931b670da234c30d24bfbbc93fa24d7 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Christian Heimes date: 2017-09-07T14:27:44-07:00 summary: [3.6] bpo-31294: Fix ZeroMQSocketListener and ZeroMQSocketHandler examples (GH-3229) (#3430) * Fix ZeroMQSocketListener and ZeroMQSocketHandler examples * Use send_json and recv_json to simplify pyzmq interfacing * Add News entry (cherry picked from commit 586c0502b5eb9a39cabe0bc2707a8ff63114265c) files: A Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst M Doc/howto/logging-cookbook.rst M Misc/ACKS diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index 6498ea56957..44f38e0341c 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1258,8 +1258,8 @@ socket is created separately and passed to the handler (as its 'queue'):: class ZeroMQSocketHandler(QueueHandler): def enqueue(self, record): - data = json.dumps(record.__dict__) - self.queue.send(data) + self.queue.send_json(record.__dict__) + handler = ZeroMQSocketHandler(sock) @@ -1272,11 +1272,10 @@ data needed by the handler to create the socket:: self.ctx = ctx or zmq.Context() socket = zmq.Socket(self.ctx, socktype) socket.bind(uri) - QueueHandler.__init__(self, socket) + super().__init__(socket) def enqueue(self, record): - data = json.dumps(record.__dict__) - self.queue.send(data) + self.queue.send_json(record.__dict__) def close(self): self.queue.close() @@ -1292,12 +1291,13 @@ of queues, for example a ZeroMQ 'subscribe' socket. Here's an example:: def __init__(self, uri, *handlers, **kwargs): self.ctx = kwargs.get('ctx') or zmq.Context() socket = zmq.Socket(self.ctx, zmq.SUB) - socket.setsockopt(zmq.SUBSCRIBE, '') # subscribe to everything + socket.setsockopt_string(zmq.SUBSCRIBE, '') # subscribe to everything socket.connect(uri) + super().__init__(socket, *handlers, **kwargs) def dequeue(self): - msg = self.queue.recv() - return logging.makeLogRecord(json.loads(msg)) + msg = self.queue.recv_json() + return logging.makeLogRecord(msg) .. seealso:: diff --git a/Misc/ACKS b/Misc/ACKS index 3b246c1eea0..83336eca5b9 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1537,6 +1537,7 @@ Martin Teichmann Gustavo Temple Mikhail Terekhov Victor Terr?n +Pablo Galindo Richard M. Tew Tobias Thelen F?vry Thibault diff --git a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst new file mode 100644 index 00000000000..2c8f8507697 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst @@ -0,0 +1,2 @@ +Fix incomplete code snippet in the ZeroMQSocketListener and +ZeroMQSocketHandler examples and adapt them to Python 3. From webhook-mailer at python.org Thu Sep 7 19:11:07 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Thu, 07 Sep 2017 23:11:07 -0000 Subject: [Python-checkins] bpo-22635: Update the getstatusoutput docstring. (#3435) Message-ID: https://github.com/python/cpython/commit/2eb0cb4787d02d995a9bb6dc075983792c12835c commit: 2eb0cb4787d02d995a9bb6dc075983792c12835c branch: master author: Gregory P. Smith committer: GitHub date: 2017-09-07T16:11:02-07:00 summary: bpo-22635: Update the getstatusoutput docstring. (#3435) To match the documentation updates already made. Also renames the local variable used within to match what it actually holds. files: M Lib/subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index f61ff0c3946..6b90d40564f 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -38,7 +38,7 @@ getoutput(...): Runs a command in the shell, waits for it to complete, then returns the output getstatusoutput(...): Runs a command in the shell, waits for it to complete, - then returns a (status, output) tuple + then returns a (exitcode, output) tuple """ import sys @@ -492,7 +492,7 @@ def list2cmdline(seq): # def getstatusoutput(cmd): - """ Return (status, output) of executing cmd in a shell. + """Return (exitcode, output) of executing cmd in a shell. Execute the string 'cmd' in a shell with 'check_output' and return a 2-tuple (status, output). The locale encoding is used @@ -506,19 +506,21 @@ def getstatusoutput(cmd): >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') - (256, 'cat: /bin/junk: No such file or directory') + (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') - (256, 'sh: /bin/junk: not found') + (127, 'sh: /bin/junk: not found') + >>> subprocess.getstatusoutput('/bin/kill $$') + (-15, '') """ try: data = check_output(cmd, shell=True, universal_newlines=True, stderr=STDOUT) - status = 0 + exitcode = 0 except CalledProcessError as ex: data = ex.output - status = ex.returncode + exitcode = ex.returncode if data[-1:] == '\n': data = data[:-1] - return status, data + return exitcode, data def getoutput(cmd): """Return output (stdout or stderr) of executing cmd in a shell. From lp_benchmark_robot at intel.com Thu Sep 7 19:23:07 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 7 Sep 2017 16:23:07 -0700 Subject: [Python-checkins] [1 down, 2 up, 62 flat] Results for Python (master branch) 2017-09-07 Message-ID: <0338e21f-efb7-4b17-90e4-d03e8cbfe658@orsmsx152.amr.corp.intel.com> Results for project python/master, build date: 2017-09-07 03:04:49-07:00. - commit: 1f06a68 - previous commit: 3fc499b - revision date: 2017-09-06 19:29:10-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.214% | -0.253% | +3.073% | +8.199% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.935% | -0.653% | +20.513% | +8.754% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.710% | -0.591% | +21.458% | +8.160% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.536% | +0.222% | +22.051% | +4.367% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 1.710% | +0.718% | +1.106% | +16.633% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.284% | +0.308% | +12.360% | +8.712% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.612% | -1.089% | +7.333% | +9.609% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.544% | -0.310% | +3.996% | +5.227% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 3.631% | -0.718% | +8.947% | +16.308% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 3.976% | -0.179% | +8.638% | +13.180% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.558% | +1.282% | +3.184% | +8.224% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.743% | +0.378% | +6.762% | +2.866% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.727% | +0.087% | +3.522% | +5.485% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.820% | +0.294% | +8.531% | +10.547% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.091% | +0.985% | +6.906% | +7.711% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.800% | -0.943% | +6.009% | +10.821% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.996% | +0.470% | +9.062% | +10.807% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.599% | +0.253% | +7.049% | +9.408% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.533% | +1.006% | +3.726% | +8.986% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 7.340% | -2.365% | -2.362% | +15.418% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.676% | +1.721% | +8.328% | +7.827% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.607% | -0.090% | +46.385% | +11.468% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 2.004% | +0.589% | +8.428% | +9.806% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.487% | -0.459% | +18.590% | +11.257% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 6.000% | -1.420% | +5.675% | +13.285% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.420% | +0.690% | +3.929% | +5.162% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.582% | -1.064% | -2.935% | +3.551% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.608% | +1.119% | +2.475% | +7.117% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.636% | +0.808% | +2.746% | +11.180% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 2.756% | +0.605% | +0.844% | +20.994% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_dict| 0.291% | +2.968% | +2.974% | +17.853% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_list| 0.813% | +3.530% | +8.300% | +14.982% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 1.373% | +2.518% | +12.301% | +7.708% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.048% | -0.208% | +0.138% | +9.414% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.122% | -0.003% | +9.285% | +4.631% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.091% | +0.062% | +1.639% | +4.764% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.074% | +0.297% | +10.070% | +11.564% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.562% | -0.729% | -9.767% | +12.861% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_dna| 0.876% | -4.140% | -2.067% | +12.565% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.562% | +0.158% | -2.562% | +0.700% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.302% | +1.108% | +10.953% | +2.176% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 2.123% | +0.083% | +7.590% | +12.614% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.736% | -0.073% | +2.212% | +2.284% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.237% | +1.588% | +26.560% | +8.997% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.682% | -0.141% | +5.525% | +3.923% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.538% | +0.024% | +15.166% | +6.223% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.522% | +1.682% | +2.874% | -1.136% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.435% | +0.058% | +7.611% | -0.522% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.113% | +0.938% | +4.716% | +8.174% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.403% | -0.442% | +5.223% | +4.635% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.636% | -1.263% | +3.136% | +6.608% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.096% | -0.392% | +11.480% | +9.098% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.509% | -0.037% | +9.754% | +6.676% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.290% | +0.326% | +10.686% | +10.351% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.216% | -0.646% | +10.491% | +12.528% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.745% | +0.118% | +23.477% | +10.714% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.191% | +0.259% | +6.177% | +5.381% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.024% | +0.278% | +2.645% | -2.572% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 7.405% | -1.434% | +7.711% | +20.912% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.252% | -0.951% | -1.810% | +19.476% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.214% | +0.604% | +7.778% | +6.479% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.948% | +0.710% | +6.510% | +7.757% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.151% | +0.925% | +2.690% | +6.536% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.580% | +0.077% | -5.576% | +11.949% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.101% | +0.975% | +7.815% | +7.920% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-2-up-62-flat-results-for-python-master-branch-2017-09-07 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Thu Sep 7 19:45:02 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Thu, 07 Sep 2017 23:45:02 -0000 Subject: [Python-checkins] [3.6] bpo-22635: Update the getstatusoutput docstring. (GH-3435) (#3439) Message-ID: https://github.com/python/cpython/commit/fb4c28c032e26b3cdbe67eae3769d45207ac3507 commit: fb4c28c032e26b3cdbe67eae3769d45207ac3507 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Gregory P. Smith date: 2017-09-07T16:44:58-07:00 summary: [3.6] bpo-22635: Update the getstatusoutput docstring. (GH-3435) (#3439) To match the documentation updates already made. Also renames the local variable used within to match what it actually holds. (cherry picked from commit 2eb0cb4787d02d995a9bb6dc075983792c12835c) files: M Lib/subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 575413d9870..290ae44f03d 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -38,7 +38,7 @@ getoutput(...): Runs a command in the shell, waits for it to complete, then returns the output getstatusoutput(...): Runs a command in the shell, waits for it to complete, - then returns a (status, output) tuple + then returns a (exitcode, output) tuple """ import sys @@ -493,7 +493,7 @@ def list2cmdline(seq): # def getstatusoutput(cmd): - """ Return (status, output) of executing cmd in a shell. + """Return (exitcode, output) of executing cmd in a shell. Execute the string 'cmd' in a shell with 'check_output' and return a 2-tuple (status, output). The locale encoding is used @@ -507,19 +507,21 @@ def getstatusoutput(cmd): >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') - (256, 'cat: /bin/junk: No such file or directory') + (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') - (256, 'sh: /bin/junk: not found') + (127, 'sh: /bin/junk: not found') + >>> subprocess.getstatusoutput('/bin/kill $$') + (-15, '') """ try: data = check_output(cmd, shell=True, universal_newlines=True, stderr=STDOUT) - status = 0 + exitcode = 0 except CalledProcessError as ex: data = ex.output - status = ex.returncode + exitcode = ex.returncode if data[-1:] == '\n': data = data[:-1] - return status, data + return exitcode, data def getoutput(cmd): """Return output (stdout or stderr) of executing cmd in a shell. From webhook-mailer at python.org Thu Sep 7 19:45:09 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 23:45:09 -0000 Subject: [Python-checkins] [2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433) Message-ID: https://github.com/python/cpython/commit/611a3eab194dfd0a54e541e8e8547051df24bcfc commit: 611a3eab194dfd0a54e541e8e8547051df24bcfc branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-07T16:45:07-07:00 summary: [2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433) Signed-off-by: Christian Heimes (cherry picked from commit 17c9ac9) files: A Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst new file mode 100644 index 00000000000..eb4e206be37 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst @@ -0,0 +1,2 @@ +ssl.SSLContext() now uses OpenSSL error information when a context cannot be +instantiated. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 761554a7827..5b4cec203ad 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2146,8 +2146,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } if (ctx == NULL) { - PyErr_SetString(PySSLErrorObject, - "failed to allocate SSL context"); + _setSSLError(NULL, 0, __FILE__, __LINE__); return NULL; } From webhook-mailer at python.org Thu Sep 7 19:45:42 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 23:45:42 -0000 Subject: [Python-checkins] [3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432) Message-ID: https://github.com/python/cpython/commit/6c99b652f7909f86753b9e567ea18c95ee736e83 commit: 6c99b652f7909f86753b9e567ea18c95ee736e83 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-07T16:45:39-07:00 summary: [3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432) Signed-off-by: Christian Heimes (cherry picked from commit 17c9ac9) files: A Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst new file mode 100644 index 00000000000..eb4e206be37 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst @@ -0,0 +1,2 @@ +ssl.SSLContext() now uses OpenSSL error information when a context cannot be +instantiated. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 25fb8090f43..ab30d212b9d 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2643,8 +2643,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version) return NULL; } if (ctx == NULL) { - PyErr_SetString(PySSLErrorObject, - "failed to allocate SSL context"); + _setSSLError(NULL, 0, __FILE__, __LINE__); return NULL; } From webhook-mailer at python.org Thu Sep 7 19:59:22 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 07 Sep 2017 23:59:22 -0000 Subject: [Python-checkins] [3.6] bpo-27340: Use memoryview in SSLSocket.sendall() (GH-3384) (#3434) Message-ID: https://github.com/python/cpython/commit/9423f5d68874ff2e500cbe072c25f883cf754be8 commit: 9423f5d68874ff2e500cbe072c25f883cf754be8 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-07T16:59:17-07:00 summary: [3.6] bpo-27340: Use memoryview in SSLSocket.sendall() (GH-3384) (#3434) * bpo-27340: Use memoryview in SSLSocket.sendall() SSLSocket.sendall() now uses memoryview to create slices of data. This fix support for all bytes-like object. It is also more efficient and avoids costly copies. Signed-off-by: Christian Heimes * Cast view to bytes, fix typo Signed-off-by: Christian Heimes . (cherry picked from commit 888bbdc192ec4db888a294ef758cf5510442dc9a) files: A Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst M Lib/ssl.py M Lib/test/test_ssl.py diff --git a/Lib/ssl.py b/Lib/ssl.py index 8ad4a339a93..7a574dcb2b1 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -959,11 +959,12 @@ def sendall(self, data, flags=0): raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - amount = len(data) count = 0 - while (count < amount): - v = self.send(data[count:]) - count += v + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v else: return socket.sendall(self, data, flags) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 4191d9036e4..157e6ced01b 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -18,6 +18,10 @@ import weakref import platform import functools +try: + import ctypes +except ImportError: + ctypes = None ssl = support.import_module("ssl") @@ -2882,7 +2886,13 @@ def _recvfrom_into(): s.send(data) buffer = bytearray(len(data)) self.assertEqual(s.read(-1, buffer), len(data)) - self.assertEqual(buffer, data) + self.assertEqual(buffer, data) # sendall accepts bytes-like objects + + if ctypes is not None: + ubyte = ctypes.c_ubyte * len(data) + byteslike = ubyte.from_buffer_copy(data) + s.sendall(byteslike) + self.assertEqual(s.read(), data) # Make sure sendmsg et al are disallowed to avoid # inadvertent disclosure of data and/or corruption diff --git a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst new file mode 100644 index 00000000000..2d05e10fc14 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst @@ -0,0 +1,3 @@ +SSLSocket.sendall() now uses memoryview to create slices of data. This fixes +support for all bytes-like object. It is also more efficient and avoids +costly copies. From webhook-mailer at python.org Thu Sep 7 20:14:19 2017 From: webhook-mailer at python.org (Nick Coghlan) Date: Fri, 08 Sep 2017 00:14:19 -0000 Subject: [Python-checkins] bpo-31344: Per-frame control of trace events (GH-3417) Message-ID: https://github.com/python/cpython/commit/5a8516701f5140c8c989c40e261a4f4e20e8af86 commit: 5a8516701f5140c8c989c40e261a4f4e20e8af86 branch: master author: Nick Coghlan committer: GitHub date: 2017-09-08T10:14:16+10:00 summary: bpo-31344: Per-frame control of trace events (GH-3417) f_trace_lines: enable/disable line trace events f_trace_opcodes: enable/disable opcode trace events These are intended primarily for testing of the interpreter itself, as they make it much easier to emulate signals arriving at unfortunate times. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst M Doc/library/sys.rst M Doc/reference/datamodel.rst M Doc/whatsnew/3.7.rst M Include/frameobject.h M Include/pystate.h M Lib/test/test_sys.py M Lib/test/test_sys_settrace.py M Objects/frameobject.c M Python/ceval.c M Python/sysmodule.c diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 8b94929c500..85f31368c30 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1068,7 +1068,7 @@ always available. Trace functions should have three arguments: *frame*, *event*, and *arg*. *frame* is the current stack frame. *event* is a string: ``'call'``, ``'line'``, ``'return'``, ``'exception'``, ``'c_call'``, ``'c_return'``, or - ``'c_exception'``. *arg* depends on the event type. + ``'c_exception'``, ``'opcode'``. *arg* depends on the event type. The trace function is invoked (with *event* set to ``'call'``) whenever a new local scope is entered; it should return a reference to a local trace @@ -1091,6 +1091,8 @@ always available. ``None``; the return value specifies the new local trace function. See :file:`Objects/lnotab_notes.txt` for a detailed explanation of how this works. + Per-line events may be disabled for a frame by setting + :attr:`f_trace_lines` to :const:`False` on that frame. ``'return'`` A function (or other code block) is about to return. The local trace @@ -1113,6 +1115,14 @@ always available. ``'c_exception'`` A C function has raised an exception. *arg* is the C function object. + ``'opcode'`` + The interpreter is about to execute a new opcode (see :mod:`dis` for + opcode details). The local trace function is called; *arg* is + ``None``; the return value specifies the new local trace function. + Per-opcode events are not emitted by default: they must be explicitly + requested by setting :attr:`f_trace_opcodes` to :const:`True` on the + frame. + Note that as an exception is propagated down the chain of callers, an ``'exception'`` event is generated at each level. @@ -1125,6 +1135,11 @@ always available. implementation platform, rather than part of the language definition, and thus may not be available in all Python implementations. + .. versionchanged:: 3.7 + + ``'opcode'`` event type added; :attr:`f_trace_lines` and + :attr:`f_trace_opcodes` attributes added to frames + .. function:: set_asyncgen_hooks(firstiter, finalizer) Accepts two optional keyword arguments which are callables that accept an diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 24a2618b01e..5f932ae0de7 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -970,10 +970,20 @@ Internal types .. index:: single: f_trace (frame attribute) + single: f_trace_lines (frame attribute) + single: f_trace_opcodes (frame attribute) single: f_lineno (frame attribute) Special writable attributes: :attr:`f_trace`, if not ``None``, is a function - called at the start of each source code line (this is used by the debugger); + called for various events during code execution (this is used by the debugger). + Normally an event is triggered for each new source line - this can be + disabled by setting :attr:`f_trace_lines` to :const:`False`. + + Implementations *may* allow per-opcode events to be requested by setting + :attr:`f_trace_opcodes` to :const:`True`. Note that this may lead to + undefined interpreter behaviour if exceptions raised by the trace + function escape to the function being traced. + :attr:`f_lineno` is the current line number of the frame --- writing to this from within a trace function jumps to the given line (only for the bottom-most frame). A debugger can implement a Jump command (aka Set Next Statement) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 14c2182e26c..5ee41dcc20b 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -348,6 +348,18 @@ Build and C API Changes (Contributed by Antoine Pitrou in :issue:`31370`.). +Other CPython Implementation Changes +==================================== + +* Trace hooks may now opt out of receiving ``line`` events from the interpreter + by setting the new ``f_trace_lines`` attribute to :const:`False` on the frame + being traced. (Contributed by Nick Coghlan in :issue:`31344`.) + +* Trace hooks may now opt in to receiving ``opcode`` events from the interpreter + by setting the new ``f_trace_opcodes`` attribute to :const:`True` on the frame + being traced. (Contributed by Nick Coghlan in :issue:`31344`.) + + Deprecated ========== diff --git a/Include/frameobject.h b/Include/frameobject.h index 616c611c7e8..dbe0a840df9 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -27,6 +27,8 @@ typedef struct _frame { to the current stack top. */ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ + char f_trace_lines; /* Emit per-line trace events? */ + char f_trace_opcodes; /* Emit per-opcode trace events? */ /* In a generator, we need to be able to swap between the exception state inside the generator and the exception state of the calling diff --git a/Include/pystate.h b/Include/pystate.h index 6229236972a..f957d536dcd 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -92,7 +92,11 @@ typedef struct _is { /* Py_tracefunc return -1 when raising an exception, or 0 for success. */ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); -/* The following values are used for 'what' for tracefunc functions: */ +/* The following values are used for 'what' for tracefunc functions + * + * To add a new kind of trace event, also update "trace_init" in + * Python/sysmodule.c to define the Python level event name + */ #define PyTrace_CALL 0 #define PyTrace_EXCEPTION 1 #define PyTrace_LINE 2 @@ -100,6 +104,7 @@ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); #define PyTrace_C_CALL 4 #define PyTrace_C_EXCEPTION 5 #define PyTrace_C_RETURN 6 +#define PyTrace_OPCODE 7 #endif #ifdef Py_LIMITED_API diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 04550e58b23..fd45abee67e 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -971,7 +971,7 @@ class C(object): pass nfrees = len(x.f_code.co_freevars) extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ ncells + nfrees - 1 - check(x, vsize('12P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) + check(x, vsize('8P2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) # function def func(): pass check(func, size('12P')) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 25c5835fd6f..ed9e6d4f492 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -234,16 +234,29 @@ def generator_example(): class Tracer: - def __init__(self): + def __init__(self, trace_line_events=None, trace_opcode_events=None): + self.trace_line_events = trace_line_events + self.trace_opcode_events = trace_opcode_events self.events = [] + + def _reconfigure_frame(self, frame): + if self.trace_line_events is not None: + frame.f_trace_lines = self.trace_line_events + if self.trace_opcode_events is not None: + frame.f_trace_opcodes = self.trace_opcode_events + def trace(self, frame, event, arg): + self._reconfigure_frame(frame) self.events.append((frame.f_lineno, event)) return self.trace + def traceWithGenexp(self, frame, event, arg): + self._reconfigure_frame(frame) (o for o in [1]) self.events.append((frame.f_lineno, event)) return self.trace + class TraceTestCase(unittest.TestCase): # Disable gc collection when tracing, otherwise the @@ -257,6 +270,11 @@ def tearDown(self): if self.using_gc: gc.enable() + @staticmethod + def make_tracer(): + """Helper to allow test subclasses to configure tracers differently""" + return Tracer() + def compare_events(self, line_offset, events, expected_events): events = [(l - line_offset, e) for (l, e) in events] if events != expected_events: @@ -266,7 +284,7 @@ def compare_events(self, line_offset, events, expected_events): [str(x) for x in events]))) def run_and_compare(self, func, events): - tracer = Tracer() + tracer = self.make_tracer() sys.settrace(tracer.trace) func() sys.settrace(None) @@ -277,7 +295,7 @@ def run_test(self, func): self.run_and_compare(func, func.events) def run_test2(self, func): - tracer = Tracer() + tracer = self.make_tracer() func(tracer.trace) sys.settrace(None) self.compare_events(func.__code__.co_firstlineno, @@ -329,7 +347,7 @@ def test_13_genexp(self): # and if the traced function contains another generator # that is not completely exhausted, the trace stopped. # Worse: the 'finally' clause was not invoked. - tracer = Tracer() + tracer = self.make_tracer() sys.settrace(tracer.traceWithGenexp) generator_example() sys.settrace(None) @@ -398,6 +416,34 @@ def func(): (1, 'line')]) +class SkipLineEventsTraceTestCase(TraceTestCase): + """Repeat the trace tests, but with per-line events skipped""" + + def compare_events(self, line_offset, events, expected_events): + skip_line_events = [e for e in expected_events if e[1] != 'line'] + super().compare_events(line_offset, events, skip_line_events) + + @staticmethod + def make_tracer(): + return Tracer(trace_line_events=False) + + + at support.cpython_only +class TraceOpcodesTestCase(TraceTestCase): + """Repeat the trace tests, but with per-opcodes events enabled""" + + def compare_events(self, line_offset, events, expected_events): + skip_opcode_events = [e for e in events if e[1] != 'opcode'] + if len(events) > 1: + self.assertLess(len(skip_opcode_events), len(events), + msg="No 'opcode' events received by the tracer") + super().compare_events(line_offset, skip_opcode_events, expected_events) + + @staticmethod + def make_tracer(): + return Tracer(trace_opcode_events=True) + + class RaisingTraceFuncTestCase(unittest.TestCase): def setUp(self): self.addCleanup(sys.settrace, sys.gettrace()) @@ -846,6 +892,8 @@ class fake_function: def test_main(): support.run_unittest( TraceTestCase, + SkipLineEventsTraceTestCase, + TraceOpcodesTestCase, RaisingTraceFuncTestCase, JumpTestCase ) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst new file mode 100644 index 00000000000..2b3a386d2b0 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst @@ -0,0 +1,5 @@ +For finer control of tracing behaviour when testing the interpreter, two new +frame attributes have been added to control the emission of particular trace +events: ``f_trace_lines`` (``True`` by default) to turn off per-line trace +events; and ``f_trace_opcodes`` (``False`` by default) to turn on per-opcode +trace events. diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 84483195ab2..b3f0b65e51c 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -15,6 +15,8 @@ static PyMemberDef frame_memberlist[] = { {"f_builtins", T_OBJECT, OFF(f_builtins), READONLY}, {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, {"f_lasti", T_INT, OFF(f_lasti), READONLY}, + {"f_trace_lines", T_BOOL, OFF(f_trace_lines), 0}, + {"f_trace_opcodes", T_BOOL, OFF(f_trace_opcodes), 0}, {NULL} /* Sentinel */ }; @@ -728,6 +730,8 @@ _PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code, f->f_iblock = 0; f->f_executing = 0; f->f_gen = NULL; + f->f_trace_opcodes = 0; + f->f_trace_lines = 1; return f; } diff --git a/Python/ceval.c b/Python/ceval.c index 8fc65cdcc04..a072a5fe81e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4458,12 +4458,19 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj, *instr_lb = bounds.ap_lower; *instr_ub = bounds.ap_upper; } - /* If the last instruction falls at the start of a line or if - it represents a jump backwards, update the frame's line - number and call the trace function. */ - if (frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev) { + /* Always emit an opcode event if we're tracing all opcodes. */ + if (frame->f_trace_opcodes) { + result = call_trace(func, obj, tstate, frame, PyTrace_OPCODE, Py_None); + } + /* If the last instruction falls at the start of a line or if it + represents a jump backwards, update the frame's line number and + then call the trace function if we're tracing source lines. + */ + if ((frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev)) { frame->f_lineno = line; - result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None); + if (frame->f_trace_lines) { + result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None); + } } *instr_prev = frame->f_lasti; return result; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index fba7220e44c..021b95d2c3d 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -349,18 +349,19 @@ same value."); * Cached interned string objects used for calling the profile and * trace functions. Initialized by trace_init(). */ -static PyObject *whatstrings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static PyObject *whatstrings[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static int trace_init(void) { - static const char * const whatnames[7] = { + static const char * const whatnames[8] = { "call", "exception", "line", "return", - "c_call", "c_exception", "c_return" + "c_call", "c_exception", "c_return", + "opcode" }; PyObject *name; int i; - for (i = 0; i < 7; ++i) { + for (i = 0; i < 8; ++i) { if (whatstrings[i] == NULL) { name = PyUnicode_InternFromString(whatnames[i]); if (name == NULL) From webhook-mailer at python.org Thu Sep 7 20:17:55 2017 From: webhook-mailer at python.org (Ned Deily) Date: Fri, 08 Sep 2017 00:17:55 -0000 Subject: [Python-checkins] bpo-31036: Allow sphinx and blurb to be found automatically (#3440) Message-ID: https://github.com/python/cpython/commit/590665c399fc4aa3c4a9f8e7104d43a02e9f3a0c commit: 590665c399fc4aa3c4a9f8e7104d43a02e9f3a0c branch: master author: Ned Deily committer: GitHub date: 2017-09-07T17:17:53-07:00 summary: bpo-31036: Allow sphinx and blurb to be found automatically (#3440) Rather than requiring the path to blurb and/or sphinx-build to be specified to the make rule, enhance the Doc/Makefile to look for each first in a virtual environment created by make venv and, if not found, look on the normal process PATH. This allows the Doc/Makefile to take advantage of an installed spinx-build or blurb and, thus, do the right thing most of the time. Also, make the directory for the venv be configurable and document the `make venv` target. files: M .gitignore M Doc/Makefile M Doc/README.rst diff --git a/.gitignore b/.gitignore index ea7abfe5599..59206541ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,9 @@ .gdb_history Doc/build/ Doc/venv/ +Doc/.venv/ +Doc/env/ +Doc/.env/ Include/pydtrace_probes.h Lib/distutils/command/*.pdb Lib/lib2to3/*.pickle diff --git a/Doc/Makefile b/Doc/Makefile index 63bbe1d4d71..307d1e0e7de 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -5,8 +5,9 @@ # You can set these variables from the command line. PYTHON = python3 -SPHINXBUILD = sphinx-build -BLURB = $(PYTHON) -m blurb +VENVDIR = ./venv +SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build +BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb PAPER = SOURCES = DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) @@ -118,11 +119,12 @@ htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" clean: - -rm -rf build/* venv/* + -rm -rf build/* $(VENVDIR)/* venv: - $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install -U Sphinx blurb + $(PYTHON) -m venv $(VENVDIR) + $(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb + @echo "The venv has been created in the $(VENVDIR) directory" dist: rm -rf dist @@ -168,7 +170,7 @@ dist: cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub check: - $(PYTHON) tools/rstlint.py -i tools -i venv -i README.rst + $(PYTHON) tools/rstlint.py -i tools -i $(VENVDIR) -i README.rst serve: ../Tools/scripts/serve.py build/html diff --git a/Doc/README.rst b/Doc/README.rst index 9156e7df672..a29d1f3a708 100644 --- a/Doc/README.rst +++ b/Doc/README.rst @@ -14,38 +14,46 @@ developers guide. Building the docs ================= -You need to have `Sphinx `_ installed; it is the toolset -used to build the docs. It is not included in this tree, but maintained -separately and `available from PyPI `_. +The documentation is built with several tools which are not included in this +tree but are maintained separately and are available from +`PyPI `_. + +* `Sphinx `_ +* `blurb `_ + +The easiest way to install these tools is to create a virtual environment and +install the tools into there. Using make ---------- -A Makefile has been prepared so that on Unix, provided you have installed -Sphinx, you can just run :: +To get started on UNIX, you can create a virtual environment with the command :: - make html + make venv -to build the HTML output files. - -On Windows, we try to emulate the Makefile as closely as possible with a -``make.bat`` file. +That will install all the tools necessary to build the documentation. Assuming +the virtual environment was created in the ``env`` directory (the default; +configurable with the VENVDIR variable), you can run the following command to +build the HTML output files:: -To use a Python interpreter that's not called ``python``, use the standard -way to set Makefile variables, using e.g. :: + make html - make html PYTHON=python3 +By default, if the virtual environment is not created, the Makefile will +look for instances of sphinxbuild and blurb installed on your process PATH +(configurable with the SPHINXBUILD and BLURB variables). -On Windows, set the PYTHON environment variable instead. - -To use a specific sphinx-build (something other than ``sphinx-build``), set -the SPHINXBUILD variable. +On Windows, we try to emulate the Makefile as closely as possible with a +``make.bat`` file. If you need to specify the Python interpreter to use, +set the PYTHON environment variable instead. Available make targets are: * "clean", which removes all build files. +* "venv", which creates a virtual environment with all necessary tools + installed. + * "html", which builds standalone HTML files for offline viewing. * "htmlview", which re-uses the "html" builder, but then opens the main page @@ -96,7 +104,7 @@ Available make targets are: Without make ------------ -Install the Sphinx package and its dependencies from PyPI. +First, install the tool dependencies from PyPI. Then, from the ``Doc`` directory, run :: @@ -112,8 +120,7 @@ Contributing Bugs in the content should be reported to the `Python bug tracker `_. -Bugs in the toolset should be reported in the -`Sphinx bug tracker `_. +Bugs in the toolset should be reported to the tools themselves. You can also send a mail to the Python Documentation Team at docs at python.org, and we will process your request as soon as possible. From webhook-mailer at python.org Thu Sep 7 20:38:34 2017 From: webhook-mailer at python.org (Ned Deily) Date: Fri, 08 Sep 2017 00:38:34 -0000 Subject: [Python-checkins] [3.6] bpo-31036: Allow sphinx and blurb to be found automatically (GH-3440) (#3441) Message-ID: https://github.com/python/cpython/commit/645c1e421348790d49eab863279a41cb2b6a007a commit: 645c1e421348790d49eab863279a41cb2b6a007a branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Ned Deily date: 2017-09-07T17:38:31-07:00 summary: [3.6] bpo-31036: Allow sphinx and blurb to be found automatically (GH-3440) (#3441) Rather than requiring the path to blurb and/or sphinx-build to be specified to the make rule, enhance the Doc/Makefile to look for each first in a virtual environment created by make venv and, if not found, look on the normal process PATH. This allows the Doc/Makefile to take advantage of an installed spinx-build or blurb and, thus, do the right thing most of the time. Also, make the directory for the venv be configurable and document the `make venv` target. (cherry picked from commit 590665c399fc4aa3c4a9f8e7104d43a02e9f3a0c) files: M .gitignore M Doc/Makefile M Doc/README.rst diff --git a/.gitignore b/.gitignore index bb5b13bf754..81f31989c55 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ .gdb_history Doc/build/ Doc/venv/ +Doc/.venv/ +Doc/env/ +Doc/.env/ Include/pydtrace_probes.h Lib/distutils/command/*.pdb Lib/lib2to3/*.pickle diff --git a/Doc/Makefile b/Doc/Makefile index 63bbe1d4d71..307d1e0e7de 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -5,8 +5,9 @@ # You can set these variables from the command line. PYTHON = python3 -SPHINXBUILD = sphinx-build -BLURB = $(PYTHON) -m blurb +VENVDIR = ./venv +SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build +BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb PAPER = SOURCES = DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) @@ -118,11 +119,12 @@ htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" clean: - -rm -rf build/* venv/* + -rm -rf build/* $(VENVDIR)/* venv: - $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install -U Sphinx blurb + $(PYTHON) -m venv $(VENVDIR) + $(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb + @echo "The venv has been created in the $(VENVDIR) directory" dist: rm -rf dist @@ -168,7 +170,7 @@ dist: cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub check: - $(PYTHON) tools/rstlint.py -i tools -i venv -i README.rst + $(PYTHON) tools/rstlint.py -i tools -i $(VENVDIR) -i README.rst serve: ../Tools/scripts/serve.py build/html diff --git a/Doc/README.rst b/Doc/README.rst index 9156e7df672..a29d1f3a708 100644 --- a/Doc/README.rst +++ b/Doc/README.rst @@ -14,38 +14,46 @@ developers guide. Building the docs ================= -You need to have `Sphinx `_ installed; it is the toolset -used to build the docs. It is not included in this tree, but maintained -separately and `available from PyPI `_. +The documentation is built with several tools which are not included in this +tree but are maintained separately and are available from +`PyPI `_. + +* `Sphinx `_ +* `blurb `_ + +The easiest way to install these tools is to create a virtual environment and +install the tools into there. Using make ---------- -A Makefile has been prepared so that on Unix, provided you have installed -Sphinx, you can just run :: +To get started on UNIX, you can create a virtual environment with the command :: - make html + make venv -to build the HTML output files. - -On Windows, we try to emulate the Makefile as closely as possible with a -``make.bat`` file. +That will install all the tools necessary to build the documentation. Assuming +the virtual environment was created in the ``env`` directory (the default; +configurable with the VENVDIR variable), you can run the following command to +build the HTML output files:: -To use a Python interpreter that's not called ``python``, use the standard -way to set Makefile variables, using e.g. :: + make html - make html PYTHON=python3 +By default, if the virtual environment is not created, the Makefile will +look for instances of sphinxbuild and blurb installed on your process PATH +(configurable with the SPHINXBUILD and BLURB variables). -On Windows, set the PYTHON environment variable instead. - -To use a specific sphinx-build (something other than ``sphinx-build``), set -the SPHINXBUILD variable. +On Windows, we try to emulate the Makefile as closely as possible with a +``make.bat`` file. If you need to specify the Python interpreter to use, +set the PYTHON environment variable instead. Available make targets are: * "clean", which removes all build files. +* "venv", which creates a virtual environment with all necessary tools + installed. + * "html", which builds standalone HTML files for offline viewing. * "htmlview", which re-uses the "html" builder, but then opens the main page @@ -96,7 +104,7 @@ Available make targets are: Without make ------------ -Install the Sphinx package and its dependencies from PyPI. +First, install the tool dependencies from PyPI. Then, from the ``Doc`` directory, run :: @@ -112,8 +120,7 @@ Contributing Bugs in the content should be reported to the `Python bug tracker `_. -Bugs in the toolset should be reported in the -`Sphinx bug tracker `_. +Bugs in the toolset should be reported to the tools themselves. You can also send a mail to the Python Documentation Team at docs at python.org, and we will process your request as soon as possible. From webhook-mailer at python.org Thu Sep 7 21:06:26 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 08 Sep 2017 01:06:26 -0000 Subject: [Python-checkins] optimize all_name_chars (#3442) Message-ID: https://github.com/python/cpython/commit/9020ac7cce97dddad51b285fffc31fe4ddf60898 commit: 9020ac7cce97dddad51b285fffc31fe4ddf60898 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-07T18:06:23-07:00 summary: optimize all_name_chars (#3442) Remove redundant PyUnicode_Check call. Use a static table for checking chars. files: M Objects/codeobject.c diff --git a/Objects/codeobject.c b/Objects/codeobject.c index de8d16ce08a..be2d7b22db7 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -4,9 +4,6 @@ #include "code.h" #include "structmember.h" -#define NAME_CHARS \ - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" - /* Holder for co_extra information */ typedef struct { Py_ssize_t ce_size; @@ -18,23 +15,26 @@ typedef struct { static int all_name_chars(PyObject *o) { - static char ok_name_char[256]; - static const unsigned char *name_chars = (unsigned char *)NAME_CHARS; + /* [a-zA-Z0-9_] */ + static const bool ok_name_char[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 + }; const unsigned char *s, *e; - if (!PyUnicode_Check(o) || PyUnicode_READY(o) == -1 || - !PyUnicode_IS_ASCII(o)) + if (PyUnicode_READY(o) == -1 || !PyUnicode_IS_ASCII(o)) return 0; - if (ok_name_char[*name_chars] == 0) { - const unsigned char *p; - for (p = name_chars; *p; p++) - ok_name_char[*p] = 1; - } s = PyUnicode_1BYTE_DATA(o); e = s + PyUnicode_GET_LENGTH(o); - while (s != e) { - if (ok_name_char[*s++] == 0) + for (; s != e; s++) { + if (!ok_name_char[*s]) return 0; } return 1; From webhook-mailer at python.org Thu Sep 7 21:07:02 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 01:07:02 -0000 Subject: [Python-checkins] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (#1363) Message-ID: https://github.com/python/cpython/commit/cb5b68abdeb1b1d56c581d5b4d647018703d61e3 commit: cb5b68abdeb1b1d56c581d5b4d647018703d61e3 branch: master author: Christian Heimes committer: GitHub date: 2017-09-07T18:07:00-07:00 summary: bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (#1363) * bpo-29136: Add TLS 1.3 support TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3 cipher suites don't overlap with cipher suites from TLS 1.2 and earlier. Since Python sets its own set of permitted ciphers, TLS 1.3 handshake will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common AES-GCM and ChaCha20 suites. Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3 now. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst M Doc/library/ssl.rst M Lib/ssl.py M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 69bea1ed4a0..031c3618bef 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -193,11 +193,11 @@ instead. .. table:: ======================== ============ ============ ============= ========= =========== =========== - *client* / **server** **SSLv2** **SSLv3** **TLS** **TLSv1** **TLSv1.1** **TLSv1.2** + *client* / **server** **SSLv2** **SSLv3** **TLS** [3]_ **TLSv1** **TLSv1.1** **TLSv1.2** ------------------------ ------------ ------------ ------------- --------- ----------- ----------- *SSLv2* yes no no [1]_ no no no *SSLv3* no yes no [2]_ no no no - *TLS* (*SSLv23*) no [1]_ no [2]_ yes yes yes yes + *TLS* (*SSLv23*) [3]_ no [1]_ no [2]_ yes yes yes yes *TLSv1* no no yes yes no no *TLSv1.1* no no yes no yes no *TLSv1.2* no no yes no no yes @@ -206,6 +206,9 @@ instead. .. rubric:: Footnotes .. [1] :class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default. .. [2] :class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default. + .. [3] TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in + OpenSSL >= 1.1.1. There is no dedicated PROTOCOL constant for just + TLS 1.3. .. note:: @@ -294,6 +297,11 @@ purposes. 3DES was dropped from the default cipher string. + .. versionchanged:: 3.7 + + TLS 1.3 cipher suites TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, + and TLS_CHACHA20_POLY1305_SHA256 were added to the default cipher string. + Random generation ^^^^^^^^^^^^^^^^^ @@ -764,6 +772,16 @@ Constants .. versionadded:: 3.4 +.. data:: OP_NO_TLSv1_3 + + Prevents a TLSv1.3 connection. This option is only applicable in conjunction + with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as + the protocol version. TLS 1.3 is available with OpenSSL 1.1.1 or later. + When Python has been compiled against an older version of OpenSSL, the + flag defaults to *0*. + + .. versionadded:: 3.7 + .. data:: OP_CIPHER_SERVER_PREFERENCE Use the server's cipher ordering preference, rather than the client's. @@ -838,6 +856,12 @@ Constants .. versionadded:: 3.3 +.. data:: HAS_TLSv1_3 + + Whether the OpenSSL library has built-in support for the TLS 1.3 protocol. + + .. versionadded:: 3.7 + .. data:: CHANNEL_BINDING_TYPES List of supported TLS channel binding types. Strings in this list diff --git a/Lib/ssl.py b/Lib/ssl.py index 7a574dcb2b1..1f3a31a9b79 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -115,7 +115,7 @@ pass -from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN +from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN, HAS_TLSv1_3 from _ssl import _OPENSSL_API_VERSION @@ -178,6 +178,7 @@ # (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') # Enable a better set of ciphers by default # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -189,6 +190,8 @@ # * Disable NULL authentication, NULL encryption, 3DES and MD5 MACs # for security reasons _DEFAULT_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!3DES' @@ -196,6 +199,7 @@ # Restricted and more secure ciphers for the server side # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -206,6 +210,8 @@ # * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, RC4, and # 3DES for security reasons _RESTRICTED_SERVER_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DES' diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 747661bc6d0..fe9f6939d33 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -170,6 +170,13 @@ def test_constants(self): ssl.OP_NO_COMPRESSION self.assertIn(ssl.HAS_SNI, {True, False}) self.assertIn(ssl.HAS_ECDH, {True, False}) + ssl.OP_NO_SSLv2 + ssl.OP_NO_SSLv3 + ssl.OP_NO_TLSv1 + ssl.OP_NO_TLSv1_3 + if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1): + ssl.OP_NO_TLSv1_1 + ssl.OP_NO_TLSv1_2 def test_str_for_enums(self): # Make sure that the PROTOCOL_* constants have enum-like string @@ -3098,12 +3105,33 @@ def test_version_basic(self): self.assertEqual(s.version(), 'TLSv1') self.assertIs(s.version(), None) + @unittest.skipUnless(ssl.HAS_TLSv1_3, + "test requires TLSv1.3 enabled OpenSSL") + def test_tls1_3(self): + context = ssl.SSLContext(ssl.PROTOCOL_TLS) + context.load_cert_chain(CERTFILE) + # disable all but TLS 1.3 + context.options |= ( + ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2 + ) + with ThreadedEchoServer(context=context) as server: + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + self.assertIn(s.cipher()[0], [ + 'TLS13-AES-256-GCM-SHA384', + 'TLS13-CHACHA20-POLY1305-SHA256', + 'TLS13-AES-128-GCM-SHA256', + ]) + @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") def test_default_ecdh_curve(self): # Issue #21015: elliptic curve-based Diffie Hellman key exchange # should be enabled by default on SSL contexts. context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain(CERTFILE) + # TLSv1.3 defaults to PFS key agreement and no longer has KEA in + # cipher name. + context.options |= ssl.OP_NO_TLSv1_3 # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled # explicitly using the 'ECCdraft' cipher alias. Otherwise, # our default cipher list should prefer ECDH-based ciphers @@ -3532,6 +3560,10 @@ def test_session_handling(self): context2.load_verify_locations(CERTFILE) context2.load_cert_chain(CERTFILE) + # TODO: session reuse does not work with TLS 1.3 + context.options |= ssl.OP_NO_TLSv1_3 + context2.options |= ssl.OP_NO_TLSv1_3 + server = ThreadedEchoServer(context=context, chatty=False) with server: with context.wrap_socket(socket.socket()) as s: diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst new file mode 100644 index 00000000000..e76997ef836 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst @@ -0,0 +1 @@ +Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5ea354a60aa..f7379257956 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5350,6 +5350,11 @@ PyInit__ssl(void) PyModule_AddIntConstant(m, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1); PyModule_AddIntConstant(m, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2); #endif +#ifdef SSL_OP_NO_TLSv1_3 + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", SSL_OP_NO_TLSv1_3); +#else + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", 0); +#endif PyModule_AddIntConstant(m, "OP_CIPHER_SERVER_PREFERENCE", SSL_OP_CIPHER_SERVER_PREFERENCE); PyModule_AddIntConstant(m, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE); @@ -5398,6 +5403,14 @@ PyInit__ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ALPN", r); +#if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3) + r = Py_True; +#else + r = Py_False; +#endif + Py_INCREF(r); + PyModule_AddObject(m, "HAS_TLSv1_3", r); + /* Mappings for error codes */ err_codes_to_names = PyDict_New(); err_names_to_codes = PyDict_New(); From webhook-mailer at python.org Thu Sep 7 21:17:41 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 08 Sep 2017 01:17:41 -0000 Subject: [Python-checkins] [3.6] bpo-30640: Fix undefined behavior in _PyFunction_FastCallDict() and PyEval_EvalCodeEx() (GH-2919) (#2964) Message-ID: https://github.com/python/cpython/commit/f032e9237aa7d43d21e0b04d685c36bddf7078c1 commit: f032e9237aa7d43d21e0b04d685c36bddf7078c1 branch: 3.6 author: Zackery Spytz committer: Victor Stinner date: 2017-09-08T03:17:38+02:00 summary: [3.6] bpo-30640: Fix undefined behavior in _PyFunction_FastCallDict() and PyEval_EvalCodeEx() (GH-2919) (#2964) k + 1 was calculated with k = NULL.. (cherry picked from commit c6ea8974e2d939223bfd6d64ee13ec89c090d2e0) files: M Python/ceval.c diff --git a/Python/ceval.c b/Python/ceval.c index 8eb78bf4d46..4aa3250cd0b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4171,7 +4171,8 @@ PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals, { return _PyEval_EvalCodeWithName(_co, globals, locals, args, argcount, - kws, kws + 1, kwcount, 2, + kws, kws != NULL ? kws + 1 : NULL, + kwcount, 2, defs, defcount, kwdefs, closure, NULL, NULL); @@ -5053,7 +5054,7 @@ _PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, args, nargs, - k, k + 1, nk, 2, + k, k != NULL ? k + 1 : NULL, nk, 2, d, nd, kwdefs, closure, name, qualname); Py_XDECREF(kwtuple); From webhook-mailer at python.org Thu Sep 7 21:56:11 2017 From: webhook-mailer at python.org (Xiang Zhang) Date: Fri, 08 Sep 2017 01:56:11 -0000 Subject: [Python-checkins] bpo-31379: Added $(RUNSHARED) to run_profile_task (#3422) Message-ID: https://github.com/python/cpython/commit/7dcea4c8769e4f12197646922f399a699c3e2a5a commit: 7dcea4c8769e4f12197646922f399a699c3e2a5a branch: 2.7 author: Xiang Zhang committer: GitHub date: 2017-09-08T09:56:06+08:00 summary: bpo-31379: Added $(RUNSHARED) to run_profile_task (#3422) files: M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index d0bb4c1d0e8..16afd9cebe4 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -428,7 +428,7 @@ build_all_generate_profile: run_profile_task: : # FIXME: can't run for a cross build - $(LLVM_PROF_FILE) ./$(BUILDPYTHON) $(PROFILE_TASK) || true + $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true build_all_merge_profile: $(LLVM_PROF_MERGER) From webhook-mailer at python.org Thu Sep 7 23:10:32 2017 From: webhook-mailer at python.org (Steve Dower) Date: Fri, 08 Sep 2017 03:10:32 -0000 Subject: [Python-checkins] Updates PCBuild/readme.txt (#3418) Message-ID: https://github.com/python/cpython/commit/bab21faded31c70b142776b9a6075a4cda055d7f commit: bab21faded31c70b142776b9a6075a4cda055d7f branch: master author: Steve Dower committer: GitHub date: 2017-09-07T20:10:29-07:00 summary: Updates PCBuild/readme.txt (#3418) files: M PCbuild/readme.txt diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 316475f5a9c..b806f336b8a 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -1,11 +1,12 @@ Quick Start Guide ----------------- -1. Install Microsoft Visual Studio 2015, any edition. +1. Install Microsoft Visual Studio 2017 with Python workload and + Python native development component. 1a. Optionally install Python 3.6 or later. If not installed, - get_externals.bat (build.bat -e) will download and use Python via + get_externals.bat (via build.bat) will download and use Python via NuGet. -2. Run "build.bat -e" to build Python in 32-bit Release configuration. +2. Run "build.bat" to build Python in 32-bit Release configuration. 3. (Optional, but recommended) Run the test suite with "rt.bat -q". @@ -15,29 +16,14 @@ Building Python using Microsoft Visual C++ This directory is used to build CPython for Microsoft Windows NT version 6.0 or higher (Windows Vista, Windows Server 2008, or later) on 32 and 64 bit platforms. Using this directory requires an installation of -Microsoft Visual C++ 2015 (MSVC 14.0) of any edition. The specific -requirements are as follows: - -Visual Studio Express 2015 for Desktop -Visual Studio Professional 2015 - Either edition is sufficient for building all configurations except - for Profile Guided Optimization. - The Python build solution pcbuild.sln makes use of Solution Folders, - which this edition does not support. Any time pcbuild.sln is opened - or reloaded by Visual Studio, a warning about Solution Folders will - be displayed, which can be safely dismissed with no impact on your - ability to build Python. - Required for building 64-bit Debug and Release configuration builds -Visual Studio Premium 2015 - Required for building Release configuration builds that make use of - Profile Guided Optimization (PGO), on either platform. - -All you need to do to build is open the solution "pcbuild.sln" in Visual -Studio, select the desired combination of configuration and platform, -then build with "Build Solution". You can also build from the command -line using the "build.bat" script in this directory; see below for -details. The solution is configured to build the projects in the correct -order. +Microsoft Visual Studio 2017 (MSVC 14.1) with the *Python workload* and +its optional *Python native development* component selected. (For +command-line builds, Visual Studio 2015 may also be used.) + +Building from the command line is recommended in order to obtain any +external dependencies. To build, simply run the "build.bat" script without +any arguments. After this succeeds, you can open the "pcbuild.sln" +solution in Visual Studio to continue development. The solution currently supports two platforms. The Win32 platform is used to build standard x86-compatible 32-bit binaries, output into the @@ -71,8 +57,8 @@ Building Python using the build.bat script In this directory you can find build.bat, a script designed to make building Python on Windows simpler. This script will use the env.bat -script to detect one of Visual Studio 2015, 2013, 2012, or 2010, any of -which may be used to build Python, though only Visual Studio 2015 is +script to detect either Visual Studio 2017 or 2015, either of +which may be used to build Python. Currently Visual Studio 2017 is officially supported. By default, build.bat will build Python in Release configuration for @@ -83,13 +69,14 @@ this behavior, try `build.bat -h` to learn more. C Runtime --------- -Visual Studio 2015 uses version 14 of the C runtime (MSVCRT14). The -executables no longer use the "Side by Side" assemblies used in previous -versions of the compiler. This simplifies distribution of applications. +Visual Studio 2017 uses version 14.0 of the C runtime (vcruntime140). +The executables no longer use the "Side by Side" assemblies used in +previous versions of the compiler. This simplifies distribution of +applications. -The run time libraries are available under the VC/Redist folder of your +The run time libraries are available under the redist folder of your Visual Studio distribution. For more info, see the Readme in the -VC/Redist folder. +redist folder. Sub-Projects @@ -129,6 +116,8 @@ categories: _freeze_importlib _freeze_importlib.exe, used to regenerate Python\importlib.h after changes have been made to Lib\importlib\_bootstrap.py +pyshellext + pyshellext.dll, the shell extension deployed with the launcher python3dll python3.dll, the PEP 384 Stable ABI dll xxlimited @@ -138,6 +127,7 @@ xxlimited The following sub-projects are for individual modules of the standard library which are implemented in C; each one builds a DLL (renamed to .pyd) of the same name as the project: +_asyncio _ctypes _ctypes_test _decimal @@ -147,9 +137,12 @@ _msi _multiprocessing _overlapped _socket -_testcapi _testbuffer +_testcapi +_testconsole _testimportmultiple +_testmultiphase +_tkinter pyexpat select unicodedata @@ -171,62 +164,47 @@ _lzma http://tukaani.org/xz/ _ssl Python wrapper for version 1.0.2k of the OpenSSL secure sockets - library, which is built by ssl.vcxproj + library, which is downloaded from our binaries repository at + https://github.com/python/cpython-bin-deps. + Homepage: http://www.openssl.org/ - Building OpenSSL requires nasm.exe (the Netwide Assembler), version - 2.10 or newer from - http://www.nasm.us/ - to be somewhere on your PATH. More recent versions of OpenSSL may - need a later version of NASM. If OpenSSL's self tests don't pass, - you should first try to update NASM and do a full rebuild of - OpenSSL. If you use the PCbuild\get_externals.bat method - for getting sources, it also downloads a version of NASM which the - libeay/ssleay sub-projects use. - - The libeay/ssleay sub-projects expect your OpenSSL sources to have - already been configured and be ready to build. If you get your sources - from svn.python.org as suggested in the "Getting External Sources" - section below, the OpenSSL source will already be ready to go. If - you want to build a different version, you will need to run - - PCbuild\prepare_ssl.py path\to\openssl-source-dir - - That script will prepare your OpenSSL sources in the same way that - those available on svn.python.org have been prepared. Note that - Perl must be installed and available on your PATH to configure - OpenSSL. ActivePerl is recommended and is available from - http://www.activestate.com/activeperl/ - - The libeay and ssleay sub-projects will build the modules of OpenSSL - required by _ssl and _hashlib and may need to be manually updated when - upgrading to a newer version of OpenSSL or when adding new - functionality to _ssl or _hashlib. They will not clean up their output - with the normal Clean target; CleanAll should be used instead. + Building OpenSSL requires Perl on your path, and can be performed by + running PCbuild\prepare_ssl.bat. This will retrieve the version of + the sources matched to the current commit from the OpenSSL branch + in our source repository at + https://github.com/python/cpython-source-deps. + + To use an alternative build of OpenSSL completely, you should replace + the files in the externals/openssl-bin- folder with your own. + As long as this folder exists, its contents will not be downloaded + again when building. + _sqlite3 Wraps SQLite 3.14.2.0, which is itself built by sqlite3.vcxproj Homepage: http://www.sqlite.org/ _tkinter - Wraps version 8.6.6 of the Tk windowing system. + Wraps version 8.6.6 of the Tk windowing system, which is downloaded + from our binaries repository at + https://github.com/python/cpython-bin-deps. + Homepage: http://www.tcl.tk/ - Tkinter's dependencies are built by the tcl.vcxproj and tk.vcxproj - projects. The tix.vcxproj project also builds the Tix extended - widget set for use with Tkinter. + Building Tcl and Tk can be performed by running + PCbuild\prepare_tcltk.bat. This will retrieve the version of the + sources matched to the current commit from the Tcl and Tk branches + in our source repository at + https://github.com/python/cpython-source-deps. - Those three projects install their respective components in a + The two projects install their respective components in a directory alongside the source directories called "tcltk" on Win32 and "tcltk64" on x64. They also copy the Tcl and Tk DLLs into the current output directory, which should ensure that Tkinter is able to load Tcl/Tk without having to change your PATH. - The tcl, tk, and tix sub-projects do not clean their builds with - the normal Clean target; if you need to rebuild, you should use the - CleanAll target or manually delete their builds. - Getting External Sources ------------------------ @@ -254,8 +232,8 @@ as the values of certain properties in order for the build solution to find them. This is an advanced topic and not necessarily fully supported. -The get_externals.bat script is called automatically by build.bat when -you pass the '-e' option to it. +The get_externals.bat script is called automatically by build.bat +unless you pass the '-E' option. Profile Guided Optimization @@ -298,7 +276,7 @@ carefully modified by hand. The property files used are: * python (versions, directories and build names) * pyproject (base settings for all projects) - * openssl (used by libeay and ssleay projects) + * openssl (used by projects dependent upon OpenSSL) * tcltk (used by _tkinter, tcl, tk and tix projects) The pyproject property file defines all of the build settings for each From webhook-mailer at python.org Thu Sep 7 23:23:55 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 03:23:55 -0000 Subject: [Python-checkins] [3.6] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3444) Message-ID: https://github.com/python/cpython/commit/9f2b3d4c2899f9caea2e47063061a76e460ac618 commit: 9f2b3d4c2899f9caea2e47063061a76e460ac618 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-07T20:23:52-07:00 summary: [3.6] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3444) * bpo-29136: Add TLS 1.3 support TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3 cipher suites don't overlap with cipher suites from TLS 1.2 and earlier. Since Python sets its own set of permitted ciphers, TLS 1.3 handshake will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common AES-GCM and ChaCha20 suites. Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3 now. Signed-off-by: Christian Heimes . (cherry picked from commit cb5b68abdeb1b1d56c581d5b4d647018703d61e3) files: A Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst M Doc/library/ssl.rst M Lib/ssl.py M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 0f09b3f0662..f19526b5406 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -193,11 +193,11 @@ instead. .. table:: ======================== ============ ============ ============= ========= =========== =========== - *client* / **server** **SSLv2** **SSLv3** **TLS** **TLSv1** **TLSv1.1** **TLSv1.2** + *client* / **server** **SSLv2** **SSLv3** **TLS** [3]_ **TLSv1** **TLSv1.1** **TLSv1.2** ------------------------ ------------ ------------ ------------- --------- ----------- ----------- *SSLv2* yes no no [1]_ no no no *SSLv3* no yes no [2]_ no no no - *TLS* (*SSLv23*) no [1]_ no [2]_ yes yes yes yes + *TLS* (*SSLv23*) [3]_ no [1]_ no [2]_ yes yes yes yes *TLSv1* no no yes yes no no *TLSv1.1* no no yes no yes no *TLSv1.2* no no yes no no yes @@ -206,6 +206,9 @@ instead. .. rubric:: Footnotes .. [1] :class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default. .. [2] :class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default. + .. [3] TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in + OpenSSL >= 1.1.1. There is no dedicated PROTOCOL constant for just + TLS 1.3. .. note:: @@ -294,6 +297,11 @@ purposes. 3DES was dropped from the default cipher string. + .. versionchanged:: 3.7 + + TLS 1.3 cipher suites TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, + and TLS_CHACHA20_POLY1305_SHA256 were added to the default cipher string. + Random generation ^^^^^^^^^^^^^^^^^ @@ -760,6 +768,16 @@ Constants .. versionadded:: 3.4 +.. data:: OP_NO_TLSv1_3 + + Prevents a TLSv1.3 connection. This option is only applicable in conjunction + with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as + the protocol version. TLS 1.3 is available with OpenSSL 1.1.1 or later. + When Python has been compiled against an older version of OpenSSL, the + flag defaults to *0*. + + .. versionadded:: 3.7 + .. data:: OP_CIPHER_SERVER_PREFERENCE Use the server's cipher ordering preference, rather than the client's. @@ -834,6 +852,12 @@ Constants .. versionadded:: 3.3 +.. data:: HAS_TLSv1_3 + + Whether the OpenSSL library has built-in support for the TLS 1.3 protocol. + + .. versionadded:: 3.7 + .. data:: CHANNEL_BINDING_TYPES List of supported TLS channel binding types. Strings in this list diff --git a/Lib/ssl.py b/Lib/ssl.py index 7a574dcb2b1..1f3a31a9b79 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -115,7 +115,7 @@ pass -from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN +from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN, HAS_TLSv1_3 from _ssl import _OPENSSL_API_VERSION @@ -178,6 +178,7 @@ # (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') # Enable a better set of ciphers by default # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -189,6 +190,8 @@ # * Disable NULL authentication, NULL encryption, 3DES and MD5 MACs # for security reasons _DEFAULT_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!3DES' @@ -196,6 +199,7 @@ # Restricted and more secure ciphers for the server side # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -206,6 +210,8 @@ # * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, RC4, and # 3DES for security reasons _RESTRICTED_SERVER_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DES' diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 157e6ced01b..e001badad17 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -176,6 +176,13 @@ def test_constants(self): ssl.OP_NO_COMPRESSION self.assertIn(ssl.HAS_SNI, {True, False}) self.assertIn(ssl.HAS_ECDH, {True, False}) + ssl.OP_NO_SSLv2 + ssl.OP_NO_SSLv3 + ssl.OP_NO_TLSv1 + ssl.OP_NO_TLSv1_3 + if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1): + ssl.OP_NO_TLSv1_1 + ssl.OP_NO_TLSv1_2 def test_str_for_enums(self): # Make sure that the PROTOCOL_* constants have enum-like string @@ -3091,12 +3098,33 @@ def test_version_basic(self): self.assertEqual(s.version(), 'TLSv1') self.assertIs(s.version(), None) + @unittest.skipUnless(ssl.HAS_TLSv1_3, + "test requires TLSv1.3 enabled OpenSSL") + def test_tls1_3(self): + context = ssl.SSLContext(ssl.PROTOCOL_TLS) + context.load_cert_chain(CERTFILE) + # disable all but TLS 1.3 + context.options |= ( + ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2 + ) + with ThreadedEchoServer(context=context) as server: + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + self.assertIn(s.cipher()[0], [ + 'TLS13-AES-256-GCM-SHA384', + 'TLS13-CHACHA20-POLY1305-SHA256', + 'TLS13-AES-128-GCM-SHA256', + ]) + @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") def test_default_ecdh_curve(self): # Issue #21015: elliptic curve-based Diffie Hellman key exchange # should be enabled by default on SSL contexts. context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) context.load_cert_chain(CERTFILE) + # TLSv1.3 defaults to PFS key agreement and no longer has KEA in + # cipher name. + context.options |= ssl.OP_NO_TLSv1_3 # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled # explicitly using the 'ECCdraft' cipher alias. Otherwise, # our default cipher list should prefer ECDH-based ciphers @@ -3525,6 +3553,10 @@ def test_session_handling(self): context2.load_verify_locations(CERTFILE) context2.load_cert_chain(CERTFILE) + # TODO: session reuse does not work with TLS 1.3 + context.options |= ssl.OP_NO_TLSv1_3 + context2.options |= ssl.OP_NO_TLSv1_3 + server = ThreadedEchoServer(context=context, chatty=False) with server: with context.wrap_socket(socket.socket()) as s: diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst new file mode 100644 index 00000000000..e76997ef836 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst @@ -0,0 +1 @@ +Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index ab30d212b9d..a28a6e00660 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5363,6 +5363,11 @@ PyInit__ssl(void) PyModule_AddIntConstant(m, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1); PyModule_AddIntConstant(m, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2); #endif +#ifdef SSL_OP_NO_TLSv1_3 + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", SSL_OP_NO_TLSv1_3); +#else + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", 0); +#endif PyModule_AddIntConstant(m, "OP_CIPHER_SERVER_PREFERENCE", SSL_OP_CIPHER_SERVER_PREFERENCE); PyModule_AddIntConstant(m, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE); @@ -5411,6 +5416,14 @@ PyInit__ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ALPN", r); +#if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3) + r = Py_True; +#else + r = Py_False; +#endif + Py_INCREF(r); + PyModule_AddObject(m, "HAS_TLSv1_3", r); + /* Mappings for error codes */ err_codes_to_names = PyDict_New(); err_names_to_codes = PyDict_New(); From webhook-mailer at python.org Fri Sep 8 01:31:20 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 05:31:20 -0000 Subject: [Python-checkins] [2.7] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3446) Message-ID: https://github.com/python/cpython/commit/b9a860f3bf80b0d4a6c25d0f2f6ef849d9bf3594 commit: b9a860f3bf80b0d4a6c25d0f2f6ef849d9bf3594 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-07T22:31:17-07:00 summary: [2.7] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3 (GH-1363) (#3446) * bpo-29136: Add TLS 1.3 support TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3 cipher suites don't overlap with cipher suites from TLS 1.2 and earlier. Since Python sets its own set of permitted ciphers, TLS 1.3 handshake will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common AES-GCM and ChaCha20 suites. Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3 now. Signed-off-by: Christian Heimes . (cherry picked from commit cb5b68abdeb1b1d56c581d5b4d647018703d61e3) files: A Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst M Doc/library/ssl.rst M Lib/ssl.py M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 36beb1777cf..288b2914a25 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -192,12 +192,17 @@ instead. ------------------------ --------- --------- ---------- --------- ----------- ----------- *SSLv2* yes no yes no no no *SSLv3* no yes yes no no no - *SSLv23* no yes yes yes yes yes + *SSLv23* [1]_ no yes yes yes yes yes *TLSv1* no no yes yes no no *TLSv1.1* no no yes no yes no *TLSv1.2* no no yes no no yes ======================== ========= ========= ========== ========= =========== =========== + .. rubric:: Footnotes + .. [1] TLS 1.3 protocol will be available with :data:`PROTOCOL_SSLv23` in + OpenSSL >= 1.1.1. There is no dedicated PROTOCOL constant for just + TLS 1.3. + .. note:: Which connections succeed will vary depending on the version of @@ -286,6 +291,11 @@ purposes. 3DES was dropped from the default cipher string. + .. versionchanged:: 2.7.15 + + TLS 1.3 cipher suites TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, + and TLS_CHACHA20_POLY1305_SHA256 were added to the default cipher string. + .. function:: _https_verify_certificates(enable=True) Specifies whether or not server certificates are verified when creating @@ -701,6 +711,16 @@ Constants .. versionadded:: 2.7.9 +.. data:: OP_NO_TLSv1_3 + + Prevents a TLSv1.3 connection. This option is only applicable in conjunction + with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as + the protocol version. TLS 1.3 is available with OpenSSL 1.1.1 or later. + When Python has been compiled against an older version of OpenSSL, the + flag defaults to *0*. + + .. versionadded:: 2.7.15 + .. data:: OP_CIPHER_SERVER_PREFERENCE Use the server's cipher ordering preference, rather than the client's. @@ -765,6 +785,12 @@ Constants .. versionadded:: 2.7.9 +.. data:: HAS_TLSv1_3 + + Whether the OpenSSL library has built-in support for the TLS 1.3 protocol. + + .. versionadded:: 2.7.15 + .. data:: CHANNEL_BINDING_TYPES List of supported TLS channel binding types. Strings in this list diff --git a/Lib/ssl.py b/Lib/ssl.py index f28c863811f..22d478b5687 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -123,7 +123,7 @@ def _import_symbols(prefix): _import_symbols('PROTOCOL_') _import_symbols('VERIFY_') -from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN +from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN, HAS_TLSv1_3 from _ssl import _OPENSSL_API_VERSION @@ -157,6 +157,7 @@ def _import_symbols(prefix): # (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') # Enable a better set of ciphers by default # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -168,6 +169,8 @@ def _import_symbols(prefix): # * Disable NULL authentication, NULL encryption, 3DES and MD5 MACs # for security reasons _DEFAULT_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!3DES' @@ -175,6 +178,7 @@ def _import_symbols(prefix): # Restricted and more secure ciphers for the server side # This list has been explicitly chosen to: +# * TLS 1.3 ChaCha20 and AES-GCM cipher suites # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE) # * Prefer ECDHE over DHE for better performance # * Prefer AEAD over CBC for better performance and security @@ -185,6 +189,8 @@ def _import_symbols(prefix): # * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, RC4, and # 3DES for security reasons _RESTRICTED_SERVER_CIPHERS = ( + 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:' + 'TLS13-AES-128-GCM-SHA256:' 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:' 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:' '!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DES' diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index d9ef232580c..cfc03e343c7 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -168,6 +168,13 @@ def test_constants(self): ssl.OP_NO_COMPRESSION self.assertIn(ssl.HAS_SNI, {True, False}) self.assertIn(ssl.HAS_ECDH, {True, False}) + ssl.OP_NO_SSLv2 + ssl.OP_NO_SSLv3 + ssl.OP_NO_TLSv1 + ssl.OP_NO_TLSv1_3 + if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1): + ssl.OP_NO_TLSv1_1 + ssl.OP_NO_TLSv1_2 def test_random(self): v = ssl.RAND_status() @@ -2784,6 +2791,24 @@ def test_version_basic(self): self.assertEqual(s.version(), 'TLSv1') self.assertIs(s.version(), None) + @unittest.skipUnless(ssl.HAS_TLSv1_3, + "test requires TLSv1.3 enabled OpenSSL") + def test_tls1_3(self): + context = ssl.SSLContext(ssl.PROTOCOL_TLS) + context.load_cert_chain(CERTFILE) + # disable all but TLS 1.3 + context.options |= ( + ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2 + ) + with ThreadedEchoServer(context=context) as server: + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + self.assertIn(s.cipher()[0], [ + 'TLS13-AES-256-GCM-SHA384', + 'TLS13-CHACHA20-POLY1305-SHA256', + 'TLS13-AES-128-GCM-SHA256', + ]) + @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") def test_default_ecdh_curve(self): # Issue #21015: elliptic curve-based Diffie Hellman key exchange diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst new file mode 100644 index 00000000000..e76997ef836 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst @@ -0,0 +1 @@ +Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5b4cec203ad..f70af266731 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -4282,6 +4282,11 @@ init_ssl(void) PyModule_AddIntConstant(m, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1); PyModule_AddIntConstant(m, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2); #endif +#ifdef SSL_OP_NO_TLSv1_3 + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", SSL_OP_NO_TLSv1_3); +#else + PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", 0); +#endif PyModule_AddIntConstant(m, "OP_CIPHER_SERVER_PREFERENCE", SSL_OP_CIPHER_SERVER_PREFERENCE); PyModule_AddIntConstant(m, "OP_SINGLE_DH_USE", SSL_OP_SINGLE_DH_USE); @@ -4333,6 +4338,14 @@ init_ssl(void) Py_INCREF(r); PyModule_AddObject(m, "HAS_ALPN", r); +#if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3) + r = Py_True; +#else + r = Py_False; +#endif + Py_INCREF(r); + PyModule_AddObject(m, "HAS_TLSv1_3", r); + /* Mappings for error codes */ err_codes_to_names = PyDict_New(); err_names_to_codes = PyDict_New(); From webhook-mailer at python.org Fri Sep 8 01:51:32 2017 From: webhook-mailer at python.org (Eric Snow) Date: Fri, 08 Sep 2017 05:51:32 -0000 Subject: [Python-checkins] bpo-30860: Consolidate stateful runtime globals. (#3397) Message-ID: https://github.com/python/cpython/commit/2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 commit: 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 branch: master author: Eric Snow committer: GitHub date: 2017-09-07T23:51:28-06:00 summary: bpo-30860: Consolidate stateful runtime globals. (#3397) * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py). files: A Include/internal/ceval.h A Include/internal/condvar.h A Include/internal/gil.h A Include/internal/mem.h A Include/internal/pymalloc.h A Include/internal/pystate.h A Include/internal/warnings.h A Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst A Tools/c-globals/README A Tools/c-globals/check-c-globals.py A Tools/c-globals/ignored-globals.txt M Include/ceval.h M Include/object.h M Include/pylifecycle.h M Include/pystate.h M Makefile.pre.in M Modules/_functoolsmodule.c M Modules/_io/bufferedio.c M Modules/_json.c M Modules/_pickle.c M Modules/_threadmodule.c M Modules/_winapi.c M Modules/gcmodule.c M Modules/main.c M Modules/zipimport.c M Objects/abstract.c M Objects/bytearrayobject.c M Objects/bytesobject.c M Objects/call.c M Objects/cellobject.c M Objects/classobject.c M Objects/descrobject.c M Objects/dictobject.c M Objects/exceptions.c M Objects/frameobject.c M Objects/funcobject.c M Objects/genobject.c M Objects/iterobject.c M Objects/listobject.c M Objects/memoryobject.c M Objects/methodobject.c M Objects/moduleobject.c M Objects/object.c M Objects/obmalloc.c M Objects/odictobject.c M Objects/setobject.c M Objects/sliceobject.c M Objects/tupleobject.c M Objects/typeobject.c M Objects/unicodeobject.c M PC/pyconfig.h M PCbuild/pythoncore.vcxproj M PCbuild/pythoncore.vcxproj.filters M Parser/myreadline.c M Parser/pgenmain.c M Python/_warnings.c M Python/ceval.c M Python/ceval_gil.h M Python/codecs.c M Python/condvar.h M Python/dynload_shlib.c M Python/errors.c M Python/import.c M Python/pylifecycle.c M Python/pystate.c M Python/pythonrun.c M Python/symtable.c M Python/sysmodule.c M Python/thread.c M Python/thread_nt.h M Python/thread_pthread.h M Python/traceback.c diff --git a/Include/ceval.h b/Include/ceval.h index 2028a9ef5bc..c5ccf473c17 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -93,6 +93,11 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void); PyThreadState_GET()->overflowed = 0; \ } while(0) PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); +/* XXX _Py_CheckRecursionLimit should be changed to + _PyRuntime.ceval.check_recursion_limit. However, due to the macros + in which it's used, _Py_CheckRecursionLimit is stuck in the stable + ABI. It should be removed therefrom when possible. +*/ PyAPI_DATA(int) _Py_CheckRecursionLimit; #ifdef USE_STACKCHECK diff --git a/Include/internal/ceval.h b/Include/internal/ceval.h new file mode 100644 index 00000000000..57db9b1ebc7 --- /dev/null +++ b/Include/internal/ceval.h @@ -0,0 +1,53 @@ +#ifndef Py_INTERNAL_CEVAL_H +#define Py_INTERNAL_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pyatomic.h" +#include "pythread.h" + +struct _pending_calls { + unsigned long main_thread; + PyThread_type_lock lock; + /* Request for running pending calls. */ + _Py_atomic_int calls_to_do; + /* Request for looking at the `async_exc` field of the current + thread state. + Guarded by the GIL. */ + int async_exc; +#define NPENDINGCALLS 32 + struct { + int (*func)(void *); + void *arg; + } calls[NPENDINGCALLS]; + int first; + int last; +}; + +#include "internal/gil.h" + +struct _ceval_runtime_state { + int recursion_limit; + int check_recursion_limit; + /* Records whether tracing is on for any thread. Counts the number + of threads for which tstate->c_tracefunc is non-NULL, so if the + value is 0, we know we don't have to check this thread's + c_tracefunc. This speeds up the if statement in + PyEval_EvalFrameEx() after fast_next_opcode. */ + int tracing_possible; + /* This single variable consolidates all requests to break out of + the fast path in the eval loop. */ + _Py_atomic_int eval_breaker; + /* Request for dropping the GIL */ + _Py_atomic_int gil_drop_request; + struct _pending_calls pending; + struct _gil_runtime_state gil; +}; + +PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_CEVAL_H */ diff --git a/Include/internal/condvar.h b/Include/internal/condvar.h new file mode 100644 index 00000000000..f9330890d3e --- /dev/null +++ b/Include/internal/condvar.h @@ -0,0 +1,91 @@ +#ifndef Py_INTERNAL_CONDVAR_H +#define Py_INTERNAL_CONDVAR_H + +#ifndef _POSIX_THREADS +/* This means pthreads are not implemented in libc headers, hence the macro + not present in unistd.h. But they still can be implemented as an external + library (e.g. gnu pth in pthread emulation) */ +# ifdef HAVE_PTHREAD_H +# include /* _POSIX_THREADS */ +# endif +#endif + +#ifdef _POSIX_THREADS +/* + * POSIX support + */ +#define Py_HAVE_CONDVAR + +#include + +#define PyMUTEX_T pthread_mutex_t +#define PyCOND_T pthread_cond_t + +#elif defined(NT_THREADS) +/* + * Windows (XP, 2003 server and later, as well as (hopefully) CE) support + * + * Emulated condition variables ones that work with XP and later, plus + * example native support on VISTA and onwards. + */ +#define Py_HAVE_CONDVAR + +/* include windows if it hasn't been done before */ +#define WIN32_LEAN_AND_MEAN +#include + +/* options */ +/* non-emulated condition variables are provided for those that want + * to target Windows Vista. Modify this macro to enable them. + */ +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ +#endif + +/* fall back to emulation if not targeting Vista */ +#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif + +#if _PY_EMULATED_WIN_CV + +typedef CRITICAL_SECTION PyMUTEX_T; + +/* The ConditionVariable object. From XP onwards it is easily emulated + with a Semaphore. + Semaphores are available on Windows XP (2003 server) and later. + We use a Semaphore rather than an auto-reset event, because although + an auto-resent event might appear to solve the lost-wakeup bug (race + condition between releasing the outer lock and waiting) because it + maintains state even though a wait hasn't happened, there is still + a lost wakeup problem if more than one thread are interrupted in the + critical place. A semaphore solves that, because its state is + counted, not Boolean. + Because it is ok to signal a condition variable with no one + waiting, we need to keep track of the number of + waiting threads. Otherwise, the semaphore's state could rise + without bound. This also helps reduce the number of "spurious wakeups" + that would otherwise happen. + */ + +typedef struct _PyCOND_T +{ + HANDLE sem; + int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ +} PyCOND_T; + +#else /* !_PY_EMULATED_WIN_CV */ + +/* Use native Win7 primitives if build target is Win7 or higher */ + +/* SRWLOCK is faster and better than CriticalSection */ +typedef SRWLOCK PyMUTEX_T; + +typedef CONDITION_VARIABLE PyCOND_T; + +#endif /* _PY_EMULATED_WIN_CV */ + +#endif /* _POSIX_THREADS, NT_THREADS */ + +#endif /* Py_INTERNAL_CONDVAR_H */ diff --git a/Include/internal/gil.h b/Include/internal/gil.h new file mode 100644 index 00000000000..6139bd215c3 --- /dev/null +++ b/Include/internal/gil.h @@ -0,0 +1,46 @@ +#ifndef Py_INTERNAL_GIL_H +#define Py_INTERNAL_GIL_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pyatomic.h" + +#include "internal/condvar.h" +#ifndef Py_HAVE_CONDVAR +#error You need either a POSIX-compatible or a Windows system! +#endif + +/* Enable if you want to force the switching of threads at least + every `interval`. */ +#undef FORCE_SWITCHING +#define FORCE_SWITCHING + +struct _gil_runtime_state { + /* microseconds (the Python API uses seconds, though) */ + unsigned long interval; + /* Last PyThreadState holding / having held the GIL. This helps us + know whether anyone else was scheduled after we dropped the GIL. */ + _Py_atomic_address last_holder; + /* Whether the GIL is already taken (-1 if uninitialized). This is + atomic because it can be read without any lock taken in ceval.c. */ + _Py_atomic_int locked; + /* Number of GIL switches since the beginning. */ + unsigned long switch_number; + /* This condition variable allows one or several threads to wait + until the GIL is released. In addition, the mutex also protects + the above variables. */ + PyCOND_T cond; + PyMUTEX_T mutex; +#ifdef FORCE_SWITCHING + /* This condition variable helps the GIL-releasing thread wait for + a GIL-awaiting thread to be scheduled and take the GIL. */ + PyCOND_T switch_cond; + PyMUTEX_T switch_mutex; +#endif +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_GIL_H */ diff --git a/Include/internal/mem.h b/Include/internal/mem.h new file mode 100644 index 00000000000..1624f378f67 --- /dev/null +++ b/Include/internal/mem.h @@ -0,0 +1,197 @@ +#ifndef Py_INTERNAL_MEM_H +#define Py_INTERNAL_MEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "objimpl.h" +#include "pymem.h" + +#ifdef WITH_PYMALLOC +#include "internal/pymalloc.h" +#endif + +/* Low-level memory runtime state */ + +struct _pymem_runtime_state { + struct _allocator_runtime_state { + PyMemAllocatorEx mem; + PyMemAllocatorEx obj; + PyMemAllocatorEx raw; + } allocators; +#ifdef WITH_PYMALLOC + /* Array of objects used to track chunks of memory (arenas). */ + struct arena_object* arenas; + /* The head of the singly-linked, NULL-terminated list of available + arena_objects. */ + struct arena_object* unused_arena_objects; + /* The head of the doubly-linked, NULL-terminated at each end, + list of arena_objects associated with arenas that have pools + available. */ + struct arena_object* usable_arenas; + /* Number of slots currently allocated in the `arenas` vector. */ + unsigned int maxarenas; + /* Number of arenas allocated that haven't been free()'d. */ + size_t narenas_currently_allocated; + /* High water mark (max value ever seen) for + * narenas_currently_allocated. */ + size_t narenas_highwater; + /* Total number of times malloc() called to allocate an arena. */ + size_t ntimes_arena_allocated; + poolp usedpools[MAX_POOLS]; + Py_ssize_t num_allocated_blocks; + size_t serialno; /* incremented on each debug {m,re}alloc */ +#endif /* WITH_PYMALLOC */ +}; + +PyAPI_FUNC(void) _PyMem_Initialize(struct _pymem_runtime_state *); + + +/* High-level memory runtime state */ + +struct _pyobj_runtime_state { + PyObjectArenaAllocator allocator_arenas; +}; + +PyAPI_FUNC(void) _PyObject_Initialize(struct _pyobj_runtime_state *); + + +/* GC runtime state */ + +/* If we change this, we need to change the default value in the + signature of gc.collect. */ +#define NUM_GENERATIONS 3 + +/* + NOTE: about the counting of long-lived objects. + + To limit the cost of garbage collection, there are two strategies; + - make each collection faster, e.g. by scanning fewer objects + - do less collections + This heuristic is about the latter strategy. + + In addition to the various configurable thresholds, we only trigger a + full collection if the ratio + long_lived_pending / long_lived_total + is above a given value (hardwired to 25%). + + The reason is that, while "non-full" collections (i.e., collections of + the young and middle generations) will always examine roughly the same + number of objects -- determined by the aforementioned thresholds --, + the cost of a full collection is proportional to the total number of + long-lived objects, which is virtually unbounded. + + Indeed, it has been remarked that doing a full collection every + of object creations entails a dramatic performance + degradation in workloads which consist in creating and storing lots of + long-lived objects (e.g. building a large list of GC-tracked objects would + show quadratic performance, instead of linear as expected: see issue #4074). + + Using the above ratio, instead, yields amortized linear performance in + the total number of objects (the effect of which can be summarized + thusly: "each full garbage collection is more and more costly as the + number of objects grows, but we do fewer and fewer of them"). + + This heuristic was suggested by Martin von L?wis on python-dev in + June 2008. His original analysis and proposal can be found at: + http://mail.python.org/pipermail/python-dev/2008-June/080579.html +*/ + +/* + NOTE: about untracking of mutable objects. + + Certain types of container cannot participate in a reference cycle, and + so do not need to be tracked by the garbage collector. Untracking these + objects reduces the cost of garbage collections. However, determining + which objects may be untracked is not free, and the costs must be + weighed against the benefits for garbage collection. + + There are two possible strategies for when to untrack a container: + + i) When the container is created. + ii) When the container is examined by the garbage collector. + + Tuples containing only immutable objects (integers, strings etc, and + recursively, tuples of immutable objects) do not need to be tracked. + The interpreter creates a large number of tuples, many of which will + not survive until garbage collection. It is therefore not worthwhile + to untrack eligible tuples at creation time. + + Instead, all tuples except the empty tuple are tracked when created. + During garbage collection it is determined whether any surviving tuples + can be untracked. A tuple can be untracked if all of its contents are + already not tracked. Tuples are examined for untracking in all garbage + collection cycles. It may take more than one cycle to untrack a tuple. + + Dictionaries containing only immutable objects also do not need to be + tracked. Dictionaries are untracked when created. If a tracked item is + inserted into a dictionary (either as a key or value), the dictionary + becomes tracked. During a full garbage collection (all generations), + the collector will untrack any dictionaries whose contents are not + tracked. + + The module provides the python function is_tracked(obj), which returns + the CURRENT tracking status of the object. Subsequent garbage + collections may change the tracking status of the object. + + Untracking of certain containers was introduced in issue #4688, and + the algorithm was refined in response to issue #14775. +*/ + +struct gc_generation { + PyGC_Head head; + int threshold; /* collection threshold */ + int count; /* count of allocations or collections of younger + generations */ +}; + +/* Running stats per generation */ +struct gc_generation_stats { + /* total number of collections */ + Py_ssize_t collections; + /* total number of collected objects */ + Py_ssize_t collected; + /* total number of uncollectable objects (put into gc.garbage) */ + Py_ssize_t uncollectable; +}; + +struct _gc_runtime_state { + /* List of objects that still need to be cleaned up, singly linked + * via their gc headers' gc_prev pointers. */ + PyObject *trash_delete_later; + /* Current call-stack depth of tp_dealloc calls. */ + int trash_delete_nesting; + + int enabled; + int debug; + /* linked lists of container objects */ + struct gc_generation generations[NUM_GENERATIONS]; + PyGC_Head *generation0; + struct gc_generation_stats generation_stats[NUM_GENERATIONS]; + /* true if we are currently running the collector */ + int collecting; + /* list of uncollectable objects */ + PyObject *garbage; + /* a list of callbacks to be invoked when collection is performed */ + PyObject *callbacks; + /* This is the number of objects that survived the last full + collection. It approximates the number of long lived objects + tracked by the GC. + + (by "full collection", we mean a collection of the oldest + generation). */ + Py_ssize_t long_lived_total; + /* This is the number of objects that survived all "non-full" + collections, and are awaiting to undergo a full collection for + the first time. */ + Py_ssize_t long_lived_pending; +}; + +PyAPI_FUNC(void) _PyGC_Initialize(struct _gc_runtime_state *); + +#define _PyGC_generation0 _PyRuntime.gc.generation0 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_MEM_H */ diff --git a/Include/internal/pymalloc.h b/Include/internal/pymalloc.h new file mode 100644 index 00000000000..e9d6ab6a8b3 --- /dev/null +++ b/Include/internal/pymalloc.h @@ -0,0 +1,443 @@ + +/* An object allocator for Python. + + Here is an introduction to the layers of the Python memory architecture, + showing where the object allocator is actually used (layer +2), It is + called for every object allocation and deallocation (PyObject_New/Del), + unless the object-specific allocators implement a proprietary allocation + scheme (ex.: ints use a simple free list). This is also the place where + the cyclic garbage collector operates selectively on container objects. + + + Object-specific allocators + _____ ______ ______ ________ + [ int ] [ dict ] [ list ] ... [ string ] Python core | ++3 | <----- Object-specific memory -----> | <-- Non-object memory --> | + _______________________________ | | + [ Python's object allocator ] | | ++2 | ####### Object memory ####### | <------ Internal buffers ------> | + ______________________________________________________________ | + [ Python's raw memory allocator (PyMem_ API) ] | ++1 | <----- Python memory (under PyMem manager's control) ------> | | + __________________________________________________________________ + [ Underlying general-purpose allocator (ex: C library malloc) ] + 0 | <------ Virtual memory allocated for the python process -------> | + + ========================================================================= + _______________________________________________________________________ + [ OS-specific Virtual Memory Manager (VMM) ] +-1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | + __________________________________ __________________________________ + [ ] [ ] +-2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | + +*/ +/*==========================================================================*/ + +/* A fast, special-purpose memory allocator for small blocks, to be used + on top of a general-purpose malloc -- heavily based on previous art. */ + +/* Vladimir Marangozov -- August 2000 */ + +/* + * "Memory management is where the rubber meets the road -- if we do the wrong + * thing at any level, the results will not be good. And if we don't make the + * levels work well together, we are in serious trouble." (1) + * + * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, + * "Dynamic Storage Allocation: A Survey and Critical Review", + * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. + */ + +#ifndef Py_INTERNAL_PYMALLOC_H +#define Py_INTERNAL_PYMALLOC_H + +/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ + +/*==========================================================================*/ + +/* + * Allocation strategy abstract: + * + * For small requests, the allocator sub-allocates blocks of memory. + * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the + * system's allocator. + * + * Small requests are grouped in size classes spaced 8 bytes apart, due + * to the required valid alignment of the returned address. Requests of + * a particular size are serviced from memory pools of 4K (one VMM page). + * Pools are fragmented on demand and contain free lists of blocks of one + * particular size class. In other words, there is a fixed-size allocator + * for each size class. Free pools are shared by the different allocators + * thus minimizing the space reserved for a particular size class. + * + * This allocation strategy is a variant of what is known as "simple + * segregated storage based on array of free lists". The main drawback of + * simple segregated storage is that we might end up with lot of reserved + * memory for the different free lists, which degenerate in time. To avoid + * this, we partition each free list in pools and we share dynamically the + * reserved space between all free lists. This technique is quite efficient + * for memory intensive programs which allocate mainly small-sized blocks. + * + * For small requests we have the following table: + * + * Request in bytes Size of allocated block Size class idx + * ---------------------------------------------------------------- + * 1-8 8 0 + * 9-16 16 1 + * 17-24 24 2 + * 25-32 32 3 + * 33-40 40 4 + * 41-48 48 5 + * 49-56 56 6 + * 57-64 64 7 + * 65-72 72 8 + * ... ... ... + * 497-504 504 62 + * 505-512 512 63 + * + * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying + * allocator. + */ + +/*==========================================================================*/ + +/* + * -- Main tunable settings section -- + */ + +/* + * Alignment of addresses returned to the user. 8-bytes alignment works + * on most current architectures (with 32-bit or 64-bit address busses). + * The alignment value is also used for grouping small requests in size + * classes spaced ALIGNMENT bytes apart. + * + * You shouldn't change this unless you know what you are doing. + */ +#define ALIGNMENT 8 /* must be 2^N */ +#define ALIGNMENT_SHIFT 3 + +/* Return the number of bytes in size class I, as a uint. */ +#define INDEX2SIZE(I) (((unsigned int)(I) + 1) << ALIGNMENT_SHIFT) + +/* + * Max size threshold below which malloc requests are considered to be + * small enough in order to use preallocated memory pools. You can tune + * this value according to your application behaviour and memory needs. + * + * Note: a size threshold of 512 guarantees that newly created dictionaries + * will be allocated from preallocated memory pools on 64-bit. + * + * The following invariants must hold: + * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 + * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT + * + * Although not required, for better performance and space efficiency, + * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. + */ +#define SMALL_REQUEST_THRESHOLD 512 +#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) + +#if NB_SMALL_SIZE_CLASSES > 64 +#error "NB_SMALL_SIZE_CLASSES should be less than 64" +#endif /* NB_SMALL_SIZE_CLASSES > 64 */ + +/* + * The system's VMM page size can be obtained on most unices with a + * getpagesize() call or deduced from various header files. To make + * things simpler, we assume that it is 4K, which is OK for most systems. + * It is probably better if this is the native page size, but it doesn't + * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page + * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation + * violation fault. 4K is apparently OK for all the platforms that python + * currently targets. + */ +#define SYSTEM_PAGE_SIZE (4 * 1024) +#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) + +/* + * Maximum amount of memory managed by the allocator for small requests. + */ +#ifdef WITH_MEMORY_LIMITS +#ifndef SMALL_MEMORY_LIMIT +#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ +#endif +#endif + +/* + * The allocator sub-allocates blocks of memory (called arenas) aligned + * on a page boundary. This is a reserved virtual address space for the + * current process (obtained through a malloc()/mmap() call). In no way this + * means that the memory arenas will be used entirely. A malloc() is + * usually an address range reservation for bytes, unless all pages within + * this space are referenced subsequently. So malloc'ing big blocks and not + * using them does not mean "wasting memory". It's an addressable range + * wastage... + * + * Arenas are allocated with mmap() on systems supporting anonymous memory + * mappings to reduce heap fragmentation. + */ +#define ARENA_SIZE (256 << 10) /* 256KB */ + +#ifdef WITH_MEMORY_LIMITS +#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) +#endif + +/* + * Size of the pools used for small blocks. Should be a power of 2, + * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. + */ +#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ +#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK + +/* + * -- End of tunable settings section -- + */ + +/*==========================================================================*/ + +/* + * Locking + * + * To reduce lock contention, it would probably be better to refine the + * crude function locking with per size class locking. I'm not positive + * however, whether it's worth switching to such locking policy because + * of the performance penalty it might introduce. + * + * The following macros describe the simplest (should also be the fastest) + * lock object on a particular platform and the init/fini/lock/unlock + * operations on it. The locks defined here are not expected to be recursive + * because it is assumed that they will always be called in the order: + * INIT, [LOCK, UNLOCK]*, FINI. + */ + +/* + * Python's threads are serialized, so object malloc locking is disabled. + */ +#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ +#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ +#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ +#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ +#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ + +/* When you say memory, my mind reasons in terms of (pointers to) blocks */ +typedef uint8_t pyblock; + +/* Pool for small blocks. */ +struct pool_header { + union { pyblock *_padding; + unsigned int count; } ref; /* number of allocated blocks */ + pyblock *freeblock; /* pool's free list head */ + struct pool_header *nextpool; /* next pool of this size class */ + struct pool_header *prevpool; /* previous pool "" */ + unsigned int arenaindex; /* index into arenas of base adr */ + unsigned int szidx; /* block size class index */ + unsigned int nextoffset; /* bytes to virgin block */ + unsigned int maxnextoffset; /* largest valid nextoffset */ +}; + +typedef struct pool_header *poolp; + +/* Record keeping for arenas. */ +struct arena_object { + /* The address of the arena, as returned by malloc. Note that 0 + * will never be returned by a successful malloc, and is used + * here to mark an arena_object that doesn't correspond to an + * allocated arena. + */ + uintptr_t address; + + /* Pool-aligned pointer to the next pool to be carved off. */ + pyblock* pool_address; + + /* The number of available pools in the arena: free pools + never- + * allocated pools. + */ + unsigned int nfreepools; + + /* The total number of pools in the arena, whether or not available. */ + unsigned int ntotalpools; + + /* Singly-linked list of available pools. */ + struct pool_header* freepools; + + /* Whenever this arena_object is not associated with an allocated + * arena, the nextarena member is used to link all unassociated + * arena_objects in the singly-linked `unused_arena_objects` list. + * The prevarena member is unused in this case. + * + * When this arena_object is associated with an allocated arena + * with at least one available pool, both members are used in the + * doubly-linked `usable_arenas` list, which is maintained in + * increasing order of `nfreepools` values. + * + * Else this arena_object is associated with an allocated arena + * all of whose pools are in use. `nextarena` and `prevarena` + * are both meaningless in this case. + */ + struct arena_object* nextarena; + struct arena_object* prevarena; +}; + +#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) + +#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ + +/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ +#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) + +/* Return total number of blocks in pool of size index I, as a uint. */ +#define NUMBLOCKS(I) \ + ((unsigned int)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) + +/*==========================================================================*/ + +/* + * This malloc lock + */ +SIMPLELOCK_DECL(_malloc_lock) +#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) +#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) +#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) +#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) + +/* + * Pool table -- headed, circular, doubly-linked lists of partially used pools. + +This is involved. For an index i, usedpools[i+i] is the header for a list of +all partially used pools holding small blocks with "size class idx" i. So +usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size +16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to +the start of a singly-linked list of free blocks within the pool. When a +block is freed, it's inserted at the front of its pool's freeblock list. Note +that the available blocks in a pool are *not* linked all together when a pool +is initialized. Instead only "the first two" (lowest addresses) blocks are +set up, returning the first such block, and setting pool->freeblock to a +one-block list holding the second such block. This is consistent with that +pymalloc strives at all levels (arena, pool, and block) never to touch a piece +of memory until it's actually needed. + +So long as a pool is in the used state, we're certain there *is* a block +available for allocating, and pool->freeblock is not NULL. If pool->freeblock +points to the end of the free list before we've carved the entire pool into +blocks, that means we simply haven't yet gotten to one of the higher-address +blocks. The offset from the pool_header to the start of "the next" virgin +block is stored in the pool_header nextoffset member, and the largest value +of nextoffset that makes sense is stored in the maxnextoffset member when a +pool is initialized. All the blocks in a pool have been passed out at least +once when and only when nextoffset > maxnextoffset. + + +Major obscurity: While the usedpools vector is declared to have poolp +entries, it doesn't really. It really contains two pointers per (conceptual) +poolp entry, the nextpool and prevpool members of a pool_header. The +excruciating initialization code below fools C so that + + usedpool[i+i] + +"acts like" a genuine poolp, but only so long as you only reference its +nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is +compensating for that a pool_header's nextpool and prevpool members +immediately follow a pool_header's first two members: + + union { block *_padding; + uint count; } ref; + block *freeblock; + +each of which consume sizeof(block *) bytes. So what usedpools[i+i] really +contains is a fudged-up pointer p such that *if* C believes it's a poolp +pointer, then p->nextpool and p->prevpool are both p (meaning that the headed +circular list is empty). + +It's unclear why the usedpools setup is so convoluted. It could be to +minimize the amount of cache required to hold this heavily-referenced table +(which only *needs* the two interpool pointer members of a pool_header). OTOH, +referencing code has to remember to "double the index" and doing so isn't +free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying +on that C doesn't insert any padding anywhere in a pool_header at or before +the prevpool member. +**************************************************************************** */ + +#define MAX_POOLS (2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8) + +/*========================================================================== +Arena management. + +`arenas` is a vector of arena_objects. It contains maxarenas entries, some of +which may not be currently used (== they're arena_objects that aren't +currently associated with an allocated arena). Note that arenas proper are +separately malloc'ed. + +Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, +we do try to free() arenas, and use some mild heuristic strategies to increase +the likelihood that arenas eventually can be freed. + +unused_arena_objects + + This is a singly-linked list of the arena_objects that are currently not + being used (no arena is associated with them). Objects are taken off the + head of the list in new_arena(), and are pushed on the head of the list in + PyObject_Free() when the arena is empty. Key invariant: an arena_object + is on this list if and only if its .address member is 0. + +usable_arenas + + This is a doubly-linked list of the arena_objects associated with arenas + that have pools available. These pools are either waiting to be reused, + or have not been used before. The list is sorted to have the most- + allocated arenas first (ascending order based on the nfreepools member). + This means that the next allocation will come from a heavily used arena, + which gives the nearly empty arenas a chance to be returned to the system. + In my unscientific tests this dramatically improved the number of arenas + that could be freed. + +Note that an arena_object associated with an arena all of whose pools are +currently in use isn't on either list. +*/ + +/* How many arena_objects do we initially allocate? + * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the + * `arenas` vector. + */ +#define INITIAL_ARENA_OBJECTS 16 + +#endif /* Py_INTERNAL_PYMALLOC_H */ diff --git a/Include/internal/pystate.h b/Include/internal/pystate.h new file mode 100644 index 00000000000..20c5946b14f --- /dev/null +++ b/Include/internal/pystate.h @@ -0,0 +1,92 @@ +#ifndef Py_INTERNAL_PYSTATE_H +#define Py_INTERNAL_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "pystate.h" +#include "pyatomic.h" +#include "pythread.h" + +#include "internal/mem.h" +#include "internal/ceval.h" +#include "internal/warnings.h" + + +/* GIL state */ + +struct _gilstate_runtime_state { + int check_enabled; + /* Assuming the current thread holds the GIL, this is the + PyThreadState for the current thread. */ + _Py_atomic_address tstate_current; + PyThreadFrameGetter getframe; + /* The single PyInterpreterState used by this process' + GILState implementation + */ + /* TODO: Given interp_main, it may be possible to kill this ref */ + PyInterpreterState *autoInterpreterState; + int autoTLSkey; +}; + +/* hook for PyEval_GetFrame(), requested for Psyco */ +#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe + +/* Issue #26558: Flag to disable PyGILState_Check(). + If set to non-zero, PyGILState_Check() always return 1. */ +#define _PyGILState_check_enabled _PyRuntime.gilstate.check_enabled + + +/* Full Python runtime state */ + +typedef struct pyruntimestate { + int initialized; + int core_initialized; + PyThreadState *finalizing; + + struct pyinterpreters { + PyThread_type_lock mutex; + PyInterpreterState *head; + PyInterpreterState *main; + /* _next_interp_id is an auto-numbered sequence of small + integers. It gets initialized in _PyInterpreterState_Init(), + which is called in Py_Initialize(), and used in + PyInterpreterState_New(). A negative interpreter ID + indicates an error occurred. The main interpreter will + always have an ID of 0. Overflow results in a RuntimeError. + If that becomes a problem later then we can adjust, e.g. by + using a Python int. */ + int64_t next_id; + } interpreters; + +#define NEXITFUNCS 32 + void (*exitfuncs[NEXITFUNCS])(void); + int nexitfuncs; + void (*pyexitfunc)(void); + + struct _pyobj_runtime_state obj; + struct _gc_runtime_state gc; + struct _pymem_runtime_state mem; + struct _warnings_runtime_state warnings; + struct _ceval_runtime_state ceval; + struct _gilstate_runtime_state gilstate; + + // XXX Consolidate globals found via the check-c-globals script. +} _PyRuntimeState; + +PyAPI_DATA(_PyRuntimeState) _PyRuntime; +PyAPI_FUNC(void) _PyRuntimeState_Init(_PyRuntimeState *); +PyAPI_FUNC(void) _PyRuntimeState_Fini(_PyRuntimeState *); + +#define _Py_CURRENTLY_FINALIZING(tstate) \ + (_PyRuntime.finalizing == tstate) + + +/* Other */ + +PyAPI_FUNC(void) _PyInterpreterState_Enable(_PyRuntimeState *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_PYSTATE_H */ diff --git a/Include/internal/warnings.h b/Include/internal/warnings.h new file mode 100644 index 00000000000..2878a28a2ee --- /dev/null +++ b/Include/internal/warnings.h @@ -0,0 +1,21 @@ +#ifndef Py_INTERNAL_WARNINGS_H +#define Py_INTERNAL_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "object.h" + +struct _warnings_runtime_state { + /* Both 'filters' and 'onceregistry' can be set in warnings.py; + get_warnings_attr() will reset these variables accordingly. */ + PyObject *filters; /* List */ + PyObject *once_registry; /* Dict */ + PyObject *default_action; /* String */ + long filters_version; +}; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTERNAL_WARNINGS_H */ diff --git a/Include/object.h b/Include/object.h index f5ed70b1129..b46d4c30e1e 100644 --- a/Include/object.h +++ b/Include/object.h @@ -1038,8 +1038,6 @@ with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. Kept for binary compatibility of extensions using the stable ABI. */ PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); PyAPI_FUNC(void) _PyTrash_destroy_chain(void); -PyAPI_DATA(int) _PyTrash_delete_nesting; -PyAPI_DATA(PyObject *) _PyTrash_delete_later; #endif /* !Py_LIMITED_API */ /* The new thread-safe private API, invoked by the macros below. */ diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 0d609ec2344..e1737b5972b 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -119,7 +119,7 @@ PyAPI_FUNC(void) _PyType_Fini(void); PyAPI_FUNC(void) _Py_HashRandomization_Fini(void); PyAPI_FUNC(void) PyAsyncGen_Fini(void); -PyAPI_DATA(PyThreadState *) _Py_Finalizing; +PyAPI_FUNC(int) _Py_IsFinalizing(void); #endif /* Signals */ diff --git a/Include/pystate.h b/Include/pystate.h index f957d536dcd..d986e35ae3b 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -29,9 +29,10 @@ typedef struct { int use_hash_seed; unsigned long hash_seed; int _disable_importlib; /* Needed by freeze_importlib */ + char *allocator; } _PyCoreConfig; -#define _PyCoreConfig_INIT {0, -1, 0, 0} +#define _PyCoreConfig_INIT {0, -1, 0, 0, NULL} /* Placeholders while working on the new configuration API * @@ -57,6 +58,19 @@ typedef struct _is { PyObject *builtins; PyObject *importlib; + /* Used in Python/sysmodule.c. */ + int check_interval; + PyObject *warnoptions; + PyObject *xoptions; + + /* Used in Modules/_threadmodule.c. */ + long num_threads; + /* Support for runtime thread stack size tuning. + A value of 0 means using the platform's default stack size + or the size specified by the THREAD_STACK_SIZE macro. */ + /* Used in Python/thread.c. */ + size_t pythread_stacksize; + PyObject *codec_search_path; PyObject *codec_search_cache; PyObject *codec_error_registry; @@ -190,9 +204,6 @@ typedef struct _ts { #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyInterpreterState_Init(void); -#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); @@ -249,7 +260,7 @@ PyAPI_FUNC(int) PyThreadState_SetAsyncExc(unsigned long, PyObject *); /* Assuming the current thread holds the GIL, this is the PyThreadState for the current thread. */ #ifdef Py_BUILD_CORE -PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current; +# define _PyThreadState_Current _PyRuntime.gilstate.tstate_current # define PyThreadState_GET() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) #else @@ -303,10 +314,6 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); #ifndef Py_LIMITED_API -/* Issue #26558: Flag to disable PyGILState_Check(). - If set to non-zero, PyGILState_Check() always return 1. */ -PyAPI_DATA(int) _PyGILState_check_enabled; - /* Helper/diagnostic function - return 1 if the current thread currently holds the GIL, 0 otherwise. @@ -341,11 +348,6 @@ PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); #endif -/* hook for PyEval_GetFrame(), requested for Psyco */ -#ifndef Py_LIMITED_API -PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; -#endif - #ifdef __cplusplus } #endif diff --git a/Makefile.pre.in b/Makefile.pre.in index 5f83e048760..0eb5c4dc501 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -984,6 +984,12 @@ PYTHON_HEADERS= \ pyconfig.h \ $(PARSER_HEADERS) \ $(srcdir)/Include/Python-ast.h \ + $(srcdir)/Include/internal/ceval.h \ + $(srcdir)/Include/internal/gil.h \ + $(srcdir)/Include/internal/mem.h \ + $(srcdir)/Include/internal/pymalloc.h \ + $(srcdir)/Include/internal/pystate.h \ + $(srcdir)/Include/internal/warnings.h \ $(DTRACE_HEADERS) $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst new file mode 100644 index 00000000000..d8e9d5eeea1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst @@ -0,0 +1,2 @@ +Consolidate CPython's global runtime state under a single struct. This +improves discoverability of the runtime state. diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 33761a46667..e109b336466 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -1,5 +1,7 @@ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" /* _functools module written and maintained diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index ba0932c5d81..b2b9ade2c7c 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -9,6 +9,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" #include "pythread.h" #include "_iomodule.h" @@ -275,7 +276,7 @@ _enter_buffered_busy(buffered *self) "reentrant call inside %R", self); return 0; } - relax_locking = (_Py_Finalizing != NULL); + relax_locking = _Py_IsFinalizing(); Py_BEGIN_ALLOW_THREADS if (!relax_locking) st = PyThread_acquire_lock(self->lock, 1); diff --git a/Modules/_json.c b/Modules/_json.c index 54fc90cfece..f1da2302dd3 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1,3 +1,10 @@ + +/* Core extension modules are built-in on some platforms (e.g. Windows). */ +#ifdef Py_BUILD_CORE +#define Py_BUILD_CORE_MODULE +#undef Py_BUILD_CORE +#endif + #include "Python.h" #include "structmember.h" #include "accu.h" diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 25255368a10..5fbf0995f4c 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1,3 +1,10 @@ + +/* Core extension modules are built-in on some platforms (e.g. Windows). */ +#ifdef Py_BUILD_CORE +#define Py_BUILD_CORE_MODULE +#undef Py_BUILD_CORE +#endif + #include "Python.h" #include "structmember.h" diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index d58ebc32926..2657a1fc68d 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -3,11 +3,11 @@ /* Interface to Sjoerd's portable C thread library */ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" /* offsetof */ #include "pythread.h" static PyObject *ThreadError; -static long nb_threads = 0; static PyObject *str_dict; _Py_IDENTIFIER(stderr); @@ -986,7 +986,7 @@ t_bootstrap(void *boot_raw) tstate->thread_id = PyThread_get_thread_ident(); _PyThreadState_Init(tstate); PyEval_AcquireThread(tstate); - nb_threads++; + tstate->interp->num_threads++; res = PyObject_Call(boot->func, boot->args, boot->keyw); if (res == NULL) { if (PyErr_ExceptionMatches(PyExc_SystemExit)) @@ -1013,7 +1013,7 @@ t_bootstrap(void *boot_raw) Py_DECREF(boot->args); Py_XDECREF(boot->keyw); PyMem_DEL(boot_raw); - nb_threads--; + tstate->interp->num_threads--; PyThreadState_Clear(tstate); PyThreadState_DeleteCurrent(); PyThread_exit_thread(); @@ -1152,7 +1152,8 @@ A thread's identity may be reused for another thread after it exits."); static PyObject * thread__count(PyObject *self) { - return PyLong_FromLong(nb_threads); + PyThreadState *tstate = PyThreadState_Get(); + return PyLong_FromLong(tstate->interp->num_threads); } PyDoc_STRVAR(_count_doc, @@ -1345,6 +1346,7 @@ PyInit__thread(void) PyObject *m, *d, *v; double time_max; double timeout_max; + PyThreadState *tstate = PyThreadState_Get(); /* Initialize types: */ if (PyType_Ready(&localdummytype) < 0) @@ -1389,7 +1391,7 @@ PyInit__thread(void) if (PyModule_AddObject(m, "_local", (PyObject *)&localtype) < 0) return NULL; - nb_threads = 0; + tstate->interp->num_threads = 0; str_dict = PyUnicode_InternFromString("__dict__"); if (str_dict == NULL) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 682d0a3cdd8..a81ccafdda9 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -114,7 +114,7 @@ overlapped_dealloc(OverlappedObject *self) { /* The operation is no longer pending -- nothing to do. */ } - else if (_Py_Finalizing == NULL) + else if (_Py_IsFinalizing()) { /* The operation is still pending -- give a warning. This will probably only happen on Windows XP. */ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 4e5acf305b9..832e27ebe66 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -24,6 +24,8 @@ */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "frameobject.h" /* for PyFrame_ClearFreeList */ #include "pydtrace.h" #include "pytime.h" /* for _PyTime_GetMonotonicClock() */ @@ -39,133 +41,9 @@ module gc /* Get the object given the GC head */ #define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) -/*** Global GC state ***/ - -struct gc_generation { - PyGC_Head head; - int threshold; /* collection threshold */ - int count; /* count of allocations or collections of younger - generations */ -}; - -/* If we change this, we need to change the default value in the signature of - gc.collect. */ -#define NUM_GENERATIONS 3 -#define GEN_HEAD(n) (&generations[n].head) - -/* linked lists of container objects */ -static struct gc_generation generations[NUM_GENERATIONS] = { - /* PyGC_Head, threshold, count */ - {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, - {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, - {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, -}; - -PyGC_Head *_PyGC_generation0 = GEN_HEAD(0); - -static int enabled = 1; /* automatic collection enabled? */ - -/* true if we are currently running the collector */ -static int collecting = 0; - -/* list of uncollectable objects */ -static PyObject *garbage = NULL; - /* Python string to use if unhandled exception occurs */ static PyObject *gc_str = NULL; -/* a list of callbacks to be invoked when collection is performed */ -static PyObject *callbacks = NULL; - -/* This is the number of objects that survived the last full collection. It - approximates the number of long lived objects tracked by the GC. - - (by "full collection", we mean a collection of the oldest generation). -*/ -static Py_ssize_t long_lived_total = 0; - -/* This is the number of objects that survived all "non-full" collections, - and are awaiting to undergo a full collection for the first time. - -*/ -static Py_ssize_t long_lived_pending = 0; - -/* - NOTE: about the counting of long-lived objects. - - To limit the cost of garbage collection, there are two strategies; - - make each collection faster, e.g. by scanning fewer objects - - do less collections - This heuristic is about the latter strategy. - - In addition to the various configurable thresholds, we only trigger a - full collection if the ratio - long_lived_pending / long_lived_total - is above a given value (hardwired to 25%). - - The reason is that, while "non-full" collections (i.e., collections of - the young and middle generations) will always examine roughly the same - number of objects -- determined by the aforementioned thresholds --, - the cost of a full collection is proportional to the total number of - long-lived objects, which is virtually unbounded. - - Indeed, it has been remarked that doing a full collection every - of object creations entails a dramatic performance - degradation in workloads which consist in creating and storing lots of - long-lived objects (e.g. building a large list of GC-tracked objects would - show quadratic performance, instead of linear as expected: see issue #4074). - - Using the above ratio, instead, yields amortized linear performance in - the total number of objects (the effect of which can be summarized - thusly: "each full garbage collection is more and more costly as the - number of objects grows, but we do fewer and fewer of them"). - - This heuristic was suggested by Martin von L?wis on python-dev in - June 2008. His original analysis and proposal can be found at: - http://mail.python.org/pipermail/python-dev/2008-June/080579.html -*/ - -/* - NOTE: about untracking of mutable objects. - - Certain types of container cannot participate in a reference cycle, and - so do not need to be tracked by the garbage collector. Untracking these - objects reduces the cost of garbage collections. However, determining - which objects may be untracked is not free, and the costs must be - weighed against the benefits for garbage collection. - - There are two possible strategies for when to untrack a container: - - i) When the container is created. - ii) When the container is examined by the garbage collector. - - Tuples containing only immutable objects (integers, strings etc, and - recursively, tuples of immutable objects) do not need to be tracked. - The interpreter creates a large number of tuples, many of which will - not survive until garbage collection. It is therefore not worthwhile - to untrack eligible tuples at creation time. - - Instead, all tuples except the empty tuple are tracked when created. - During garbage collection it is determined whether any surviving tuples - can be untracked. A tuple can be untracked if all of its contents are - already not tracked. Tuples are examined for untracking in all garbage - collection cycles. It may take more than one cycle to untrack a tuple. - - Dictionaries containing only immutable objects also do not need to be - tracked. Dictionaries are untracked when created. If a tracked item is - inserted into a dictionary (either as a key or value), the dictionary - becomes tracked. During a full garbage collection (all generations), - the collector will untrack any dictionaries whose contents are not - tracked. - - The module provides the python function is_tracked(obj), which returns - the CURRENT tracking status of the object. Subsequent garbage - collections may change the tracking status of the object. - - Untracking of certain containers was introduced in issue #4688, and - the algorithm was refined in response to issue #14775. -*/ - /* set for debugging information */ #define DEBUG_STATS (1<<0) /* print collection statistics */ #define DEBUG_COLLECTABLE (1<<1) /* print collectable objects */ @@ -174,19 +52,26 @@ static Py_ssize_t long_lived_pending = 0; #define DEBUG_LEAK DEBUG_COLLECTABLE | \ DEBUG_UNCOLLECTABLE | \ DEBUG_SAVEALL -static int debug; - -/* Running stats per generation */ -struct gc_generation_stats { - /* total number of collections */ - Py_ssize_t collections; - /* total number of collected objects */ - Py_ssize_t collected; - /* total number of uncollectable objects (put into gc.garbage) */ - Py_ssize_t uncollectable; -}; -static struct gc_generation_stats generation_stats[NUM_GENERATIONS]; +#define GEN_HEAD(n) (&_PyRuntime.gc.generations[n].head) + +void +_PyGC_Initialize(struct _gc_runtime_state *state) +{ + state->enabled = 1; /* automatic collection enabled? */ + +#define _GEN_HEAD(n) (&state->generations[n].head) + struct gc_generation generations[NUM_GENERATIONS] = { + /* PyGC_Head, threshold, count */ + {{{_GEN_HEAD(0), _GEN_HEAD(0), 0}}, 700, 0}, + {{{_GEN_HEAD(1), _GEN_HEAD(1), 0}}, 10, 0}, + {{{_GEN_HEAD(2), _GEN_HEAD(2), 0}}, 10, 0}, + }; + for (int i = 0; i < NUM_GENERATIONS; i++) { + state->generations[i] = generations[i]; + }; + state->generation0 = GEN_HEAD(0); +} /*-------------------------------------------------------------------------- gc_refs values. @@ -766,16 +651,16 @@ handle_legacy_finalizers(PyGC_Head *finalizers, PyGC_Head *old) { PyGC_Head *gc = finalizers->gc.gc_next; - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) + if (_PyRuntime.gc.garbage == NULL) { + _PyRuntime.gc.garbage = PyList_New(0); + if (_PyRuntime.gc.garbage == NULL) Py_FatalError("gc couldn't create gc.garbage list"); } for (; gc != finalizers; gc = gc->gc.gc_next) { PyObject *op = FROM_GC(gc); - if ((debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { - if (PyList_Append(garbage, op) < 0) + if ((_PyRuntime.gc.debug & DEBUG_SAVEALL) || has_legacy_finalizer(op)) { + if (PyList_Append(_PyRuntime.gc.garbage, op) < 0) return -1; } } @@ -865,8 +750,8 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old) PyGC_Head *gc = collectable->gc.gc_next; PyObject *op = FROM_GC(gc); - if (debug & DEBUG_SAVEALL) { - PyList_Append(garbage, op); + if (_PyRuntime.gc.debug & DEBUG_SAVEALL) { + PyList_Append(_PyRuntime.gc.garbage, op); } else { if ((clear = Py_TYPE(op)->tp_clear) != NULL) { @@ -919,9 +804,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, PyGC_Head *gc; _PyTime_t t1 = 0; /* initialize to prevent a compiler warning */ - struct gc_generation_stats *stats = &generation_stats[generation]; + struct gc_generation_stats *stats = &_PyRuntime.gc.generation_stats[generation]; - if (debug & DEBUG_STATS) { + if (_PyRuntime.gc.debug & DEBUG_STATS) { PySys_WriteStderr("gc: collecting generation %d...\n", generation); PySys_WriteStderr("gc: objects in each generation:"); @@ -938,9 +823,9 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* update collection and allocation counters */ if (generation+1 < NUM_GENERATIONS) - generations[generation+1].count += 1; + _PyRuntime.gc.generations[generation+1].count += 1; for (i = 0; i <= generation; i++) - generations[i].count = 0; + _PyRuntime.gc.generations[i].count = 0; /* merge younger generations with one we are currently collecting */ for (i = 0; i < generation; i++) { @@ -974,7 +859,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* Move reachable objects to next generation. */ if (young != old) { if (generation == NUM_GENERATIONS - 2) { - long_lived_pending += gc_list_size(young); + _PyRuntime.gc.long_lived_pending += gc_list_size(young); } gc_list_merge(young, old); } @@ -982,8 +867,8 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, /* We only untrack dicts in full collections, to avoid quadratic dict build-up. See issue #14775. */ untrack_dicts(young); - long_lived_pending = 0; - long_lived_total = gc_list_size(young); + _PyRuntime.gc.long_lived_pending = 0; + _PyRuntime.gc.long_lived_total = gc_list_size(young); } /* All objects in unreachable are trash, but objects reachable from @@ -1003,7 +888,7 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, for (gc = unreachable.gc.gc_next; gc != &unreachable; gc = gc->gc.gc_next) { m++; - if (debug & DEBUG_COLLECTABLE) { + if (_PyRuntime.gc.debug & DEBUG_COLLECTABLE) { debug_cycle("collectable", FROM_GC(gc)); } } @@ -1032,10 +917,10 @@ collect(int generation, Py_ssize_t *n_collected, Py_ssize_t *n_uncollectable, gc != &finalizers; gc = gc->gc.gc_next) { n++; - if (debug & DEBUG_UNCOLLECTABLE) + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) debug_cycle("uncollectable", FROM_GC(gc)); } - if (debug & DEBUG_STATS) { + if (_PyRuntime.gc.debug & DEBUG_STATS) { _PyTime_t t2 = _PyTime_GetMonotonicClock(); if (m == 0 && n == 0) @@ -1098,11 +983,11 @@ invoke_gc_callback(const char *phase, int generation, PyObject *info = NULL; /* we may get called very early */ - if (callbacks == NULL) + if (_PyRuntime.gc.callbacks == NULL) return; /* The local variable cannot be rebound, check it for sanity */ - assert(callbacks != NULL && PyList_CheckExact(callbacks)); - if (PyList_GET_SIZE(callbacks) != 0) { + assert(_PyRuntime.gc.callbacks != NULL && PyList_CheckExact(_PyRuntime.gc.callbacks)); + if (PyList_GET_SIZE(_PyRuntime.gc.callbacks) != 0) { info = Py_BuildValue("{sisnsn}", "generation", generation, "collected", collected, @@ -1112,8 +997,8 @@ invoke_gc_callback(const char *phase, int generation, return; } } - for (i=0; i= 0; i--) { - if (generations[i].count > generations[i].threshold) { + if (_PyRuntime.gc.generations[i].count > _PyRuntime.gc.generations[i].threshold) { /* Avoid quadratic performance degradation in number of tracked objects. See comments at the beginning of this file, and issue #4074. */ if (i == NUM_GENERATIONS - 1 - && long_lived_pending < long_lived_total / 4) + && _PyRuntime.gc.long_lived_pending < _PyRuntime.gc.long_lived_total / 4) continue; n = collect_with_callback(i); break; @@ -1174,7 +1059,7 @@ static PyObject * gc_enable_impl(PyObject *module) /*[clinic end generated code: output=45a427e9dce9155c input=81ac4940ca579707]*/ { - enabled = 1; + _PyRuntime.gc.enabled = 1; Py_RETURN_NONE; } @@ -1188,7 +1073,7 @@ static PyObject * gc_disable_impl(PyObject *module) /*[clinic end generated code: output=97d1030f7aa9d279 input=8c2e5a14e800d83b]*/ { - enabled = 0; + _PyRuntime.gc.enabled = 0; Py_RETURN_NONE; } @@ -1202,7 +1087,7 @@ static int gc_isenabled_impl(PyObject *module) /*[clinic end generated code: output=1874298331c49130 input=30005e0422373b31]*/ { - return enabled; + return _PyRuntime.gc.enabled; } /*[clinic input] @@ -1230,12 +1115,12 @@ gc_collect_impl(PyObject *module, int generation) return -1; } - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; /* already collecting, don't do anything */ else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect_with_callback(generation); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; @@ -1263,7 +1148,7 @@ static PyObject * gc_set_debug_impl(PyObject *module, int flags) /*[clinic end generated code: output=7c8366575486b228 input=5e5ce15e84fbed15]*/ { - debug = flags; + _PyRuntime.gc.debug = flags; Py_RETURN_NONE; } @@ -1278,7 +1163,7 @@ static int gc_get_debug_impl(PyObject *module) /*[clinic end generated code: output=91242f3506cd1e50 input=91a101e1c3b98366]*/ { - return debug; + return _PyRuntime.gc.debug; } PyDoc_STRVAR(gc_set_thresh__doc__, @@ -1292,13 +1177,13 @@ gc_set_thresh(PyObject *self, PyObject *args) { int i; if (!PyArg_ParseTuple(args, "i|ii:set_threshold", - &generations[0].threshold, - &generations[1].threshold, - &generations[2].threshold)) + &_PyRuntime.gc.generations[0].threshold, + &_PyRuntime.gc.generations[1].threshold, + &_PyRuntime.gc.generations[2].threshold)) return NULL; for (i = 2; i < NUM_GENERATIONS; i++) { /* generations higher than 2 get the same threshold */ - generations[i].threshold = generations[2].threshold; + _PyRuntime.gc.generations[i].threshold = _PyRuntime.gc.generations[2].threshold; } Py_RETURN_NONE; @@ -1315,9 +1200,9 @@ gc_get_threshold_impl(PyObject *module) /*[clinic end generated code: output=7902bc9f41ecbbd8 input=286d79918034d6e6]*/ { return Py_BuildValue("(iii)", - generations[0].threshold, - generations[1].threshold, - generations[2].threshold); + _PyRuntime.gc.generations[0].threshold, + _PyRuntime.gc.generations[1].threshold, + _PyRuntime.gc.generations[2].threshold); } /*[clinic input] @@ -1331,9 +1216,9 @@ gc_get_count_impl(PyObject *module) /*[clinic end generated code: output=354012e67b16398f input=a392794a08251751]*/ { return Py_BuildValue("(iii)", - generations[0].count, - generations[1].count, - generations[2].count); + _PyRuntime.gc.generations[0].count, + _PyRuntime.gc.generations[1].count, + _PyRuntime.gc.generations[2].count); } static int @@ -1464,7 +1349,7 @@ gc_get_stats_impl(PyObject *module) /* To get consistent values despite allocations while constructing the result list, we use a snapshot of the running stats. */ for (i = 0; i < NUM_GENERATIONS; i++) { - stats[i] = generation_stats[i]; + stats[i] = _PyRuntime.gc.generation_stats[i]; } result = PyList_New(0); @@ -1581,22 +1466,22 @@ PyInit_gc(void) if (m == NULL) return NULL; - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) + if (_PyRuntime.gc.garbage == NULL) { + _PyRuntime.gc.garbage = PyList_New(0); + if (_PyRuntime.gc.garbage == NULL) return NULL; } - Py_INCREF(garbage); - if (PyModule_AddObject(m, "garbage", garbage) < 0) + Py_INCREF(_PyRuntime.gc.garbage); + if (PyModule_AddObject(m, "garbage", _PyRuntime.gc.garbage) < 0) return NULL; - if (callbacks == NULL) { - callbacks = PyList_New(0); - if (callbacks == NULL) + if (_PyRuntime.gc.callbacks == NULL) { + _PyRuntime.gc.callbacks = PyList_New(0); + if (_PyRuntime.gc.callbacks == NULL) return NULL; } - Py_INCREF(callbacks); - if (PyModule_AddObject(m, "callbacks", callbacks) < 0) + Py_INCREF(_PyRuntime.gc.callbacks); + if (PyModule_AddObject(m, "callbacks", _PyRuntime.gc.callbacks) < 0) return NULL; #define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return NULL @@ -1615,12 +1500,12 @@ PyGC_Collect(void) { Py_ssize_t n; - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; /* already collecting, don't do anything */ else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect_with_callback(NUM_GENERATIONS - 1); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; @@ -1629,7 +1514,7 @@ PyGC_Collect(void) Py_ssize_t _PyGC_CollectIfEnabled(void) { - if (!enabled) + if (!_PyRuntime.gc.enabled) return 0; return PyGC_Collect(); @@ -1646,12 +1531,12 @@ _PyGC_CollectNoFail(void) during interpreter shutdown (and then never finish it). See http://bugs.python.org/issue8713#msg195178 for an example. */ - if (collecting) + if (_PyRuntime.gc.collecting) n = 0; else { - collecting = 1; + _PyRuntime.gc.collecting = 1; n = collect(NUM_GENERATIONS - 1, NULL, NULL, 1); - collecting = 0; + _PyRuntime.gc.collecting = 0; } return n; } @@ -1659,10 +1544,10 @@ _PyGC_CollectNoFail(void) void _PyGC_DumpShutdownStats(void) { - if (!(debug & DEBUG_SAVEALL) - && garbage != NULL && PyList_GET_SIZE(garbage) > 0) { + if (!(_PyRuntime.gc.debug & DEBUG_SAVEALL) + && _PyRuntime.gc.garbage != NULL && PyList_GET_SIZE(_PyRuntime.gc.garbage) > 0) { char *message; - if (debug & DEBUG_UNCOLLECTABLE) + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) message = "gc: %zd uncollectable objects at " \ "shutdown"; else @@ -1673,13 +1558,13 @@ _PyGC_DumpShutdownStats(void) already. */ if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0, "gc", NULL, message, - PyList_GET_SIZE(garbage))) + PyList_GET_SIZE(_PyRuntime.gc.garbage))) PyErr_WriteUnraisable(NULL); - if (debug & DEBUG_UNCOLLECTABLE) { + if (_PyRuntime.gc.debug & DEBUG_UNCOLLECTABLE) { PyObject *repr = NULL, *bytes = NULL; - repr = PyObject_Repr(garbage); + repr = PyObject_Repr(_PyRuntime.gc.garbage); if (!repr || !(bytes = PyUnicode_EncodeFSDefault(repr))) - PyErr_WriteUnraisable(garbage); + PyErr_WriteUnraisable(_PyRuntime.gc.garbage); else { PySys_WriteStderr( " %s\n", @@ -1695,7 +1580,7 @@ _PyGC_DumpShutdownStats(void) void _PyGC_Fini(void) { - Py_CLEAR(callbacks); + Py_CLEAR(_PyRuntime.gc.callbacks); } /* for debugging */ @@ -1746,15 +1631,15 @@ _PyObject_GC_Alloc(int use_calloc, size_t basicsize) return PyErr_NoMemory(); g->gc.gc_refs = 0; _PyGCHead_SET_REFS(g, GC_UNTRACKED); - generations[0].count++; /* number of allocated GC objects */ - if (generations[0].count > generations[0].threshold && - enabled && - generations[0].threshold && - !collecting && + _PyRuntime.gc.generations[0].count++; /* number of allocated GC objects */ + if (_PyRuntime.gc.generations[0].count > _PyRuntime.gc.generations[0].threshold && + _PyRuntime.gc.enabled && + _PyRuntime.gc.generations[0].threshold && + !_PyRuntime.gc.collecting && !PyErr_Occurred()) { - collecting = 1; + _PyRuntime.gc.collecting = 1; collect_generations(); - collecting = 0; + _PyRuntime.gc.collecting = 0; } op = FROM_GC(g); return op; @@ -1819,8 +1704,8 @@ PyObject_GC_Del(void *op) PyGC_Head *g = AS_GC(op); if (IS_TRACKED(op)) gc_list_remove(g); - if (generations[0].count > 0) { - generations[0].count--; + if (_PyRuntime.gc.generations[0].count > 0) { + _PyRuntime.gc.generations[0].count--; } PyObject_FREE(g); } diff --git a/Modules/main.c b/Modules/main.c index 08b22760de1..3e347dc8e24 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -598,16 +598,10 @@ Py_Main(int argc, wchar_t **argv) } } - char *pymalloc = Py_GETENV("PYTHONMALLOC"); - if (_PyMem_SetupAllocators(pymalloc) < 0) { - fprintf(stderr, - "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", pymalloc); - exit(1); - } - /* Initialize the core language runtime */ Py_IgnoreEnvironmentFlag = core_config.ignore_environment; core_config._disable_importlib = 0; + core_config.allocator = Py_GETENV("PYTHONMALLOC"); _Py_InitializeCore(&core_config); /* Reprocess the command line with the language runtime available */ diff --git a/Modules/zipimport.c b/Modules/zipimport.c index d710360f95d..141ada5adc5 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1,4 +1,5 @@ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" #include "osdefs.h" #include "marshal.h" diff --git a/Objects/abstract.c b/Objects/abstract.c index 66ac0e3ea73..998bcb12b80 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1,6 +1,7 @@ /* Abstract Object Interface (many thanks to Jim Fulton) */ #include "Python.h" +#include "internal/pystate.h" #include #include "structmember.h" /* we need the offsetof() macro from there */ #include "longintrepr.h" diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 857a1aa070e..d09b1f22b44 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2,6 +2,8 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" #include "bytes_methods.h" #include "bytesobject.h" diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index e95ab9c63b1..d91cb7d8724 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3,6 +3,8 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "bytes_methods.h" #include "pystrhex.h" diff --git a/Objects/call.c b/Objects/call.c index 92464327fbc..91e60783117 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -1,4 +1,5 @@ #include "Python.h" +#include "internal/pystate.h" #include "frameobject.h" diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 6af93b00308..3f6389feaee 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -1,6 +1,8 @@ /* Cell object implementation */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" PyObject * PyCell_New(PyObject *obj) diff --git a/Objects/classobject.c b/Objects/classobject.c index b0ed0230569..063c24a7171 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -1,6 +1,8 @@ /* Class object implementation (dead now except for methods) */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" #define TP_DESCR_GET(t) ((t)->tp_descr_get) diff --git a/Objects/descrobject.c b/Objects/descrobject.c index c20ca9be4df..edead26a7d5 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1,6 +1,7 @@ /* Descriptors -- a new, flexible way to describe attributes */ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" /* Why is this not included in Python.h? */ /*[clinic input] diff --git a/Objects/dictobject.c b/Objects/dictobject.c index f055170750d..81c7f7f2436 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -111,6 +111,7 @@ converting the dict to the combined table. #define PyDict_MINSIZE 8 #include "Python.h" +#include "internal/pystate.h" #include "dict-common.h" #include "stringlib/eq.h" /* to get unicode_eq() */ diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 13c1be90d88..1b70be786a4 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -6,6 +6,8 @@ #define PY_SSIZE_T_CLEAN #include +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" #include "osdefs.h" diff --git a/Objects/frameobject.c b/Objects/frameobject.c index b3f0b65e51c..8739596bfc3 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -1,6 +1,7 @@ /* Frame object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "code.h" #include "frameobject.h" diff --git a/Objects/funcobject.c b/Objects/funcobject.c index e440258d7de..d376f9cab90 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -2,6 +2,8 @@ /* Function object implementation */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "code.h" #include "structmember.h" diff --git a/Objects/genobject.c b/Objects/genobject.c index 8c2213e5bf2..1a8c37abf23 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1,6 +1,7 @@ /* Generator object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "frameobject.h" #include "structmember.h" #include "opcode.h" diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 75b2fcbd411..252169acbfd 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -1,6 +1,8 @@ /* Iterator objects */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" typedef struct { PyObject_HEAD diff --git a/Objects/listobject.c b/Objects/listobject.c index 314a13c4c8f..858532252e9 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1,6 +1,7 @@ /* List object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "accu.h" #ifdef STDC_HEADERS diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 1b95af2d4a8..ccf45ffc582 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -1,6 +1,8 @@ /* Memoryview object implementation */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "pystrhex.h" #include diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 4050922e03c..2cf314660d0 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -2,6 +2,8 @@ /* Method object implementation */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" /* Free list for method objects to safe malloc/free overhead diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 89afe290323..2be49fbda38 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -2,6 +2,7 @@ /* Module object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" static Py_ssize_t max_module_number; diff --git a/Objects/object.c b/Objects/object.c index 638f7e7c9ba..74893e38c71 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2,6 +2,7 @@ /* Generic object operations; and implementation of None */ #include "Python.h" +#include "internal/pystate.h" #include "frameobject.h" #ifdef __cplusplus @@ -2022,14 +2023,6 @@ Py_ReprLeave(PyObject *obj) /* Trashcan support. */ -/* Current call-stack depth of tp_dealloc calls. */ -int _PyTrash_delete_nesting = 0; - -/* List of objects that still need to be cleaned up, singly linked via their - * gc headers' gc_prev pointers. - */ -PyObject *_PyTrash_delete_later = NULL; - /* Add op to the _PyTrash_delete_later list. Called when the current * call-stack depth gets large. op must be a currently untracked gc'ed * object, with refcount 0. Py_DECREF must already have been called on it. @@ -2040,8 +2033,8 @@ _PyTrash_deposit_object(PyObject *op) assert(PyObject_IS_GC(op)); assert(_PyGC_REFS(op) == _PyGC_REFS_UNTRACKED); assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; - _PyTrash_delete_later = op; + _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyRuntime.gc.trash_delete_later; + _PyRuntime.gc.trash_delete_later = op; } /* The equivalent API, using per-thread state recursion info */ @@ -2062,11 +2055,11 @@ _PyTrash_thread_deposit_object(PyObject *op) void _PyTrash_destroy_chain(void) { - while (_PyTrash_delete_later) { - PyObject *op = _PyTrash_delete_later; + while (_PyRuntime.gc.trash_delete_later) { + PyObject *op = _PyRuntime.gc.trash_delete_later; destructor dealloc = Py_TYPE(op)->tp_dealloc; - _PyTrash_delete_later = + _PyRuntime.gc.trash_delete_later = (PyObject*) _Py_AS_GC(op)->gc.gc_prev; /* Call the deallocator directly. This used to try to @@ -2076,9 +2069,9 @@ _PyTrash_destroy_chain(void) * up distorting allocation statistics. */ assert(op->ob_refcnt == 0); - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; (*dealloc)(op); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; } } diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index af9cf7b92c0..57edf97e206 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1,4 +1,6 @@ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include @@ -178,7 +180,9 @@ static struct { #define PYDBG_FUNCS \ _PyMem_DebugMalloc, _PyMem_DebugCalloc, _PyMem_DebugRealloc, _PyMem_DebugFree -static PyMemAllocatorEx _PyMem_Raw = { + +#define _PyMem_Raw _PyRuntime.mem.allocators.raw +static const PyMemAllocatorEx _pymem_raw = { #ifdef Py_DEBUG &_PyMem_Debug.raw, PYRAWDBG_FUNCS #else @@ -186,7 +190,8 @@ static PyMemAllocatorEx _PyMem_Raw = { #endif }; -static PyMemAllocatorEx _PyMem = { +#define _PyMem _PyRuntime.mem.allocators.mem +static const PyMemAllocatorEx _pymem = { #ifdef Py_DEBUG &_PyMem_Debug.mem, PYDBG_FUNCS #else @@ -194,7 +199,8 @@ static PyMemAllocatorEx _PyMem = { #endif }; -static PyMemAllocatorEx _PyObject = { +#define _PyObject _PyRuntime.mem.allocators.obj +static const PyMemAllocatorEx _pyobject = { #ifdef Py_DEBUG &_PyMem_Debug.obj, PYDBG_FUNCS #else @@ -267,7 +273,7 @@ _PyMem_SetupAllocators(const char *opt) #undef PYRAWDBG_FUNCS #undef PYDBG_FUNCS -static PyObjectArenaAllocator _PyObject_Arena = {NULL, +static const PyObjectArenaAllocator _PyObject_Arena = {NULL, #ifdef MS_WINDOWS _PyObject_ArenaVirtualAlloc, _PyObject_ArenaVirtualFree #elif defined(ARENAS_USE_MMAP) @@ -277,6 +283,34 @@ static PyObjectArenaAllocator _PyObject_Arena = {NULL, #endif }; +void +_PyObject_Initialize(struct _pyobj_runtime_state *state) +{ + state->allocator_arenas = _PyObject_Arena; +} + +void +_PyMem_Initialize(struct _pymem_runtime_state *state) +{ + state->allocators.raw = _pymem_raw; + state->allocators.mem = _pymem; + state->allocators.obj = _pyobject; + +#ifdef WITH_PYMALLOC + for (int i = 0; i < 8; i++) { + if (NB_SMALL_SIZE_CLASSES <= i * 8) + break; + for (int j = 0; j < 8; j++) { + int x = i * 8 + j; + poolp *addr = &(state->usedpools[2*(x)]); + poolp val = (poolp)((uint8_t *)addr - 2*sizeof(pyblock *)); + state->usedpools[x * 2] = val; + state->usedpools[x * 2 + 1] = val; + }; + }; +#endif /* WITH_PYMALLOC */ +} + #ifdef WITH_PYMALLOC static int _PyMem_DebugEnabled(void) @@ -363,13 +397,13 @@ PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator) void PyObject_GetArenaAllocator(PyObjectArenaAllocator *allocator) { - *allocator = _PyObject_Arena; + *allocator = _PyRuntime.obj.allocator_arenas; } void PyObject_SetArenaAllocator(PyObjectArenaAllocator *allocator) { - _PyObject_Arena = *allocator; + _PyRuntime.obj.allocator_arenas = *allocator; } void * @@ -404,7 +438,8 @@ PyMem_RawRealloc(void *ptr, size_t new_size) return _PyMem_Raw.realloc(_PyMem_Raw.ctx, ptr, new_size); } -void PyMem_RawFree(void *ptr) +void +PyMem_RawFree(void *ptr) { _PyMem_Raw.free(_PyMem_Raw.ctx, ptr); } @@ -521,497 +556,10 @@ PyObject_Free(void *ptr) static int running_on_valgrind = -1; #endif -/* An object allocator for Python. - - Here is an introduction to the layers of the Python memory architecture, - showing where the object allocator is actually used (layer +2), It is - called for every object allocation and deallocation (PyObject_New/Del), - unless the object-specific allocators implement a proprietary allocation - scheme (ex.: ints use a simple free list). This is also the place where - the cyclic garbage collector operates selectively on container objects. - - - Object-specific allocators - _____ ______ ______ ________ - [ int ] [ dict ] [ list ] ... [ string ] Python core | -+3 | <----- Object-specific memory -----> | <-- Non-object memory --> | - _______________________________ | | - [ Python's object allocator ] | | -+2 | ####### Object memory ####### | <------ Internal buffers ------> | - ______________________________________________________________ | - [ Python's raw memory allocator (PyMem_ API) ] | -+1 | <----- Python memory (under PyMem manager's control) ------> | | - __________________________________________________________________ - [ Underlying general-purpose allocator (ex: C library malloc) ] - 0 | <------ Virtual memory allocated for the python process -------> | - - ========================================================================= - _______________________________________________________________________ - [ OS-specific Virtual Memory Manager (VMM) ] --1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | - __________________________________ __________________________________ - [ ] [ ] --2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | - -*/ -/*==========================================================================*/ - -/* A fast, special-purpose memory allocator for small blocks, to be used - on top of a general-purpose malloc -- heavily based on previous art. */ - -/* Vladimir Marangozov -- August 2000 */ - -/* - * "Memory management is where the rubber meets the road -- if we do the wrong - * thing at any level, the results will not be good. And if we don't make the - * levels work well together, we are in serious trouble." (1) - * - * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, - * "Dynamic Storage Allocation: A Survey and Critical Review", - * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. - */ - -/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ - -/*==========================================================================*/ - -/* - * Allocation strategy abstract: - * - * For small requests, the allocator sub-allocates blocks of memory. - * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the - * system's allocator. - * - * Small requests are grouped in size classes spaced 8 bytes apart, due - * to the required valid alignment of the returned address. Requests of - * a particular size are serviced from memory pools of 4K (one VMM page). - * Pools are fragmented on demand and contain free lists of blocks of one - * particular size class. In other words, there is a fixed-size allocator - * for each size class. Free pools are shared by the different allocators - * thus minimizing the space reserved for a particular size class. - * - * This allocation strategy is a variant of what is known as "simple - * segregated storage based on array of free lists". The main drawback of - * simple segregated storage is that we might end up with lot of reserved - * memory for the different free lists, which degenerate in time. To avoid - * this, we partition each free list in pools and we share dynamically the - * reserved space between all free lists. This technique is quite efficient - * for memory intensive programs which allocate mainly small-sized blocks. - * - * For small requests we have the following table: - * - * Request in bytes Size of allocated block Size class idx - * ---------------------------------------------------------------- - * 1-8 8 0 - * 9-16 16 1 - * 17-24 24 2 - * 25-32 32 3 - * 33-40 40 4 - * 41-48 48 5 - * 49-56 56 6 - * 57-64 64 7 - * 65-72 72 8 - * ... ... ... - * 497-504 504 62 - * 505-512 512 63 - * - * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying - * allocator. - */ - -/*==========================================================================*/ - -/* - * -- Main tunable settings section -- - */ - -/* - * Alignment of addresses returned to the user. 8-bytes alignment works - * on most current architectures (with 32-bit or 64-bit address busses). - * The alignment value is also used for grouping small requests in size - * classes spaced ALIGNMENT bytes apart. - * - * You shouldn't change this unless you know what you are doing. - */ -#define ALIGNMENT 8 /* must be 2^N */ -#define ALIGNMENT_SHIFT 3 - -/* Return the number of bytes in size class I, as a uint. */ -#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) - -/* - * Max size threshold below which malloc requests are considered to be - * small enough in order to use preallocated memory pools. You can tune - * this value according to your application behaviour and memory needs. - * - * Note: a size threshold of 512 guarantees that newly created dictionaries - * will be allocated from preallocated memory pools on 64-bit. - * - * The following invariants must hold: - * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 512 - * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT - * - * Although not required, for better performance and space efficiency, - * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. - */ -#define SMALL_REQUEST_THRESHOLD 512 -#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) - -/* - * The system's VMM page size can be obtained on most unices with a - * getpagesize() call or deduced from various header files. To make - * things simpler, we assume that it is 4K, which is OK for most systems. - * It is probably better if this is the native page size, but it doesn't - * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page - * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation - * violation fault. 4K is apparently OK for all the platforms that python - * currently targets. - */ -#define SYSTEM_PAGE_SIZE (4 * 1024) -#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) - -/* - * Maximum amount of memory managed by the allocator for small requests. - */ -#ifdef WITH_MEMORY_LIMITS -#ifndef SMALL_MEMORY_LIMIT -#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ -#endif -#endif - -/* - * The allocator sub-allocates blocks of memory (called arenas) aligned - * on a page boundary. This is a reserved virtual address space for the - * current process (obtained through a malloc()/mmap() call). In no way this - * means that the memory arenas will be used entirely. A malloc() is - * usually an address range reservation for bytes, unless all pages within - * this space are referenced subsequently. So malloc'ing big blocks and not - * using them does not mean "wasting memory". It's an addressable range - * wastage... - * - * Arenas are allocated with mmap() on systems supporting anonymous memory - * mappings to reduce heap fragmentation. - */ -#define ARENA_SIZE (256 << 10) /* 256KB */ - -#ifdef WITH_MEMORY_LIMITS -#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) -#endif - -/* - * Size of the pools used for small blocks. Should be a power of 2, - * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. - */ -#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ -#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK - -/* - * -- End of tunable settings section -- - */ - -/*==========================================================================*/ - -/* - * Locking - * - * To reduce lock contention, it would probably be better to refine the - * crude function locking with per size class locking. I'm not positive - * however, whether it's worth switching to such locking policy because - * of the performance penalty it might introduce. - * - * The following macros describe the simplest (should also be the fastest) - * lock object on a particular platform and the init/fini/lock/unlock - * operations on it. The locks defined here are not expected to be recursive - * because it is assumed that they will always be called in the order: - * INIT, [LOCK, UNLOCK]*, FINI. - */ - -/* - * Python's threads are serialized, so object malloc locking is disabled. - */ -#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ -#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ -#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ -#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ -#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ - -/* When you say memory, my mind reasons in terms of (pointers to) blocks */ -typedef uint8_t block; - -/* Pool for small blocks. */ -struct pool_header { - union { block *_padding; - uint count; } ref; /* number of allocated blocks */ - block *freeblock; /* pool's free list head */ - struct pool_header *nextpool; /* next pool of this size class */ - struct pool_header *prevpool; /* previous pool "" */ - uint arenaindex; /* index into arenas of base adr */ - uint szidx; /* block size class index */ - uint nextoffset; /* bytes to virgin block */ - uint maxnextoffset; /* largest valid nextoffset */ -}; - -typedef struct pool_header *poolp; - -/* Record keeping for arenas. */ -struct arena_object { - /* The address of the arena, as returned by malloc. Note that 0 - * will never be returned by a successful malloc, and is used - * here to mark an arena_object that doesn't correspond to an - * allocated arena. - */ - uintptr_t address; - - /* Pool-aligned pointer to the next pool to be carved off. */ - block* pool_address; - - /* The number of available pools in the arena: free pools + never- - * allocated pools. - */ - uint nfreepools; - - /* The total number of pools in the arena, whether or not available. */ - uint ntotalpools; - - /* Singly-linked list of available pools. */ - struct pool_header* freepools; - - /* Whenever this arena_object is not associated with an allocated - * arena, the nextarena member is used to link all unassociated - * arena_objects in the singly-linked `unused_arena_objects` list. - * The prevarena member is unused in this case. - * - * When this arena_object is associated with an allocated arena - * with at least one available pool, both members are used in the - * doubly-linked `usable_arenas` list, which is maintained in - * increasing order of `nfreepools` values. - * - * Else this arena_object is associated with an allocated arena - * all of whose pools are in use. `nextarena` and `prevarena` - * are both meaningless in this case. - */ - struct arena_object* nextarena; - struct arena_object* prevarena; -}; - -#define POOL_OVERHEAD _Py_SIZE_ROUND_UP(sizeof(struct pool_header), ALIGNMENT) - -#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ - -/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ -#define POOL_ADDR(P) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE)) - -/* Return total number of blocks in pool of size index I, as a uint. */ -#define NUMBLOCKS(I) ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) - -/*==========================================================================*/ - -/* - * This malloc lock - */ -SIMPLELOCK_DECL(_malloc_lock) -#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) -#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) -#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) -#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) - -/* - * Pool table -- headed, circular, doubly-linked lists of partially used pools. - -This is involved. For an index i, usedpools[i+i] is the header for a list of -all partially used pools holding small blocks with "size class idx" i. So -usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size -16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to -the start of a singly-linked list of free blocks within the pool. When a -block is freed, it's inserted at the front of its pool's freeblock list. Note -that the available blocks in a pool are *not* linked all together when a pool -is initialized. Instead only "the first two" (lowest addresses) blocks are -set up, returning the first such block, and setting pool->freeblock to a -one-block list holding the second such block. This is consistent with that -pymalloc strives at all levels (arena, pool, and block) never to touch a piece -of memory until it's actually needed. - -So long as a pool is in the used state, we're certain there *is* a block -available for allocating, and pool->freeblock is not NULL. If pool->freeblock -points to the end of the free list before we've carved the entire pool into -blocks, that means we simply haven't yet gotten to one of the higher-address -blocks. The offset from the pool_header to the start of "the next" virgin -block is stored in the pool_header nextoffset member, and the largest value -of nextoffset that makes sense is stored in the maxnextoffset member when a -pool is initialized. All the blocks in a pool have been passed out at least -once when and only when nextoffset > maxnextoffset. - - -Major obscurity: While the usedpools vector is declared to have poolp -entries, it doesn't really. It really contains two pointers per (conceptual) -poolp entry, the nextpool and prevpool members of a pool_header. The -excruciating initialization code below fools C so that - - usedpool[i+i] - -"acts like" a genuine poolp, but only so long as you only reference its -nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is -compensating for that a pool_header's nextpool and prevpool members -immediately follow a pool_header's first two members: - - union { block *_padding; - uint count; } ref; - block *freeblock; - -each of which consume sizeof(block *) bytes. So what usedpools[i+i] really -contains is a fudged-up pointer p such that *if* C believes it's a poolp -pointer, then p->nextpool and p->prevpool are both p (meaning that the headed -circular list is empty). - -It's unclear why the usedpools setup is so convoluted. It could be to -minimize the amount of cache required to hold this heavily-referenced table -(which only *needs* the two interpool pointer members of a pool_header). OTOH, -referencing code has to remember to "double the index" and doing so isn't -free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying -on that C doesn't insert any padding anywhere in a pool_header at or before -the prevpool member. -**************************************************************************** */ - -#define PTA(x) ((poolp )((uint8_t *)&(usedpools[2*(x)]) - 2*sizeof(block *))) -#define PT(x) PTA(x), PTA(x) - -static poolp usedpools[2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8] = { - PT(0), PT(1), PT(2), PT(3), PT(4), PT(5), PT(6), PT(7) -#if NB_SMALL_SIZE_CLASSES > 8 - , PT(8), PT(9), PT(10), PT(11), PT(12), PT(13), PT(14), PT(15) -#if NB_SMALL_SIZE_CLASSES > 16 - , PT(16), PT(17), PT(18), PT(19), PT(20), PT(21), PT(22), PT(23) -#if NB_SMALL_SIZE_CLASSES > 24 - , PT(24), PT(25), PT(26), PT(27), PT(28), PT(29), PT(30), PT(31) -#if NB_SMALL_SIZE_CLASSES > 32 - , PT(32), PT(33), PT(34), PT(35), PT(36), PT(37), PT(38), PT(39) -#if NB_SMALL_SIZE_CLASSES > 40 - , PT(40), PT(41), PT(42), PT(43), PT(44), PT(45), PT(46), PT(47) -#if NB_SMALL_SIZE_CLASSES > 48 - , PT(48), PT(49), PT(50), PT(51), PT(52), PT(53), PT(54), PT(55) -#if NB_SMALL_SIZE_CLASSES > 56 - , PT(56), PT(57), PT(58), PT(59), PT(60), PT(61), PT(62), PT(63) -#if NB_SMALL_SIZE_CLASSES > 64 -#error "NB_SMALL_SIZE_CLASSES should be less than 64" -#endif /* NB_SMALL_SIZE_CLASSES > 64 */ -#endif /* NB_SMALL_SIZE_CLASSES > 56 */ -#endif /* NB_SMALL_SIZE_CLASSES > 48 */ -#endif /* NB_SMALL_SIZE_CLASSES > 40 */ -#endif /* NB_SMALL_SIZE_CLASSES > 32 */ -#endif /* NB_SMALL_SIZE_CLASSES > 24 */ -#endif /* NB_SMALL_SIZE_CLASSES > 16 */ -#endif /* NB_SMALL_SIZE_CLASSES > 8 */ -}; - -/*========================================================================== -Arena management. - -`arenas` is a vector of arena_objects. It contains maxarenas entries, some of -which may not be currently used (== they're arena_objects that aren't -currently associated with an allocated arena). Note that arenas proper are -separately malloc'ed. - -Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, -we do try to free() arenas, and use some mild heuristic strategies to increase -the likelihood that arenas eventually can be freed. - -unused_arena_objects - - This is a singly-linked list of the arena_objects that are currently not - being used (no arena is associated with them). Objects are taken off the - head of the list in new_arena(), and are pushed on the head of the list in - PyObject_Free() when the arena is empty. Key invariant: an arena_object - is on this list if and only if its .address member is 0. - -usable_arenas - - This is a doubly-linked list of the arena_objects associated with arenas - that have pools available. These pools are either waiting to be reused, - or have not been used before. The list is sorted to have the most- - allocated arenas first (ascending order based on the nfreepools member). - This means that the next allocation will come from a heavily used arena, - which gives the nearly empty arenas a chance to be returned to the system. - In my unscientific tests this dramatically improved the number of arenas - that could be freed. - -Note that an arena_object associated with an arena all of whose pools are -currently in use isn't on either list. -*/ - -/* Array of objects used to track chunks of memory (arenas). */ -static struct arena_object* arenas = NULL; -/* Number of slots currently allocated in the `arenas` vector. */ -static uint maxarenas = 0; - -/* The head of the singly-linked, NULL-terminated list of available - * arena_objects. - */ -static struct arena_object* unused_arena_objects = NULL; - -/* The head of the doubly-linked, NULL-terminated at each end, list of - * arena_objects associated with arenas that have pools available. - */ -static struct arena_object* usable_arenas = NULL; - -/* How many arena_objects do we initially allocate? - * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the - * `arenas` vector. - */ -#define INITIAL_ARENA_OBJECTS 16 - -/* Number of arenas allocated that haven't been free()'d. */ -static size_t narenas_currently_allocated = 0; - -/* Total number of times malloc() called to allocate an arena. */ -static size_t ntimes_arena_allocated = 0; -/* High water mark (max value ever seen) for narenas_currently_allocated. */ -static size_t narenas_highwater = 0; - -static Py_ssize_t _Py_AllocatedBlocks = 0; - Py_ssize_t _Py_GetAllocatedBlocks(void) { - return _Py_AllocatedBlocks; + return _PyRuntime.mem.num_allocated_blocks; } @@ -1035,7 +583,7 @@ new_arena(void) if (debug_stats) _PyObject_DebugMallocStats(stderr); - if (unused_arena_objects == NULL) { + if (_PyRuntime.mem.unused_arena_objects == NULL) { uint i; uint numarenas; size_t nbytes; @@ -1043,18 +591,18 @@ new_arena(void) /* Double the number of arena objects on each allocation. * Note that it's possible for `numarenas` to overflow. */ - numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; - if (numarenas <= maxarenas) + numarenas = _PyRuntime.mem.maxarenas ? _PyRuntime.mem.maxarenas << 1 : INITIAL_ARENA_OBJECTS; + if (numarenas <= _PyRuntime.mem.maxarenas) return NULL; /* overflow */ #if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > SIZE_MAX / sizeof(*arenas)) + if (numarenas > SIZE_MAX / sizeof(*_PyRuntime.mem.arenas)) return NULL; /* overflow */ #endif - nbytes = numarenas * sizeof(*arenas); - arenaobj = (struct arena_object *)PyMem_RawRealloc(arenas, nbytes); + nbytes = numarenas * sizeof(*_PyRuntime.mem.arenas); + arenaobj = (struct arena_object *)PyMem_RawRealloc(_PyRuntime.mem.arenas, nbytes); if (arenaobj == NULL) return NULL; - arenas = arenaobj; + _PyRuntime.mem.arenas = arenaobj; /* We might need to fix pointers that were copied. However, * new_arena only gets called when all the pages in the @@ -1062,45 +610,45 @@ new_arena(void) * into the old array. Thus, we don't have to worry about * invalid pointers. Just to be sure, some asserts: */ - assert(usable_arenas == NULL); - assert(unused_arena_objects == NULL); + assert(_PyRuntime.mem.usable_arenas == NULL); + assert(_PyRuntime.mem.unused_arena_objects == NULL); /* Put the new arenas on the unused_arena_objects list. */ - for (i = maxarenas; i < numarenas; ++i) { - arenas[i].address = 0; /* mark as unassociated */ - arenas[i].nextarena = i < numarenas - 1 ? - &arenas[i+1] : NULL; + for (i = _PyRuntime.mem.maxarenas; i < numarenas; ++i) { + _PyRuntime.mem.arenas[i].address = 0; /* mark as unassociated */ + _PyRuntime.mem.arenas[i].nextarena = i < numarenas - 1 ? + &_PyRuntime.mem.arenas[i+1] : NULL; } /* Update globals. */ - unused_arena_objects = &arenas[maxarenas]; - maxarenas = numarenas; + _PyRuntime.mem.unused_arena_objects = &_PyRuntime.mem.arenas[_PyRuntime.mem.maxarenas]; + _PyRuntime.mem.maxarenas = numarenas; } /* Take the next available arena object off the head of the list. */ - assert(unused_arena_objects != NULL); - arenaobj = unused_arena_objects; - unused_arena_objects = arenaobj->nextarena; + assert(_PyRuntime.mem.unused_arena_objects != NULL); + arenaobj = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = arenaobj->nextarena; assert(arenaobj->address == 0); - address = _PyObject_Arena.alloc(_PyObject_Arena.ctx, ARENA_SIZE); + address = _PyRuntime.obj.allocator_arenas.alloc(_PyRuntime.obj.allocator_arenas.ctx, ARENA_SIZE); if (address == NULL) { /* The allocation failed: return NULL after putting the * arenaobj back. */ - arenaobj->nextarena = unused_arena_objects; - unused_arena_objects = arenaobj; + arenaobj->nextarena = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = arenaobj; return NULL; } arenaobj->address = (uintptr_t)address; - ++narenas_currently_allocated; - ++ntimes_arena_allocated; - if (narenas_currently_allocated > narenas_highwater) - narenas_highwater = narenas_currently_allocated; + ++_PyRuntime.mem.narenas_currently_allocated; + ++_PyRuntime.mem.ntimes_arena_allocated; + if (_PyRuntime.mem.narenas_currently_allocated > _PyRuntime.mem.narenas_highwater) + _PyRuntime.mem.narenas_highwater = _PyRuntime.mem.narenas_currently_allocated; arenaobj->freepools = NULL; /* pool_address <- first pool-aligned address in the arena nfreepools <- number of whole pools that fit after alignment */ - arenaobj->pool_address = (block*)arenaobj->address; + arenaobj->pool_address = (pyblock*)arenaobj->address; arenaobj->nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * arenaobj->nfreepools == ARENA_SIZE); excess = (uint)(arenaobj->address & POOL_SIZE_MASK); @@ -1197,9 +745,9 @@ address_in_range(void *p, poolp pool) // the GIL. The following dance forces the compiler to read pool->arenaindex // only once. uint arenaindex = *((volatile uint *)&pool->arenaindex); - return arenaindex < maxarenas && - (uintptr_t)p - arenas[arenaindex].address < ARENA_SIZE && - arenas[arenaindex].address != 0; + return arenaindex < _PyRuntime.mem.maxarenas && + (uintptr_t)p - _PyRuntime.mem.arenas[arenaindex].address < ARENA_SIZE && + _PyRuntime.mem.arenas[arenaindex].address != 0; } /*==========================================================================*/ @@ -1220,12 +768,12 @@ static void * _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) { size_t nbytes; - block *bp; + pyblock *bp; poolp pool; poolp next; uint size; - _Py_AllocatedBlocks++; + _PyRuntime.mem.num_allocated_blocks++; assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize); nbytes = nelem * elsize; @@ -1246,7 +794,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * Most frequent paths first */ size = (uint)(nbytes - 1) >> ALIGNMENT_SHIFT; - pool = usedpools[size + size]; + pool = _PyRuntime.mem.usedpools[size + size]; if (pool != pool->nextpool) { /* * There is a used pool for this size class. @@ -1255,7 +803,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) ++pool->ref.count; bp = pool->freeblock; assert(bp != NULL); - if ((pool->freeblock = *(block **)bp) != NULL) { + if ((pool->freeblock = *(pyblock **)bp) != NULL) { UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1266,10 +814,10 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ if (pool->nextoffset <= pool->maxnextoffset) { /* There is room for another block. */ - pool->freeblock = (block*)pool + + pool->freeblock = (pyblock*)pool + pool->nextoffset; pool->nextoffset += INDEX2SIZE(size); - *(block **)(pool->freeblock) = NULL; + *(pyblock **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1289,29 +837,29 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) /* There isn't a pool of the right size class immediately * available: use a free pool. */ - if (usable_arenas == NULL) { + if (_PyRuntime.mem.usable_arenas == NULL) { /* No arena has a free pool: allocate a new arena. */ #ifdef WITH_MEMORY_LIMITS - if (narenas_currently_allocated >= MAX_ARENAS) { + if (_PyRuntime.mem.narenas_currently_allocated >= MAX_ARENAS) { UNLOCK(); goto redirect; } #endif - usable_arenas = new_arena(); - if (usable_arenas == NULL) { + _PyRuntime.mem.usable_arenas = new_arena(); + if (_PyRuntime.mem.usable_arenas == NULL) { UNLOCK(); goto redirect; } - usable_arenas->nextarena = - usable_arenas->prevarena = NULL; + _PyRuntime.mem.usable_arenas->nextarena = + _PyRuntime.mem.usable_arenas->prevarena = NULL; } - assert(usable_arenas->address != 0); + assert(_PyRuntime.mem.usable_arenas->address != 0); /* Try to get a cached free pool. */ - pool = usable_arenas->freepools; + pool = _PyRuntime.mem.usable_arenas->freepools; if (pool != NULL) { /* Unlink from cached pools. */ - usable_arenas->freepools = pool->nextpool; + _PyRuntime.mem.usable_arenas->freepools = pool->nextpool; /* This arena already had the smallest nfreepools * value, so decreasing nfreepools doesn't change @@ -1320,18 +868,18 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * become wholly allocated, we need to remove its * arena_object from usable_arenas. */ - --usable_arenas->nfreepools; - if (usable_arenas->nfreepools == 0) { + --_PyRuntime.mem.usable_arenas->nfreepools; + if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { /* Wholly allocated: remove. */ - assert(usable_arenas->freepools == NULL); - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); - - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); + assert(_PyRuntime.mem.usable_arenas->freepools == NULL); + assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || + _PyRuntime.mem.usable_arenas->nextarena->prevarena == + _PyRuntime.mem.usable_arenas); + + _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; + if (_PyRuntime.mem.usable_arenas != NULL) { + _PyRuntime.mem.usable_arenas->prevarena = NULL; + assert(_PyRuntime.mem.usable_arenas->address != 0); } } else { @@ -1340,14 +888,14 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) * off all the arena's pools for the first * time. */ - assert(usable_arenas->freepools != NULL || - usable_arenas->pool_address <= - (block*)usable_arenas->address + + assert(_PyRuntime.mem.usable_arenas->freepools != NULL || + _PyRuntime.mem.usable_arenas->pool_address <= + (pyblock*)_PyRuntime.mem.usable_arenas->address + ARENA_SIZE - POOL_SIZE); } init_pool: /* Frontlink to used pools. */ - next = usedpools[size + size]; /* == prev */ + next = _PyRuntime.mem.usedpools[size + size]; /* == prev */ pool->nextpool = next; pool->prevpool = next; next->nextpool = pool; @@ -1360,7 +908,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ bp = pool->freeblock; assert(bp != NULL); - pool->freeblock = *(block **)bp; + pool->freeblock = *(pyblock **)bp; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1373,11 +921,11 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) */ pool->szidx = size; size = INDEX2SIZE(size); - bp = (block *)pool + POOL_OVERHEAD; + bp = (pyblock *)pool + POOL_OVERHEAD; pool->nextoffset = POOL_OVERHEAD + (size << 1); pool->maxnextoffset = POOL_SIZE - size; pool->freeblock = bp + size; - *(block **)(pool->freeblock) = NULL; + *(pyblock **)(pool->freeblock) = NULL; UNLOCK(); if (use_calloc) memset(bp, 0, nbytes); @@ -1385,26 +933,26 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) } /* Carve off a new pool. */ - assert(usable_arenas->nfreepools > 0); - assert(usable_arenas->freepools == NULL); - pool = (poolp)usable_arenas->pool_address; - assert((block*)pool <= (block*)usable_arenas->address + - ARENA_SIZE - POOL_SIZE); - pool->arenaindex = (uint)(usable_arenas - arenas); - assert(&arenas[pool->arenaindex] == usable_arenas); + assert(_PyRuntime.mem.usable_arenas->nfreepools > 0); + assert(_PyRuntime.mem.usable_arenas->freepools == NULL); + pool = (poolp)_PyRuntime.mem.usable_arenas->pool_address; + assert((pyblock*)pool <= (pyblock*)_PyRuntime.mem.usable_arenas->address + + ARENA_SIZE - POOL_SIZE); + pool->arenaindex = (uint)(_PyRuntime.mem.usable_arenas - _PyRuntime.mem.arenas); + assert(&_PyRuntime.mem.arenas[pool->arenaindex] == _PyRuntime.mem.usable_arenas); pool->szidx = DUMMY_SIZE_IDX; - usable_arenas->pool_address += POOL_SIZE; - --usable_arenas->nfreepools; + _PyRuntime.mem.usable_arenas->pool_address += POOL_SIZE; + --_PyRuntime.mem.usable_arenas->nfreepools; - if (usable_arenas->nfreepools == 0) { - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); + if (_PyRuntime.mem.usable_arenas->nfreepools == 0) { + assert(_PyRuntime.mem.usable_arenas->nextarena == NULL || + _PyRuntime.mem.usable_arenas->nextarena->prevarena == + _PyRuntime.mem.usable_arenas); /* Unlink the arena: it is completely allocated. */ - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); + _PyRuntime.mem.usable_arenas = _PyRuntime.mem.usable_arenas->nextarena; + if (_PyRuntime.mem.usable_arenas != NULL) { + _PyRuntime.mem.usable_arenas->prevarena = NULL; + assert(_PyRuntime.mem.usable_arenas->address != 0); } } @@ -1426,7 +974,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) else result = PyMem_RawMalloc(nbytes); if (!result) - _Py_AllocatedBlocks--; + _PyRuntime.mem.num_allocated_blocks--; return result; } } @@ -1449,14 +997,14 @@ static void _PyObject_Free(void *ctx, void *p) { poolp pool; - block *lastfree; + pyblock *lastfree; poolp next, prev; uint size; if (p == NULL) /* free(NULL) has no effect */ return; - _Py_AllocatedBlocks--; + _PyRuntime.mem.num_allocated_blocks--; #ifdef WITH_VALGRIND if (UNLIKELY(running_on_valgrind > 0)) @@ -1474,8 +1022,8 @@ _PyObject_Free(void *ctx, void *p) * list in any case). */ assert(pool->ref.count > 0); /* else it was empty */ - *(block **)p = lastfree = pool->freeblock; - pool->freeblock = (block *)p; + *(pyblock **)p = lastfree = pool->freeblock; + pool->freeblock = (pyblock *)p; if (lastfree) { struct arena_object* ao; uint nf; /* ao->nfreepools */ @@ -1501,7 +1049,7 @@ _PyObject_Free(void *ctx, void *p) /* Link the pool to freepools. This is a singly-linked * list, and pool->prevpool isn't used there. */ - ao = &arenas[pool->arenaindex]; + ao = &_PyRuntime.mem.arenas[pool->arenaindex]; pool->nextpool = ao->freepools; ao->freepools = pool; nf = ++ao->nfreepools; @@ -1530,9 +1078,9 @@ _PyObject_Free(void *ctx, void *p) * usable_arenas pointer. */ if (ao->prevarena == NULL) { - usable_arenas = ao->nextarena; - assert(usable_arenas == NULL || - usable_arenas->address != 0); + _PyRuntime.mem.usable_arenas = ao->nextarena; + assert(_PyRuntime.mem.usable_arenas == NULL || + _PyRuntime.mem.usable_arenas->address != 0); } else { assert(ao->prevarena->nextarena == ao); @@ -1548,14 +1096,14 @@ _PyObject_Free(void *ctx, void *p) /* Record that this arena_object slot is * available to be reused. */ - ao->nextarena = unused_arena_objects; - unused_arena_objects = ao; + ao->nextarena = _PyRuntime.mem.unused_arena_objects; + _PyRuntime.mem.unused_arena_objects = ao; /* Free the entire arena. */ - _PyObject_Arena.free(_PyObject_Arena.ctx, + _PyRuntime.obj.allocator_arenas.free(_PyRuntime.obj.allocator_arenas.ctx, (void *)ao->address, ARENA_SIZE); ao->address = 0; /* mark unassociated */ - --narenas_currently_allocated; + --_PyRuntime.mem.narenas_currently_allocated; UNLOCK(); return; @@ -1566,12 +1114,12 @@ _PyObject_Free(void *ctx, void *p) * ao->nfreepools was 0 before, ao isn't * currently on the usable_arenas list. */ - ao->nextarena = usable_arenas; + ao->nextarena = _PyRuntime.mem.usable_arenas; ao->prevarena = NULL; - if (usable_arenas) - usable_arenas->prevarena = ao; - usable_arenas = ao; - assert(usable_arenas->address != 0); + if (_PyRuntime.mem.usable_arenas) + _PyRuntime.mem.usable_arenas->prevarena = ao; + _PyRuntime.mem.usable_arenas = ao; + assert(_PyRuntime.mem.usable_arenas->address != 0); UNLOCK(); return; @@ -1601,8 +1149,8 @@ _PyObject_Free(void *ctx, void *p) } else { /* ao is at the head of the list */ - assert(usable_arenas == ao); - usable_arenas = ao->nextarena; + assert(_PyRuntime.mem.usable_arenas == ao); + _PyRuntime.mem.usable_arenas = ao->nextarena; } ao->nextarena->prevarena = ao->prevarena; @@ -1631,7 +1179,7 @@ _PyObject_Free(void *ctx, void *p) nf > ao->prevarena->nfreepools); assert(ao->nextarena == NULL || ao->nextarena->prevarena == ao); - assert((usable_arenas == ao && + assert((_PyRuntime.mem.usable_arenas == ao && ao->prevarena == NULL) || ao->prevarena->nextarena == ao); @@ -1647,7 +1195,7 @@ _PyObject_Free(void *ctx, void *p) --pool->ref.count; assert(pool->ref.count > 0); /* else the pool is empty */ size = pool->szidx; - next = usedpools[size + size]; + next = _PyRuntime.mem.usedpools[size + size]; prev = next->prevpool; /* insert pool before next: prev <-> pool <-> next */ pool->nextpool = next; @@ -1769,15 +1317,13 @@ _Py_GetAllocatedBlocks(void) #define DEADBYTE 0xDB /* dead (newly freed) memory */ #define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ -static size_t serialno = 0; /* incremented on each debug {m,re}alloc */ - /* serialno is always incremented via calling this routine. The point is * to supply a single place to set a breakpoint. */ static void bumpserialno(void) { - ++serialno; + ++_PyRuntime.mem.serialno; } #define SST SIZEOF_SIZE_T @@ -1868,7 +1414,7 @@ _PyMem_DebugRawAlloc(int use_calloc, void *ctx, size_t nbytes) /* at tail, write pad (SST bytes) and serialno (SST bytes) */ tail = p + 2*SST + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); + write_size_t(tail + SST, _PyRuntime.mem.serialno); return p + 2*SST; } @@ -1953,7 +1499,7 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes) tail = q + nbytes; memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); + write_size_t(tail + SST, _PyRuntime.mem.serialno); if (nbytes > original_nbytes) { /* growing: mark new extra memory clean */ @@ -2283,16 +1829,16 @@ _PyObject_DebugMallocStats(FILE *out) * to march over all the arenas. If we're lucky, most of the memory * will be living in full pools -- would be a shame to miss them. */ - for (i = 0; i < maxarenas; ++i) { + for (i = 0; i < _PyRuntime.mem.maxarenas; ++i) { uint j; - uintptr_t base = arenas[i].address; + uintptr_t base = _PyRuntime.mem.arenas[i].address; /* Skip arenas which are not allocated. */ - if (arenas[i].address == (uintptr_t)NULL) + if (_PyRuntime.mem.arenas[i].address == (uintptr_t)NULL) continue; narenas += 1; - numfreepools += arenas[i].nfreepools; + numfreepools += _PyRuntime.mem.arenas[i].nfreepools; /* round up to pool alignment */ if (base & (uintptr_t)POOL_SIZE_MASK) { @@ -2302,8 +1848,8 @@ _PyObject_DebugMallocStats(FILE *out) } /* visit every pool in the arena */ - assert(base <= (uintptr_t) arenas[i].pool_address); - for (j = 0; base < (uintptr_t) arenas[i].pool_address; + assert(base <= (uintptr_t) _PyRuntime.mem.arenas[i].pool_address); + for (j = 0; base < (uintptr_t) _PyRuntime.mem.arenas[i].pool_address; ++j, base += POOL_SIZE) { poolp p = (poolp)base; const uint sz = p->szidx; @@ -2312,7 +1858,7 @@ _PyObject_DebugMallocStats(FILE *out) if (p->ref.count == 0) { /* currently unused */ #ifdef Py_DEBUG - assert(pool_is_in_list(p, arenas[i].freepools)); + assert(pool_is_in_list(p, _PyRuntime.mem.arenas[i].freepools)); #endif continue; } @@ -2322,11 +1868,11 @@ _PyObject_DebugMallocStats(FILE *out) numfreeblocks[sz] += freeblocks; #ifdef Py_DEBUG if (freeblocks > 0) - assert(pool_is_in_list(p, usedpools[sz + sz])); + assert(pool_is_in_list(p, _PyRuntime.mem.usedpools[sz + sz])); #endif } } - assert(narenas == narenas_currently_allocated); + assert(narenas == _PyRuntime.mem.narenas_currently_allocated); fputc('\n', out); fputs("class size num pools blocks in use avail blocks\n" @@ -2354,10 +1900,10 @@ _PyObject_DebugMallocStats(FILE *out) } fputc('\n', out); if (_PyMem_DebugEnabled()) - (void)printone(out, "# times object malloc called", serialno); - (void)printone(out, "# arenas allocated total", ntimes_arena_allocated); - (void)printone(out, "# arenas reclaimed", ntimes_arena_allocated - narenas); - (void)printone(out, "# arenas highwater mark", narenas_highwater); + (void)printone(out, "# times object malloc called", _PyRuntime.mem.serialno); + (void)printone(out, "# arenas allocated total", _PyRuntime.mem.ntimes_arena_allocated); + (void)printone(out, "# arenas reclaimed", _PyRuntime.mem.ntimes_arena_allocated - narenas); + (void)printone(out, "# arenas highwater mark", _PyRuntime.mem.narenas_highwater); (void)printone(out, "# arenas allocated current", narenas); PyOS_snprintf(buf, sizeof(buf), diff --git a/Objects/odictobject.c b/Objects/odictobject.c index e1ee53beae6..8ad8f384c41 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -470,6 +470,7 @@ Potential Optimizations */ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" #include "dict-common.h" #include diff --git a/Objects/setobject.c b/Objects/setobject.c index 219e81d0baf..8772e58f0a0 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -32,6 +32,7 @@ */ #include "Python.h" +#include "internal/pystate.h" #include "structmember.h" /* Object used as dummy key to fill deleted entries */ diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index b5aabfd9d7a..59f084d1a61 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -14,6 +14,8 @@ this type and there is exactly one in existence. */ #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "structmember.h" static PyObject * diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 2a904904993..c150af8ed1a 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -2,6 +2,7 @@ /* Tuple object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "accu.h" /*[clinic input] diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 1d963aae3f8..b2154bbf690 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1,6 +1,7 @@ /* Type object implementation */ #include "Python.h" +#include "internal/pystate.h" #include "frameobject.h" #include "structmember.h" @@ -1157,10 +1158,10 @@ subtype_dealloc(PyObject *self) /* UnTrack and re-Track around the trashcan macro, alas */ /* See explanation at end of function for full disclosure */ PyObject_GC_UnTrack(self); - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_BEGIN(self); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; -- tstate->trash_delete_nesting; /* Find the nearest base with a different tp_dealloc */ @@ -1254,10 +1255,10 @@ subtype_dealloc(PyObject *self) Py_DECREF(type); endlabel: - ++_PyTrash_delete_nesting; + ++_PyRuntime.gc.trash_delete_nesting; ++ tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_END(self); - --_PyTrash_delete_nesting; + --_PyRuntime.gc.trash_delete_nesting; -- tstate->trash_delete_nesting; /* Explanation of the weirdness around the trashcan macros: @@ -1297,7 +1298,7 @@ subtype_dealloc(PyObject *self) a subtle disaster. Q. Why the bizarre (net-zero) manipulation of - _PyTrash_delete_nesting around the trashcan macros? + _PyRuntime.trash_delete_nesting around the trashcan macros? A. Some base classes (e.g. list) also use the trashcan mechanism. The following scenario used to be possible: diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f7b2aa6c3df..db1516ddf65 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -40,6 +40,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "internal/pystate.h" #include "ucnhash.h" #include "bytes_methods.h" #include "stringlib/eq.h" diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 0da68418cc0..4e25fbd973d 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -278,18 +278,20 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ /* For an MSVC DLL, we can nominate the .lib files used by extensions */ #ifdef MS_COREDLL # ifndef Py_BUILD_CORE /* not building the core - must be an ext */ -# if defined(_MSC_VER) - /* So MSVC users need not specify the .lib file in - their Makefile (other compilers are generally - taken care of by distutils.) */ -# if defined(_DEBUG) -# pragma comment(lib,"python37_d.lib") -# elif defined(Py_LIMITED_API) -# pragma comment(lib,"python3.lib") -# else -# pragma comment(lib,"python37.lib") -# endif /* _DEBUG */ -# endif /* _MSC_VER */ +# ifndef Py_BUILD_CORE_MODULE +# if defined(_MSC_VER) + /* So MSVC users need not specify the .lib + file in their Makefile (other compilers are + generally taken care of by distutils.) */ +# if defined(_DEBUG) +# pragma comment(lib,"python37_d.lib") +# elif defined(Py_LIMITED_API) +# pragma comment(lib,"python3.lib") +# else +# pragma comment(lib,"python37.lib") +# endif /* _DEBUG */ +# endif /* _MSC_VER */ +# endif /* Py_BUILD_CORE_MODULE */ # endif /* Py_BUILD_CORE */ #endif /* MS_COREDLL */ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 59910951b62..246de78463d 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -112,6 +112,13 @@ + + + + + + + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 115ce85edec..b37e9930e31 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -129,6 +129,27 @@ Include + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + Include diff --git a/Parser/myreadline.c b/Parser/myreadline.c index 1b63f7863fa..7fe04a9d365 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -10,6 +10,7 @@ */ #include "Python.h" +#include "internal/pystate.h" #ifdef MS_WINDOWS #define WIN32_LEAN_AND_MEAN #include "windows.h" diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c index ce66ebca0cc..8f3e2f7c4ee 100644 --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -16,6 +16,8 @@ #define PGEN #include "Python.h" +#include "internal/mem.h" +#include "internal/pystate.h" #include "pgenheaders.h" #include "grammar.h" #include "node.h" @@ -25,6 +27,7 @@ int Py_DebugFlag; int Py_VerboseFlag; int Py_IgnoreEnvironmentFlag; +_PyRuntimeState _PyRuntime = {0, 0}; /* Forward */ grammar *getgrammar(const char *filename); @@ -59,6 +62,8 @@ main(int argc, char **argv) filename = argv[1]; graminit_h = argv[2]; graminit_c = argv[3]; + _PyObject_Initialize(&_PyRuntime.obj); + _PyMem_Initialize(&_PyRuntime.mem); g = getgrammar(filename); fp = fopen(graminit_c, "w"); if (fp == NULL) { diff --git a/Python/_warnings.c b/Python/_warnings.c index 8616195c4e3..5230318788c 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1,4 +1,5 @@ #include "Python.h" +#include "internal/pystate.h" #include "frameobject.h" #include "clinic/_warnings.c.h" @@ -8,13 +9,6 @@ PyDoc_STRVAR(warnings__doc__, MODULE_NAME " provides basic warning filtering support.\n" "It is a helper module to speed up interpreter start-up."); -/* Both 'filters' and 'onceregistry' can be set in warnings.py; - get_warnings_attr() will reset these variables accordingly. */ -static PyObject *_filters; /* List */ -static PyObject *_once_registry; /* Dict */ -static PyObject *_default_action; /* String */ -static long _filters_version; - _Py_IDENTIFIER(argv); _Py_IDENTIFIER(stderr); @@ -53,7 +47,7 @@ get_warnings_attr(const char *attr, int try_import) } /* don't try to import after the start of the Python finallization */ - if (try_import && _Py_Finalizing == NULL) { + if (try_import && !_Py_IsFinalizing()) { warnings_module = PyImport_Import(warnings_str); if (warnings_module == NULL) { /* Fallback to the C implementation if we cannot get @@ -90,10 +84,10 @@ get_once_registry(void) if (registry == NULL) { if (PyErr_Occurred()) return NULL; - return _once_registry; + return _PyRuntime.warnings.once_registry; } - Py_DECREF(_once_registry); - _once_registry = registry; + Py_DECREF(_PyRuntime.warnings.once_registry); + _PyRuntime.warnings.once_registry = registry; return registry; } @@ -108,11 +102,11 @@ get_default_action(void) if (PyErr_Occurred()) { return NULL; } - return _default_action; + return _PyRuntime.warnings.default_action; } - Py_DECREF(_default_action); - _default_action = default_action; + Py_DECREF(_PyRuntime.warnings.default_action); + _PyRuntime.warnings.default_action = default_action; return default_action; } @@ -132,23 +126,24 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, return NULL; } else { - Py_DECREF(_filters); - _filters = warnings_filters; + Py_DECREF(_PyRuntime.warnings.filters); + _PyRuntime.warnings.filters = warnings_filters; } - if (_filters == NULL || !PyList_Check(_filters)) { + PyObject *filters = _PyRuntime.warnings.filters; + if (filters == NULL || !PyList_Check(filters)) { PyErr_SetString(PyExc_ValueError, MODULE_NAME ".filters must be a list"); return NULL; } - /* _filters could change while we are iterating over it. */ - for (i = 0; i < PyList_GET_SIZE(_filters); i++) { + /* _PyRuntime.warnings.filters could change while we are iterating over it. */ + for (i = 0; i < PyList_GET_SIZE(filters); i++) { PyObject *tmp_item, *action, *msg, *cat, *mod, *ln_obj; Py_ssize_t ln; int is_subclass, good_msg, good_mod; - tmp_item = PyList_GET_ITEM(_filters, i); + tmp_item = PyList_GET_ITEM(filters, i); if (!PyTuple_Check(tmp_item) || PyTuple_GET_SIZE(tmp_item) != 5) { PyErr_Format(PyExc_ValueError, MODULE_NAME ".filters item %zd isn't a 5-tuple", i); @@ -220,9 +215,9 @@ already_warned(PyObject *registry, PyObject *key, int should_set) version_obj = _PyDict_GetItemId(registry, &PyId_version); if (version_obj == NULL || !PyLong_CheckExact(version_obj) - || PyLong_AsLong(version_obj) != _filters_version) { + || PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) { PyDict_Clear(registry); - version_obj = PyLong_FromLong(_filters_version); + version_obj = PyLong_FromLong(_PyRuntime.warnings.filters_version); if (version_obj == NULL) return -1; if (_PyDict_SetItemId(registry, &PyId_version, version_obj) < 0) { @@ -520,7 +515,7 @@ warn_explicit(PyObject *category, PyObject *message, if (registry == NULL) goto cleanup; } - /* _once_registry[(text, category)] = 1 */ + /* _PyRuntime.warnings.once_registry[(text, category)] = 1 */ rc = update_registry(registry, text, category, 0); } else if (_PyUnicode_EqualToASCIIString(action, "module")) { @@ -910,7 +905,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) static PyObject * warnings_filters_mutated(PyObject *self, PyObject *args) { - _filters_version++; + _PyRuntime.warnings.filters_version++; Py_RETURN_NONE; } @@ -1160,7 +1155,8 @@ create_filter(PyObject *category, const char *action) } /* This assumes the line number is zero for now. */ - return PyTuple_Pack(5, action_obj, Py_None, category, Py_None, _PyLong_Zero); + return PyTuple_Pack(5, action_obj, Py_None, + category, Py_None, _PyLong_Zero); } static PyObject * @@ -1228,33 +1224,35 @@ _PyWarnings_Init(void) if (m == NULL) return NULL; - if (_filters == NULL) { - _filters = init_filters(); - if (_filters == NULL) + if (_PyRuntime.warnings.filters == NULL) { + _PyRuntime.warnings.filters = init_filters(); + if (_PyRuntime.warnings.filters == NULL) return NULL; } - Py_INCREF(_filters); - if (PyModule_AddObject(m, "filters", _filters) < 0) + Py_INCREF(_PyRuntime.warnings.filters); + if (PyModule_AddObject(m, "filters", _PyRuntime.warnings.filters) < 0) return NULL; - if (_once_registry == NULL) { - _once_registry = PyDict_New(); - if (_once_registry == NULL) + if (_PyRuntime.warnings.once_registry == NULL) { + _PyRuntime.warnings.once_registry = PyDict_New(); + if (_PyRuntime.warnings.once_registry == NULL) return NULL; } - Py_INCREF(_once_registry); - if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) + Py_INCREF(_PyRuntime.warnings.once_registry); + if (PyModule_AddObject(m, "_onceregistry", + _PyRuntime.warnings.once_registry) < 0) return NULL; - if (_default_action == NULL) { - _default_action = PyUnicode_FromString("default"); - if (_default_action == NULL) + if (_PyRuntime.warnings.default_action == NULL) { + _PyRuntime.warnings.default_action = PyUnicode_FromString("default"); + if (_PyRuntime.warnings.default_action == NULL) return NULL; } - Py_INCREF(_default_action); - if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) + Py_INCREF(_PyRuntime.warnings.default_action); + if (PyModule_AddObject(m, "_defaultaction", + _PyRuntime.warnings.default_action) < 0) return NULL; - _filters_version = 0; + _PyRuntime.warnings.filters_version = 0; return m; } diff --git a/Python/ceval.c b/Python/ceval.c index a072a5fe81e..e583e272d72 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -10,6 +10,7 @@ #define PY_LOCAL_AGGRESSIVE #include "Python.h" +#include "internal/pystate.h" #include "code.h" #include "dictobject.h" @@ -36,7 +37,8 @@ extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **); typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *); /* Forward declarations */ -Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *); +Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, + PyObject *); static PyObject * do_call_core(PyObject *, PyObject *, PyObject *); #ifdef LLTRACE @@ -52,13 +54,15 @@ static int call_trace_protected(Py_tracefunc, PyObject *, static void call_exc_trace(Py_tracefunc, PyObject *, PyThreadState *, PyFrameObject *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, - PyThreadState *, PyFrameObject *, int *, int *, int *); + PyThreadState *, PyFrameObject *, + int *, int *, int *); static void maybe_dtrace_line(PyFrameObject *, int *, int *, int *); static void dtrace_function_entry(PyFrameObject *); static void dtrace_function_return(PyFrameObject *); static PyObject * cmp_outcome(int, PyObject *, PyObject *); -static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, PyObject *); +static PyObject * import_name(PyFrameObject *, PyObject *, PyObject *, + PyObject *); static PyObject * import_from(PyObject *, PyObject *); static int import_all_from(PyObject *, PyObject *); static void format_exc_check_arg(PyObject *, const char *, PyObject *); @@ -87,72 +91,60 @@ static long dxp[256]; #endif #endif -#define GIL_REQUEST _Py_atomic_load_relaxed(&gil_drop_request) +#define GIL_REQUEST _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) /* This can set eval_breaker to 0 even though gil_drop_request became 1. We believe this is all right because the eval loop will release the GIL eventually anyway. */ #define COMPUTE_EVAL_BREAKER() \ _Py_atomic_store_relaxed( \ - &eval_breaker, \ + &_PyRuntime.ceval.eval_breaker, \ GIL_REQUEST | \ - _Py_atomic_load_relaxed(&pendingcalls_to_do) | \ - pending_async_exc) + _Py_atomic_load_relaxed(&_PyRuntime.ceval.pending.calls_to_do) | \ + _PyRuntime.ceval.pending.async_exc) #define SET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&gil_drop_request, 1); \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define RESET_GIL_DROP_REQUEST() \ do { \ - _Py_atomic_store_relaxed(&gil_drop_request, 0); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil_drop_request, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) /* Pending calls are only modified under pending_lock */ #define SIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&pendingcalls_to_do, 1); \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 1); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define UNSIGNAL_PENDING_CALLS() \ do { \ - _Py_atomic_store_relaxed(&pendingcalls_to_do, 0); \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.pending.calls_to_do, 0); \ COMPUTE_EVAL_BREAKER(); \ } while (0) #define SIGNAL_ASYNC_EXC() \ do { \ - pending_async_exc = 1; \ - _Py_atomic_store_relaxed(&eval_breaker, 1); \ + _PyRuntime.ceval.pending.async_exc = 1; \ + _Py_atomic_store_relaxed(&_PyRuntime.ceval.eval_breaker, 1); \ } while (0) #define UNSIGNAL_ASYNC_EXC() \ - do { pending_async_exc = 0; COMPUTE_EVAL_BREAKER(); } while (0) - + do { \ + _PyRuntime.ceval.pending.async_exc = 0; \ + COMPUTE_EVAL_BREAKER(); \ + } while (0) -/* This single variable consolidates all requests to break out of the fast path - in the eval loop. */ -static _Py_atomic_int eval_breaker = {0}; -/* Request for running pending calls. */ -static _Py_atomic_int pendingcalls_to_do = {0}; -/* Request for looking at the `async_exc` field of the current thread state. - Guarded by the GIL. */ -static int pending_async_exc = 0; #ifdef HAVE_ERRNO_H #include #endif #include "pythread.h" - -static PyThread_type_lock pending_lock = 0; /* for pending calls */ -static unsigned long main_thread = 0; -/* Request for dropping the GIL */ -static _Py_atomic_int gil_drop_request = {0}; - #include "ceval_gil.h" int @@ -168,9 +160,9 @@ PyEval_InitThreads(void) return; create_gil(); take_gil(PyThreadState_GET()); - main_thread = PyThread_get_thread_ident(); - if (!pending_lock) - pending_lock = PyThread_allocate_lock(); + _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); + if (!_PyRuntime.ceval.pending.lock) + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); } void @@ -238,9 +230,9 @@ PyEval_ReInitThreads(void) if (!gil_created()) return; recreate_gil(); - pending_lock = PyThread_allocate_lock(); + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); take_gil(current_tstate); - main_thread = PyThread_get_thread_ident(); + _PyRuntime.ceval.pending.main_thread = PyThread_get_thread_ident(); /* Destroy all threads except the current one */ _PyThreadState_DeleteExcept(current_tstate); @@ -279,7 +271,7 @@ PyEval_RestoreThread(PyThreadState *tstate) int err = errno; take_gil(tstate); /* _Py_Finalizing is protected by the GIL */ - if (_Py_Finalizing && tstate != _Py_Finalizing) { + if (_Py_IsFinalizing() && !_Py_CURRENTLY_FINALIZING(tstate)) { drop_gil(tstate); PyThread_exit_thread(); assert(0); /* unreachable */ @@ -326,19 +318,11 @@ _PyEval_SignalReceived(void) callback. */ -#define NPENDINGCALLS 32 -static struct { - int (*func)(void *); - void *arg; -} pendingcalls[NPENDINGCALLS]; -static int pendingfirst = 0; -static int pendinglast = 0; - int Py_AddPendingCall(int (*func)(void *), void *arg) { int i, j, result=0; - PyThread_type_lock lock = pending_lock; + PyThread_type_lock lock = _PyRuntime.ceval.pending.lock; /* try a few times for the lock. Since this mechanism is used * for signal handling (on the main thread), there is a (slim) @@ -360,14 +344,14 @@ Py_AddPendingCall(int (*func)(void *), void *arg) return -1; } - i = pendinglast; + i = _PyRuntime.ceval.pending.last; j = (i + 1) % NPENDINGCALLS; - if (j == pendingfirst) { + if (j == _PyRuntime.ceval.pending.first) { result = -1; /* Queue full */ } else { - pendingcalls[i].func = func; - pendingcalls[i].arg = arg; - pendinglast = j; + _PyRuntime.ceval.pending.calls[i].func = func; + _PyRuntime.ceval.pending.calls[i].arg = arg; + _PyRuntime.ceval.pending.last = j; } /* signal main loop */ SIGNAL_PENDING_CALLS(); @@ -385,16 +369,19 @@ Py_MakePendingCalls(void) assert(PyGILState_Check()); - if (!pending_lock) { + if (!_PyRuntime.ceval.pending.lock) { /* initial allocation of the lock */ - pending_lock = PyThread_allocate_lock(); - if (pending_lock == NULL) + _PyRuntime.ceval.pending.lock = PyThread_allocate_lock(); + if (_PyRuntime.ceval.pending.lock == NULL) return -1; } /* only service pending calls on main thread */ - if (main_thread && PyThread_get_thread_ident() != main_thread) + if (_PyRuntime.ceval.pending.main_thread && + PyThread_get_thread_ident() != _PyRuntime.ceval.pending.main_thread) + { return 0; + } /* don't perform recursive pending calls */ if (busy) return 0; @@ -416,16 +403,16 @@ Py_MakePendingCalls(void) void *arg = NULL; /* pop one item off the queue while holding the lock */ - PyThread_acquire_lock(pending_lock, WAIT_LOCK); - j = pendingfirst; - if (j == pendinglast) { + PyThread_acquire_lock(_PyRuntime.ceval.pending.lock, WAIT_LOCK); + j = _PyRuntime.ceval.pending.first; + if (j == _PyRuntime.ceval.pending.last) { func = NULL; /* Queue empty */ } else { - func = pendingcalls[j].func; - arg = pendingcalls[j].arg; - pendingfirst = (j + 1) % NPENDINGCALLS; + func = _PyRuntime.ceval.pending.calls[j].func; + arg = _PyRuntime.ceval.pending.calls[j].arg; + _PyRuntime.ceval.pending.first = (j + 1) % NPENDINGCALLS; } - PyThread_release_lock(pending_lock); + PyThread_release_lock(_PyRuntime.ceval.pending.lock); /* having released the lock, perform the callback */ if (func == NULL) break; @@ -444,26 +431,33 @@ Py_MakePendingCalls(void) return -1; } - /* The interpreter's recursion limit */ #ifndef Py_DEFAULT_RECURSION_LIMIT #define Py_DEFAULT_RECURSION_LIMIT 1000 #endif -static int recursion_limit = Py_DEFAULT_RECURSION_LIMIT; + int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; +void +_PyEval_Initialize(struct _ceval_runtime_state *state) +{ + state->recursion_limit = Py_DEFAULT_RECURSION_LIMIT; + _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT; + _gil_initialize(&state->gil); +} + int Py_GetRecursionLimit(void) { - return recursion_limit; + return _PyRuntime.ceval.recursion_limit; } void Py_SetRecursionLimit(int new_limit) { - recursion_limit = new_limit; - _Py_CheckRecursionLimit = recursion_limit; + _PyRuntime.ceval.recursion_limit = new_limit; + _Py_CheckRecursionLimit = _PyRuntime.ceval.recursion_limit; } /* the macro Py_EnterRecursiveCall() only calls _Py_CheckRecursiveCall() @@ -475,6 +469,7 @@ int _Py_CheckRecursiveCall(const char *where) { PyThreadState *tstate = PyThreadState_GET(); + int recursion_limit = _PyRuntime.ceval.recursion_limit; #ifdef USE_STACKCHECK if (PyOS_CheckStack()) { @@ -522,13 +517,7 @@ static void restore_and_clear_exc_state(PyThreadState *, PyFrameObject *); static int do_raise(PyObject *, PyObject *); static int unpack_iterable(PyObject *, int, int, PyObject **); -/* Records whether tracing is on for any thread. Counts the number of - threads for which tstate->c_tracefunc is non-NULL, so if the value - is 0, we know we don't have to check this thread's c_tracefunc. - This speeds up the if statement in PyEval_EvalFrameEx() after - fast_next_opcode*/ -static int _Py_TracingPossible = 0; - +#define _Py_TracingPossible _PyRuntime.ceval.tracing_possible PyObject * @@ -659,7 +648,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) #define DISPATCH() \ { \ - if (!_Py_atomic_load_relaxed(&eval_breaker)) { \ + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \ FAST_DISPATCH(); \ } \ continue; \ @@ -707,7 +696,8 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) /* Code access macros */ /* The integer overflow is checked by an assertion below. */ -#define INSTR_OFFSET() (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) +#define INSTR_OFFSET() \ + (sizeof(_Py_CODEUNIT) * (int)(next_instr - first_instr)) #define NEXTOPARG() do { \ _Py_CODEUNIT word = *next_instr; \ opcode = _Py_OPCODE(word); \ @@ -960,7 +950,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) async I/O handler); see Py_AddPendingCall() and Py_MakePendingCalls() above. */ - if (_Py_atomic_load_relaxed(&eval_breaker)) { + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { if (_Py_OPCODE(*next_instr) == SETUP_FINALLY || _Py_OPCODE(*next_instr) == YIELD_FROM) { /* Two cases where we skip running signal handlers and other @@ -977,11 +967,15 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) */ goto fast_next_opcode; } - if (_Py_atomic_load_relaxed(&pendingcalls_to_do)) { + if (_Py_atomic_load_relaxed( + &_PyRuntime.ceval.pending.calls_to_do)) + { if (Py_MakePendingCalls() < 0) goto error; } - if (_Py_atomic_load_relaxed(&gil_drop_request)) { + if (_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil_drop_request)) + { /* Give another thread a chance */ if (PyThreadState_Swap(NULL) != tstate) Py_FatalError("ceval: tstate mix-up"); @@ -992,7 +986,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) take_gil(tstate); /* Check if we should make a quick exit. */ - if (_Py_Finalizing && _Py_Finalizing != tstate) { + if (_Py_IsFinalizing() && + !_Py_CURRENTLY_FINALIZING(tstate)) + { drop_gil(tstate); PyThread_exit_thread(); } diff --git a/Python/ceval_gil.h b/Python/ceval_gil.h index a3b450bd5c4..ef5189068e0 100644 --- a/Python/ceval_gil.h +++ b/Python/ceval_gil.h @@ -8,20 +8,13 @@ /* First some general settings */ -/* microseconds (the Python API uses seconds, though) */ -#define DEFAULT_INTERVAL 5000 -static unsigned long gil_interval = DEFAULT_INTERVAL; -#define INTERVAL (gil_interval >= 1 ? gil_interval : 1) - -/* Enable if you want to force the switching of threads at least every `gil_interval` */ -#undef FORCE_SWITCHING -#define FORCE_SWITCHING +#define INTERVAL (_PyRuntime.ceval.gil.interval >= 1 ? _PyRuntime.ceval.gil.interval : 1) /* Notes about the implementation: - - The GIL is just a boolean variable (gil_locked) whose access is protected + - The GIL is just a boolean variable (locked) whose access is protected by a mutex (gil_mutex), and whose changes are signalled by a condition variable (gil_cond). gil_mutex is taken for short periods of time, and therefore mostly uncontended. @@ -48,7 +41,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; - When a thread releases the GIL and gil_drop_request is set, that thread ensures that another GIL-awaiting thread gets scheduled. It does so by waiting on a condition variable (switch_cond) until - the value of gil_last_holder is changed to something else than its + the value of last_holder is changed to something else than its own thread state pointer, indicating that another thread was able to take the GIL. @@ -60,11 +53,7 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; */ #include "condvar.h" -#ifndef Py_HAVE_CONDVAR -#error You need either a POSIX-compatible or a Windows system! -#endif -#define MUTEX_T PyMUTEX_T #define MUTEX_INIT(mut) \ if (PyMUTEX_INIT(&(mut))) { \ Py_FatalError("PyMUTEX_INIT(" #mut ") failed"); }; @@ -78,7 +67,6 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; if (PyMUTEX_UNLOCK(&(mut))) { \ Py_FatalError("PyMUTEX_UNLOCK(" #mut ") failed"); }; -#define COND_T PyCOND_T #define COND_INIT(cond) \ if (PyCOND_INIT(&(cond))) { \ Py_FatalError("PyCOND_INIT(" #cond ") failed"); }; @@ -103,48 +91,36 @@ static unsigned long gil_interval = DEFAULT_INTERVAL; } \ +#define DEFAULT_INTERVAL 5000 -/* Whether the GIL is already taken (-1 if uninitialized). This is atomic - because it can be read without any lock taken in ceval.c. */ -static _Py_atomic_int gil_locked = {-1}; -/* Number of GIL switches since the beginning. */ -static unsigned long gil_switch_number = 0; -/* Last PyThreadState holding / having held the GIL. This helps us know - whether anyone else was scheduled after we dropped the GIL. */ -static _Py_atomic_address gil_last_holder = {0}; - -/* This condition variable allows one or several threads to wait until - the GIL is released. In addition, the mutex also protects the above - variables. */ -static COND_T gil_cond; -static MUTEX_T gil_mutex; - -#ifdef FORCE_SWITCHING -/* This condition variable helps the GIL-releasing thread wait for - a GIL-awaiting thread to be scheduled and take the GIL. */ -static COND_T switch_cond; -static MUTEX_T switch_mutex; -#endif - +static void _gil_initialize(struct _gil_runtime_state *state) +{ + _Py_atomic_int uninitialized = {-1}; + state->locked = uninitialized; + state->interval = DEFAULT_INTERVAL; +} static int gil_created(void) { - return _Py_atomic_load_explicit(&gil_locked, _Py_memory_order_acquire) >= 0; + return (_Py_atomic_load_explicit(&_PyRuntime.ceval.gil.locked, + _Py_memory_order_acquire) + ) >= 0; } static void create_gil(void) { - MUTEX_INIT(gil_mutex); + MUTEX_INIT(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - MUTEX_INIT(switch_mutex); + MUTEX_INIT(_PyRuntime.ceval.gil.switch_mutex); #endif - COND_INIT(gil_cond); + COND_INIT(_PyRuntime.ceval.gil.cond); #ifdef FORCE_SWITCHING - COND_INIT(switch_cond); + COND_INIT(_PyRuntime.ceval.gil.switch_cond); #endif - _Py_atomic_store_relaxed(&gil_last_holder, 0); - _Py_ANNOTATE_RWLOCK_CREATE(&gil_locked); - _Py_atomic_store_explicit(&gil_locked, 0, _Py_memory_order_release); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, 0); + _Py_ANNOTATE_RWLOCK_CREATE(&_PyRuntime.ceval.gil.locked); + _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, 0, + _Py_memory_order_release); } static void destroy_gil(void) @@ -152,54 +128,62 @@ static void destroy_gil(void) /* some pthread-like implementations tie the mutex to the cond * and must have the cond destroyed first. */ - COND_FINI(gil_cond); - MUTEX_FINI(gil_mutex); + COND_FINI(_PyRuntime.ceval.gil.cond); + MUTEX_FINI(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - COND_FINI(switch_cond); - MUTEX_FINI(switch_mutex); + COND_FINI(_PyRuntime.ceval.gil.switch_cond); + MUTEX_FINI(_PyRuntime.ceval.gil.switch_mutex); #endif - _Py_atomic_store_explicit(&gil_locked, -1, _Py_memory_order_release); - _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); + _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, -1, + _Py_memory_order_release); + _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); } static void recreate_gil(void) { - _Py_ANNOTATE_RWLOCK_DESTROY(&gil_locked); + _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); /* XXX should we destroy the old OS resources here? */ create_gil(); } static void drop_gil(PyThreadState *tstate) { - if (!_Py_atomic_load_relaxed(&gil_locked)) + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) Py_FatalError("drop_gil: GIL is not locked"); /* tstate is allowed to be NULL (early interpreter init) */ if (tstate != NULL) { /* Sub-interpreter support: threads might have been switched under our feet using PyThreadState_Swap(). Fix the GIL last holder variable so that our heuristics work. */ - _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, + (uintptr_t)tstate); } - MUTEX_LOCK(gil_mutex); - _Py_ANNOTATE_RWLOCK_RELEASED(&gil_locked, /*is_write=*/1); - _Py_atomic_store_relaxed(&gil_locked, 0); - COND_SIGNAL(gil_cond); - MUTEX_UNLOCK(gil_mutex); + MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); + _Py_ANNOTATE_RWLOCK_RELEASED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 0); + COND_SIGNAL(_PyRuntime.ceval.gil.cond); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); #ifdef FORCE_SWITCHING - if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) { - MUTEX_LOCK(switch_mutex); + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) && + tstate != NULL) + { + MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); /* Not switched yet => wait */ - if ((PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder) == tstate) { + if (((PyThreadState*)_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil.last_holder) + ) == tstate) + { RESET_GIL_DROP_REQUEST(); /* NOTE: if COND_WAIT does not atomically start waiting when releasing the mutex, another thread can run through, take the GIL and drop it again, and reset the condition before we even had a chance to wait for it. */ - COND_WAIT(switch_cond, switch_mutex); + COND_WAIT(_PyRuntime.ceval.gil.switch_cond, + _PyRuntime.ceval.gil.switch_mutex); } - MUTEX_UNLOCK(switch_mutex); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); } #endif } @@ -211,60 +195,65 @@ static void take_gil(PyThreadState *tstate) Py_FatalError("take_gil: NULL tstate"); err = errno; - MUTEX_LOCK(gil_mutex); + MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); - if (!_Py_atomic_load_relaxed(&gil_locked)) + if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) goto _ready; - while (_Py_atomic_load_relaxed(&gil_locked)) { + while (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) { int timed_out = 0; unsigned long saved_switchnum; - saved_switchnum = gil_switch_number; - COND_TIMED_WAIT(gil_cond, gil_mutex, INTERVAL, timed_out); + saved_switchnum = _PyRuntime.ceval.gil.switch_number; + COND_TIMED_WAIT(_PyRuntime.ceval.gil.cond, _PyRuntime.ceval.gil.mutex, + INTERVAL, timed_out); /* If we timed out and no switch occurred in the meantime, it is time to ask the GIL-holding thread to drop it. */ if (timed_out && - _Py_atomic_load_relaxed(&gil_locked) && - gil_switch_number == saved_switchnum) { + _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked) && + _PyRuntime.ceval.gil.switch_number == saved_switchnum) { SET_GIL_DROP_REQUEST(); } } _ready: #ifdef FORCE_SWITCHING - /* This mutex must be taken before modifying gil_last_holder (see drop_gil()). */ - MUTEX_LOCK(switch_mutex); + /* This mutex must be taken before modifying + _PyRuntime.ceval.gil.last_holder (see drop_gil()). */ + MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); #endif /* We now hold the GIL */ - _Py_atomic_store_relaxed(&gil_locked, 1); - _Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1); - - if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) { - _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate); - ++gil_switch_number; + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 1); + _Py_ANNOTATE_RWLOCK_ACQUIRED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); + + if (tstate != (PyThreadState*)_Py_atomic_load_relaxed( + &_PyRuntime.ceval.gil.last_holder)) + { + _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, + (uintptr_t)tstate); + ++_PyRuntime.ceval.gil.switch_number; } #ifdef FORCE_SWITCHING - COND_SIGNAL(switch_cond); - MUTEX_UNLOCK(switch_mutex); + COND_SIGNAL(_PyRuntime.ceval.gil.switch_cond); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); #endif - if (_Py_atomic_load_relaxed(&gil_drop_request)) { + if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request)) { RESET_GIL_DROP_REQUEST(); } if (tstate->async_exc != NULL) { _PyEval_SignalAsyncExc(); } - MUTEX_UNLOCK(gil_mutex); + MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); errno = err; } void _PyEval_SetSwitchInterval(unsigned long microseconds) { - gil_interval = microseconds; + _PyRuntime.ceval.gil.interval = microseconds; } unsigned long _PyEval_GetSwitchInterval() { - return gil_interval; + return _PyRuntime.ceval.gil.interval; } diff --git a/Python/codecs.c b/Python/codecs.c index 688a40bd6ff..18edfbdab94 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -9,6 +9,7 @@ Copyright (c) Corporation for National Research Initiatives. ------------------------------------------------------------------------ */ #include "Python.h" +#include "internal/pystate.h" #include "ucnhash.h" #include diff --git a/Python/condvar.h b/Python/condvar.h index 9a71b17738f..951b8ad47f0 100644 --- a/Python/condvar.h +++ b/Python/condvar.h @@ -37,27 +37,16 @@ * Condition Variable. */ -#ifndef _CONDVAR_H_ -#define _CONDVAR_H_ +#ifndef _CONDVAR_IMPL_H_ +#define _CONDVAR_IMPL_H_ #include "Python.h" - -#ifndef _POSIX_THREADS -/* This means pthreads are not implemented in libc headers, hence the macro - not present in unistd.h. But they still can be implemented as an external - library (e.g. gnu pth in pthread emulation) */ -# ifdef HAVE_PTHREAD_H -# include /* _POSIX_THREADS */ -# endif -#endif +#include "internal/condvar.h" #ifdef _POSIX_THREADS /* * POSIX support */ -#define Py_HAVE_CONDVAR - -#include #define PyCOND_ADD_MICROSECONDS(tv, interval) \ do { /* TODO: add overflow and truncation checks */ \ @@ -74,13 +63,11 @@ do { /* TODO: add overflow and truncation checks */ \ #endif /* The following functions return 0 on success, nonzero on error */ -#define PyMUTEX_T pthread_mutex_t #define PyMUTEX_INIT(mut) pthread_mutex_init((mut), NULL) #define PyMUTEX_FINI(mut) pthread_mutex_destroy(mut) #define PyMUTEX_LOCK(mut) pthread_mutex_lock(mut) #define PyMUTEX_UNLOCK(mut) pthread_mutex_unlock(mut) -#define PyCOND_T pthread_cond_t #define PyCOND_INIT(cond) pthread_cond_init((cond), NULL) #define PyCOND_FINI(cond) pthread_cond_destroy(cond) #define PyCOND_SIGNAL(cond) pthread_cond_signal(cond) @@ -116,45 +103,11 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) * Emulated condition variables ones that work with XP and later, plus * example native support on VISTA and onwards. */ -#define Py_HAVE_CONDVAR - - -/* include windows if it hasn't been done before */ -#define WIN32_LEAN_AND_MEAN -#include - -/* options */ -/* non-emulated condition variables are provided for those that want - * to target Windows Vista. Modify this macro to enable them. - */ -#ifndef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 /* use emulated condition variables */ -#endif - -/* fall back to emulation if not targeting Vista */ -#if !defined NTDDI_VISTA || NTDDI_VERSION < NTDDI_VISTA -#undef _PY_EMULATED_WIN_CV -#define _PY_EMULATED_WIN_CV 1 -#endif - #if _PY_EMULATED_WIN_CV /* The mutex is a CriticalSection object and The condition variables is emulated with the help of a semaphore. - Semaphores are available on Windows XP (2003 server) and later. - We use a Semaphore rather than an auto-reset event, because although - an auto-resent event might appear to solve the lost-wakeup bug (race - condition between releasing the outer lock and waiting) because it - maintains state even though a wait hasn't happened, there is still - a lost wakeup problem if more than one thread are interrupted in the - critical place. A semaphore solves that, because its state is counted, - not Boolean. - Because it is ok to signal a condition variable with no one - waiting, we need to keep track of the number of - waiting threads. Otherwise, the semaphore's state could rise - without bound. This also helps reduce the number of "spurious wakeups" - that would otherwise happen. This implementation still has the problem that the threads woken with a "signal" aren't necessarily those that are already @@ -168,8 +121,6 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us) http://www.cse.wustl.edu/~schmidt/win32-cv-1.html */ -typedef CRITICAL_SECTION PyMUTEX_T; - Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) { @@ -198,15 +149,6 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) return 0; } -/* The ConditionVariable object. From XP onwards it is easily emulated with - * a Semaphore - */ - -typedef struct _PyCOND_T -{ - HANDLE sem; - int waiting; /* to allow PyCOND_SIGNAL to be a no-op */ -} PyCOND_T; Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) @@ -304,12 +246,7 @@ PyCOND_BROADCAST(PyCOND_T *cv) return 0; } -#else - -/* Use native Win7 primitives if build target is Win7 or higher */ - -/* SRWLOCK is faster and better than CriticalSection */ -typedef SRWLOCK PyMUTEX_T; +#else /* !_PY_EMULATED_WIN_CV */ Py_LOCAL_INLINE(int) PyMUTEX_INIT(PyMUTEX_T *cs) @@ -339,8 +276,6 @@ PyMUTEX_UNLOCK(PyMUTEX_T *cs) } -typedef CONDITION_VARIABLE PyCOND_T; - Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cv) { @@ -387,4 +322,4 @@ PyCOND_BROADCAST(PyCOND_T *cv) #endif /* _POSIX_THREADS, NT_THREADS */ -#endif /* _CONDVAR_H_ */ +#endif /* _CONDVAR_IMPL_H_ */ diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 7f8f134d60b..f2711931908 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -2,6 +2,7 @@ /* Support for dynamic loading of extension modules */ #include "Python.h" +#include "internal/pystate.h" #include "importdl.h" #include diff --git a/Python/errors.c b/Python/errors.c index 261dd7b27cb..3cb6d5306f8 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -2,6 +2,7 @@ /* Error handling */ #include "Python.h" +#include "internal/pystate.h" #ifndef __STDC__ #ifndef MS_WINDOWS diff --git a/Python/import.c b/Python/import.c index a406db31032..6b2634c3497 100644 --- a/Python/import.c +++ b/Python/import.c @@ -5,6 +5,7 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with winbase.h */ +#include "internal/pystate.h" #include "errcode.h" #include "marshal.h" #include "code.h" diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 7798dfe9c2c..b9f916bf39f 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -4,6 +4,7 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with winbase.h */ +#include "internal/pystate.h" #include "grammar.h" #include "node.h" #include "token.h" @@ -75,6 +76,36 @@ extern void _Py_ReadyTypes(void); extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); extern void _PyGILState_Fini(void); +_PyRuntimeState _PyRuntime = {0, 0}; + +void +_PyRuntime_Initialize(void) +{ + /* XXX We only initialize once in the process, which aligns with + the static initialization of the former globals now found in + _PyRuntime. However, _PyRuntime *should* be initialized with + every Py_Initialize() call, but doing so breaks the runtime. + This is because the runtime state is not properly finalized + currently. */ + static int initialized = 0; + if (initialized) + return; + initialized = 1; + _PyRuntimeState_Init(&_PyRuntime); +} + +void +_PyRuntime_Finalize(void) +{ + _PyRuntimeState_Fini(&_PyRuntime); +} + +int +_Py_IsFinalizing(void) +{ + return _PyRuntime.finalizing != NULL; +} + /* Global configuration variable declarations are in pydebug.h */ /* XXX (ncoghlan): move those declarations to pylifecycle.h? */ int Py_DebugFlag; /* Needed by parser.c */ @@ -98,8 +129,6 @@ int Py_LegacyWindowsFSEncodingFlag = 0; /* Uses mbcs instead of utf-8 */ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */ #endif -PyThreadState *_Py_Finalizing = NULL; - /* Hack to force loading of object files */ int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \ PyOS_mystrnicmp; /* Python/pystrcmp.o */ @@ -117,19 +146,17 @@ PyModule_GetWarningsModule(void) * * Can be called prior to Py_Initialize. */ -int _Py_CoreInitialized = 0; -int _Py_Initialized = 0; int _Py_IsCoreInitialized(void) { - return _Py_CoreInitialized; + return _PyRuntime.core_initialized; } int Py_IsInitialized(void) { - return _Py_Initialized; + return _PyRuntime.initialized; } /* Helper to allow an embedding application to override the normal @@ -542,14 +569,16 @@ void _Py_InitializeCore(const _PyCoreConfig *config) _PyCoreConfig core_config = _PyCoreConfig_INIT; _PyMainInterpreterConfig preinit_config = _PyMainInterpreterConfig_INIT; + _PyRuntime_Initialize(); + if (config != NULL) { core_config = *config; } - if (_Py_Initialized) { + if (_PyRuntime.initialized) { Py_FatalError("Py_InitializeCore: main interpreter already initialized"); } - if (_Py_CoreInitialized) { + if (_PyRuntime.core_initialized) { Py_FatalError("Py_InitializeCore: runtime core already initialized"); } @@ -562,7 +591,14 @@ void _Py_InitializeCore(const _PyCoreConfig *config) * threads still hanging around from a previous Py_Initialize/Finalize * pair :( */ - _Py_Finalizing = NULL; + _PyRuntime.finalizing = NULL; + + if (_PyMem_SetupAllocators(core_config.allocator) < 0) { + fprintf(stderr, + "Error in PYTHONMALLOC: unknown allocator \"%s\"!\n", + core_config.allocator); + exit(1); + } #ifdef __ANDROID__ /* Passing "" to setlocale() on Android requests the C locale rather @@ -604,7 +640,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) Py_HashRandomizationFlag = 1; } - _PyInterpreterState_Init(); + _PyInterpreterState_Enable(&_PyRuntime); interp = PyInterpreterState_New(); if (interp == NULL) Py_FatalError("Py_InitializeCore: can't make main interpreter"); @@ -694,7 +730,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) } /* Only when we get here is the runtime core fully initialized */ - _Py_CoreInitialized = 1; + _PyRuntime.core_initialized = 1; } /* Read configuration settings from standard locations @@ -735,10 +771,10 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) PyInterpreterState *interp; PyThreadState *tstate; - if (!_Py_CoreInitialized) { + if (!_PyRuntime.core_initialized) { Py_FatalError("Py_InitializeMainInterpreter: runtime core not initialized"); } - if (_Py_Initialized) { + if (_PyRuntime.initialized) { Py_FatalError("Py_InitializeMainInterpreter: main interpreter already initialized"); } @@ -759,7 +795,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) * This means anything which needs support from extension modules * or pure Python code in the standard library won't work. */ - _Py_Initialized = 1; + _PyRuntime.initialized = 1; return 0; } /* TODO: Report exceptions rather than fatal errors below here */ @@ -804,7 +840,7 @@ int _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) Py_XDECREF(warnings_module); } - _Py_Initialized = 1; + _PyRuntime.initialized = 1; if (!Py_NoSiteFlag) initsite(); /* Module site */ @@ -920,7 +956,7 @@ Py_FinalizeEx(void) PyThreadState *tstate; int status = 0; - if (!_Py_Initialized) + if (!_PyRuntime.initialized) return status; wait_for_thread_shutdown(); @@ -942,9 +978,9 @@ Py_FinalizeEx(void) /* Remaining threads (e.g. daemon threads) will automatically exit after taking the GIL (in PyEval_RestoreThread()). */ - _Py_Finalizing = tstate; - _Py_Initialized = 0; - _Py_CoreInitialized = 0; + _PyRuntime.finalizing = tstate; + _PyRuntime.initialized = 0; + _PyRuntime.core_initialized = 0; /* Flush sys.stdout and sys.stderr */ if (flush_std_files() < 0) { @@ -1104,6 +1140,7 @@ Py_FinalizeEx(void) #endif call_ll_exitfuncs(); + _PyRuntime_Finalize(); return status; } @@ -1133,7 +1170,7 @@ Py_NewInterpreter(void) PyThreadState *tstate, *save_tstate; PyObject *bimod, *sysmod; - if (!_Py_Initialized) + if (!_PyRuntime.initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); /* Issue #10915, #15751: The GIL API doesn't work with multiple @@ -1844,20 +1881,19 @@ Py_FatalError(const char *msg) # include "pythread.h" -static void (*pyexitfunc)(void) = NULL; /* For the atexit module. */ void _Py_PyAtExit(void (*func)(void)) { - pyexitfunc = func; + _PyRuntime.pyexitfunc = func; } static void call_py_exitfuncs(void) { - if (pyexitfunc == NULL) + if (_PyRuntime.pyexitfunc == NULL) return; - (*pyexitfunc)(); + (*_PyRuntime.pyexitfunc)(); PyErr_Clear(); } @@ -1888,22 +1924,19 @@ wait_for_thread_shutdown(void) } #define NEXITFUNCS 32 -static void (*exitfuncs[NEXITFUNCS])(void); -static int nexitfuncs = 0; - int Py_AtExit(void (*func)(void)) { - if (nexitfuncs >= NEXITFUNCS) + if (_PyRuntime.nexitfuncs >= NEXITFUNCS) return -1; - exitfuncs[nexitfuncs++] = func; + _PyRuntime.exitfuncs[_PyRuntime.nexitfuncs++] = func; return 0; } static void call_ll_exitfuncs(void) { - while (nexitfuncs > 0) - (*exitfuncs[--nexitfuncs])(); + while (_PyRuntime.nexitfuncs > 0) + (*_PyRuntime.exitfuncs[--_PyRuntime.nexitfuncs])(); fflush(stdout); fflush(stderr); diff --git a/Python/pystate.c b/Python/pystate.c index 379e5a39c5a..be012d7d46a 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -2,6 +2,7 @@ /* Thread and interpreter state structures and their interfaces */ #include "Python.h" +#include "internal/pystate.h" #define GET_TSTATE() \ ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) @@ -34,47 +35,52 @@ to avoid the expense of doing their own locking). extern "C" { #endif -int _PyGILState_check_enabled = 1; +void +_PyRuntimeState_Init(_PyRuntimeState *runtime) +{ + memset(runtime, 0, sizeof(*runtime)); -#include "pythread.h" -static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ -#define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) -#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK) -#define HEAD_UNLOCK() PyThread_release_lock(head_mutex) + _PyObject_Initialize(&runtime->obj); + _PyMem_Initialize(&runtime->mem); + _PyGC_Initialize(&runtime->gc); + _PyEval_Initialize(&runtime->ceval); -/* The single PyInterpreterState used by this process' - GILState implementation -*/ -/* TODO: Given interp_main, it may be possible to kill this ref */ -static PyInterpreterState *autoInterpreterState = NULL; -static int autoTLSkey = -1; + runtime->gilstate.check_enabled = 1; + runtime->gilstate.autoTLSkey = -1; -static PyInterpreterState *interp_head = NULL; -static PyInterpreterState *interp_main = NULL; - -/* Assuming the current thread holds the GIL, this is the - PyThreadState for the current thread. */ -_Py_atomic_address _PyThreadState_Current = {0}; -PyThreadFrameGetter _PyThreadState_GetFrame = NULL; + runtime->interpreters.mutex = PyThread_allocate_lock(); + if (runtime->interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); + runtime->interpreters.next_id = -1; +} -static void _PyGILState_NoteThreadState(PyThreadState* tstate); +void +_PyRuntimeState_Fini(_PyRuntimeState *runtime) +{ + if (runtime->interpreters.mutex != NULL) { + PyThread_free_lock(runtime->interpreters.mutex); + runtime->interpreters.mutex = NULL; + } +} -/* _next_interp_id is an auto-numbered sequence of small integers. - It gets initialized in _PyInterpreterState_Init(), which is called - in Py_Initialize(), and used in PyInterpreterState_New(). A negative - interpreter ID indicates an error occurred. The main interpreter - will always have an ID of 0. Overflow results in a RuntimeError. - If that becomes a problem later then we can adjust, e.g. by using - a Python int. +#define HEAD_LOCK() PyThread_acquire_lock(_PyRuntime.interpreters.mutex, \ + WAIT_LOCK) +#define HEAD_UNLOCK() PyThread_release_lock(_PyRuntime.interpreters.mutex) - We initialize this to -1 so that the pre-Py_Initialize() value - results in an error. */ -static int64_t _next_interp_id = -1; +static void _PyGILState_NoteThreadState(PyThreadState* tstate); void -_PyInterpreterState_Init(void) -{ - _next_interp_id = 0; +_PyInterpreterState_Enable(_PyRuntimeState *runtime) +{ + runtime->interpreters.next_id = 0; + /* Since we only call _PyRuntimeState_Init() once per process + (see _PyRuntime_Initialize()), we make sure the mutex is + initialized here. */ + if (runtime->interpreters.mutex == NULL) { + runtime->interpreters.mutex = PyThread_allocate_lock(); + if (runtime->interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); + } } PyInterpreterState * @@ -84,14 +90,16 @@ PyInterpreterState_New(void) PyMem_RawMalloc(sizeof(PyInterpreterState)); if (interp != NULL) { - HEAD_INIT(); - if (head_mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; interp->builtins_copy = NULL; interp->tstate_head = NULL; + interp->check_interval = 100; + interp->warnoptions = NULL; + interp->xoptions = NULL; + interp->num_threads = 0; + interp->pythread_stacksize = 0; interp->codec_search_path = NULL; interp->codec_search_cache = NULL; interp->codec_error_registry = NULL; @@ -115,19 +123,19 @@ PyInterpreterState_New(void) #endif HEAD_LOCK(); - interp->next = interp_head; - if (interp_main == NULL) { - interp_main = interp; + interp->next = _PyRuntime.interpreters.head; + if (_PyRuntime.interpreters.main == NULL) { + _PyRuntime.interpreters.main = interp; } - interp_head = interp; - if (_next_interp_id < 0) { + _PyRuntime.interpreters.head = interp; + if (_PyRuntime.interpreters.next_id < 0) { /* overflow or Py_Initialize() not called! */ PyErr_SetString(PyExc_RuntimeError, "failed to get an interpreter ID"); interp = NULL; } else { - interp->id = _next_interp_id; - _next_interp_id += 1; + interp->id = _PyRuntime.interpreters.next_id; + _PyRuntime.interpreters.next_id += 1; } HEAD_UNLOCK(); } @@ -179,7 +187,7 @@ PyInterpreterState_Delete(PyInterpreterState *interp) PyInterpreterState **p; zapthreads(interp); HEAD_LOCK(); - for (p = &interp_head; ; p = &(*p)->next) { + for (p = &_PyRuntime.interpreters.head; ; p = &(*p)->next) { if (*p == NULL) Py_FatalError( "PyInterpreterState_Delete: invalid interp"); @@ -189,17 +197,13 @@ PyInterpreterState_Delete(PyInterpreterState *interp) if (interp->tstate_head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining threads"); *p = interp->next; - if (interp_main == interp) { - interp_main = NULL; - if (interp_head != NULL) + if (_PyRuntime.interpreters.main == interp) { + _PyRuntime.interpreters.main = NULL; + if (_PyRuntime.interpreters.head != NULL) Py_FatalError("PyInterpreterState_Delete: remaining subinterpreters"); } HEAD_UNLOCK(); PyMem_RawFree(interp); - if (interp_head == NULL && head_mutex != NULL) { - PyThread_free_lock(head_mutex); - head_mutex = NULL; - } } @@ -480,8 +484,11 @@ PyThreadState_Delete(PyThreadState *tstate) { if (tstate == GET_TSTATE()) Py_FatalError("PyThreadState_Delete: tstate is still current"); - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); + if (_PyRuntime.gilstate.autoInterpreterState && + PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) + { + PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); + } tstate_delete_common(tstate); } @@ -494,8 +501,11 @@ PyThreadState_DeleteCurrent() Py_FatalError( "PyThreadState_DeleteCurrent: no current tstate"); tstate_delete_common(tstate); - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); + if (_PyRuntime.gilstate.autoInterpreterState && + PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == tstate) + { + PyThread_delete_key_value(_PyRuntime.gilstate.autoTLSkey); + } SET_TSTATE(NULL); PyEval_ReleaseLock(); } @@ -654,13 +664,13 @@ PyThreadState_SetAsyncExc(unsigned long id, PyObject *exc) PyInterpreterState * PyInterpreterState_Head(void) { - return interp_head; + return _PyRuntime.interpreters.head; } PyInterpreterState * PyInterpreterState_Main(void) { - return interp_main; + return _PyRuntime.interpreters.main; } PyInterpreterState * @@ -700,7 +710,7 @@ _PyThread_CurrentFrames(void) * need to grab head_mutex for the duration. */ HEAD_LOCK(); - for (i = interp_head; i != NULL; i = i->next) { + for (i = _PyRuntime.interpreters.head; i != NULL; i = i->next) { PyThreadState *t; for (t = i->tstate_head; t != NULL; t = t->next) { PyObject *id; @@ -751,11 +761,11 @@ void _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) { assert(i && t); /* must init with valid states */ - autoTLSkey = PyThread_create_key(); - if (autoTLSkey == -1) + _PyRuntime.gilstate.autoTLSkey = PyThread_create_key(); + if (_PyRuntime.gilstate.autoTLSkey == -1) Py_FatalError("Could not allocate TLS entry"); - autoInterpreterState = i; - assert(PyThread_get_key_value(autoTLSkey) == NULL); + _PyRuntime.gilstate.autoInterpreterState = i; + assert(PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL); assert(t->gilstate_counter == 0); _PyGILState_NoteThreadState(t); @@ -764,15 +774,15 @@ _PyGILState_Init(PyInterpreterState *i, PyThreadState *t) PyInterpreterState * _PyGILState_GetInterpreterStateUnsafe(void) { - return autoInterpreterState; + return _PyRuntime.gilstate.autoInterpreterState; } void _PyGILState_Fini(void) { - PyThread_delete_key(autoTLSkey); - autoTLSkey = -1; - autoInterpreterState = NULL; + PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); + _PyRuntime.gilstate.autoTLSkey = -1; + _PyRuntime.gilstate.autoInterpreterState = NULL; } /* Reset the TLS key - called by PyOS_AfterFork_Child(). @@ -782,16 +792,18 @@ _PyGILState_Fini(void) void _PyGILState_Reinit(void) { - head_mutex = NULL; - HEAD_INIT(); + _PyRuntime.interpreters.mutex = PyThread_allocate_lock(); + if (_PyRuntime.interpreters.mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); PyThreadState *tstate = PyGILState_GetThisThreadState(); - PyThread_delete_key(autoTLSkey); - if ((autoTLSkey = PyThread_create_key()) == -1) + PyThread_delete_key(_PyRuntime.gilstate.autoTLSkey); + if ((_PyRuntime.gilstate.autoTLSkey = PyThread_create_key()) == -1) Py_FatalError("Could not allocate TLS entry"); /* If the thread had an associated auto thread state, reassociate it with * the new key. */ - if (tstate && PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) + if (tstate && PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, + (void *)tstate) < 0) Py_FatalError("Couldn't create autoTLSkey mapping"); } @@ -806,7 +818,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) /* If autoTLSkey isn't initialized, this must be the very first threadstate created in Py_Initialize(). Don't do anything for now (we'll be back here when _PyGILState_Init is called). */ - if (!autoInterpreterState) + if (!_PyRuntime.gilstate.autoInterpreterState) return; /* Stick the thread state for this thread in thread local storage. @@ -821,9 +833,13 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) The first thread state created for that given OS level thread will "win", which seems reasonable behaviour. */ - if (PyThread_get_key_value(autoTLSkey) == NULL) { - if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) + if (PyThread_get_key_value(_PyRuntime.gilstate.autoTLSkey) == NULL) { + if ((PyThread_set_key_value(_PyRuntime.gilstate.autoTLSkey, + (void *)tstate) + ) < 0) + { Py_FatalError("Couldn't create autoTLSkey mapping"); + } } /* PyGILState_Release must not try to delete this thread state. */ @@ -834,9 +850,10 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) PyThreadState * PyGILState_GetThisThreadState(void) { - if (autoInterpreterState == NULL) + if (_PyRuntime.gilstate.autoInterpreterState == NULL) return NULL; - return (PyThreadState *)PyThread_get_key_value(autoTLSkey); + return (PyThreadState *)PyThread_get_key_value( + _PyRuntime.gilstate.autoTLSkey); } int @@ -847,7 +864,7 @@ PyGILState_Check(void) if (!_PyGILState_check_enabled) return 1; - if (autoTLSkey == -1) + if (_PyRuntime.gilstate.autoTLSkey == -1) return 1; tstate = GET_TSTATE(); @@ -867,8 +884,10 @@ PyGILState_Ensure(void) spells out other issues. Embedders are expected to have called Py_Initialize() and usually PyEval_InitThreads(). */ - assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ - tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); + /* Py_Initialize() hasn't been called! */ + assert(_PyRuntime.gilstate.autoInterpreterState); + tcur = (PyThreadState *)PyThread_get_key_value( + _PyRuntime.gilstate.autoTLSkey); if (tcur == NULL) { /* At startup, Python has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the first time, we need the create the @@ -876,7 +895,7 @@ PyGILState_Ensure(void) PyEval_InitThreads(); /* Create a new thread state for this thread */ - tcur = PyThreadState_New(autoInterpreterState); + tcur = PyThreadState_New(_PyRuntime.gilstate.autoInterpreterState); if (tcur == NULL) Py_FatalError("Couldn't create thread-state for new thread"); /* This is our thread state! We'll need to delete it in the @@ -901,7 +920,7 @@ void PyGILState_Release(PyGILState_STATE oldstate) { PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value( - autoTLSkey); + _PyRuntime.gilstate.autoTLSkey); if (tcur == NULL) Py_FatalError("auto-releasing thread-state, " "but no thread-state for this thread"); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index f31b3ee5a5d..d1d4a69a8dd 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -12,6 +12,7 @@ #include "Python-ast.h" #undef Yield /* undefine macro conflicting with winbase.h */ +#include "internal/pystate.h" #include "grammar.h" #include "node.h" #include "token.h" diff --git a/Python/symtable.c b/Python/symtable.c index 6165cfe162e..2658b917d7a 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1,4 +1,8 @@ #include "Python.h" +#include "internal/pystate.h" +#ifdef Yield +#undef Yield /* undefine conflicting macro from winbase.h */ +#endif #include "Python-ast.h" #include "code.h" #include "symtable.h" diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 021b95d2c3d..3ecd7fca54a 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -15,6 +15,7 @@ Data members: */ #include "Python.h" +#include "internal/pystate.h" #include "code.h" #include "frameobject.h" #include "pythread.h" @@ -520,8 +521,6 @@ Return the profiling function set with sys.setprofile.\n\ See the profiler chapter in the library manual." ); -static int _check_interval = 100; - static PyObject * sys_setcheckinterval(PyObject *self, PyObject *args) { @@ -530,7 +529,8 @@ sys_setcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.setswitchinterval() " "instead.", 1) < 0) return NULL; - if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval)) + PyInterpreterState *interp = PyThreadState_GET()->interp; + if (!PyArg_ParseTuple(args, "i:setcheckinterval", &interp->check_interval)) return NULL; Py_RETURN_NONE; } @@ -550,7 +550,8 @@ sys_getcheckinterval(PyObject *self, PyObject *args) "are deprecated. Use sys.getswitchinterval() " "instead.", 1) < 0) return NULL; - return PyLong_FromLong(_check_interval); + PyInterpreterState *interp = PyThreadState_GET()->interp; + return PyLong_FromLong(interp->check_interval); } PyDoc_STRVAR(getcheckinterval_doc, @@ -1337,7 +1338,7 @@ Clear the internal type lookup cache."); static PyObject * sys_is_finalizing(PyObject* self, PyObject* args) { - return PyBool_FromLong(_Py_Finalizing != NULL); + return PyBool_FromLong(_Py_IsFinalizing()); } PyDoc_STRVAR(is_finalizing_doc, @@ -1475,11 +1476,24 @@ list_builtin_module_names(void) return list; } -static PyObject *warnoptions = NULL; +static PyObject * +get_warnoptions(void) +{ + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + if (warnoptions == NULL || !PyList_Check(warnoptions)) { + Py_XDECREF(warnoptions); + warnoptions = PyList_New(0); + if (warnoptions == NULL) + return NULL; + PyThreadState_GET()->interp->warnoptions = warnoptions; + } + return warnoptions; +} void PySys_ResetWarnOptions(void) { + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1488,12 +1502,9 @@ PySys_ResetWarnOptions(void) void PySys_AddWarnOptionUnicode(PyObject *unicode) { - if (warnoptions == NULL || !PyList_Check(warnoptions)) { - Py_XDECREF(warnoptions); - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return; - } + PyObject *warnoptions = get_warnoptions(); + if (warnoptions == NULL) + return; PyList_Append(warnoptions, unicode); } @@ -1511,17 +1522,20 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } -static PyObject *xoptions = NULL; - static PyObject * get_xoptions(void) { + PyObject *xoptions = PyThreadState_GET()->interp->xoptions; if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); + if (xoptions == NULL) + return NULL; + PyThreadState_GET()->interp->xoptions = xoptions; } return xoptions; } @@ -2124,17 +2138,15 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - if (warnoptions == NULL) { - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return -1; - } - - SET_SYS_FROM_STRING_INT_RESULT("warnoptions", - PyList_GetSlice(warnoptions, - 0, Py_SIZE(warnoptions))); + PyObject *warnoptions = get_warnoptions(); + if (warnoptions == NULL) + return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); - SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", get_xoptions()); + PyObject *xoptions = get_xoptions(); + if (xoptions == NULL) + return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); if (PyErr_Occurred()) return -1; diff --git a/Python/thread.c b/Python/thread.c index 4d2f2c32a19..f742d0521e1 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -6,6 +6,7 @@ Stuff shared by all thread_*.h files is collected here. */ #include "Python.h" +#include "internal/pystate.h" #ifndef _POSIX_THREADS /* This means pthreads are not implemented in libc headers, hence the macro @@ -76,11 +77,6 @@ PyThread_init_thread(void) PyThread__init_thread(); } -/* Support for runtime thread stack size tuning. - A value of 0 means using the platform's default stack size - or the size specified by the THREAD_STACK_SIZE macro. */ -static size_t _pythread_stacksize = 0; - #if defined(_POSIX_THREADS) # define PYTHREAD_NAME "pthread" # include "thread_pthread.h" @@ -96,7 +92,7 @@ static size_t _pythread_stacksize = 0; size_t PyThread_get_stacksize(void) { - return _pythread_stacksize; + return PyThreadState_GET()->interp->pythread_stacksize; } /* Only platforms defining a THREAD_SET_STACKSIZE() macro diff --git a/Python/thread_nt.h b/Python/thread_nt.h index 47eb4b6e94c..2f3a71b86ad 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -189,9 +189,10 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; obj->func = func; obj->arg = arg; + PyThreadState *tstate = PyThreadState_GET(); + size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; hThread = (HANDLE)_beginthreadex(0, - Py_SAFE_DOWNCAST(_pythread_stacksize, - Py_ssize_t, unsigned int), + Py_SAFE_DOWNCAST(stacksize, Py_ssize_t, unsigned int), bootstrap, obj, 0, &threadID); if (hThread == 0) { @@ -332,13 +333,13 @@ _pythread_nt_set_stacksize(size_t size) { /* set to default */ if (size == 0) { - _pythread_stacksize = 0; + PyThreadState_GET()->interp->pythread_stacksize = 0; return 0; } /* valid range? */ if (size >= THREAD_MIN_STACKSIZE && size < THREAD_MAX_STACKSIZE) { - _pythread_stacksize = size; + PyThreadState_GET()->interp->pythread_stacksize = size; return 0; } diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 268dec41168..ea05b6fbcfe 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -205,8 +205,9 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) return PYTHREAD_INVALID_THREAD_ID; #endif #if defined(THREAD_STACK_SIZE) - tss = (_pythread_stacksize != 0) ? _pythread_stacksize - : THREAD_STACK_SIZE; + PyThreadState *tstate = PyThreadState_GET(); + size_t stacksize = tstate ? tstate->interp->pythread_stacksize : 0; + tss = (stacksize != 0) ? stacksize : THREAD_STACK_SIZE; if (tss != 0) { if (pthread_attr_setstacksize(&attrs, tss) != 0) { pthread_attr_destroy(&attrs); @@ -578,7 +579,7 @@ _pythread_pthread_set_stacksize(size_t size) /* set to default */ if (size == 0) { - _pythread_stacksize = 0; + PyThreadState_GET()->interp->pythread_stacksize = 0; return 0; } @@ -595,7 +596,7 @@ _pythread_pthread_set_stacksize(size_t size) rc = pthread_attr_setstacksize(&attrs, size); pthread_attr_destroy(&attrs); if (rc == 0) { - _pythread_stacksize = size; + PyThreadState_GET()->interp->pythread_stacksize = size; return 0; } } diff --git a/Python/traceback.c b/Python/traceback.c index cd30d56b94a..ba979aad8fa 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -2,6 +2,7 @@ /* Traceback implementation */ #include "Python.h" +#include "internal/pystate.h" #include "code.h" #include "frameobject.h" diff --git a/Tools/c-globals/README b/Tools/c-globals/README new file mode 100644 index 00000000000..d0e6e8eba06 --- /dev/null +++ b/Tools/c-globals/README @@ -0,0 +1,41 @@ +####################################### +# C Globals and CPython Runtime State. + +CPython's C code makes extensive use of global variables. Each global +falls into one of several categories: + +* (effectively) constants (incl. static types) +* globals used exclusively in main or in the REPL +* freelists, caches, and counters +* process-global state +* module state +* Python runtime state + +The ignored-globals.txt file is organized similarly. Of the different +categories, the last two are problematic and generally should not exist +in the codebase. + +Globals that hold module state (i.e. in Modules/*.c) cause problems +when multiple interpreters are in use. For more info, see PEP 3121, +which addresses the situation for extension modules in general. + +Globals in the last category should be avoided as well. The problem +isn't with the Python runtime having state. Rather, the problem is with +that state being spread thoughout the codebase in dozens of individual +globals. Unlike the other globals, the runtime state represents a set +of values that are constantly shifting in a complex way. When they are +spread out it's harder to get a clear picture of what the runtime +involves. Furthermore, when they are spread out it complicates efforts +that change the runtime. + +Consequently, the globals for Python's runtime state have been +consolidated under a single top-level _PyRuntime global. No new globals +should be added for runtime state. Instead, they should be added to +_PyRuntimeState or one of its sub-structs. The check-c-globals script +should be run to ensure that no new globals have been added: + + python3 Tools/c-globals/check-c-globals.py + +If it reports any globals then they should be resolved. If the globals +are runtime state then they should be folded into _PyRuntimeState. +Otherwise they should be added to ignored-globals.txt. diff --git a/Tools/c-globals/check-c-globals.py b/Tools/c-globals/check-c-globals.py new file mode 100644 index 00000000000..1de69a8751c --- /dev/null +++ b/Tools/c-globals/check-c-globals.py @@ -0,0 +1,446 @@ + +from collections import namedtuple +import glob +import os.path +import re +import shutil +import sys +import subprocess + + +VERBOSITY = 2 + +C_GLOBALS_DIR = os.path.abspath(os.path.dirname(__file__)) +TOOLS_DIR = os.path.dirname(C_GLOBALS_DIR) +ROOT_DIR = os.path.dirname(TOOLS_DIR) +GLOBALS_FILE = os.path.join(C_GLOBALS_DIR, 'ignored-globals.txt') + +SOURCE_DIRS = ['Include', 'Objects', 'Modules', 'Parser', 'Python'] + +CAPI_REGEX = re.compile(r'^ *PyAPI_DATA\([^)]*\) \W*(_?Py\w+(?:, \w+)*\w).*;.*$') + + +IGNORED_VARS = { + '_DYNAMIC', + '_GLOBAL_OFFSET_TABLE_', + '__JCR_LIST__', + '__JCR_END__', + '__TMC_END__', + '__bss_start', + '__data_start', + '__dso_handle', + '_edata', + '_end', + } + + +def find_capi_vars(root): + capi_vars = {} + for dirname in SOURCE_DIRS: + for filename in glob.glob(os.path.join(ROOT_DIR, dirname, '**/*.[hc]'), + recursive=True): + with open(filename) as file: + for name in _find_capi_vars(file): + if name in capi_vars: + assert not filename.endswith('.c') + assert capi_vars[name].endswith('.c') + capi_vars[name] = filename + return capi_vars + + +def _find_capi_vars(lines): + for line in lines: + if not line.startswith('PyAPI_DATA'): + continue + assert '{' not in line + match = CAPI_REGEX.match(line) + assert match + names, = match.groups() + for name in names.split(', '): + yield name + + +def _read_global_names(filename): + # These variables are shared between all interpreters in the process. + with open(filename) as file: + return {line.partition('#')[0].strip() + for line in file + if line.strip() and not line.startswith('#')} + + +def _is_global_var(name, globalnames): + if _is_autogen_var(name): + return True + if _is_type_var(name): + return True + if _is_module(name): + return True + if _is_exception(name): + return True + if _is_compiler(name): + return True + return name in globalnames + + +def _is_autogen_var(name): + return ( + name.startswith('PyId_') or + '.' in name or + # Objects/typeobject.c + name.startswith('op_id.') or + name.startswith('rop_id.') or + # Python/graminit.c + name.startswith('arcs_') or + name.startswith('states_') + ) + + +def _is_type_var(name): + if name.endswith(('Type', '_Type', '_type')): # XXX Always a static type? + return True + if name.endswith('_desc'): # for structseq types + return True + return ( + name.startswith('doc_') or + name.endswith(('_doc', '__doc__', '_docstring')) or + name.endswith('_methods') or + name.endswith('_fields') or + name.endswith(('_memberlist', '_members')) or + name.endswith('_slots') or + name.endswith(('_getset', '_getsets', '_getsetlist')) or + name.endswith('_as_mapping') or + name.endswith('_as_number') or + name.endswith('_as_sequence') or + name.endswith('_as_buffer') or + name.endswith('_as_async') + ) + + +def _is_module(name): + if name.endswith(('_functions', 'Methods', '_Methods')): + return True + if name == 'module_def': + return True + if name == 'initialized': + return True + return name.endswith(('module', '_Module')) + + +def _is_exception(name): + # Other vars are enumerated in globals-core.txt. + if not name.startswith(('PyExc_', '_PyExc_')): + return False + return name.endswith(('Error', 'Warning')) + + +def _is_compiler(name): + return ( + # Python/Pythyon-ast.c + name.endswith('_type') or + name.endswith('_singleton') or + name.endswith('_attributes') + ) + + +class Var(namedtuple('Var', 'name kind scope capi filename')): + + @classmethod + def parse_nm(cls, line, expected, ignored, capi_vars, globalnames): + _, _, line = line.partition(' ') # strip off the address + line = line.strip() + kind, _, line = line.partition(' ') + if kind in ignored or (): + return None + elif kind not in expected or (): + raise RuntimeError('unsupported NM type {!r}'.format(kind)) + + name, _, filename = line.partition('\t') + name = name.strip() + if _is_autogen_var(name): + return None + if _is_global_var(name, globalnames): + scope = 'global' + else: + scope = None + capi = (name in capi_vars or ()) + if filename: + filename = os.path.relpath(filename.partition(':')[0]) + return cls(name, kind, scope, capi, filename or '~???~') + + @property + def external(self): + return self.kind.isupper() + + +def find_vars(root, globals_filename=GLOBALS_FILE): + python = os.path.join(root, 'python') + if not os.path.exists(python): + raise RuntimeError('python binary missing (need to build it first?)') + capi_vars = find_capi_vars(root) + globalnames = _read_global_names(globals_filename) + + nm = shutil.which('nm') + if nm is None: + # XXX Use dumpbin.exe /SYMBOLS on Windows. + raise NotImplementedError + else: + yield from (var + for var in _find_var_symbols(python, nm, capi_vars, + globalnames) + if var.name not in IGNORED_VARS) + + +NM_FUNCS = set('Tt') +NM_PUBLIC_VARS = set('BD') +NM_PRIVATE_VARS = set('bd') +NM_VARS = NM_PUBLIC_VARS | NM_PRIVATE_VARS +NM_DATA = set('Rr') +NM_OTHER = set('ACGgiINpSsuUVvWw-?') +NM_IGNORED = NM_FUNCS | NM_DATA | NM_OTHER + + +def _find_var_symbols(python, nm, capi_vars, globalnames): + args = [nm, + '--line-numbers', + python] + out = subprocess.check_output(args) + for line in out.decode('utf-8').splitlines(): + var = Var.parse_nm(line, NM_VARS, NM_IGNORED, capi_vars, globalnames) + if var is None: + continue + yield var + + +####################################### + +class Filter(namedtuple('Filter', 'name op value action')): + + @classmethod + def parse(cls, raw): + action = '+' + if raw.startswith(('+', '-')): + action = raw[0] + raw = raw[1:] + # XXX Support < and >? + name, op, value = raw.partition('=') + return cls(name, op, value, action) + + def check(self, var): + value = getattr(var, self.name, None) + if not self.op: + matched = bool(value) + elif self.op == '=': + matched = (value == self.value) + else: + raise NotImplementedError + + if self.action == '+': + return matched + elif self.action == '-': + return not matched + else: + raise NotImplementedError + + +def filter_var(var, filters): + for filter in filters: + if not filter.check(var): + return False + return True + + +def make_sort_key(spec): + columns = [(col.strip('_'), '_' if col.startswith('_') else '') + for col in spec] + def sort_key(var): + return tuple(getattr(var, col).lstrip(prefix) + for col, prefix in columns) + return sort_key + + +def make_groups(allvars, spec): + group = spec + groups = {} + for var in allvars: + value = getattr(var, group) + key = '{}: {}'.format(group, value) + try: + groupvars = groups[key] + except KeyError: + groupvars = groups[key] = [] + groupvars.append(var) + return groups + + +def format_groups(groups, columns, fmts, widths): + for group in sorted(groups): + groupvars = groups[group] + yield '', 0 + yield ' # {}'.format(group), 0 + yield from format_vars(groupvars, columns, fmts, widths) + + +def format_vars(allvars, columns, fmts, widths): + fmt = ' '.join(fmts[col] for col in columns) + fmt = ' ' + fmt.replace(' ', ' ') + ' ' # for div margin + header = fmt.replace(':', ':^').format(*(col.upper() for col in columns)) + yield header, 0 + div = ' '.join('-'*(widths[col]+2) for col in columns) + yield div, 0 + for var in allvars: + values = (getattr(var, col) for col in columns) + row = fmt.format(*('X' if val is True else val or '' + for val in values)) + yield row, 1 + yield div, 0 + + +####################################### + +COLUMNS = 'name,external,capi,scope,filename' +COLUMN_NAMES = COLUMNS.split(',') + +COLUMN_WIDTHS = {col: len(col) + for col in COLUMN_NAMES} +COLUMN_WIDTHS.update({ + 'name': 50, + 'scope': 7, + 'filename': 40, + }) +COLUMN_FORMATS = {col: '{:%s}' % width + for col, width in COLUMN_WIDTHS.items()} +for col in COLUMN_FORMATS: + if COLUMN_WIDTHS[col] == len(col): + COLUMN_FORMATS[col] = COLUMN_FORMATS[col].replace(':', ':^') + + +def _parse_filters_arg(raw, error): + filters = [] + for value in raw.split(','): + value=value.strip() + if not value: + continue + try: + filter = Filter.parse(value) + if filter.name not in COLUMN_NAMES: + raise Exception('unsupported column {!r}'.format(filter.name)) + except Exception as e: + error('bad filter {!r}: {}'.format(raw, e)) + filters.append(filter) + return filters + + +def _parse_columns_arg(raw, error): + columns = raw.split(',') + for column in columns: + if column not in COLUMN_NAMES: + error('unsupported column {!r}'.format(column)) + return columns + + +def _parse_sort_arg(raw, error): + sort = raw.split(',') + for column in sort: + if column.lstrip('_') not in COLUMN_NAMES: + error('unsupported column {!r}'.format(column)) + return sort + + +def _parse_group_arg(raw, error): + if not raw: + return raw + group = raw + if group not in COLUMN_NAMES: + error('unsupported column {!r}'.format(group)) + if group != 'filename': + error('unsupported group {!r}'.format(group)) + return group + + +def parse_args(argv=None): + if argv is None: + argv = sys.argv[1:] + + import argparse + parser = argparse.ArgumentParser() + + parser.add_argument('-v', '--verbose', action='count', default=0) + parser.add_argument('-q', '--quiet', action='count', default=0) + + parser.add_argument('--filters', default='-scope', + help='[[-][=]] ...') + + parser.add_argument('--columns', default=COLUMNS, + help='a comma-separated list of columns to show') + parser.add_argument('--sort', default='filename,_name', + help='a comma-separated list of columns to sort') + parser.add_argument('--group', + help='group by the given column name (- to not group)') + + parser.add_argument('--rc-on-match', dest='rc', type=int) + + parser.add_argument('filename', nargs='?', default=GLOBALS_FILE) + + args = parser.parse_args(argv) + + verbose = vars(args).pop('verbose', 0) + quiet = vars(args).pop('quiet', 0) + args.verbosity = max(0, VERBOSITY + verbose - quiet) + + if args.sort.startswith('filename') and not args.group: + args.group = 'filename' + + if args.rc is None: + if '-scope=core' in args.filters or 'core' not in args.filters: + args.rc = 0 + else: + args.rc = 1 + + args.filters = _parse_filters_arg(args.filters, parser.error) + args.columns = _parse_columns_arg(args.columns, parser.error) + args.sort = _parse_sort_arg(args.sort, parser.error) + args.group = _parse_group_arg(args.group, parser.error) + + return args + + +def main(root=ROOT_DIR, filename=GLOBALS_FILE, + filters=None, columns=COLUMN_NAMES, sort=None, group=None, + verbosity=VERBOSITY, rc=1): + + log = lambda msg: ... + if verbosity >= 2: + log = lambda msg: print(msg) + + allvars = (var + for var in find_vars(root, filename) + if filter_var(var, filters)) + if sort: + allvars = sorted(allvars, key=make_sort_key(sort)) + + if group: + try: + columns.remove(group) + except ValueError: + pass + grouped = make_groups(allvars, group) + lines = format_groups(grouped, columns, COLUMN_FORMATS, COLUMN_WIDTHS) + else: + lines = format_vars(allvars, columns, COLUMN_FORMATS, COLUMN_WIDTHS) + + total = 0 + for line, count in lines: + total += count + log(line) + log('\ntotal: {}'.format(total)) + + if total and rc: + print('ERROR: found unsafe globals', file=sys.stderr) + return rc + return 0 + + +if __name__ == '__main__': + args = parse_args() + sys.exit( + main(**vars(args))) diff --git a/Tools/c-globals/ignored-globals.txt b/Tools/c-globals/ignored-globals.txt new file mode 100644 index 00000000000..4fafba6eefa --- /dev/null +++ b/Tools/c-globals/ignored-globals.txt @@ -0,0 +1,494 @@ +# All variables declared here are shared between all interpreters +# in a single process. That means that they must not be changed +# unless that change should apply to all interpreters. +# +# See check-c-globals.py. +# +# Many generic names are handled via the script: +# +# * most exceptions and all warnings handled via _is_exception() +# * for builtin modules, generic names are handled via _is_module() +# * generic names for static types handled via _is_type_var() +# * AST vars handled via _is_compiler() + + +####################################### +# main + +# Modules/getpath.c +exec_prefix +module_search_path +prefix +progpath + +# Modules/main.c +orig_argc +orig_argv + +# Python/getopt.c +opt_ptr +_PyOS_optarg +_PyOS_opterr +_PyOS_optind + + +####################################### +# REPL + +# Parser/myreadline.c +PyOS_InputHook +PyOS_ReadlineFunctionPointer +_PyOS_ReadlineLock +_PyOS_ReadlineTState + + +####################################### +# state + +# Python/dtoa.c +p5s +pmem_next # very slight race +private_mem # very slight race + +# Python/import.c +# For the moment the import lock stays global. Ultimately there should +# be a global lock for extension modules and a per-interpreter lock. +import_lock +import_lock_level +import_lock_thread + +# Python/pylifecycle.c +_PyRuntime + + +#--------------------------------- +# module globals (PyObject) + +# Modules/_functoolsmodule.c +kwd_mark + +# Modules/_localemodule.c +Error + +# Modules/_threadmodule.c +ThreadError + +# Modules/_tracemalloc.c +unknown_filename + +# Modules/gcmodule.c +gc_str + +# Modules/posixmodule.c +billion +posix_putenv_garbage + +# Modules/signalmodule.c +DefaultHandler +IgnoreHandler +IntHandler +ItimerError + +# Modules/zipimport.c +ZipImportError +zip_directory_cache + + +#--------------------------------- +# module globals (other) + +# Modules/_tracemalloc.c +allocators +tables_lock +tracemalloc_config +tracemalloc_empty_traceback +tracemalloc_filenames +tracemalloc_peak_traced_memory +tracemalloc_reentrant_key +tracemalloc_traceback +tracemalloc_tracebacks +tracemalloc_traced_memory +tracemalloc_traces + +# Modules/faulthandler.c +fatal_error +faulthandler_handlers +old_stack +stack +thread +user_signals + +# Modules/posixmodule.c +posix_constants_confstr +posix_constants_pathconf +posix_constants_sysconf +_stat_float_times # deprecated, __main__-only +structseq_new +ticks_per_second + +# Modules/signalmodule.c +Handlers # main thread only +is_tripped # main thread only +main_pid +main_thread +old_siginthandler +wakeup_fd # main thread only + +# Modules/zipimport.c +zip_searchorder + +# Python/bltinmodule.c +Py_FileSystemDefaultEncodeErrors +Py_FileSystemDefaultEncoding +Py_HasFileSystemDefaultEncoding + +# Python/sysmodule.c +_PySys_ImplCacheTag +_PySys_ImplName + + +#--------------------------------- +# freelists + +# Modules/_collectionsmodule.c +freeblocks +numfreeblocks + +# Objects/classobject.c +free_list +numfree + +# Objects/dictobject.c +free_list +keys_free_list +numfree +numfreekeys + +# Objects/exceptions.c +memerrors_freelist +memerrors_numfree + +# Objects/floatobject.c +free_list +numfree + +# Objects/frameobject.c +free_list +numfree + +# Objects/genobject.c +ag_asend_freelist +ag_asend_freelist_free +ag_value_freelist +ag_value_freelist_free + +# Objects/listobject.c +free_list +numfree + +# Objects/methodobject.c +free_list +numfree + +# Objects/sliceobject.c +slice_cache # slight race + +# Objects/tupleobject.c +free_list +numfree + +# Python/dtoa.c +freelist # very slight race + + +#--------------------------------- +# caches (PyObject) + +# Objects/typeobject.c +method_cache # only for static types +next_version_tag # only for static types + +# Python/dynload_shlib.c +handles # slight race during import +nhandles # slight race during import + +# Python/import.c +extensions # slight race on init during import + + +#--------------------------------- +# caches (other) + +# Python/bootstrap_hash.c +urandom_cache + +# Python/modsupport.c +_Py_PackageContext # Slight race during import! Move to PyThreadState? + + +#--------------------------------- +# counters + +# Objects/bytesobject.c +null_strings +one_strings + +# Objects/dictobject.c +pydict_global_version + +# Objects/moduleobject.c +max_module_number # slight race during import + + +####################################### +# constants + +#--------------------------------- +# singletons + +# Objects/boolobject.c +_Py_FalseStruct +_Py_TrueStruct + +# Objects/object.c +_Py_NoneStruct +_Py_NotImplementedStruct + +# Objects/sliceobject.c +_Py_EllipsisObject + + +#--------------------------------- +# constants (other) + +# Modules/config.c +_PyImport_Inittab + +# Objects/bytearrayobject.c +_PyByteArray_empty_string + +# Objects/dictobject.c +empty_keys_struct +empty_values + +# Objects/floatobject.c +detected_double_format +detected_float_format +double_format +float_format + +# Objects/longobject.c +_PyLong_DigitValue + +# Objects/object.c +_Py_SwappedOp + +# Objects/obmalloc.c +_PyMem_Debug + +# Objects/setobject.c +_dummy_struct + +# Objects/structseq.c +PyStructSequence_UnnamedField + +# Objects/typeobject.c +name_op +slotdefs # almost +slotdefs_initialized # almost +subtype_getsets_dict_only +subtype_getsets_full +subtype_getsets_weakref_only +tp_new_methoddef + +# Objects/unicodeobject.c +bloom_linebreak +static_strings # slight race + +# Parser/tokenizer.c +_PyParser_TokenNames + +# Python/Python-ast.c +alias_fields + +# Python/codecs.c +Py_hexdigits +ucnhash_CAPI # slight performance-only race + +# Python/dynload_shlib.c +_PyImport_DynLoadFiletab + +# Python/fileutils.c +_Py_open_cloexec_works +force_ascii + +# Python/frozen.c +M___hello__ +PyImport_FrozenModules + +# Python/graminit.c +_PyParser_Grammar +dfas +labels + +# Python/import.c +PyImport_Inittab + +# Python/pylifecycle.c +_TARGET_LOCALES + + +#--------------------------------- +# initialized (PyObject) + +# Objects/bytesobject.c +characters +nullstring + +# Objects/exceptions.c +PyExc_RecursionErrorInst +errnomap + +# Objects/longobject.c +_PyLong_One +_PyLong_Zero +small_ints + +# Objects/setobject.c +emptyfrozenset + +# Objects/unicodeobject.c +interned # slight race on init in PyUnicode_InternInPlace() +unicode_empty +unicode_latin1 + + +#--------------------------------- +# initialized (other) + +# Python/getargs.c +static_arg_parsers + +# Python/pyhash.c +PyHash_Func +_Py_HashSecret +_Py_HashSecret_Initialized + +# Python/pylifecycle.c +_Py_StandardStreamEncoding +_Py_StandardStreamErrors +default_home +env_home +progname +Py_BytesWarningFlag +Py_DebugFlag +Py_DontWriteBytecodeFlag +Py_FrozenFlag +Py_HashRandomizationFlag +Py_IgnoreEnvironmentFlag +Py_InspectFlag +Py_InteractiveFlag +Py_IsolatedFlag +Py_NoSiteFlag +Py_NoUserSiteDirectory +Py_OptimizeFlag +Py_QuietFlag +Py_UnbufferedStdioFlag +Py_UseClassExceptionsFlag +Py_VerboseFlag + + +#--------------------------------- +# types + +# Modules/_threadmodule.c +Locktype +RLocktype +localdummytype +localtype + +# Objects/exceptions.c +PyExc_BaseException +PyExc_Exception +PyExc_GeneratorExit +PyExc_KeyboardInterrupt +PyExc_StopAsyncIteration +PyExc_StopIteration +PyExc_SystemExit +_PyExc_BaseException +_PyExc_Exception +_PyExc_GeneratorExit +_PyExc_KeyboardInterrupt +_PyExc_StopAsyncIteration +_PyExc_StopIteration +_PyExc_SystemExit + +# Objects/structseq.c +_struct_sequence_template + + +#--------------------------------- +# interned strings/bytes + +# Modules/_io/_iomodule.c +_PyIO_empty_bytes +_PyIO_empty_str +_PyIO_str_close +_PyIO_str_closed +_PyIO_str_decode +_PyIO_str_encode +_PyIO_str_fileno +_PyIO_str_flush +_PyIO_str_getstate +_PyIO_str_isatty +_PyIO_str_newlines +_PyIO_str_nl +_PyIO_str_read +_PyIO_str_read1 +_PyIO_str_readable +_PyIO_str_readall +_PyIO_str_readinto +_PyIO_str_readline +_PyIO_str_reset +_PyIO_str_seek +_PyIO_str_seekable +_PyIO_str_setstate +_PyIO_str_tell +_PyIO_str_truncate +_PyIO_str_writable +_PyIO_str_write + +# Modules/_threadmodule.c +str_dict + +# Objects/boolobject.c +false_str +true_str + +# Objects/listobject.c +indexerr + +# Python/symtable.c +__class__ +dictcomp +genexpr +lambda +listcomp +setcomp +top + +# Python/sysmodule.c +whatstrings + + +####################################### +# hacks + +# Objects/object.c +_Py_abstract_hack + +# Objects/setobject.c +_PySet_Dummy + +# Python/pylifecycle.c +_PyOS_mystrnicmp_hack From webhook-mailer at python.org Fri Sep 8 02:35:56 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 08 Sep 2017 06:35:56 -0000 Subject: [Python-checkins] update all_name_chars comment after 9020ac7cce97dddad51b285fffc31fe4ddf60898 (#3452) Message-ID: https://github.com/python/cpython/commit/8e0ad46bc8349bf92f5f7b8545385b8798c94b52 commit: 8e0ad46bc8349bf92f5f7b8545385b8798c94b52 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-07T23:35:53-07:00 summary: update all_name_chars comment after 9020ac7cce97dddad51b285fffc31fe4ddf60898 (#3452) files: M Objects/codeobject.c diff --git a/Objects/codeobject.c b/Objects/codeobject.c index be2d7b22db7..eee9bfeaf7c 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -10,8 +10,7 @@ typedef struct { void *ce_extras[1]; } _PyCodeObjectExtra; -/* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */ - +/* all_name_chars(s): true iff s matches [a-zA-Z0-9_]* */ static int all_name_chars(PyObject *o) { From webhook-mailer at python.org Fri Sep 8 02:53:09 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Fri, 08 Sep 2017 06:53:09 -0000 Subject: [Python-checkins] Show example of itemgetter() applied to a dictionary (#3431) Message-ID: https://github.com/python/cpython/commit/70c2dd306f575e8bc9edb10ced5c7a6a555d1c87 commit: 70c2dd306f575e8bc9edb10ced5c7a6a555d1c87 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-07T23:53:07-07:00 summary: Show example of itemgetter() applied to a dictionary (#3431) files: M Doc/library/operator.rst diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 8121b480cb6..76335b179c5 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -321,6 +321,9 @@ expect a function argument. >>> itemgetter(slice(2,None))('ABCDEFG') 'CDEFG' + >>> soldier = dict(rank='captain', name='dotterbart') + >>> itemgetter('rank')(soldier) + 'captain' Example of using :func:`itemgetter` to retrieve specific fields from a tuple record: From webhook-mailer at python.org Fri Sep 8 02:58:55 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 08 Sep 2017 06:58:55 -0000 Subject: [Python-checkins] bpo-31393: Fix the use of PyUnicode_READY(). (#3451) Message-ID: https://github.com/python/cpython/commit/e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c commit: e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-08T09:58:51+03:00 summary: bpo-31393: Fix the use of PyUnicode_READY(). (#3451) files: M Modules/socketmodule.c M Objects/codeobject.c M Objects/typeobject.c M Objects/unicodeobject.c M Python/ceval.c diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2c2f98d4ac3..50a4443a35a 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1467,7 +1467,10 @@ idna_converter(PyObject *obj, struct maybe_idna *data) len = PyByteArray_Size(obj); } else if (PyUnicode_Check(obj)) { - if (PyUnicode_READY(obj) == 0 && PyUnicode_IS_COMPACT_ASCII(obj)) { + if (PyUnicode_READY(obj) == -1) { + return 0; + } + if (PyUnicode_IS_COMPACT_ASCII(obj)) { data->buf = PyUnicode_DATA(obj); len = PyUnicode_GET_LENGTH(obj); } diff --git a/Objects/codeobject.c b/Objects/codeobject.c index eee9bfeaf7c..adef625b296 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -27,7 +27,7 @@ all_name_chars(PyObject *o) }; const unsigned char *s, *e; - if (PyUnicode_READY(o) == -1 || !PyUnicode_IS_ASCII(o)) + if (!PyUnicode_IS_ASCII(o)) return 0; s = PyUnicode_1BYTE_DATA(o); @@ -63,6 +63,10 @@ intern_string_constants(PyObject *tuple) for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); if (PyUnicode_CheckExact(v)) { + if (PyUnicode_READY(v) == -1) { + PyErr_Clear(); + continue; + } if (all_name_chars(v)) { PyObject *w = v; PyUnicode_InternInPlace(&v); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b2154bbf690..a06cab72e5c 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -30,9 +30,9 @@ class object "PyObject *" "&PyBaseObject_Type" #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ ((PyASCIIObject *)(name))->hash) -#define MCACHE_CACHEABLE_NAME(name) \ - PyUnicode_CheckExact(name) && \ - PyUnicode_READY(name) != -1 && \ +#define MCACHE_CACHEABLE_NAME(name) \ + PyUnicode_CheckExact(name) && \ + PyUnicode_IS_READY(name) && \ PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index db1516ddf65..c4d93fca045 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4185,10 +4185,13 @@ PyUnicode_ReadChar(PyObject *unicode, Py_ssize_t index) void *data; int kind; - if (!PyUnicode_Check(unicode) || PyUnicode_READY(unicode) == -1) { + if (!PyUnicode_Check(unicode)) { PyErr_BadArgument(); return (Py_UCS4)-1; } + if (PyUnicode_READY(unicode) == -1) { + return (Py_UCS4)-1; + } if (index < 0 || index >= PyUnicode_GET_LENGTH(unicode)) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return (Py_UCS4)-1; @@ -11668,10 +11671,13 @@ unicode_getitem(PyObject *self, Py_ssize_t index) enum PyUnicode_Kind kind; Py_UCS4 ch; - if (!PyUnicode_Check(self) || PyUnicode_READY(self) == -1) { + if (!PyUnicode_Check(self)) { PyErr_BadArgument(); return NULL; } + if (PyUnicode_READY(self) == -1) { + return NULL; + } if (index < 0 || index >= PyUnicode_GET_LENGTH(self)) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return NULL; diff --git a/Python/ceval.c b/Python/ceval.c index e583e272d72..5dd7cd9f03e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5017,13 +5017,16 @@ import_all_from(PyObject *locals, PyObject *v) PyErr_Clear(); break; } - if (skip_leading_underscores && - PyUnicode_Check(name) && - PyUnicode_READY(name) != -1 && - PyUnicode_READ_CHAR(name, 0) == '_') - { - Py_DECREF(name); - continue; + if (skip_leading_underscores && PyUnicode_Check(name)) { + if (PyUnicode_READY(name) == -1) { + Py_DECREF(name); + err = -1; + break; + } + if (PyUnicode_READ_CHAR(name, 0) == '_') { + Py_DECREF(name); + continue; + } } value = PyObject_GetAttr(v, name); if (value == NULL) From webhook-mailer at python.org Fri Sep 8 03:43:59 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 08 Sep 2017 07:43:59 -0000 Subject: [Python-checkins] [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453) Message-ID: https://github.com/python/cpython/commit/ddb536ba7b7c6022424e39d666c3cc81772645c0 commit: ddb536ba7b7c6022424e39d666c3cc81772645c0 branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-09-08T10:43:54+03:00 summary: [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453) (cherry picked from commit e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c) files: M Modules/socketmodule.c M Objects/codeobject.c M Objects/typeobject.c M Objects/unicodeobject.c M Python/ceval.c diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index d006bd4def3..a351faa7f9f 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1464,7 +1464,10 @@ idna_converter(PyObject *obj, struct maybe_idna *data) len = PyByteArray_Size(obj); } else if (PyUnicode_Check(obj)) { - if (PyUnicode_READY(obj) == 0 && PyUnicode_IS_COMPACT_ASCII(obj)) { + if (PyUnicode_READY(obj) == -1) { + return 0; + } + if (PyUnicode_IS_COMPACT_ASCII(obj)) { data->buf = PyUnicode_DATA(obj); len = PyUnicode_GET_LENGTH(obj); } diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 6de697ae3fd..d45be4c9679 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -22,8 +22,7 @@ all_name_chars(PyObject *o) static const unsigned char *name_chars = (unsigned char *)NAME_CHARS; const unsigned char *s, *e; - if (!PyUnicode_Check(o) || PyUnicode_READY(o) == -1 || - !PyUnicode_IS_ASCII(o)) + if (!PyUnicode_IS_ASCII(o)) return 0; if (ok_name_char[*name_chars] == 0) { @@ -64,6 +63,10 @@ intern_string_constants(PyObject *tuple) for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); if (PyUnicode_CheckExact(v)) { + if (PyUnicode_READY(v) == -1) { + PyErr_Clear(); + continue; + } if (all_name_chars(v)) { PyObject *w = v; PyUnicode_InternInPlace(&v); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 271b93575c6..cb5e235628d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -22,9 +22,9 @@ #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ ((PyASCIIObject *)(name))->hash) -#define MCACHE_CACHEABLE_NAME(name) \ - PyUnicode_CheckExact(name) && \ - PyUnicode_READY(name) != -1 && \ +#define MCACHE_CACHEABLE_NAME(name) \ + PyUnicode_CheckExact(name) && \ + PyUnicode_IS_READY(name) && \ PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 1650370bacc..1f221aff67c 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4210,10 +4210,13 @@ PyUnicode_ReadChar(PyObject *unicode, Py_ssize_t index) void *data; int kind; - if (!PyUnicode_Check(unicode) || PyUnicode_READY(unicode) == -1) { + if (!PyUnicode_Check(unicode)) { PyErr_BadArgument(); return (Py_UCS4)-1; } + if (PyUnicode_READY(unicode) == -1) { + return (Py_UCS4)-1; + } if (index < 0 || index >= PyUnicode_GET_LENGTH(unicode)) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return (Py_UCS4)-1; @@ -11706,10 +11709,13 @@ unicode_getitem(PyObject *self, Py_ssize_t index) enum PyUnicode_Kind kind; Py_UCS4 ch; - if (!PyUnicode_Check(self) || PyUnicode_READY(self) == -1) { + if (!PyUnicode_Check(self)) { PyErr_BadArgument(); return NULL; } + if (PyUnicode_READY(self) == -1) { + return NULL; + } if (index < 0 || index >= PyUnicode_GET_LENGTH(self)) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return NULL; diff --git a/Python/ceval.c b/Python/ceval.c index 4aa3250cd0b..2b74d0e5730 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5307,13 +5307,16 @@ import_all_from(PyObject *locals, PyObject *v) PyErr_Clear(); break; } - if (skip_leading_underscores && - PyUnicode_Check(name) && - PyUnicode_READY(name) != -1 && - PyUnicode_READ_CHAR(name, 0) == '_') - { - Py_DECREF(name); - continue; + if (skip_leading_underscores && PyUnicode_Check(name)) { + if (PyUnicode_READY(name) == -1) { + Py_DECREF(name); + err = -1; + break; + } + if (PyUnicode_READ_CHAR(name, 0) == '_') { + Py_DECREF(name); + continue; + } } value = PyObject_GetAttr(v, name); if (value == NULL) From solipsis at pitrou.net Fri Sep 8 05:22:29 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 08 Sep 2017 09:22:29 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-1 Message-ID: <20170908092229.91124.FC7026C51DEB87C3@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 1, 0] memory blocks, sum=-1 test_multiprocessing_spawn leaked [2, -1, 1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog070Y5h', '--timeout', '7200'] From webhook-mailer at python.org Fri Sep 8 13:35:52 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 08 Sep 2017 17:35:52 -0000 Subject: [Python-checkins] replace custom table with pyctype (#3456) Message-ID: https://github.com/python/cpython/commit/2b7953d974dbe5adc0937394c93f31c46cf01517 commit: 2b7953d974dbe5adc0937394c93f31c46cf01517 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-08T10:35:49-07:00 summary: replace custom table with pyctype (#3456) files: M Objects/codeobject.c diff --git a/Objects/codeobject.c b/Objects/codeobject.c index adef625b296..f312f338a9b 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -14,17 +14,6 @@ typedef struct { static int all_name_chars(PyObject *o) { - /* [a-zA-Z0-9_] */ - static const bool ok_name_char[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 - }; const unsigned char *s, *e; if (!PyUnicode_IS_ASCII(o)) @@ -33,7 +22,7 @@ all_name_chars(PyObject *o) s = PyUnicode_1BYTE_DATA(o); e = s + PyUnicode_GET_LENGTH(o); for (; s != e; s++) { - if (!ok_name_char[*s]) + if (!Py_ISALNUM(*s) && *s != '_') return 0; } return 1; From webhook-mailer at python.org Fri Sep 8 13:46:47 2017 From: webhook-mailer at python.org (Ned Deily) Date: Fri, 08 Sep 2017 17:46:47 -0000 Subject: [Python-checkins] [3.5] bpo-31036: Allow sphinx and blurb to be found automatically (GH-3440) Message-ID: https://github.com/python/cpython/commit/9cc332094c5f8cbaa47400633ab3ba372da61c9d commit: 9cc332094c5f8cbaa47400633ab3ba372da61c9d branch: 3.5 author: Ned Deily committer: Ned Deily date: 2017-09-08T10:42:19-07:00 summary: [3.5] bpo-31036: Allow sphinx and blurb to be found automatically (GH-3440) Rather than requiring the path to blurb and/or sphinx-build to be specified to the make rule, enhance the Doc/Makefile to look for each first in a virtual environment created by make venv and, if not found, look on the normal process PATH. This allows the Doc/Makefile to take advantage of an installed spinx-build or blurb and, thus, do the right thing most of the time. Also, make the directory for the venv be configurable and document the `make venv` target. files: M Doc/Makefile diff --git a/Doc/Makefile b/Doc/Makefile index 04da82fea96..da3274396eb 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -5,8 +5,9 @@ # You can set these variables from the command line. PYTHON = python3 -SPHINXBUILD = sphinx-build -BLURB = $(PYTHON) -m blurb +VENVDIR = ./venv +SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build +BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb PAPER = SOURCES = DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) @@ -118,11 +119,12 @@ htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" clean: - -rm -rf build/* venv/* + -rm -rf build/* $(VENVDIR)/* venv: - $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install -U Sphinx blurb + $(PYTHON) -m venv $(VENVDIR) + $(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb + @echo "The venv has been created in the $(VENVDIR) directory" dist: rm -rf dist @@ -174,15 +176,20 @@ serve: ../Tools/scripts/serve.py build/html # Targets for daily automated doc build +# By default, Sphinx only rebuilds pages where the page content has changed. +# This means it doesn't always pick up changes to preferred link targets, etc +# To ensure such changes are picked up, we build the published docs with +# `-E` (to ignore the cached environment) and `-a` (to ignore already existing +# output files) # for development releases: always build autobuild-dev: - make dist SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A versionswitcher=1' + make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1' -make suspicious # for quick rebuilds (HTML only) autobuild-dev-html: - make html SPHINXOPTS='$(SPHINXOPTS) -A daily=1 -A versionswitcher=1' + make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) # release candidate downloads are okay, since the stable tree can be in that stage From webhook-mailer at python.org Fri Sep 8 14:21:10 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Fri, 08 Sep 2017 18:21:10 -0000 Subject: [Python-checkins] [2.7] bpo-30450: Fall back on the old env.bat (GH-3443) Message-ID: https://github.com/python/cpython/commit/1911cf3dd2ae67d600c166ba52872fdcf3e85824 commit: 1911cf3dd2ae67d600c166ba52872fdcf3e85824 branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-08T11:21:06-07:00 summary: [2.7] bpo-30450: Fall back on the old env.bat (GH-3443) files: M PCbuild/build.bat diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 13da4be4404..b263ec7a654 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -101,7 +101,7 @@ if exist "%GIT%" set GITProperty=/p:GIT="%GIT%" rem Setup the environment call "%dir%find_msbuild.bat" %MSBUILD% -if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) +if ERRORLEVEL 1 (call "%dir%env.bat" && set MSBUILD=msbuild) if "%kill%"=="true" call :Kill From webhook-mailer at python.org Fri Sep 8 14:32:29 2017 From: webhook-mailer at python.org (Ned Deily) Date: Fri, 08 Sep 2017 18:32:29 -0000 Subject: [Python-checkins] [3.5] Fix broken `Show Source` links on documentation pages (GH-3113) (#3126) Message-ID: https://github.com/python/cpython/commit/0d68d6d9c6386e3f78893f0506f2ce16d88b5db8 commit: 0d68d6d9c6386e3f78893f0506f2ce16d88b5db8 branch: 3.5 author: Mariatta committer: Ned Deily date: 2017-09-08T11:32:26-07:00 summary: [3.5] Fix broken `Show Source` links on documentation pages (GH-3113) (#3126) The `Show Source` was broken because of a change made in sphinx 1.5.1 In Sphinx 1.4.9, the sourcename was "index.txt". In Sphinx 1.5.1+, it is now "index.rst.txt". (cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69) files: M Doc/tools/templates/customsourcelink.html diff --git a/Doc/tools/templates/customsourcelink.html b/Doc/tools/templates/customsourcelink.html index 71d0bba6830..21af621efce 100644 --- a/Doc/tools/templates/customsourcelink.html +++ b/Doc/tools/templates/customsourcelink.html @@ -4,7 +4,7 @@
  • {% trans %}Report a Bug{% endtrans %}
  • - {{ _('Show Source') }}
  • From webhook-mailer at python.org Fri Sep 8 14:35:41 2017 From: webhook-mailer at python.org (Steve Dower) Date: Fri, 08 Sep 2017 18:35:41 -0000 Subject: [Python-checkins] Fixes reference leak (#3457) Message-ID: https://github.com/python/cpython/commit/af8d6b90723daa943c5cd0a38ee7564790d8687a commit: af8d6b90723daa943c5cd0a38ee7564790d8687a branch: master author: Steve Dower committer: GitHub date: 2017-09-08T11:35:38-07:00 summary: Fixes reference leak (#3457) files: M PC/_findvs.cpp diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp index 6c660115963..dd7c1fcb723 100644 --- a/PC/_findvs.cpp +++ b/PC/_findvs.cpp @@ -161,18 +161,26 @@ static PyObject *find_all_instances() PyObject *version = nullptr; PyObject *path = nullptr; PyObject *packages = nullptr; + PyObject *tuple = nullptr; if (FAILED(hr = inst->QueryInterface(&inst2)) || !(name = get_install_name(inst2)) || !(version = get_install_version(inst)) || !(path = get_install_path(inst)) || !(packages = get_installed_packages(inst2)) || - PyList_Append(res, PyTuple_Pack(4, name, version, path, packages)) < 0) + !(tuple = PyTuple_Pack(4, name, version, path, packages)) || + PyList_Append(res, tuple) < 0) goto iter_error; + Py_DECREF(tuple); + Py_DECREF(packages); + Py_DECREF(path); + Py_DECREF(version); + Py_DECREF(name); continue; iter_error: if (inst2) inst2->Release(); + Py_XDECREF(tuple); Py_XDECREF(packages); Py_XDECREF(path); Py_XDECREF(version); From webhook-mailer at python.org Fri Sep 8 15:00:21 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 19:00:21 -0000 Subject: [Python-checkins] bpo-28182: Expose OpenSSL verification results (#3412) Message-ID: https://github.com/python/cpython/commit/b3ad0e5127bdeb6e506301e0d65403fa23c4177b commit: b3ad0e5127bdeb6e506301e0d65403fa23c4177b branch: master author: Christian Heimes committer: GitHub date: 2017-09-08T12:00:19-07:00 summary: bpo-28182: Expose OpenSSL verification results (#3412) The SSL module now raises SSLCertVerificationError when OpenSSL fails to verify the peer's certificate. The exception contains more information about the error. Original patch by Chi Hsuan Yen Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst M Doc/library/ssl.rst M Lib/ssl.py M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 031c3618bef..200ab0454ef 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -129,11 +129,26 @@ Functions, Constants, and Exceptions .. versionadded:: 3.3 +.. exception:: SSLCertVerificationError + + A subclass of :exc:`SSLError` raised when certificate validation has + failed. + + .. versionadded:: 3.7 + + .. attribute:: verify_code + + A numeric error number that denotes the verification error. + + .. attribute:: verify_message + + A human readable string of the verification error. + .. exception:: CertificateError Raised to signal an error with a certificate (such as mismatching hostname). Certificate errors detected by OpenSSL, though, raise - an :exc:`SSLError`. + an :exc:`SSLCertVerificationError`. Socket creation diff --git a/Lib/ssl.py b/Lib/ssl.py index 1f3a31a9b79..062e8021180 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -104,7 +104,7 @@ from _ssl import _SSLContext, MemoryBIO, SSLSession from _ssl import ( SSLError, SSLZeroReturnError, SSLWantReadError, SSLWantWriteError, - SSLSyscallError, SSLEOFError, + SSLSyscallError, SSLEOFError, SSLCertVerificationError ) from _ssl import txt2obj as _txt2obj, nid2obj as _nid2obj from _ssl import RAND_status, RAND_add, RAND_bytes, RAND_pseudo_bytes diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index fe9f6939d33..99fd80b3a04 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2530,6 +2530,29 @@ def connector(): finally: t.join() + def test_ssl_cert_verify_error(self): + if support.verbose: + sys.stdout.write("\n") + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + server_context.load_cert_chain(SIGNED_CERTFILE) + + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + + server = ThreadedEchoServer(context=server_context, chatty=True) + with server: + with context.wrap_socket(socket.socket(), + server_hostname="localhost") as s: + try: + s.connect((HOST, server.port)) + except ssl.SSLError as e: + msg = 'unable to get local issuer certificate' + self.assertIsInstance(e, ssl.SSLCertVerificationError) + self.assertEqual(e.verify_code, 20) + self.assertEqual(e.verify_message, msg) + self.assertIn(msg, repr(e)) + self.assertIn('certificate verify failed', repr(e)) + @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), "OpenSSL is compiled without SSLv2 support") diff --git a/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst b/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst new file mode 100644 index 00000000000..d96079f0aee --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst @@ -0,0 +1,3 @@ +The SSL module now raises SSLCertVerificationError when OpenSSL fails to +verify the peer's certificate. The exception contains more information about +the error. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index f7379257956..5b27f2fda2c 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -66,6 +66,7 @@ static PySocketModule_APIObject PySocketModule; /* SSL error object */ static PyObject *PySSLErrorObject; +static PyObject *PySSLCertVerificationErrorObject; static PyObject *PySSLZeroReturnErrorObject; static PyObject *PySSLWantReadErrorObject; static PyObject *PySSLWantWriteErrorObject; @@ -386,6 +387,9 @@ typedef enum { PyDoc_STRVAR(SSLError_doc, "An error occurred in the SSL implementation."); +PyDoc_STRVAR(SSLCertVerificationError_doc, +"A certificate could not be verified."); + PyDoc_STRVAR(SSLZeroReturnError_doc, "SSL/TLS session closed cleanly."); @@ -430,13 +434,16 @@ static PyType_Spec sslerror_type_spec = { }; static void -fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr, - int lineno, unsigned long errcode) +fill_and_set_sslerror(PySSLSocket *sslsock, PyObject *type, int ssl_errno, + const char *errstr, int lineno, unsigned long errcode) { PyObject *err_value = NULL, *reason_obj = NULL, *lib_obj = NULL; + PyObject *verify_obj = NULL, *verify_code_obj = NULL; PyObject *init_value, *msg, *key; _Py_IDENTIFIER(reason); _Py_IDENTIFIER(library); + _Py_IDENTIFIER(verify_message); + _Py_IDENTIFIER(verify_code); if (errcode != 0) { int lib, reason; @@ -466,7 +473,50 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr, if (errstr == NULL) errstr = "unknown error"; - if (reason_obj && lib_obj) + /* verify code for cert validation error */ + if ((sslsock != NULL) && (type == PySSLCertVerificationErrorObject)) { + const char *verify_str = NULL; + long verify_code; + + verify_code = SSL_get_verify_result(sslsock->ssl); + verify_code_obj = PyLong_FromLong(verify_code); + if (verify_code_obj == NULL) { + goto fail; + } + + switch (verify_code) { + case X509_V_ERR_HOSTNAME_MISMATCH: + verify_obj = PyUnicode_FromFormat( + "Hostname mismatch, certificate is not valid for '%S'.", + sslsock->server_hostname + ); + break; + case X509_V_ERR_IP_ADDRESS_MISMATCH: + verify_obj = PyUnicode_FromFormat( + "IP address mismatch, certificate is not valid for '%S'.", + sslsock->server_hostname + ); + break; + default: + verify_str = X509_verify_cert_error_string(verify_code); + if (verify_str != NULL) { + verify_obj = PyUnicode_FromString(verify_str); + } else { + verify_obj = Py_None; + Py_INCREF(verify_obj); + } + break; + } + if (verify_obj == NULL) { + goto fail; + } + } + + if (verify_obj && reason_obj && lib_obj) + msg = PyUnicode_FromFormat("[%S: %S] %s: %S (_ssl.c:%d)", + lib_obj, reason_obj, errstr, verify_obj, + lineno); + else if (reason_obj && lib_obj) msg = PyUnicode_FromFormat("[%S: %S] %s (_ssl.c:%d)", lib_obj, reason_obj, errstr, lineno); else if (lib_obj) @@ -490,17 +540,30 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr, reason_obj = Py_None; if (_PyObject_SetAttrId(err_value, &PyId_reason, reason_obj)) goto fail; + if (lib_obj == NULL) lib_obj = Py_None; if (_PyObject_SetAttrId(err_value, &PyId_library, lib_obj)) goto fail; + + if ((sslsock != NULL) && (type == PySSLCertVerificationErrorObject)) { + /* Only set verify code / message for SSLCertVerificationError */ + if (_PyObject_SetAttrId(err_value, &PyId_verify_code, + verify_code_obj)) + goto fail; + if (_PyObject_SetAttrId(err_value, &PyId_verify_message, verify_obj)) + goto fail; + } + PyErr_SetObject(type, err_value); fail: Py_XDECREF(err_value); + Py_XDECREF(verify_code_obj); + Py_XDECREF(verify_obj); } static PyObject * -PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) +PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno) { PyObject *type = PySSLErrorObject; char *errstr = NULL; @@ -511,8 +574,8 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) assert(ret <= 0); e = ERR_peek_last_error(); - if (obj->ssl != NULL) { - err = SSL_get_error(obj->ssl, ret); + if (sslsock->ssl != NULL) { + err = SSL_get_error(sslsock->ssl, ret); switch (err) { case SSL_ERROR_ZERO_RETURN: @@ -541,7 +604,7 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) case SSL_ERROR_SYSCALL: { if (e == 0) { - PySocketSockObject *s = GET_SOCKET(obj); + PySocketSockObject *s = GET_SOCKET(sslsock); if (ret == 0 || (((PyObject *)s) == Py_None)) { p = PY_SSL_ERROR_EOF; type = PySSLEOFErrorObject; @@ -566,9 +629,14 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) case SSL_ERROR_SSL: { p = PY_SSL_ERROR_SSL; - if (e == 0) + if (e == 0) { /* possible? */ errstr = "A failure in the SSL library occurred"; + } + if (ERR_GET_LIB(e) == ERR_LIB_SSL && + ERR_GET_REASON(e) == SSL_R_CERTIFICATE_VERIFY_FAILED) { + type = PySSLCertVerificationErrorObject; + } break; } default: @@ -576,7 +644,7 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) errstr = "Invalid error code"; } } - fill_and_set_sslerror(type, p, errstr, lineno, e); + fill_and_set_sslerror(sslsock, type, p, errstr, lineno, e); ERR_clear_error(); return NULL; } @@ -588,15 +656,11 @@ _setSSLError (const char *errstr, int errcode, const char *filename, int lineno) errcode = ERR_peek_last_error(); else errcode = 0; - fill_and_set_sslerror(PySSLErrorObject, errcode, errstr, lineno, errcode); + fill_and_set_sslerror(NULL, PySSLErrorObject, errcode, errstr, lineno, errcode); ERR_clear_error(); return NULL; } -/* - * SSL objects - */ - static PySSLSocket * newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, enum py_ssl_server_or_client socket_type, @@ -656,7 +720,6 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, if (server_hostname != NULL) SSL_set_tlsext_host_name(self->ssl, server_hostname); #endif - /* If the socket is in non-blocking mode or timeout mode, set the BIO * to non-blocking mode (blocking is the default) */ @@ -5130,7 +5193,7 @@ parse_openssl_version(unsigned long libver, PyMODINIT_FUNC PyInit__ssl(void) { - PyObject *m, *d, *r; + PyObject *m, *d, *r, *bases; unsigned long libver; unsigned int major, minor, fix, patch, status; PySocketModule_APIObject *socket_api; @@ -5182,6 +5245,14 @@ PyInit__ssl(void) if (PySSLErrorObject == NULL) return NULL; + /* ssl.CertificateError used to be a subclass of ValueError */ + bases = Py_BuildValue("OO", PySSLErrorObject, PyExc_ValueError); + if (bases == NULL) + return NULL; + PySSLCertVerificationErrorObject = PyErr_NewExceptionWithDoc( + "ssl.SSLCertVerificationError", SSLCertVerificationError_doc, + bases, NULL); + Py_DECREF(bases); PySSLZeroReturnErrorObject = PyErr_NewExceptionWithDoc( "ssl.SSLZeroReturnError", SSLZeroReturnError_doc, PySSLErrorObject, NULL); @@ -5197,13 +5268,16 @@ PyInit__ssl(void) PySSLEOFErrorObject = PyErr_NewExceptionWithDoc( "ssl.SSLEOFError", SSLEOFError_doc, PySSLErrorObject, NULL); - if (PySSLZeroReturnErrorObject == NULL + if (PySSLCertVerificationErrorObject == NULL + || PySSLZeroReturnErrorObject == NULL || PySSLWantReadErrorObject == NULL || PySSLWantWriteErrorObject == NULL || PySSLSyscallErrorObject == NULL || PySSLEOFErrorObject == NULL) return NULL; if (PyDict_SetItemString(d, "SSLError", PySSLErrorObject) != 0 + || PyDict_SetItemString(d, "SSLCertVerificationError", + PySSLCertVerificationErrorObject) != 0 || PyDict_SetItemString(d, "SSLZeroReturnError", PySSLZeroReturnErrorObject) != 0 || PyDict_SetItemString(d, "SSLWantReadError", PySSLWantReadErrorObject) != 0 || PyDict_SetItemString(d, "SSLWantWriteError", PySSLWantWriteErrorObject) != 0 From webhook-mailer at python.org Fri Sep 8 15:14:38 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Fri, 08 Sep 2017 19:14:38 -0000 Subject: [Python-checkins] bpo-31354: Let configure --with-lto work on all builds Message-ID: https://github.com/python/cpython/commit/4c81401b3a9ffa48fc9e1ffff9963cbad5111e33 commit: 4c81401b3a9ffa48fc9e1ffff9963cbad5111e33 branch: master author: octaviansoldea committer: Gregory P. Smith date: 2017-09-08T12:14:33-07:00 summary: bpo-31354: Let configure --with-lto work on all builds Allow configure --with-lto to apply to all builds, not just profile-opt builds. Whether this is actually useful or not must be determined by the person building CPython using their own toolchain. My own quick test on x86_64 Debian 9 (gcc 6.3, binutils 2.28) seemed to suggest that it wasn't, but I expect better toolchains can or will exist at some point. The point is to allow it at all. files: A Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst M Makefile.pre.in M configure M configure.ac diff --git a/Makefile.pre.in b/Makefile.pre.in index 0eb5c4dc501..1c721000833 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -463,7 +463,7 @@ profile-opt: $(MAKE) profile-removal build_all_generate_profile: - $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" run_profile_task: @ # FIXME: can't run for a cross build @@ -473,7 +473,7 @@ build_all_merge_profile: $(LLVM_PROF_MERGER) build_all_use_profile: - $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@" + $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG)" LDFLAGS="$(LDFLAGS)" # Compile and run with gcov .PHONY=coverage coverage-lcov coverage-report diff --git a/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst b/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst new file mode 100644 index 00000000000..b63c9ea6e01 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst @@ -0,0 +1 @@ +Allow --with-lto to be used on all builds, not just `make profile-opt`. diff --git a/configure b/configure index 12afe5e9b3c..00dd1f0514a 100755 --- a/configure +++ b/configure @@ -679,7 +679,6 @@ LLVM_PROF_FILE LLVM_PROF_MERGER PGO_PROF_USE_FLAG PGO_PROF_GEN_FLAG -LTOFLAGS DEF_MAKE_RULE DEF_MAKE_ALL_RULE ABIFLAGS @@ -1511,8 +1510,8 @@ Optional Packages: --with-suffix=.exe set executable suffix --with-pydebug build with Py_DEBUG defined --with-assertions build with C assertions enabled - --with-lto Enable Link Time Optimization in PGO builds. - Disabled by default. + --with-lto Enable Link Time Optimization in any build. Disabled + by default. --with-hash-algorithm=[fnv|siphash24] select hash algorithm --with-address-sanitizer @@ -6511,7 +6510,6 @@ else fi # Enable LTO flags - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lto" >&5 $as_echo_n "checking for --with-lto... " >&6; } @@ -6557,6 +6555,8 @@ if test "$Py_LTO" = 'true' ; then esac ;; esac + CFLAGS="$CFLAGS $LTOFLAGS" + LDFLAGS="$LDFLAGS $LTOFLAGS" fi # Enable PGO flags. diff --git a/configure.ac b/configure.ac index 9cded9f6f79..88ab6a12157 100644 --- a/configure.ac +++ b/configure.ac @@ -1282,9 +1282,8 @@ else fi # Enable LTO flags -AC_SUBST(LTOFLAGS) AC_MSG_CHECKING(for --with-lto) -AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]), +AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in any build. Disabled by default.]), [ if test "$withval" != no then @@ -1319,6 +1318,8 @@ if test "$Py_LTO" = 'true' ; then esac ;; esac + CFLAGS="$CFLAGS $LTOFLAGS" + LDFLAGS="$LDFLAGS $LTOFLAGS" fi # Enable PGO flags. From webhook-mailer at python.org Fri Sep 8 17:26:29 2017 From: webhook-mailer at python.org (Steve Dower) Date: Fri, 08 Sep 2017 21:26:29 -0000 Subject: [Python-checkins] [3.6] Fixes reference leak (GH-3457) (#3460) Message-ID: https://github.com/python/cpython/commit/ef18b0dab94b00ee233d672d89776539ef236207 commit: ef18b0dab94b00ee233d672d89776539ef236207 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Steve Dower date: 2017-09-08T14:26:27-07:00 summary: [3.6] Fixes reference leak (GH-3457) (#3460) (cherry picked from commit af8d6b90723daa943c5cd0a38ee7564790d8687a) files: M PC/_findvs.cpp diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp index 6c660115963..dd7c1fcb723 100644 --- a/PC/_findvs.cpp +++ b/PC/_findvs.cpp @@ -161,18 +161,26 @@ static PyObject *find_all_instances() PyObject *version = nullptr; PyObject *path = nullptr; PyObject *packages = nullptr; + PyObject *tuple = nullptr; if (FAILED(hr = inst->QueryInterface(&inst2)) || !(name = get_install_name(inst2)) || !(version = get_install_version(inst)) || !(path = get_install_path(inst)) || !(packages = get_installed_packages(inst2)) || - PyList_Append(res, PyTuple_Pack(4, name, version, path, packages)) < 0) + !(tuple = PyTuple_Pack(4, name, version, path, packages)) || + PyList_Append(res, tuple) < 0) goto iter_error; + Py_DECREF(tuple); + Py_DECREF(packages); + Py_DECREF(path); + Py_DECREF(version); + Py_DECREF(name); continue; iter_error: if (inst2) inst2->Release(); + Py_XDECREF(tuple); Py_XDECREF(packages); Py_XDECREF(path); Py_XDECREF(version); From webhook-mailer at python.org Fri Sep 8 17:30:10 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 08 Sep 2017 21:30:10 -0000 Subject: [Python-checkins] delete dead locale initialization code for windows (#3461) Message-ID: https://github.com/python/cpython/commit/db610e909b07ced88e73fb0c23e04eed0d4e1b0d commit: db610e909b07ced88e73fb0c23e04eed0d4e1b0d branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-08T14:30:07-07:00 summary: delete dead locale initialization code for windows (#3461) files: M Python/pylifecycle.c diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index b9f916bf39f..caa324e3afa 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -264,11 +264,7 @@ get_codec_name(const char *encoding) static char* get_locale_encoding(void) { -#ifdef MS_WINDOWS - char codepage[100]; - PyOS_snprintf(codepage, sizeof(codepage), "cp%d", GetACP()); - return get_codec_name(codepage); -#elif defined(HAVE_LANGINFO_H) && defined(CODESET) +#if defined(HAVE_LANGINFO_H) && defined(CODESET) char* codeset = nl_langinfo(CODESET); if (!codeset || codeset[0] == '\0') { PyErr_SetString(PyExc_ValueError, "CODESET is not set or empty"); From webhook-mailer at python.org Fri Sep 8 17:48:02 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 21:48:02 -0000 Subject: [Python-checkins] bpo-28182: restore backwards compatibility (#3464) Message-ID: https://github.com/python/cpython/commit/0915360b9ef765bf84d4471a8a079f48c49bad68 commit: 0915360b9ef765bf84d4471a8a079f48c49bad68 branch: master author: Christian Heimes committer: GitHub date: 2017-09-08T14:47:58-07:00 summary: bpo-28182: restore backwards compatibility (#3464) b3ad0e5 broke backwards compatibility with OpenSSL < 1.0.2. Signed-off-by: Christian Heimes files: M Modules/_ssl.c diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5b27f2fda2c..5ec31a77365 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -485,18 +485,23 @@ fill_and_set_sslerror(PySSLSocket *sslsock, PyObject *type, int ssl_errno, } switch (verify_code) { +#ifdef X509_V_ERR_HOSTNAME_MISMATCH + /* OpenSSL >= 1.0.2, LibreSSL >= 2.5.3 */ case X509_V_ERR_HOSTNAME_MISMATCH: verify_obj = PyUnicode_FromFormat( "Hostname mismatch, certificate is not valid for '%S'.", sslsock->server_hostname ); break; +#endif +#ifdef X509_V_ERR_IP_ADDRESS_MISMATCH case X509_V_ERR_IP_ADDRESS_MISMATCH: verify_obj = PyUnicode_FromFormat( "IP address mismatch, certificate is not valid for '%S'.", sslsock->server_hostname ); break; +#endif default: verify_str = X509_verify_cert_error_string(verify_code); if (verify_str != NULL) { From webhook-mailer at python.org Fri Sep 8 18:16:18 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 08 Sep 2017 22:16:18 -0000 Subject: [Python-checkins] bpo-31400: Improve SSL error handling on Windows (#3463) Message-ID: https://github.com/python/cpython/commit/e6eb48c10dc389d1d70657593de6a6cb3087d3d1 commit: e6eb48c10dc389d1d70657593de6a6cb3087d3d1 branch: master author: Steve Dower committer: Christian Heimes date: 2017-09-08T15:16:15-07:00 summary: bpo-31400: Improve SSL error handling on Windows (#3463) * bpo-31392: Improve SSL error handling on Windows * Remove unnecessary Windows mention in NEWS files: A Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst new file mode 100644 index 00000000000..1321300dbd4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst @@ -0,0 +1 @@ +Improves SSL error handling to avoid losing error numbers. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5ec31a77365..bd22f16fae7 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -321,6 +321,11 @@ typedef struct { enum py_ssl_server_or_client socket_type; PyObject *owner; /* Python level "owner" passed to servername callback */ PyObject *server_hostname; + int ssl_errno; /* last seen error from SSL */ + int c_errno; /* last seen error from libc */ +#ifdef MS_WINDOWS + int ws_errno; /* last seen error from winsock */ +#endif } PySSLSocket; typedef struct { @@ -340,6 +345,21 @@ static PyTypeObject PySSLSocket_Type; static PyTypeObject PySSLMemoryBIO_Type; static PyTypeObject PySSLSession_Type; +#ifdef MS_WINDOWS +#define _PySSL_UPDATE_ERRNO_IF(cond, sock, retcode) if (cond) { \ + (sock)->ws_errno = WSAGetLastError(); \ + _PySSL_FIX_ERRNO; \ + (sock)->c_errno = errno; \ + (sock)->ssl_errno = SSL_get_error((sock->ssl), (retcode)); \ + } else { sock->ws_errno = 0; sock->c_errno = 0; sock->ssl_errno = 0; } +#else +#define _PySSL_UPDATE_ERRNO_IF(cond, sock, retcode) if (cond) { \ + (sock)->c_errno = errno; \ + (sock)->ssl_errno = SSL_get_error((sock->ssl), (retcode)); \ + } else { (sock)->c_errno = 0; (sock)->ssl_errno = 0; } +#endif +#define _PySSL_UPDATE_ERRNO(sock, retcode) _PySSL_UPDATE_ERRNO_IF(1, (sock), (retcode)) + /*[clinic input] module _ssl class _ssl._SSLContext "PySSLContext *" "&PySSLContext_Type" @@ -580,7 +600,7 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno) e = ERR_peek_last_error(); if (sslsock->ssl != NULL) { - err = SSL_get_error(sslsock->ssl, ret); + err = sslsock->ssl_errno; switch (err) { case SSL_ERROR_ZERO_RETURN: @@ -616,8 +636,16 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno) errstr = "EOF occurred in violation of protocol"; } else if (s && ret == -1) { /* underlying BIO reported an I/O error */ - Py_INCREF(s); ERR_clear_error(); +#ifdef MS_WINDOWS + if (sslsock->ws_errno) + return PyErr_SetFromWindowsErr(sslsock->ws_errno); +#endif + if (sslsock->c_errno) { + errno = sslsock->c_errno; + return PyErr_SetFromErrno(PyExc_OSError); + } + Py_INCREF(s); s->errorhandler(); Py_DECREF(s); return NULL; @@ -696,6 +724,11 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, } self->server_hostname = hostname; } + self->ssl_errno = 0; + self->c_errno = 0; +#ifdef MS_WINDOWS + self->ws_errno = 0; +#endif /* Make sure the SSL error state is initialized */ (void) ERR_get_state(); @@ -792,8 +825,9 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) do { PySSL_BEGIN_ALLOW_THREADS ret = SSL_do_handshake(self->ssl); - err = SSL_get_error(self->ssl, ret); + _PySSL_UPDATE_ERRNO_IF(ret < 1, self, ret); PySSL_END_ALLOW_THREADS + err = self->ssl_errno; if (PyErr_CheckSignals()) goto error; @@ -2064,8 +2098,9 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b) do { PySSL_BEGIN_ALLOW_THREADS len = SSL_write(self->ssl, b->buf, (int)b->len); - err = SSL_get_error(self->ssl, len); + _PySSL_UPDATE_ERRNO_IF(len <= 0, self, len); PySSL_END_ALLOW_THREADS + err = self->ssl_errno; if (PyErr_CheckSignals()) goto error; @@ -2119,6 +2154,7 @@ _ssl__SSLSocket_pending_impl(PySSLSocket *self) PySSL_BEGIN_ALLOW_THREADS count = SSL_pending(self->ssl); + _PySSL_UPDATE_ERRNO_IF(count < 0, self, count); PySSL_END_ALLOW_THREADS if (count < 0) return PySSL_SetError(self, count, __FILE__, __LINE__); @@ -2207,7 +2243,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, do { PySSL_BEGIN_ALLOW_THREADS count = SSL_read(self->ssl, mem, len); - err = SSL_get_error(self->ssl, count); + _PySSL_UPDATE_ERRNO_IF(count <= 0, self, count); PySSL_END_ALLOW_THREADS if (PyErr_CheckSignals()) @@ -2216,6 +2252,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, if (has_timeout) timeout = deadline - _PyTime_GetMonotonicClock(); + err = self->ssl_errno; if (err == SSL_ERROR_WANT_READ) { sockstate = PySSL_select(sock, 0, timeout); } else if (err == SSL_ERROR_WANT_WRITE) { @@ -2272,7 +2309,7 @@ static PyObject * _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) /*[clinic end generated code: output=ca1aa7ed9d25ca42 input=ede2cc1a2ddf0ee4]*/ { - int err, ssl_err, sockstate, nonblocking; + int err, sockstate, nonblocking; int zeros = 0; PySocketSockObject *sock = GET_SOCKET(self); _PyTime_t timeout, deadline = 0; @@ -2311,6 +2348,7 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) if (self->shutdown_seen_zero) SSL_set_read_ahead(self->ssl, 0); err = SSL_shutdown(self->ssl); + _PySSL_UPDATE_ERRNO_IF(err < 0, self, err); PySSL_END_ALLOW_THREADS /* If err == 1, a secure shutdown with SSL_shutdown() is complete */ @@ -2331,16 +2369,16 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) timeout = deadline - _PyTime_GetMonotonicClock(); /* Possibly retry shutdown until timeout or failure */ - ssl_err = SSL_get_error(self->ssl, err); - if (ssl_err == SSL_ERROR_WANT_READ) + _PySSL_UPDATE_ERRNO(self, err); + if (self->ssl_errno == SSL_ERROR_WANT_READ) sockstate = PySSL_select(sock, 0, timeout); - else if (ssl_err == SSL_ERROR_WANT_WRITE) + else if (self->ssl_errno == SSL_ERROR_WANT_WRITE) sockstate = PySSL_select(sock, 1, timeout); else break; if (sockstate == SOCKET_HAS_TIMED_OUT) { - if (ssl_err == SSL_ERROR_WANT_READ) + if (self->ssl_errno == SSL_ERROR_WANT_READ) PyErr_SetString(PySocketModule.timeout_error, "The read operation timed out"); else From webhook-mailer at python.org Fri Sep 8 18:44:36 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 08 Sep 2017 22:44:36 -0000 Subject: [Python-checkins] [3.6] bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (GH-2534) (#3405) Message-ID: https://github.com/python/cpython/commit/3892799668dbf2b123a52780fd1d78f8880fdeb7 commit: 3892799668dbf2b123a52780fd1d78f8880fdeb7 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-08T15:44:33-07:00 summary: [3.6] bpo-30822: Deduplicate ZoneInfoTest classes in test_datetime. (GH-2534) (#3405) (cherry picked from commit 34b54873b51a1ebee2a3c57b7205537b4f33128d) files: M Lib/test/test_datetime.py diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 2d00b56c1cc..d659f369d54 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -32,6 +32,7 @@ elif issubclass(cls, unittest.TestSuite): suit = cls() test_classes.extend(type(test) for test in suit) + test_classes = sorted(set(test_classes), key=lambda cls: cls.__qualname__) for cls in test_classes: cls.__name__ += suffix cls.__qualname__ += suffix From webhook-mailer at python.org Fri Sep 8 19:05:08 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 08 Sep 2017 23:05:08 -0000 Subject: [Python-checkins] bpo-26669: Fix nan arg value error in pytime.c (#3085) Message-ID: https://github.com/python/cpython/commit/829dacce4fca60fc3c3367980e75e21dfcdbe6be commit: 829dacce4fca60fc3c3367980e75e21dfcdbe6be branch: master author: Han Lee committer: Victor Stinner date: 2017-09-08T16:05:05-07:00 summary: bpo-26669: Fix nan arg value error in pytime.c (#3085) * Fix #26669 * Modify NaN check function and error message * Fix pytime.c when arg is nan * fix whitespace files: M Lib/test/test_time.py M Python/pytime.c diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 42323b90ec6..b2aedc3be50 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -485,6 +485,10 @@ def test_localtime_failure(self): self.assertRaises(OSError, time.localtime, invalid_time_t) self.assertRaises(OSError, time.ctime, invalid_time_t) + # Issue #26669: check for localtime() failure + self.assertRaises(ValueError, time.localtime, float("nan")) + self.assertRaises(ValueError, time.ctime, float("nan")) + def test_get_clock_info(self): clocks = ['clock', 'perf_counter', 'process_time', 'time'] if hasattr(time, 'monotonic'): @@ -819,6 +823,11 @@ def c_int_filter(secs): lambda secs: secs * SEC_TO_NS, value_filter=c_int_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(TypeError): + PyTime_FromSeconds(float('nan')) + def test_FromSecondsObject(self): from _testcapi import PyTime_FromSecondsObject @@ -830,6 +839,11 @@ def test_FromSecondsObject(self): PyTime_FromSecondsObject, lambda ns: self.decimal_round(ns * SEC_TO_NS)) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + PyTime_FromSecondsObject(float('nan'), time_rnd) + def test_AsSecondsDouble(self): from _testcapi import PyTime_AsSecondsDouble @@ -843,6 +857,11 @@ def float_converter(ns): float_converter, NS_TO_SEC) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(TypeError): + PyTime_AsSecondsDouble(float('nan')) + def create_decimal_converter(self, denominator): denom = decimal.Decimal(denominator) @@ -948,6 +967,11 @@ def test_object_to_timeval(self): self.create_converter(SEC_TO_US), value_filter=self.time_t_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + pytime_object_to_timeval(float('nan'), time_rnd) + def test_object_to_timespec(self): from _testcapi import pytime_object_to_timespec @@ -959,6 +983,11 @@ def test_object_to_timespec(self): self.create_converter(SEC_TO_NS), value_filter=self.time_t_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + pytime_object_to_timespec(float('nan'), time_rnd) + if __name__ == "__main__": unittest.main() diff --git a/Python/pytime.c b/Python/pytime.c index f3c913226ce..7edb534596e 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -133,6 +133,11 @@ _PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator, if (PyFloat_Check(obj)) { double d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + *numerator = 0; + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } return _PyTime_DoubleToDenominator(d, sec, numerator, denominator, round); } @@ -154,6 +159,11 @@ _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) volatile double d; d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } + d = _PyTime_Round(d, round); (void)modf(d, &intpart); @@ -301,6 +311,10 @@ _PyTime_FromObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round, if (PyFloat_Check(obj)) { double d; d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } return _PyTime_FromFloatObject(t, d, round, unit_to_ns); } else { From lp_benchmark_robot at intel.com Fri Sep 8 19:55:41 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 8 Sep 2017 16:55:41 -0700 Subject: [Python-checkins] [2 down, 1 up, 62 flat] Results for Python (master branch) 2017-09-08 Message-ID: <92213a0c-39ac-4c0e-b4c3-0e8e0c7f1e16@orsmsx156.amr.corp.intel.com> Results for project python/master, build date: 2017-09-08 03:04:52-07:00. - commit: e3b2b4b - previous commit: 1f06a68 - revision date: 2017-09-08 09:58:51+03:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.140% | +0.608% | +3.663% | +8.512% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.991% | -1.498% | +19.322% | +14.032% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.939% | -0.872% | +20.773% | +13.627% | +-----+------------------------+--------+------------+------------+------------+ | :-( | call_method_unknown| 1.204% | -3.990% | +18.941% | +12.556% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 1.922% | -1.219% | -0.099% | +17.937% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.093% | -2.430% | +10.230% | +11.357% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.540% | -1.167% | +6.252% | +10.422% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.511% | -0.518% | +3.499% | +5.979% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 2.188% | +1.410% | +10.231% | +16.394% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 1.448% | +2.395% | +10.825% | +11.055% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 0.854% | +0.799% | +3.958% | +7.831% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.376% | -1.209% | +5.635% | +3.493% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.554% | +0.527% | +4.030% | +4.352% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.477% | -1.179% | +7.453% | +12.581% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.070% | -1.491% | +5.518% | +9.357% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.829% | +0.827% | +6.786% | +9.840% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.847% | +0.635% | +9.639% | +10.825% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.706% | +1.489% | +8.433% | +9.256% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.421% | +0.406% | +4.118% | +9.557% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 4.938% | +4.210% | +1.947% | +12.827% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.399% | -2.359% | +6.166% | +9.346% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.882% | +1.652% | +47.270% | +11.767% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.676% | -1.345% | +7.196% | +10.924% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.584% | -0.614% | +18.090% | +9.461% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 2.327% | +1.429% | +7.024% | +11.513% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.178% | +1.013% | +4.902% | +4.417% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.411% | +1.737% | -1.147% | +2.839% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.782% | +0.518% | +2.980% | +5.079% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pathlib| 1.344% | +4.449% | +7.073% | +6.199% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.008% | +0.401% | +1.242% | +22.954% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_dict| 0.380% | -2.428% | +0.618% | +26.456% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.629% | -0.967% | +7.413% | +19.296% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 5.583% | -1.055% | +11.375% | +9.367% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.350% | +0.065% | +0.203% | +9.772% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.122% | -0.060% | +9.231% | +2.273% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.094% | -0.465% | +1.181% | +2.138% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.655% | -0.926% | +9.237% | +13.815% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.967% | -2.141% | -12.117% | +13.510% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.311% | +0.502% | -1.555% | +12.405% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.511% | -1.521% | -4.122% | +4.457% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.539% | +0.764% | +11.633% | +0.600% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.369% | +0.853% | +8.378% | +14.813% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.533% | -1.270% | +0.971% | +1.084% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.668% | +1.802% | +27.884% | +7.708% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.116% | -0.666% | +4.896% | +4.706% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.585% | -0.580% | +14.674% | +8.488% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.912% | -1.650% | +1.272% | -2.071% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 1.782% | -2.755% | +5.066% | +2.074% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.024% | +0.468% | +5.162% | +7.008% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.964% | +0.524% | +5.719% | +4.121% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.119% | -0.421% | +2.729% | +8.937% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.140% | +0.433% | +11.863% | +8.937% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.721% | -0.594% | +9.218% | +7.338% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 2.888% | +1.023% | +11.600% | +9.411% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.422% | -0.608% | +9.947% | +12.360% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.530% | +2.175% | +25.142% | +9.207% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.391% | -0.251% | +5.941% | +4.846% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 5.089% | -0.655% | +2.008% | -1.503% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.279% | -1.094% | +6.701% | +22.067% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.456% | +0.055% | -1.754% | +18.262% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.849% | -0.787% | +7.052% | +6.682% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.818% | +0.241% | +6.736% | +7.705% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.076% | +0.233% | +2.917% | +5.470% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.976% | -0.587% | -6.196% | +11.514% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.121% | -0.616% | +7.247% | +8.389% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/2-down-1-up-62-flat-results-for-python-master-branch-2017-09-08 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Sat Sep 9 00:53:07 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 09 Sep 2017 04:53:07 -0000 Subject: [Python-checkins] [3.6] bpo-26669: Fix nan arg value error in pytime.c (GH-3085) (GH-3467) Message-ID: https://github.com/python/cpython/commit/a4baf1c543bca261c27e98ba296e42665f3cb872 commit: a4baf1c543bca261c27e98ba296e42665f3cb872 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-08T21:53:04-07:00 summary: [3.6] bpo-26669: Fix nan arg value error in pytime.c (GH-3085) (GH-3467) * Modify NaN check function and error message * Fix pytime.c when arg is nan * fix whitespace (cherry picked from commit 829dacce4fca60fc3c3367980e75e21dfcdbe6be) files: M Lib/test/test_time.py M Python/pytime.c diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 810ec37b111..7093fc6a2ec 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -489,6 +489,10 @@ def test_localtime_failure(self): self.assertRaises(OSError, time.localtime, invalid_time_t) self.assertRaises(OSError, time.ctime, invalid_time_t) + # Issue #26669: check for localtime() failure + self.assertRaises(ValueError, time.localtime, float("nan")) + self.assertRaises(ValueError, time.ctime, float("nan")) + def test_get_clock_info(self): clocks = ['clock', 'perf_counter', 'process_time', 'time'] if hasattr(time, 'monotonic'): @@ -823,6 +827,11 @@ def c_int_filter(secs): lambda secs: secs * SEC_TO_NS, value_filter=c_int_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(TypeError): + PyTime_FromSeconds(float('nan')) + def test_FromSecondsObject(self): from _testcapi import PyTime_FromSecondsObject @@ -834,6 +843,11 @@ def test_FromSecondsObject(self): PyTime_FromSecondsObject, lambda ns: self.decimal_round(ns * SEC_TO_NS)) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + PyTime_FromSecondsObject(float('nan'), time_rnd) + def test_AsSecondsDouble(self): from _testcapi import PyTime_AsSecondsDouble @@ -847,6 +861,11 @@ def float_converter(ns): float_converter, NS_TO_SEC) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(TypeError): + PyTime_AsSecondsDouble(float('nan')) + def create_decimal_converter(self, denominator): denom = decimal.Decimal(denominator) @@ -952,6 +971,11 @@ def test_object_to_timeval(self): self.create_converter(SEC_TO_US), value_filter=self.time_t_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + pytime_object_to_timeval(float('nan'), time_rnd) + def test_object_to_timespec(self): from _testcapi import pytime_object_to_timespec @@ -963,6 +987,11 @@ def test_object_to_timespec(self): self.create_converter(SEC_TO_NS), value_filter=self.time_t_filter) + # test nan + for time_rnd, _ in ROUNDING_MODES: + with self.assertRaises(ValueError): + pytime_object_to_timespec(float('nan'), time_rnd) + if __name__ == "__main__": unittest.main() diff --git a/Python/pytime.c b/Python/pytime.c index 387657af2cf..b416eff6b29 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -133,6 +133,11 @@ _PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator, if (PyFloat_Check(obj)) { double d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + *numerator = 0; + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } return _PyTime_DoubleToDenominator(d, sec, numerator, denominator, round); } @@ -154,6 +159,11 @@ _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) volatile double d; d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } + d = _PyTime_Round(d, round); (void)modf(d, &intpart); @@ -301,6 +311,10 @@ _PyTime_FromObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round, if (PyFloat_Check(obj)) { double d; d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } return _PyTime_FromFloatObject(t, d, round, unit_to_ns); } else { From webhook-mailer at python.org Sat Sep 9 03:30:18 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Sat, 09 Sep 2017 07:30:18 -0000 Subject: [Python-checkins] bpo-29639: change test.support.HOST to "localhost" Message-ID: https://github.com/python/cpython/commit/efb1d0a3c001a6153211063ba439b9847aa03509 commit: efb1d0a3c001a6153211063ba439b9847aa03509 branch: master author: Gregory P. Smith committer: GitHub date: 2017-09-09T00:30:15-07:00 summary: bpo-29639: change test.support.HOST to "localhost" test.support.HOST should be "localhost" as it was in the past. See the bpo-29639. Tests that need the IP address should use HOSTv4 (added) or the existing HOSTv6 constant. This changes the definition and fixes tests that needed updating to deal with HOST being the hostname rather than the hardcoded IP address. This is only the first step in addressing https://bugs.python.org/issue29639. files: A Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst M Lib/asyncore.py M Lib/test/support/__init__.py M Lib/test/test_smtpd.py M Lib/test/test_smtplib.py M Lib/test/test_socket.py diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 03d16838b73..828f4d4fe78 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -287,7 +287,6 @@ def create_socket(self, family=socket.AF_INET, type=socket.SOCK_STREAM): def set_socket(self, sock, map=None): self.socket = sock -## self.__dict__['socket'] = sock self._fileno = sock.fileno() self.add_channel(map) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index bfceba151a1..f57b2517792 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -601,9 +601,8 @@ def wrapper(*args, **kw): return decorator -# Don't use "localhost", since resolving it uses the DNS under recent -# Windows versions (see issue #18792). -HOST = "127.0.0.1" +HOST = "localhost" +HOSTv4 = "127.0.0.1" HOSTv6 = "::1" diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py index 3eebe948ad8..a9f7d5a3b8b 100644 --- a/Lib/test/test_smtpd.py +++ b/Lib/test/test_smtpd.py @@ -170,11 +170,11 @@ def tearDown(self): @unittest.skipUnless(support.IPV6_ENABLED, "IPv6 not enabled") def test_socket_uses_IPv6(self): - server = smtpd.SMTPServer((support.HOSTv6, 0), (support.HOST, 0)) + server = smtpd.SMTPServer((support.HOSTv6, 0), (support.HOSTv4, 0)) self.assertEqual(server.socket.family, socket.AF_INET6) def test_socket_uses_IPv4(self): - server = smtpd.SMTPServer((support.HOST, 0), (support.HOSTv6, 0)) + server = smtpd.SMTPServer((support.HOSTv4, 0), (support.HOSTv6, 0)) self.assertEqual(server.socket.family, socket.AF_INET) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 42f4266b249..4c9b7d367c8 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -19,10 +19,9 @@ import unittest from test import support, mock_socket +from test.support import HOST, HOSTv4, HOSTv6 -HOST = support.HOST - if sys.platform == 'darwin': # select.poll returns a select.POLLHUP at the end of the tests # on darwin, so just ignore it @@ -208,8 +207,8 @@ def setUp(self): # Pick a random unused port by passing 0 for the port number self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1), decode_data=True) - # Keep a note of what port was assigned - self.port = self.serv.socket.getsockname()[1] + # Keep a note of what server host and port were assigned + self.host, self.port = self.serv.socket.getsockname()[:2] serv_args = (self.serv, self.serv_evt, self.client_evt) self.thread = threading.Thread(target=debugging_server, args=serv_args) self.thread.start() @@ -231,6 +230,11 @@ def tearDown(self): smtpd.DEBUGSTREAM.close() smtpd.DEBUGSTREAM = self.old_DEBUGSTREAM + def get_output_without_xpeer(self): + test_output = self.output.getvalue() + return re.sub(r'(.*?)^X-Peer:\s*\S+\n(.*)', r'\1\2', + test_output, flags=re.MULTILINE|re.DOTALL) + def testBasic(self): # connect smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) @@ -238,16 +242,16 @@ def testBasic(self): def testSourceAddress(self): # connect - port = support.find_unused_port() + src_port = support.find_unused_port() try: - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', - timeout=3, source_address=('127.0.0.1', port)) - self.assertEqual(smtp.source_address, ('127.0.0.1', port)) + smtp = smtplib.SMTP(self.host, self.port, local_hostname='localhost', + timeout=3, source_address=(self.host, src_port)) + self.assertEqual(smtp.source_address, (self.host, src_port)) self.assertEqual(smtp.local_hostname, 'localhost') smtp.quit() except OSError as e: if e.errno == errno.EADDRINUSE: - self.skipTest("couldn't bind to port %d" % port) + self.skipTest("couldn't bind to source port %d" % src_port) raise def testNOOP(self): @@ -374,10 +378,14 @@ def testSendMessage(self): self.client_evt.set() self.serv_evt.wait() self.output.flush() - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds as figuring out + # exactly what IP address format is put there is not easy (and + # irrelevant to our test). Typically 127.0.0.1 or ::1, but it is + # not always the same as socket.gethostbyname(HOST). :( + test_output = self.get_output_without_xpeer() + del m['X-Peer'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) def testSendMessageWithAddresses(self): m = email.mime.text.MIMEText('A test message') @@ -397,12 +405,13 @@ def testSendMessageWithAddresses(self): self.client_evt.set() self.serv_evt.wait() self.output.flush() - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds. + test_output = self.get_output_without_xpeer() + del m['X-Peer'] # The Bcc header should not be transmitted. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) debugout = smtpd.DEBUGSTREAM.getvalue() sender = re.compile("^sender: foo at bar.com$", re.MULTILINE) self.assertRegex(debugout, sender) @@ -426,10 +435,11 @@ def testSendMessageWithSomeAddresses(self): self.client_evt.set() self.serv_evt.wait() self.output.flush() - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds. + test_output = self.get_output_without_xpeer() + del m['X-Peer'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) debugout = smtpd.DEBUGSTREAM.getvalue() sender = re.compile("^sender: foo at bar.com$", re.MULTILINE) self.assertRegex(debugout, sender) @@ -452,10 +462,11 @@ def testSendMessageWithSpecifiedAddresses(self): self.client_evt.set() self.serv_evt.wait() self.output.flush() - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds. + test_output = self.get_output_without_xpeer() + del m['X-Peer'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) debugout = smtpd.DEBUGSTREAM.getvalue() sender = re.compile("^sender: joe at example.com$", re.MULTILINE) self.assertRegex(debugout, sender) @@ -481,10 +492,11 @@ def testSendMessageWithMultipleFrom(self): self.client_evt.set() self.serv_evt.wait() self.output.flush() - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds. + test_output = self.get_output_without_xpeer() + del m['X-Peer'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) debugout = smtpd.DEBUGSTREAM.getvalue() sender = re.compile("^sender: the_rescuers at Rescue-Aid-Society.com$", re.MULTILINE) self.assertRegex(debugout, sender) @@ -515,10 +527,11 @@ def testSendMessageResent(self): # The Resent-Bcc headers are deleted before serialization. del m['Bcc'] del m['Resent-Bcc'] - # Add the X-Peer header that DebuggingServer adds - m['X-Peer'] = socket.gethostbyname('localhost') + # Remove the X-Peer header that DebuggingServer adds. + test_output = self.get_output_without_xpeer() + del m['X-Peer'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) - self.assertEqual(self.output.getvalue(), mexpect) + self.assertEqual(test_output, mexpect) debugout = smtpd.DEBUGSTREAM.getvalue() sender = re.compile("^sender: holy at grail.net$", re.MULTILINE) self.assertRegex(debugout, sender) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 27d9d4944e1..05d8761241e 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -864,12 +864,12 @@ def testHostnameRes(self): self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) def test_host_resolution(self): - for addr in [support.HOST, '10.0.0.1', '255.255.255.255']: + for addr in [support.HOSTv4, '10.0.0.1', '255.255.255.255']: self.assertEqual(socket.gethostbyname(addr), addr) # we don't test support.HOSTv6 because there's a chance it doesn't have # a matching name entry (e.g. 'ip6-localhost') - for host in [support.HOST]: + for host in [support.HOSTv4]: self.assertIn(host, socket.gethostbyaddr(host)[2]) def test_host_resolution_bad_address(self): diff --git a/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst b/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst new file mode 100644 index 00000000000..7f49eb4bab4 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst @@ -0,0 +1,2 @@ +test.support.HOST is now "localhost", a new HOSTv4 constant has been added +for your ``127.0.0.1`` needs, similar to the existing HOSTv6 constant. From solipsis at pitrou.net Sat Sep 9 05:22:06 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 09 Sep 2017 09:22:06 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=7 Message-ID: <20170909092206.90400.9FF511564F7BB0CF@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-2, 2, 0] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogtwuYm4', '--timeout', '7200'] From webhook-mailer at python.org Sat Sep 9 09:13:10 2017 From: webhook-mailer at python.org (Steve Dower) Date: Sat, 09 Sep 2017 13:13:10 -0000 Subject: [Python-checkins] bpo-31392: Update SSL build for 1.1.0 (#3448) Message-ID: https://github.com/python/cpython/commit/b84bcc48ae31c385fe480c08c05d95212ef7fcdc commit: b84bcc48ae31c385fe480c08c05d95212ef7fcdc branch: master author: Steve Dower committer: GitHub date: 2017-09-09T06:13:06-07:00 summary: bpo-31392: Update SSL build for 1.1.0 (#3448) files: A Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst D Tools/ssl/sslspeed.vcxproj M PCbuild/get_externals.bat M PCbuild/openssl.props M PCbuild/openssl.vcxproj M PCbuild/prepare_ssl.bat M PCbuild/python.props M Tools/msi/lib/lib_files.wxs M Tools/msi/make_zip.py M Tools/msi/msi.props M Tools/nuget/pythondaily.symbols.nuspec diff --git a/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst b/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst new file mode 100644 index 00000000000..cc1cb787e55 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst @@ -0,0 +1 @@ +Update Windows build to use OpenSSL 1.1.0f diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index 0bbd2ad2329..1830726919d 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -49,7 +49,7 @@ echo.Fetching external libraries... set libraries= set libraries=%libraries% bzip2-1.0.6 -if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.0.2k +if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.0f set libraries=%libraries% sqlite-3.14.2.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.6.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.6.0 @@ -72,7 +72,7 @@ for %%e in (%libraries%) do ( echo.Fetching external binaries... set binaries= -if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.0.2k +if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.0f if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.6.0 if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06 diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props index 9ebe8a645f6..257cc857d0e 100644 --- a/PCbuild/openssl.props +++ b/PCbuild/openssl.props @@ -6,14 +6,18 @@ $(opensslOutDir);%(AdditionalLibraryDirectories) - ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) + ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies) + + <_DLLSuffix>-1_1 + <_DLLSuffix Condition="$(Platform) == 'x64'">$(_DLLSuffix)-x64 + - <_SSLDLL Include="$(opensslOutDir)\libeay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" /> diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 2d42b126818..1a36d08ec06 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -47,52 +47,68 @@ 64 x86 amd64 + VC-WIN32 + VC-WIN64A true - - - - - $(opensslDir)\tmp$(Bitness)dll - $(opensslDir)\out$(Bitness)dll - ms\ntdll$(Bitness).mak - LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl + $(opensslOutDir) setlocal -set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(opensslDir.TrimEnd(`\`))" if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" -if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" -if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" -$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) -nmake -f $(MakeFile) $(NMakeOptions) headers lib -copy /y LICENSE "$(opensslOutDir)\LICENSE" +cd /D "$(IntDir.TrimEnd('\'))" +$(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm +nmake - - + + + $(opensslDir)\ms\uplink.c + ((h = GetModuleHandle(NULL)) == NULL) + ((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/) + + + + <_Original>$([System.IO.File]::ReadAllText($(Uplink))) + <_Patched>$(_Original.Replace($(BeforePatch), $(AfterPatch))) + false + true + + + + - + - - + <_Built Include="$(opensslDir)\LICENSE" /> + <_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" /> + <_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" /> + <_AppLink Include="$(opensslDir)\ms\applink.c" /> + <_Include Include="$(opensslDir)\Include\openssl\*.h" /> + <_Include Include="$(IntDir)\include\openssl\*.h" /> - + + + + - + diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat index 1df5b8d9f52..5a3de2d8ac8 100644 --- a/PCbuild/prepare_ssl.bat +++ b/PCbuild/prepare_ssl.bat @@ -23,6 +23,8 @@ setlocal if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) +set OUT= +set SRC= set ORG_SETTING= :CheckOpts @@ -30,12 +32,19 @@ if "%~1"=="-h" shift & goto Usage if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts +if "%~1"=="-i" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--in" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="-o" (set OUT=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--out" (set OUT=$~2) && shift && shift && goto CheckOpts if "%~1"=="" goto Build echo Unrecognized option: %1 goto Usage :Build +if not defined SRC (echo --in directory is required & exit /b 1) +if not defined OUT (echo --out directory is required & exit /b 1) + call "%PCBUILD%find_msbuild.bat" %MSBUILD% if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) @@ -51,3 +60,4 @@ if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exi if errorlevel 1 exit /b %MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 if errorlevel 1 exit /b + diff --git a/PCbuild/python.props b/PCbuild/python.props index 3bfbb77ab24..ebb16315e1a 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -47,8 +47,8 @@ $(ExternalsDir)sqlite-3.14.2.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.2.2\ - $(ExternalsDir)openssl-1.0.2k\ - $(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\ + $(ExternalsDir)openssl-1.1.0f\ + $(ExternalsDir)openssl-bin-1.1.0f\$(ArchName)\ $(opensslOutDir)include $(ExternalsDir)\nasm-2.11.06\ $(ExternalsDir)\zlib-1.2.11\ diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs index 0b8a3ee89d9..fa0da3ab43f 100644 --- a/Tools/msi/lib/lib_files.wxs +++ b/Tools/msi/lib/lib_files.wxs @@ -14,11 +14,11 @@ - - + + - - + + @@ -36,11 +36,11 @@ - - + + - - + + diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py index 8e35bdc5679..58f3b15ef85 100644 --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -47,8 +47,6 @@ EXCLUDE_FILE_FROM_LIBS = { 'liblzma', - 'ssleay', - 'libeay', 'python3stub', } diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 60abba1f7be..2318d484d11 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -92,10 +92,10 @@ $(DefineConstants);CRTRedist=$(CRTRedist); - $(DefineConstants);Suffix32=-32; + $(DefineConstants);Suffix32=-32;ssltag=-1_1; - $(DefineConstants);Suffix32=; + $(DefineConstants);Suffix32=;ssltag=-1_1-x64; diff --git a/Tools/nuget/pythondaily.symbols.nuspec b/Tools/nuget/pythondaily.symbols.nuspec index 77792b8c24d..b89717a1afe 100644 --- a/Tools/nuget/pythondaily.symbols.nuspec +++ b/Tools/nuget/pythondaily.symbols.nuspec @@ -18,7 +18,7 @@ - - + + diff --git a/Tools/ssl/sslspeed.vcxproj b/Tools/ssl/sslspeed.vcxproj deleted file mode 100644 index 8ec410681ef..00000000000 --- a/Tools/ssl/sslspeed.vcxproj +++ /dev/null @@ -1,70 +0,0 @@ -? - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {F068BCCF-C0D6-478D-A2C5-26BA3237C992} - sslspeed - - - - - - - - $(OutDir) - $(MSBuildProjectDirectory)\$(ArchName)\ - $(MSBuildProjectDirectory)\$(ArchName)\obj\ - Application - MultiByte - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - $(opensslIncDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;crypt32.lib;libeay$(PyDebugExt).lib;ssleay$(PyDebugExt).lib;%(AdditionalDependencies) - $(OriginalOutDir);%(AdditionalLibraryDirectories) - Console - - - - - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - - - \ No newline at end of file From webhook-mailer at python.org Sat Sep 9 11:22:14 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Sat, 09 Sep 2017 15:22:14 -0000 Subject: [Python-checkins] [3.6] bpo-31400: Improve SSL error handling on Windows (GH-3463) (#3466) Message-ID: https://github.com/python/cpython/commit/16f16dbd0ed02cd1a7b270eb6dd80d9bd179902e commit: 16f16dbd0ed02cd1a7b270eb6dd80d9bd179902e branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-09T08:22:11-07:00 summary: [3.6] bpo-31400: Improve SSL error handling on Windows (GH-3463) (#3466) * bpo-31392: Improve SSL error handling on Windows * Remove unnecessary Windows mention in NEWS. (cherry picked from commit e6eb48c10dc389d1d70657593de6a6cb3087d3d1) files: A Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst M Modules/_ssl.c diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst new file mode 100644 index 00000000000..1321300dbd4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst @@ -0,0 +1 @@ +Improves SSL error handling to avoid losing error numbers. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index a28a6e00660..4a656a145ab 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -302,6 +302,11 @@ typedef struct { enum py_ssl_server_or_client socket_type; PyObject *owner; /* Python level "owner" passed to servername callback */ PyObject *server_hostname; + int ssl_errno; /* last seen error from SSL */ + int c_errno; /* last seen error from libc */ +#ifdef MS_WINDOWS + int ws_errno; /* last seen error from winsock */ +#endif } PySSLSocket; typedef struct { @@ -321,6 +326,20 @@ static PyTypeObject PySSLSocket_Type; static PyTypeObject PySSLMemoryBIO_Type; static PyTypeObject PySSLSession_Type; +#ifdef MS_WINDOWS +#define _PySSL_UPDATE_ERRNO_IF(cond, sock, retcode) if (cond) { \ + (sock)->ws_errno = WSAGetLastError(); \ + (sock)->c_errno = errno; \ + (sock)->ssl_errno = SSL_get_error((sock->ssl), (retcode)); \ + } else { sock->ws_errno = 0; sock->c_errno = 0; sock->ssl_errno = 0; } +#else +#define _PySSL_UPDATE_ERRNO_IF(cond, sock, retcode) if (cond) { \ + (sock)->c_errno = errno; \ + (sock)->ssl_errno = SSL_get_error((sock->ssl), (retcode)); \ + } else { (sock)->c_errno = 0; (sock)->ssl_errno = 0; } +#endif +#define _PySSL_UPDATE_ERRNO(sock, retcode) _PySSL_UPDATE_ERRNO_IF(1, (sock), (retcode)) + /*[clinic input] module _ssl class _ssl._SSLContext "PySSLContext *" "&PySSLContext_Type" @@ -494,7 +513,7 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) e = ERR_peek_last_error(); if (obj->ssl != NULL) { - err = SSL_get_error(obj->ssl, ret); + err = obj->ssl_errno; switch (err) { case SSL_ERROR_ZERO_RETURN: @@ -530,8 +549,16 @@ PySSL_SetError(PySSLSocket *obj, int ret, const char *filename, int lineno) errstr = "EOF occurred in violation of protocol"; } else if (s && ret == -1) { /* underlying BIO reported an I/O error */ - Py_INCREF(s); ERR_clear_error(); +#ifdef MS_WINDOWS + if (obj->ws_errno) + return PyErr_SetFromWindowsErr(obj->ws_errno); +#endif + if (obj->c_errno) { + errno = obj->c_errno; + return PyErr_SetFromErrno(PyExc_OSError); + } + Py_INCREF(s); s->errorhandler(); Py_DECREF(s); return NULL; @@ -609,6 +636,11 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, } self->server_hostname = hostname; } + self->ssl_errno = 0; + self->c_errno = 0; +#ifdef MS_WINDOWS + self->ws_errno = 0; +#endif /* Make sure the SSL error state is initialized */ (void) ERR_get_state(); @@ -706,8 +738,9 @@ _ssl__SSLSocket_do_handshake_impl(PySSLSocket *self) do { PySSL_BEGIN_ALLOW_THREADS ret = SSL_do_handshake(self->ssl); - err = SSL_get_error(self->ssl, ret); + _PySSL_UPDATE_ERRNO_IF(ret < 1, self, ret); PySSL_END_ALLOW_THREADS + err = self->ssl_errno; if (PyErr_CheckSignals()) goto error; @@ -2003,8 +2036,9 @@ _ssl__SSLSocket_write_impl(PySSLSocket *self, Py_buffer *b) do { PySSL_BEGIN_ALLOW_THREADS len = SSL_write(self->ssl, b->buf, (int)b->len); - err = SSL_get_error(self->ssl, len); + _PySSL_UPDATE_ERRNO_IF(len <= 0, self, len); PySSL_END_ALLOW_THREADS + err = self->ssl_errno; if (PyErr_CheckSignals()) goto error; @@ -2058,6 +2092,7 @@ _ssl__SSLSocket_pending_impl(PySSLSocket *self) PySSL_BEGIN_ALLOW_THREADS count = SSL_pending(self->ssl); + _PySSL_UPDATE_ERRNO_IF(count < 0, self, count); PySSL_END_ALLOW_THREADS if (count < 0) return PySSL_SetError(self, count, __FILE__, __LINE__); @@ -2146,7 +2181,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, do { PySSL_BEGIN_ALLOW_THREADS count = SSL_read(self->ssl, mem, len); - err = SSL_get_error(self->ssl, count); + _PySSL_UPDATE_ERRNO_IF(count <= 0, self, count); PySSL_END_ALLOW_THREADS if (PyErr_CheckSignals()) @@ -2155,6 +2190,7 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, if (has_timeout) timeout = deadline - _PyTime_GetMonotonicClock(); + err = self->ssl_errno; if (err == SSL_ERROR_WANT_READ) { sockstate = PySSL_select(sock, 0, timeout); } else if (err == SSL_ERROR_WANT_WRITE) { @@ -2211,7 +2247,7 @@ static PyObject * _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) /*[clinic end generated code: output=ca1aa7ed9d25ca42 input=ede2cc1a2ddf0ee4]*/ { - int err, ssl_err, sockstate, nonblocking; + int err, sockstate, nonblocking; int zeros = 0; PySocketSockObject *sock = GET_SOCKET(self); _PyTime_t timeout, deadline = 0; @@ -2250,6 +2286,7 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) if (self->shutdown_seen_zero) SSL_set_read_ahead(self->ssl, 0); err = SSL_shutdown(self->ssl); + _PySSL_UPDATE_ERRNO_IF(err < 0, self, err); PySSL_END_ALLOW_THREADS /* If err == 1, a secure shutdown with SSL_shutdown() is complete */ @@ -2270,16 +2307,16 @@ _ssl__SSLSocket_shutdown_impl(PySSLSocket *self) timeout = deadline - _PyTime_GetMonotonicClock(); /* Possibly retry shutdown until timeout or failure */ - ssl_err = SSL_get_error(self->ssl, err); - if (ssl_err == SSL_ERROR_WANT_READ) + _PySSL_UPDATE_ERRNO(self, err); + if (self->ssl_errno == SSL_ERROR_WANT_READ) sockstate = PySSL_select(sock, 0, timeout); - else if (ssl_err == SSL_ERROR_WANT_WRITE) + else if (self->ssl_errno == SSL_ERROR_WANT_WRITE) sockstate = PySSL_select(sock, 1, timeout); else break; if (sockstate == SOCKET_HAS_TIMED_OUT) { - if (ssl_err == SSL_ERROR_WANT_READ) + if (self->ssl_errno == SSL_ERROR_WANT_READ) PyErr_SetString(PySocketModule.timeout_error, "The read operation timed out"); else From webhook-mailer at python.org Sat Sep 9 12:39:38 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 09 Sep 2017 16:39:38 -0000 Subject: [Python-checkins] Make `json.dumps()` example to be PEP-8 compliant. (GH-3472) Message-ID: https://github.com/python/cpython/commit/a7fbad96c8631070c1db137635d5bdd5e2aaac50 commit: a7fbad96c8631070c1db137635d5bdd5e2aaac50 branch: master author: Sergey Fedoseev committer: Mariatta date: 2017-09-09T09:39:36-07:00 summary: Make `json.dumps()` example to be PEP-8 compliant. (GH-3472) files: M Doc/library/json.rst diff --git a/Doc/library/json.rst b/Doc/library/json.rst index fdbdcb169fa..829218d5584 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -43,7 +43,7 @@ Encoding basic Python object hierarchies:: Compact encoding:: >>> import json - >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':')) + >>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: From webhook-mailer at python.org Sat Sep 9 13:26:25 2017 From: webhook-mailer at python.org (Stefan Krah) Date: Sat, 09 Sep 2017 17:26:25 -0000 Subject: [Python-checkins] bpo-31403: Remove WITHOUT_THREADS from _decimal. (#3474) Message-ID: https://github.com/python/cpython/commit/c0c29dff7940b7e7ecc1dd051080c5d5f9e42ba8 commit: c0c29dff7940b7e7ecc1dd051080c5d5f9e42ba8 branch: master author: Stefan Krah committer: GitHub date: 2017-09-09T19:26:22+02:00 summary: bpo-31403: Remove WITHOUT_THREADS from _decimal. (#3474) files: M Modules/_decimal/_decimal.c M Modules/_decimal/tests/runall-memorydebugger.sh diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index a6e365d4536..e3c1a7997fa 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -80,9 +80,7 @@ typedef struct { PyObject *traps; PyObject *flags; int capitals; -#ifndef WITHOUT_THREADS PyThreadState *tstate; -#endif } PyDecContextObject; typedef struct { @@ -124,15 +122,10 @@ incr_false(void) } -#ifdef WITHOUT_THREADS -/* Default module context */ -static PyObject *module_context = NULL; -#else /* Key for thread state dictionary */ static PyObject *tls_context_key = NULL; /* Invariant: NULL or the most recently accessed thread local context */ static PyDecContextObject *cached_context = NULL; -#endif /* Template for creating new thread contexts, calling Context() without * arguments and initializing the module_context on first access. */ @@ -1219,9 +1212,7 @@ context_new(PyTypeObject *type, PyObject *args UNUSED, PyObject *kwds UNUSED) SdFlagAddr(self->flags) = &ctx->status; CtxCaps(self) = 1; -#ifndef WITHOUT_THREADS self->tstate = NULL; -#endif return (PyObject *)self; } @@ -1229,11 +1220,10 @@ context_new(PyTypeObject *type, PyObject *args UNUSED, PyObject *kwds UNUSED) static void context_dealloc(PyDecContextObject *self) { -#ifndef WITHOUT_THREADS if (self == cached_context) { cached_context = NULL; } -#endif + Py_XDECREF(self->traps); Py_XDECREF(self->flags); Py_TYPE(self)->tp_free(self); @@ -1501,76 +1491,6 @@ static PyGetSetDef context_getsets [] = /* Global, thread local and temporary contexts */ /******************************************************************************/ -#ifdef WITHOUT_THREADS -/* Return borrowed reference to the current context. When compiled - * without threads, this is always the module context. */ -static int module_context_set = 0; -static PyObject * -current_context(void) -{ - /* In decimal.py, the module context is automatically initialized - * from the DefaultContext when it is first accessed. This - * complicates the code and has a speed penalty of 1-2%. */ - if (module_context_set) { - return module_context; - } - - *CTX(module_context) = *CTX(default_context_template); - CTX(module_context)->status = 0; - CTX(module_context)->newtrap = 0; - CtxCaps(module_context) = CtxCaps(default_context_template); - - module_context_set = 1; - return module_context; -} - -/* ctxobj := borrowed reference to the current context */ -#define CURRENT_CONTEXT(ctxobj) \ - ctxobj = current_context() - -/* ctx := pointer to the mpd_context_t struct of the current context */ -#define CURRENT_CONTEXT_ADDR(ctx) \ - ctx = CTX(current_context()) - -/* Return a new reference to the current context */ -static PyObject * -PyDec_GetCurrentContext(PyObject *self UNUSED, PyObject *args UNUSED) -{ - PyObject *context; - - CURRENT_CONTEXT(context); - - Py_INCREF(context); - return context; -} - -/* Set the module context to a new context, decrement old reference */ -static PyObject * -PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v) -{ - CONTEXT_CHECK(v); - - /* If the new context is one of the templates, make a copy. - * This is the current behavior of decimal.py. */ - if (v == default_context_template || - v == basic_context_template || - v == extended_context_template) { - v = context_copy(v, NULL); - if (v == NULL) { - return NULL; - } - CTX(v)->status = 0; - } - else { - Py_INCREF(v); - } - - Py_XDECREF(module_context); - module_context = v; - module_context_set = 1; - Py_RETURN_NONE; -} -#else /* * Thread local storage currently has a speed penalty of about 4%. * All functions that map Python's arithmetic operators to mpdecimal @@ -1713,7 +1633,6 @@ PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v) Py_DECREF(v); Py_RETURN_NONE; } -#endif /* Context manager object for the 'with' statement. The manager * owns one reference to the global (outer) context and one @@ -5840,17 +5759,9 @@ PyInit__decimal(void) CHECK_INT(PyModule_AddObject(m, "DefaultContext", default_context_template)); -#ifdef WITHOUT_THREADS - /* Init module context */ - ASSIGN_PTR(module_context, - PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); - Py_INCREF(Py_False); - CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_False)); -#else ASSIGN_PTR(tls_context_key, PyUnicode_FromString("___DECIMAL_CTX__")); Py_INCREF(Py_True); CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_True)); -#endif /* Init basic context template */ ASSIGN_PTR(basic_context_template, @@ -5906,12 +5817,8 @@ PyInit__decimal(void) Py_CLEAR(MutableMapping); /* GCOV_NOT_REACHED */ Py_CLEAR(SignalTuple); /* GCOV_NOT_REACHED */ Py_CLEAR(DecimalTuple); /* GCOV_NOT_REACHED */ -#ifdef WITHOUT_THREADS - Py_CLEAR(module_context); /* GCOV_NOT_REACHED */ -#else Py_CLEAR(default_context_template); /* GCOV_NOT_REACHED */ Py_CLEAR(tls_context_key); /* GCOV_NOT_REACHED */ -#endif Py_CLEAR(basic_context_template); /* GCOV_NOT_REACHED */ Py_CLEAR(extended_context_template); /* GCOV_NOT_REACHED */ Py_CLEAR(m); /* GCOV_NOT_REACHED */ diff --git a/Modules/_decimal/tests/runall-memorydebugger.sh b/Modules/_decimal/tests/runall-memorydebugger.sh index a446fc8b97b..77c0c9cd82c 100755 --- a/Modules/_decimal/tests/runall-memorydebugger.sh +++ b/Modules/_decimal/tests/runall-memorydebugger.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Purpose: test with and without threads, all machine configurations, pydebug, -# refleaks, release build and release build with valgrind. +# Purpose: test all machine configurations, pydebug, refleaks, release build +# and release build with valgrind. # # Synopsis: ./runall-memorydebugger.sh [--all-configs64 | --all-configs32] # @@ -57,8 +57,7 @@ print_config () cd .. # test_decimal: refleak, regular and Valgrind tests -for args in "--without-threads" ""; do - for config in $CONFIGS; do +for config in $CONFIGS; do unset PYTHON_DECIMAL_WITH_MACHINE libmpdec_config=$config @@ -70,12 +69,12 @@ for args in "--without-threads" ""; do fi ############ refleak tests ########### - print_config "refleak tests: config=$config" $args + print_config "refleak tests: config=$config" printf "\nbuilding python ...\n\n" cd ../../ $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ======================== refleak tests ===========================\n\n" @@ -83,11 +82,11 @@ for args in "--without-threads" ""; do ############ regular tests ########### - print_config "regular tests: config=$config" $args + print_config "regular tests: config=$config" printf "\nbuilding python ...\n\n" $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ======================== regular tests ===========================\n\n" @@ -104,23 +103,21 @@ for args in "--without-threads" ""; do esac esac - print_config "valgrind tests: config=$config" $args + print_config "valgrind tests: config=$config" printf "\nbuilding python ...\n\n" $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ======================== valgrind tests ===========================\n\n" $valgrind ./python -m test -uall test_decimal cd Modules/_decimal - done done # deccheck cd ../../ for config in $CONFIGS; do - for args in "--without-threads" ""; do unset PYTHON_DECIMAL_WITH_MACHINE if [ X"$config" != X"auto" ]; then @@ -129,22 +126,22 @@ for config in $CONFIGS; do fi ############ debug ############ - print_config "deccheck: config=$config --with-pydebug" $args + print_config "deccheck: config=$config --with-pydebug" printf "\nbuilding python ...\n\n" $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ========================== debug ===========================\n\n" ./python Modules/_decimal/tests/deccheck.py ########### regular ########### - print_config "deccheck: config=$config " $args + print_config "deccheck: config=$config " printf "\nbuilding python ...\n\n" $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ======================== regular ===========================\n\n" @@ -160,16 +157,15 @@ for config in $CONFIGS; do esac esac - print_config "valgrind deccheck: config=$config " $args + print_config "valgrind deccheck: config=$config " printf "\nbuilding python ...\n\n" $GMAKE distclean > /dev/null 2>&1 - ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc $args > /dev/null 2>&1 + ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc > /dev/null 2>&1 $GMAKE | grep _decimal printf "\n\n# ======================== valgrind ==========================\n\n" $valgrind ./python Modules/_decimal/tests/deccheck.py - done done From webhook-mailer at python.org Sat Sep 9 13:26:52 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 09 Sep 2017 17:26:52 -0000 Subject: [Python-checkins] [3.6] Make `json.dumps()` example to be PEP-8 compliant. (GH-3472) (GH-3473) Message-ID: https://github.com/python/cpython/commit/fe9bebf9605e390994bf75c136bc1fb9443e174c commit: fe9bebf9605e390994bf75c136bc1fb9443e174c branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-09T10:26:49-07:00 summary: [3.6] Make `json.dumps()` example to be PEP-8 compliant. (GH-3472) (GH-3473) (cherry picked from commit a7fbad96c8631070c1db137635d5bdd5e2aaac50) files: M Doc/library/json.rst diff --git a/Doc/library/json.rst b/Doc/library/json.rst index fdbdcb169fa..829218d5584 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -43,7 +43,7 @@ Encoding basic Python object hierarchies:: Compact encoding:: >>> import json - >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':')) + >>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: From webhook-mailer at python.org Sun Sep 10 01:54:09 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 10 Sep 2017 05:54:09 -0000 Subject: [Python-checkins] [3.6] Clarify nature of parse_args 'args' argument. (GH-3292) (GH-3325) Message-ID: https://github.com/python/cpython/commit/f8693229f5650e464a5c112ad28fd4e14d55a7bd commit: f8693229f5650e464a5c112ad28fd4e14d55a7bd branch: 3.6 author: R. David Murray committer: Mariatta date: 2017-09-09T22:54:05-07:00 summary: [3.6] Clarify nature of parse_args 'args' argument. (GH-3292) (GH-3325) Patch by Paul.j3. Includes an unrelated but useful addition to the optparse porting section. (cherry picked from commit 0c7983e4adf9604d0ac93757a45d14be06c27696) files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 9411bbd4ac5..27c7ba55820 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -900,6 +900,8 @@ values are: usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +.. _`argparse.REMAINDER`: + * ``argparse.REMAINDER``. All the remaining command-line arguments are gathered into a list. This is commonly useful for command line utilities that dispatch to other command line utilities:: @@ -1326,8 +1328,11 @@ The parse_args() method created and how they are assigned. See the documentation for :meth:`add_argument` for details. - By default, the argument strings are taken from :data:`sys.argv`, and a new empty - :class:`Namespace` object is created for the attributes. + * args_ - List of strings to parse. The default is taken from + :data:`sys.argv`. + + * namespace_ - An object to take the attributes. The default is a new empty + :class:`Namespace` object. Option value syntax @@ -1469,6 +1474,7 @@ unambiguous (the prefix matches a unique option):: An error is produced for arguments that could produce more than one options. This feature can be disabled by setting :ref:`allow_abbrev` to ``False``. +.. _args: Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^ @@ -1490,6 +1496,7 @@ interactive prompt:: >>> parser.parse_args(['1', '2', '3', '4', '--sum']) Namespace(accumulate=, integers=[1, 2, 3, 4]) +.. _namespace: The Namespace object ^^^^^^^^^^^^^^^^^^^^ @@ -2010,7 +2017,12 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`: * Replace ``(options, args) = parser.parse_args()`` with ``args = parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls for the positional arguments. Keep in mind that what was previously - called ``options``, now in :mod:`argparse` context is called ``args``. + called ``options``, now in the :mod:`argparse` context is called ``args``. + +* Replace :meth:`optparse.OptionParser.disable_interspersed_args` + by setting ``nargs`` of a positional argument to `argparse.REMAINDER`_, or + use :meth:`~ArgumentParser.parse_known_args` to collect unparsed argument + strings in a separate list. * Replace callback actions and the ``callback_*`` keyword arguments with ``type`` or ``action`` arguments. From webhook-mailer at python.org Sun Sep 10 01:55:11 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 10 Sep 2017 05:55:11 -0000 Subject: [Python-checkins] [2.7] Clarify nature of parse_args 'args' argument. (GH-3292) (GH-3328) Message-ID: https://github.com/python/cpython/commit/ae16b9966da1ac083796ecbffff004e3060b7731 commit: ae16b9966da1ac083796ecbffff004e3060b7731 branch: 2.7 author: R. David Murray committer: Mariatta date: 2017-09-09T22:55:07-07:00 summary: [2.7] Clarify nature of parse_args 'args' argument. (GH-3292) (GH-3328) Patch by Paul.j3. Includes an unrelated but useful addition to the optparse porting section. (cherry picked from commit 0c7983e4adf9604d0ac93757a45d14be06c27696) files: M Doc/library/argparse.rst diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index c8a5941df72..799336092a9 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -854,6 +854,8 @@ values are: usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +.. _`argparse.REMAINDER`: + * ``argparse.REMAINDER``. All the remaining command-line arguments are gathered into a list. This is commonly useful for command line utilities that dispatch to other command line utilities:: @@ -1275,8 +1277,11 @@ The parse_args() method created and how they are assigned. See the documentation for :meth:`add_argument` for details. - By default, the argument strings are taken from :data:`sys.argv`, and a new empty - :class:`Namespace` object is created for the attributes. + * args_ - List of strings to parse. The default is taken from + :data:`sys.argv`. + + * namespace_ - An object to take the attributes. The default is a new empty + :class:`Namespace` object. Option value syntax @@ -1417,6 +1422,7 @@ a unique option):: An error is produced for arguments that could produce more than one options. +.. _args: Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^ @@ -1438,6 +1444,7 @@ interactive prompt:: >>> parser.parse_args(['1', '2', '3', '4', '--sum']) Namespace(accumulate=, integers=[1, 2, 3, 4]) +.. _namespace: The Namespace object ^^^^^^^^^^^^^^^^^^^^ @@ -1943,7 +1950,12 @@ A partial upgrade path from :mod:`optparse` to :mod:`argparse`: * Replace ``(options, args) = parser.parse_args()`` with ``args = parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls for the positional arguments. Keep in mind that what was previously - called ``options``, now in :mod:`argparse` context is called ``args``. + called ``options``, now in the :mod:`argparse` context is called ``args``. + +* Replace :meth:`optparse.OptionParser.disable_interspersed_args` + by setting ``nargs`` of a positional argument to `argparse.REMAINDER`_, or + use :meth:`~ArgumentParser.parse_known_args` to collect unparsed argument + strings in a separate list. * Replace callback actions and the ``callback_*`` keyword arguments with ``type`` or ``action`` arguments. From webhook-mailer at python.org Sun Sep 10 02:02:17 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 10 Sep 2017 06:02:17 -0000 Subject: [Python-checkins] bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (GH-2960) Message-ID: https://github.com/python/cpython/commit/e1847ea4a9bdc7549893091a63e14f2afbdecc32 commit: e1847ea4a9bdc7549893091a63e14f2afbdecc32 branch: 2.7 author: Cheryl Sabella committer: Mariatta date: 2017-09-09T23:02:14-07:00 summary: bpo-25684: ttk.OptionMenu radiobuttons weren't unique (GH-2276) (GH-2960) ttk.OptionMenu radiobuttons weren't unique between instances of OptionMenu. (cherry picked from commit a568e5273382a5dca0c27274f7d8e34c41a87d4d) files: A Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst M Lib/lib-tk/test/test_ttk/test_extensions.py M Lib/lib-tk/ttk.py M Misc/ACKS diff --git a/Lib/lib-tk/test/test_ttk/test_extensions.py b/Lib/lib-tk/test/test_ttk/test_extensions.py index 57ffdddb7d8..70b2f9c6b12 100644 --- a/Lib/lib-tk/test/test_ttk/test_extensions.py +++ b/Lib/lib-tk/test/test_ttk/test_extensions.py @@ -284,6 +284,31 @@ def cb_test(item): optmenu.destroy() + def test_unique_radiobuttons(self): + # check that radiobuttons are unique across instances (bpo25684) + items = ('a', 'b', 'c') + default = 'a' + optmenu = ttk.OptionMenu(self.root, self.textvar, default, *items) + textvar2 = tkinter.StringVar(self.root) + optmenu2 = ttk.OptionMenu(self.root, textvar2, default, *items) + optmenu.pack() + optmenu.wait_visibility() + optmenu2.pack() + optmenu2.wait_visibility() + optmenu['menu'].invoke(1) + optmenu2['menu'].invoke(2) + optmenu_stringvar_name = optmenu['menu'].entrycget(0, 'variable') + optmenu2_stringvar_name = optmenu2['menu'].entrycget(0, 'variable') + self.assertNotEqual(optmenu_stringvar_name, + optmenu2_stringvar_name) + self.assertEqual(self.root.tk.globalgetvar(optmenu_stringvar_name), + items[1]) + self.assertEqual(self.root.tk.globalgetvar(optmenu2_stringvar_name), + items[2]) + + optmenu.destroy() + optmenu2.destroy() + tests_gui = (LabeledScaleTest, OptionMenuTest) diff --git a/Lib/lib-tk/ttk.py b/Lib/lib-tk/ttk.py index 77c93b12ae7..6da1eb189f1 100644 --- a/Lib/lib-tk/ttk.py +++ b/Lib/lib-tk/ttk.py @@ -1614,7 +1614,8 @@ def set_menu(self, default=None, *values): menu.delete(0, 'end') for val in values: menu.add_radiobutton(label=val, - command=Tkinter._setit(self._variable, val, self._callback)) + command=Tkinter._setit(self._variable, val, self._callback), + variable=self._variable) if default: self._variable.set(default) diff --git a/Misc/ACKS b/Misc/ACKS index 229a874ffc2..688cd470d20 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1229,6 +1229,7 @@ James Rutherford Chris Ryland Constantina S. Matthieu S +Cheryl Sabella Patrick Sabin S?bastien Sabl? Suman Saha diff --git a/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst b/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst new file mode 100644 index 00000000000..61d6b29cafc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst @@ -0,0 +1,2 @@ +Change ``ttk.OptionMenu`` radiobuttons to be unique across instances of +``OptionMenu``. From webhook-mailer at python.org Sun Sep 10 02:10:00 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 10 Sep 2017 06:10:00 -0000 Subject: [Python-checkins] Improve IncrementalEncoder documentation (GH-2746) Message-ID: https://github.com/python/cpython/commit/30644dee0c14af6c1c61d44166a97cec8245300b commit: 30644dee0c14af6c1c61d44166a97cec8245300b branch: master author: Zhiming Wang committer: Mariatta date: 2017-09-09T23:09:55-07:00 summary: Improve IncrementalEncoder documentation (GH-2746) getstate and setstate are instance methods, same as encode and reset. files: M Doc/library/codecs.rst diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 0ecd89ba75b..b9c1868d595 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -554,19 +554,19 @@ define in order to be compatible with the Python codec registry. if necessary, to reset the encoder and to get the output. -.. method:: IncrementalEncoder.getstate() + .. method:: getstate() - Return the current state of the encoder which must be an integer. The - implementation should make sure that ``0`` is the most common state. (States - that are more complicated than integers can be converted into an integer by - marshaling/pickling the state and encoding the bytes of the resulting string - into an integer). + Return the current state of the encoder which must be an integer. The + implementation should make sure that ``0`` is the most common + state. (States that are more complicated than integers can be converted + into an integer by marshaling/pickling the state and encoding the bytes + of the resulting string into an integer). -.. method:: IncrementalEncoder.setstate(state) + .. method:: setstate(state) - Set the state of the encoder to *state*. *state* must be an encoder state - returned by :meth:`getstate`. + Set the state of the encoder to *state*. *state* must be an encoder state + returned by :meth:`getstate`. .. _incremental-decoder-objects: From solipsis at pitrou.net Sun Sep 10 05:21:36 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 10 Sep 2017 09:21:36 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170910092135.123776.C27AFFDF598B30E2@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogBOMOJI', '--timeout', '7200'] From webhook-mailer at python.org Sun Sep 10 09:26:46 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 10 Sep 2017 13:26:46 -0000 Subject: [Python-checkins] [3.6] Improve IncrementalEncoder documentation (GH-2746) (GH-3475) Message-ID: https://github.com/python/cpython/commit/638601ec52858e19a4e3498c1057a62ee1481e65 commit: 638601ec52858e19a4e3498c1057a62ee1481e65 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-10T06:26:42-07:00 summary: [3.6] Improve IncrementalEncoder documentation (GH-2746) (GH-3475) getstate and setstate are instance methods, same as encode and reset. (cherry picked from commit 30644dee0c14af6c1c61d44166a97cec8245300b) files: M Doc/library/codecs.rst diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 0ecd89ba75b..b9c1868d595 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -554,19 +554,19 @@ define in order to be compatible with the Python codec registry. if necessary, to reset the encoder and to get the output. -.. method:: IncrementalEncoder.getstate() + .. method:: getstate() - Return the current state of the encoder which must be an integer. The - implementation should make sure that ``0`` is the most common state. (States - that are more complicated than integers can be converted into an integer by - marshaling/pickling the state and encoding the bytes of the resulting string - into an integer). + Return the current state of the encoder which must be an integer. The + implementation should make sure that ``0`` is the most common + state. (States that are more complicated than integers can be converted + into an integer by marshaling/pickling the state and encoding the bytes + of the resulting string into an integer). -.. method:: IncrementalEncoder.setstate(state) + .. method:: setstate(state) - Set the state of the encoder to *state*. *state* must be an encoder state - returned by :meth:`getstate`. + Set the state of the encoder to *state*. *state* must be an encoder state + returned by :meth:`getstate`. .. _incremental-decoder-objects: From webhook-mailer at python.org Sun Sep 10 12:08:07 2017 From: webhook-mailer at python.org (Stefan Krah) Date: Sun, 10 Sep 2017 16:08:07 -0000 Subject: [Python-checkins] bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477) Message-ID: https://github.com/python/cpython/commit/3cedf46cdbeefc019f4a672c1104f3d5e94712bd commit: 3cedf46cdbeefc019f4a672c1104f3d5e94712bd branch: master author: Stefan Krah committer: GitHub date: 2017-09-10T18:08:04+02:00 summary: bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477) files: M Modules/_decimal/_decimal.c diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index e3c1a7997fa..18fa2e4fa5e 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2082,13 +2082,17 @@ dec_from_long(PyTypeObject *type, const PyObject *v, /* Return a new PyDecObject from a PyLongObject. Use the context for conversion. */ static PyObject * -PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong, - PyObject *context) +PyDecType_FromLong(PyTypeObject *type, const PyObject *v, PyObject *context) { PyObject *dec; uint32_t status = 0; - dec = dec_from_long(type, pylong, CTX(context), &status); + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, "argument must be an integer"); + return NULL; + } + + dec = dec_from_long(type, v, CTX(context), &status); if (dec == NULL) { return NULL; } @@ -2104,15 +2108,20 @@ PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong, /* Return a new PyDecObject from a PyLongObject. Use a maximum context for conversion. If the conversion is not exact, set InvalidOperation. */ static PyObject * -PyDecType_FromLongExact(PyTypeObject *type, const PyObject *pylong, +PyDecType_FromLongExact(PyTypeObject *type, const PyObject *v, PyObject *context) { PyObject *dec; uint32_t status = 0; mpd_context_t maxctx; + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, "argument must be an integer"); + return NULL; + } + mpd_maxcontext(&maxctx); - dec = dec_from_long(type, pylong, &maxctx, &status); + dec = dec_from_long(type, v, &maxctx, &status); if (dec == NULL) { return NULL; } From webhook-mailer at python.org Sun Sep 10 12:46:52 2017 From: webhook-mailer at python.org (Stefan Krah) Date: Sun, 10 Sep 2017 16:46:52 -0000 Subject: [Python-checkins] [3.6] bpo-31406: Fix crash due to lack of type checking in subclassing. (GH-3477) (#3479) Message-ID: https://github.com/python/cpython/commit/f8909d0e4b652256e4da153fa6be664490f60a07 commit: f8909d0e4b652256e4da153fa6be664490f60a07 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Stefan Krah date: 2017-09-10T18:46:49+02:00 summary: [3.6] bpo-31406: Fix crash due to lack of type checking in subclassing. (GH-3477) (#3479) (cherry picked from commit 3cedf46cdbeefc019f4a672c1104f3d5e94712bd) files: M Modules/_decimal/_decimal.c diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index fcc1f151cf5..13418c905b2 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2163,13 +2163,17 @@ dec_from_long(PyTypeObject *type, const PyObject *v, /* Return a new PyDecObject from a PyLongObject. Use the context for conversion. */ static PyObject * -PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong, - PyObject *context) +PyDecType_FromLong(PyTypeObject *type, const PyObject *v, PyObject *context) { PyObject *dec; uint32_t status = 0; - dec = dec_from_long(type, pylong, CTX(context), &status); + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, "argument must be an integer"); + return NULL; + } + + dec = dec_from_long(type, v, CTX(context), &status); if (dec == NULL) { return NULL; } @@ -2185,15 +2189,20 @@ PyDecType_FromLong(PyTypeObject *type, const PyObject *pylong, /* Return a new PyDecObject from a PyLongObject. Use a maximum context for conversion. If the conversion is not exact, set InvalidOperation. */ static PyObject * -PyDecType_FromLongExact(PyTypeObject *type, const PyObject *pylong, +PyDecType_FromLongExact(PyTypeObject *type, const PyObject *v, PyObject *context) { PyObject *dec; uint32_t status = 0; mpd_context_t maxctx; + if (!PyLong_Check(v)) { + PyErr_SetString(PyExc_TypeError, "argument must be an integer"); + return NULL; + } + mpd_maxcontext(&maxctx); - dec = dec_from_long(type, pylong, &maxctx, &status); + dec = dec_from_long(type, v, &maxctx, &status); if (dec == NULL) { return NULL; } From webhook-mailer at python.org Sun Sep 10 13:23:38 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 10 Sep 2017 17:23:38 -0000 Subject: [Python-checkins] bpo-28638: Optimize namedtuple() creation time by minimizing use of exec() (#3454) Message-ID: https://github.com/python/cpython/commit/8b57d7363916869357848e666d03fa7614c47897 commit: 8b57d7363916869357848e666d03fa7614c47897 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-10T10:23:36-07:00 summary: bpo-28638: Optimize namedtuple() creation time by minimizing use of exec() (#3454) * Working draft without _source * Re-use itemgetter() instances * Speed-up calls to __new__() with a pre-bound tuple.__new__() * Add note regarding string interning * Remove unnecessary create function wrappers * Minor sync-ups with PR-2736. Mostly formatting and f-strings * Bring-in qualname/__module fix-ups from PR-2736 * Formally remove the verbose flag and _source attribute * Restore a test of potentially problematic field names * Restore kwonly_args test but without the verbose option * Adopt Inada's idea to reuse the docstrings for the itemgetters * Neaten-up a bit * Add news blurb * Serhiy pointed-out the need for interning * Jelle noticed as missing f on an f-string * Add whatsnew entry for feature removal * Accede to request for dict literals instead keyword arguments * Leave the method.__module__ attribute pointing the actual location of the code * Improve variable names and add a micro-optimization for an non-public helper function * Simplify by in-lining reuse_itemgetter() * Arrange steps in more logical order * Save docstring in local cache instead of interning files: A Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst M Doc/library/collections.rst M Doc/whatsnew/3.7.rst M Lib/collections/__init__.py M Lib/test/test_collections.py diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index d6d2056dfc4..cda829694a3 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -763,7 +763,7 @@ Named tuples assign meaning to each position in a tuple and allow for more reada self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index. -.. function:: namedtuple(typename, field_names, *, verbose=False, rename=False, module=None) +.. function:: namedtuple(typename, field_names, *, rename=False, module=None) Returns a new tuple subclass named *typename*. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as @@ -786,10 +786,6 @@ they add the ability to access fields by name instead of position index. converted to ``['abc', '_1', 'ghi', '_3']``, eliminating the keyword ``def`` and the duplicate fieldname ``abc``. - If *verbose* is true, the class definition is printed after it is - built. This option is outdated; instead, it is simpler to print the - :attr:`_source` attribute. - If *module* is defined, the ``__module__`` attribute of the named tuple is set to that value. @@ -806,6 +802,9 @@ they add the ability to access fields by name instead of position index. .. versionchanged:: 3.6 Added the *module* parameter. + .. versionchanged:: 3.7 + Remove the *verbose* parameter and the :attr:`_source` attribute. + .. doctest:: :options: +NORMALIZE_WHITESPACE @@ -878,15 +877,6 @@ field names, the method and attribute names start with an underscore. >>> for partnum, record in inventory.items(): ... inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now()) -.. attribute:: somenamedtuple._source - - A string with the pure Python source code used to create the named - tuple class. The source makes the named tuple self-documenting. - It can be printed, executed using :func:`exec`, or saved to a file - and imported. - - .. versionadded:: 3.3 - .. attribute:: somenamedtuple._fields Tuple of strings listing the field names. Useful for introspection diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 5ee41dcc20b..6ff1bfcb68f 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -435,6 +435,12 @@ API and Feature Removals Python 3.1, and has now been removed. Use the :func:`~os.path.splitdrive` function instead. +* :func:`collections.namedtuple` no longer supports the *verbose* parameter + or ``_source`` attribute which showed the generated source code for the + named tuple class. This was part of an optimization designed to speed-up + class creation. (Contributed by Jelle Zijlstra with further improvements + by INADA Naoki, Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.) + * Functions :func:`bool`, :func:`float`, :func:`list` and :func:`tuple` no longer take keyword arguments. The first argument of :func:`int` can now be passed only as positional argument. diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 70cb683088b..50cf8141731 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -301,59 +301,9 @@ def __eq__(self, other): ### namedtuple ################################################################################ -_class_template = """\ -from builtins import property as _property, tuple as _tuple -from operator import itemgetter as _itemgetter -from collections import OrderedDict +_nt_itemgetters = {} -class {typename}(tuple): - '{typename}({arg_list})' - - __slots__ = () - - _fields = {field_names!r} - - def __new__(_cls, {arg_list}): - 'Create new instance of {typename}({arg_list})' - return _tuple.__new__(_cls, ({arg_list})) - - @classmethod - def _make(cls, iterable, new=tuple.__new__, len=len): - 'Make a new {typename} object from a sequence or iterable' - result = new(cls, iterable) - if len(result) != {num_fields:d}: - raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) - return result - - def _replace(_self, **kwds): - 'Return a new {typename} object replacing specified fields with new values' - result = _self._make(map(kwds.pop, {field_names!r}, _self)) - if kwds: - raise ValueError('Got unexpected field names: %r' % list(kwds)) - return result - - def __repr__(self): - 'Return a nicely formatted representation string' - return self.__class__.__name__ + '({repr_fmt})' % self - - def _asdict(self): - 'Return a new OrderedDict which maps field names to their values.' - return OrderedDict(zip(self._fields, self)) - - def __getnewargs__(self): - 'Return self as a plain tuple. Used by copy and pickle.' - return tuple(self) - -{field_defs} -""" - -_repr_template = '{name}=%r' - -_field_template = '''\ - {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') -''' - -def namedtuple(typename, field_names, *, verbose=False, rename=False, module=None): +def namedtuple(typename, field_names, *, rename=False, module=None): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', ['x', 'y']) @@ -390,46 +340,104 @@ def namedtuple(typename, field_names, *, verbose=False, rename=False, module=Non or _iskeyword(name) or name.startswith('_') or name in seen): - field_names[index] = '_%d' % index + field_names[index] = f'_{index}' seen.add(name) for name in [typename] + field_names: if type(name) is not str: raise TypeError('Type names and field names must be strings') if not name.isidentifier(): raise ValueError('Type names and field names must be valid ' - 'identifiers: %r' % name) + f'identifiers: {name!r}') if _iskeyword(name): raise ValueError('Type names and field names cannot be a ' - 'keyword: %r' % name) + f'keyword: {name!r}') seen = set() for name in field_names: if name.startswith('_') and not rename: raise ValueError('Field names cannot start with an underscore: ' - '%r' % name) + f'{name!r}') if name in seen: - raise ValueError('Encountered duplicate field name: %r' % name) + raise ValueError(f'Encountered duplicate field name: {name!r}') seen.add(name) - # Fill-in the class template - class_definition = _class_template.format( - typename = typename, - field_names = tuple(field_names), - num_fields = len(field_names), - arg_list = repr(tuple(field_names)).replace("'", "")[1:-1], - repr_fmt = ', '.join(_repr_template.format(name=name) - for name in field_names), - field_defs = '\n'.join(_field_template.format(index=index, name=name) - for index, name in enumerate(field_names)) - ) - - # Execute the template string in a temporary namespace and support - # tracing utilities by setting a value for frame.f_globals['__name__'] - namespace = dict(__name__='namedtuple_%s' % typename) - exec(class_definition, namespace) - result = namespace[typename] - result._source = class_definition - if verbose: - print(result._source) + # Variables used in the methods and docstrings + field_names = tuple(map(_sys.intern, field_names)) + num_fields = len(field_names) + arg_list = repr(field_names).replace("'", "")[1:-1] + repr_fmt = '(' + ', '.join(f'{name}=%r' for name in field_names) + ')' + tuple_new = tuple.__new__ + _len = len + + # Create all the named tuple methods to be added to the class namespace + + s = f'def __new__(_cls, {arg_list}): return _tuple_new(_cls, ({arg_list}))' + namespace = {'_tuple_new': tuple_new, '__name__': f'namedtuple_{typename}'} + # Note: exec() has the side-effect of interning the typename and field names + exec(s, namespace) + __new__ = namespace['__new__'] + __new__.__doc__ = f'Create new instance of {typename}({arg_list})' + + @classmethod + def _make(cls, iterable): + result = tuple_new(cls, iterable) + if _len(result) != num_fields: + raise TypeError(f'Expected {num_fields} arguments, got {len(result)}') + return result + + _make.__func__.__doc__ = (f'Make a new {typename} object from a sequence ' + 'or iterable') + + def _replace(_self, **kwds): + result = _self._make(map(kwds.pop, field_names, _self)) + if kwds: + raise ValueError(f'Got unexpected field names: {list(kwds)!r}') + return result + + _replace.__doc__ = (f'Return a new {typename} object replacing specified ' + 'fields with new values') + + def __repr__(self): + 'Return a nicely formatted representation string' + return self.__class__.__name__ + repr_fmt % self + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values.' + return OrderedDict(zip(self._fields, self)) + + def __getnewargs__(self): + 'Return self as a plain tuple. Used by copy and pickle.' + return tuple(self) + + # Modify function metadata to help with introspection and debugging + + for method in (__new__, _make.__func__, _replace, + __repr__, _asdict, __getnewargs__): + method.__qualname__ = f'{typename}.{method.__name__}' + + # Build-up the class namespace dictionary + # and use type() to build the result class + class_namespace = { + '__doc__': f'{typename}({arg_list})', + '__slots__': (), + '_fields': field_names, + '__new__': __new__, + '_make': _make, + '_replace': _replace, + '__repr__': __repr__, + '_asdict': _asdict, + '__getnewargs__': __getnewargs__, + } + cache = _nt_itemgetters + for index, name in enumerate(field_names): + try: + itemgetter_object, doc = cache[index] + except KeyError: + itemgetter_object = _itemgetter(index) + doc = f'Alias for field number {index}' + cache[index] = itemgetter_object, doc + class_namespace[name] = property(itemgetter_object, doc=doc) + + result = type(typename, (tuple,), class_namespace) # For pickling to work, the __module__ variable needs to be set to the frame # where the named tuple is created. Bypass this step in environments where diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 3bf15786189..75defa12739 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -194,7 +194,6 @@ def test_factory(self): self.assertEqual(Point.__module__, __name__) self.assertEqual(Point.__getitem__, tuple.__getitem__) self.assertEqual(Point._fields, ('x', 'y')) - self.assertIn('class Point(tuple)', Point._source) self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword @@ -366,11 +365,37 @@ def test_name_conflicts(self): newt = t._replace(itemgetter=10, property=20, self=30, cls=40, tuple=50) self.assertEqual(newt, (10,20,30,40,50)) - # Broader test of all interesting names in a template - with support.captured_stdout() as template: - T = namedtuple('T', 'x', verbose=True) - words = set(re.findall('[A-Za-z]+', template.getvalue())) - words -= set(keyword.kwlist) + # Broader test of all interesting names taken from the code, old + # template, and an example + words = {'Alias', 'At', 'AttributeError', 'Build', 'Bypass', 'Create', + 'Encountered', 'Expected', 'Field', 'For', 'Got', 'Helper', + 'IronPython', 'Jython', 'KeyError', 'Make', 'Modify', 'Note', + 'OrderedDict', 'Point', 'Return', 'Returns', 'Type', 'TypeError', + 'Used', 'Validate', 'ValueError', 'Variables', 'a', 'accessible', 'add', + 'added', 'all', 'also', 'an', 'arg_list', 'args', 'arguments', + 'automatically', 'be', 'build', 'builtins', 'but', 'by', 'cannot', + 'class_namespace', 'classmethod', 'cls', 'collections', 'convert', + 'copy', 'created', 'creation', 'd', 'debugging', 'defined', 'dict', + 'dictionary', 'doc', 'docstring', 'docstrings', 'duplicate', 'effect', + 'either', 'enumerate', 'environments', 'error', 'example', 'exec', 'f', + 'f_globals', 'field', 'field_names', 'fields', 'formatted', 'frame', + 'function', 'functions', 'generate', 'get', 'getter', 'got', 'greater', + 'has', 'help', 'identifiers', 'index', 'indexable', 'instance', + 'instantiate', 'interning', 'introspection', 'isidentifier', + 'isinstance', 'itemgetter', 'iterable', 'join', 'keyword', 'keywords', + 'kwds', 'len', 'like', 'list', 'map', 'maps', 'message', 'metadata', + 'method', 'methods', 'module', 'module_name', 'must', 'name', 'named', + 'namedtuple', 'namedtuple_', 'names', 'namespace', 'needs', 'new', + 'nicely', 'num_fields', 'number', 'object', 'of', 'operator', 'option', + 'p', 'particular', 'pickle', 'pickling', 'plain', 'pop', 'positional', + 'property', 'r', 'regular', 'rename', 'replace', 'replacing', 'repr', + 'repr_fmt', 'representation', 'result', 'reuse_itemgetter', 's', 'seen', + 'self', 'sequence', 'set', 'side', 'specified', 'split', 'start', + 'startswith', 'step', 'str', 'string', 'strings', 'subclass', 'sys', + 'targets', 'than', 'the', 'their', 'this', 'to', 'tuple', 'tuple_new', + 'type', 'typename', 'underscore', 'unexpected', 'unpack', 'up', 'use', + 'used', 'user', 'valid', 'values', 'variable', 'verbose', 'where', + 'which', 'work', 'x', 'y', 'z', 'zip'} T = namedtuple('T', words) # test __new__ values = tuple(range(len(words))) @@ -396,30 +421,15 @@ def test_name_conflicts(self): self.assertEqual(t.__getnewargs__(), values) def test_repr(self): - with support.captured_stdout() as template: - A = namedtuple('A', 'x', verbose=True) + A = namedtuple('A', 'x') self.assertEqual(repr(A(1)), 'A(x=1)') # repr should show the name of the subclass class B(A): pass self.assertEqual(repr(B(1)), 'B(x=1)') - def test_source(self): - # verify that _source can be run through exec() - tmp = namedtuple('NTColor', 'red green blue') - globals().pop('NTColor', None) # remove artifacts from other tests - exec(tmp._source, globals()) - self.assertIn('NTColor', globals()) - c = NTColor(10, 20, 30) - self.assertEqual((c.red, c.green, c.blue), (10, 20, 30)) - self.assertEqual(NTColor._fields, ('red', 'green', 'blue')) - globals().pop('NTColor', None) # clean-up after this test - def test_keyword_only_arguments(self): # See issue 25628 - with support.captured_stdout() as template: - NT = namedtuple('NT', ['x', 'y'], verbose=True) - self.assertIn('class NT', NT._source) with self.assertRaises(TypeError): NT = namedtuple('NT', ['x', 'y'], True) diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst new file mode 100644 index 00000000000..53b809f51c0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst @@ -0,0 +1,9 @@ +Changed the implementation strategy for collections.namedtuple() to +substantially reduce the use of exec() in favor of precomputed methods. As a +result, the *verbose* parameter and *_source* attribute are no longer +supported. The benefits include 1) having a smaller memory footprint for +applications using multiple named tuples, 2) faster creation of the named +tuple class (approx 4x to 6x depending on how it is measured), and 3) minor +speed-ups for instance creation using __new__, _make, and _replace. (The +primary patch contributor is Jelle Zijlstra with further improvements by +INADA Naoki, Serhiy Storchaka, and Raymond Hettinger.) From webhook-mailer at python.org Sun Sep 10 14:32:16 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Sun, 10 Sep 2017 18:32:16 -0000 Subject: [Python-checkins] Simplify run_tests.py (#3482) Message-ID: https://github.com/python/cpython/commit/d39dbf4cf18488beb190ab358b7ab38792cd5043 commit: d39dbf4cf18488beb190ab358b7ab38792cd5043 branch: master author: Antoine Pitrou committer: GitHub date: 2017-09-10T20:32:13+02:00 summary: Simplify run_tests.py (#3482) files: M Tools/scripts/run_tests.py diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py index 30283023b6d..9fc37997683 100644 --- a/Tools/scripts/run_tests.py +++ b/Tools/scripts/run_tests.py @@ -10,10 +10,6 @@ import os import sys import test.support -try: - import threading -except ImportError: - threading = None def is_multiprocess_flag(arg): @@ -43,7 +39,7 @@ def main(regrtest_args): ]) if sys.platform == 'win32': args.append('-n') # Silence alerts under Windows - if threading and not any(is_multiprocess_flag(arg) for arg in regrtest_args): + if not any(is_multiprocess_flag(arg) for arg in regrtest_args): args.extend(['-j', '0']) # Use all CPU cores if not any(is_resource_use_flag(arg) for arg in regrtest_args): args.extend(['-u', 'all,-largefile,-audio,-gui']) From webhook-mailer at python.org Sun Sep 10 15:14:37 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Sun, 10 Sep 2017 19:14:37 -0000 Subject: [Python-checkins] bpo-29136: Fix versionchange for TLS 1.3 changes (#3483) Message-ID: https://github.com/python/cpython/commit/28580316a57d1757978196c27286f989d21ec0f3 commit: 28580316a57d1757978196c27286f989d21ec0f3 branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-10T21:14:34+02:00 summary: bpo-29136: Fix versionchange for TLS 1.3 changes (#3483) Thanks Arfrever! Signed-off-by: Christian Heimes files: M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index f19526b5406..d7e0467239b 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -297,7 +297,7 @@ purposes. 3DES was dropped from the default cipher string. - .. versionchanged:: 3.7 + .. versionchanged:: 3.6.3 TLS 1.3 cipher suites TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, and TLS_CHACHA20_POLY1305_SHA256 were added to the default cipher string. @@ -776,7 +776,7 @@ Constants When Python has been compiled against an older version of OpenSSL, the flag defaults to *0*. - .. versionadded:: 3.7 + .. versionadded:: 3.6.3 .. data:: OP_CIPHER_SERVER_PREFERENCE @@ -856,7 +856,7 @@ Constants Whether the OpenSSL library has built-in support for the TLS 1.3 protocol. - .. versionadded:: 3.7 + .. versionadded:: 3.6.3 .. data:: CHANNEL_BINDING_TYPES From webhook-mailer at python.org Sun Sep 10 17:19:51 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 10 Sep 2017 21:19:51 -0000 Subject: [Python-checkins] bpo-27099: IDLE - Convert built-in extensions to regular features (#2494) Message-ID: https://github.com/python/cpython/commit/58fc71c447049d0efe4e11db1b55edc307f1bede commit: 58fc71c447049d0efe4e11db1b55edc307f1bede branch: master author: wohlganger committer: Terry Jan Reedy date: 2017-09-10T17:19:47-04:00 summary: bpo-27099: IDLE - Convert built-in extensions to regular features (#2494) About 10 IDLE features were implemented as supposedly optional extensions. Their different behavior could be confusing or worse for users and not good for maintenance. Hence the conversion. The main difference for users is that user configurable key bindings for builtin features are now handled uniformly. Now, editing a binding in a keyset only affects its value in the keyset. All bindings are defined together in the system-specific default keysets in config- extensions.def. All custom keysets are saved as a whole in config- extension.cfg. All take effect as soon as one clicks Apply or Ok. The affected events are '<>', '<>', '<>', '<>', '<>', '<>', '<>', and '<>'. Any (global) customizations made before 3.6.3 will not affect their keyset- specific customization after 3.6.3. and vice versa. Inital patch by Charles Wohlganger, revised by Terry Jan Reedy. files: A Lib/idlelib/zzdummy.py A Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst M Doc/library/idle.rst M Lib/idlelib/autocomplete.py M Lib/idlelib/autoexpand.py M Lib/idlelib/calltips.py M Lib/idlelib/codecontext.py M Lib/idlelib/config-extensions.def M Lib/idlelib/config-keys.def M Lib/idlelib/config.py M Lib/idlelib/configdialog.py M Lib/idlelib/editor.py M Lib/idlelib/idle_test/test_config.py M Lib/idlelib/idle_test/test_configdialog.py M Lib/idlelib/mainmenu.py M Lib/idlelib/outwin.py M Lib/idlelib/paragraph.py M Lib/idlelib/parenmatch.py M Lib/idlelib/rstrip.py M Lib/idlelib/runscript.py M Lib/idlelib/zoomheight.py diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index a945b6d7712..4f51f3f0ac2 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -672,23 +672,6 @@ Extensions IDLE contains an extension facility. Preferences for extensions can be changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The default extensions -are currently: - -* FormatParagraph - -* AutoExpand - -* ZoomHeight - -* ScriptBinding - -* CallTips - -* ParenMatch - -* AutoComplete - -* CodeContext - -* RstripExtension +in the idlelib directory for further information. The only current default +extension is zoomheight. It exists as an extension primarily to be an example +and for testing purposes. \ No newline at end of file diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index cd212ccb143..edf445f08b5 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -1,7 +1,7 @@ -"""autocomplete.py - An IDLE extension for automatically completing names. +"""Complete either attribute names or file names. -This extension can complete either attribute names or file names. It can pop -a window with all available names, for the user to select from. +Either on demand or after a user-selected delay after a key character, +pop up a list of candidates. """ import os import string @@ -27,18 +27,9 @@ class AutoComplete: - menudefs = [ - ('edit', [ - ("Show Completions", "<>"), - ]) - ] - - popupwait = idleConf.GetOption("extensions", "AutoComplete", - "popupwait", type="int", default=0) - def __init__(self, editwin=None): self.editwin = editwin - if editwin is not None: # not in subprocess or test + if editwin is not None: # not in subprocess or test self.text = editwin.text self.autocompletewindow = None # id of delayed call, and the index of the text insert when @@ -47,6 +38,11 @@ def __init__(self, editwin=None): self._delayed_completion_id = None self._delayed_completion_index = None + @classmethod + def reload(cls): + cls.popupwait = idleConf.GetOption( + "extensions", "AutoComplete", "popupwait", type="int", default=0) + def _make_autocomplete_window(self): return autocomplete_w.AutoCompleteWindow(self.text) @@ -228,6 +224,9 @@ def get_entity(self, name): return eval(name, namespace) +AutoComplete.reload() + + if __name__ == '__main__': from unittest import main main('idlelib.idle_test.test_autocomplete', verbosity=2) diff --git a/Lib/idlelib/autoexpand.py b/Lib/idlelib/autoexpand.py index 6b46bee69c9..42e733a1a9e 100644 --- a/Lib/idlelib/autoexpand.py +++ b/Lib/idlelib/autoexpand.py @@ -10,23 +10,13 @@ place before requesting the next selection causes AutoExpand to reset its state. -This is an extension file and there is only one instance of AutoExpand. +There is only one instance of Autoexpand. ''' import re import string -###$ event <> -###$ win -###$ unix class AutoExpand: - - menudefs = [ - ('edit', [ - ('E_xpand Word', '<>'), - ]), - ] - wordchars = string.ascii_letters + string.digits + "_" def __init__(self, editwin): @@ -100,6 +90,7 @@ def getprevword(self): i = i-1 return line[i:] + if __name__ == '__main__': import unittest unittest.main('idlelib.idle_test.test_autoexpand', verbosity=2) diff --git a/Lib/idlelib/calltips.py b/Lib/idlelib/calltips.py index 49625eac158..ec8f6169895 100644 --- a/Lib/idlelib/calltips.py +++ b/Lib/idlelib/calltips.py @@ -1,9 +1,8 @@ -"""calltips.py - An IDLE Extension to Jog Your Memory +"""Pop up a reminder of how to call a function. Call Tips are floating windows which display function, class, and method parameter and docstring information when you type an opening parenthesis, and which disappear when you type a closing parenthesis. - """ import inspect import re @@ -15,13 +14,8 @@ from idlelib.hyperparser import HyperParser import __main__ -class CallTips: - menudefs = [ - ('edit', [ - ("Show call tip", "<>"), - ]) - ] +class CallTips: def __init__(self, editwin=None): if editwin is None: # subprocess and test @@ -103,6 +97,7 @@ def fetch_tip(self, expression): else: return get_argspec(get_entity(expression)) + def get_entity(expression): """Return the object corresponding to expression evaluated in a namespace spanning sys.modules and __main.dict__. @@ -126,7 +121,6 @@ def get_entity(expression): _invalid_method = "invalid method signature" _argument_positional = "\n['/' marks preceding arguments as positional-only]\n" - def get_argspec(ob): '''Return a string describing the signature of a callable object, or ''. diff --git a/Lib/idlelib/codecontext.py b/Lib/idlelib/codecontext.py index 09dc078d63f..779b5b88cf3 100644 --- a/Lib/idlelib/codecontext.py +++ b/Lib/idlelib/codecontext.py @@ -1,4 +1,4 @@ -"""codecontext - Extension to display the block context above the edit window +"""codecontext - display the block context above the edit window Once code has scrolled off the top of a window, it can be difficult to determine which block you are in. This extension implements a pane at the top @@ -25,10 +25,8 @@ getspacesfirstword =\ lambda s, c=re.compile(r"^(\s*)(\w*)"): c.match(s).groups() + class CodeContext: - menudefs = [('options', [('!Code Conte_xt', '<>')])] - context_depth = idleConf.GetOption("extensions", "CodeContext", - "numlines", type="int", default=3) bgcolor = idleConf.GetOption("extensions", "CodeContext", "bgcolor", type="str", default="LightGray") fgcolor = idleConf.GetOption("extensions", "CodeContext", @@ -45,15 +43,20 @@ def __init__(self, editwin): # starts the toplevel 'block' of the module. self.info = [(0, -1, "", False)] self.topvisible = 1 - visible = idleConf.GetOption("extensions", "CodeContext", - "visible", type="bool", default=False) - if visible: - self.toggle_code_context_event() - self.editwin.setvar('<>', True) + self.reload() # Start two update cycles, one for context lines, one for font changes. self.text.after(UPDATEINTERVAL, self.timer_event) self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + @classmethod + def reload(cls): + cls.context_depth = idleConf.GetOption("extensions", "CodeContext", + "numlines", type="int", default=3) + cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", + "bgcolor", type="str", default="LightGray") + cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", + "fgcolor", type="str", default="Black") + def toggle_code_context_event(self, event=None): if not self.label: # Calculate the border width and horizontal padding required to @@ -86,7 +89,7 @@ def toggle_code_context_event(self, event=None): else: self.label.destroy() self.label = None - idleConf.SetOption("extensions", "CodeContext", "visible", + idleConf.SetOption("main", "Theme", "contexton", str(self.label is not None)) idleConf.SaveUserCfgFiles() return "break" @@ -177,3 +180,6 @@ def font_timer_event(self): self.textfont = newtextfont self.label["font"] = self.textfont self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + + +CodeContext.reload() diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index a24b8c9316b..e8d417bac0d 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -1,5 +1,25 @@ # config-extensions.def # +# The following sections are for features that are no longer extensions. +# Their options values are left here for back-compatibility. + +[AutoComplete] +popupwait= 2000 + +[CodeContext] +numlines= 3 +visible= False +bgcolor= LightGray +fgcolor= Black + +[FormatParagraph] +max-width= 72 + +[ParenMatch] +style= expression +flash-delay= 500 +bell= True + # IDLE reads several config files to determine user preferences. This # file is the default configuration file for IDLE extensions settings. # @@ -19,7 +39,7 @@ # extension that may be sensibly re-configured. # # If there are no keybindings for a menus' virtual events, include lines -# like <>= (See [CodeContext], below.) +# like <>=. # # Currently it is necessary to manually modify this file to change # extension key bindings and default values. To customize, create @@ -32,68 +52,14 @@ # See config-keys.def for notes on specifying keys and extend.txt for # information on creating IDLE extensions. -[AutoComplete] -enable=True -popupwait=2000 -[AutoComplete_cfgBindings] -force-open-completions= -[AutoComplete_bindings] -autocomplete= -try-open-completions= - -[AutoExpand] -enable=True -[AutoExpand_cfgBindings] -expand-word= - -[CallTips] -enable=True -[CallTips_cfgBindings] -force-open-calltip= -[CallTips_bindings] -try-open-calltip= -refresh-calltip= - -[CodeContext] -enable=True -enable_shell=False -numlines=3 -visible=False -bgcolor=LightGray -fgcolor=Black -[CodeContext_bindings] -toggle-code-context= - -[FormatParagraph] -enable=True -max-width=72 -[FormatParagraph_cfgBindings] -format-paragraph= - -[ParenMatch] -enable=True -style= expression -flash-delay= 500 -bell=True -[ParenMatch_cfgBindings] -flash-paren= -[ParenMatch_bindings] -paren-closed= - -[RstripExtension] -enable=True -enable_shell=False -enable_editor=True - -[ScriptBinding] -enable=True -enable_shell=False -enable_editor=True -[ScriptBinding_cfgBindings] -run-module= -check-module= - -[ZoomHeight] -enable=True -[ZoomHeight_cfgBindings] -zoom-height= +# A fake extension for testing and example purposes. When enabled and +# invoked, inserts or deletes z-text at beginning of every line. +[ZzDummy] +enable= True +enable_shell = False +enable_editor = True +z-text= Z +[ZzDummy_cfgBindings] +z-in= +[ZzDummy_bindings] +z-out= diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def index 64788f9adf0..fd235194dfc 100644 --- a/Lib/idlelib/config-keys.def +++ b/Lib/idlelib/config-keys.def @@ -57,6 +57,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic Unix] copy= @@ -108,6 +116,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Modern Unix] copy = @@ -159,6 +175,14 @@ toggle-tabs = change-indentwidth = del-word-left = del-word-right = +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic Mac] copy= @@ -210,6 +234,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic OSX] toggle-tabs = @@ -262,4 +294,11 @@ python-context-help = save-copy-of-window-as-file = open-window-from-file = python-docs = - +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py index 63d9a442345..c3e57bc692d 100644 --- a/Lib/idlelib/config.py +++ b/Lib/idlelib/config.py @@ -359,7 +359,8 @@ def GetThemeDict(self, type, themeName): 'stderr-foreground':'#000000', 'stderr-background':'#ffffff', 'console-foreground':'#000000', - 'console-background':'#ffffff' } + 'console-background':'#ffffff', + } for element in theme: if not cfgParser.has_option(themeName, element): # Print warning that will return a default color @@ -443,6 +444,11 @@ def GetExtensions(self, active_only=True, for extn in userExtns: if extn not in extns: #user has added own extension extns.append(extn) + for extn in ('AutoComplete','CodeContext', + 'FormatParagraph','ParenMatch'): + extns.remove(extn) + # specific exclusions because we are storing config for mainlined old + # extensions in config-extensions.def for backward compatibility if active_only: activeExtns = [] for extn in extns: @@ -594,7 +600,12 @@ def IsCoreBinding(self, virtualEvent): return ('<<'+virtualEvent+'>>') in self.GetCoreKeys() # TODO make keyBindins a file or class attribute used for test above -# and copied in function below +# and copied in function below. + + former_extension_events = { # Those with user-configurable keys. + '<>', '<>', + '<>', '<>', '<>', + '<>', '<>', '<>'} def GetCoreKeys(self, keySetName=None): """Return dict of core virtual-key keybindings for keySetName. @@ -654,8 +665,17 @@ def GetCoreKeys(self, keySetName=None): '<>': [''], '<>': [''], '<>': [''], - '<>': [''] + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], } + if keySetName: if not (self.userCfg['keys'].has_section(keySetName) or self.defaultCfg['keys'].has_section(keySetName)): @@ -670,7 +690,8 @@ def GetCoreKeys(self, keySetName=None): binding = self.GetKeyBinding(keySetName, event) if binding: keyBindings[event] = binding - else: #we are going to return a default, print warning + # Otherwise return default in keyBindings. + elif event not in self.former_extension_events: warning = ( '\n Warning: config.py - IdleConf.GetCoreKeys -\n' ' problem retrieving key binding for event %r\n' diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 4ef6197e714..604719f0453 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -15,7 +15,7 @@ NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW, HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END) from tkinter.ttk import (Button, Checkbutton, Entry, Frame, Label, LabelFrame, - Notebook, Radiobutton, Scrollbar, Style) + OptionMenu, Notebook, Radiobutton, Scrollbar, Style) import tkinter.colorchooser as tkColorChooser import tkinter.font as tkFont from tkinter import messagebox @@ -198,7 +198,6 @@ def help(self): def deactivate_current_config(self): """Remove current key bindings. - Iterate over window instances defined in parent and remove the keybindings. """ @@ -288,6 +287,7 @@ def load_extensions(self): "Fill self.extensions with data from the default and user configs." self.extensions = {} for ext_name in idleConf.GetExtensions(active_only=False): + # Former built-in extensions are already filtered out. self.extensions[ext_name] = [] for ext_name in self.extensions: @@ -796,7 +796,8 @@ def create_page_highlight(self): takefocus=FALSE, highlightthickness=0, wrap=NONE) text.bind('', lambda e: 'break') text.bind('', lambda e: 'break') - text_and_tags=(('\n', 'normal'), + text_and_tags=( + ('\n', 'normal'), ('#you can click here', 'comment'), ('\n', 'normal'), ('#to choose items', 'comment'), ('\n', 'normal'), ('def', 'keyword'), (' ', 'normal'), @@ -858,11 +859,10 @@ def tem(event, elem=element): frame_theme, text='Delete Custom Theme', command=self.delete_custom) self.theme_message = Label(frame_theme, borderwidth=2) - # Pack widgets: # body. frame_custom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH) - frame_theme.pack(side=LEFT, padx=5, pady=5, fill=Y) + frame_theme.pack(side=TOP, padx=5, pady=5, fill=X) # frame_custom. self.frame_color_set.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X) frame_fg_bg_toggle.pack(side=TOP, padx=5, pady=0) @@ -1764,15 +1764,30 @@ def create_page_general(self): (*)helplist: ListBox scroll_helplist: Scrollbar """ + # Integer values need StringVar because int('') raises. self.startup_edit = tracers.add( IntVar(self), ('main', 'General', 'editor-on-startup')) - self.autosave = tracers.add( - IntVar(self), ('main', 'General', 'autosave')) self.win_width = tracers.add( StringVar(self), ('main', 'EditorWindow', 'width')) self.win_height = tracers.add( StringVar(self), ('main', 'EditorWindow', 'height')) + self.autocomplete_wait = tracers.add( + StringVar(self), ('extensions', 'AutoComplete', 'popupwait')) + self.paren_style = tracers.add( + StringVar(self), ('extensions', 'ParenMatch', 'style')) + self.flash_delay = tracers.add( + StringVar(self), ('extensions', 'ParenMatch', 'flash-delay')) + self.paren_bell = tracers.add( + BooleanVar(self), ('extensions', 'ParenMatch', 'bell')) + + self.autosave = tracers.add( + IntVar(self), ('main', 'General', 'autosave')) + self.format_width = tracers.add( + StringVar(self), ('extensions', 'FormatParagraph', 'max-width')) + self.context_lines = tracers.add( + StringVar(self), ('extensions', 'CodeContext', 'numlines')) + # Create widgets: # Section frames. frame_window = LabelFrame(self, borderwidth=2, relief=GROOVE, text=' Window Preferences') @@ -1790,7 +1805,7 @@ def create_page_general(self): frame_run, variable=self.startup_edit, value=0, text='Open Shell Window') - frame_win_size = Frame(frame_window, borderwidth=0,) + frame_win_size = Frame(frame_window, borderwidth=0) win_size_title = Label( frame_win_size, text='Initial Window Size (in characters)') win_width_title = Label(frame_win_size, text='Width') @@ -1800,6 +1815,26 @@ def create_page_general(self): self.win_height_int = Entry( frame_win_size, textvariable=self.win_height, width=3) + frame_autocomplete = Frame(frame_window, borderwidth=0,) + auto_wait_title = Label(frame_autocomplete, + text='Completions Popup Wait (milliseconds)') + self.auto_wait_int = Entry(frame_autocomplete, width=6, + textvariable=self.autocomplete_wait) + + frame_paren1 = Frame(frame_window, borderwidth=0) + paren_style_title = Label(frame_paren1, text='Paren Match Style') + self.paren_style_type = OptionMenu( + frame_paren1, self.paren_style, 'expression', + "opener","parens","expression") + frame_paren2 = Frame(frame_window, borderwidth=0) + paren_time_title = Label( + frame_paren2, text='Time Match Displayed (milliseconds)\n' + '(0 is until next input)') + self.paren_flash_time = Entry( + frame_paren2, textvariable=self.flash_delay, width=6) + self.bell_on = Checkbutton( + frame_paren2, text="Bell on Mismatch", variable=self.paren_bell) + # Frame_editor. frame_save = Frame(frame_editor, borderwidth=0) run_save_title = Label(frame_save, text='At Start of Run (F5) ') @@ -1810,6 +1845,18 @@ def create_page_general(self): frame_save, variable=self.autosave, value=1, text='No Prompt') + frame_format = Frame(frame_editor, borderwidth=0) + format_width_title = Label(frame_format, + text='Format Paragraph Max Width') + self.format_width_int = Entry( + frame_format, textvariable=self.format_width, width=4) + + frame_context = Frame(frame_editor, borderwidth=0) + context_title = Label(frame_context, text='Context Lines :') + self.context_int = Entry( + frame_context, textvariable=self.context_lines, width=3) + + # frame_help. frame_helplist = Frame(frame_help) frame_helplist_buttons = Frame(frame_helplist) @@ -1847,11 +1894,33 @@ def create_page_general(self): win_height_title.pack(side=RIGHT, anchor=E, pady=5) self.win_width_int.pack(side=RIGHT, anchor=E, padx=10, pady=5) win_width_title.pack(side=RIGHT, anchor=E, pady=5) + # frame_autocomplete. + frame_autocomplete.pack(side=TOP, padx=5, pady=0, fill=X) + auto_wait_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.auto_wait_int.pack(side=TOP, padx=10, pady=5) + # frame_paren. + frame_paren1.pack(side=TOP, padx=5, pady=0, fill=X) + paren_style_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.paren_style_type.pack(side=TOP, padx=10, pady=5) + frame_paren2.pack(side=TOP, padx=5, pady=0, fill=X) + paren_time_title.pack(side=LEFT, anchor=W, padx=5) + self.bell_on.pack(side=RIGHT, anchor=E, padx=15, pady=5) + self.paren_flash_time.pack(side=TOP, anchor=W, padx=15, pady=5) + # frame_save. frame_save.pack(side=TOP, padx=5, pady=0, fill=X) run_save_title.pack(side=LEFT, anchor=W, padx=5, pady=5) self.save_auto_on.pack(side=RIGHT, anchor=W, padx=5, pady=5) self.save_ask_on.pack(side=RIGHT, anchor=W, padx=5, pady=5) + # frame_format. + frame_format.pack(side=TOP, padx=5, pady=0, fill=X) + format_width_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.format_width_int.pack(side=TOP, padx=10, pady=5) + # frame_context. + frame_context.pack(side=TOP, padx=5, pady=0, fill=X) + context_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.context_int.pack(side=TOP, padx=5, pady=5) + # frame_help. frame_helplist_buttons.pack(side=RIGHT, padx=5, pady=5, fill=Y) frame_helplist.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH) @@ -1863,17 +1932,30 @@ def create_page_general(self): def load_general_cfg(self): "Load current configuration settings for the general options." - # Set startup state. + # Set variables for all windows. self.startup_edit.set(idleConf.GetOption( - 'main', 'General', 'editor-on-startup', default=0, type='bool')) - # Set autosave state. - self.autosave.set(idleConf.GetOption( - 'main', 'General', 'autosave', default=0, type='bool')) - # Set initial window size. + 'main', 'General', 'editor-on-startup', type='bool')) self.win_width.set(idleConf.GetOption( 'main', 'EditorWindow', 'width', type='int')) self.win_height.set(idleConf.GetOption( 'main', 'EditorWindow', 'height', type='int')) + self.autocomplete_wait.set(idleConf.GetOption( + 'extensions', 'AutoComplete', 'popupwait', type='int')) + self.paren_style.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'style')) + self.flash_delay.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'flash-delay', type='int')) + self.paren_bell.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'bell')) + + # Set variables for editor windows. + self.autosave.set(idleConf.GetOption( + 'main', 'General', 'autosave', default=0, type='bool')) + self.format_width.set(idleConf.GetOption( + 'extensions', 'FormatParagraph', 'max-width', type='int')) + self.context_lines.set(idleConf.GetOption( + 'extensions', 'CodeContext', 'numlines', type='int')) + # Set additional help sources. self.user_helplist = idleConf.GetAllExtraHelpSourcesList() self.helplist.delete(0, 'end') @@ -2034,10 +2116,10 @@ def detach(self): be used with older IDLE releases if it is saved as a custom key set, with a different name. ''', - 'Extensions': ''' -Extensions: + 'General': ''' +General: -Autocomplete: Popupwait is milleseconds to wait after key char, without +AutoComplete: Popupwait is milleseconds to wait after key char, without cursor movement, before popping up completion box. Key char is '.' after identifier or a '/' (or '\\' on Windows) within a string. diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 43b105f7265..855d3750556 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -31,7 +31,6 @@ TK_TABWIDTH_DEFAULT = 8 _py_version = ' (%s)' % platform.python_version() - def _sphinx_version(): "Format sys.version_info to produce the Sphinx version string used to install the chm docs" major, minor, micro, level, serial = sys.version_info @@ -52,11 +51,22 @@ class EditorWindow(object): from idlelib import mainmenu from tkinter import Toplevel from idlelib.statusbar import MultiStatusBar + from idlelib.autocomplete import AutoComplete + from idlelib.autoexpand import AutoExpand + from idlelib.calltips import CallTips + from idlelib.codecontext import CodeContext + from idlelib.paragraph import FormatParagraph + from idlelib.parenmatch import ParenMatch + from idlelib.rstrip import RstripExtension + from idlelib.zoomheight import ZoomHeight filesystemencoding = sys.getfilesystemencoding() # for file names help_url = None def __init__(self, flist=None, filename=None, key=None, root=None): + # Delay import: runscript imports pyshell imports EditorWindow. + from idlelib.runscript import ScriptBinding + if EditorWindow.help_url is None: dochome = os.path.join(sys.base_prefix, 'Doc', 'index.html') if sys.platform.count('linux'): @@ -84,7 +94,8 @@ def __init__(self, flist=None, filename=None, key=None, root=None): # Safari requires real file:-URLs EditorWindow.help_url = 'file://' + EditorWindow.help_url else: - EditorWindow.help_url = "https://docs.python.org/%d.%d/" % sys.version_info[:2] + EditorWindow.help_url = ("https://docs.python.org/%d.%d/" + % sys.version_info[:2]) self.flist = flist root = root or flist.root self.root = root @@ -270,6 +281,43 @@ def __init__(self, flist=None, filename=None, key=None, root=None): self.askinteger = tkSimpleDialog.askinteger self.showerror = tkMessageBox.showerror + # Add pseudoevents for former extension fixed keys. + # (This probably needs to be done once in the process.) + text.event_add('<>', '') + text.event_add('<>', '', + '', '') + text.event_add('<>', '') + text.event_add('<>', '') + text.event_add('<>', '', + '', '') + + # Former extension bindings depends on frame.text being packed + # (called from self.ResetColorizer()). + autocomplete = self.AutoComplete(self) + text.bind("<>", autocomplete.autocomplete_event) + text.bind("<>", + autocomplete.try_open_completions_event) + text.bind("<>", + autocomplete.force_open_completions_event) + text.bind("<>", self.AutoExpand(self).expand_word_event) + text.bind("<>", + self.FormatParagraph(self).format_paragraph_event) + parenmatch = self.ParenMatch(self) + text.bind("<>", parenmatch.flash_paren_event) + text.bind("<>", parenmatch.paren_closed_event) + scriptbinding = ScriptBinding(self) + text.bind("<>", scriptbinding.check_module_event) + text.bind("<>", scriptbinding.run_module_event) + text.bind("<>", self.RstripExtension(self).do_rstrip) + calltips = self.CallTips(self) + text.bind("<>", calltips.try_open_calltip_event) + #refresh-calltips must come after paren-closed to work right + text.bind("<>", calltips.refresh_calltip_event) + text.bind("<>", calltips.force_open_calltip_event) + text.bind("<>", self.ZoomHeight(self).zoom_height_event) + text.bind("<>", + self.CodeContext(self).toggle_code_context_event) + def _filename_to_unicode(self, filename): """Return filename as BMP unicode so diplayable in Tk.""" # Decode bytes to unicode. @@ -981,16 +1029,8 @@ def load_standard_extensions(self): def get_standard_extension_names(self): return idleConf.GetExtensions(editor_only=True) - extfiles = { # map config-extension section names to new file names - 'AutoComplete': 'autocomplete', - 'AutoExpand': 'autoexpand', - 'CallTips': 'calltips', - 'CodeContext': 'codecontext', - 'FormatParagraph': 'paragraph', - 'ParenMatch': 'parenmatch', - 'RstripExtension': 'rstrip', - 'ScriptBinding': 'runscript', - 'ZoomHeight': 'zoomheight', + extfiles = { # Map built-in config-extension section names to file names. + 'ZzDummy': 'zzdummy', } def load_extension(self, name): diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py index bbf06504fc2..84b45a63767 100644 --- a/Lib/idlelib/idle_test/test_config.py +++ b/Lib/idlelib/idle_test/test_config.py @@ -437,78 +437,57 @@ def test_get_extensions(self): eq = self.assertEqual eq(conf.GetExtensions(), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['ZzDummy']) eq(conf.GetExtensions(active_only=False), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight', 'DISABLE']) + ['ZzDummy', 'DISABLE']) eq(conf.GetExtensions(editor_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['ZzDummy']) eq(conf.GetExtensions(shell_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'FormatParagraph', - 'ParenMatch', 'ZoomHeight']) + []) eq(conf.GetExtensions(active_only=False, editor_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'DISABLE']) - eq(conf.GetExtensions(active_only=False, shell_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight', 'DISABLE']) + ['ZzDummy', 'DISABLE']) # Add user extensions conf.SetOption('extensions', 'Foobar', 'enable', 'True') eq(conf.GetExtensions(), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'Foobar']) # User extensions didn't sort + ['ZzDummy', 'Foobar']) # User extensions didn't sort eq(conf.GetExtensions(active_only=False), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'DISABLE', 'Foobar']) + ['ZzDummy', 'DISABLE', 'Foobar']) def test_remove_key_bind_names(self): conf = self.mock_config() self.assertCountEqual( conf.RemoveKeyBindNames(conf.GetSectionList('default', 'extensions')), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['AutoComplete', 'CodeContext', 'FormatParagraph', 'ParenMatch','ZzDummy']) def test_get_extn_name_for_event(self): conf = self.mock_config() eq = self.assertEqual - eq(conf.GetExtnNameForEvent('force-open-completions'), 'AutoComplete') - eq(conf.GetExtnNameForEvent('expand-word'), 'AutoExpand') - eq(conf.GetExtnNameForEvent('force-open-calltip'), 'CallTips') - eq(conf.GetExtnNameForEvent('zoom-height'), 'ZoomHeight') + eq(conf.GetExtnNameForEvent('z-in'), 'ZzDummy') + eq(conf.GetExtnNameForEvent('z-out'), None) def test_get_extension_keys(self): conf = self.mock_config() eq = self.assertEqual - eq(conf.GetExtensionKeys('AutoComplete'), - {'<>': ['']}) - eq(conf.GetExtensionKeys('ParenMatch'), - {'<>': ['']}) - - key = [''] if sys.platform == 'darwin' else [''] - eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) + eq(conf.GetExtensionKeys('ZzDummy'), + {'<>': ['']}) +# need option key test +## key = [''] if sys.platform == 'darwin' else [''] +## eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) def test_get_extension_bindings(self): conf = self.mock_config() self.assertEqual(conf.GetExtensionBindings('NotExists'), {}) - key = [''] if sys.platform == 'darwin' else [''] + #key = [''] if sys.platform == 'darwin' else [''] + expect = {'<>': [''], + '<>': ['']} self.assertEqual( - conf.GetExtensionBindings('ZoomHeight'), {'<>': key}) + conf.GetExtensionBindings('ZzDummy'), expect) # Add non-configuarable bindings conf.defaultCfg['extensions'].add_section('Foobar') @@ -542,9 +521,11 @@ def test_get_current_keyset(self): sys.platform = 'some-linux' self.assertEqual(conf.GetCurrentKeySet(), conf.GetKeySet(conf.CurrentKeys())) - # This should not be the same, sicne replace ') self.assertEqual(keyspage, {'my custom keys': {'copy': ''}}) + # Not a core binding - adds to extensions. d.bindingslist.selection_set(1) d.bindingslist.selection_anchor(1) d.keybinding.set('') self.assertEqual(extpage, - {'AutoExpand_cfgBindings': {'expand-word': ''}}) + {'ZzDummy_cfgBindings': {'z-in': ''}}) def test_set_keys_type(self): eq = self.assertEqual @@ -1125,13 +1126,6 @@ def test_startup(self): self.assertEqual(mainpage, {'General': {'editor-on-startup': '0'}}) - def test_autosave(self): - d = self.page - d.save_auto_on.invoke() - self.assertEqual(mainpage, {'General': {'autosave': '1'}}) - d.save_ask_on.invoke() - self.assertEqual(mainpage, {'General': {'autosave': '0'}}) - def test_editor_size(self): d = self.page d.win_height_int.insert(0, '1') @@ -1140,6 +1134,37 @@ def test_editor_size(self): d.win_width_int.insert(0, '1') self.assertEqual(mainpage, {'EditorWindow': {'width': '180'}}) + def test_autocomplete_wait(self): + self.page.auto_wait_int.insert(0, '1') + self.assertEqual(extpage, {'AutoComplete': {'popupwait': '12000'}}) + + def test_parenmatch(self): + d = self.page + eq = self.assertEqual + d.paren_style_type['menu'].invoke(0) + eq(extpage, {'ParenMatch': {'style': 'opener'}}) + changes.clear() + d.paren_flash_time.insert(0, '2') + eq(extpage, {'ParenMatch': {'flash-delay': '2500'}}) + changes.clear() + d.bell_on.invoke() + eq(extpage, {'ParenMatch': {'bell': 'False'}}) + + def test_autosave(self): + d = self.page + d.save_auto_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '1'}}) + d.save_ask_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '0'}}) + + def test_paragraph(self): + self.page.format_width_int.insert(0, '1') + self.assertEqual(extpage, {'FormatParagraph': {'max-width': '172'}}) + + def test_context(self): + self.page.context_int.insert(0, '1') + self.assertEqual(extpage, {'CodeContext': {'numlines': '13'}}) + def test_source_selected(self): d = self.page d.set = d.set_add_delete_state diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py index 65345cd1f16..d1dcb83d932 100644 --- a/Lib/idlelib/mainmenu.py +++ b/Lib/idlelib/mainmenu.py @@ -52,6 +52,11 @@ ('Find in Files...', '<>'), ('R_eplace...', '<>'), ('Go to _Line', '<>'), + ('S_how Completions', '<>'), + ('E_xpand Word', '<>'), + ('Show C_all Tip', '<>'), + ('Show Surrounding P_arens', '<>'), + ]), ('format', [ ('_Indent Region', '<>'), @@ -62,9 +67,13 @@ ('Untabify Region', '<>'), ('Toggle Tabs', '<>'), ('New Indent Width', '<>'), + ('F_ormat Paragraph', '<>'), + ('S_trip Trailing Whitespace', '<>'), ]), ('run', [ ('Python Shell', '<>'), + ('C_heck Module', '<>'), + ('R_un Module', '<>'), ]), ('shell', [ ('_View Last Restart', '<>'), @@ -80,7 +89,10 @@ ]), ('options', [ ('Configure _IDLE', '<>'), - None, + ('_Code Context', '<>'), + ]), + ('windows', [ + ('Zoom Height', '<>'), ]), ('help', [ ('_About IDLE', '<>'), diff --git a/Lib/idlelib/outwin.py b/Lib/idlelib/outwin.py index 5f7c09fb92c..6c2a792d86b 100644 --- a/Lib/idlelib/outwin.py +++ b/Lib/idlelib/outwin.py @@ -77,6 +77,7 @@ class OutputWindow(EditorWindow): def __init__(self, *args): EditorWindow.__init__(self, *args) self.text.bind("<>", self.goto_file_line) + self.text.unbind("<>") # Customize EditorWindow def ispythonsource(self, filename): diff --git a/Lib/idlelib/paragraph.py b/Lib/idlelib/paragraph.py index f11bdaeb77a..cf8dfdb641f 100644 --- a/Lib/idlelib/paragraph.py +++ b/Lib/idlelib/paragraph.py @@ -1,4 +1,4 @@ -"""Extension to format a paragraph or selection to a max width. +"""Format a paragraph, comment block, or selection to a max width. Does basic, standard text formatting, and also understands Python comment blocks. Thus, for editing Python source code, this @@ -21,15 +21,14 @@ class FormatParagraph: - menudefs = [ - ('format', [ # /s/edit/format dscherer at cmu.edu - ('Format Paragraph', '<>'), - ]) - ] - def __init__(self, editwin): self.editwin = editwin + @classmethod + def reload(cls): + cls.max_width = idleConf.GetOption('extensions', 'FormatParagraph', + 'max-width', type='int', default=72) + def close(self): self.editwin = None @@ -45,11 +44,7 @@ def format_paragraph_event(self, event, limit=None): The length limit parameter is for testing with a known value. """ - if limit is None: - # The default length limit is that defined by pep8 - limit = idleConf.GetOption( - 'extensions', 'FormatParagraph', 'max-width', - type='int', default=72) + limit = self.max_width if limit is None else limit text = self.editwin.text first, last = self.editwin.get_selection_indices() if first and last: @@ -75,6 +70,9 @@ def format_paragraph_event(self, event, limit=None): text.see("insert") return "break" + +FormatParagraph.reload() + def find_paragraph(text, mark): """Returns the start/stop indices enclosing the paragraph that mark is in. diff --git a/Lib/idlelib/parenmatch.py b/Lib/idlelib/parenmatch.py index 7f25880ae5e..12212150c6d 100644 --- a/Lib/idlelib/parenmatch.py +++ b/Lib/idlelib/parenmatch.py @@ -1,4 +1,4 @@ -"""ParenMatch -- An IDLE extension for parenthesis matching. +"""ParenMatch -- for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to @@ -30,18 +30,6 @@ class ParenMatch: - Highlight when cursor is moved to the right of a closer. This might be too expensive to check. """ - menudefs = [ - ('edit', [ - ("Show surrounding parens", "<>"), - ]) - ] - STYLE = idleConf.GetOption( - 'extensions','ParenMatch','style', default='expression') - FLASH_DELAY = idleConf.GetOption( - 'extensions','ParenMatch','flash-delay', type='int',default=500) - BELL = idleConf.GetOption( - 'extensions','ParenMatch','bell', type='bool',default=1) - HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(),'hilite') RESTORE_VIRTUAL_EVENT_NAME = "<>" # We want the restore event be called before the usual return and @@ -62,6 +50,17 @@ def __init__(self, editwin): self.is_restore_active = 0 self.set_style(self.STYLE) + @classmethod + def reload(cls): + cls.STYLE = idleConf.GetOption( + 'extensions','ParenMatch','style', default='opener') + cls.FLASH_DELAY = idleConf.GetOption( + 'extensions','ParenMatch','flash-delay', type='int',default=500) + cls.BELL = idleConf.GetOption( + 'extensions','ParenMatch','bell', type='bool', default=1) + cls.HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(), + 'hilite') + def activate_restore(self): "Activate mechanism to restore text from highlighting." if not self.is_restore_active: @@ -181,6 +180,9 @@ def set_timeout_last(self): lambda self=self, c=self.counter: self.handle_restore_timer(c)) +ParenMatch.reload() + + if __name__ == '__main__': import unittest unittest.main('idlelib.idle_test.test_parenmatch', verbosity=2) diff --git a/Lib/idlelib/rstrip.py b/Lib/idlelib/rstrip.py index 2ce3c7eafe5..18c86f9b2c8 100644 --- a/Lib/idlelib/rstrip.py +++ b/Lib/idlelib/rstrip.py @@ -2,12 +2,8 @@ class RstripExtension: - menudefs = [ - ('format', [None, ('Strip trailing whitespace', '<>'), ] ), ] - def __init__(self, editwin): self.editwin = editwin - self.editwin.text.bind("<>", self.do_rstrip) def do_rstrip(self, event=None): diff --git a/Lib/idlelib/runscript.py b/Lib/idlelib/runscript.py index 3355f17d90b..45bf5634582 100644 --- a/Lib/idlelib/runscript.py +++ b/Lib/idlelib/runscript.py @@ -1,22 +1,14 @@ -"""Extension to execute code outside the Python shell window. +"""Execute code from an editor. -This adds the following commands: +Check module: do a full syntax check of the current module. +Also run the tabnanny to catch any inconsistent tabs. -- Check module does a full syntax check of the current module. - It also runs the tabnanny to catch any inconsistent tabs. - -- Run module executes the module's code in the __main__ namespace. The window - must have been saved previously. The module is added to sys.modules, and is - also added to the __main__ namespace. - -XXX GvR Redesign this interface (yet again) as follows: - -- Present a dialog box for ``Run Module'' - -- Allow specify command line arguments in the dialog box +Run module: also execute the module's code in the __main__ namespace. +The window must have been saved previously. The module is added to +sys.modules, and is also added to the __main__ namespace. +TODO: Specify command line arguments in a dialog box. """ - import os import tabnanny import tokenize @@ -40,11 +32,6 @@ class ScriptBinding: - menudefs = [ - ('run', [None, - ('Check Module', '<>'), - ('Run Module', '<>'), ]), ] - def __init__(self, editwin): self.editwin = editwin # Provide instance variables referenced by debugger diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index d01c9e964aa..74fbc888a80 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -1,4 +1,4 @@ -# Sample extension: zoom a window to maximum height +"Zoom a window to maximum height." import re import sys @@ -8,12 +8,6 @@ class ZoomHeight: - menudefs = [ - ('windows', [ - ('_Zoom Height', '<>'), - ]) - ] - def __init__(self, editwin): self.editwin = editwin diff --git a/Lib/idlelib/zzdummy.py b/Lib/idlelib/zzdummy.py new file mode 100644 index 00000000000..80844996466 --- /dev/null +++ b/Lib/idlelib/zzdummy.py @@ -0,0 +1,42 @@ +"Example extension, also used for testing." + +from idlelib.config import idleConf + +ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') + + +class ZzDummy: + +## menudefs = [ +## ('format', [ +## ('Z in', '<>'), +## ('Z out', '<>'), +## ] ) +## ] + + def __init__(self, editwin): + self.text = editwin.text + z_in = False + + @classmethod + def reload(cls): + cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') + + def z_in_event(self, event): + """ + """ + text = self.text + text.undo_block_start() + for line in range(1, text.index('end')): + text.insert('%d.0', ztest) + text.undo_block_stop() + return "break" + + def z_out_event(self, event): pass + +ZzDummy.reload() + +##if __name__ == "__main__": +## import unittest +## unittest.main('idlelib.idle_test.test_zzdummy', +## verbosity=2, exit=False) diff --git a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst new file mode 100644 index 00000000000..9b59fbabe53 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst @@ -0,0 +1,20 @@ +Convert IDLE's built-in 'extensions' to regular features. + +About 10 IDLE features were implemented as supposedly optional +extensions. Their different behavior could be confusing or worse for +users and not good for maintenance. Hence the conversion. + +The main difference for users is that user configurable key bindings +for builtin features are now handled uniformly. Now, editing a binding +in a keyset only affects its value in the keyset. All bindings are +defined together in the system-specific default keysets in config- +extensions.def. All custom keysets are saved as a whole in config- +extension.cfg. All take effect as soon as one clicks Apply or Ok. + +The affected events are '<>', '<>', +'<>', '<>', '<>', +'<>', '<>', and '<>'. Any +(global) customizations made before 3.6.3 will not affect their keyset- +specific customization after 3.6.3. and vice versa. + +Inital patch by Charles Wohlganger. From webhook-mailer at python.org Sun Sep 10 20:30:49 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 00:30:49 -0000 Subject: [Python-checkins] [3.6] bpo-27099: IDLE - Convert built-in extensions to regular features (GH-2494) (#3487) Message-ID: https://github.com/python/cpython/commit/d6c397bf772a8f17e00afc5e0a2cf37fdebcdf29 commit: d6c397bf772a8f17e00afc5e0a2cf37fdebcdf29 branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-09-10T20:30:46-04:00 summary: [3.6] bpo-27099: IDLE - Convert built-in extensions to regular features (GH-2494) (#3487) About 10 IDLE features were implemented as supposedly optional extensions. Their different behavior could be confusing or worse for users and not good for maintenance. Hence the conversion. The main difference for users is that user configurable key bindings for builtin features are now handled uniformly. Now, editing a binding in a keyset only affects its value in the keyset. All bindings are defined together in the system-specific default keysets in config- extensions.def. All custom keysets are saved as a whole in config- extension.cfg. All take effect as soon as one clicks Apply or Ok. The affected events are '<>', '<>', '<>', '<>', '<>', '<>', '<>', and '<>'. Any (global) customizations made before 3.6.3 will not affect their keyset- specific customization after 3.6.3. and vice versa. Inital patch by Charles Wohlganger, revised by Terry Jan Reedy. (cherry picked from commit 58fc71c) files: A Lib/idlelib/zzdummy.py A Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst M Doc/library/idle.rst M Lib/idlelib/autocomplete.py M Lib/idlelib/autoexpand.py M Lib/idlelib/calltips.py M Lib/idlelib/codecontext.py M Lib/idlelib/config-extensions.def M Lib/idlelib/config-keys.def M Lib/idlelib/config.py M Lib/idlelib/configdialog.py M Lib/idlelib/editor.py M Lib/idlelib/idle_test/test_config.py M Lib/idlelib/idle_test/test_configdialog.py M Lib/idlelib/mainmenu.py M Lib/idlelib/outwin.py M Lib/idlelib/paragraph.py M Lib/idlelib/parenmatch.py M Lib/idlelib/rstrip.py M Lib/idlelib/runscript.py M Lib/idlelib/zoomheight.py diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index a945b6d7712..4f51f3f0ac2 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -672,23 +672,6 @@ Extensions IDLE contains an extension facility. Preferences for extensions can be changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The default extensions -are currently: - -* FormatParagraph - -* AutoExpand - -* ZoomHeight - -* ScriptBinding - -* CallTips - -* ParenMatch - -* AutoComplete - -* CodeContext - -* RstripExtension +in the idlelib directory for further information. The only current default +extension is zoomheight. It exists as an extension primarily to be an example +and for testing purposes. \ No newline at end of file diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index cd212ccb143..edf445f08b5 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -1,7 +1,7 @@ -"""autocomplete.py - An IDLE extension for automatically completing names. +"""Complete either attribute names or file names. -This extension can complete either attribute names or file names. It can pop -a window with all available names, for the user to select from. +Either on demand or after a user-selected delay after a key character, +pop up a list of candidates. """ import os import string @@ -27,18 +27,9 @@ class AutoComplete: - menudefs = [ - ('edit', [ - ("Show Completions", "<>"), - ]) - ] - - popupwait = idleConf.GetOption("extensions", "AutoComplete", - "popupwait", type="int", default=0) - def __init__(self, editwin=None): self.editwin = editwin - if editwin is not None: # not in subprocess or test + if editwin is not None: # not in subprocess or test self.text = editwin.text self.autocompletewindow = None # id of delayed call, and the index of the text insert when @@ -47,6 +38,11 @@ def __init__(self, editwin=None): self._delayed_completion_id = None self._delayed_completion_index = None + @classmethod + def reload(cls): + cls.popupwait = idleConf.GetOption( + "extensions", "AutoComplete", "popupwait", type="int", default=0) + def _make_autocomplete_window(self): return autocomplete_w.AutoCompleteWindow(self.text) @@ -228,6 +224,9 @@ def get_entity(self, name): return eval(name, namespace) +AutoComplete.reload() + + if __name__ == '__main__': from unittest import main main('idlelib.idle_test.test_autocomplete', verbosity=2) diff --git a/Lib/idlelib/autoexpand.py b/Lib/idlelib/autoexpand.py index 6b46bee69c9..42e733a1a9e 100644 --- a/Lib/idlelib/autoexpand.py +++ b/Lib/idlelib/autoexpand.py @@ -10,23 +10,13 @@ place before requesting the next selection causes AutoExpand to reset its state. -This is an extension file and there is only one instance of AutoExpand. +There is only one instance of Autoexpand. ''' import re import string -###$ event <> -###$ win -###$ unix class AutoExpand: - - menudefs = [ - ('edit', [ - ('E_xpand Word', '<>'), - ]), - ] - wordchars = string.ascii_letters + string.digits + "_" def __init__(self, editwin): @@ -100,6 +90,7 @@ def getprevword(self): i = i-1 return line[i:] + if __name__ == '__main__': import unittest unittest.main('idlelib.idle_test.test_autoexpand', verbosity=2) diff --git a/Lib/idlelib/calltips.py b/Lib/idlelib/calltips.py index 49625eac158..ec8f6169895 100644 --- a/Lib/idlelib/calltips.py +++ b/Lib/idlelib/calltips.py @@ -1,9 +1,8 @@ -"""calltips.py - An IDLE Extension to Jog Your Memory +"""Pop up a reminder of how to call a function. Call Tips are floating windows which display function, class, and method parameter and docstring information when you type an opening parenthesis, and which disappear when you type a closing parenthesis. - """ import inspect import re @@ -15,13 +14,8 @@ from idlelib.hyperparser import HyperParser import __main__ -class CallTips: - menudefs = [ - ('edit', [ - ("Show call tip", "<>"), - ]) - ] +class CallTips: def __init__(self, editwin=None): if editwin is None: # subprocess and test @@ -103,6 +97,7 @@ def fetch_tip(self, expression): else: return get_argspec(get_entity(expression)) + def get_entity(expression): """Return the object corresponding to expression evaluated in a namespace spanning sys.modules and __main.dict__. @@ -126,7 +121,6 @@ def get_entity(expression): _invalid_method = "invalid method signature" _argument_positional = "\n['/' marks preceding arguments as positional-only]\n" - def get_argspec(ob): '''Return a string describing the signature of a callable object, or ''. diff --git a/Lib/idlelib/codecontext.py b/Lib/idlelib/codecontext.py index 09dc078d63f..779b5b88cf3 100644 --- a/Lib/idlelib/codecontext.py +++ b/Lib/idlelib/codecontext.py @@ -1,4 +1,4 @@ -"""codecontext - Extension to display the block context above the edit window +"""codecontext - display the block context above the edit window Once code has scrolled off the top of a window, it can be difficult to determine which block you are in. This extension implements a pane at the top @@ -25,10 +25,8 @@ getspacesfirstword =\ lambda s, c=re.compile(r"^(\s*)(\w*)"): c.match(s).groups() + class CodeContext: - menudefs = [('options', [('!Code Conte_xt', '<>')])] - context_depth = idleConf.GetOption("extensions", "CodeContext", - "numlines", type="int", default=3) bgcolor = idleConf.GetOption("extensions", "CodeContext", "bgcolor", type="str", default="LightGray") fgcolor = idleConf.GetOption("extensions", "CodeContext", @@ -45,15 +43,20 @@ def __init__(self, editwin): # starts the toplevel 'block' of the module. self.info = [(0, -1, "", False)] self.topvisible = 1 - visible = idleConf.GetOption("extensions", "CodeContext", - "visible", type="bool", default=False) - if visible: - self.toggle_code_context_event() - self.editwin.setvar('<>', True) + self.reload() # Start two update cycles, one for context lines, one for font changes. self.text.after(UPDATEINTERVAL, self.timer_event) self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + @classmethod + def reload(cls): + cls.context_depth = idleConf.GetOption("extensions", "CodeContext", + "numlines", type="int", default=3) + cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", + "bgcolor", type="str", default="LightGray") + cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", + "fgcolor", type="str", default="Black") + def toggle_code_context_event(self, event=None): if not self.label: # Calculate the border width and horizontal padding required to @@ -86,7 +89,7 @@ def toggle_code_context_event(self, event=None): else: self.label.destroy() self.label = None - idleConf.SetOption("extensions", "CodeContext", "visible", + idleConf.SetOption("main", "Theme", "contexton", str(self.label is not None)) idleConf.SaveUserCfgFiles() return "break" @@ -177,3 +180,6 @@ def font_timer_event(self): self.textfont = newtextfont self.label["font"] = self.textfont self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + + +CodeContext.reload() diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index a24b8c9316b..e8d417bac0d 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -1,5 +1,25 @@ # config-extensions.def # +# The following sections are for features that are no longer extensions. +# Their options values are left here for back-compatibility. + +[AutoComplete] +popupwait= 2000 + +[CodeContext] +numlines= 3 +visible= False +bgcolor= LightGray +fgcolor= Black + +[FormatParagraph] +max-width= 72 + +[ParenMatch] +style= expression +flash-delay= 500 +bell= True + # IDLE reads several config files to determine user preferences. This # file is the default configuration file for IDLE extensions settings. # @@ -19,7 +39,7 @@ # extension that may be sensibly re-configured. # # If there are no keybindings for a menus' virtual events, include lines -# like <>= (See [CodeContext], below.) +# like <>=. # # Currently it is necessary to manually modify this file to change # extension key bindings and default values. To customize, create @@ -32,68 +52,14 @@ # See config-keys.def for notes on specifying keys and extend.txt for # information on creating IDLE extensions. -[AutoComplete] -enable=True -popupwait=2000 -[AutoComplete_cfgBindings] -force-open-completions= -[AutoComplete_bindings] -autocomplete= -try-open-completions= - -[AutoExpand] -enable=True -[AutoExpand_cfgBindings] -expand-word= - -[CallTips] -enable=True -[CallTips_cfgBindings] -force-open-calltip= -[CallTips_bindings] -try-open-calltip= -refresh-calltip= - -[CodeContext] -enable=True -enable_shell=False -numlines=3 -visible=False -bgcolor=LightGray -fgcolor=Black -[CodeContext_bindings] -toggle-code-context= - -[FormatParagraph] -enable=True -max-width=72 -[FormatParagraph_cfgBindings] -format-paragraph= - -[ParenMatch] -enable=True -style= expression -flash-delay= 500 -bell=True -[ParenMatch_cfgBindings] -flash-paren= -[ParenMatch_bindings] -paren-closed= - -[RstripExtension] -enable=True -enable_shell=False -enable_editor=True - -[ScriptBinding] -enable=True -enable_shell=False -enable_editor=True -[ScriptBinding_cfgBindings] -run-module= -check-module= - -[ZoomHeight] -enable=True -[ZoomHeight_cfgBindings] -zoom-height= +# A fake extension for testing and example purposes. When enabled and +# invoked, inserts or deletes z-text at beginning of every line. +[ZzDummy] +enable= True +enable_shell = False +enable_editor = True +z-text= Z +[ZzDummy_cfgBindings] +z-in= +[ZzDummy_bindings] +z-out= diff --git a/Lib/idlelib/config-keys.def b/Lib/idlelib/config-keys.def index 64788f9adf0..fd235194dfc 100644 --- a/Lib/idlelib/config-keys.def +++ b/Lib/idlelib/config-keys.def @@ -57,6 +57,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic Unix] copy= @@ -108,6 +116,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Modern Unix] copy = @@ -159,6 +175,14 @@ toggle-tabs = change-indentwidth = del-word-left = del-word-right = +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic Mac] copy= @@ -210,6 +234,14 @@ toggle-tabs= change-indentwidth= del-word-left= del-word-right= +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= [IDLE Classic OSX] toggle-tabs = @@ -262,4 +294,11 @@ python-context-help = save-copy-of-window-as-file = open-window-from-file = python-docs = - +force-open-completions= +expand-word= +force-open-calltip= +format-paragraph= +flash-paren= +run-module= +check-module= +zoom-height= diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py index 63d9a442345..c3e57bc692d 100644 --- a/Lib/idlelib/config.py +++ b/Lib/idlelib/config.py @@ -359,7 +359,8 @@ def GetThemeDict(self, type, themeName): 'stderr-foreground':'#000000', 'stderr-background':'#ffffff', 'console-foreground':'#000000', - 'console-background':'#ffffff' } + 'console-background':'#ffffff', + } for element in theme: if not cfgParser.has_option(themeName, element): # Print warning that will return a default color @@ -443,6 +444,11 @@ def GetExtensions(self, active_only=True, for extn in userExtns: if extn not in extns: #user has added own extension extns.append(extn) + for extn in ('AutoComplete','CodeContext', + 'FormatParagraph','ParenMatch'): + extns.remove(extn) + # specific exclusions because we are storing config for mainlined old + # extensions in config-extensions.def for backward compatibility if active_only: activeExtns = [] for extn in extns: @@ -594,7 +600,12 @@ def IsCoreBinding(self, virtualEvent): return ('<<'+virtualEvent+'>>') in self.GetCoreKeys() # TODO make keyBindins a file or class attribute used for test above -# and copied in function below +# and copied in function below. + + former_extension_events = { # Those with user-configurable keys. + '<>', '<>', + '<>', '<>', '<>', + '<>', '<>', '<>'} def GetCoreKeys(self, keySetName=None): """Return dict of core virtual-key keybindings for keySetName. @@ -654,8 +665,17 @@ def GetCoreKeys(self, keySetName=None): '<>': [''], '<>': [''], '<>': [''], - '<>': [''] + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], + '<>': [''], } + if keySetName: if not (self.userCfg['keys'].has_section(keySetName) or self.defaultCfg['keys'].has_section(keySetName)): @@ -670,7 +690,8 @@ def GetCoreKeys(self, keySetName=None): binding = self.GetKeyBinding(keySetName, event) if binding: keyBindings[event] = binding - else: #we are going to return a default, print warning + # Otherwise return default in keyBindings. + elif event not in self.former_extension_events: warning = ( '\n Warning: config.py - IdleConf.GetCoreKeys -\n' ' problem retrieving key binding for event %r\n' diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 4ef6197e714..604719f0453 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -15,7 +15,7 @@ NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW, HORIZONTAL, VERTICAL, ANCHOR, ACTIVE, END) from tkinter.ttk import (Button, Checkbutton, Entry, Frame, Label, LabelFrame, - Notebook, Radiobutton, Scrollbar, Style) + OptionMenu, Notebook, Radiobutton, Scrollbar, Style) import tkinter.colorchooser as tkColorChooser import tkinter.font as tkFont from tkinter import messagebox @@ -198,7 +198,6 @@ def help(self): def deactivate_current_config(self): """Remove current key bindings. - Iterate over window instances defined in parent and remove the keybindings. """ @@ -288,6 +287,7 @@ def load_extensions(self): "Fill self.extensions with data from the default and user configs." self.extensions = {} for ext_name in idleConf.GetExtensions(active_only=False): + # Former built-in extensions are already filtered out. self.extensions[ext_name] = [] for ext_name in self.extensions: @@ -796,7 +796,8 @@ def create_page_highlight(self): takefocus=FALSE, highlightthickness=0, wrap=NONE) text.bind('', lambda e: 'break') text.bind('', lambda e: 'break') - text_and_tags=(('\n', 'normal'), + text_and_tags=( + ('\n', 'normal'), ('#you can click here', 'comment'), ('\n', 'normal'), ('#to choose items', 'comment'), ('\n', 'normal'), ('def', 'keyword'), (' ', 'normal'), @@ -858,11 +859,10 @@ def tem(event, elem=element): frame_theme, text='Delete Custom Theme', command=self.delete_custom) self.theme_message = Label(frame_theme, borderwidth=2) - # Pack widgets: # body. frame_custom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH) - frame_theme.pack(side=LEFT, padx=5, pady=5, fill=Y) + frame_theme.pack(side=TOP, padx=5, pady=5, fill=X) # frame_custom. self.frame_color_set.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X) frame_fg_bg_toggle.pack(side=TOP, padx=5, pady=0) @@ -1764,15 +1764,30 @@ def create_page_general(self): (*)helplist: ListBox scroll_helplist: Scrollbar """ + # Integer values need StringVar because int('') raises. self.startup_edit = tracers.add( IntVar(self), ('main', 'General', 'editor-on-startup')) - self.autosave = tracers.add( - IntVar(self), ('main', 'General', 'autosave')) self.win_width = tracers.add( StringVar(self), ('main', 'EditorWindow', 'width')) self.win_height = tracers.add( StringVar(self), ('main', 'EditorWindow', 'height')) + self.autocomplete_wait = tracers.add( + StringVar(self), ('extensions', 'AutoComplete', 'popupwait')) + self.paren_style = tracers.add( + StringVar(self), ('extensions', 'ParenMatch', 'style')) + self.flash_delay = tracers.add( + StringVar(self), ('extensions', 'ParenMatch', 'flash-delay')) + self.paren_bell = tracers.add( + BooleanVar(self), ('extensions', 'ParenMatch', 'bell')) + + self.autosave = tracers.add( + IntVar(self), ('main', 'General', 'autosave')) + self.format_width = tracers.add( + StringVar(self), ('extensions', 'FormatParagraph', 'max-width')) + self.context_lines = tracers.add( + StringVar(self), ('extensions', 'CodeContext', 'numlines')) + # Create widgets: # Section frames. frame_window = LabelFrame(self, borderwidth=2, relief=GROOVE, text=' Window Preferences') @@ -1790,7 +1805,7 @@ def create_page_general(self): frame_run, variable=self.startup_edit, value=0, text='Open Shell Window') - frame_win_size = Frame(frame_window, borderwidth=0,) + frame_win_size = Frame(frame_window, borderwidth=0) win_size_title = Label( frame_win_size, text='Initial Window Size (in characters)') win_width_title = Label(frame_win_size, text='Width') @@ -1800,6 +1815,26 @@ def create_page_general(self): self.win_height_int = Entry( frame_win_size, textvariable=self.win_height, width=3) + frame_autocomplete = Frame(frame_window, borderwidth=0,) + auto_wait_title = Label(frame_autocomplete, + text='Completions Popup Wait (milliseconds)') + self.auto_wait_int = Entry(frame_autocomplete, width=6, + textvariable=self.autocomplete_wait) + + frame_paren1 = Frame(frame_window, borderwidth=0) + paren_style_title = Label(frame_paren1, text='Paren Match Style') + self.paren_style_type = OptionMenu( + frame_paren1, self.paren_style, 'expression', + "opener","parens","expression") + frame_paren2 = Frame(frame_window, borderwidth=0) + paren_time_title = Label( + frame_paren2, text='Time Match Displayed (milliseconds)\n' + '(0 is until next input)') + self.paren_flash_time = Entry( + frame_paren2, textvariable=self.flash_delay, width=6) + self.bell_on = Checkbutton( + frame_paren2, text="Bell on Mismatch", variable=self.paren_bell) + # Frame_editor. frame_save = Frame(frame_editor, borderwidth=0) run_save_title = Label(frame_save, text='At Start of Run (F5) ') @@ -1810,6 +1845,18 @@ def create_page_general(self): frame_save, variable=self.autosave, value=1, text='No Prompt') + frame_format = Frame(frame_editor, borderwidth=0) + format_width_title = Label(frame_format, + text='Format Paragraph Max Width') + self.format_width_int = Entry( + frame_format, textvariable=self.format_width, width=4) + + frame_context = Frame(frame_editor, borderwidth=0) + context_title = Label(frame_context, text='Context Lines :') + self.context_int = Entry( + frame_context, textvariable=self.context_lines, width=3) + + # frame_help. frame_helplist = Frame(frame_help) frame_helplist_buttons = Frame(frame_helplist) @@ -1847,11 +1894,33 @@ def create_page_general(self): win_height_title.pack(side=RIGHT, anchor=E, pady=5) self.win_width_int.pack(side=RIGHT, anchor=E, padx=10, pady=5) win_width_title.pack(side=RIGHT, anchor=E, pady=5) + # frame_autocomplete. + frame_autocomplete.pack(side=TOP, padx=5, pady=0, fill=X) + auto_wait_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.auto_wait_int.pack(side=TOP, padx=10, pady=5) + # frame_paren. + frame_paren1.pack(side=TOP, padx=5, pady=0, fill=X) + paren_style_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.paren_style_type.pack(side=TOP, padx=10, pady=5) + frame_paren2.pack(side=TOP, padx=5, pady=0, fill=X) + paren_time_title.pack(side=LEFT, anchor=W, padx=5) + self.bell_on.pack(side=RIGHT, anchor=E, padx=15, pady=5) + self.paren_flash_time.pack(side=TOP, anchor=W, padx=15, pady=5) + # frame_save. frame_save.pack(side=TOP, padx=5, pady=0, fill=X) run_save_title.pack(side=LEFT, anchor=W, padx=5, pady=5) self.save_auto_on.pack(side=RIGHT, anchor=W, padx=5, pady=5) self.save_ask_on.pack(side=RIGHT, anchor=W, padx=5, pady=5) + # frame_format. + frame_format.pack(side=TOP, padx=5, pady=0, fill=X) + format_width_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.format_width_int.pack(side=TOP, padx=10, pady=5) + # frame_context. + frame_context.pack(side=TOP, padx=5, pady=0, fill=X) + context_title.pack(side=LEFT, anchor=W, padx=5, pady=5) + self.context_int.pack(side=TOP, padx=5, pady=5) + # frame_help. frame_helplist_buttons.pack(side=RIGHT, padx=5, pady=5, fill=Y) frame_helplist.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH) @@ -1863,17 +1932,30 @@ def create_page_general(self): def load_general_cfg(self): "Load current configuration settings for the general options." - # Set startup state. + # Set variables for all windows. self.startup_edit.set(idleConf.GetOption( - 'main', 'General', 'editor-on-startup', default=0, type='bool')) - # Set autosave state. - self.autosave.set(idleConf.GetOption( - 'main', 'General', 'autosave', default=0, type='bool')) - # Set initial window size. + 'main', 'General', 'editor-on-startup', type='bool')) self.win_width.set(idleConf.GetOption( 'main', 'EditorWindow', 'width', type='int')) self.win_height.set(idleConf.GetOption( 'main', 'EditorWindow', 'height', type='int')) + self.autocomplete_wait.set(idleConf.GetOption( + 'extensions', 'AutoComplete', 'popupwait', type='int')) + self.paren_style.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'style')) + self.flash_delay.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'flash-delay', type='int')) + self.paren_bell.set(idleConf.GetOption( + 'extensions', 'ParenMatch', 'bell')) + + # Set variables for editor windows. + self.autosave.set(idleConf.GetOption( + 'main', 'General', 'autosave', default=0, type='bool')) + self.format_width.set(idleConf.GetOption( + 'extensions', 'FormatParagraph', 'max-width', type='int')) + self.context_lines.set(idleConf.GetOption( + 'extensions', 'CodeContext', 'numlines', type='int')) + # Set additional help sources. self.user_helplist = idleConf.GetAllExtraHelpSourcesList() self.helplist.delete(0, 'end') @@ -2034,10 +2116,10 @@ def detach(self): be used with older IDLE releases if it is saved as a custom key set, with a different name. ''', - 'Extensions': ''' -Extensions: + 'General': ''' +General: -Autocomplete: Popupwait is milleseconds to wait after key char, without +AutoComplete: Popupwait is milleseconds to wait after key char, without cursor movement, before popping up completion box. Key char is '.' after identifier or a '/' (or '\\' on Windows) within a string. diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 43b105f7265..855d3750556 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -31,7 +31,6 @@ TK_TABWIDTH_DEFAULT = 8 _py_version = ' (%s)' % platform.python_version() - def _sphinx_version(): "Format sys.version_info to produce the Sphinx version string used to install the chm docs" major, minor, micro, level, serial = sys.version_info @@ -52,11 +51,22 @@ class EditorWindow(object): from idlelib import mainmenu from tkinter import Toplevel from idlelib.statusbar import MultiStatusBar + from idlelib.autocomplete import AutoComplete + from idlelib.autoexpand import AutoExpand + from idlelib.calltips import CallTips + from idlelib.codecontext import CodeContext + from idlelib.paragraph import FormatParagraph + from idlelib.parenmatch import ParenMatch + from idlelib.rstrip import RstripExtension + from idlelib.zoomheight import ZoomHeight filesystemencoding = sys.getfilesystemencoding() # for file names help_url = None def __init__(self, flist=None, filename=None, key=None, root=None): + # Delay import: runscript imports pyshell imports EditorWindow. + from idlelib.runscript import ScriptBinding + if EditorWindow.help_url is None: dochome = os.path.join(sys.base_prefix, 'Doc', 'index.html') if sys.platform.count('linux'): @@ -84,7 +94,8 @@ def __init__(self, flist=None, filename=None, key=None, root=None): # Safari requires real file:-URLs EditorWindow.help_url = 'file://' + EditorWindow.help_url else: - EditorWindow.help_url = "https://docs.python.org/%d.%d/" % sys.version_info[:2] + EditorWindow.help_url = ("https://docs.python.org/%d.%d/" + % sys.version_info[:2]) self.flist = flist root = root or flist.root self.root = root @@ -270,6 +281,43 @@ def __init__(self, flist=None, filename=None, key=None, root=None): self.askinteger = tkSimpleDialog.askinteger self.showerror = tkMessageBox.showerror + # Add pseudoevents for former extension fixed keys. + # (This probably needs to be done once in the process.) + text.event_add('<>', '') + text.event_add('<>', '', + '', '') + text.event_add('<>', '') + text.event_add('<>', '') + text.event_add('<>', '', + '', '') + + # Former extension bindings depends on frame.text being packed + # (called from self.ResetColorizer()). + autocomplete = self.AutoComplete(self) + text.bind("<>", autocomplete.autocomplete_event) + text.bind("<>", + autocomplete.try_open_completions_event) + text.bind("<>", + autocomplete.force_open_completions_event) + text.bind("<>", self.AutoExpand(self).expand_word_event) + text.bind("<>", + self.FormatParagraph(self).format_paragraph_event) + parenmatch = self.ParenMatch(self) + text.bind("<>", parenmatch.flash_paren_event) + text.bind("<>", parenmatch.paren_closed_event) + scriptbinding = ScriptBinding(self) + text.bind("<>", scriptbinding.check_module_event) + text.bind("<>", scriptbinding.run_module_event) + text.bind("<>", self.RstripExtension(self).do_rstrip) + calltips = self.CallTips(self) + text.bind("<>", calltips.try_open_calltip_event) + #refresh-calltips must come after paren-closed to work right + text.bind("<>", calltips.refresh_calltip_event) + text.bind("<>", calltips.force_open_calltip_event) + text.bind("<>", self.ZoomHeight(self).zoom_height_event) + text.bind("<>", + self.CodeContext(self).toggle_code_context_event) + def _filename_to_unicode(self, filename): """Return filename as BMP unicode so diplayable in Tk.""" # Decode bytes to unicode. @@ -981,16 +1029,8 @@ def load_standard_extensions(self): def get_standard_extension_names(self): return idleConf.GetExtensions(editor_only=True) - extfiles = { # map config-extension section names to new file names - 'AutoComplete': 'autocomplete', - 'AutoExpand': 'autoexpand', - 'CallTips': 'calltips', - 'CodeContext': 'codecontext', - 'FormatParagraph': 'paragraph', - 'ParenMatch': 'parenmatch', - 'RstripExtension': 'rstrip', - 'ScriptBinding': 'runscript', - 'ZoomHeight': 'zoomheight', + extfiles = { # Map built-in config-extension section names to file names. + 'ZzDummy': 'zzdummy', } def load_extension(self, name): diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py index bbf06504fc2..84b45a63767 100644 --- a/Lib/idlelib/idle_test/test_config.py +++ b/Lib/idlelib/idle_test/test_config.py @@ -437,78 +437,57 @@ def test_get_extensions(self): eq = self.assertEqual eq(conf.GetExtensions(), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['ZzDummy']) eq(conf.GetExtensions(active_only=False), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight', 'DISABLE']) + ['ZzDummy', 'DISABLE']) eq(conf.GetExtensions(editor_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['ZzDummy']) eq(conf.GetExtensions(shell_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'FormatParagraph', - 'ParenMatch', 'ZoomHeight']) + []) eq(conf.GetExtensions(active_only=False, editor_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'DISABLE']) - eq(conf.GetExtensions(active_only=False, shell_only=True), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight', 'DISABLE']) + ['ZzDummy', 'DISABLE']) # Add user extensions conf.SetOption('extensions', 'Foobar', 'enable', 'True') eq(conf.GetExtensions(), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'Foobar']) # User extensions didn't sort + ['ZzDummy', 'Foobar']) # User extensions didn't sort eq(conf.GetExtensions(active_only=False), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', - 'ScriptBinding', 'ZoomHeight', 'DISABLE', 'Foobar']) + ['ZzDummy', 'DISABLE', 'Foobar']) def test_remove_key_bind_names(self): conf = self.mock_config() self.assertCountEqual( conf.RemoveKeyBindNames(conf.GetSectionList('default', 'extensions')), - ['AutoComplete', 'AutoExpand', 'CallTips', 'CodeContext', - 'FormatParagraph', 'ParenMatch', 'RstripExtension', 'ScriptBinding', - 'ZoomHeight']) + ['AutoComplete', 'CodeContext', 'FormatParagraph', 'ParenMatch','ZzDummy']) def test_get_extn_name_for_event(self): conf = self.mock_config() eq = self.assertEqual - eq(conf.GetExtnNameForEvent('force-open-completions'), 'AutoComplete') - eq(conf.GetExtnNameForEvent('expand-word'), 'AutoExpand') - eq(conf.GetExtnNameForEvent('force-open-calltip'), 'CallTips') - eq(conf.GetExtnNameForEvent('zoom-height'), 'ZoomHeight') + eq(conf.GetExtnNameForEvent('z-in'), 'ZzDummy') + eq(conf.GetExtnNameForEvent('z-out'), None) def test_get_extension_keys(self): conf = self.mock_config() eq = self.assertEqual - eq(conf.GetExtensionKeys('AutoComplete'), - {'<>': ['']}) - eq(conf.GetExtensionKeys('ParenMatch'), - {'<>': ['']}) - - key = [''] if sys.platform == 'darwin' else [''] - eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) + eq(conf.GetExtensionKeys('ZzDummy'), + {'<>': ['']}) +# need option key test +## key = [''] if sys.platform == 'darwin' else [''] +## eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) def test_get_extension_bindings(self): conf = self.mock_config() self.assertEqual(conf.GetExtensionBindings('NotExists'), {}) - key = [''] if sys.platform == 'darwin' else [''] + #key = [''] if sys.platform == 'darwin' else [''] + expect = {'<>': [''], + '<>': ['']} self.assertEqual( - conf.GetExtensionBindings('ZoomHeight'), {'<>': key}) + conf.GetExtensionBindings('ZzDummy'), expect) # Add non-configuarable bindings conf.defaultCfg['extensions'].add_section('Foobar') @@ -542,9 +521,11 @@ def test_get_current_keyset(self): sys.platform = 'some-linux' self.assertEqual(conf.GetCurrentKeySet(), conf.GetKeySet(conf.CurrentKeys())) - # This should not be the same, sicne replace ') self.assertEqual(keyspage, {'my custom keys': {'copy': ''}}) + # Not a core binding - adds to extensions. d.bindingslist.selection_set(1) d.bindingslist.selection_anchor(1) d.keybinding.set('') self.assertEqual(extpage, - {'AutoExpand_cfgBindings': {'expand-word': ''}}) + {'ZzDummy_cfgBindings': {'z-in': ''}}) def test_set_keys_type(self): eq = self.assertEqual @@ -1125,13 +1126,6 @@ def test_startup(self): self.assertEqual(mainpage, {'General': {'editor-on-startup': '0'}}) - def test_autosave(self): - d = self.page - d.save_auto_on.invoke() - self.assertEqual(mainpage, {'General': {'autosave': '1'}}) - d.save_ask_on.invoke() - self.assertEqual(mainpage, {'General': {'autosave': '0'}}) - def test_editor_size(self): d = self.page d.win_height_int.insert(0, '1') @@ -1140,6 +1134,37 @@ def test_editor_size(self): d.win_width_int.insert(0, '1') self.assertEqual(mainpage, {'EditorWindow': {'width': '180'}}) + def test_autocomplete_wait(self): + self.page.auto_wait_int.insert(0, '1') + self.assertEqual(extpage, {'AutoComplete': {'popupwait': '12000'}}) + + def test_parenmatch(self): + d = self.page + eq = self.assertEqual + d.paren_style_type['menu'].invoke(0) + eq(extpage, {'ParenMatch': {'style': 'opener'}}) + changes.clear() + d.paren_flash_time.insert(0, '2') + eq(extpage, {'ParenMatch': {'flash-delay': '2500'}}) + changes.clear() + d.bell_on.invoke() + eq(extpage, {'ParenMatch': {'bell': 'False'}}) + + def test_autosave(self): + d = self.page + d.save_auto_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '1'}}) + d.save_ask_on.invoke() + self.assertEqual(mainpage, {'General': {'autosave': '0'}}) + + def test_paragraph(self): + self.page.format_width_int.insert(0, '1') + self.assertEqual(extpage, {'FormatParagraph': {'max-width': '172'}}) + + def test_context(self): + self.page.context_int.insert(0, '1') + self.assertEqual(extpage, {'CodeContext': {'numlines': '13'}}) + def test_source_selected(self): d = self.page d.set = d.set_add_delete_state diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py index 65345cd1f16..d1dcb83d932 100644 --- a/Lib/idlelib/mainmenu.py +++ b/Lib/idlelib/mainmenu.py @@ -52,6 +52,11 @@ ('Find in Files...', '<>'), ('R_eplace...', '<>'), ('Go to _Line', '<>'), + ('S_how Completions', '<>'), + ('E_xpand Word', '<>'), + ('Show C_all Tip', '<>'), + ('Show Surrounding P_arens', '<>'), + ]), ('format', [ ('_Indent Region', '<>'), @@ -62,9 +67,13 @@ ('Untabify Region', '<>'), ('Toggle Tabs', '<>'), ('New Indent Width', '<>'), + ('F_ormat Paragraph', '<>'), + ('S_trip Trailing Whitespace', '<>'), ]), ('run', [ ('Python Shell', '<>'), + ('C_heck Module', '<>'), + ('R_un Module', '<>'), ]), ('shell', [ ('_View Last Restart', '<>'), @@ -80,7 +89,10 @@ ]), ('options', [ ('Configure _IDLE', '<>'), - None, + ('_Code Context', '<>'), + ]), + ('windows', [ + ('Zoom Height', '<>'), ]), ('help', [ ('_About IDLE', '<>'), diff --git a/Lib/idlelib/outwin.py b/Lib/idlelib/outwin.py index 5f7c09fb92c..6c2a792d86b 100644 --- a/Lib/idlelib/outwin.py +++ b/Lib/idlelib/outwin.py @@ -77,6 +77,7 @@ class OutputWindow(EditorWindow): def __init__(self, *args): EditorWindow.__init__(self, *args) self.text.bind("<>", self.goto_file_line) + self.text.unbind("<>") # Customize EditorWindow def ispythonsource(self, filename): diff --git a/Lib/idlelib/paragraph.py b/Lib/idlelib/paragraph.py index f11bdaeb77a..cf8dfdb641f 100644 --- a/Lib/idlelib/paragraph.py +++ b/Lib/idlelib/paragraph.py @@ -1,4 +1,4 @@ -"""Extension to format a paragraph or selection to a max width. +"""Format a paragraph, comment block, or selection to a max width. Does basic, standard text formatting, and also understands Python comment blocks. Thus, for editing Python source code, this @@ -21,15 +21,14 @@ class FormatParagraph: - menudefs = [ - ('format', [ # /s/edit/format dscherer at cmu.edu - ('Format Paragraph', '<>'), - ]) - ] - def __init__(self, editwin): self.editwin = editwin + @classmethod + def reload(cls): + cls.max_width = idleConf.GetOption('extensions', 'FormatParagraph', + 'max-width', type='int', default=72) + def close(self): self.editwin = None @@ -45,11 +44,7 @@ def format_paragraph_event(self, event, limit=None): The length limit parameter is for testing with a known value. """ - if limit is None: - # The default length limit is that defined by pep8 - limit = idleConf.GetOption( - 'extensions', 'FormatParagraph', 'max-width', - type='int', default=72) + limit = self.max_width if limit is None else limit text = self.editwin.text first, last = self.editwin.get_selection_indices() if first and last: @@ -75,6 +70,9 @@ def format_paragraph_event(self, event, limit=None): text.see("insert") return "break" + +FormatParagraph.reload() + def find_paragraph(text, mark): """Returns the start/stop indices enclosing the paragraph that mark is in. diff --git a/Lib/idlelib/parenmatch.py b/Lib/idlelib/parenmatch.py index 7f25880ae5e..12212150c6d 100644 --- a/Lib/idlelib/parenmatch.py +++ b/Lib/idlelib/parenmatch.py @@ -1,4 +1,4 @@ -"""ParenMatch -- An IDLE extension for parenthesis matching. +"""ParenMatch -- for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to @@ -30,18 +30,6 @@ class ParenMatch: - Highlight when cursor is moved to the right of a closer. This might be too expensive to check. """ - menudefs = [ - ('edit', [ - ("Show surrounding parens", "<>"), - ]) - ] - STYLE = idleConf.GetOption( - 'extensions','ParenMatch','style', default='expression') - FLASH_DELAY = idleConf.GetOption( - 'extensions','ParenMatch','flash-delay', type='int',default=500) - BELL = idleConf.GetOption( - 'extensions','ParenMatch','bell', type='bool',default=1) - HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(),'hilite') RESTORE_VIRTUAL_EVENT_NAME = "<>" # We want the restore event be called before the usual return and @@ -62,6 +50,17 @@ def __init__(self, editwin): self.is_restore_active = 0 self.set_style(self.STYLE) + @classmethod + def reload(cls): + cls.STYLE = idleConf.GetOption( + 'extensions','ParenMatch','style', default='opener') + cls.FLASH_DELAY = idleConf.GetOption( + 'extensions','ParenMatch','flash-delay', type='int',default=500) + cls.BELL = idleConf.GetOption( + 'extensions','ParenMatch','bell', type='bool', default=1) + cls.HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(), + 'hilite') + def activate_restore(self): "Activate mechanism to restore text from highlighting." if not self.is_restore_active: @@ -181,6 +180,9 @@ def set_timeout_last(self): lambda self=self, c=self.counter: self.handle_restore_timer(c)) +ParenMatch.reload() + + if __name__ == '__main__': import unittest unittest.main('idlelib.idle_test.test_parenmatch', verbosity=2) diff --git a/Lib/idlelib/rstrip.py b/Lib/idlelib/rstrip.py index 2ce3c7eafe5..18c86f9b2c8 100644 --- a/Lib/idlelib/rstrip.py +++ b/Lib/idlelib/rstrip.py @@ -2,12 +2,8 @@ class RstripExtension: - menudefs = [ - ('format', [None, ('Strip trailing whitespace', '<>'), ] ), ] - def __init__(self, editwin): self.editwin = editwin - self.editwin.text.bind("<>", self.do_rstrip) def do_rstrip(self, event=None): diff --git a/Lib/idlelib/runscript.py b/Lib/idlelib/runscript.py index 3355f17d90b..45bf5634582 100644 --- a/Lib/idlelib/runscript.py +++ b/Lib/idlelib/runscript.py @@ -1,22 +1,14 @@ -"""Extension to execute code outside the Python shell window. +"""Execute code from an editor. -This adds the following commands: +Check module: do a full syntax check of the current module. +Also run the tabnanny to catch any inconsistent tabs. -- Check module does a full syntax check of the current module. - It also runs the tabnanny to catch any inconsistent tabs. - -- Run module executes the module's code in the __main__ namespace. The window - must have been saved previously. The module is added to sys.modules, and is - also added to the __main__ namespace. - -XXX GvR Redesign this interface (yet again) as follows: - -- Present a dialog box for ``Run Module'' - -- Allow specify command line arguments in the dialog box +Run module: also execute the module's code in the __main__ namespace. +The window must have been saved previously. The module is added to +sys.modules, and is also added to the __main__ namespace. +TODO: Specify command line arguments in a dialog box. """ - import os import tabnanny import tokenize @@ -40,11 +32,6 @@ class ScriptBinding: - menudefs = [ - ('run', [None, - ('Check Module', '<>'), - ('Run Module', '<>'), ]), ] - def __init__(self, editwin): self.editwin = editwin # Provide instance variables referenced by debugger diff --git a/Lib/idlelib/zoomheight.py b/Lib/idlelib/zoomheight.py index d01c9e964aa..74fbc888a80 100644 --- a/Lib/idlelib/zoomheight.py +++ b/Lib/idlelib/zoomheight.py @@ -1,4 +1,4 @@ -# Sample extension: zoom a window to maximum height +"Zoom a window to maximum height." import re import sys @@ -8,12 +8,6 @@ class ZoomHeight: - menudefs = [ - ('windows', [ - ('_Zoom Height', '<>'), - ]) - ] - def __init__(self, editwin): self.editwin = editwin diff --git a/Lib/idlelib/zzdummy.py b/Lib/idlelib/zzdummy.py new file mode 100644 index 00000000000..80844996466 --- /dev/null +++ b/Lib/idlelib/zzdummy.py @@ -0,0 +1,42 @@ +"Example extension, also used for testing." + +from idlelib.config import idleConf + +ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') + + +class ZzDummy: + +## menudefs = [ +## ('format', [ +## ('Z in', '<>'), +## ('Z out', '<>'), +## ] ) +## ] + + def __init__(self, editwin): + self.text = editwin.text + z_in = False + + @classmethod + def reload(cls): + cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') + + def z_in_event(self, event): + """ + """ + text = self.text + text.undo_block_start() + for line in range(1, text.index('end')): + text.insert('%d.0', ztest) + text.undo_block_stop() + return "break" + + def z_out_event(self, event): pass + +ZzDummy.reload() + +##if __name__ == "__main__": +## import unittest +## unittest.main('idlelib.idle_test.test_zzdummy', +## verbosity=2, exit=False) diff --git a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst new file mode 100644 index 00000000000..9b59fbabe53 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst @@ -0,0 +1,20 @@ +Convert IDLE's built-in 'extensions' to regular features. + +About 10 IDLE features were implemented as supposedly optional +extensions. Their different behavior could be confusing or worse for +users and not good for maintenance. Hence the conversion. + +The main difference for users is that user configurable key bindings +for builtin features are now handled uniformly. Now, editing a binding +in a keyset only affects its value in the keyset. All bindings are +defined together in the system-specific default keysets in config- +extensions.def. All custom keysets are saved as a whole in config- +extension.cfg. All take effect as soon as one clicks Apply or Ok. + +The affected events are '<>', '<>', +'<>', '<>', '<>', +'<>', '<>', and '<>'. Any +(global) customizations made before 3.6.3 will not affect their keyset- +specific customization after 3.6.3. and vice versa. + +Inital patch by Charles Wohlganger. From webhook-mailer at python.org Sun Sep 10 21:11:20 2017 From: webhook-mailer at python.org (Mariatta) Date: Mon, 11 Sep 2017 01:11:20 -0000 Subject: [Python-checkins] Backport docstring improvements to OrderedDict. (GH-3470) Message-ID: https://github.com/python/cpython/commit/2a0f7c34c386dc80519da6c3fb150f081943f204 commit: 2a0f7c34c386dc80519da6c3fb150f081943f204 branch: 3.6 author: Henk-Jaap Wagenaar committer: Mariatta date: 2017-09-10T18:11:18-07:00 summary: Backport docstring improvements to OrderedDict. (GH-3470) files: M Lib/collections/__init__.py M Objects/odictobject.c diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 1d6822a3a0b..26aeac180c7 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -155,9 +155,9 @@ def clear(self): dict.clear(self) def popitem(self, last=True): - '''od.popitem() -> (k, v), return and remove a (key, value) pair. - Pairs are returned in LIFO order if last is true or FIFO order if false. + '''Remove and return a (key, value) pair from the dictionary. + Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') diff --git a/Objects/odictobject.c b/Objects/odictobject.c index 9e891152aff..65f90e83434 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1154,10 +1154,12 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj) /* popitem() */ PyDoc_STRVAR(odict_popitem__doc__, -"od.popitem() -> (k, v), return and remove a (key, value) pair.\n\ - Pairs are returned in LIFO order if last is true or FIFO order if false.\n\ -\n\ - "); +"popitem($self, /, last=True)\n" +"--\n" +"\n" +"Remove and return a (key, value) pair from the dictionary.\n" +"\n" +"Pairs are returned in LIFO order if last is true or FIFO order if false."); static PyObject * odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs) From webhook-mailer at python.org Sun Sep 10 22:41:13 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 02:41:13 -0000 Subject: [Python-checkins] bpo-30781: IDLE: Fix help button on configdialog (#3238) Message-ID: https://github.com/python/cpython/commit/3866d9bbcf808cea98b3d00007f9f246b83858ce commit: 3866d9bbcf808cea98b3d00007f9f246b83858ce branch: master author: Cheryl Sabella committer: Terry Jan Reedy date: 2017-09-10T22:41:10-04:00 summary: bpo-30781: IDLE: Fix help button on configdialog (#3238) This fixes an omission in the ttk conversion patch for this issue, hence no new news. Patch by Cheryl Sabella. files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 604719f0453..683c36e9776 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -187,12 +187,12 @@ def help(self): """Create textview for config dialog help. Attrbutes accessed: - tab_pages + note Methods: view_text: Method from textview module. """ - page = self.tab_pages._current_page + page = self.note.tab(self.note.select(), option='text').strip() view_text(self, title='Help for IDLE preferences', text=help_common+help_pages.get(page, '')) @@ -2104,7 +2104,7 @@ def detach(self): [Cancel] only cancels changes made since the last save. ''' help_pages = { - 'Highlighting': ''' + 'Highlights': ''' Highlighting: The IDLE Dark color theme is new in October 2015. It can only be used with older IDLE releases if it is saved as a custom From webhook-mailer at python.org Sun Sep 10 23:19:38 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 03:19:38 -0000 Subject: [Python-checkins] [3.6] bpo-30781: IDLE: Fix help button on configdialog (GH-3238) (#3489) Message-ID: https://github.com/python/cpython/commit/4a8b53a2083506ee13ff2eba2c14264f5a7faa91 commit: 4a8b53a2083506ee13ff2eba2c14264f5a7faa91 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-10T23:19:35-04:00 summary: [3.6] bpo-30781: IDLE: Fix help button on configdialog (GH-3238) (#3489) This fixes an omission in the ttk conversion patch for this issue, hence no new news. Patch by Cheryl Sabella. (cherry picked from commit 3866d9bbcf808cea98b3d00007f9f246b83858ce) files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 604719f0453..683c36e9776 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -187,12 +187,12 @@ def help(self): """Create textview for config dialog help. Attrbutes accessed: - tab_pages + note Methods: view_text: Method from textview module. """ - page = self.tab_pages._current_page + page = self.note.tab(self.note.select(), option='text').strip() view_text(self, title='Help for IDLE preferences', text=help_common+help_pages.get(page, '')) @@ -2104,7 +2104,7 @@ def detach(self): [Cancel] only cancels changes made since the last save. ''' help_pages = { - 'Highlighting': ''' + 'Highlights': ''' Highlighting: The IDLE Dark color theme is new in October 2015. It can only be used with older IDLE releases if it is saved as a custom From webhook-mailer at python.org Mon Sep 11 02:26:19 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 06:26:19 -0000 Subject: [Python-checkins] [3.6] bpo-29526: Add reference to help('FORMATTING') in format() builtin (GH-166). (#3491) Message-ID: https://github.com/python/cpython/commit/c67838da2cde6fa3f1bef11f08719237983e6990 commit: c67838da2cde6fa3f1bef11f08719237983e6990 branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-09-11T09:26:15+03:00 summary: [3.6] bpo-29526: Add reference to help('FORMATTING') in format() builtin (GH-166). (#3491) (cherry picked from commit 2e6bb4484ee1b0da67d1dfcf0816c58602daa5a0) files: M Python/bltinmodule.c M Python/clinic/bltinmodule.c.h diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 597e26ec69a..911e2ba79ef 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -588,12 +588,14 @@ format as builtin_format Return value.__format__(format_spec) -format_spec defaults to the empty string +format_spec defaults to the empty string. +See the Format Specification Mini-Language section of help('FORMATTING') for +details. [clinic start generated code]*/ static PyObject * builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec) -/*[clinic end generated code: output=2f40bdfa4954b077 input=6325e751a1b29b86]*/ +/*[clinic end generated code: output=2f40bdfa4954b077 input=88339c93ea522b33]*/ { return PyObject_Format(value, format_spec); } diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h index c88deef33f0..37ce794b298 100644 --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -77,7 +77,9 @@ PyDoc_STRVAR(builtin_format__doc__, "\n" "Return value.__format__(format_spec)\n" "\n" -"format_spec defaults to the empty string"); +"format_spec defaults to the empty string.\n" +"See the Format Specification Mini-Language section of help(\'FORMATTING\') for\n" +"details."); #define BUILTIN_FORMAT_METHODDEF \ {"format", (PyCFunction)builtin_format, METH_VARARGS, builtin_format__doc__}, @@ -674,4 +676,4 @@ builtin_issubclass(PyObject *module, PyObject *args) exit: return return_value; } -/*[clinic end generated code: output=63483deb75805f7c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2ef82846acdfa0f5 input=a9049054013a1b77]*/ From webhook-mailer at python.org Mon Sep 11 02:26:42 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 06:26:42 -0000 Subject: [Python-checkins] [2.7] bpo-29526: Add reference to help('FORMATTING') in format() builtin (GH-166). (#3492) Message-ID: https://github.com/python/cpython/commit/6ed7aff8948e50708f048f3f7fd41809259d1777 commit: 6ed7aff8948e50708f048f3f7fd41809259d1777 branch: 2.7 author: Serhiy Storchaka committer: GitHub date: 2017-09-11T09:26:39+03:00 summary: [2.7] bpo-29526: Add reference to help('FORMATTING') in format() builtin (GH-166). (#3492) (cherry picked from commit 2e6bb4484ee1b0da67d1dfcf0816c58602daa5a0) files: M Python/bltinmodule.c diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 70308e9dc9e..0f2ee4ad1eb 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -374,7 +374,9 @@ PyDoc_STRVAR(format_doc, "format(value[, format_spec]) -> string\n\ \n\ Returns value.__format__(format_spec)\n\ -format_spec defaults to \"\""); +format_spec defaults to the empty string.\n\ +See the Format Specification Mini-Language section of help('FORMATTING') for\n\ +details."); static PyObject * builtin_chr(PyObject *self, PyObject *args) From webhook-mailer at python.org Mon Sep 11 02:28:42 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 06:28:42 -0000 Subject: [Python-checkins] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (#3485) Message-ID: https://github.com/python/cpython/commit/252033d50effa08046ac34fcc406bc99796ab88b commit: 252033d50effa08046ac34fcc406bc99796ab88b branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-11T09:28:39+03:00 summary: bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (#3485) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 69623c40f46..75539cf1c87 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -794,6 +794,17 @@ def test_stderr_none(self): self.assertNotIn(b'Warning!', stderr) self.assertNotIn(b'Error', stderr) + @support.cpython_only + def test_issue31411(self): + # warn_explicit() shouldn't raise a SystemError in case + # warnings.onceregistry isn't a dictionary. + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filterwarnings('once') + with support.swap_attr(wmod, 'onceregistry', None): + with self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None) + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst new file mode 100644 index 00000000000..ad1b4b8870a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst @@ -0,0 +1,2 @@ +Raise a TypeError instead of SystemError in case warnings.onceregistry is +not a dictionary. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 5230318788c..078bdcb0399 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -86,6 +86,12 @@ get_once_registry(void) return NULL; return _PyRuntime.warnings.once_registry; } + if (!PyDict_Check(registry)) { + PyErr_SetString(PyExc_TypeError, + "warnings.onceregistry must be a dict"); + Py_DECREF(registry); + return NULL; + } Py_DECREF(_PyRuntime.warnings.once_registry); _PyRuntime.warnings.once_registry = registry; return registry; @@ -437,7 +443,7 @@ warn_explicit(PyObject *category, PyObject *message, Py_RETURN_NONE; if (registry && !PyDict_Check(registry) && (registry != Py_None)) { - PyErr_SetString(PyExc_TypeError, "'registry' must be a dict"); + PyErr_SetString(PyExc_TypeError, "'registry' must be a dict or None"); return NULL; } From webhook-mailer at python.org Mon Sep 11 02:50:48 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Mon, 11 Sep 2017 06:50:48 -0000 Subject: [Python-checkins] bpo-31373: remove overly strict float range checks (#3486) Message-ID: https://github.com/python/cpython/commit/2bb69a5b4e7f96cb35d1b28aa7b7b3974b351f59 commit: 2bb69a5b4e7f96cb35d1b28aa7b7b3974b351f59 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-10T23:50:46-07:00 summary: bpo-31373: remove overly strict float range checks (#3486) This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 except for the pytime.c parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be rounded into finite floats. Tests were added to very this behavior. files: M Lib/test/test_float.py M Lib/test/test_getargs2.py M Objects/floatobject.c M Python/getargs.c diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 66726d6496d..a16c05cf5d9 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -617,6 +617,12 @@ def test_float_specials_do_unpack(self): (' FLT_MAX && !Py_IS_INFINITY(x)) + if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) goto Overflow; unsigned char s[sizeof(float)]; - float y = (float)x; memcpy(s, &y, sizeof(float)); if ((float_format == ieee_little_endian_format && !le) diff --git a/Python/getargs.c b/Python/getargs.c index 0b155a170f9..dd7ca9fed15 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -859,10 +859,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, double dval = PyFloat_AsDouble(arg); if (PyErr_Occurred()) RETURN_ERR_OCCURRED; - else if (dval > FLT_MAX) - *p = (float)INFINITY; - else if (dval < -FLT_MAX) - *p = (float)-INFINITY; else *p = (float) dval; break; From webhook-mailer at python.org Mon Sep 11 03:01:34 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 07:01:34 -0000 Subject: [Python-checkins] [2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3493) Message-ID: https://github.com/python/cpython/commit/004547f97067be2e23ae770f300c0c0d1db1ba27 commit: 004547f97067be2e23ae770f300c0c0d1db1ba27 branch: 2.7 author: Serhiy Storchaka committer: GitHub date: 2017-09-11T10:01:31+03:00 summary: [2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3493) (cherry picked from commit 252033d50effa08046ac34fcc406bc99796ab88b) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst M Lib/test/test_warnings.py M Python/_warnings.c diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 607d9f9b722..0023363832c 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -584,6 +584,17 @@ def test_stderr_none(self): self.assertNotIn(b'Warning!', stderr) self.assertNotIn(b'Error', stderr) + @test_support.cpython_only + def test_issue31411(self): + # warn_explicit() shouldn't raise a SystemError in case + # warnings.onceregistry isn't a dictionary. + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filterwarnings('once') + with test_support.swap_attr(wmod, 'onceregistry', None): + with self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None) + class WarningsDisplayTests(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst new file mode 100644 index 00000000000..ad1b4b8870a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst @@ -0,0 +1,2 @@ +Raise a TypeError instead of SystemError in case warnings.onceregistry is +not a dictionary. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 8e8c0cceb31..dd168f92593 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -72,6 +72,12 @@ get_once_registry(void) return NULL; return _once_registry; } + if (!PyDict_Check(registry)) { + PyErr_SetString(PyExc_TypeError, + "warnings.onceregistry must be a dict"); + Py_DECREF(registry); + return NULL; + } Py_DECREF(_once_registry); _once_registry = registry; return registry; @@ -296,7 +302,7 @@ warn_explicit(PyObject *category, PyObject *message, int rc; if (registry && !PyDict_Check(registry) && (registry != Py_None)) { - PyErr_SetString(PyExc_TypeError, "'registry' must be a dict"); + PyErr_SetString(PyExc_TypeError, "'registry' must be a dict or None"); return NULL; } From webhook-mailer at python.org Mon Sep 11 03:01:50 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 07:01:50 -0000 Subject: [Python-checkins] [3.6] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3494) Message-ID: https://github.com/python/cpython/commit/7972ed2111ea2f01e8712eef91bcf2260e05ad8b commit: 7972ed2111ea2f01e8712eef91bcf2260e05ad8b branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-09-11T10:01:47+03:00 summary: [3.6] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3494) (cherry picked from commit 252033d50effa08046ac34fcc406bc99796ab88b) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 755ee65438c..c66fe3aa878 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -794,6 +794,17 @@ def test_stderr_none(self): self.assertNotIn(b'Warning!', stderr) self.assertNotIn(b'Error', stderr) + @support.cpython_only + def test_issue31411(self): + # warn_explicit() shouldn't raise a SystemError in case + # warnings.onceregistry isn't a dictionary. + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filterwarnings('once') + with support.swap_attr(wmod, 'onceregistry', None): + with self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None) + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst new file mode 100644 index 00000000000..ad1b4b8870a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst @@ -0,0 +1,2 @@ +Raise a TypeError instead of SystemError in case warnings.onceregistry is +not a dictionary. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 6cfae77f126..2b04b9081e2 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -94,6 +94,12 @@ get_once_registry(void) return NULL; return _once_registry; } + if (!PyDict_Check(registry)) { + PyErr_SetString(PyExc_TypeError, + "warnings.onceregistry must be a dict"); + Py_DECREF(registry); + return NULL; + } Py_DECREF(_once_registry); _once_registry = registry; return registry; @@ -449,7 +455,7 @@ warn_explicit(PyObject *category, PyObject *message, Py_RETURN_NONE; if (registry && !PyDict_Check(registry) && (registry != Py_None)) { - PyErr_SetString(PyExc_TypeError, "'registry' must be a dict"); + PyErr_SetString(PyExc_TypeError, "'registry' must be a dict or None"); return NULL; } From solipsis at pitrou.net Mon Sep 11 05:23:18 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 11 Sep 2017 09:23:18 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170911092317.90858.20966C154DA68E5B@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 0, 2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogy0NcP0', '--timeout', '7200'] From webhook-mailer at python.org Mon Sep 11 06:37:13 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Mon, 11 Sep 2017 10:37:13 -0000 Subject: [Python-checkins] Remove a null statement that was necessary for --without-threads (#3478) Message-ID: https://github.com/python/cpython/commit/834a5cecac0e77e907762611c06fa460545487e7 commit: 834a5cecac0e77e907762611c06fa460545487e7 branch: master author: Zackery Spytz committer: Christian Heimes date: 2017-09-11T12:37:10+02:00 summary: Remove a null statement that was necessary for --without-threads (#3478) files: M Modules/socketmodule.c diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 50a4443a35a..5df9d014c35 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -623,7 +623,6 @@ internal_setblocking(PySocketSockObject *s, int block) result = 0; done: - ; /* necessary for --without-threads flag */ Py_END_ALLOW_THREADS if (result) { From webhook-mailer at python.org Mon Sep 11 12:34:28 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 11 Sep 2017 16:34:28 -0000 Subject: [Python-checkins] test_ssl: Implement timeout in ssl_io_loop() (#3500) Message-ID: https://github.com/python/cpython/commit/50a72af6574f30090cd496c2f74906a52337865f commit: 50a72af6574f30090cd496c2f74906a52337865f branch: master author: Victor Stinner committer: GitHub date: 2017-09-11T09:34:24-07:00 summary: test_ssl: Implement timeout in ssl_io_loop() (#3500) The timeout parameter was not used. files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 99fd80b3a04..523322da2f6 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1708,8 +1708,11 @@ def ssl_io_loop(self, sock, incoming, outgoing, func, *args, **kwargs): # A simple IO loop. Call func(*args) depending on the error we get # (WANT_READ or WANT_WRITE) move data between the socket and the BIOs. timeout = kwargs.get('timeout', 10) + deadline = time.monotonic() + timeout count = 0 while True: + if time.monotonic() > deadline: + self.fail("timeout") errno = None count += 1 try: From webhook-mailer at python.org Mon Sep 11 12:34:39 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 11 Sep 2017 16:34:39 -0000 Subject: [Python-checkins] bpo-30860: Add Include/internal/ in "make tags" (#3498) Message-ID: https://github.com/python/cpython/commit/4866957e86594935ec2e6434b6e470ebeb0c79b4 commit: 4866957e86594935ec2e6434b6e470ebeb0c79b4 branch: master author: Victor Stinner committer: GitHub date: 2017-09-11T09:34:36-07:00 summary: bpo-30860: Add Include/internal/ in "make tags" (#3498) files: M Makefile.pre.in diff --git a/Makefile.pre.in b/Makefile.pre.in index 1c721000833..5a001ecbe73 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1580,7 +1580,7 @@ autoconf: # Create a tags file for vi tags:: cd $(srcdir); \ - ctags -w Include/*.h; \ + ctags -w Include/*.h Include/internal/*.h; \ for i in $(SRCDIRS); do ctags -f tags -w -a $$i/*.[ch]; \ done; \ LC_ALL=C sort -o tags tags @@ -1588,7 +1588,7 @@ tags:: # Create a tags file for GNU Emacs TAGS:: cd $(srcdir); \ - etags Include/*.h; \ + etags Include/*.h Include/internal/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done # Sanitation targets -- clean leaves libraries, executables and tags From webhook-mailer at python.org Mon Sep 11 16:02:36 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 20:02:36 -0000 Subject: [Python-checkins] bpo-31414: IDLE -- fix tk entry box tests by deleting first. (#3501) Message-ID: https://github.com/python/cpython/commit/667522efa8fedfb57fd89d7335d7dfd270f274d5 commit: 667522efa8fedfb57fd89d7335d7dfd270f274d5 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-11T16:02:33-04:00 summary: bpo-31414: IDLE -- fix tk entry box tests by deleting first. (#3501) Adding to an int entry is not the same as deleting and inserting because int('') will fail. files: A Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst M Lib/idlelib/idle_test/test_configdialog.py diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index 3d6a858e6fd..cae7186415b 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1128,15 +1128,18 @@ def test_startup(self): def test_editor_size(self): d = self.page - d.win_height_int.insert(0, '1') - self.assertEqual(mainpage, {'EditorWindow': {'height': '140'}}) + d.win_height_int.delete(0, 'end') + d.win_height_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'height': '11'}}) changes.clear() - d.win_width_int.insert(0, '1') - self.assertEqual(mainpage, {'EditorWindow': {'width': '180'}}) + d.win_width_int.delete(0, 'end') + d.win_width_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'width': '11'}}) def test_autocomplete_wait(self): - self.page.auto_wait_int.insert(0, '1') - self.assertEqual(extpage, {'AutoComplete': {'popupwait': '12000'}}) + self.page.auto_wait_int.delete(0, 'end') + self.page.auto_wait_int.insert(0, '11') + self.assertEqual(extpage, {'AutoComplete': {'popupwait': '11'}}) def test_parenmatch(self): d = self.page @@ -1144,8 +1147,9 @@ def test_parenmatch(self): d.paren_style_type['menu'].invoke(0) eq(extpage, {'ParenMatch': {'style': 'opener'}}) changes.clear() - d.paren_flash_time.insert(0, '2') - eq(extpage, {'ParenMatch': {'flash-delay': '2500'}}) + d.paren_flash_time.delete(0, 'end') + d.paren_flash_time.insert(0, '11') + eq(extpage, {'ParenMatch': {'flash-delay': '11'}}) changes.clear() d.bell_on.invoke() eq(extpage, {'ParenMatch': {'bell': 'False'}}) @@ -1158,12 +1162,14 @@ def test_autosave(self): self.assertEqual(mainpage, {'General': {'autosave': '0'}}) def test_paragraph(self): - self.page.format_width_int.insert(0, '1') - self.assertEqual(extpage, {'FormatParagraph': {'max-width': '172'}}) + self.page.format_width_int.delete(0, 'end') + self.page.format_width_int.insert(0, '11') + self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}}) def test_context(self): + self.page.context_int.delete(0, 'end') self.page.context_int.insert(0, '1') - self.assertEqual(extpage, {'CodeContext': {'numlines': '13'}}) + self.assertEqual(extpage, {'CodeContext': {'numlines': '1'}}) def test_source_selected(self): d = self.page diff --git a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst new file mode 100644 index 00000000000..aa49d882d0a --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst @@ -0,0 +1,2 @@ +IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is +not the same as deleting and inserting because int('') will fail. From webhook-mailer at python.org Mon Sep 11 16:34:14 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 20:34:14 -0000 Subject: [Python-checkins] [3.6] bpo-31414: IDLE -- fix tk entry box tests by deleting first. (GH-3501) (#3502) Message-ID: https://github.com/python/cpython/commit/31b242459cef0835057f08c8756559b3261aa8ff commit: 31b242459cef0835057f08c8756559b3261aa8ff branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-11T16:34:11-04:00 summary: [3.6] bpo-31414: IDLE -- fix tk entry box tests by deleting first. (GH-3501) (#3502) Adding to an int entry is not the same as deleting and inserting because int('') will fail. (cherry picked from commit 667522efa8fedfb57fd89d7335d7dfd270f274d5) files: A Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst M Lib/idlelib/idle_test/test_configdialog.py diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index 3d6a858e6fd..cae7186415b 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1128,15 +1128,18 @@ def test_startup(self): def test_editor_size(self): d = self.page - d.win_height_int.insert(0, '1') - self.assertEqual(mainpage, {'EditorWindow': {'height': '140'}}) + d.win_height_int.delete(0, 'end') + d.win_height_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'height': '11'}}) changes.clear() - d.win_width_int.insert(0, '1') - self.assertEqual(mainpage, {'EditorWindow': {'width': '180'}}) + d.win_width_int.delete(0, 'end') + d.win_width_int.insert(0, '11') + self.assertEqual(mainpage, {'EditorWindow': {'width': '11'}}) def test_autocomplete_wait(self): - self.page.auto_wait_int.insert(0, '1') - self.assertEqual(extpage, {'AutoComplete': {'popupwait': '12000'}}) + self.page.auto_wait_int.delete(0, 'end') + self.page.auto_wait_int.insert(0, '11') + self.assertEqual(extpage, {'AutoComplete': {'popupwait': '11'}}) def test_parenmatch(self): d = self.page @@ -1144,8 +1147,9 @@ def test_parenmatch(self): d.paren_style_type['menu'].invoke(0) eq(extpage, {'ParenMatch': {'style': 'opener'}}) changes.clear() - d.paren_flash_time.insert(0, '2') - eq(extpage, {'ParenMatch': {'flash-delay': '2500'}}) + d.paren_flash_time.delete(0, 'end') + d.paren_flash_time.insert(0, '11') + eq(extpage, {'ParenMatch': {'flash-delay': '11'}}) changes.clear() d.bell_on.invoke() eq(extpage, {'ParenMatch': {'bell': 'False'}}) @@ -1158,12 +1162,14 @@ def test_autosave(self): self.assertEqual(mainpage, {'General': {'autosave': '0'}}) def test_paragraph(self): - self.page.format_width_int.insert(0, '1') - self.assertEqual(extpage, {'FormatParagraph': {'max-width': '172'}}) + self.page.format_width_int.delete(0, 'end') + self.page.format_width_int.insert(0, '11') + self.assertEqual(extpage, {'FormatParagraph': {'max-width': '11'}}) def test_context(self): + self.page.context_int.delete(0, 'end') self.page.context_int.insert(0, '1') - self.assertEqual(extpage, {'CodeContext': {'numlines': '13'}}) + self.assertEqual(extpage, {'CodeContext': {'numlines': '1'}}) def test_source_selected(self): d = self.page diff --git a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst new file mode 100644 index 00000000000..aa49d882d0a --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst @@ -0,0 +1,2 @@ +IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is +not the same as deleting and inserting because int('') will fail. From webhook-mailer at python.org Mon Sep 11 16:43:28 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 20:43:28 -0000 Subject: [Python-checkins] bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (#3503) Message-ID: https://github.com/python/cpython/commit/8239fd704637d7cbf59273883fbe487fc0f568fc commit: 8239fd704637d7cbf59273883fbe487fc0f568fc branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-11T16:43:26-04:00 summary: bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (#3503) files: M Lib/idlelib/NEWS.txt diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index e78818e5be3..86906b80abe 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,51 @@ Released on 2018-06-18? ======================== +bpo-bpo-31414: Fix tk entry box tests by deleting first. +Adding to an int entry is not the same as deleting and inserting +because int('') will fail. Patch by Terry Jan Reedy. + +bpo-27099: Convert IDLE's built-in 'extensions' to regular features. + About 10 IDLE features were implemented as supposedly optional +extensions. Their different behavior could be confusing or worse for +users and not good for maintenance. Hence the conversion. + The main difference for users is that user configurable key bindings +for builtin features are now handled uniformly. Now, editing a binding +in a keyset only affects its value in the keyset. All bindings are +defined together in the system-specific default keysets in config- +extensions.def. All custom keysets are saved as a whole in config- +extension.cfg. All take effect as soon as one clicks Apply or Ok. + The affected events are '<>', +'<>', '<>', '<>', +'<>', '<>', '<>', and +'<>'. Any (global) customizations made before 3.6.3 will +not affect their keyset-specific customization after 3.6.3. and vice +versa. + Inital patch by Charles Wohlganger, revised by Terry Jan Reedy. + +bpo-31051: Rearrange condigdialog General tab. +Sort non-Help options into Window (Shell+Editor) and Editor (only). +Leave room for the addition of new options. +Patch by Terry Jan Reedy. + +bpo-30617: Add docstrings and tests for outwin subclass of editor. +Move some data and functions from the class to module level. +Patch by Cheryl Sabella. + +bpo-31287: Do not modify tkinter.messagebox in test_configdialog. +Instead, mask it with an instance mock that can be deleted. +Patch by Terry Jan Reedy. + +bpo-30781: Use ttk widgets in ConfigDialog pages. +These should especially look better on MacOSX. +Patches by Terry Jan Reedy and Cheryl Sabella. + +bpo-31206: Factor HighPage(Frame) class from ConfigDialog. +Patch by Cheryl Sabella. + +bp0-31001: Add tests for configdialog highlight tab. +Patch by Cheryl Sabella. + bpo-31205: Factor KeysPage(Frame) class from ConfigDialog. The slightly modified tests continue to pass. Patch by Cheryl Sabella. @@ -32,6 +77,7 @@ broken by the switch to ttk.Notebook is fixed. Patch mostly by Cheryl Sabella. bpo-30781: IDLE - Use ttk Notebook in ConfigDialog. +This improves navigation by tabbing. Patch by Terry Jan Reedy. bpo-31060: IDLE - Finish rearranging methods of ConfigDialog. From webhook-mailer at python.org Mon Sep 11 17:18:12 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 11 Sep 2017 21:18:12 -0000 Subject: [Python-checkins] bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (#3496) Message-ID: https://github.com/python/cpython/commit/9d984fd2b097c8c29479d1c3eb740995fe1ccb0d commit: 9d984fd2b097c8c29479d1c3eb740995fe1ccb0d branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-12T00:18:09+03:00 summary: bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (#3496) Patch by Oren Milman. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 75539cf1c87..2d0c46f409a 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -805,6 +805,21 @@ def test_issue31411(self): with self.assertRaises(TypeError): wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None) + @support.cpython_only + def test_issue31416(self): + # warn_explicit() shouldn't cause an assertion failure in case of a + # bad warnings.filters or warnings.defaultaction. + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filters = [(None, None, Warning, None, 0)] + with self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1) + + wmod.filters = [] + with support.swap_attr(wmod, 'defaultaction', None), \ + self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1) + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst new file mode 100644 index 00000000000..148a5c8eda5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst @@ -0,0 +1,2 @@ +Fix assertion failures in case of a bad warnings.filters or +warnings.defaultaction. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 078bdcb0399..6dad0806867 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -110,7 +110,14 @@ get_default_action(void) } return _PyRuntime.warnings.default_action; } - + if (!PyUnicode_Check(default_action)) { + PyErr_Format(PyExc_TypeError, + MODULE_NAME ".defaultaction must be a string, " + "not '%.200s'", + Py_TYPE(default_action)->tp_name); + Py_DECREF(default_action); + return NULL; + } Py_DECREF(_PyRuntime.warnings.default_action); _PyRuntime.warnings.default_action = default_action; return default_action; @@ -164,6 +171,14 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, mod = PyTuple_GET_ITEM(tmp_item, 3); ln_obj = PyTuple_GET_ITEM(tmp_item, 4); + if (!PyUnicode_Check(action)) { + PyErr_Format(PyExc_TypeError, + "action must be a string, not '%.200s'", + Py_TYPE(action)->tp_name); + Py_DECREF(tmp_item); + return NULL; + } + good_msg = check_matched(msg, text); if (good_msg == -1) { Py_DECREF(tmp_item); @@ -203,8 +218,6 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, return action; } - PyErr_SetString(PyExc_ValueError, - MODULE_NAME ".defaultaction not found"); return NULL; } From webhook-mailer at python.org Mon Sep 11 17:50:44 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 11 Sep 2017 21:50:44 -0000 Subject: [Python-checkins] [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (GH-3503) (#3504) Message-ID: https://github.com/python/cpython/commit/99b941b420d63027654dc6722f1648a8f36d2925 commit: 99b941b420d63027654dc6722f1648a8f36d2925 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-11T17:50:40-04:00 summary: [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017-09-11. (GH-3503) (#3504) (cherry picked from commit 8239fd704637d7cbf59273883fbe487fc0f568fc) files: M Lib/idlelib/NEWS.txt diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index ff69d48d3df..23cc9805133 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,51 @@ Released on 2017-09-25? ======================== +bpo-bpo-31414: Fix tk entry box tests by deleting first. +Adding to an int entry is not the same as deleting and inserting +because int('') will fail. Patch by Terry Jan Reedy. + +bpo-27099: Convert IDLE's built-in 'extensions' to regular features. + About 10 IDLE features were implemented as supposedly optional +extensions. Their different behavior could be confusing or worse for +users and not good for maintenance. Hence the conversion. + The main difference for users is that user configurable key bindings +for builtin features are now handled uniformly. Now, editing a binding +in a keyset only affects its value in the keyset. All bindings are +defined together in the system-specific default keysets in config- +extensions.def. All custom keysets are saved as a whole in config- +extension.cfg. All take effect as soon as one clicks Apply or Ok. + The affected events are '<>', +'<>', '<>', '<>', +'<>', '<>', '<>', and +'<>'. Any (global) customizations made before 3.6.3 will +not affect their keyset-specific customization after 3.6.3. and vice +versa. + Inital patch by Charles Wohlganger, revised by Terry Jan Reedy. + +bpo-31051: Rearrange condigdialog General tab. +Sort non-Help options into Window (Shell+Editor) and Editor (only). +Leave room for the addition of new options. +Patch by Terry Jan Reedy. + +bpo-30617: Add docstrings and tests for outwin subclass of editor. +Move some data and functions from the class to module level. +Patch by Cheryl Sabella. + +bpo-31287: Do not modify tkinter.messagebox in test_configdialog. +Instead, mask it with an instance mock that can be deleted. +Patch by Terry Jan Reedy. + +bpo-30781: Use ttk widgets in ConfigDialog pages. +These should especially look better on MacOSX. +Patches by Terry Jan Reedy and Cheryl Sabella. + +bpo-31206: Factor HighPage(Frame) class from ConfigDialog. +Patch by Cheryl Sabella. + +bp0-31001: Add tests for configdialog highlight tab. +Patch by Cheryl Sabella. + bpo-31205: Factor KeysPage(Frame) class from ConfigDialog. The slightly modified tests continue to pass. Patch by Cheryl Sabella. @@ -32,6 +77,7 @@ broken by the switch to ttk.Notebook is fixed. Patch mostly by Cheryl Sabella. bpo-30781: IDLE - Use ttk Notebook in ConfigDialog. +This improves navigation by tabbing. Patch by Terry Jan Reedy. bpo-31060: IDLE - Finish rearranging methods of ConfigDialog. From webhook-mailer at python.org Mon Sep 11 18:31:20 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 11 Sep 2017 22:31:20 -0000 Subject: [Python-checkins] bpo-17085: test_socket: cancel scheduled alarm on test failure (#3505) Message-ID: https://github.com/python/cpython/commit/40996d3f6fbd1adcb2e69e426fa311aaf90762ff commit: 40996d3f6fbd1adcb2e69e426fa311aaf90762ff branch: 2.7 author: Victor Stinner committer: GitHub date: 2017-09-11T15:31:16-07:00 summary: bpo-17085: test_socket: cancel scheduled alarm on test failure (#3505) (cherry picked from commit 71fe8c00f6e2eda39d90c225c5f7635268cc4653) files: M Lib/test/test_socket.py diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 2b20a791501..bef18728226 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -733,6 +733,7 @@ def raising_handler(*args): self.assertRaises(socket.timeout, c.sendall, b"x" * test_support.SOCK_MAX_SIZE) finally: + signal.alarm(0) signal.signal(signal.SIGALRM, old_alarm) c.close() s.close() From webhook-mailer at python.org Mon Sep 11 20:02:29 2017 From: webhook-mailer at python.org (Eric Snow) Date: Tue, 12 Sep 2017 00:02:29 -0000 Subject: [Python-checkins] bpo-30860: Always provide serialno. (#3507) Message-ID: https://github.com/python/cpython/commit/ba6d5d1defd7a281c8c8804e4b4cfd7370886236 commit: ba6d5d1defd7a281c8c8804e4b4cfd7370886236 branch: master author: Eric Snow committer: GitHub date: 2017-09-11T17:02:24-07:00 summary: bpo-30860: Always provide serialno. (#3507) This fixes bpo-31407. files: M Include/internal/mem.h diff --git a/Include/internal/mem.h b/Include/internal/mem.h index 1624f378f67..f3a8f56e805 100644 --- a/Include/internal/mem.h +++ b/Include/internal/mem.h @@ -40,8 +40,8 @@ struct _pymem_runtime_state { size_t ntimes_arena_allocated; poolp usedpools[MAX_POOLS]; Py_ssize_t num_allocated_blocks; - size_t serialno; /* incremented on each debug {m,re}alloc */ #endif /* WITH_PYMALLOC */ + size_t serialno; /* incremented on each debug {m,re}alloc */ }; PyAPI_FUNC(void) _PyMem_Initialize(struct _pymem_runtime_state *); From webhook-mailer at python.org Mon Sep 11 20:59:25 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 12 Sep 2017 00:59:25 -0000 Subject: [Python-checkins] bpo-30860: Fix a refleak. (#3506) Message-ID: https://github.com/python/cpython/commit/8728018624f257c7cfe44014742ae46134047f49 commit: 8728018624f257c7cfe44014742ae46134047f49 branch: master author: Eric Snow committer: Victor Stinner date: 2017-09-11T17:59:22-07:00 summary: bpo-30860: Fix a refleak. (#3506) * Drop warnoptions from PyInterpreterState. * Drop xoptions from PyInterpreterState. * Don't set warnoptions and _xoptions again. * Decref after adding to sys.__dict__. * Drop an unused macro. * Check sys.xoptions *before* we delete it. files: M Include/object.h M Include/pystate.h M Objects/object.c M Python/pylifecycle.c M Python/pystate.c M Python/pythonrun.c M Python/sysmodule.c diff --git a/Include/object.h b/Include/object.h index b46d4c30e1e..9bb780e28bc 100644 --- a/Include/object.h +++ b/Include/object.h @@ -727,14 +727,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ +PyAPI_FUNC(PyObject *) _PyDebug_XOptionShowRefCount(void); PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); -#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #define _Py_REF_DEBUG_COMMA #define _Py_CHECK_REFCNT(OP) /* a semicolon */; -#define _PY_DEBUG_PRINT_TOTAL_REFS() #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS diff --git a/Include/pystate.h b/Include/pystate.h index d986e35ae3b..5b75bb080fe 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -60,8 +60,6 @@ typedef struct _is { /* Used in Python/sysmodule.c. */ int check_interval; - PyObject *warnoptions; - PyObject *xoptions; /* Used in Modules/_threadmodule.c. */ long num_threads; diff --git a/Objects/object.c b/Objects/object.c index 74893e38c71..ed8a62a163a 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -29,20 +29,23 @@ _Py_GetRefTotal(void) return total; } -void -_PyDebug_PrintTotalRefs(void) { - PyObject *xoptions, *value; +PyObject * +_PyDebug_XOptionShowRefCount(void) +{ + PyObject *xoptions = PySys_GetXOptions(); + if (xoptions == NULL) + return NULL; + _Py_IDENTIFIER(showrefcount); + return _PyDict_GetItemId(xoptions, &PyId_showrefcount); +} - xoptions = PySys_GetXOptions(); - if (xoptions == NULL) - return; - value = _PyDict_GetItemId(xoptions, &PyId_showrefcount); - if (value == Py_True) - fprintf(stderr, - "[%" PY_FORMAT_SIZE_T "d refs, " - "%" PY_FORMAT_SIZE_T "d blocks]\n", - _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); +void +_PyDebug_PrintTotalRefs(void) { + fprintf(stderr, + "[%" PY_FORMAT_SIZE_T "d refs, " + "%" PY_FORMAT_SIZE_T "d blocks]\n", + _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); } #endif /* Py_REF_DEBUG */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index caa324e3afa..3265d701810 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1006,6 +1006,11 @@ Py_FinalizeEx(void) while (_PyGC_CollectIfEnabled() > 0) /* nothing */; #endif + +#ifdef Py_REF_DEBUG + PyObject *showrefcount = _PyDebug_XOptionShowRefCount(); +#endif + /* Destroy all modules */ PyImport_Cleanup(); @@ -1053,7 +1058,10 @@ Py_FinalizeEx(void) /* dump hash stats */ _PyHash_Fini(); - _PY_DEBUG_PRINT_TOTAL_REFS(); +#ifdef Py_REF_DEBUG + if (showrefcount == Py_True) + _PyDebug_PrintTotalRefs(); +#endif #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary diff --git a/Python/pystate.c b/Python/pystate.c index be012d7d46a..08048428610 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -96,8 +96,6 @@ PyInterpreterState_New(void) interp->builtins_copy = NULL; interp->tstate_head = NULL; interp->check_interval = 100; - interp->warnoptions = NULL; - interp->xoptions = NULL; interp->num_threads = 0; interp->pythread_stacksize = 0; interp->codec_search_path = NULL; diff --git a/Python/pythonrun.c b/Python/pythonrun.c index d1d4a69a8dd..df814fbed97 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -113,7 +113,10 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * err = -1; for (;;) { ret = PyRun_InteractiveOneObject(fp, filename, flags); - _PY_DEBUG_PRINT_TOTAL_REFS(); +#ifdef Py_REF_DEBUG + if (_PyDebug_XOptionShowRefCount() == Py_True) + _PyDebug_PrintTotalRefs(); +#endif if (ret == E_EOF) { err = 0; break; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 3ecd7fca54a..5bde4b7b702 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -36,12 +36,14 @@ extern const char *PyWin_DLLVersionString; _Py_IDENTIFIER(_); _Py_IDENTIFIER(__sizeof__); +_Py_IDENTIFIER(_xoptions); _Py_IDENTIFIER(buffer); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(encoding); _Py_IDENTIFIER(path); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); +_Py_IDENTIFIER(warnoptions); _Py_IDENTIFIER(write); PyObject * @@ -1479,13 +1481,17 @@ list_builtin_module_names(void) static PyObject * get_warnoptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); if (warnoptions == NULL || !PyList_Check(warnoptions)) { Py_XDECREF(warnoptions); warnoptions = PyList_New(0); if (warnoptions == NULL) return NULL; - PyThreadState_GET()->interp->warnoptions = warnoptions; + if (_PySys_SetObjectId(&PyId_warnoptions, warnoptions)) { + Py_DECREF(warnoptions); + return NULL; + } + Py_DECREF(warnoptions); } return warnoptions; } @@ -1493,7 +1499,7 @@ get_warnoptions(void) void PySys_ResetWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1522,20 +1528,24 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } static PyObject * get_xoptions(void) { - PyObject *xoptions = PyThreadState_GET()->interp->xoptions; + PyObject *xoptions = _PySys_GetObjectId(&PyId__xoptions); if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); if (xoptions == NULL) return NULL; - PyThreadState_GET()->interp->xoptions = xoptions; + if (_PySys_SetObjectId(&PyId__xoptions, xoptions)) { + Py_DECREF(xoptions); + return NULL; + } + Py_DECREF(xoptions); } return xoptions; } @@ -2084,16 +2094,6 @@ _PySys_BeginInit(void) #undef SET_SYS_FROM_STRING_BORROW /* Updating the sys namespace, returning integer error codes */ -#define SET_SYS_FROM_STRING_BORROW_INT_RESULT(key, value) \ - do { \ - PyObject *v = (value); \ - if (v == NULL) \ - return -1; \ - res = PyDict_SetItemString(sysdict, key, v); \ - if (res < 0) { \ - return res; \ - } \ - } while (0) #define SET_SYS_FROM_STRING_INT_RESULT(key, value) \ do { \ PyObject *v = (value); \ @@ -2138,15 +2138,11 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - PyObject *warnoptions = get_warnoptions(); - if (warnoptions == NULL) + if (get_warnoptions() == NULL) return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); - PyObject *xoptions = get_xoptions(); - if (xoptions == NULL) + if (get_xoptions() == NULL) return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); if (PyErr_Occurred()) return -1; @@ -2154,7 +2150,6 @@ _PySys_EndInit(PyObject *sysdict) } #undef SET_SYS_FROM_STRING_INT_RESULT -#undef SET_SYS_FROM_STRING_BORROW_INT_RESULT static PyObject * makepathobject(const wchar_t *path, wchar_t delim) From lp_benchmark_robot at intel.com Mon Sep 11 21:06:31 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 11 Sep 2017 18:06:31 -0700 Subject: [Python-checkins] [4 down, 2 up, 59 flat] Results for Python (master branch) 2017-09-11 Message-ID: <850d5ad7-305b-421d-8f30-8e1a23fdf3d7@orsmsx153.amr.corp.intel.com> Results for project python/master, build date: 2017-09-11 03:04:57-07:00. - commit: 2bb69a5 - previous commit: e3b2b4b - revision date: 2017-09-10 23:50:46-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.046% | -0.372% | +3.304% | +8.436% | +-----+------------------------+--------+------------+------------+------------+ | :-( | call_method| 0.519% | -3.489% | +16.507% | +16.444% | +-----+------------------------+--------+------------+------------+------------+ | :-( | call_method_slots| 0.177% | -3.897% | +17.685% | +15.522% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.717% | -2.089% | +17.247% | +14.243% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.142% | +0.412% | +0.313% | +17.370% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 2.489% | -0.430% | +9.844% | +10.961% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.633% | +0.674% | +6.883% | +10.602% | +-----+------------------------+--------+------------+------------+------------+ | :-( | crypto_pyaes| 0.753% | -2.341% | +1.240% | +8.868% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 5.317% | -7.112% | +3.847% | +21.625% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 3.986% | -5.487% | +5.933% | +13.239% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.144% | -0.399% | +3.575% | +6.613% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.590% | +0.333% | +5.950% | +4.660% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.857% | -0.819% | +3.244% | +6.134% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.188% | +0.066% | +7.514% | +11.072% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.568% | +1.188% | +6.640% | +8.491% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.760% | +0.685% | +7.425% | +9.507% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.335% | -1.098% | +8.647% | +12.171% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.742% | -0.451% | +8.020% | +7.738% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.220% | -0.320% | +3.810% | +9.666% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.086% | -3.140% | -1.132% | +14.059% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.672% | +0.373% | +6.516% | +10.721% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 3.836% | -2.482% | +45.962% | +13.452% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.720% | +0.617% | +7.769% | +10.910% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.384% | +0.245% | +18.291% | +11.624% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.769% | +0.490% | +7.479% | +10.704% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.773% | -0.874% | +4.071% | +4.843% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.203% | -1.693% | -2.859% | +5.154% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 1.059% | -1.436% | +1.586% | +7.886% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.652% | -4.020% | +3.337% | +10.275% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.449% | -2.259% | -0.990% | +22.738% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_dict| 0.292% | +2.471% | +3.074% | +22.409% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list|10.520% | -2.425% | +5.169% | +21.861% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 2.084% | +1.419% | +12.633% | +7.820% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.393% | -0.051% | +0.152% | +10.373% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.140% | -0.323% | +8.937% | +5.093% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.101% | -0.266% | +0.918% | +4.986% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.990% | -0.978% | +8.349% | +13.724% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.617% | -0.367% | -12.529% | +14.236% | +-----+------------------------+--------+------------+------------+------------+ | :-) | regex_dna| 0.665% | +3.148% | +1.642% | +8.845% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 1.747% | +4.561% | +0.627% | +2.231% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.084% | -0.583% | +11.119% | +4.061% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.262% | -1.423% | +7.074% | +15.085% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.410% | -0.344% | +0.630% | +3.329% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.376% | -1.248% | +26.983% | +7.038% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.501% | +0.184% | +5.071% | +4.279% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.744% | -0.128% | +14.565% | +9.212% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 3.442% | +0.006% | +1.278% | +1.701% | +-----+------------------------+--------+------------+------------+------------+ | :-( | spectral_norm| 1.765% | -6.228% | -0.847% | +9.883% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.919% | -0.003% | +5.159% | +7.559% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.602% | -1.551% | +4.258% | +5.210% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.885% | -2.896% | -0.089% | +11.460% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.317% | +0.135% | +11.983% | +8.000% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.956% | -0.209% | +9.028% | +7.018% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.683% | -1.508% | +10.267% | +10.086% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.154% | -1.724% | +8.394% | +12.770% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.834% | -2.912% | +22.961% | +9.003% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.551% | -0.626% | +5.353% | +6.739% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 2.247% | -0.682% | +1.340% | -1.020% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 9.545% | +0.959% | +7.596% | +21.199% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.009% | +1.316% | -0.415% | +19.414% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 1.801% | -0.189% | +6.876% | +6.175% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.973% | -0.515% | +6.256% | +6.591% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.601% | -2.163% | +0.818% | +7.830% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 2.001% | +1.362% | -4.749% | +10.711% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.425% | -0.932% | +6.383% | +8.121% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/4-down-2-up-59-flat-results-for-python-master-branch-2017-09-11 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Mon Sep 11 21:30:46 2017 From: webhook-mailer at python.org (Eric Snow) Date: Tue, 12 Sep 2017 01:30:46 -0000 Subject: [Python-checkins] bpo-30860: Move windows.h include out of internal/*.h. (#3458) Message-ID: https://github.com/python/cpython/commit/fc1bf872e9d31f3e837f686210f94e57ad3d6582 commit: fc1bf872e9d31f3e837f686210f94e57ad3d6582 branch: master author: Eric Snow committer: GitHub date: 2017-09-11T18:30:43-07:00 summary: bpo-30860: Move windows.h include out of internal/*.h. (#3458) PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them. files: M Include/pyport.h M Modules/_json.c M Modules/_pickle.c M PC/pyconfig.h diff --git a/Include/pyport.h b/Include/pyport.h index 6c91898b44f..dbf6db68768 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -641,7 +641,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); /* only get special linkage if built as shared or platform is Cygwin */ #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) # if defined(HAVE_DECLSPEC_DLL) -# ifdef Py_BUILD_CORE +# if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE /* module init functions inside the core need no external linkage */ @@ -773,7 +773,7 @@ extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); #define PY_LITTLE_ENDIAN 1 #endif -#ifdef Py_BUILD_CORE +#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) /* * Macros to protect CRT calls against instant termination when passed an * invalid parameter (issue23524). diff --git a/Modules/_json.c b/Modules/_json.c index f1da2302dd3..769696d9d68 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1,7 +1,7 @@ /* Core extension modules are built-in on some platforms (e.g. Windows). */ #ifdef Py_BUILD_CORE -#define Py_BUILD_CORE_MODULE +#define Py_BUILD_CORE_BUILTIN #undef Py_BUILD_CORE #endif diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 5fbf0995f4c..bcbe4ac7945 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1,7 +1,7 @@ /* Core extension modules are built-in on some platforms (e.g. Windows). */ #ifdef Py_BUILD_CORE -#define Py_BUILD_CORE_MODULE +#define Py_BUILD_CORE_BUILTIN #undef Py_BUILD_CORE #endif diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 4e25fbd973d..db745dee761 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -143,7 +143,7 @@ WIN32 is still required for the locale module. structures etc so it can optionally use new Windows features if it determines at runtime they are available. */ -#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE) +#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) || defined(Py_BUILD_CORE_MODULE) #ifndef NTDDI_VERSION #define NTDDI_VERSION Py_NTDDI #endif @@ -277,21 +277,20 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ /* For an MSVC DLL, we can nominate the .lib files used by extensions */ #ifdef MS_COREDLL -# ifndef Py_BUILD_CORE /* not building the core - must be an ext */ -# ifndef Py_BUILD_CORE_MODULE -# if defined(_MSC_VER) - /* So MSVC users need not specify the .lib - file in their Makefile (other compilers are - generally taken care of by distutils.) */ -# if defined(_DEBUG) -# pragma comment(lib,"python37_d.lib") -# elif defined(Py_LIMITED_API) -# pragma comment(lib,"python3.lib") -# else -# pragma comment(lib,"python37.lib") -# endif /* _DEBUG */ -# endif /* _MSC_VER */ -# endif /* Py_BUILD_CORE_MODULE */ +# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN) + /* not building the core - must be an ext */ +# if defined(_MSC_VER) + /* So MSVC users need not specify the .lib + file in their Makefile (other compilers are + generally taken care of by distutils.) */ +# if defined(_DEBUG) +# pragma comment(lib,"python37_d.lib") +# elif defined(Py_LIMITED_API) +# pragma comment(lib,"python3.lib") +# else +# pragma comment(lib,"python37.lib") +# endif /* _DEBUG */ +# endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ #endif /* MS_COREDLL */ From webhook-mailer at python.org Tue Sep 12 02:08:52 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Tue, 12 Sep 2017 06:08:52 -0000 Subject: [Python-checkins] [3.6] bpo-31373: remove overly strict float range checks (GH-3486) (#3495) Message-ID: https://github.com/python/cpython/commit/cb356c2ecc0528d47fee2b9f4b32da4fcfb48b3a commit: cb356c2ecc0528d47fee2b9f4b32da4fcfb48b3a branch: 3.6 author: Benjamin Peterson committer: GitHub date: 2017-09-11T23:08:49-07:00 summary: [3.6] bpo-31373: remove overly strict float range checks (GH-3486) (#3495) This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 except for the pytime.c parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be rounded into finite floats. Tests were added to very this behavior. (cherry picked from commit 2bb69a5b4e7f96cb35d1b28aa7b7b3974b351f59) files: M Lib/test/test_float.py M Lib/test/test_getargs2.py M Objects/floatobject.c M Python/getargs.c diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 6491f458c3a..c5ca50c8f71 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -613,6 +613,12 @@ def test_float_specials_do_unpack(self): (' FLT_MAX && !Py_IS_INFINITY(x)) + if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) goto Overflow; unsigned char s[sizeof(float)]; - float y = (float)x; memcpy(s, &y, sizeof(float)); if ((float_format == ieee_little_endian_format && !le) diff --git a/Python/getargs.c b/Python/getargs.c index 8fb19f34ecb..13819642060 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -811,10 +811,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, double dval = PyFloat_AsDouble(arg); if (PyErr_Occurred()) RETURN_ERR_OCCURRED; - else if (dval > FLT_MAX) - *p = (float)INFINITY; - else if (dval < -FLT_MAX) - *p = (float)-INFINITY; else *p = (float) dval; break; From webhook-mailer at python.org Tue Sep 12 02:48:31 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 12 Sep 2017 06:48:31 -0000 Subject: [Python-checkins] [3.6] bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (GH-3496) (#3509) Message-ID: https://github.com/python/cpython/commit/9adc87b0f82e5169c5f44739f89212a86013d1c4 commit: 9adc87b0f82e5169c5f44739f89212a86013d1c4 branch: 3.6 author: Serhiy Storchaka committer: GitHub date: 2017-09-12T09:48:27+03:00 summary: [3.6] bpo-31416: Fix assertion failures in case of a bad warnings.filters or warnings.defaultaction. (GH-3496) (#3509) Patch by Oren Milman.. (cherry picked from commit 9d984fd2b097c8c29479d1c3eb740995fe1ccb0d) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index c66fe3aa878..354da6b46f0 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -805,6 +805,21 @@ def test_issue31411(self): with self.assertRaises(TypeError): wmod.warn_explicit('foo', Warning, 'bar', 1, registry=None) + @support.cpython_only + def test_issue31416(self): + # warn_explicit() shouldn't cause an assertion failure in case of a + # bad warnings.filters or warnings.defaultaction. + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filters = [(None, None, Warning, None, 0)] + with self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1) + + wmod.filters = [] + with support.swap_attr(wmod, 'defaultaction', None), \ + self.assertRaises(TypeError): + wmod.warn_explicit('foo', Warning, 'bar', 1) + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst new file mode 100644 index 00000000000..148a5c8eda5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst @@ -0,0 +1,2 @@ +Fix assertion failures in case of a bad warnings.filters or +warnings.defaultaction. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 2b04b9081e2..7270d2c2ecb 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -118,7 +118,14 @@ get_default_action(void) } return _default_action; } - + if (!PyUnicode_Check(default_action)) { + PyErr_Format(PyExc_TypeError, + MODULE_NAME ".defaultaction must be a string, " + "not '%.200s'", + Py_TYPE(default_action)->tp_name); + Py_DECREF(default_action); + return NULL; + } Py_DECREF(_default_action); _default_action = default_action; return default_action; @@ -171,6 +178,14 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, mod = PyTuple_GET_ITEM(tmp_item, 3); ln_obj = PyTuple_GET_ITEM(tmp_item, 4); + if (!PyUnicode_Check(action)) { + PyErr_Format(PyExc_TypeError, + "action must be a string, not '%.200s'", + Py_TYPE(action)->tp_name); + Py_DECREF(tmp_item); + return NULL; + } + good_msg = check_matched(msg, text); if (good_msg == -1) { Py_DECREF(tmp_item); @@ -210,8 +225,6 @@ get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, return action; } - PyErr_SetString(PyExc_ValueError, - MODULE_NAME ".defaultaction not found"); return NULL; } From solipsis at pitrou.net Tue Sep 12 05:22:08 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 12 Sep 2017 09:22:08 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=7 Message-ID: <20170912092207.90568.C84737A523881602@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [2, -1, 1] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogBut1mO', '--timeout', '7200'] From webhook-mailer at python.org Tue Sep 12 07:45:20 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 12 Sep 2017 11:45:20 -0000 Subject: [Python-checkins] bpo-27099: Finish updating IDLE doc and help text. (#3510) Message-ID: https://github.com/python/cpython/commit/adb4cd2a2a59019ac6955e0fd531c9fec9258962 commit: adb4cd2a2a59019ac6955e0fd531c9fec9258962 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-12T07:45:15-04:00 summary: bpo-27099: Finish updating IDLE doc and help text. (#3510) As needed for the conversion of extensions to features. files: M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 4f51f3f0ac2..38ab4f114b8 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -671,7 +671,7 @@ Extensions ^^^^^^^^^^ IDLE contains an extension facility. Preferences for extensions can be -changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The only current default -extension is zoomheight. It exists as an extension primarily to be an example -and for testing purposes. \ No newline at end of file +changed with the Extensions tab of the preferences dialog. See the +beginning of config-extensions.def in the idlelib directory for further +information. The only current default extension is zzdummy, an example +also used for testing. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 0a3062e1564..07fcac5fb3b 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -635,20 +635,11 @@

    25.5.4.3. Extensions?

    IDLE contains an extension facility. Preferences for extensions can be -changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The default extensions -are currently:

    -
      -
    • FormatParagraph
    • -
    • AutoExpand
    • -
    • ZoomHeight
    • -
    • ScriptBinding
    • -
    • CallTips
    • -
    • ParenMatch
    • -
    • AutoComplete
    • -
    • CodeContext
    • -
    • RstripExtension
    • -
    +changed with the Extensions tab of the preferences dialog. See the +beginning of config-extensions.def in the idlelib directory for further +information. The only current default extension is zzdummy, an example +also used for testing. +

    @@ -711,7 +702,7 @@
    • Report a Bug
    • - Show Source
    • @@ -768,7 +759,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
      - Last updated on Jun 13, 2017. + Last updated on Sep 12, 2017. Found a bug?
      Created using Sphinx 1.3.6. From webhook-mailer at python.org Tue Sep 12 08:23:40 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 12 Sep 2017 12:23:40 -0000 Subject: [Python-checkins] [3.6] bpo-27099: Finish updating IDLE doc and help text. (GH-3510) (#3511) Message-ID: https://github.com/python/cpython/commit/01dcaa5c996baf019656cf51451bb1b6ecd720fa commit: 01dcaa5c996baf019656cf51451bb1b6ecd720fa branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-12T08:23:38-04:00 summary: [3.6] bpo-27099: Finish updating IDLE doc and help text. (GH-3510) (#3511) As needed for the conversion of extensions to features. (cherry picked from commit adb4cd2a2a59019ac6955e0fd531c9fec9258962) files: M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 4f51f3f0ac2..38ab4f114b8 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -671,7 +671,7 @@ Extensions ^^^^^^^^^^ IDLE contains an extension facility. Preferences for extensions can be -changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The only current default -extension is zoomheight. It exists as an extension primarily to be an example -and for testing purposes. \ No newline at end of file +changed with the Extensions tab of the preferences dialog. See the +beginning of config-extensions.def in the idlelib directory for further +information. The only current default extension is zzdummy, an example +also used for testing. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 0a3062e1564..07fcac5fb3b 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -635,20 +635,11 @@

      25.5.4.3. Extensions?

      IDLE contains an extension facility. Preferences for extensions can be -changed with Configure Extensions. See the beginning of config-extensions.def -in the idlelib directory for further information. The default extensions -are currently:

      -
        -
      • FormatParagraph
      • -
      • AutoExpand
      • -
      • ZoomHeight
      • -
      • ScriptBinding
      • -
      • CallTips
      • -
      • ParenMatch
      • -
      • AutoComplete
      • -
      • CodeContext
      • -
      • RstripExtension
      • -
      +changed with the Extensions tab of the preferences dialog. See the +beginning of config-extensions.def in the idlelib directory for further +information. The only current default extension is zzdummy, an example +also used for testing. +

      @@ -711,7 +702,7 @@
      • Report a Bug
      • - Show Source
      • @@ -768,7 +759,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
        - Last updated on Jun 13, 2017. + Last updated on Sep 12, 2017. Found a bug?
        Created using Sphinx 1.3.6. From webhook-mailer at python.org Tue Sep 12 09:05:23 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 12 Sep 2017 13:05:23 -0000 Subject: [Python-checkins] bpo-31421: Document how IDLE runs tkinter programs. (#3513) Message-ID: https://github.com/python/cpython/commit/98758bc67fb39b74bab368bef8ff3b34554c77c8 commit: 98758bc67fb39b74bab368bef8ff3b34554c77c8 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-12T09:05:16-04:00 summary: bpo-31421: Document how IDLE runs tkinter programs. (#3513) IDLE calls tcl/tk update in the background in order to make live interaction and experimentatin with tkinter applications much easier. files: A Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 38ab4f114b8..0faeb6df934 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -599,15 +599,15 @@ starting from a console (``python -m idlelib)`` and see if a message appears. IDLE-console differences ^^^^^^^^^^^^^^^^^^^^^^^^ -As much as possible, the result of executing Python code with IDLE is the -same as executing the same code in a console window. However, the different -interface and operation occasionally affect visible results. For instance, -``sys.modules`` starts with more entries. +With rare exceptions, the result of executing Python code with IDLE is +intended to be the same as executing the same code in a console window. +However, the different interface and operation occasionally affect +visible results. For instance, ``sys.modules`` starts with more entries. IDLE also replaces ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` with objects that get input from and send output to the Shell window. -When this window has the focus, it controls the keyboard and screen. -This is normally transparent, but functions that directly access the keyboard +When Shell has the focus, it controls the keyboard and screen. This is +normally transparent, but functions that directly access the keyboard and screen will not work. If ``sys`` is reset with ``importlib.reload(sys)``, IDLE's changes are lost and things like ``input``, ``raw_input``, and ``print`` will not work correctly. @@ -617,6 +617,29 @@ Some consoles only work with a single physical line at a time. IDLE uses ``exec`` to run each statement. As a result, ``'__builtins__'`` is always defined for each statement. +Developing tkinter applications +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +IDLE is intentionally different from standard Python in order to +facilitate development of tkinter programs. Enter ``import tkinter as tk; +root = tk.Tk()`` in standard Python and nothing appears. Enter the same +in IDLE and a tk window appears. In standard Python, one must also enter +``root.update()`` to see the window. IDLE does the equivalent in the +background, about 20 times a second, which is about every 50 milleseconds. +Next enter ``b = tk.Button(root, text='button'); b.pack()``. Again, +nothing visibly changes in standard Python until one enters ``root.update()``. + +Most tkinter programs run ``root.mainloop()``, which usually does not +return until the tk app is destroyed. If the program is run with +``python -i`` or from an IDLE editor, a ``>>>`` shell prompt does not +appear until ``mainloop()`` returns, at which time there is nothing left +to interact with. + +When running a tkinter program from an IDLE editor, one can comment out +the mainloop call. One then gets a shell prompt immediately and can +interact with the live application. One just has to remember to +re-enable the mainloop call when running in standard Python. + Running without a subprocess ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 07fcac5fb3b..9005157dd98 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -573,14 +573,14 @@

        25.5.3.3. IDLE-console differences?

        -

        As much as possible, the result of executing Python code with IDLE is the -same as executing the same code in a console window. However, the different -interface and operation occasionally affect visible results. For instance, -sys.modules starts with more entries.

        +

        With rare exceptions, the result of executing Python code with IDLE is +intended to be the same as executing the same code in a console window. +However, the different interface and operation occasionally affect +visible results. For instance, sys.modules starts with more entries.

        IDLE also replaces sys.stdin, sys.stdout, and sys.stderr with objects that get input from and send output to the Shell window. -When this window has the focus, it controls the keyboard and screen. -This is normally transparent, but functions that directly access the keyboard +When Shell has the focus, it controls the keyboard and screen. This is +normally transparent, but functions that directly access the keyboard and screen will not work. If sys is reset with importlib.reload(sys), IDLE’s changes are lost and things like input, raw_input, and print will not work correctly.

        @@ -589,8 +589,28 @@ exec to run each statement. As a result, '__builtins__' is always defined for each statement.

        +
        +

        25.5.3.4. Developing tkinter applications?

        +

        IDLE is intentionally different from standard Python in order to +facilitate development of tkinter programs. Enter import tkinter as tk; +root = tk.Tk() in standard Python and nothing appears. Enter the same +in IDLE and a tk window appears. In standard Python, one must also enter +root.update() to see the window. IDLE does the equivalent in the +background, about 20 times a second, which is about every 50 milleseconds. +Next enter b = tk.Button(root, text='button'); b.pack(). Again, +nothing visibly changes in standard Python until one enters root.update().

        +

        Most tkinter programs run root.mainloop(), which usually does not +return until the tk app is destroyed. If the program is run with +python -i or from an IDLE editor, a >>> shell prompt does not +appear until mainloop() returns, at which time there is nothing left +to interact with.

        +

        When running a tkinter program from an IDLE editor, one can comment out +the mainloop call. One then gets a shell prompt immediately and can +interact with the live application. One just has to remember to +re-enable the mainloop call when running in standard Python.

        +
        -

        25.5.3.4. Running without a subprocess?

        +

        25.5.3.5. Running without a subprocess?

        By default, IDLE executes user code in a separate subprocess via a socket, which uses the internal loopback interface. This connection is not externally visible and no data is sent to or received from the Internet. @@ -638,8 +658,7 @@ changed with the Extensions tab of the preferences dialog. See the beginning of config-extensions.def in the idlelib directory for further information. The only current default extension is zzdummy, an example -also used for testing. -

        +also used for testing.

        @@ -678,7 +697,8 @@
      • 25.5.3.1. Command line usage
      • 25.5.3.2. Startup failure
      • 25.5.3.3. IDLE-console differences
      • -
      • 25.5.3.4. Running without a subprocess
      • +
      • 25.5.3.4. Developing tkinter applications
      • +
      • 25.5.3.5. Running without a subprocess
    • 25.5.4. Help and preferences
        diff --git a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst new file mode 100644 index 00000000000..f3e4ab22320 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst @@ -0,0 +1,4 @@ +Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the +background in order to make live + +interaction and experimentatin with tkinter applications much easier. From webhook-mailer at python.org Tue Sep 12 09:45:03 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 12 Sep 2017 13:45:03 -0000 Subject: [Python-checkins] [3.6] bpo-31421: Document how IDLE runs tkinter programs. (GH-3513) (#3514) Message-ID: https://github.com/python/cpython/commit/4d7807ab9ad9f990e948d250bbb390b23a790764 commit: 4d7807ab9ad9f990e948d250bbb390b23a790764 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-12T09:44:59-04:00 summary: [3.6] bpo-31421: Document how IDLE runs tkinter programs. (GH-3513) (#3514) IDLE calls tcl/tk update in the background in order to make live interaction and experimentatin with tkinter applications much easier. (cherry picked from commit 98758bc67fb39b74bab368bef8ff3b34554c77c8) files: A Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 38ab4f114b8..0faeb6df934 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -599,15 +599,15 @@ starting from a console (``python -m idlelib)`` and see if a message appears. IDLE-console differences ^^^^^^^^^^^^^^^^^^^^^^^^ -As much as possible, the result of executing Python code with IDLE is the -same as executing the same code in a console window. However, the different -interface and operation occasionally affect visible results. For instance, -``sys.modules`` starts with more entries. +With rare exceptions, the result of executing Python code with IDLE is +intended to be the same as executing the same code in a console window. +However, the different interface and operation occasionally affect +visible results. For instance, ``sys.modules`` starts with more entries. IDLE also replaces ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` with objects that get input from and send output to the Shell window. -When this window has the focus, it controls the keyboard and screen. -This is normally transparent, but functions that directly access the keyboard +When Shell has the focus, it controls the keyboard and screen. This is +normally transparent, but functions that directly access the keyboard and screen will not work. If ``sys`` is reset with ``importlib.reload(sys)``, IDLE's changes are lost and things like ``input``, ``raw_input``, and ``print`` will not work correctly. @@ -617,6 +617,29 @@ Some consoles only work with a single physical line at a time. IDLE uses ``exec`` to run each statement. As a result, ``'__builtins__'`` is always defined for each statement. +Developing tkinter applications +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +IDLE is intentionally different from standard Python in order to +facilitate development of tkinter programs. Enter ``import tkinter as tk; +root = tk.Tk()`` in standard Python and nothing appears. Enter the same +in IDLE and a tk window appears. In standard Python, one must also enter +``root.update()`` to see the window. IDLE does the equivalent in the +background, about 20 times a second, which is about every 50 milleseconds. +Next enter ``b = tk.Button(root, text='button'); b.pack()``. Again, +nothing visibly changes in standard Python until one enters ``root.update()``. + +Most tkinter programs run ``root.mainloop()``, which usually does not +return until the tk app is destroyed. If the program is run with +``python -i`` or from an IDLE editor, a ``>>>`` shell prompt does not +appear until ``mainloop()`` returns, at which time there is nothing left +to interact with. + +When running a tkinter program from an IDLE editor, one can comment out +the mainloop call. One then gets a shell prompt immediately and can +interact with the live application. One just has to remember to +re-enable the mainloop call when running in standard Python. + Running without a subprocess ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 07fcac5fb3b..9005157dd98 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -573,14 +573,14 @@

        25.5.3.3. IDLE-console differences?

        -

        As much as possible, the result of executing Python code with IDLE is the -same as executing the same code in a console window. However, the different -interface and operation occasionally affect visible results. For instance, -sys.modules starts with more entries.

        +

        With rare exceptions, the result of executing Python code with IDLE is +intended to be the same as executing the same code in a console window. +However, the different interface and operation occasionally affect +visible results. For instance, sys.modules starts with more entries.

        IDLE also replaces sys.stdin, sys.stdout, and sys.stderr with objects that get input from and send output to the Shell window. -When this window has the focus, it controls the keyboard and screen. -This is normally transparent, but functions that directly access the keyboard +When Shell has the focus, it controls the keyboard and screen. This is +normally transparent, but functions that directly access the keyboard and screen will not work. If sys is reset with importlib.reload(sys), IDLE’s changes are lost and things like input, raw_input, and print will not work correctly.

        @@ -589,8 +589,28 @@ exec to run each statement. As a result, '__builtins__' is always defined for each statement.

        +
        +

        25.5.3.4. Developing tkinter applications?

        +

        IDLE is intentionally different from standard Python in order to +facilitate development of tkinter programs. Enter import tkinter as tk; +root = tk.Tk() in standard Python and nothing appears. Enter the same +in IDLE and a tk window appears. In standard Python, one must also enter +root.update() to see the window. IDLE does the equivalent in the +background, about 20 times a second, which is about every 50 milleseconds. +Next enter b = tk.Button(root, text='button'); b.pack(). Again, +nothing visibly changes in standard Python until one enters root.update().

        +

        Most tkinter programs run root.mainloop(), which usually does not +return until the tk app is destroyed. If the program is run with +python -i or from an IDLE editor, a >>> shell prompt does not +appear until mainloop() returns, at which time there is nothing left +to interact with.

        +

        When running a tkinter program from an IDLE editor, one can comment out +the mainloop call. One then gets a shell prompt immediately and can +interact with the live application. One just has to remember to +re-enable the mainloop call when running in standard Python.

        +
        -

        25.5.3.4. Running without a subprocess?

        +

        25.5.3.5. Running without a subprocess?

        By default, IDLE executes user code in a separate subprocess via a socket, which uses the internal loopback interface. This connection is not externally visible and no data is sent to or received from the Internet. @@ -638,8 +658,7 @@ changed with the Extensions tab of the preferences dialog. See the beginning of config-extensions.def in the idlelib directory for further information. The only current default extension is zzdummy, an example -also used for testing. -

        +also used for testing.

        @@ -678,7 +697,8 @@
      • 25.5.3.1. Command line usage
      • 25.5.3.2. Startup failure
      • 25.5.3.3. IDLE-console differences
      • -
      • 25.5.3.4. Running without a subprocess
      • +
      • 25.5.3.4. Developing tkinter applications
      • +
      • 25.5.3.5. Running without a subprocess
    • 25.5.4. Help and preferences
        diff --git a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst new file mode 100644 index 00000000000..f3e4ab22320 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst @@ -0,0 +1,4 @@ +Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the +background in order to make live + +interaction and experimentatin with tkinter applications much easier. From webhook-mailer at python.org Tue Sep 12 10:39:20 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 12 Sep 2017 14:39:20 -0000 Subject: [Python-checkins] bpo-31428: Prevent raising a SystemError in case the memo arg of ElementTree.Element.__deepcopy__() isn't a dictionary. (#3512) Message-ID: https://github.com/python/cpython/commit/d056818ed2ade6d28190a375d7183f4aef9caa55 commit: d056818ed2ade6d28190a375d7183f4aef9caa55 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-12T17:39:15+03:00 summary: bpo-31428: Prevent raising a SystemError in case the memo arg of ElementTree.Element.__deepcopy__() isn't a dictionary. (#3512) files: M Modules/_elementtree.c M Modules/clinic/_elementtree.c.h diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 857005a2a9b..98d5e7f5062 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -733,14 +733,14 @@ LOCAL(PyObject *) deepcopy(PyObject *, PyObject *); /*[clinic input] _elementtree.Element.__deepcopy__ - memo: object + memo: object(subclass_of="&PyDict_Type") / [clinic start generated code]*/ static PyObject * -_elementtree_Element___deepcopy__(ElementObject *self, PyObject *memo) -/*[clinic end generated code: output=d1f19851d17bf239 input=df24c2b602430b77]*/ +_elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo) +/*[clinic end generated code: output=eefc3df50465b642 input=a2d40348c0aade10]*/ { Py_ssize_t i; ElementObject* element; @@ -849,7 +849,8 @@ deepcopy(PyObject *object, PyObject *memo) /* Fall through to general case */ } else if (Element_CheckExact(object)) { - return _elementtree_Element___deepcopy__((ElementObject *)object, memo); + return _elementtree_Element___deepcopy___impl( + (ElementObject *)object, memo); } } diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h index 19a77978f36..9563afa88d0 100644 --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -70,6 +70,24 @@ PyDoc_STRVAR(_elementtree_Element___deepcopy____doc__, #define _ELEMENTTREE_ELEMENT___DEEPCOPY___METHODDEF \ {"__deepcopy__", (PyCFunction)_elementtree_Element___deepcopy__, METH_O, _elementtree_Element___deepcopy____doc__}, +static PyObject * +_elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo); + +static PyObject * +_elementtree_Element___deepcopy__(ElementObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *memo; + + if (!PyArg_Parse(arg, "O!:__deepcopy__", &PyDict_Type, &memo)) { + goto exit; + } + return_value = _elementtree_Element___deepcopy___impl(self, memo); + +exit: + return return_value; +} + PyDoc_STRVAR(_elementtree_Element___sizeof____doc__, "__sizeof__($self, /)\n" "--\n" @@ -731,4 +749,4 @@ _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject **args, Py_ssi exit: return return_value; } -/*[clinic end generated code: output=75d0ff80e20b830f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ed55bd5209c12364 input=a9049054013a1b77]*/ From webhook-mailer at python.org Tue Sep 12 13:49:26 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 12 Sep 2017 17:49:26 -0000 Subject: [Python-checkins] bpo-31234: Enhance test_thread.test_forkinthread() (#3516) Message-ID: https://github.com/python/cpython/commit/a15d155aadfad232158f530278505cdc6f326f93 commit: a15d155aadfad232158f530278505cdc6f326f93 branch: master author: Victor Stinner committer: GitHub date: 2017-09-12T10:49:22-07:00 summary: bpo-31234: Enhance test_thread.test_forkinthread() (#3516) * test_thread.test_forkinthread() now waits until the thread completes. * Check the status in the test method, not in the thread function * Don't ignore RuntimeError anymore: since the commit 346cbd351ee0dd3ab9cb9f0e4cb625556707877e (bpo-16500, os.register_at_fork(), os.fork() cannot fail anymore with RuntimeError. * Replace 0.01 literal with a new POLL_SLEEP constant * test_forkinthread(): test if os.fork() exists rather than testing the platform. files: M Lib/test/test_thread.py diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index 2e2655aee7f..2dd1593eaa0 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -11,6 +11,7 @@ NUMTASKS = 10 NUMTRIPS = 3 +POLL_SLEEP = 0.010 # seconds = 10 ms _print_mutex = thread.allocate_lock() @@ -114,7 +115,7 @@ def task(): mut.release() thread.start_new_thread(task, ()) while not started: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertEqual(thread._count(), orig + 1) # Allow the task to finish. mut.release() @@ -125,7 +126,7 @@ def task(): wr = weakref.ref(task, lambda _: done.append(None)) del task while not done: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertEqual(thread._count(), orig) def test_save_exception_state_on_error(self): @@ -148,7 +149,7 @@ def mywrite(self, *args): thread.start_new_thread(task, ()) started.acquire() while thread._count() > c: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertIn("Traceback", stderr.getvalue()) @@ -221,30 +222,36 @@ class TestForkInThread(unittest.TestCase): def setUp(self): self.read_fd, self.write_fd = os.pipe() - @unittest.skipIf(sys.platform.startswith('win'), - "This test is only appropriate for POSIX-like systems.") + @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork') @support.reap_threads def test_forkinthread(self): + running = True + status = "not set" + def thread1(): - try: - pid = os.fork() # fork in a thread - except RuntimeError: - os._exit(1) # exit the child + nonlocal running, status - if pid == 0: # child + # fork in a thread + pid = os.fork() + if pid == 0: + # child try: os.close(self.read_fd) os.write(self.write_fd, b"OK") finally: os._exit(0) - else: # parent + else: + # parent os.close(self.write_fd) pid, status = os.waitpid(pid, 0) - self.assertEqual(status, 0) + running = False thread.start_new_thread(thread1, ()) self.assertEqual(os.read(self.read_fd, 2), b"OK", "Unable to fork() in thread") + while running: + time.sleep(POLL_SLEEP) + self.assertEqual(status, 0) def tearDown(self): try: From webhook-mailer at python.org Tue Sep 12 17:18:26 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 12 Sep 2017 21:18:26 -0000 Subject: [Python-checkins] [3.6] bpo-31250: test_asyncio: fix dangling threads (#3517) Message-ID: https://github.com/python/cpython/commit/5013a5ebc9978a58435036fa3860c465882c21da commit: 5013a5ebc9978a58435036fa3860c465882c21da branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-12T14:18:23-07:00 summary: [3.6] bpo-31250: test_asyncio: fix dangling threads (#3517) * bpo-31250, test_asyncio: fix dangling threads (#3252) * Explicitly call shutdown(wait=True) on executors to wait until all threads complete to prevent side effects between tests. * Fix test_loop_self_reading_exception(): don't mock loop.close(). Previously, the original close() method was called rather than the mock, because how set_event_loop() registered loop.close(). (cherry picked from commit 16432beadb8eba079c9786cc0c0eaacfd9fd2f7b) * bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264) Call doCleanups() to close the loop after calling executor.shutdown(wait=True): see TestCase.set_event_loop() of asyncio.test_utils. Replace also gc.collect() with support.gc_collect(). (cherry picked from commit e8a533fbc734af6eeb389202ba6c6e9c2548027f) files: M Lib/asyncio/test_utils.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_asyncio/test_futures.py M Lib/test/test_asyncio/test_proactor_events.py diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index 94d48e1361a..8b8c22a7475 100644 --- a/Lib/asyncio/test_utils.py +++ b/Lib/asyncio/test_utils.py @@ -438,12 +438,19 @@ def get_function_source(func): class TestCase(unittest.TestCase): + @staticmethod + def close_loop(loop): + executor = loop._default_executor + if executor is not None: + executor.shutdown(wait=True) + loop.close() + def set_event_loop(self, loop, *, cleanup=True): assert loop is not None # ensure that the event loop is passed explicitly in asyncio events.set_event_loop(None) if cleanup: - self.addCleanup(loop.close) + self.addCleanup(self.close_loop, loop) def new_test_loop(self, gen=None): loop = TestLoop(gen) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 9746678607c..27781a2d91b 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -258,8 +258,8 @@ def tearDown(self): if not self.loop.is_closed(): test_utils.run_briefly(self.loop) - self.loop.close() - gc.collect() + self.doCleanups() + support.gc_collect() super().tearDown() def test_run_until_complete_nesting(self): diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index a06059dc9b7..4320a901f49 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -413,6 +413,7 @@ def run(arg): self.assertTrue(asyncio.isfuture(f2)) self.assertEqual(res, 'oi') self.assertNotEqual(ident, threading.get_ident()) + ex.shutdown(wait=True) def test_wrap_future_future(self): f1 = self._new_future(loop=self.loop) @@ -428,6 +429,7 @@ def run(arg): f1 = ex.submit(run, 'oi') f2 = asyncio.wrap_future(f1) self.assertIs(self.loop, f2._loop) + ex.shutdown(wait=True) def test_wrap_future_cancel(self): f1 = concurrent.futures.Future() diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py index 4dfc61259f8..d76da661ab9 100644 --- a/Lib/test/test_asyncio/test_proactor_events.py +++ b/Lib/test/test_asyncio/test_proactor_events.py @@ -529,7 +529,6 @@ def test_loop_self_reading_fut(self): self.loop._loop_self_reading) def test_loop_self_reading_exception(self): - self.loop.close = mock.Mock() self.loop.call_exception_handler = mock.Mock() self.proactor.recv.side_effect = OSError() self.loop._loop_self_reading() From webhook-mailer at python.org Tue Sep 12 19:09:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 12 Sep 2017 23:09:47 -0000 Subject: [Python-checkins] [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (#3518) Message-ID: https://github.com/python/cpython/commit/c0e77364ca29df6cfb311e79892955c92bd8e595 commit: c0e77364ca29df6cfb311e79892955c92bd8e595 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-12T16:09:44-07:00 summary: [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (#3518) * bpo-30923: Disable warning that has been part of -Wextra since gcc-7.0. (#3142) (cherry picked from commit d73a960c575207539c3f9765cff26d4fff400b45) * bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) (cherry picked from commit f432a3234f9f2ee09bd40be03e06bf72865ee375) * bpo-31275: Small refactoring to silence a fall-through warning. (#3206) (cherry picked from commit 138753c1b96b5e06a5c5d409fa4cae5e2fe1108b) files: M Modules/_ctypes/_ctypes.c M Modules/_decimal/libmpdec/io.c M Modules/cjkcodecs/_codecs_iso2022.c M Objects/stringlib/codecs.h M Objects/unicodeobject.c M Python/ast.c M Python/ceval.c M Python/compile.c M Python/dtoa.c M Python/formatter_unicode.c M Python/getargs.c M Python/marshal.c M Python/pyhash.c M Python/wordcode_helpers.h diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 2c01e374f19..1ced6305d3d 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3675,7 +3675,7 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes, case (PARAMFLAG_FIN | PARAMFLAG_FOUT): *pinoutmask |= (1 << i); /* mark as inout arg */ (*pnumretvals)++; - /* fall through to PARAMFLAG_FIN... */ + /* fall through */ case 0: case PARAMFLAG_FIN: /* 'in' parameter. Copy it from inargs. */ diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c index 3aadfb04379..f45e558f1a9 100644 --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -45,6 +45,12 @@ PEP-3101 formatting for numeric types. */ +/* Disable warning that is part of -Wextra since gcc 7.0. */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7 + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + + /* * Work around the behavior of tolower() and strcasecmp() in certain * locales. For example, in tr_TR.utf8: diff --git a/Modules/cjkcodecs/_codecs_iso2022.c b/Modules/cjkcodecs/_codecs_iso2022.c index 1ce4218f308..7394cf67e0e 100644 --- a/Modules/cjkcodecs/_codecs_iso2022.c +++ b/Modules/cjkcodecs/_codecs_iso2022.c @@ -807,15 +807,9 @@ jisx0213_encoder(const Py_UCS4 *data, Py_ssize_t *length, void *config) case 2: /* second character of unicode pair */ coded = find_pairencmap((ucs2_t)data[0], (ucs2_t)data[1], jisx0213_pair_encmap, JISX0213_ENCPAIRS); - if (coded == DBCINV) { - *length = 1; - coded = find_pairencmap((ucs2_t)data[0], 0, - jisx0213_pair_encmap, JISX0213_ENCPAIRS); - if (coded == DBCINV) - return MAP_UNMAPPABLE; - } - else + if (coded != DBCINV) return coded; + /* fall through */ case -1: /* flush unterminated */ *length = 1; diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h index 43f2f3266fd..f019d9a96bf 100644 --- a/Objects/stringlib/codecs.h +++ b/Objects/stringlib/codecs.h @@ -330,7 +330,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode, case _Py_ERROR_REPLACE: memset(p, '?', endpos - startpos); p += (endpos - startpos); - /* fall through the ignore handler */ + /* fall through */ case _Py_ERROR_IGNORE: i += (endpos - startpos - 1); break; @@ -378,7 +378,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode, } startpos = k; assert(startpos < endpos); - /* fall through the default handler */ + /* fall through */ default: rep = unicode_encode_call_errorhandler( errors, &error_handler_obj, "utf-8", "surrogates not allowed", diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 1f221aff67c..e9fc6580383 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1779,6 +1779,7 @@ unicode_dealloc(PyObject *unicode) case SSTATE_INTERNED_IMMORTAL: Py_FatalError("Immortal interned string died."); + /* fall through */ default: Py_FatalError("Inconsistent interned string state."); @@ -6816,7 +6817,7 @@ unicode_encode_ucs1(PyObject *unicode, case _Py_ERROR_REPLACE: memset(str, '?', collend - collstart); str += (collend - collstart); - /* fall through ignore error handler */ + /* fall through */ case _Py_ERROR_IGNORE: pos = collend; break; @@ -6855,7 +6856,7 @@ unicode_encode_ucs1(PyObject *unicode, break; collstart = pos; assert(collstart != collend); - /* fallback to general error handling */ + /* fall through */ default: rep = unicode_encode_call_errorhandler(errors, &error_handler_obj, diff --git a/Python/ast.c b/Python/ast.c index 4fa68a371d4..aa4acc9b261 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1175,6 +1175,7 @@ ast_for_comp_op(struct compiling *c, const node *n) return In; if (strcmp(STR(n), "is") == 0) return Is; + /* fall through */ default: PyErr_Format(PyExc_SystemError, "invalid comp_op: %s", STR(n)); @@ -1189,6 +1190,7 @@ ast_for_comp_op(struct compiling *c, const node *n) return NotIn; if (strcmp(STR(CHILD(n, 0)), "is") == 0) return IsNot; + /* fall through */ default: PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s", STR(CHILD(n, 0)), STR(CHILD(n, 1))); @@ -3149,6 +3151,7 @@ ast_for_flow_stmt(struct compiling *c, const node *n) } return Raise(expression, cause, LINENO(n), n->n_col_offset, c->c_arena); } + /* fall through */ default: PyErr_Format(PyExc_SystemError, "unexpected flow_stmt: %d", TYPE(ch)); diff --git a/Python/ceval.c b/Python/ceval.c index 2b74d0e5730..b6ad444e70b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1875,9 +1875,11 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) switch (oparg) { case 2: cause = POP(); /* cause */ + /* fall through */ case 1: exc = POP(); /* exc */ - case 0: /* Fallthrough */ + /* fall through */ + case 0: if (do_raise(exc, cause)) { why = WHY_EXCEPTION; goto fast_block_end; diff --git a/Python/compile.c b/Python/compile.c index 6255ec7d47f..797a1840e6a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -4069,6 +4069,7 @@ expr_constant(struct compiler *c, expr_ty e) else if (o == Py_False) return 0; } + /* fall through */ default: return -1; } @@ -4361,13 +4362,13 @@ compiler_visit_expr(struct compiler *c, expr_ty e) switch (e->v.Attribute.ctx) { case AugLoad: ADDOP(c, DUP_TOP); - /* Fall through to load */ + /* Fall through */ case Load: ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names); break; case AugStore: ADDOP(c, ROT_TWO); - /* Fall through to save */ + /* Fall through */ case Store: ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names); break; diff --git a/Python/dtoa.c b/Python/dtoa.c index efcadc31e9c..01ca9b0b22f 100644 --- a/Python/dtoa.c +++ b/Python/dtoa.c @@ -1454,7 +1454,7 @@ _Py_dg_strtod(const char *s00, char **se) switch (c) { case '-': sign = 1; - /* no break */ + /* fall through */ case '+': c = *++s; } @@ -1523,7 +1523,7 @@ _Py_dg_strtod(const char *s00, char **se) switch (c) { case '-': esign = 1; - /* no break */ + /* fall through */ case '+': c = *++s; } @@ -2441,7 +2441,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits, break; case 2: leftright = 0; - /* no break */ + /* fall through */ case 4: if (ndigits <= 0) ndigits = 1; @@ -2449,7 +2449,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits, break; case 3: leftright = 0; - /* no break */ + /* fall through */ case 5: i = ndigits + k + 1; ilim = i; diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c index a2c2b3627c9..9192bfd6a67 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -312,6 +312,7 @@ parse_internal_render_format_spec(PyObject *format_spec, format->thousands_separators = LT_UNDER_FOUR_LOCALE; break; } + /* fall through */ default: invalid_comma_type(format->type); return 0; diff --git a/Python/getargs.c b/Python/getargs.c index 13819642060..ed6b8152de4 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -2260,8 +2260,8 @@ skipitem(const char **p_format, va_list *p_va, int flags) /* after 'e', only 's' and 't' is allowed */ goto err; format++; - /* explicit fallthrough to string cases */ } + /* fall through */ case 's': /* string */ case 'z': /* string or None */ diff --git a/Python/marshal.c b/Python/marshal.c index 7b12ab7510d..22ca49c7562 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1105,6 +1105,7 @@ r_object(RFILE *p) case TYPE_ASCII_INTERNED: is_interned = 1; + /* fall through */ case TYPE_ASCII: n = r_long(p); if (PyErr_Occurred()) @@ -1117,6 +1118,7 @@ r_object(RFILE *p) case TYPE_SHORT_ASCII_INTERNED: is_interned = 1; + /* fall through */ case TYPE_SHORT_ASCII: n = r_byte(p); if (n == EOF) { @@ -1142,6 +1144,7 @@ r_object(RFILE *p) case TYPE_INTERNED: is_interned = 1; + /* fall through */ case TYPE_UNICODE: { const char *buffer; diff --git a/Python/pyhash.c b/Python/pyhash.c index 57a2da715e1..a2ec2309c70 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -393,13 +393,13 @@ siphash24(const void *src, Py_ssize_t src_sz) { pt = (uint8_t *)&t; m = (uint8_t *)in; switch (src_sz) { - case 7: pt[6] = m[6]; - case 6: pt[5] = m[5]; - case 5: pt[4] = m[4]; + case 7: pt[6] = m[6]; /* fall through */ + case 6: pt[5] = m[5]; /* fall through */ + case 5: pt[4] = m[4]; /* fall through */ case 4: memcpy(pt, m, sizeof(uint32_t)); break; - case 3: pt[2] = m[2]; - case 2: pt[1] = m[1]; - case 1: pt[0] = m[0]; + case 3: pt[2] = m[2]; /* fall through */ + case 2: pt[1] = m[1]; /* fall through */ + case 1: pt[0] = m[0]; /* fall through */ } b |= _le64toh(t); diff --git a/Python/wordcode_helpers.h b/Python/wordcode_helpers.h index b0e3a917767..cce81c1d24e 100644 --- a/Python/wordcode_helpers.h +++ b/Python/wordcode_helpers.h @@ -28,10 +28,13 @@ write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode, switch (ilen) { case 4: *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff); + /* fall through */ case 3: *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff); + /* fall through */ case 2: *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff); + /* fall through */ case 1: *codestr++ = PACKOPARG(opcode, oparg & 0xff); break; From webhook-mailer at python.org Tue Sep 12 19:14:12 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 12 Sep 2017 23:14:12 -0000 Subject: [Python-checkins] [3.6] bpo-31234: Enhance test_thread.test_forkinthread() (GH-3516) (#3519) Message-ID: https://github.com/python/cpython/commit/bcf042ff98b6261b7780c1e40fa1681ef30502f9 commit: bcf042ff98b6261b7780c1e40fa1681ef30502f9 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-12T16:14:09-07:00 summary: [3.6] bpo-31234: Enhance test_thread.test_forkinthread() (GH-3516) (#3519) * test_thread.test_forkinthread() now waits until the thread completes. * Check the status in the test method, not in the thread function * Don't ignore RuntimeError anymore: since the commit 346cbd351ee0dd3ab9cb9f0e4cb625556707877e (bpo-16500, os.register_at_fork(), os.fork() cannot fail anymore with RuntimeError. * Replace 0.01 literal with a new POLL_SLEEP constant * test_forkinthread(): test if os.fork() exists rather than testing the platform. (cherry picked from commit a15d155aadfad232158f530278505cdc6f326f93) files: M Lib/test/test_thread.py diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index 2e2655aee7f..2dd1593eaa0 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -11,6 +11,7 @@ NUMTASKS = 10 NUMTRIPS = 3 +POLL_SLEEP = 0.010 # seconds = 10 ms _print_mutex = thread.allocate_lock() @@ -114,7 +115,7 @@ def task(): mut.release() thread.start_new_thread(task, ()) while not started: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertEqual(thread._count(), orig + 1) # Allow the task to finish. mut.release() @@ -125,7 +126,7 @@ def task(): wr = weakref.ref(task, lambda _: done.append(None)) del task while not done: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertEqual(thread._count(), orig) def test_save_exception_state_on_error(self): @@ -148,7 +149,7 @@ def mywrite(self, *args): thread.start_new_thread(task, ()) started.acquire() while thread._count() > c: - time.sleep(0.01) + time.sleep(POLL_SLEEP) self.assertIn("Traceback", stderr.getvalue()) @@ -221,30 +222,36 @@ class TestForkInThread(unittest.TestCase): def setUp(self): self.read_fd, self.write_fd = os.pipe() - @unittest.skipIf(sys.platform.startswith('win'), - "This test is only appropriate for POSIX-like systems.") + @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork') @support.reap_threads def test_forkinthread(self): + running = True + status = "not set" + def thread1(): - try: - pid = os.fork() # fork in a thread - except RuntimeError: - os._exit(1) # exit the child + nonlocal running, status - if pid == 0: # child + # fork in a thread + pid = os.fork() + if pid == 0: + # child try: os.close(self.read_fd) os.write(self.write_fd, b"OK") finally: os._exit(0) - else: # parent + else: + # parent os.close(self.write_fd) pid, status = os.waitpid(pid, 0) - self.assertEqual(status, 0) + running = False thread.start_new_thread(thread1, ()) self.assertEqual(os.read(self.read_fd, 2), b"OK", "Unable to fork() in thread") + while running: + time.sleep(POLL_SLEEP) + self.assertEqual(status, 0) def tearDown(self): try: From webhook-mailer at python.org Tue Sep 12 20:05:56 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 00:05:56 -0000 Subject: [Python-checkins] bpo-31249: Fix test_concurrent_futures dangling thread (#3521) Message-ID: https://github.com/python/cpython/commit/3bcf157c115ba3e48bce62ac8cb13c703475a113 commit: 3bcf157c115ba3e48bce62ac8cb13c703475a113 branch: master author: Victor Stinner committer: GitHub date: 2017-09-12T17:05:53-07:00 summary: bpo-31249: Fix test_concurrent_futures dangling thread (#3521) ProcessPoolShutdownTest.test_del_shutdown() now closes the call queue and joins its thread, to prevent leaking a dangling thread. files: M Lib/test/test_concurrent_futures.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index a888dcacc49..7bc733efb1e 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -222,11 +222,14 @@ def test_del_shutdown(self): list(executor.map(abs, range(-5, 5))) queue_management_thread = executor._queue_management_thread processes = executor._processes + call_queue = executor._call_queue del executor queue_management_thread.join() for p in processes.values(): p.join() + call_queue.close() + call_queue.join_thread() class WaitTests: From webhook-mailer at python.org Tue Sep 12 20:43:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 00:43:47 -0000 Subject: [Python-checkins] [3.6] bpo-31249: Fix test_concurrent_futures dangling thread (GH-3521) (#3522) Message-ID: https://github.com/python/cpython/commit/94eb2d5b73d07bc447f1fe19923b4c3259734b9c commit: 94eb2d5b73d07bc447f1fe19923b4c3259734b9c branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-12T17:43:44-07:00 summary: [3.6] bpo-31249: Fix test_concurrent_futures dangling thread (GH-3521) (#3522) ProcessPoolShutdownTest.test_del_shutdown() now closes the call queue and joins its thread, to prevent leaking a dangling thread. (cherry picked from commit 3bcf157c115ba3e48bce62ac8cb13c703475a113) files: M Lib/test/test_concurrent_futures.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 03f8d1d7112..e5d6b7e09b5 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -226,11 +226,14 @@ def test_del_shutdown(self): list(executor.map(abs, range(-5, 5))) queue_management_thread = executor._queue_management_thread processes = executor._processes + call_queue = executor._call_queue del executor queue_management_thread.join() for p in processes.values(): p.join() + call_queue.close() + call_queue.join_thread() class WaitTests: From lp_benchmark_robot at intel.com Tue Sep 12 21:17:40 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 12 Sep 2017 18:17:40 -0700 Subject: [Python-checkins] [1 down, 3 up, 61 flat] Results for Python (master branch) 2017-09-12 Message-ID: <0cc177cf-661b-4bf9-863b-70eaefe3bba0@orsmsx110.amr.corp.intel.com> Results for project python/master, build date: 2017-09-12 03:05:00-07:00. - commit: fc1bf87 - previous commit: 2bb69a5 - revision date: 2017-09-11 18:30:43-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.008% | +0.409% | +3.699% | +8.353% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 3.072% | +2.007% | +18.183% | +13.474% | +-----+------------------------+--------+------------+------------+------------+ | :-) | call_method_slots| 0.632% | +2.819% | +20.006% | +12.387% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.775% | +1.608% | +18.578% | +12.666% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.240% | +2.260% | +2.566% | +12.877% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 2.086% | +0.031% | +9.873% | +11.084% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.995% | +0.417% | +7.271% | +11.408% | +-----+------------------------+--------+------------+------------+------------+ | :-) | crypto_pyaes| 0.555% | +2.322% | +3.533% | +7.280% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.878% | +3.714% | +7.418% | +18.650% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.207% | +2.212% | +8.014% | +13.742% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.559% | +0.140% | +3.710% | +6.982% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.613% | +0.342% | +6.272% | +5.798% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.799% | +0.354% | +3.586% | +5.062% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.402% | -0.516% | +7.036% | +12.477% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.812% | -0.542% | +6.134% | +8.880% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.779% | -0.442% | +7.016% | +10.022% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.870% | +1.344% | +9.875% | +11.521% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.747% | +0.126% | +8.136% | +10.018% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.958% | +0.262% | +4.063% | +7.992% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 4.667% | +2.047% | +0.938% | +10.804% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.895% | -0.619% | +5.937% | +12.245% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.552% | +2.924% | +47.541% | +10.148% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.478% | -1.639% | +6.257% | +13.131% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.484% | +0.347% | +18.574% | +10.857% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 2.056% | +0.479% | +7.922% | +8.371% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.715% | +0.557% | +4.605% | +5.115% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.988% | +1.079% | -1.749% | +3.964% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 3.372% | +0.223% | +1.806% | +9.938% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 0.923% | +2.814% | +6.057% | +8.146% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 5.375% | +0.703% | -0.280% | +22.359% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.210% | -0.589% | +2.503% | +17.393% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.000% | -0.026% | +5.144% | +16.661% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.228% | -1.448% | +11.368% | +10.146% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.411% | +0.020% | +0.171% | +8.895% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.140% | +0.153% | +9.076% | +4.931% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.114% | +0.131% | +1.048% | +4.639% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.347% | +1.427% | +9.656% | +12.750% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.659% | +0.740% | -11.696% | +11.052% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_dna| 0.444% | -3.479% | -1.780% | +10.784% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 1.860% | -4.225% | -3.572% | +5.716% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.403% | +0.517% | +11.578% | +1.845% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.007% | +0.769% | +7.789% | +13.477% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.186% | +0.262% | +0.890% | +1.695% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.029% | +0.461% | +27.320% | +8.918% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.581% | -0.549% | +4.549% | +6.673% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.443% | +0.960% | +15.385% | +8.204% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.949% | -0.132% | +1.147% | -1.582% | +-----+------------------------+--------+------------+------------+------------+ | :-) | spectral_norm| 0.501% | +6.074% | +5.278% | +1.372% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.895% | -1.110% | +4.107% | +7.628% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.139% | +0.047% | +4.303% | +5.953% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.110% | +1.477% | +1.389% | +10.314% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 1.912% | +0.057% | +12.033% | +7.294% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.709% | -0.095% | +8.942% | +8.134% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.498% | +0.630% | +10.832% | +9.102% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.467% | +1.069% | +9.373% | +10.488% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.428% | +1.918% | +24.439% | +8.751% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.386% | +0.649% | +5.966% | +5.989% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 3.327% | +0.258% | +1.594% | +3.219% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle|10.208% | -3.506% | +4.357% | +23.260% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.762% | +0.971% | +0.560% | +15.751% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.344% | +0.349% | +7.201% | +7.278% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.091% | -0.322% | +5.954% | +7.967% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.161% | +1.106% | +1.914% | +7.154% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 1.522% | +0.123% | -4.620% | +10.891% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.196% | +0.376% | +6.735% | +8.189% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-3-up-61-flat-results-for-python-master-branch-2017-09-12 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Tue Sep 12 23:24:06 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 03:24:06 -0000 Subject: [Python-checkins] bpo-31394: Clarify documentation about token type attribute (GH-3469) Message-ID: https://github.com/python/cpython/commit/5f8fbf917ebf2398aa75a1f271617e2e50ab7c88 commit: 5f8fbf917ebf2398aa75a1f271617e2e50ab7c88 branch: master author: Aivar Annamaa committer: Mariatta date: 2017-09-12T20:24:03-07:00 summary: bpo-31394: Clarify documentation about token type attribute (GH-3469) Make it clear that Ellipsis tokens also have type attribute set to token.OP. files: M Doc/library/tokenize.rst diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst index cd27a101a8f..e6ddc057921 100644 --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -16,8 +16,8 @@ implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. -To simplify token stream handling, all :ref:`operators` and :ref:`delimiters` -tokens are returned using the generic :data:`~token.OP` token type. The exact +To simplify token stream handling, all :ref:`operator ` and :ref:`delimiter ` +tokens and :data:`Ellipsis` are returned using the generic :data:`~token.OP` token type. The exact type can be determined by checking the ``exact_type`` property on the :term:`named tuple` returned from :func:`tokenize.tokenize`. From webhook-mailer at python.org Tue Sep 12 23:43:07 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 03:43:07 -0000 Subject: [Python-checkins] [3.6] bpo-31394: Clarify documentation about token type attribute (GH-3469) (GH-3525) Message-ID: https://github.com/python/cpython/commit/5513e888e9a742156c35ce7ab628407d8cf9e1f0 commit: 5513e888e9a742156c35ce7ab628407d8cf9e1f0 branch: 3.6 author: Mariatta committer: GitHub date: 2017-09-12T20:43:04-07:00 summary: [3.6] bpo-31394: Clarify documentation about token type attribute (GH-3469) (GH-3525) Make it clear that Ellipsis tokens also have type attribute set to token.OP.. (cherry picked from commit 5f8fbf917ebf2398aa75a1f271617e2e50ab7c88) files: M Doc/library/tokenize.rst diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst index ff55aacbd44..afed36b9e46 100644 --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -16,8 +16,9 @@ implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. -To simplify token stream handling, all :ref:`operators` and :ref:`delimiters` -tokens are returned using the generic :data:`token.OP` token type. The exact +To simplify token stream handling, all :ref:`operator ` and +:ref:`delimiter ` tokens and :data:`Ellipsis` are returned using +the generic :data:`~token.OP` token type. The exact type can be determined by checking the ``exact_type`` property on the :term:`named tuple` returned from :func:`tokenize.tokenize`. From webhook-mailer at python.org Wed Sep 13 00:00:04 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 04:00:04 -0000 Subject: [Python-checkins] bpo-31394: Make tokenize.rst PEP 8-compliant (GH-3526) Message-ID: https://github.com/python/cpython/commit/ea0f7c26cef4550bf4db1a9bae17d41b79ab7c0d commit: ea0f7c26cef4550bf4db1a9bae17d41b79ab7c0d branch: master author: Mariatta committer: GitHub date: 2017-09-12T21:00:00-07:00 summary: bpo-31394: Make tokenize.rst PEP 8-compliant (GH-3526) The last commit contained lines longer than 80 characters. files: M Doc/library/tokenize.rst diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst index e6ddc057921..02a0428f21b 100644 --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -16,8 +16,9 @@ implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. -To simplify token stream handling, all :ref:`operator ` and :ref:`delimiter ` -tokens and :data:`Ellipsis` are returned using the generic :data:`~token.OP` token type. The exact +To simplify token stream handling, all :ref:`operator ` and +:ref:`delimiter ` tokens and :data:`Ellipsis` are returned using +the generic :data:`~token.OP` token type. The exact type can be determined by checking the ``exact_type`` property on the :term:`named tuple` returned from :func:`tokenize.tokenize`. From webhook-mailer at python.org Wed Sep 13 00:44:16 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 04:44:16 -0000 Subject: [Python-checkins] Mention enum as an ex (#2982) Message-ID: https://github.com/python/cpython/commit/b8d1b9d7c697dd0401491b6d43047acbaf425f02 commit: b8d1b9d7c697dd0401491b6d43047acbaf425f02 branch: master author: Louie Lu committer: Mariatta date: 2017-09-12T21:44:14-07:00 summary: Mention enum as an ex (#2982) files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 5f932ae0de7..31a7671f55f 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1896,8 +1896,8 @@ Metaclass example ^^^^^^^^^^^^^^^^^ The potential uses for metaclasses are boundless. Some ideas that have been -explored include logging, interface checking, automatic delegation, automatic -property creation, proxies, frameworks, and automatic resource +explored include enum, logging, interface checking, automatic delegation, +automatic property creation, proxies, frameworks, and automatic resource locking/synchronization. Here is an example of a metaclass that uses an :class:`collections.OrderedDict` From webhook-mailer at python.org Wed Sep 13 00:55:26 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 04:55:26 -0000 Subject: [Python-checkins] [3.6] Mention enum as a potential use for metaclasses (GH-2982) (GH-3527) Message-ID: https://github.com/python/cpython/commit/547f2a97ea77ee6b3fe2f5b80c2c1fa20956b5a1 commit: 547f2a97ea77ee6b3fe2f5b80c2c1fa20956b5a1 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-12T21:55:23-07:00 summary: [3.6] Mention enum as a potential use for metaclasses (GH-2982) (GH-3527) (cherry picked from commit b8d1b9d7c697dd0401491b6d43047acbaf425f02) files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 7c140a3bc86..230caf843a5 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1875,8 +1875,8 @@ Metaclass example ^^^^^^^^^^^^^^^^^ The potential uses for metaclasses are boundless. Some ideas that have been -explored include logging, interface checking, automatic delegation, automatic -property creation, proxies, frameworks, and automatic resource +explored include enum, logging, interface checking, automatic delegation, +automatic property creation, proxies, frameworks, and automatic resource locking/synchronization. Here is an example of a metaclass that uses an :class:`collections.OrderedDict` From webhook-mailer at python.org Wed Sep 13 04:44:14 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 08:44:14 -0000 Subject: [Python-checkins] bpo-30830: logging.config.listen() calls server_close() (#3524) Message-ID: https://github.com/python/cpython/commit/97d7e65dfed1d42d40d9bc2f630af56240555f02 commit: 97d7e65dfed1d42d40d9bc2f630af56240555f02 branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T01:44:08-07:00 summary: bpo-30830: logging.config.listen() calls server_close() (#3524) The ConfigSocketReceiver.serve_until_stopped() method from logging.config.listen() now calls server_close() (of socketserver.ThreadingTCPServer) rather than closing manually the socket. While this change has no effect yet, it will help to prevent dangling threads once ThreadingTCPServer.server_close() will join spawned threads (bpo-31233). files: M Lib/logging/config.py diff --git a/Lib/logging/config.py b/Lib/logging/config.py index c16a75a0f1e..b08cba06875 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -887,7 +887,7 @@ def serve_until_stopped(self): logging._acquireLock() abort = self.abort logging._releaseLock() - self.socket.close() + self.server_close() class Server(threading.Thread): From webhook-mailer at python.org Wed Sep 13 04:47:25 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 08:47:25 -0000 Subject: [Python-checkins] bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523) Message-ID: https://github.com/python/cpython/commit/b8f4163da30e16c7cd58fe04f4b17e38d53cd57e commit: b8f4163da30e16c7cd58fe04f4b17e38d53cd57e branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T01:47:22-07:00 summary: bpo-31233: socketserver.ThreadingMixIn.server_close() (#3523) socketserver.ThreadingMixIn now keeps a list of non-daemonic threads to wait until all these threads complete in server_close(). Reenable test_logging skipped tests. Fix SocketHandlerTest.tearDown(): close the socket handler before stopping the server, so the server can join threads. files: A Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst M Lib/socketserver.py M Lib/test/test_logging.py diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 721eb50fbe6..1ae7bef9040 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -629,6 +629,9 @@ class ThreadingMixIn: # Decides how threads will act upon termination of the # main process daemon_threads = False + # For non-daemonic threads, list of threading.Threading objects + # used by server_close() to wait for all threads completion. + _threads = None def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread. @@ -648,8 +651,20 @@ def process_request(self, request, client_address): t = threading.Thread(target = self.process_request_thread, args = (request, client_address)) t.daemon = self.daemon_threads + if not t.daemon: + if self._threads is None: + self._threads = [] + self._threads.append(t) t.start() + def server_close(self): + super().server_close() + threads = self._threads + self._threads = None + if threads: + for thread in threads: + thread.join() + if hasattr(os, "fork"): class ForkingUDPServer(ForkingMixIn, UDPServer): pass diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 9c3816ada77..76f98bb572d 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1465,7 +1465,6 @@ def test_logger_disabling(self): self.assertFalse(logger.disabled) - at unittest.skipIf(True, "FIXME: bpo-30830") class SocketHandlerTest(BaseTest): """Test for SocketHandler objects.""" @@ -1502,11 +1501,11 @@ def setUp(self): def tearDown(self): """Shutdown the TCP server.""" try: - if self.server: - self.server.stop(2.0) if self.sock_hdlr: self.root_logger.removeHandler(self.sock_hdlr) self.sock_hdlr.close() + if self.server: + self.server.stop(2.0) finally: BaseTest.tearDown(self) @@ -1563,7 +1562,6 @@ def _get_temp_domain_socket(): os.remove(fn) return fn - at unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") class UnixSocketHandlerTest(SocketHandlerTest): @@ -1581,7 +1579,6 @@ def tearDown(self): SocketHandlerTest.tearDown(self) support.unlink(self.address) - at unittest.skipIf(True, "FIXME: bpo-30830") class DatagramHandlerTest(BaseTest): """Test for DatagramHandler.""" @@ -1646,7 +1643,6 @@ def test_output(self): self.handled.wait() self.assertEqual(self.log_output, "spam\neggs\n") - at unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") class UnixDatagramHandlerTest(DatagramHandlerTest): @@ -1731,7 +1727,6 @@ def test_output(self): self.handled.wait() self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m') - at unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required") class UnixSysLogHandlerTest(SysLogHandlerTest): @@ -1749,7 +1744,6 @@ def tearDown(self): SysLogHandlerTest.tearDown(self) support.unlink(self.address) - at unittest.skipIf(True, "FIXME: bpo-30830") @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 support required for this test.') class IPv6SysLogHandlerTest(SysLogHandlerTest): @@ -2872,9 +2866,6 @@ def test_config14_ok(self): logging.warning('Exclamation') self.assertTrue(output.getvalue().endswith('Exclamation!\n')) - # listen() uses ConfigSocketReceiver which is based - # on socketserver.ThreadingTCPServer - @unittest.skipIf(True, "FIXME: bpo-30830") def setup_via_listener(self, text, verify=None): text = text.encode("utf-8") # Ask for a randomly assigned port (by using port 0) diff --git a/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst b/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst new file mode 100644 index 00000000000..5cf75e7c9f8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst @@ -0,0 +1,2 @@ +socketserver.ThreadingMixIn now keeps a list of non-daemonic threads to wait +until all these threads complete in server_close(). From solipsis at pitrou.net Wed Sep 13 05:22:18 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 13 Sep 2017 09:22:18 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170913092218.107961.CBB556650C084CB1@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 7] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogsQSC8L', '--timeout', '7200'] From webhook-mailer at python.org Wed Sep 13 06:26:56 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 10:26:56 -0000 Subject: [Python-checkins] bpo-31234: fork_wait tests now join threads (#3139) (#3535) Message-ID: https://github.com/python/cpython/commit/42f7e0d8b0ca940a809a786f25d967dcce4d71b6 commit: 42f7e0d8b0ca940a809a786f25d967dcce4d71b6 branch: 2.7 author: Victor Stinner committer: GitHub date: 2017-09-13T03:26:54-07:00 summary: bpo-31234: fork_wait tests now join threads (#3139) (#3535) fork_wait.py tests now joins threads, to not leak running threads in the background. (cherry picked from commit c99d41f9c0304fcf06550515c3db55f93a629e9e) files: M Lib/test/fork_wait.py diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 2646cbd5816..b900463da60 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -13,8 +13,9 @@ """ import os, sys, time, unittest -import test.test_support as test_support -thread = test_support.import_module('thread') +import test.support as support + +threading = support.import_module('threading') LONGSLEEP = 2 SHORTSLEEP = 0.5 @@ -23,8 +24,19 @@ class ForkWait(unittest.TestCase): def setUp(self): + self._threading_key = support.threading_setup() self.alive = {} self.stop = 0 + self.threads = [] + + def tearDown(self): + # Stop threads + self.stop = 1 + for thread in self.threads: + thread.join() + thread = None + del self.threads[:] + support.threading_cleanup(*self._threading_key) def f(self, id): while not self.stop: @@ -48,7 +60,9 @@ def wait_impl(self, cpid): def test_wait(self): for i in range(NUM_THREADS): - thread.start_new(self.f, (i,)) + thread = threading.Thread(target=self.f, args=(i,)) + thread.start() + self.threads.append(thread) time.sleep(LONGSLEEP) @@ -74,6 +88,3 @@ def test_wait(self): else: # Parent self.wait_impl(cpid) - # Tell threads to die - self.stop = 1 - time.sleep(2*SHORTSLEEP) # Wait for threads to die From webhook-mailer at python.org Wed Sep 13 06:27:37 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 10:27:37 -0000 Subject: [Python-checkins] [3.6] bpo-31323: Fix reference leak in test_ssl (GH-3263) (#3538) Message-ID: https://github.com/python/cpython/commit/1b00bddd5c4a5728b15eee5a27ed3f78a173ef64 commit: 1b00bddd5c4a5728b15eee5a27ed3f78a173ef64 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T03:27:34-07:00 summary: [3.6] bpo-31323: Fix reference leak in test_ssl (GH-3263) (#3538) Store exceptions as string rather than object to prevent reference cycles which cause leaking dangling threads. (cherry picked from commit 868710158910fa38e285ce0e6d50026e1d0b2a8c) files: M Lib/test/test_ssl.py diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index e001badad17..54644e1596c 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1867,7 +1867,11 @@ def wrap_conn(self): # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. - self.server.conn_errors.append(e) + # + # bpo-31323: Store the exception as string to prevent + # a reference leak: server -> conn_errors -> exception + # -> traceback -> self (ConnectionHandler) -> server + self.server.conn_errors.append(str(e)) if self.server.chatty: handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") self.running = False @@ -3081,7 +3085,7 @@ def test_default_ciphers(self): with context.wrap_socket(socket.socket()) as s: with self.assertRaises(OSError): s.connect((HOST, server.port)) - self.assertIn("no shared cipher", str(server.conn_errors[0])) + self.assertIn("no shared cipher", server.conn_errors[0]) def test_version_basic(self): """ From webhook-mailer at python.org Wed Sep 13 06:27:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 10:27:47 -0000 Subject: [Python-checkins] [3.6] bpo-31234: test_threaded_import: fix test_side_effect_import() (GH-3189) (#3537) Message-ID: https://github.com/python/cpython/commit/89bfc9b0d9033f7c9f086c7281a31a489fe1136f commit: 89bfc9b0d9033f7c9f086c7281a31a489fe1136f branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T03:27:45-07:00 summary: [3.6] bpo-31234: test_threaded_import: fix test_side_effect_import() (GH-3189) (#3537) * Don't leak the module into sys.modules * Avoid dangling thread (cherry picked from commit 41bbd82b6b6a887e893974fa5cdaae7782ae6cac) files: M Lib/test/test_threaded_import.py diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index 9b2d9a6f19b..f42c900103f 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -221,7 +221,8 @@ def target(): import random t = threading.Thread(target=target) t.start() - t.join()""" + t.join() + t = None""" sys.path.insert(0, os.curdir) self.addCleanup(sys.path.remove, os.curdir) filename = TESTFN + ".py" @@ -232,6 +233,7 @@ def target(): self.addCleanup(rmtree, '__pycache__') importlib.invalidate_caches() __import__(TESTFN) + del sys.modules[TESTFN] @reap_threads From webhook-mailer at python.org Wed Sep 13 06:27:56 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 10:27:56 -0000 Subject: [Python-checkins] [3.6] bpo-31234: test_httpservers joins the server thread (GH-3188) (#3536) Message-ID: https://github.com/python/cpython/commit/6c25b73194714e78975eddea3799f06f3de74647 commit: 6c25b73194714e78975eddea3799f06f3de74647 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T03:27:54-07:00 summary: [3.6] bpo-31234: test_httpservers joins the server thread (GH-3188) (#3536) (cherry picked from commit 830d7d2936434ace113822294acce82f62cde41b) files: M Lib/test/test_httpservers.py diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 4e931446b9e..22b3bf5235c 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -52,6 +52,7 @@ def run(self): def stop(self): self.server.shutdown() + self.join() class BaseTestCase(unittest.TestCase): From webhook-mailer at python.org Wed Sep 13 06:58:28 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 10:58:28 -0000 Subject: [Python-checkins] bpo-31234: Fix dangling thread in test_ftp/poplib (#3540) Message-ID: https://github.com/python/cpython/commit/d403a29c0055de6b03ed5ae7a5c564e1c95a5950 commit: d403a29c0055de6b03ed5ae7a5c564e1c95a5950 branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T03:58:25-07:00 summary: bpo-31234: Fix dangling thread in test_ftp/poplib (#3540) Explicitly clear the server attribute in test_ftplib and test_poplib to prevent dangling thread. files: M Lib/test/test_ftplib.py M Lib/test/test_poplib.py diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 151e0919066..372282b4faf 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -470,6 +470,8 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None asyncore.close_all(ignore_all=True) def check_data(self, received, expected): @@ -800,6 +802,8 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None asyncore.close_all(ignore_all=True) def test_af(self): @@ -859,6 +863,8 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None asyncore.close_all(ignore_all=True) def test_control_connection(self): diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 92febbf83fc..d7a26bc14c9 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -254,6 +254,8 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None def test_getwelcome(self): self.assertEqual(self.client.getwelcome(), @@ -436,6 +438,8 @@ def tearDown(self): # this exception self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None def test_stls(self): self.assertRaises(poplib.error_proto, self.client.stls) @@ -461,7 +465,8 @@ def setUp(self): def tearDown(self): self.thread.join() - del self.thread # Clear out any dangling Thread objects. + # Explicitly clear the attribute to prevent dangling thread + self.thread = None def server(self, evt, serv): serv.listen() From webhook-mailer at python.org Wed Sep 13 08:17:30 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 12:17:30 -0000 Subject: [Python-checkins] Travis CI: run coverage test using --fail-env-changed (#3541) Message-ID: https://github.com/python/cpython/commit/a7b3bc554c6fdc868accc1480038712c74354b42 commit: a7b3bc554c6fdc868accc1480038712c74354b42 branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T05:17:27-07:00 summary: Travis CI: run coverage test using --fail-env-changed (#3541) files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index 148c0eb3f96..2e0ad87affb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,7 +56,7 @@ matrix: ./venv/bin/python -m test.pythoninfo script: # Skip tests that re-run the entire test suite. - - ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn + - ./venv/bin/python -m coverage run --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn after_script: # Probably should be after_success once test suite updated to run under coverage.py. # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files. - source ./venv/bin/activate From webhook-mailer at python.org Wed Sep 13 08:53:15 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 12:53:15 -0000 Subject: [Python-checkins] bpo-31448, test_poplib: Fix ResourceWarning (#3542) Message-ID: https://github.com/python/cpython/commit/d165e14e29b45a22450263722f5c2c386c3a748a commit: d165e14e29b45a22450263722f5c2c386c3a748a branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T05:53:10-07:00 summary: bpo-31448, test_poplib: Fix ResourceWarning (#3542) Call POP3.close(), don't close close directly the sock attribute. files: M Lib/test/test_poplib.py diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index d7a26bc14c9..721ea252011 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -488,7 +488,7 @@ def testTimeoutDefault(self): finally: socket.setdefaulttimeout(None) self.assertEqual(pop.sock.gettimeout(), 30) - pop.sock.close() + pop.close() def testTimeoutNone(self): self.assertIsNone(socket.getdefaulttimeout()) @@ -498,12 +498,12 @@ def testTimeoutNone(self): finally: socket.setdefaulttimeout(None) self.assertIsNone(pop.sock.gettimeout()) - pop.sock.close() + pop.close() def testTimeoutValue(self): pop = poplib.POP3(HOST, self.port, timeout=30) self.assertEqual(pop.sock.gettimeout(), 30) - pop.sock.close() + pop.close() def test_main(): From webhook-mailer at python.org Wed Sep 13 09:09:47 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 13:09:47 -0000 Subject: [Python-checkins] [3.6] bpo-31448, test_poplib: Fix ResourceWarning (GH-3542) (#3543) Message-ID: https://github.com/python/cpython/commit/769ddb075ac3a840d473930a12a5b72bfbab366f commit: 769ddb075ac3a840d473930a12a5b72bfbab366f branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T06:09:44-07:00 summary: [3.6] bpo-31448, test_poplib: Fix ResourceWarning (GH-3542) (#3543) Call POP3.close(), don't close close directly the sock attribute. (cherry picked from commit d165e14e29b45a22450263722f5c2c386c3a748a) files: M Lib/test/test_poplib.py diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index e5b16dc98a4..6bc97397808 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -483,7 +483,7 @@ def testTimeoutDefault(self): finally: socket.setdefaulttimeout(None) self.assertEqual(pop.sock.gettimeout(), 30) - pop.sock.close() + pop.close() def testTimeoutNone(self): self.assertIsNone(socket.getdefaulttimeout()) @@ -493,12 +493,12 @@ def testTimeoutNone(self): finally: socket.setdefaulttimeout(None) self.assertIsNone(pop.sock.gettimeout()) - pop.sock.close() + pop.close() def testTimeoutValue(self): pop = poplib.POP3(HOST, self.port, timeout=30) self.assertEqual(pop.sock.gettimeout(), 30) - pop.sock.close() + pop.close() def test_main(): From webhook-mailer at python.org Wed Sep 13 09:44:01 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 13:44:01 -0000 Subject: [Python-checkins] bpo-31234: Fix dangling thread in test_ftplib (#3544) Message-ID: https://github.com/python/cpython/commit/b157ce1e58b03988ce4340a55d0b856125833cc5 commit: b157ce1e58b03988ce4340a55d0b856125833cc5 branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T06:43:58-07:00 summary: bpo-31234: Fix dangling thread in test_ftplib (#3544) Clear also self.server_thread attribute in TestTimeouts.tearDown(). files: M Lib/test/test_ftplib.py diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 372282b4faf..5880a1e941d 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -988,6 +988,8 @@ def setUp(self): def tearDown(self): ftplib.FTP.port = self.old_port self.server_thread.join() + # Explicitly clear the attribute to prevent dangling thread + self.server_thread = None def server(self): # This method sets the evt 3 times: From webhook-mailer at python.org Wed Sep 13 13:10:13 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 17:10:13 -0000 Subject: [Python-checkins] bpo-31234, socket.create_connection(): Fix ref cycle (#3546) Message-ID: https://github.com/python/cpython/commit/acb9fa79fa6453c2bbe3ccfc9cad2837feb90093 commit: acb9fa79fa6453c2bbe3ccfc9cad2837feb90093 branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T10:10:10-07:00 summary: bpo-31234, socket.create_connection(): Fix ref cycle (#3546) files: A Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst M Lib/socket.py diff --git a/Lib/socket.py b/Lib/socket.py index 740e71782af..1ada24d3326 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -711,6 +711,8 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, if source_address: sock.bind(source_address) sock.connect(sa) + # Break explicitly a reference cycle + err = None return sock except error as _: diff --git a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst new file mode 100644 index 00000000000..e522e8e9527 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst @@ -0,0 +1,2 @@ +socket.create_connection() now fixes manually a reference cycle: clear the +variable storing the last exception on success. From webhook-mailer at python.org Wed Sep 13 15:11:23 2017 From: webhook-mailer at python.org (Gregory P. Smith) Date: Wed, 13 Sep 2017 19:11:23 -0000 Subject: [Python-checkins] Update subprocess.communicate() docstring. Message-ID: https://github.com/python/cpython/commit/88031a9adedb594500db643404614f6648beec81 commit: 88031a9adedb594500db643404614f6648beec81 branch: master author: Joel Schaerer committer: Gregory P. Smith date: 2017-09-13T12:11:20-07:00 summary: Update subprocess.communicate() docstring. Explicitly state that communicate() closes stdin after writing input to it. files: M Lib/subprocess.py diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 6b90d40564f..dd994e2aaf1 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -800,9 +800,9 @@ def _stdin_write(self, input): raise def communicate(self, input=None, timeout=None): - """Interact with process: Send data to stdin. Read data from - stdout and stderr, until end-of-file is reached. Wait for - process to terminate. + """Interact with process: Send data to stdin and close it. + Read data from stdout and stderr, until end-of-file is + reached. Wait for process to terminate. The optional "input" argument should be data to be sent to the child process (if self.universal_newlines is True, this should From webhook-mailer at python.org Wed Sep 13 16:42:03 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 20:42:03 -0000 Subject: [Python-checkins] bpo-31234: threading_cleanup() now warns immediately (#3138) Message-ID: https://github.com/python/cpython/commit/ace1ecc00b35a8b1dc6e352d547dde07913017bb commit: ace1ecc00b35a8b1dc6e352d547dde07913017bb branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T13:42:00-07:00 summary: bpo-31234: threading_cleanup() now warns immediately (#3138) support.threading_cleanup() waits for 1 second before emitting a warning if there are threads running in the background. With this change, it now emits the warning immediately, to be able to catch bugs more easily. files: M Lib/test/support/__init__.py diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f57b2517792..df235050ae2 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2030,22 +2030,32 @@ def threading_cleanup(*original_values): global environment_altered _MAX_COUNT = 100 - t0 = time.monotonic() + for count in range(_MAX_COUNT): values = _thread._count(), threading._dangling if values == original_values: break + + if not count: + # Display a warning at the first iteration + environment_altered = True + dangling_threads = values[1] + print("Warning -- threading_cleanup() failed to cleanup " + "%s threads (count: %s, dangling: %s)" + % (values[0] - original_values[0], + values[0], len(dangling_threads)), + file=sys.stderr) + for thread in dangling_threads: + print(f"Dangling thread: {thread!r}", file=sys.stderr) + sys.stderr.flush() + + # Don't hold references to threads + dangling_threads = None + values = None + time.sleep(0.01) gc_collect() - else: - environment_altered = True - dt = time.monotonic() - t0 - print("Warning -- threading_cleanup() failed to cleanup %s threads " - "after %.0f sec (count: %s, dangling: %s)" - % (values[0] - original_values[0], dt, - values[0], len(values[1])), - file=sys.stderr) def reap_threads(func): """Use this function when threads are being used. This will From webhook-mailer at python.org Wed Sep 13 18:18:00 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 22:18:00 -0000 Subject: [Python-checkins] [2.7] bpo-30442: Skips refcount test in test_xml_etree under coverage (GH-1767) (#3549) Message-ID: https://github.com/python/cpython/commit/860839cc8e0a4a0890418f77c984955697f96828 commit: 860839cc8e0a4a0890418f77c984955697f96828 branch: 2.7 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T15:17:55-07:00 summary: [2.7] bpo-30442: Skips refcount test in test_xml_etree under coverage (GH-1767) (#3549) (cherry picked from commit 1de4705d00168afa8c5b6741af02e21fc609af58) files: M Lib/test/test_xml_etree.py diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 60b26ead7a2..55d70101233 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1338,6 +1338,7 @@ def test_bug_xmltoolkit62(self): self.assertEqual(t.find('.//paragraph').text, u'A new cultivar of Begonia plant named \u2018BCT9801BEG\u2019.') + @unittest.skipIf(sys.gettrace(), "Skips under coverage.") def test_bug_xmltoolkit63(self): # Check reference leak. def xmltoolkit63(): From webhook-mailer at python.org Wed Sep 13 18:30:08 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Wed, 13 Sep 2017 22:30:08 -0000 Subject: [Python-checkins] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539) Message-ID: https://github.com/python/cpython/commit/f6e61df01536493f1280cd07639c7ff9bffb2cdc commit: f6e61df01536493f1280cd07639c7ff9bffb2cdc branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-14T01:30:05+03:00 summary: bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (#3539) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst M Python/errors.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst new file mode 100644 index 00000000000..6d6cbd81142 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an +exception with a bad ``__module__`` attribute. Patch by Oren Milman. diff --git a/Python/errors.c b/Python/errors.c index 3cb6d5306f8..5709fddb584 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -961,7 +961,7 @@ PyErr_WriteUnraisable(PyObject *obj) } moduleName = _PyObject_GetAttrId(t, &PyId___module__); - if (moduleName == NULL) { + if (moduleName == NULL || !PyUnicode_Check(moduleName)) { PyErr_Clear(); if (PyFile_WriteString("", f) < 0) goto done; From webhook-mailer at python.org Wed Sep 13 18:54:39 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 22:54:39 -0000 Subject: [Python-checkins] [3.6] bpo-31234, socket.create_connection(): Fix ref cycle (GH-3546) (#3552) Message-ID: https://github.com/python/cpython/commit/d99e85b9f6422dd5e4f2eb1539368fc4003d4c8b commit: d99e85b9f6422dd5e4f2eb1539368fc4003d4c8b branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-13T15:54:34-07:00 summary: [3.6] bpo-31234, socket.create_connection(): Fix ref cycle (GH-3546) (#3552) (cherry picked from commit acb9fa79fa6453c2bbe3ccfc9cad2837feb90093) files: A Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst M Lib/socket.py diff --git a/Lib/socket.py b/Lib/socket.py index 740e71782af..1ada24d3326 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -711,6 +711,8 @@ def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, if source_address: sock.bind(source_address) sock.connect(sa) + # Break explicitly a reference cycle + err = None return sock except error as _: diff --git a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst new file mode 100644 index 00000000000..e522e8e9527 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst @@ -0,0 +1,2 @@ +socket.create_connection() now fixes manually a reference cycle: clear the +variable storing the last exception on success. From webhook-mailer at python.org Wed Sep 13 18:56:17 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 22:56:17 -0000 Subject: [Python-checkins] [3.6] bpo-31234: Fix dangling thread in test_ftp/poplib (#3554) Message-ID: https://github.com/python/cpython/commit/ef323e8d82b07d4e7e4303c360dc32d3de0b3147 commit: ef323e8d82b07d4e7e4303c360dc32d3de0b3147 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-13T15:56:14-07:00 summary: [3.6] bpo-31234: Fix dangling thread in test_ftp/poplib (#3554) * bpo-31234: Fix dangling thread in test_ftp/poplib (#3540) Explicitly clear the server attribute in test_ftplib and test_poplib to prevent dangling thread. (cherry picked from commit d403a29c0055de6b03ed5ae7a5c564e1c95a5950) * bpo-31234: Fix dangling thread in test_ftplib (#3544) Clear also self.server_thread attribute in TestTimeouts.tearDown(). (cherry picked from commit b157ce1e58b03988ce4340a55d0b856125833cc5) files: M Lib/test/test_ftplib.py M Lib/test/test_poplib.py diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index a561e9efa03..b593313db09 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -470,6 +470,9 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None + asyncore.close_all(ignore_all=True) def check_data(self, received, expected): self.assertEqual(len(received), len(expected)) @@ -799,6 +802,9 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None + asyncore.close_all(ignore_all=True) def test_af(self): self.assertEqual(self.client.af, socket.AF_INET6) @@ -857,6 +863,9 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None + asyncore.close_all(ignore_all=True) def test_control_connection(self): self.assertNotIsInstance(self.client.sock, ssl.SSLSocket) @@ -979,6 +988,8 @@ def setUp(self): def tearDown(self): ftplib.FTP.port = self.old_port self.server_thread.join() + # Explicitly clear the attribute to prevent dangling thread + self.server_thread = None def server(self): # This method sets the evt 3 times: diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 6bc97397808..1269199423c 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -254,6 +254,8 @@ def setUp(self): def tearDown(self): self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None def test_getwelcome(self): self.assertEqual(self.client.getwelcome(), @@ -436,6 +438,8 @@ def tearDown(self): # this exception self.client.close() self.server.stop() + # Explicitly clear the attribute to prevent dangling thread + self.server = None def test_stls(self): self.assertRaises(poplib.error_proto, self.client.stls) @@ -461,7 +465,8 @@ def setUp(self): def tearDown(self): self.thread.join() - del self.thread # Clear out any dangling Thread objects. + # Explicitly clear the attribute to prevent dangling thread + self.thread = None def server(self, evt, serv): serv.listen() From lp_benchmark_robot at intel.com Wed Sep 13 19:07:15 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 13 Sep 2017 16:07:15 -0700 Subject: [Python-checkins] [65 flat] Results for Python (master branch) 2017-09-13 Message-ID: Results for project python/master, build date: 2017-09-13 03:05:02-07:00. - commit: b8f4163 - previous commit: fc1bf87 - revision date: 2017-09-13 01:47:22-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.105% | -0.298% | +3.413% | +8.658% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.671% | +0.480% | +18.576% | +8.256% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.420% | +0.199% | +20.165% | +6.970% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.991% | -0.116% | +18.484% | +3.371% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.478% | -0.067% | +2.501% | +12.036% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.345% | +0.189% | +10.042% | +9.485% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.647% | -0.024% | +7.249% | +10.076% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.598% | -0.164% | +3.375% | +5.967% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 5.059% | +0.144% | +7.551% | +17.438% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 5.899% | -1.439% | +6.690% | +14.431% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.352% | -0.344% | +3.379% | +6.638% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.316% | +0.025% | +6.295% | +3.964% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.605% | +0.157% | +3.738% | +4.068% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.348% | -0.057% | +6.984% | +12.683% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.372% | -0.312% | +5.841% | +11.309% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.695% | -0.063% | +6.957% | +9.992% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 1.331% | -0.260% | +9.641% | +11.288% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.668% | -0.920% | +7.291% | +9.525% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.439% | -0.135% | +3.933% | +8.374% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 7.501% | -1.382% | -0.431% | +13.404% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 2.264% | -0.651% | +5.324% | +12.344% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.613% | -0.489% | +47.285% | +9.621% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.870% | +0.331% | +6.567% | +13.432% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.533% | -0.048% | +18.536% | +10.839% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 3.077% | -0.227% | +7.713% | +10.983% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 2.281% | -0.360% | +4.262% | +4.380% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.190% | -0.150% | -1.901% | +2.617% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 3.104% | +0.011% | +1.817% | +8.188% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.132% | -0.976% | +5.140% | +8.929% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.094% | +1.249% | +0.972% | +21.770% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.297% | +0.007% | +2.510% | +17.308% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.625% | +0.076% | +5.216% | +17.424% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 4.317% | -0.491% | +10.933% | +9.900% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.352% | +0.032% | +0.204% | +9.679% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.137% | -0.093% | +8.992% | +2.674% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.103% | -0.023% | +1.025% | +4.838% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.873% | -0.484% | +9.219% | +13.204% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.644% | -0.496% | -12.250% | +13.755% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.956% | -0.184% | -1.967% | +8.076% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.456% | +0.840% | -2.702% | +1.732% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.578% | -0.118% | +11.474% | +0.798% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.613% | -0.481% | +7.345% | +15.252% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 2.129% | -0.249% | +0.644% | +2.536% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.975% | -0.005% | +27.316% | +7.243% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.561% | +0.354% | +4.888% | +4.912% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.330% | +0.115% | +15.482% | +7.274% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.583% | -0.029% | +1.119% | -2.197% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.454% | +0.091% | +5.364% | +1.695% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.022% | +0.170% | +4.270% | +8.157% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.884% | -0.704% | +3.629% | +6.157% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 4.217% | -1.870% | -0.455% | +11.594% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.425% | -1.206% | +10.972% | +9.172% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.650% | -0.350% | +8.623% | +7.860% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.603% | +0.073% | +10.897% | +10.144% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.461% | -0.643% | +8.790% | +13.378% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 3.736% | -0.499% | +24.062% | +9.130% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.433% | -0.924% | +5.097% | +7.253% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.796% | +0.600% | +2.184% | +1.739% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle|10.486% | -3.191% | +1.305% | +23.644% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.088% | -0.044% | +0.516% | +19.709% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.374% | +0.026% | +7.225% | +5.747% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.222% | -0.056% | +5.902% | +7.506% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.246% | +0.427% | +2.333% | +6.428% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 1.177% | -0.078% | -4.703% | +11.240% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.768% | -0.894% | +5.901% | +8.559% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/65-flat-results-for-python-master-branch-2017-09-13 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Wed Sep 13 19:25:18 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Wed, 13 Sep 2017 23:25:18 -0000 Subject: [Python-checkins] bpo-28556: Minor updates to typing module (#3550) Message-ID: https://github.com/python/cpython/commit/65bc62052fe5d550cb14c0033e8a2550618fb7b9 commit: 65bc62052fe5d550cb14c0033e8a2550618fb7b9 branch: master author: Ivan Levkivskyi committer: ?ukasz Langa date: 2017-09-13T19:25:15-04:00 summary: bpo-28556: Minor updates to typing module (#3550) * Copy changes to typing from upstream repo * Add NEWS entry files: A Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst M Lib/test/test_typing.py M Lib/typing.py diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index fd2d93c3a4d..a351be1dc3e 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -1069,6 +1069,13 @@ class Node(Generic[T]): ... for t in things + [Any]: self.assertEqual(t, copy(t)) self.assertEqual(t, deepcopy(t)) + if sys.version_info >= (3, 3): + # From copy module documentation: + # It does "copy" functions and classes (shallow and deeply), by returning + # the original object unchanged; this is compatible with the way these + # are treated by the pickle module. + self.assertTrue(t is copy(t)) + self.assertTrue(t is deepcopy(t)) def test_weakref_all(self): T = TypeVar('T') diff --git a/Lib/typing.py b/Lib/typing.py index c487afcb5b4..609f813b01e 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -376,7 +376,7 @@ def _type_check(arg, msg): if ( type(arg).__name__ in ('_Union', '_Optional') and not getattr(arg, '__origin__', None) or - isinstance(arg, TypingMeta) and _gorg(arg) in (Generic, _Protocol) + isinstance(arg, TypingMeta) and arg._gorg in (Generic, _Protocol) ): raise TypeError("Plain %s is not valid as type argument" % arg) return arg @@ -849,29 +849,6 @@ def __getitem__(self, arg): Optional = _Optional(_root=True) -def _gorg(a): - """Return the farthest origin of a generic class (internal helper).""" - assert isinstance(a, GenericMeta) - while a.__origin__ is not None: - a = a.__origin__ - return a - - -def _geqv(a, b): - """Return whether two generic classes are equivalent (internal helper). - - The intention is to consider generic class X and any of its - parameterized forms (X[T], X[int], etc.) as equivalent. - - However, X is not equivalent to a subclass of X. - - The relation is reflexive, symmetric and transitive. - """ - assert isinstance(a, GenericMeta) and isinstance(b, GenericMeta) - # Reduce each to its origin. - return _gorg(a) is _gorg(b) - - def _next_in_mro(cls): """Helper for Generic.__new__. @@ -881,7 +858,7 @@ def _next_in_mro(cls): next_in_mro = object # Look for the last occurrence of Generic or Generic[...]. for i, c in enumerate(cls.__mro__[:-1]): - if isinstance(c, GenericMeta) and _gorg(c) is Generic: + if isinstance(c, GenericMeta) and c._gorg is Generic: next_in_mro = cls.__mro__[i + 1] return next_in_mro @@ -991,14 +968,15 @@ def __new__(cls, name, bases, namespace, initial_bases = bases if extra is not None and type(extra) is abc.ABCMeta and extra not in bases: bases = (extra,) + bases - bases = tuple(_gorg(b) if isinstance(b, GenericMeta) else b for b in bases) + bases = tuple(b._gorg if isinstance(b, GenericMeta) else b for b in bases) # remove bare Generic from bases if there are other generic bases if any(isinstance(b, GenericMeta) and b is not Generic for b in bases): bases = tuple(b for b in bases if b is not Generic) namespace.update({'__origin__': origin, '__extra__': extra}) self = super().__new__(cls, name, bases, namespace, _root=True) - + super(GenericMeta, self).__setattr__('_gorg', + self if not origin else origin._gorg) self.__parameters__ = tvars # Be prepared that GenericMeta will be subclassed by TupleMeta # and CallableMeta, those two allow ..., (), or [] in __args___. @@ -1041,7 +1019,7 @@ def __new__(cls, name, bases, namespace, def _abc_negative_cache(self): if isinstance(self.__extra__, abc.ABCMeta): return self.__extra__._abc_negative_cache - return _gorg(self)._abc_generic_negative_cache + return self._gorg._abc_generic_negative_cache @_abc_negative_cache.setter def _abc_negative_cache(self, value): @@ -1055,7 +1033,7 @@ def _abc_negative_cache(self, value): def _abc_negative_cache_version(self): if isinstance(self.__extra__, abc.ABCMeta): return self.__extra__._abc_negative_cache_version - return _gorg(self)._abc_generic_negative_cache_version + return self._gorg._abc_generic_negative_cache_version @_abc_negative_cache_version.setter def _abc_negative_cache_version(self, value): @@ -1105,7 +1083,7 @@ def _subs_tree(self, tvars=None, args=None): if self.__origin__ is None: return self tree_args = _subs_tree(self, tvars, args) - return (_gorg(self),) + tuple(tree_args) + return (self._gorg,) + tuple(tree_args) def __eq__(self, other): if not isinstance(other, GenericMeta): @@ -1121,7 +1099,7 @@ def __hash__(self): def __getitem__(self, params): if not isinstance(params, tuple): params = (params,) - if not params and not _gorg(self) is Tuple: + if not params and self._gorg is not Tuple: raise TypeError( "Parameter list to %s[...] cannot be empty" % _qualname(self)) msg = "Parameters to generic types must be types." @@ -1189,14 +1167,14 @@ def __copy__(self): self.__extra__, self.__orig_bases__) def __setattr__(self, attr, value): - # We consider all the subscripted genrics as proxies for original class + # We consider all the subscripted generics as proxies for original class if ( attr.startswith('__') and attr.endswith('__') or attr.startswith('_abc_') ): super(GenericMeta, self).__setattr__(attr, value) else: - super(GenericMeta, _gorg(self)).__setattr__(attr, value) + super(GenericMeta, self._gorg).__setattr__(attr, value) # Prevent checks for Generic to crash when defining Generic. @@ -1209,7 +1187,7 @@ def _generic_new(base_cls, cls, *args, **kwds): if cls.__origin__ is None: return base_cls.__new__(cls) else: - origin = _gorg(cls) + origin = cls._gorg obj = base_cls.__new__(origin) try: obj.__orig_class__ = cls @@ -1243,7 +1221,7 @@ def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Generic): + if cls._gorg is Generic: raise TypeError("Type Generic cannot be instantiated; " "it can be used only as a base class") return _generic_new(cls.__next_in_mro__, cls, *args, **kwds) @@ -1265,7 +1243,7 @@ class TupleMeta(GenericMeta): @_tp_cache def __getitem__(self, parameters): - if self.__origin__ is not None or not _geqv(self, Tuple): + if self.__origin__ is not None or self._gorg is not Tuple: # Normal generic rules apply if this is not the first subscription # or a subscription of a subclass. return super().__getitem__(parameters) @@ -1307,7 +1285,7 @@ class Tuple(tuple, extra=tuple, metaclass=TupleMeta): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Tuple): + if cls._gorg is Tuple: raise TypeError("Type Tuple cannot be instantiated; " "use tuple() instead") return _generic_new(tuple, cls, *args, **kwds) @@ -1322,7 +1300,7 @@ def __repr__(self): return self._tree_repr(self._subs_tree()) def _tree_repr(self, tree): - if _gorg(self) is not Callable: + if self._gorg is not Callable: return super()._tree_repr(tree) # For actual Callable (not its subclass) we override # super()._tree_repr() for nice formatting. @@ -1342,7 +1320,7 @@ def __getitem__(self, parameters): with hashable arguments to improve speed. """ - if self.__origin__ is not None or not _geqv(self, Callable): + if self.__origin__ is not None or self._gorg is not Callable: return super().__getitem__(parameters) if not isinstance(parameters, tuple) or len(parameters) != 2: raise TypeError("Callable must be used as " @@ -1384,7 +1362,7 @@ class Callable(extra=collections_abc.Callable, metaclass=CallableMeta): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Callable): + if cls._gorg is Callable: raise TypeError("Type Callable cannot be instantiated; " "use a non-abstract subclass instead") return _generic_new(cls.__next_in_mro__, cls, *args, **kwds) @@ -1568,7 +1546,7 @@ def no_type_check(arg): if isinstance(arg, type): arg_attrs = arg.__dict__.copy() for attr, val in arg.__dict__.items(): - if val in arg.__bases__: + if val in arg.__bases__ + (arg,): arg_attrs.pop(attr) for obj in arg_attrs.values(): if isinstance(obj, types.FunctionType): @@ -1687,6 +1665,7 @@ def _get_protocol_attrs(self): attr != '__annotations__' and attr != '__weakref__' and attr != '_is_protocol' and + attr != '_gorg' and attr != '__dict__' and attr != '__args__' and attr != '__slots__' and @@ -1892,7 +1871,7 @@ class List(list, MutableSequence[T], extra=list): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, List): + if cls._gorg is List: raise TypeError("Type List cannot be instantiated; " "use list() instead") return _generic_new(list, cls, *args, **kwds) @@ -1903,7 +1882,7 @@ class Deque(collections.deque, MutableSequence[T], extra=collections.deque): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Deque): + if cls._gorg is Deque: return collections.deque(*args, **kwds) return _generic_new(collections.deque, cls, *args, **kwds) @@ -1913,7 +1892,7 @@ class Set(set, MutableSet[T], extra=set): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Set): + if cls._gorg is Set: raise TypeError("Type Set cannot be instantiated; " "use set() instead") return _generic_new(set, cls, *args, **kwds) @@ -1923,7 +1902,7 @@ class FrozenSet(frozenset, AbstractSet[T_co], extra=frozenset): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, FrozenSet): + if cls._gorg is FrozenSet: raise TypeError("Type FrozenSet cannot be instantiated; " "use frozenset() instead") return _generic_new(frozenset, cls, *args, **kwds) @@ -2014,7 +1993,7 @@ class Dict(dict, MutableMapping[KT, VT], extra=dict): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Dict): + if cls._gorg is Dict: raise TypeError("Type Dict cannot be instantiated; " "use dict() instead") return _generic_new(dict, cls, *args, **kwds) @@ -2026,7 +2005,7 @@ class DefaultDict(collections.defaultdict, MutableMapping[KT, VT], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, DefaultDict): + if cls._gorg is DefaultDict: return collections.defaultdict(*args, **kwds) return _generic_new(collections.defaultdict, cls, *args, **kwds) @@ -2036,7 +2015,7 @@ class Counter(collections.Counter, Dict[T, int], extra=collections.Counter): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Counter): + if cls._gorg is Counter: return collections.Counter(*args, **kwds) return _generic_new(collections.Counter, cls, *args, **kwds) @@ -2051,7 +2030,7 @@ class ChainMap(collections.ChainMap, MutableMapping[KT, VT], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, ChainMap): + if cls._gorg is ChainMap: return collections.ChainMap(*args, **kwds) return _generic_new(collections.ChainMap, cls, *args, **kwds) @@ -2070,7 +2049,7 @@ class Generator(Iterator[T_co], Generic[T_co, T_contra, V_co], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Generator): + if cls._gorg is Generator: raise TypeError("Type Generator cannot be instantiated; " "create a subclass instead") return _generic_new(_G_base, cls, *args, **kwds) diff --git a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst new file mode 100644 index 00000000000..efc5918ca07 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst @@ -0,0 +1,2 @@ +Speed improvements to the ``typing`` module. Original PRs by Ivan +Levkivskyi and Mitar. From webhook-mailer at python.org Wed Sep 13 19:41:13 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 13 Sep 2017 23:41:13 -0000 Subject: [Python-checkins] bpo-31234: Try to fix lock_tests warning (#3557) Message-ID: https://github.com/python/cpython/commit/096ae3373abac2c8b3a26a3fe33cc8bd4cbccd4e commit: 096ae3373abac2c8b3a26a3fe33cc8bd4cbccd4e branch: master author: Victor Stinner committer: GitHub date: 2017-09-13T16:41:08-07:00 summary: bpo-31234: Try to fix lock_tests warning (#3557) Try to fix the "Warning -- threading_cleanup() failed to cleanup 1 threads" warning in test.lock_tests: wait a little bit longer to give time to the threads to complete. Warning seen on test_thread and test_importlib. files: M Lib/test/lock_tests.py diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py index 4fa154f734d..e8fa4f999a7 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -54,6 +54,13 @@ def wait_for_started(self): def wait_for_finished(self): while len(self.finished) < self.n: _wait() + # Wait a little bit longer to prevent the "threading_cleanup() + # failed to cleanup X threads" warning. The loop above is a weak + # synchronization. At the C level, t_bootstrap() can still be + # running and so _thread.count() still accounts the "almost dead" + # thead. + for _ in range(self.n): + _wait() def do_finish(self): self._can_exit = True @@ -304,6 +311,7 @@ def f(): self.assertRaises(RuntimeError, lock.release) finally: b.do_finish() + b.wait_for_finished() def test__is_owned(self): lock = self.locktype() From webhook-mailer at python.org Wed Sep 13 19:47:36 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 13 Sep 2017 23:47:36 -0000 Subject: [Python-checkins] bpo-31458: Update Misc/NEWS link in What's New page (GH-3555) Message-ID: https://github.com/python/cpython/commit/1b8f612e1800b6e58472113f4abe8ee7c31f4db7 commit: 1b8f612e1800b6e58472113f4abe8ee7c31f4db7 branch: master author: Mariatta committer: GitHub date: 2017-09-13T16:47:33-07:00 summary: bpo-31458: Update Misc/NEWS link in What's New page (GH-3555) Update the link from Misc/NEWS to Misc/NEWS.d files: M Doc/whatsnew/index.rst M README.rst diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst index 160b364a4bc..20b599e3163 100644 --- a/Doc/whatsnew/index.rst +++ b/Doc/whatsnew/index.rst @@ -28,7 +28,7 @@ anyone wishing to stay up-to-date after a new release. 2.1.rst 2.0.rst -The "Changelog" is a HTML version of the file :source:`Misc/NEWS` which +The "Changelog" is a HTML version of the file :source:`Misc/NEWS.d` which contains *all* nontrivial changes to Python for the current version. .. toctree:: diff --git a/README.rst b/README.rst index b7e9eff4097..201af0ffeb4 100644 --- a/README.rst +++ b/README.rst @@ -128,7 +128,7 @@ What's New We have a comprehensive overview of the changes in the `What's New in Python 3.7 `_ document. For a more detailed change log, read `Misc/NEWS -`_, but a full +`_, but a full accounting of changes can only be gleaned from the `commit history `_. From webhook-mailer at python.org Wed Sep 13 20:10:57 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 14 Sep 2017 00:10:57 -0000 Subject: [Python-checkins] [3.6] bpo-28556: Minor updates to typing module (GH-3550) (#3558) Message-ID: https://github.com/python/cpython/commit/9e3cd78ec18b2d2078d30b04307916acd68be37a commit: 9e3cd78ec18b2d2078d30b04307916acd68be37a branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: ?ukasz Langa date: 2017-09-13T20:10:53-04:00 summary: [3.6] bpo-28556: Minor updates to typing module (GH-3550) (#3558) * Copy changes to typing from upstream repo * Add NEWS entry (cherry picked from commit 65bc62052fe5d550cb14c0033e8a2550618fb7b9) files: A Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst M Lib/test/test_typing.py M Lib/typing.py diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 6d0b2659db2..ff634e8c2a0 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -1069,6 +1069,13 @@ class Node(Generic[T]): ... for t in things + [Any]: self.assertEqual(t, copy(t)) self.assertEqual(t, deepcopy(t)) + if sys.version_info >= (3, 3): + # From copy module documentation: + # It does "copy" functions and classes (shallow and deeply), by returning + # the original object unchanged; this is compatible with the way these + # are treated by the pickle module. + self.assertTrue(t is copy(t)) + self.assertTrue(t is deepcopy(t)) def test_weakref_all(self): T = TypeVar('T') diff --git a/Lib/typing.py b/Lib/typing.py index c487afcb5b4..609f813b01e 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -376,7 +376,7 @@ def _type_check(arg, msg): if ( type(arg).__name__ in ('_Union', '_Optional') and not getattr(arg, '__origin__', None) or - isinstance(arg, TypingMeta) and _gorg(arg) in (Generic, _Protocol) + isinstance(arg, TypingMeta) and arg._gorg in (Generic, _Protocol) ): raise TypeError("Plain %s is not valid as type argument" % arg) return arg @@ -849,29 +849,6 @@ def __getitem__(self, arg): Optional = _Optional(_root=True) -def _gorg(a): - """Return the farthest origin of a generic class (internal helper).""" - assert isinstance(a, GenericMeta) - while a.__origin__ is not None: - a = a.__origin__ - return a - - -def _geqv(a, b): - """Return whether two generic classes are equivalent (internal helper). - - The intention is to consider generic class X and any of its - parameterized forms (X[T], X[int], etc.) as equivalent. - - However, X is not equivalent to a subclass of X. - - The relation is reflexive, symmetric and transitive. - """ - assert isinstance(a, GenericMeta) and isinstance(b, GenericMeta) - # Reduce each to its origin. - return _gorg(a) is _gorg(b) - - def _next_in_mro(cls): """Helper for Generic.__new__. @@ -881,7 +858,7 @@ def _next_in_mro(cls): next_in_mro = object # Look for the last occurrence of Generic or Generic[...]. for i, c in enumerate(cls.__mro__[:-1]): - if isinstance(c, GenericMeta) and _gorg(c) is Generic: + if isinstance(c, GenericMeta) and c._gorg is Generic: next_in_mro = cls.__mro__[i + 1] return next_in_mro @@ -991,14 +968,15 @@ def __new__(cls, name, bases, namespace, initial_bases = bases if extra is not None and type(extra) is abc.ABCMeta and extra not in bases: bases = (extra,) + bases - bases = tuple(_gorg(b) if isinstance(b, GenericMeta) else b for b in bases) + bases = tuple(b._gorg if isinstance(b, GenericMeta) else b for b in bases) # remove bare Generic from bases if there are other generic bases if any(isinstance(b, GenericMeta) and b is not Generic for b in bases): bases = tuple(b for b in bases if b is not Generic) namespace.update({'__origin__': origin, '__extra__': extra}) self = super().__new__(cls, name, bases, namespace, _root=True) - + super(GenericMeta, self).__setattr__('_gorg', + self if not origin else origin._gorg) self.__parameters__ = tvars # Be prepared that GenericMeta will be subclassed by TupleMeta # and CallableMeta, those two allow ..., (), or [] in __args___. @@ -1041,7 +1019,7 @@ def __new__(cls, name, bases, namespace, def _abc_negative_cache(self): if isinstance(self.__extra__, abc.ABCMeta): return self.__extra__._abc_negative_cache - return _gorg(self)._abc_generic_negative_cache + return self._gorg._abc_generic_negative_cache @_abc_negative_cache.setter def _abc_negative_cache(self, value): @@ -1055,7 +1033,7 @@ def _abc_negative_cache(self, value): def _abc_negative_cache_version(self): if isinstance(self.__extra__, abc.ABCMeta): return self.__extra__._abc_negative_cache_version - return _gorg(self)._abc_generic_negative_cache_version + return self._gorg._abc_generic_negative_cache_version @_abc_negative_cache_version.setter def _abc_negative_cache_version(self, value): @@ -1105,7 +1083,7 @@ def _subs_tree(self, tvars=None, args=None): if self.__origin__ is None: return self tree_args = _subs_tree(self, tvars, args) - return (_gorg(self),) + tuple(tree_args) + return (self._gorg,) + tuple(tree_args) def __eq__(self, other): if not isinstance(other, GenericMeta): @@ -1121,7 +1099,7 @@ def __hash__(self): def __getitem__(self, params): if not isinstance(params, tuple): params = (params,) - if not params and not _gorg(self) is Tuple: + if not params and self._gorg is not Tuple: raise TypeError( "Parameter list to %s[...] cannot be empty" % _qualname(self)) msg = "Parameters to generic types must be types." @@ -1189,14 +1167,14 @@ def __copy__(self): self.__extra__, self.__orig_bases__) def __setattr__(self, attr, value): - # We consider all the subscripted genrics as proxies for original class + # We consider all the subscripted generics as proxies for original class if ( attr.startswith('__') and attr.endswith('__') or attr.startswith('_abc_') ): super(GenericMeta, self).__setattr__(attr, value) else: - super(GenericMeta, _gorg(self)).__setattr__(attr, value) + super(GenericMeta, self._gorg).__setattr__(attr, value) # Prevent checks for Generic to crash when defining Generic. @@ -1209,7 +1187,7 @@ def _generic_new(base_cls, cls, *args, **kwds): if cls.__origin__ is None: return base_cls.__new__(cls) else: - origin = _gorg(cls) + origin = cls._gorg obj = base_cls.__new__(origin) try: obj.__orig_class__ = cls @@ -1243,7 +1221,7 @@ def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Generic): + if cls._gorg is Generic: raise TypeError("Type Generic cannot be instantiated; " "it can be used only as a base class") return _generic_new(cls.__next_in_mro__, cls, *args, **kwds) @@ -1265,7 +1243,7 @@ class TupleMeta(GenericMeta): @_tp_cache def __getitem__(self, parameters): - if self.__origin__ is not None or not _geqv(self, Tuple): + if self.__origin__ is not None or self._gorg is not Tuple: # Normal generic rules apply if this is not the first subscription # or a subscription of a subclass. return super().__getitem__(parameters) @@ -1307,7 +1285,7 @@ class Tuple(tuple, extra=tuple, metaclass=TupleMeta): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Tuple): + if cls._gorg is Tuple: raise TypeError("Type Tuple cannot be instantiated; " "use tuple() instead") return _generic_new(tuple, cls, *args, **kwds) @@ -1322,7 +1300,7 @@ def __repr__(self): return self._tree_repr(self._subs_tree()) def _tree_repr(self, tree): - if _gorg(self) is not Callable: + if self._gorg is not Callable: return super()._tree_repr(tree) # For actual Callable (not its subclass) we override # super()._tree_repr() for nice formatting. @@ -1342,7 +1320,7 @@ def __getitem__(self, parameters): with hashable arguments to improve speed. """ - if self.__origin__ is not None or not _geqv(self, Callable): + if self.__origin__ is not None or self._gorg is not Callable: return super().__getitem__(parameters) if not isinstance(parameters, tuple) or len(parameters) != 2: raise TypeError("Callable must be used as " @@ -1384,7 +1362,7 @@ class Callable(extra=collections_abc.Callable, metaclass=CallableMeta): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Callable): + if cls._gorg is Callable: raise TypeError("Type Callable cannot be instantiated; " "use a non-abstract subclass instead") return _generic_new(cls.__next_in_mro__, cls, *args, **kwds) @@ -1568,7 +1546,7 @@ def no_type_check(arg): if isinstance(arg, type): arg_attrs = arg.__dict__.copy() for attr, val in arg.__dict__.items(): - if val in arg.__bases__: + if val in arg.__bases__ + (arg,): arg_attrs.pop(attr) for obj in arg_attrs.values(): if isinstance(obj, types.FunctionType): @@ -1687,6 +1665,7 @@ def _get_protocol_attrs(self): attr != '__annotations__' and attr != '__weakref__' and attr != '_is_protocol' and + attr != '_gorg' and attr != '__dict__' and attr != '__args__' and attr != '__slots__' and @@ -1892,7 +1871,7 @@ class List(list, MutableSequence[T], extra=list): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, List): + if cls._gorg is List: raise TypeError("Type List cannot be instantiated; " "use list() instead") return _generic_new(list, cls, *args, **kwds) @@ -1903,7 +1882,7 @@ class Deque(collections.deque, MutableSequence[T], extra=collections.deque): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Deque): + if cls._gorg is Deque: return collections.deque(*args, **kwds) return _generic_new(collections.deque, cls, *args, **kwds) @@ -1913,7 +1892,7 @@ class Set(set, MutableSet[T], extra=set): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Set): + if cls._gorg is Set: raise TypeError("Type Set cannot be instantiated; " "use set() instead") return _generic_new(set, cls, *args, **kwds) @@ -1923,7 +1902,7 @@ class FrozenSet(frozenset, AbstractSet[T_co], extra=frozenset): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, FrozenSet): + if cls._gorg is FrozenSet: raise TypeError("Type FrozenSet cannot be instantiated; " "use frozenset() instead") return _generic_new(frozenset, cls, *args, **kwds) @@ -2014,7 +1993,7 @@ class Dict(dict, MutableMapping[KT, VT], extra=dict): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Dict): + if cls._gorg is Dict: raise TypeError("Type Dict cannot be instantiated; " "use dict() instead") return _generic_new(dict, cls, *args, **kwds) @@ -2026,7 +2005,7 @@ class DefaultDict(collections.defaultdict, MutableMapping[KT, VT], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, DefaultDict): + if cls._gorg is DefaultDict: return collections.defaultdict(*args, **kwds) return _generic_new(collections.defaultdict, cls, *args, **kwds) @@ -2036,7 +2015,7 @@ class Counter(collections.Counter, Dict[T, int], extra=collections.Counter): __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Counter): + if cls._gorg is Counter: return collections.Counter(*args, **kwds) return _generic_new(collections.Counter, cls, *args, **kwds) @@ -2051,7 +2030,7 @@ class ChainMap(collections.ChainMap, MutableMapping[KT, VT], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, ChainMap): + if cls._gorg is ChainMap: return collections.ChainMap(*args, **kwds) return _generic_new(collections.ChainMap, cls, *args, **kwds) @@ -2070,7 +2049,7 @@ class Generator(Iterator[T_co], Generic[T_co, T_contra, V_co], __slots__ = () def __new__(cls, *args, **kwds): - if _geqv(cls, Generator): + if cls._gorg is Generator: raise TypeError("Type Generator cannot be instantiated; " "create a subclass instead") return _generic_new(_G_base, cls, *args, **kwds) diff --git a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst new file mode 100644 index 00000000000..efc5918ca07 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst @@ -0,0 +1,2 @@ +Speed improvements to the ``typing`` module. Original PRs by Ivan +Levkivskyi and Mitar. From webhook-mailer at python.org Wed Sep 13 22:33:29 2017 From: webhook-mailer at python.org (Xiang Zhang) Date: Thu, 14 Sep 2017 02:33:29 -0000 Subject: [Python-checkins] bpo-30246: fix several error messages which only mention bytes in struct (#1421) Message-ID: https://github.com/python/cpython/commit/c3e97d9d984130d1c2aceedc4dfcd603b3162688 commit: c3e97d9d984130d1c2aceedc4dfcd603b3162688 branch: master author: Xiang Zhang committer: GitHub date: 2017-09-14T10:33:26+08:00 summary: bpo-30246: fix several error messages which only mention bytes in struct (#1421) files: M Modules/_struct.c diff --git a/Modules/_struct.c b/Modules/_struct.c index 69a1e996d05..04d7f8e1871 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1453,7 +1453,8 @@ Struct___init___impl(PyStructObject *self, PyObject *format) if (!PyBytes_Check(format)) { Py_DECREF(format); PyErr_Format(PyExc_TypeError, - "Struct() argument 1 must be a bytes object, not %.200s", + "Struct() argument 1 must be a str or bytes object, " + "not %.200s", Py_TYPE(format)->tp_name); return -1; } @@ -1535,7 +1536,7 @@ Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer) assert(self->s_codes != NULL); if (buffer->len != self->s_size) { PyErr_Format(StructError, - "unpack requires a bytes object of length %zd", + "unpack requires a buffer of %zd bytes", self->s_size); return NULL; } @@ -1708,8 +1709,8 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer) } if (iter->buf.len % self->s_size != 0) { PyErr_Format(StructError, - "iterative unpacking requires a bytes length " - "multiple of %zd", + "iterative unpacking requires a buffer of " + "a multiple of %zd bytes", self->s_size); Py_DECREF(iter); return NULL; From webhook-mailer at python.org Wed Sep 13 22:40:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 14 Sep 2017 02:40:34 -0000 Subject: [Python-checkins] [3.6] bpo-31458: Update Misc/NEWS link in What's New page (GH-3555) (GH-3560) Message-ID: https://github.com/python/cpython/commit/905e4ef86e86dbf8f28b2f6e45af31a6eea84e10 commit: 905e4ef86e86dbf8f28b2f6e45af31a6eea84e10 branch: 3.6 author: Mariatta committer: GitHub date: 2017-09-13T19:40:32-07:00 summary: [3.6] bpo-31458: Update Misc/NEWS link in What's New page (GH-3555) (GH-3560) Update the link from Misc/NEWS to Misc/NEWS.d (cherry picked from commit 1b8f612e1800b6e58472113f4abe8ee7c31f4db7) files: M Doc/whatsnew/index.rst M README.rst diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst index 7c9252401ef..63e6a7bafa9 100644 --- a/Doc/whatsnew/index.rst +++ b/Doc/whatsnew/index.rst @@ -27,7 +27,7 @@ anyone wishing to stay up-to-date after a new release. 2.1.rst 2.0.rst -The "Changelog" is a HTML version of the file :source:`Misc/NEWS` which +The "Changelog" is a HTML version of the file :source:`Misc/NEWS.d` which contains *all* nontrivial changes to Python for the current version. .. toctree:: diff --git a/README.rst b/README.rst index 82d61f7a2e2..1a3e577208e 100644 --- a/README.rst +++ b/README.rst @@ -127,7 +127,7 @@ What's New We have a comprehensive overview of the changes in the `What's New in Python 3.6 `_ document. For a more detailed change log, read `Misc/NEWS -`_, but a full +`_, but a full accounting of changes can only be gleaned from the `commit history `_. From webhook-mailer at python.org Wed Sep 13 23:22:26 2017 From: webhook-mailer at python.org (Xiang Zhang) Date: Thu, 14 Sep 2017 03:22:26 -0000 Subject: [Python-checkins] [3.6] bpo-30246: fix several error messages which only mention bytes in struct (#3561) Message-ID: https://github.com/python/cpython/commit/fa82dda1012b406a7091587fc65384ce11528346 commit: fa82dda1012b406a7091587fc65384ce11528346 branch: 3.6 author: Xiang Zhang committer: GitHub date: 2017-09-14T11:22:23+08:00 summary: [3.6] bpo-30246: fix several error messages which only mention bytes in struct (#3561) files: M Modules/_struct.c diff --git a/Modules/_struct.c b/Modules/_struct.c index e9af6efa2ea..cd3fa2d1506 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1460,7 +1460,8 @@ s_init(PyObject *self, PyObject *args, PyObject *kwds) if (!PyBytes_Check(o_format)) { Py_DECREF(o_format); PyErr_Format(PyExc_TypeError, - "Struct() argument 1 must be a bytes object, not %.200s", + "Struct() argument 1 must be a str or bytes object, " + "not %.200s", Py_TYPE(o_format)->tp_name); return -1; } @@ -1541,7 +1542,7 @@ s_unpack(PyObject *self, PyObject *input) return NULL; if (vbuf.len != soself->s_size) { PyErr_Format(StructError, - "unpack requires a bytes object of length %zd", + "unpack requires a buffer of %zd bytes", soself->s_size); PyBuffer_Release(&vbuf); return NULL; @@ -1718,8 +1719,8 @@ s_iter_unpack(PyObject *_so, PyObject *input) } if (self->buf.len % so->s_size != 0) { PyErr_Format(StructError, - "iterative unpacking requires a bytes length " - "multiple of %zd", + "iterative unpacking requires a buffer of " + "a multiple of %zd bytes", so->s_size); Py_DECREF(self); return NULL; From webhook-mailer at python.org Thu Sep 14 00:20:31 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 14 Sep 2017 04:20:31 -0000 Subject: [Python-checkins] consistently use Py_TYPE, Py_REFCNT, and correct initializer macros (#3563) Message-ID: https://github.com/python/cpython/commit/a72d15c97f9837f6c9c6bd476a62175c942cc588 commit: a72d15c97f9837f6c9c6bd476a62175c942cc588 branch: 2.7 author: Benjamin Peterson committer: GitHub date: 2017-09-13T21:20:29-07:00 summary: consistently use Py_TYPE, Py_REFCNT, and correct initializer macros (#3563) This no-op change makes 2.7 more consistent with 3.x to ease comparison and backports. files: M Include/frameobject.h M Include/intobject.h M Modules/_ctypes/ctypes.h M Modules/_elementtree.c M Modules/_json.c M Modules/_lsprof.c M Modules/_sqlite/connection.c M Modules/_sqlite/cursor.c M Modules/_sre.c M Modules/_testcapimodule.c M Modules/arraymodule.c M Modules/datetimemodule.c M Objects/bufferobject.c M Objects/classobject.c M Objects/exceptions.c M Objects/fileobject.c M Objects/floatobject.c M Objects/intobject.c M Objects/longobject.c M Objects/rangeobject.c M Objects/setobject.c M Objects/weakrefobject.c diff --git a/Include/frameobject.h b/Include/frameobject.h index 17e7679ac87..843908159dd 100644 --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -54,7 +54,7 @@ typedef struct _frame { PyAPI_DATA(PyTypeObject) PyFrame_Type; -#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) +#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) #define PyFrame_IsRestricted(f) \ ((f)->f_builtins != (f)->f_tstate->interp->builtins) diff --git a/Include/intobject.h b/Include/intobject.h index 252eea9fd92..59d061629e2 100644 --- a/Include/intobject.h +++ b/Include/intobject.h @@ -28,8 +28,8 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyInt_Type; #define PyInt_Check(op) \ - PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) -#define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_INT_SUBCLASS) +#define PyInt_CheckExact(op) (Py_TYPE(op) == &PyInt_Type) PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); #ifdef Py_USING_UNICODE diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h index b21fe92b044..12b56c4342f 100644 --- a/Modules/_ctypes/ctypes.h +++ b/Modules/_ctypes/ctypes.h @@ -108,7 +108,7 @@ typedef struct { ffi_type *atypes[1]; } CThunkObject; extern PyTypeObject PyCThunk_Type; -#define CThunk_CheckExact(v) ((v)->ob_type == &PyCThunk_Type) +#define CThunk_CheckExact(v) (Py_TYPE(v) == &PyCThunk_Type) typedef struct { /* First part identical to tagCDataObject */ diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 929616f3e2e..b52402f3811 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1661,8 +1661,8 @@ static PyMappingMethods element_as_mapping = { }; statichere PyTypeObject Element_Type = { - PyObject_HEAD_INIT(NULL) - 0, "Element", sizeof(ElementObject), 0, + PyVarObject_HEAD_INIT(NULL, 0) + "Element", sizeof(ElementObject), 0, /* methods */ (destructor)element_dealloc, /* tp_dealloc */ 0, /* tp_print */ @@ -2031,8 +2031,8 @@ treebuilder_getattr(TreeBuilderObject* self, char* name) } statichere PyTypeObject TreeBuilder_Type = { - PyObject_HEAD_INIT(NULL) - 0, "TreeBuilder", sizeof(TreeBuilderObject), 0, + PyVarObject_HEAD_INIT(NULL, 0) + "TreeBuilder", sizeof(TreeBuilderObject), 0, /* methods */ (destructor)treebuilder_dealloc, /* tp_dealloc */ 0, /* tp_print */ @@ -2897,8 +2897,8 @@ xmlparser_getattr(XMLParserObject* self, char* name) } statichere PyTypeObject XMLParser_Type = { - PyObject_HEAD_INIT(NULL) - 0, "XMLParser", sizeof(XMLParserObject), 0, + PyVarObject_HEAD_INIT(NULL, 0) + "XMLParser", sizeof(XMLParserObject), 0, /* methods */ (destructor)xmlparser_dealloc, /* tp_dealloc */ 0, /* tp_print */ diff --git a/Modules/_json.c b/Modules/_json.c index be1e0796960..39ec467b093 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1767,8 +1767,7 @@ PyDoc_STRVAR(scanner_doc, "JSON scanner object"); static PyTypeObject PyScannerType = { - PyObject_HEAD_INIT(NULL) - 0, /* tp_internal */ + PyVarObject_HEAD_INIT(NULL, 0) "_json.Scanner", /* tp_name */ sizeof(PyScannerObject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -2344,8 +2343,7 @@ PyDoc_STRVAR(encoder_doc, "_iterencode(obj, _current_indent_level) -> iterable") static PyTypeObject PyEncoderType = { - PyObject_HEAD_INIT(NULL) - 0, /* tp_internal */ + PyVarObject_HEAD_INIT(NULL, 0) "_json.Encoder", /* tp_name */ sizeof(PyEncoderObject), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 049c94db393..6090c7dd236 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -817,8 +817,7 @@ Profiler(custom_timer=None, time_unit=None, subcalls=True, builtins=True)\n\ "); statichere PyTypeObject PyProfiler_Type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "_lsprof.Profiler", /* tp_name */ sizeof(ProfilerObject), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 237d6e419a9..439542e5139 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -293,7 +293,7 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self) Py_XDECREF(self->statements); Py_XDECREF(self->cursors); - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } /* diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index db360040e44..ad607d93861 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -135,7 +135,7 @@ static void pysqlite_cursor_dealloc(pysqlite_Cursor* self) PyObject_ClearWeakRefs((PyObject*)self); } - self->ob_type->tp_free((PyObject*)self); + Py_TYPE(self)->tp_free((PyObject*)self); } PyObject* _pysqlite_get_converter(PyObject* key) diff --git a/Modules/_sre.c b/Modules/_sre.c index 6fd3affb09a..94b3d5089ce 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2712,8 +2712,8 @@ static PyMemberDef pattern_members[] = { }; statichere PyTypeObject Pattern_Type = { - PyObject_HEAD_INIT(NULL) - 0, "_" SRE_MODULE ".SRE_Pattern", + PyVarObject_HEAD_INIT(NULL, 0) + "_" SRE_MODULE ".SRE_Pattern", sizeof(PatternObject), sizeof(SRE_CODE), (destructor)pattern_dealloc, /*tp_dealloc*/ 0, /* tp_print */ @@ -3952,8 +3952,8 @@ static PyMemberDef scanner_members[] = { }; statichere PyTypeObject Scanner_Type = { - PyObject_HEAD_INIT(NULL) - 0, "_" SRE_MODULE ".SRE_Scanner", + PyVarObject_HEAD_INIT(NULL, 0) + "_" SRE_MODULE ".SRE_Scanner", sizeof(ScannerObject), 0, (destructor)scanner_dealloc, /*tp_dealloc*/ 0, /* tp_print */ diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index ecc473cf4c1..7691b5188ff 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -187,8 +187,7 @@ test_dict_iteration(PyObject* self) * PyType_Ready if it hasn't already been called */ static PyTypeObject _HashInheritanceTester_Type = { - PyObject_HEAD_INIT(NULL) - 0, /* Number of items for varobject */ + PyVarObject_HEAD_INIT(NULL, 0) "hashinheritancetester", /* Name of this type */ sizeof(PyObject), /* Basic object size */ 0, /* Item size for varobject */ @@ -315,8 +314,7 @@ static PyBufferProcs memoryviewtester_as_buffer = { }; static PyTypeObject _MemoryViewTester_Type = { - PyObject_HEAD_INIT(NULL) - 0, /* Number of items for varobject */ + PyVarObject_HEAD_INIT(NULL, 0) "memoryviewtester", /* Name of this type */ sizeof(PyObject), /* Basic object size */ 0, /* Item size for varobject */ diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index f6f597a046c..5bd3a42f009 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1292,9 +1292,9 @@ array_tofile(arrayobject *self, PyObject *f) PyErr_SetString(PyExc_TypeError, "arg must be open file"); return NULL; } - if (self->ob_size > 0) { + if (Py_SIZE(self) > 0) { if (fwrite(self->ob_item, self->ob_descr->itemsize, - self->ob_size, fp) != (size_t)self->ob_size) { + Py_SIZE(self), fp) != (size_t)Py_SIZE(self)) { PyErr_SetFromErrno(PyExc_IOError); clearerr(fp); return NULL; @@ -1348,7 +1348,7 @@ array_fromlist(arrayobject *self, PyObject *list) if ((*self->ob_descr->setitem)(self, Py_SIZE(self) - n + i, v) != 0) { Py_SIZE(self) -= n; - if (itemsize && (self->ob_size > PY_SSIZE_T_MAX / itemsize)) { + if (itemsize && (Py_SIZE(self) > PY_SSIZE_T_MAX / itemsize)) { return PyErr_NoMemory(); } PyMem_RESIZE(item, char, @@ -1444,7 +1444,7 @@ values,as if it had been read from a file using the fromfile() method)."); static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - if (self->ob_size <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { + if (Py_SIZE(self) <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } else { @@ -2289,8 +2289,8 @@ initarray(void) { PyObject *m; - Arraytype.ob_type = &PyType_Type; - PyArrayIter_Type.ob_type = &PyType_Type; + Py_TYPE(&Arraytype) = &PyType_Type; + Py_TYPE(&PyArrayIter_Type) = &PyType_Type; m = Py_InitModule3("array", a_methods, module_doc); if (m == NULL) return; diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 45736376d14..34b8ed41b8d 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -3039,8 +3039,7 @@ static char tzinfo_doc[] = PyDoc_STR("Abstract base class for time zone info objects."); statichere PyTypeObject PyDateTime_TZInfoType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.tzinfo", /* tp_name */ sizeof(PyDateTime_TZInfo), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -3564,8 +3563,7 @@ static PyNumberMethods time_as_number = { }; statichere PyTypeObject PyDateTime_TimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.time", /* tp_name */ sizeof(PyDateTime_Time), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -4692,8 +4690,7 @@ static PyNumberMethods datetime_as_number = { }; statichere PyTypeObject PyDateTime_DateTimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.datetime", /* tp_name */ sizeof(PyDateTime_DateTime), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c index 65857bf0b39..d2297f306f4 100644 --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -34,7 +34,7 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size, else { Py_ssize_t count, offset; readbufferproc proc = 0; - PyBufferProcs *bp = self->b_base->ob_type->tp_as_buffer; + PyBufferProcs *bp = Py_TYPE(self->b_base)->tp_as_buffer; if ((*bp->bf_getsegcount)(self->b_base, NULL) != 1) { PyErr_SetString(PyExc_TypeError, "single-segment buffer object expected"); @@ -47,7 +47,7 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size, (buffer_type == ANY_BUFFER)) proc = (readbufferproc)bp->bf_getwritebuffer; else if (buffer_type == CHAR_BUFFER) { - if (!PyType_HasFeature(self->ob_type, + if (!PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HAVE_GETCHARBUFFER)) { PyErr_SetString(PyExc_TypeError, "Py_TPFLAGS_HAVE_GETCHARBUFFER needed"); diff --git a/Objects/classobject.c b/Objects/classobject.c index 738e613c836..5b645787cbf 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -88,9 +88,9 @@ PyClass_New(PyObject *bases, PyObject *dict, PyObject *name) base = PyTuple_GET_ITEM(bases, i); if (!PyClass_Check(base)) { if (PyCallable_Check( - (PyObject *) base->ob_type)) + (PyObject *) Py_TYPE(base))) return PyObject_CallFunctionObjArgs( - (PyObject *) base->ob_type, + (PyObject *) Py_TYPE(base), name, bases, dict, NULL); PyErr_SetString(PyExc_TypeError, "PyClass_New: base must be a class"); @@ -265,7 +265,7 @@ class_getattr(register PyClassObject *op, PyObject *name) PyString_AS_STRING(op->cl_name), sname); return NULL; } - f = TP_DESCR_GET(v->ob_type); + f = TP_DESCR_GET(Py_TYPE(v)); if (f == NULL) Py_INCREF(v); else @@ -442,8 +442,7 @@ class_traverse(PyClassObject *o, visitproc visit, void *arg) } PyTypeObject PyClass_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "classobj", sizeof(PyClassObject), 0, @@ -639,9 +638,9 @@ instance_dealloc(register PyInstanceObject *inst) PyObject_ClearWeakRefs((PyObject *) inst); /* Temporarily resurrect the object. */ - assert(inst->ob_type == &PyInstance_Type); - assert(inst->ob_refcnt == 0); - inst->ob_refcnt = 1; + assert(Py_TYPE(inst) == &PyInstance_Type); + assert(Py_REFCNT(inst) == 0); + Py_REFCNT(inst) = 1; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); @@ -665,8 +664,8 @@ instance_dealloc(register PyInstanceObject *inst) /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ - assert(inst->ob_refcnt > 0); - if (--inst->ob_refcnt == 0) { + assert(Py_REFCNT(inst) > 0); + if (--Py_REFCNT(inst) == 0) { /* New weakrefs could be created during the finalizer call. If this occurs, clear them out without calling their @@ -682,12 +681,12 @@ instance_dealloc(register PyInstanceObject *inst) PyObject_GC_Del(inst); } else { - Py_ssize_t refcnt = inst->ob_refcnt; + Py_ssize_t refcnt = Py_REFCNT(inst); /* __del__ resurrected it! Make it look like the original * Py_DECREF never happened. */ _Py_NewReference((PyObject *)inst); - inst->ob_refcnt = refcnt; + Py_REFCNT(inst) = refcnt; _PyObject_GC_TRACK(inst); /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so * we need to undo that. */ @@ -699,8 +698,8 @@ instance_dealloc(register PyInstanceObject *inst) * undone. */ #ifdef COUNT_ALLOCS - --inst->ob_type->tp_frees; - --inst->ob_type->tp_allocs; + --Py_TYPE(inst)->tp_frees; + --Py_TYPE(inst)->tp_allocs; #endif } } @@ -756,7 +755,7 @@ instance_getattr2(register PyInstanceObject *inst, PyObject *name) v = class_lookup(inst->in_class, name, &klass); if (v != NULL) { Py_INCREF(v); - f = TP_DESCR_GET(v->ob_type); + f = TP_DESCR_GET(Py_TYPE(v)); if (f != NULL) { PyObject *w = f(v, (PyObject *)inst, (PyObject *)(inst->in_class)); @@ -1012,7 +1011,7 @@ instance_hash(PyInstanceObject *inst) return -1; if (PyInt_Check(res) || PyLong_Check(res)) /* This already converts a -1 result to -2. */ - outcome = res->ob_type->tp_hash(res); + outcome = Py_TYPE(res)->tp_hash(res); else { PyErr_SetString(PyExc_TypeError, "__hash__() should return an int"); @@ -1500,7 +1499,7 @@ half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, } v1 = PyTuple_GetItem(coerced, 0); w = PyTuple_GetItem(coerced, 1); - if (v1->ob_type == v->ob_type && PyInstance_Check(v)) { + if (Py_TYPE(v1) == Py_TYPE(v) && PyInstance_Check(v)) { /* prevent recursion if __coerce__ returns self as the first * argument */ result = generic_binary_op(v1, w, opname); @@ -2077,7 +2076,7 @@ instance_getiter(PyInstanceObject *self) PyErr_Format(PyExc_TypeError, "__iter__ returned non-iterator " "of type '%.100s'", - res->ob_type->tp_name); + Py_TYPE(res)->tp_name); Py_DECREF(res); res = NULL; } @@ -2201,8 +2200,7 @@ static PyNumberMethods instance_as_number = { }; PyTypeObject PyInstance_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "instance", sizeof(PyInstanceObject), 0, @@ -2321,7 +2319,7 @@ static PyObject * instancemethod_getattro(PyObject *obj, PyObject *name) { PyMethodObject *im = (PyMethodObject *)obj; - PyTypeObject *tp = obj->ob_type; + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr = NULL; if (PyType_HasFeature(tp, Py_TPFLAGS_HAVE_CLASS)) { @@ -2333,9 +2331,9 @@ instancemethod_getattro(PyObject *obj, PyObject *name) } if (descr != NULL) { - descrgetfunc f = TP_DESCR_GET(descr->ob_type); + descrgetfunc f = TP_DESCR_GET(Py_TYPE(descr)); if (f != NULL) - return f(descr, obj, (PyObject *)obj->ob_type); + return f(descr, obj, (PyObject *)Py_TYPE(obj)); else { Py_INCREF(descr); return descr; @@ -2538,7 +2536,7 @@ getinstclassname(PyObject *inst, char *buf, int bufsize) if (klass == NULL) { /* This function cannot return an exception */ PyErr_Clear(); - klass = (PyObject *)(inst->ob_type); + klass = (PyObject *)Py_TYPE(inst); Py_INCREF(klass); } getclassname(klass, buf, bufsize); @@ -2631,8 +2629,7 @@ instancemethod_descr_get(PyObject *meth, PyObject *obj, PyObject *cls) } PyTypeObject PyMethod_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "instancemethod", sizeof(PyMethodObject), 0, diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 1929777197f..224d1ba08af 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -368,8 +368,7 @@ static PyGetSetDef BaseException_getset[] = { static PyTypeObject _PyExc_BaseException = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) EXC_MODULE_NAME "BaseException", /*tp_name*/ sizeof(PyBaseExceptionObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -419,8 +418,7 @@ PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException; */ #define SimpleExtendsException(EXCBASE, EXCNAME, EXCDOC) \ static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ + PyVarObject_HEAD_INIT(NULL, 0) \ EXC_MODULE_NAME # EXCNAME, \ sizeof(PyBaseExceptionObject), \ 0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \ @@ -435,8 +433,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME #define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \ static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ + PyVarObject_HEAD_INIT(NULL, 0) \ EXC_MODULE_NAME # EXCNAME, \ sizeof(Py ## EXCSTORE ## Object), \ 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ @@ -451,8 +448,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME #define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDEALLOC, EXCMETHODS, EXCMEMBERS, EXCSTR, EXCDOC) \ static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ + PyVarObject_HEAD_INIT(NULL, 0) \ EXC_MODULE_NAME # EXCNAME, \ sizeof(Py ## EXCSTORE ## Object), 0, \ (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ @@ -1679,8 +1675,7 @@ UnicodeEncodeError_str(PyObject *self) } static PyTypeObject _PyExc_UnicodeEncodeError = { - PyObject_HEAD_INIT(NULL) - 0, + PyVarObject_HEAD_INIT(NULL, 0) EXC_MODULE_NAME "UnicodeEncodeError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1764,8 +1759,7 @@ UnicodeDecodeError_str(PyObject *self) } static PyTypeObject _PyExc_UnicodeDecodeError = { - PyObject_HEAD_INIT(NULL) - 0, + PyVarObject_HEAD_INIT(NULL, 0) EXC_MODULE_NAME "UnicodeDecodeError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1862,8 +1856,7 @@ UnicodeTranslateError_str(PyObject *self) } static PyTypeObject _PyExc_UnicodeTranslateError = { - PyObject_HEAD_INIT(NULL) - 0, + PyVarObject_HEAD_INIT(NULL, 0) EXC_MODULE_NAME "UnicodeTranslateError", sizeof(PyUnicodeErrorObject), 0, (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/Objects/fileobject.c b/Objects/fileobject.c index a7d64ba16d4..7e07a5376f8 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -427,7 +427,7 @@ close_the_file(PyFileObject *f) if (local_fp != NULL) { local_close = f->f_close; if (local_close != NULL && f->unlocked_count > 0) { - if (f->ob_refcnt > 0) { + if (Py_REFCNT(f) > 0) { PyErr_SetString(PyExc_IOError, "close() called during concurrent " "operation on the same file object."); diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 801f286e6a4..360ef94d2f7 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -65,7 +65,7 @@ PyFloat_GetMin(void) return DBL_MIN; } -static PyTypeObject FloatInfoType = {0, 0, 0, 0, 0, 0}; +static PyTypeObject FloatInfoType; PyDoc_STRVAR(floatinfo__doc__, "sys.float_info\n\ diff --git a/Objects/intobject.c b/Objects/intobject.c index 04e4d299169..3ab00af1e28 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -1486,7 +1486,7 @@ PyInt_ClearFreeList(void) for (i = 0, p = &list->objects[0]; i < N_INTOBJECTS; i++, p++) { - if (PyInt_CheckExact(p) && p->ob_refcnt != 0) + if (PyInt_CheckExact(p) && Py_REFCNT(p) != 0) u++; } next = list->next; @@ -1497,7 +1497,7 @@ PyInt_ClearFreeList(void) i < N_INTOBJECTS; i++, p++) { if (!PyInt_CheckExact(p) || - p->ob_refcnt == 0) { + Py_REFCNT(p) == 0) { Py_TYPE(p) = (struct _typeobject *) free_list; free_list = p; @@ -1560,14 +1560,14 @@ PyInt_Fini(void) for (i = 0, p = &list->objects[0]; i < N_INTOBJECTS; i++, p++) { - if (PyInt_CheckExact(p) && p->ob_refcnt != 0) + if (PyInt_CheckExact(p) && Py_REFCNT(p) != 0) /* XXX(twouters) cast refcount to long until %zd is universally available */ fprintf(stderr, "# \n", - p, (long)p->ob_refcnt, + p, (long)Py_REFCNT(p), p->ob_ival); } list = list->next; diff --git a/Objects/longobject.c b/Objects/longobject.c index 768a92a9414..5d6ce70d537 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -83,12 +83,12 @@ _PyLong_Copy(PyLongObject *src) Py_ssize_t i; assert(src != NULL); - i = src->ob_size; + i = Py_SIZE(src); if (i < 0) i = -(i); result = _PyLong_New(i); if (result != NULL) { - result->ob_size = src->ob_size; + Py_SIZE(result) = Py_SIZE(src); while (--i >= 0) result->ob_digit[i] = src->ob_digit[i]; } @@ -129,7 +129,7 @@ PyLong_FromLong(long ival) v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - v->ob_size = negative ? -ndigits : ndigits; + Py_SIZE(v) = negative ? -ndigits : ndigits; t = abs_ival; while (t) { *p++ = (digit)(t & PyLong_MASK); @@ -372,7 +372,7 @@ PyLong_AsSsize_t(PyObject *vv) { return -1; } v = (PyLongObject *)vv; - i = v->ob_size; + i = Py_SIZE(v); sign = 1; x = 0; if (i < 0) { @@ -464,7 +464,7 @@ PyLong_AsUnsignedLongMask(PyObject *vv) return (unsigned long) -1; } v = (PyLongObject *)vv; - i = v->ob_size; + i = Py_SIZE(v); sign = 1; x = 0; if (i < 0) { @@ -951,7 +951,7 @@ PyLong_AsLongLong(PyObject *vv) PyObject *io; if (PyInt_Check(vv)) return (PY_LONG_LONG)PyInt_AsLong(vv); - if ((nb = vv->ob_type->tp_as_number) == NULL || + if ((nb = Py_TYPE(vv)->tp_as_number) == NULL || nb->nb_int == NULL) { PyErr_SetString(PyExc_TypeError, "an integer is required"); return -1; @@ -1025,7 +1025,7 @@ PyLong_AsUnsignedLongLongMask(PyObject *vv) return (unsigned long) -1; } v = (PyLongObject *)vv; - i = v->ob_size; + i = Py_SIZE(v); sign = 1; x = 0; if (i < 0) { @@ -1068,7 +1068,7 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow) if (!PyLong_Check(vv)) { PyNumberMethods *nb; - nb = vv->ob_type->tp_as_number; + nb = Py_TYPE(vv)->tp_as_number; if (nb == NULL || nb->nb_int == NULL) { PyErr_SetString(PyExc_TypeError, "an integer is required"); @@ -1495,10 +1495,10 @@ _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) *p = '\0'; if (addL) *--p = 'L'; - if (a->ob_size < 0) + if (Py_SIZE(a) < 0) sign = '-'; - if (a->ob_size == 0) { + if (Py_SIZE(a) == 0) { *--p = '0'; } else if ((base & (base - 1)) == 0) { @@ -2063,10 +2063,10 @@ long_divrem(PyLongObject *a, PyLongObject *b, The quotient z has the sign of a*b; the remainder r has the sign of a, so a = b*z + r. */ - if ((a->ob_size < 0) != (b->ob_size < 0)) - z->ob_size = -(z->ob_size); - if (a->ob_size < 0 && (*prem)->ob_size != 0) - (*prem)->ob_size = -((*prem)->ob_size); + if ((Py_SIZE(a) < 0) != (Py_SIZE(b) < 0)) + Py_SIZE(z) = -(Py_SIZE(z)); + if (Py_SIZE(a) < 0 && Py_SIZE(*prem) != 0) + Py_SIZE(*prem) = -Py_SIZE(*prem); *pdiv = z; return 0; } @@ -2398,7 +2398,7 @@ long_hash(PyLongObject *v) /* This is designed so that Python ints and longs with the same value hash to the same value, otherwise comparisons of mapping keys will turn out weird */ - i = v->ob_size; + i = Py_SIZE(v); sign = 1; x = 0; if (i < 0) { @@ -2510,7 +2510,7 @@ x_sub(PyLongObject *a, PyLongObject *b) } assert(borrow == 0); if (sign < 0) - z->ob_size = -(z->ob_size); + Py_SIZE(z) = -(Py_SIZE(z)); return long_normalize(z); } @@ -2521,17 +2521,17 @@ long_add(PyLongObject *v, PyLongObject *w) CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); - if (a->ob_size < 0) { - if (b->ob_size < 0) { + if (Py_SIZE(a) < 0) { + if (Py_SIZE(b) < 0) { z = x_add(a, b); - if (z != NULL && z->ob_size != 0) - z->ob_size = -(z->ob_size); + if (z != NULL && Py_SIZE(z) != 0) + Py_SIZE(z) = -(Py_SIZE(z)); } else z = x_sub(b, a); } else { - if (b->ob_size < 0) + if (Py_SIZE(b) < 0) z = x_sub(a, b); else z = x_add(a, b); @@ -2548,16 +2548,16 @@ long_sub(PyLongObject *v, PyLongObject *w) CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); - if (a->ob_size < 0) { - if (b->ob_size < 0) + if (Py_SIZE(a) < 0) { + if (Py_SIZE(b) < 0) z = x_sub(a, b); else z = x_add(a, b); - if (z != NULL && z->ob_size != 0) - z->ob_size = -(z->ob_size); + if (z != NULL && Py_SIZE(z) != 0) + Py_SIZE(z) = -(Py_SIZE(z)); } else { - if (b->ob_size < 0) + if (Py_SIZE(b) < 0) z = x_add(a, b); else z = x_sub(a, b); @@ -2742,7 +2742,7 @@ k_mul(PyLongObject *a, PyLongObject *b) /* If a is small compared to b, splitting on b gives a degenerate * case with ah==0, and Karatsuba may be (even much) less efficient * than "grade school" then. However, we can still win, by viewing - * b as a string of "big digits", each of width a->ob_size. That + * b as a string of "big digits", each of width Py_SIZE(a). That * leads to a sequence of balanced calls to k_mul. */ if (2 * asize <= bsize) @@ -2910,7 +2910,7 @@ ah*bh and al*bl too. /* b has at least twice the digits of a, and a is big enough that Karatsuba * would pay off *if* the inputs had balanced sizes. View b as a sequence - * of slices, each with a->ob_size digits, and multiply the slices by a, + * of slices, each with Py_SIZE(a) digits, and multiply the slices by a, * one at a time. This gives k_mul balanced inputs to work with, and is * also cache-friendly (we compute one double-width slice of the result * at a time, then move on, never backtracking except for the helpful @@ -2982,8 +2982,8 @@ long_mul(PyLongObject *v, PyLongObject *w) z = k_mul(a, b); /* Negate if exactly one of the inputs is negative. */ - if (((a->ob_size ^ b->ob_size) < 0) && z) - z->ob_size = -(z->ob_size); + if (((Py_SIZE(a) ^ Py_SIZE(b)) < 0) && z) + Py_SIZE(z) = -(Py_SIZE(z)); Py_DECREF(a); Py_DECREF(b); return (PyObject *)z; @@ -3464,7 +3464,7 @@ long_pow(PyObject *v, PyObject *w, PyObject *x) Py_DECREF(c); c = temp; temp = NULL; - c->ob_size = - c->ob_size; + Py_SIZE(c) = - Py_SIZE(c); } /* if modulus == 1: @@ -3608,21 +3608,21 @@ static PyObject * long_neg(PyLongObject *v) { PyLongObject *z; - if (v->ob_size == 0 && PyLong_CheckExact(v)) { + if (Py_SIZE(v) == 0 && PyLong_CheckExact(v)) { /* -0 == 0 */ Py_INCREF(v); return (PyObject *) v; } z = (PyLongObject *)_PyLong_Copy(v); if (z != NULL) - z->ob_size = -(v->ob_size); + Py_SIZE(z) = -(Py_SIZE(v)); return (PyObject *)z; } static PyObject * long_abs(PyLongObject *v) { - if (v->ob_size < 0) + if (Py_SIZE(v) < 0) return long_neg(v); else return long_long((PyObject *)v); @@ -3725,15 +3725,15 @@ long_lshift(PyObject *v, PyObject *w) wordshift = shiftby / PyLong_SHIFT; remshift = shiftby - wordshift * PyLong_SHIFT; - oldsize = ABS(a->ob_size); + oldsize = ABS(Py_SIZE(a)); newsize = oldsize + wordshift; if (remshift) ++newsize; z = _PyLong_New(newsize); if (z == NULL) goto out; - if (a->ob_size < 0) - z->ob_size = -(z->ob_size); + if (Py_SIZE(a) < 0) + Py_SIZE(z) = -(Py_SIZE(z)); for (i = 0; i < wordshift; i++) z->ob_digit[i] = 0; accum = 0; @@ -4142,7 +4142,7 @@ long_sizeof(PyLongObject *v) { Py_ssize_t res; - res = v->ob_type->tp_basicsize + ABS(Py_SIZE(v))*sizeof(digit); + res = Py_TYPE(v)->tp_basicsize + ABS(Py_SIZE(v))*sizeof(digit); return PyInt_FromSsize_t(res); } @@ -4314,8 +4314,7 @@ static PyNumberMethods long_as_number = { }; PyTypeObject PyLong_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(&PyType_Type, 0) "long", /* tp_name */ offsetof(PyLongObject, ob_digit), /* tp_basicsize */ sizeof(digit), /* tp_itemsize */ diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index baa8deebe89..888069a433a 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -183,8 +183,7 @@ static PyMethodDef range_methods[] = { }; PyTypeObject PyRange_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* Number of items for varobject */ + PyVarObject_HEAD_INIT(&PyType_Type, 0) "xrange", /* Name of this type */ sizeof(rangeobject), /* Basic object size */ 0, /* Item size for varobject */ @@ -256,8 +255,7 @@ static PyMethodDef rangeiter_methods[] = { }; static PyTypeObject Pyrangeiter_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(&PyType_Type, 0) "rangeiterator", /* tp_name */ sizeof(rangeiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Objects/setobject.c b/Objects/setobject.c index 0c69fac8e6d..154be43564d 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -583,13 +583,13 @@ set_tp_print(PySetObject *so, FILE *fp, int flags) if (status < 0) return status; Py_BEGIN_ALLOW_THREADS - fprintf(fp, "%s(...)", so->ob_type->tp_name); + fprintf(fp, "%s(...)", Py_TYPE(so)->tp_name); Py_END_ALLOW_THREADS return 0; } Py_BEGIN_ALLOW_THREADS - fprintf(fp, "%s([", so->ob_type->tp_name); + fprintf(fp, "%s([", Py_TYPE(so)->tp_name); Py_END_ALLOW_THREADS while (set_next(so, &pos, &entry)) { Py_BEGIN_ALLOW_THREADS @@ -617,7 +617,7 @@ set_repr(PySetObject *so) if (status != 0) { if (status < 0) return NULL; - return PyString_FromFormat("%s(...)", so->ob_type->tp_name); + return PyString_FromFormat("%s(...)", Py_TYPE(so)->tp_name); } keys = PySequence_List((PyObject *)so); @@ -628,7 +628,7 @@ set_repr(PySetObject *so) if (listrepr == NULL) goto done; - result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, + result = PyString_FromFormat("%s(%s)", Py_TYPE(so)->tp_name, PyString_AS_STRING(listrepr)); Py_DECREF(listrepr); done: diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index 2eb4fe0b17f..344e6f24fc5 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -196,7 +196,7 @@ weakref_repr(PyWeakReference *self) static PyObject * weakref_richcompare(PyWeakReference* self, PyWeakReference* other, int op) { - if ((op != Py_EQ && op != Py_NE) || self->ob_type != other->ob_type) { + if ((op != Py_EQ && op != Py_NE) || Py_TYPE(self) != Py_TYPE(other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } @@ -914,7 +914,7 @@ PyObject_ClearWeakRefs(PyObject *object) if (object == NULL || !PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)) - || object->ob_refcnt != 0) { + || Py_REFCNT(object) != 0) { PyErr_BadInternalCall(); return; } @@ -937,7 +937,7 @@ PyObject_ClearWeakRefs(PyObject *object) current->wr_callback = NULL; clear_weakref(current); if (callback != NULL) { - if (current->ob_refcnt > 0) + if (Py_REFCNT(current) > 0) handle_callback(current, callback); Py_DECREF(callback); } @@ -955,7 +955,7 @@ PyObject_ClearWeakRefs(PyObject *object) for (i = 0; i < count; ++i) { PyWeakReference *next = current->wr_next; - if (current->ob_refcnt > 0) + if (Py_REFCNT(current) > 0) { Py_INCREF(current); PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); From webhook-mailer at python.org Thu Sep 14 02:24:38 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 14 Sep 2017 06:24:38 -0000 Subject: [Python-checkins] Improve code examples in hashlib cookie signing (GH-3562) Message-ID: https://github.com/python/cpython/commit/312ffead1eb272535e021e248b5d74ab04b2e72e commit: 312ffead1eb272535e021e248b5d74ab04b2e72e branch: master author: sww committer: Mariatta date: 2017-09-13T23:24:36-07:00 summary: Improve code examples in hashlib cookie signing (GH-3562) The `blake2b` function does not take the `data` keyword argument. The hex digest returned by sign was a string, whereas compare_digest expects bytes-like objects. Typo fix: compare_digesty -> compare_digest files: M Doc/library/hashlib.rst diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 9d563566d49..725dce6fa15 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -506,8 +506,9 @@ to users and later verify them to make sure they weren't tampered with:: >>> AUTH_SIZE = 16 >>> >>> def sign(cookie): - ... h = blake2b(data=cookie, digest_size=AUTH_SIZE, key=SECRET_KEY) - ... return h.hexdigest() + ... h = blake2b(digest_size=AUTH_SIZE, key=SECRET_KEY) + ... h.update(cookie) + ... return h.hexdigest().encode('utf-8') >>> >>> cookie = b'user:vatrogasac' >>> sig = sign(cookie) @@ -517,7 +518,7 @@ to users and later verify them to make sure they weren't tampered with:: True >>> compare_digest(b'user:policajac', sig) False - >>> compare_digesty(cookie, '0102030405060708090a0b0c0d0e0f00') + >>> compare_digest(cookie, b'0102030405060708090a0b0c0d0e0f00') False Even though there's a native keyed hashing mode, BLAKE2 can, of course, be used From webhook-mailer at python.org Thu Sep 14 02:38:39 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 06:38:39 -0000 Subject: [Python-checkins] bpo-31462: Remove trailing whitespaces. (#3564) Message-ID: https://github.com/python/cpython/commit/13ad3b7a82bf56d803fbe48ee5df6c4b08986c78 commit: 13ad3b7a82bf56d803fbe48ee5df6c4b08986c78 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-14T09:38:36+03:00 summary: bpo-31462: Remove trailing whitespaces. (#3564) files: M Include/pyatomic.h M Lib/http/server.py M Lib/idlelib/ChangeLog M Lib/idlelib/README.txt M Lib/idlelib/idle_test/README.txt M Lib/test/dtracedata/call_stack.d M Lib/test/test_inspect.py M Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt M Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt M Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt M Lib/test/tokenize_tests.txt M Lib/venv/scripts/posix/activate.fish M Modules/expat/pyexpatns.h M Modules/socketmodule.h M Objects/cellobject.c M Objects/setobject.c M PC/_testconsole.c M PC/msvcrtmodule.c M Programs/_testembed.c M Tools/freeze/test/Makefile M aclocal.m4 diff --git a/Include/pyatomic.h b/Include/pyatomic.h index bd516b8bb6c..9a497a68368 100644 --- a/Include/pyatomic.h +++ b/Include/pyatomic.h @@ -11,7 +11,7 @@ #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) #include #include #endif @@ -223,7 +223,7 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order) result; \ }) -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) /* _Interlocked* functions provide a full memory barrier and are therefore enough for acq_rel and seq_cst. If the HLE variants aren't available in hardware they will fall back to a full memory barrier as well. @@ -249,7 +249,7 @@ typedef struct _Py_atomic_int { } _Py_atomic_int; -#if defined(_M_X64) +#if defined(_M_X64) #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ @@ -312,7 +312,7 @@ inline intptr_t _Py_atomic_load_64bit(volatile uintptr_t* value, int order) { break; } } - return old; + return old; } #else @@ -347,7 +347,7 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) { break; } } - return old; + return old; } #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ @@ -379,7 +379,7 @@ typedef struct _Py_atomic_int { } _Py_atomic_int; -#if defined(_M_ARM64) +#if defined(_M_ARM64) #define _Py_atomic_store_64bit(ATOMIC_VAL, NEW_VAL, ORDER) \ switch (ORDER) { \ case _Py_memory_order_acquire: \ @@ -442,7 +442,7 @@ inline intptr_t _Py_atomic_load_64bit(volatile uintptr_t* value, int order) { break; } } - return old; + return old; } #else @@ -477,13 +477,13 @@ inline int _Py_atomic_load_32bit(volatile int* value, int order) { break; } } - return old; + return old; } #define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \ if (sizeof(*ATOMIC_VAL._value) == 8) { \ _Py_atomic_store_64bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } else { \ - _Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } + _Py_atomic_store_32bit(ATOMIC_VAL._value, NEW_VAL, ORDER) } #define _Py_atomic_load_explicit(ATOMIC_VAL, ORDER) \ ( \ diff --git a/Lib/http/server.py b/Lib/http/server.py index b1151a2b654..502bce0c7a4 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -717,7 +717,7 @@ def send_head(self): fs.st_mtime, datetime.timezone.utc) # remove microseconds, like in If-Modified-Since last_modif = last_modif.replace(microsecond=0) - + if last_modif <= ims: self.send_response(HTTPStatus.NOT_MODIFIED) self.end_headers() @@ -727,7 +727,7 @@ def send_head(self): self.send_response(HTTPStatus.OK) self.send_header("Content-type", ctype) self.send_header("Content-Length", str(fs[6])) - self.send_header("Last-Modified", + self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) self.end_headers() return f diff --git a/Lib/idlelib/ChangeLog b/Lib/idlelib/ChangeLog index 0c36664512b..d7d7e1efdb1 100644 --- a/Lib/idlelib/ChangeLog +++ b/Lib/idlelib/ChangeLog @@ -27,9 +27,9 @@ IDLEfork ChangeLog * INSTALLATION, setup.py: INSTALLATION: Remove the coexist.patch instructions - + **************** setup.py: - + Remove the idles script, add some words on IDLE Fork to the long_description, and clean up some line spacing. @@ -42,30 +42,30 @@ IDLEfork ChangeLog * PyShell.py, idle, idles: Implement idle command interface as suggested by GvR [idle-dev] 16 July **************** PyShell: Added functionality: - + usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ... - + idle file(s) (without options) edit the file(s) - + -c cmd run the command in a shell -d enable the debugger -i open an interactive shell -i file(s) open a shell and also an editor window for each file -r script run a file as a script in a shell -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window - + Remaining arguments are applied to the command (-c) or script (-r). - + ****************** idles: Removed the idles script, not needed - + ****************** idle: Removed the IdleConf references, not required anymore 2001-07-16 17:08 kbk * INSTALLATION, coexist.patch: Added installation instructions. - + Added a patch which modifies idlefork so that it can co-exist with "official" IDLE in the site-packages directory. This patch is not necessary if only idlefork IDLE is installed. See INSTALLATION for @@ -74,7 +74,7 @@ IDLEfork ChangeLog 2001-07-16 15:50 kbk * idles: Add a script "idles" which opens a Python Shell window. - + The default behaviour of idlefork idle is to open an editor window instead of a shell. Complex expressions may be run in a fresh environment by selecting "run". There are times, however, when a @@ -90,7 +90,7 @@ IDLEfork ChangeLog * PyShell.py, setup.py: Add a script "idles" which opens a Python Shell window. - + The default behaviour of idlefork idle is to open an editor window instead of a shell. Complex expressions may be run in a fresh environment by selecting "run". There are times, however, when a @@ -110,13 +110,13 @@ IDLEfork ChangeLog * setup.py: Installing Idle to site-packages via Distutils does not copy the Idle help.txt file. - + Ref SF Python Patch 422471 2001-07-14 15:26 kbk * keydefs.py: py-cvs-2001_07_13 (Rev 1.3) merge - + "Make copy, cut and paste events case insensitive. Reported by Patrick K. O'Brien on idle-dev. (Should other bindings follow suit?)" --GvR @@ -124,7 +124,7 @@ IDLEfork ChangeLog 2001-07-14 15:21 kbk * idle.py: py-cvs-2001_07_13 (Rev 1.4) merge - + "Move the action of loading the configuration to the IdleConf module rather than the idle.py script. This has advantages and disadvantages; the biggest advantage being that we can more easily @@ -133,21 +133,21 @@ IDLEfork ChangeLog 2001-07-14 15:18 kbk * extend.txt: py-cvs-2001_07_13 (Rev 1.4) merge - + "Quick update to the extension mechanism (extend.py is gone, long live config.txt)" --GvR 2001-07-14 15:15 kbk * StackViewer.py: py-cvs-2001_07_13 (Rev 1.16) merge - + "Refactored, with some future plans in mind. This now uses the new gotofileline() method defined in FileList.py" --GvR 2001-07-14 15:10 kbk * PyShell.py: py-cvs-2001_07_13 (Rev 1.34) merge - + "Amazing. A very subtle change in policy in descr-branch actually found a bug here. Here's the deal: Class PyShell derives from class OutputWindow. Method PyShell.close() wants to invoke its @@ -166,19 +166,19 @@ IDLEfork ChangeLog 2001-07-14 14:59 kbk * PyParse.py: py-cvs-2001_07_13 (Rel 1.9) merge - + "Taught IDLE's autoident parser that "yield" is a keyword that begins a stmt. Along w/ the preceding change to keyword.py, making all this work w/ a future-stmt just looks harder and harder." --tim_one - + (From Rel 1.8: "Hack to make this still work with Python 1.5.2. ;-( " --fdrake) 2001-07-14 14:51 kbk * IdleConf.py: py-cvs-2001_07_13 (Rel 1.7) merge - + "Move the action of loading the configuration to the IdleConf module rather than the idle.py script. This has advantages and disadvantages; the biggest advantage being that we can more easily @@ -187,11 +187,11 @@ IDLEfork ChangeLog 2001-07-14 14:45 kbk * FileList.py: py-cvs-2000_07_13 (Rev 1.9) merge - + "Delete goodname() method, which is unused. Add gotofileline(), a convenience method which I intend to use in a variant. Rename test() to _test()." --GvR - + This was an interesting merge. The join completely missed removing goodname(), which was adjacent, but outside of, a small conflict. I only caught it by comparing the 1.1.3.2/1.1.3.3 diff. CVS ain't @@ -245,13 +245,13 @@ IDLEfork ChangeLog 2001-07-14 10:13 kbk * PyShell.py: cvs-py-rel2_1 (Rev 1.29 - 1.33) merge - + Merged the following py-cvs revs without conflict: 1.29 Reduce copyright text output at startup 1.30 Delay setting sys.args until Tkinter is fully initialized 1.31 Whitespace normalization 1.32 Turn syntax warning into error when interactive 1.33 Fix warning initialization bug - + Note that module is extensively modified wrt py-cvs 2001-07-14 06:33 kbk @@ -317,14 +317,14 @@ IDLEfork ChangeLog 2001-07-13 13:35 kbk * EditorWindow.py: py-cvs-rel2_1 (Rev 1.33 - 1.37) merge - + VP IDLE version depended on VP's ExecBinding.py and spawn.py to get the path to the Windows Doc directory (relative to python.exe). Removed this conflicting code in favor of py-cvs updates which on Windows use a hard coded path relative to the location of this module. py-cvs updates include support for webbrowser.py. Module still has BrowserControl.py for 1.5.2 support. - + At this point, the differences wrt py-cvs relate to menu functionality. @@ -1194,7 +1194,7 @@ Wed Mar 10 05:18:02 1999 Guido van Rossum ====================================================================== Python release 1.5.2b2, IDLE version 0.3 ====================================================================== - + Wed Feb 17 22:47:41 1999 Guido van Rossum * NEWS.txt: News in 0.3. @@ -1330,7 +1330,7 @@ Sat Jan 9 22:01:33 1999 Guido van Rossum ====================================================================== Python release 1.5.2b1, IDLE version 0.2 ====================================================================== - + Fri Jan 8 17:26:02 1999 Guido van Rossum * README.txt, NEWS.txt: What's new in this release. diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 51e8ef5888c..c784a1a0b61 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -206,7 +206,7 @@ Window # windows Help - About IDLE # eEW.about_dialog, help_about.AboutDialog + About IDLE # eEW.about_dialog, help_about.AboutDialog --- IDLE Help # eEW.help_dialog, helpshow_idlehelp Python Doc # eEW.python_docs @@ -230,7 +230,7 @@ Help Center Insert # eEW.center_insert_event - + CODE STYLE -- Generally PEP 8. import diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt index a54e74ddda2..c580fb9e793 100644 --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -164,7 +164,7 @@ python -m idlelib.idle_test.htest 5. Test Coverage Install the coverage package into your Python 3.6 site-packages -directory. (Its exact location depends on the OS). +directory. (Its exact location depends on the OS). > python3 -m pip install coverage (On Windows, replace 'python3 with 'py -3.6' or perhaps just 'python'.) diff --git a/Lib/test/dtracedata/call_stack.d b/Lib/test/dtracedata/call_stack.d index 450e939d4f1..761d30fd559 100644 --- a/Lib/test/dtracedata/call_stack.d +++ b/Lib/test/dtracedata/call_stack.d @@ -10,7 +10,7 @@ python$target:::function-entry /self->trace/ { printf("%d\t%*s:", timestamp, 15, probename); - printf("%*s", self->indent, ""); + printf("%*s", self->indent, ""); printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2); self->indent++; } @@ -20,7 +20,7 @@ python$target:::function-return { self->indent--; printf("%d\t%*s:", timestamp, 15, probename); - printf("%*s", self->indent, ""); + printf("%*s", self->indent, ""); printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2); } diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 350d5dbd776..7cc1e78f787 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -2018,7 +2018,7 @@ def test_staticmethod(*args): # NOQA ((('args', ..., ..., 'var_positional'),), ...)) self.assertEqual(self.signature(A.f3), ((('args', ..., ..., 'var_positional'),), ...)) - self.assertEqual(self.signature(A.f4), + self.assertEqual(self.signature(A.f4), ((('args', ..., ..., 'var_positional'), ('kwargs', ..., ..., 'var_keyword')), ...)) @cpython_only diff --git a/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt b/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt index dc7c5f060a5..1b5335b64ed 100644 --- a/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt +++ b/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt @@ -1,5 +1,5 @@ ?# -*- coding: latin1 -*- -# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' +# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # at the start of it. Make sure this is preserved if any changes # are made! Also note that the coding cookie above conflicts with # the presence of a utf-8 BOM signature -- this is intended. diff --git a/Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt b/Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt index 81931c46985..23fd2168ae5 100644 --- a/Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt +++ b/Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt @@ -1,4 +1,4 @@ -?# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' +?# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # at the start of it. Make sure this is preserved if any changes # are made! diff --git a/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt b/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt index 74568a7ecb5..4b20ff6ad6d 100644 --- a/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt +++ b/Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt @@ -1,5 +1,5 @@ ?# -*- coding: utf-8 -*- -# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' +# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # at the start of it. Make sure this is preserved if any changes # are made! diff --git a/Lib/test/tokenize_tests.txt b/Lib/test/tokenize_tests.txt index 2c5fb105765..c4f5a58a946 100644 --- a/Lib/test/tokenize_tests.txt +++ b/Lib/test/tokenize_tests.txt @@ -1,5 +1,5 @@ # Tests for the 'tokenize' module. -# Large bits stolen from test_grammar.py. +# Large bits stolen from test_grammar.py. # Comments "#" diff --git a/Lib/venv/scripts/posix/activate.fish b/Lib/venv/scripts/posix/activate.fish index 4d4f0bd7a4f..b40105825ea 100644 --- a/Lib/venv/scripts/posix/activate.fish +++ b/Lib/venv/scripts/posix/activate.fish @@ -52,7 +52,7 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" set -l old_status $status # Prompt override? - if test -n "__VENV_PROMPT__" + if test -n "__VENV_PROMPT__" printf "%s%s" "__VENV_PROMPT__" (set_color normal) else # ...Otherwise, prepend env diff --git a/Modules/expat/pyexpatns.h b/Modules/expat/pyexpatns.h index 999c5c730ab..cfb742ee000 100644 --- a/Modules/expat/pyexpatns.h +++ b/Modules/expat/pyexpatns.h @@ -26,7 +26,7 @@ * http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115 * * The list of relevant exported symbols can be had with this command: - * + * nm pyexpat.so \ | grep -v " [a-zBUA] " \ | grep -v "_fini\|_init\|initpyexpat" diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 03dbf18f7bd..e0d50dffefa 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -199,7 +199,7 @@ typedef union sock_addr { #ifdef HAVE_SOCKADDR_ALG struct sockaddr_alg alg; #endif -#ifdef AF_VSOCK +#ifdef AF_VSOCK struct sockaddr_vm vm; #endif } sock_addr_t; diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 3f6389feaee..8f16f07d7b3 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -151,7 +151,7 @@ cell_set_contents(PyCellObject *op, PyObject *obj) } static PyGetSetDef cell_getsetlist[] = { - {"cell_contents", (getter)cell_get_contents, + {"cell_contents", (getter)cell_get_contents, (setter)cell_set_contents, NULL}, {NULL} /* sentinel */ }; diff --git a/Objects/setobject.c b/Objects/setobject.c index 8772e58f0a0..cd5d2dd83c0 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -23,7 +23,7 @@ Unlike the dictionary implementation, the lookkey function can return NULL if the rich comparison returns an error. - + Use cases for sets differ considerably from dictionaries where looked-up keys are more likely to be present. In contrast, sets are primarily about membership testing where the presence of an element is not known in diff --git a/PC/_testconsole.c b/PC/_testconsole.c index 1c93679e435..23d1286ed4f 100644 --- a/PC/_testconsole.c +++ b/PC/_testconsole.c @@ -46,7 +46,7 @@ _testconsole_write_input_impl(PyObject *module, PyObject *file, /*[clinic end generated code: output=48f9563db34aedb3 input=4c774f2d05770bc6]*/ { INPUT_RECORD *rec = NULL; - + if (!PyWindowsConsoleIO_Check(file)) { PyErr_SetString(PyExc_TypeError, "expected raw console object"); return NULL; @@ -59,7 +59,7 @@ _testconsole_write_input_impl(PyObject *module, PyObject *file, if (!rec) goto error; memset(rec, 0, sizeof(INPUT_RECORD) * size); - + INPUT_RECORD *prec = rec; for (DWORD i = 0; i < size; ++i, ++p, ++prec) { prec->EventType = KEY_EVENT; @@ -80,7 +80,7 @@ _testconsole_write_input_impl(PyObject *module, PyObject *file, } PyMem_Free((void*)rec); - + Py_RETURN_NONE; error: if (rec) diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index 81d2db37903..c4113e54c2b 100644 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -359,7 +359,7 @@ msvcrt_ungetch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/ { int res; - + _Py_BEGIN_SUPPRESS_IPH res = _ungetch(char_value); _Py_END_SUPPRESS_IPH diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 94a3c3d9c8f..e68e68de327 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -127,7 +127,7 @@ static int test_forced_io_encoding(void) /* ********************************************************* * List of test cases and the function that implements it. - * + * * Names are compared case-sensitively with the first * argument. If no match is found, or no first argument was * provided, the names of all test cases are printed and @@ -135,7 +135,7 @@ static int test_forced_io_encoding(void) * * The int returned from test functions is used as the exit * code, and test_capi treats all non-zero exit codes as a - * failed test. + * failed test. *********************************************************/ struct TestCase { diff --git a/Tools/freeze/test/Makefile b/Tools/freeze/test/Makefile index 1679f723e7a..b889e897527 100644 --- a/Tools/freeze/test/Makefile +++ b/Tools/freeze/test/Makefile @@ -8,4 +8,4 @@ test: $(PYTHON) ../freeze.py -o $(OUTDIR) ok.py make -C $(OUTDIR) $(OUTDIR)/ok - + diff --git a/aclocal.m4 b/aclocal.m4 index 2a745e57466..4eb2dc3bbe2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -170,7 +170,7 @@ if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs From webhook-mailer at python.org Thu Sep 14 02:41:41 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 06:41:41 -0000 Subject: [Python-checkins] [3.6] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (GH-3539) (#3556) Message-ID: https://github.com/python/cpython/commit/5dbb28ececdd0382d85b164aaf37bec1ae08036c commit: 5dbb28ececdd0382d85b164aaf37bec1ae08036c branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-14T09:41:39+03:00 summary: [3.6] bpo-31418: Fix an assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__ attribute. (GH-3539) (#3556) (cherry picked from commit f6e61df01536493f1280cd07639c7ff9bffb2cdc) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst M Python/errors.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst new file mode 100644 index 00000000000..6d6cbd81142 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an +exception with a bad ``__module__`` attribute. Patch by Oren Milman. diff --git a/Python/errors.c b/Python/errors.c index 60958438152..2f39f9d473d 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -978,7 +978,7 @@ PyErr_WriteUnraisable(PyObject *obj) } moduleName = _PyObject_GetAttrId(t, &PyId___module__); - if (moduleName == NULL) { + if (moduleName == NULL || !PyUnicode_Check(moduleName)) { PyErr_Clear(); if (PyFile_WriteString("", f) < 0) goto done; From webhook-mailer at python.org Thu Sep 14 02:46:07 2017 From: webhook-mailer at python.org (Eric Snow) Date: Thu, 14 Sep 2017 06:46:07 -0000 Subject: [Python-checkins] bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565) Message-ID: https://github.com/python/cpython/commit/93c92f7d1dbb6e7e472f1d0444c6968858113de2 commit: 93c92f7d1dbb6e7e472f1d0444c6968858113de2 branch: master author: Eric Snow committer: GitHub date: 2017-09-13T23:46:04-07:00 summary: bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565) PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted. files: D Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst M Doc/c-api/import.rst M Doc/whatsnew/3.7.rst M Include/import.h M Include/modsupport.h M Include/object.h M Include/pystate.h M Modules/_pickle.c M Modules/pyexpat.c M Objects/moduleobject.c M Objects/object.c M Objects/typeobject.c M Python/_warnings.c M Python/bltinmodule.c M Python/ceval.c M Python/import.c M Python/importdl.c M Python/pylifecycle.c M Python/pystate.c M Python/pythonrun.c M Python/sysmodule.c diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index 8cdc256e7c9..7c16ece0586 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -204,13 +204,6 @@ Importing Modules Return the dictionary used for the module administration (a.k.a. ``sys.modules``). Note that this is a per-interpreter variable. -.. c:function:: PyObject* PyImport_GetModule(PyObject *name) - - Return the already imported module with the given name. If the - module has not been imported yet then returns NULL but does not set - an error. Returns NULL and sets an error if the lookup failed. - - .. versionadded:: 3.7 .. c:function:: PyObject* PyImport_GetImporter(PyObject *path) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 6ff1bfcb68f..44911ccc354 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -486,9 +486,6 @@ Changes in the Python API and module are affected by this change. (Contributed by INADA Naoki and Eugene Toder in :issue:`29463`.) -* ``PyInterpreterState`` no longer has a ``modules`` field. Instead use - ``sys.modules``. - * The *mode* argument of :func:`os.makedirs` no longer affects the file permission bits of newly-created intermediate-level directories. To set their file permission bits you can set the umask before invoking diff --git a/Include/import.h b/Include/import.h index 5463c0cb960..7e83985b3a4 100644 --- a/Include/import.h +++ b/Include/import.h @@ -38,25 +38,11 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); -#ifndef Py_LIMITED_API -PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); -#endif -PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyImport_GetModule(PyObject *name); -PyAPI_FUNC(PyObject *) _PyImport_GetModuleWithError(PyObject *name); -PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); -PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); -PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); -#endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *); -#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -106,19 +92,14 @@ PyAPI_FUNC(int) _PyImport_ReleaseLock(void); PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( - const char *name, /* UTF-8 encoded string */ - PyObject *modules + const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *, - PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, - const char *name, /* UTF-8 encoded string */ - PyObject *modules + const char *name /* UTF-8 encoded string */ ); -PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, - PyObject *, PyObject *); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ diff --git a/Include/modsupport.h b/Include/modsupport.h index 73d86a94b95..8c7cf39d9a3 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -191,10 +191,6 @@ PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, int apiver); -#ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*, - int apiver); -#endif #ifdef Py_LIMITED_API #define PyModule_Create(module) \ diff --git a/Include/object.h b/Include/object.h index 9bb780e28bc..b46d4c30e1e 100644 --- a/Include/object.h +++ b/Include/object.h @@ -727,13 +727,14 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ -PyAPI_FUNC(PyObject *) _PyDebug_XOptionShowRefCount(void); PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); +#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #define _Py_REF_DEBUG_COMMA #define _Py_CHECK_REFCNT(OP) /* a semicolon */; +#define _PY_DEBUG_PRINT_TOTAL_REFS() #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS diff --git a/Include/pystate.h b/Include/pystate.h index 5b75bb080fe..09061144605 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -53,6 +53,7 @@ typedef struct _is { int64_t id; + PyObject *modules; PyObject *modules_by_index; PyObject *sysdict; PyObject *builtins; @@ -60,6 +61,8 @@ typedef struct _is { /* Used in Python/sysmodule.c. */ int check_interval; + PyObject *warnoptions; + PyObject *xoptions; /* Used in Modules/_threadmodule.c. */ long num_threads; diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst deleted file mode 100644 index 2417f781276..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-10-46-09.bpo-28411.IU9rQL.rst +++ /dev/null @@ -1,4 +0,0 @@ -``PyInterpreterState`` has a "modules" field that is copied into -``sys.modules`` during interpreter startup. This causes problems if a -program replaces ``sys.modules`` with something else. To solve this we -eliminate ``PyInterpreterState.modules``. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index bcbe4ac7945..3165b4e6d68 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6425,7 +6425,9 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, /*[clinic end generated code: output=becc08d7f9ed41e3 input=e2e6a865de093ef4]*/ { PyObject *global; + PyObject *modules_dict; PyObject *module; + _Py_IDENTIFIER(modules); /* Try to map the old names used in Python 2.x to the new ones used in Python 3.x. We do this only with old pickle protocols and when the @@ -6482,7 +6484,13 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, } } - module = PyImport_GetModule(module_name); + modules_dict = _PySys_GetObjectId(&PyId_modules); + if (modules_dict == NULL) { + PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); + return NULL; + } + + module = PyDict_GetItemWithError(modules_dict, module_name); if (module == NULL) { if (PyErr_Occurred()) return NULL; @@ -6490,11 +6498,11 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, if (module == NULL) return NULL; global = getattribute(module, global_name, self->proto >= 4); + Py_DECREF(module); } else { global = getattribute(module, global_name, self->proto >= 4); } - Py_DECREF(module); return global; } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index c8a01d4e088..d9cfa3e2085 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1643,6 +1643,7 @@ MODULE_INITFUNC(void) PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; + PyObject *sys_modules; PyObject *tmpnum, *tmpstr; PyObject *codes_dict; PyObject *rev_codes_dict; @@ -1692,6 +1693,11 @@ MODULE_INITFUNC(void) */ PyModule_AddStringConstant(m, "native_encoding", "UTF-8"); + sys_modules = PySys_GetObject("modules"); + if (sys_modules == NULL) { + Py_DECREF(m); + return NULL; + } d = PyModule_GetDict(m); if (d == NULL) { Py_DECREF(m); @@ -1701,7 +1707,7 @@ MODULE_INITFUNC(void) if (errors_module == NULL) { errors_module = PyModule_New(MODULE_NAME ".errors"); if (errors_module != NULL) { - _PyImport_SetModule(errmod_name, errors_module); + PyDict_SetItem(sys_modules, errmod_name, errors_module); /* gives away the reference to errors_module */ PyModule_AddObject(m, "errors", errors_module); } @@ -1711,7 +1717,7 @@ MODULE_INITFUNC(void) if (model_module == NULL) { model_module = PyModule_New(MODULE_NAME ".model"); if (model_module != NULL) { - _PyImport_SetModule(modelmod_name, model_module); + PyDict_SetItem(sys_modules, modelmod_name, model_module); /* gives away the reference to model_module */ PyModule_AddObject(m, "model", model_module); } diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 2be49fbda38..5fab06d31df 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -162,17 +162,11 @@ _add_methods_to_object(PyObject *module, PyObject *name, PyMethodDef *functions) PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { - if (!_PyImport_IsInitialized(PyThreadState_GET()->interp)) - Py_FatalError("Python import machinery not initialized"); - return _PyModule_CreateInitialized(module, module_api_version); -} - -PyObject * -_PyModule_CreateInitialized(struct PyModuleDef* module, int module_api_version) -{ const char* name; PyModuleObject *m; - + PyInterpreterState *interp = PyThreadState_Get()->interp; + if (interp->modules == NULL) + Py_FatalError("Python import machinery not initialized"); if (!PyModuleDef_Init(module)) return NULL; name = module->m_name; diff --git a/Objects/object.c b/Objects/object.c index ed8a62a163a..74893e38c71 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -29,23 +29,20 @@ _Py_GetRefTotal(void) return total; } -PyObject * -_PyDebug_XOptionShowRefCount(void) -{ - PyObject *xoptions = PySys_GetXOptions(); - if (xoptions == NULL) - return NULL; - - _Py_IDENTIFIER(showrefcount); - return _PyDict_GetItemId(xoptions, &PyId_showrefcount); -} - void _PyDebug_PrintTotalRefs(void) { - fprintf(stderr, - "[%" PY_FORMAT_SIZE_T "d refs, " - "%" PY_FORMAT_SIZE_T "d blocks]\n", - _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); + PyObject *xoptions, *value; + _Py_IDENTIFIER(showrefcount); + + xoptions = PySys_GetXOptions(); + if (xoptions == NULL) + return; + value = _PyDict_GetItemId(xoptions, &PyId_showrefcount); + if (value == Py_True) + fprintf(stderr, + "[%" PY_FORMAT_SIZE_T "d refs, " + "%" PY_FORMAT_SIZE_T "d blocks]\n", + _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); } #endif /* Py_REF_DEBUG */ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a06cab72e5c..dc4d2edc5cf 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3902,6 +3902,7 @@ import_copyreg(void) { PyObject *copyreg_str; PyObject *copyreg_module; + PyInterpreterState *interp = PyThreadState_GET()->interp; _Py_IDENTIFIER(copyreg); copyreg_str = _PyUnicode_FromId(&PyId_copyreg); @@ -3913,7 +3914,7 @@ import_copyreg(void) by storing a reference to the cached module in a static variable, but this broke when multiple embedded interpreters were in use (see issue #17408 and #19088). */ - copyreg_module = _PyImport_GetModuleWithError(copyreg_str); + copyreg_module = PyDict_GetItemWithError(interp->modules, copyreg_str); if (copyreg_module != NULL) { Py_INCREF(copyreg_module); return copyreg_module; diff --git a/Python/_warnings.c b/Python/_warnings.c index 6dad0806867..ba004859df8 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -38,6 +38,7 @@ static PyObject * get_warnings_attr(const char *attr, int try_import) { static PyObject *warnings_str = NULL; + PyObject *all_modules; PyObject *warnings_module, *obj; if (warnings_str == NULL) { @@ -57,7 +58,9 @@ get_warnings_attr(const char *attr, int try_import) } } else { - warnings_module = _PyImport_GetModule(warnings_str); + all_modules = PyImport_GetModuleDict(); + + warnings_module = PyDict_GetItem(all_modules, warnings_str); if (warnings_module == NULL) return NULL; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index c363cfe8cea..5e1f1d3854f 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2685,7 +2685,7 @@ _PyBuiltin_Init(void) PyType_Ready(&PyZip_Type) < 0) return NULL; - mod = _PyModule_CreateInitialized(&builtinsmodule, PYTHON_API_VERSION); + mod = PyModule_Create(&builtinsmodule); if (mod == NULL) return NULL; dict = PyModule_GetDict(mod); diff --git a/Python/ceval.c b/Python/ceval.c index 5dd7cd9f03e..08533a42bf2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4935,7 +4935,7 @@ import_from(PyObject *v, PyObject *name) Py_DECREF(pkgname); return NULL; } - x = _PyImport_GetModule(fullmodname); + x = PyDict_GetItem(PyImport_GetModuleDict(), fullmodname); Py_DECREF(fullmodname); if (x == NULL) { goto error; diff --git a/Python/import.c b/Python/import.c index 6b2634c3497..2aacf659351 100644 --- a/Python/import.c +++ b/Python/import.c @@ -290,115 +290,10 @@ _PyImport_Fini(void) PyObject * PyImport_GetModuleDict(void) { - PyObject *sysdict = PyThreadState_GET()->interp->sysdict; - if (sysdict == NULL) { - Py_FatalError("PyImport_GetModuleDict: no sys module!"); - } - - _Py_IDENTIFIER(modules); - PyObject *modules = _PyDict_GetItemId(sysdict, &PyId_modules); - if (modules == NULL) { - Py_FatalError("lost sys.modules"); - } - return modules; -} - -/* In some corner cases it is important to be sure that the import - machinery has been initialized (or not cleaned up yet). For - example, see issue #4236 and PyModule_Create2(). */ - -int -_PyImport_IsInitialized(PyInterpreterState *interp) -{ - if (interp->sysdict == NULL) - return 0; - _Py_IDENTIFIER(modules); - PyObject *modules = _PyDict_GetItemId(interp->sysdict, &PyId_modules); - if (modules == NULL) - return 0; - return 1; -} - -PyObject * -_PyImport_GetModule(PyObject *name) -{ - PyObject *modules = PyImport_GetModuleDict(); - if (PyDict_CheckExact(modules)) { - return PyDict_GetItem(modules, name); - } - - PyObject *mod = PyObject_GetItem(modules, name); - // For backward-comaptibility we copy the behavior of PyDict_GetItem(). - if (PyErr_Occurred()) { - PyErr_Clear(); - } - Py_XDECREF(mod); - return mod; -} - -PyObject * -_PyImport_GetModuleWithError(PyObject *name) -{ - PyObject *modules = PyImport_GetModuleDict(); - if (PyDict_CheckExact(modules)) { - return PyDict_GetItemWithError(modules, name); - } - - PyObject *mod = PyObject_GetItem(modules, name); - // For backward-comaptibility we copy the behavior - // of PyDict_GetItemWithError(). - if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - } - return mod; -} - -PyObject * -_PyImport_GetModuleId(struct _Py_Identifier *nameid) -{ - PyObject *name = _PyUnicode_FromId(nameid); /* borrowed */ - if (name == NULL) { - return NULL; - } - return _PyImport_GetModule(name); -} - -int -_PyImport_SetModule(PyObject *name, PyObject *m) -{ - PyObject *modules = PyImport_GetModuleDict(); - return PyObject_SetItem(modules, name, m); -} - -int -_PyImport_SetModuleString(const char *name, PyObject *m) -{ - PyObject *modules = PyImport_GetModuleDict(); - return PyMapping_SetItemString(modules, name, m); -} - -PyObject * -PyImport_GetModule(PyObject *name) -{ - PyObject *m; - PyObject *modules = PyImport_GetModuleDict(); - if (modules == NULL) { - PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); - return NULL; - } - Py_INCREF(modules); - if (PyDict_CheckExact(modules)) { - m = PyDict_GetItemWithError(modules, name); /* borrowed */ - Py_XINCREF(m); - } - else { - m = PyObject_GetItem(modules, name); - if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - } - } - Py_DECREF(modules); - return m; + PyInterpreterState *interp = PyThreadState_GET()->interp; + if (interp->modules == NULL) + Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); + return interp->modules; } @@ -428,7 +323,7 @@ PyImport_Cleanup(void) Py_ssize_t pos; PyObject *key, *value, *dict; PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = PyImport_GetModuleDict(); + PyObject *modules = interp->modules; PyObject *weaklist = NULL; const char * const *p; @@ -490,7 +385,7 @@ PyImport_Cleanup(void) if (Py_VerboseFlag && PyUnicode_Check(key)) PySys_FormatStderr("# cleanup[2] removing %U\n", key); STORE_MODULE_WEAKREF(key, value); - PyObject_SetItem(modules, key, Py_None); + PyDict_SetItem(modules, key, Py_None); } } @@ -557,6 +452,7 @@ PyImport_Cleanup(void) /* Clear and delete the modules directory. Actual modules will still be there only if imported during the execution of some destructor. */ + interp->modules = NULL; Py_DECREF(modules); /* Once more */ @@ -615,9 +511,9 @@ PyImport_GetMagicTag(void) int _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, - PyObject *filename, PyObject *modules) + PyObject *filename) { - PyObject *dict, *key; + PyObject *modules, *dict, *key; struct PyModuleDef *def; int res; if (extensions == NULL) { @@ -634,10 +530,11 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, PyErr_BadInternalCall(); return -1; } - if (PyObject_SetItem(modules, name, mod) < 0) + modules = PyImport_GetModuleDict(); + if (PyDict_SetItem(modules, name, mod) < 0) return -1; if (_PyState_AddModule(mod, def) < 0) { - PyMapping_DelItem(modules, name); + PyDict_DelItem(modules, name); return -1; } if (def->m_size == -1) { @@ -665,14 +562,14 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, } int -_PyImport_FixupBuiltin(PyObject *mod, const char *name, PyObject *modules) +_PyImport_FixupBuiltin(PyObject *mod, const char *name) { int res; PyObject *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return -1; - res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj, modules); + res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj); Py_DECREF(nameobj); return res; } @@ -680,14 +577,6 @@ _PyImport_FixupBuiltin(PyObject *mod, const char *name, PyObject *modules) PyObject * _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) { - PyObject *modules = PyImport_GetModuleDict(); - return _PyImport_FindExtensionObjectEx(name, filename, modules); -} - -PyObject * -_PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, - PyObject *modules) -{ PyObject *mod, *mdict, *key; PyModuleDef* def; if (extensions == NULL) @@ -703,7 +592,7 @@ _PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, /* Module does not support repeated initialization */ if (def->m_base.m_copy == NULL) return NULL; - mod = _PyImport_AddModuleObject(name, modules); + mod = PyImport_AddModuleObject(name); if (mod == NULL) return NULL; mdict = PyModule_GetDict(mod); @@ -718,14 +607,14 @@ _PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, mod = def->m_base.m_init(); if (mod == NULL) return NULL; - if (PyObject_SetItem(modules, name, mod) == -1) { + if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) { Py_DECREF(mod); return NULL; } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) { - PyMapping_DelItem(modules, name); + PyDict_DelItem(PyImport_GetModuleDict(), name); Py_DECREF(mod); return NULL; } @@ -737,13 +626,13 @@ _PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, } PyObject * -_PyImport_FindBuiltin(const char *name, PyObject *modules) +_PyImport_FindBuiltin(const char *name) { PyObject *res, *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return NULL; - res = _PyImport_FindExtensionObjectEx(nameobj, nameobj, modules); + res = _PyImport_FindExtensionObject(nameobj, nameobj); Py_DECREF(nameobj); return res; } @@ -758,34 +647,19 @@ PyObject * PyImport_AddModuleObject(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); - return _PyImport_AddModuleObject(name, modules); -} - -PyObject * -_PyImport_AddModuleObject(PyObject *name, PyObject *modules) -{ PyObject *m; - if (PyDict_CheckExact(modules)) { - m = PyDict_GetItemWithError(modules, name); - } - else { - m = PyObject_GetItem(modules, name); - // For backward-comaptibility we copy the behavior - // of PyDict_GetItemWithError(). - if (PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_Clear(); - } + + if ((m = PyDict_GetItemWithError(modules, name)) != NULL && + PyModule_Check(m)) { + return m; } if (PyErr_Occurred()) { return NULL; } - if (m != NULL && PyModule_Check(m)) { - return m; - } m = PyModule_NewObject(name); if (m == NULL) return NULL; - if (PyObject_SetItem(modules, name, m) != 0) { + if (PyDict_SetItem(modules, name, m) != 0) { Py_DECREF(m); return NULL; } @@ -812,13 +686,11 @@ static void remove_module(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); - if (PyMapping_DelItem(modules, name) < 0) { - if (!PyMapping_HasKey(modules, name)) { - return; - } + if (PyDict_GetItem(modules, name) == NULL) + return; + if (PyDict_DelItem(modules, name) < 0) Py_FatalError("import: deleting existing key in" "sys.modules failed"); - } } @@ -927,6 +799,7 @@ module_dict_for_exec(PyObject *name) static PyObject * exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object) { + PyObject *modules = PyImport_GetModuleDict(); PyObject *v, *m; v = PyEval_EvalCode(code_object, module_dict, module_dict); @@ -936,8 +809,7 @@ exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object } Py_DECREF(v); - m = _PyImport_GetModule(name); - if (m == NULL) { + if ((m = PyDict_GetItem(modules, name)) == NULL) { PyErr_Format(PyExc_ImportError, "Loaded module %R not found in sys.modules", name); @@ -1170,7 +1042,6 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } - PyObject *modules = NULL; for (p = PyImport_Inittab; p->name != NULL; p++) { PyModuleDef *def; if (_PyUnicode_EqualToASCIIString(name, p->name)) { @@ -1196,11 +1067,7 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } def->m_base.m_init = p->initfunc; - if (modules == NULL) { - modules = PyImport_GetModuleDict(); - } - if (_PyImport_FixupExtensionObject(mod, name, name, - modules) < 0) { + if (_PyImport_FixupExtensionObject(mod, name, name) < 0) { Py_DECREF(name); return NULL; } @@ -1644,7 +1511,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, Py_INCREF(abs_name); } - mod = _PyImport_GetModule(abs_name); + mod = PyDict_GetItem(interp->modules, abs_name); if (mod != NULL && mod != Py_None) { _Py_IDENTIFIER(__spec__); _Py_IDENTIFIER(_initializing); @@ -1731,7 +1598,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, goto error; } - final_mod = _PyImport_GetModule(to_return); + final_mod = PyDict_GetItem(interp->modules, to_return); Py_DECREF(to_return); if (final_mod == NULL) { PyErr_Format(PyExc_KeyError, @@ -1784,10 +1651,10 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { - _Py_IDENTIFIER(imp); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *imp = _PyImport_GetModuleId(&PyId_imp); + PyObject *modules = PyImport_GetModuleDict(); + PyObject *imp = PyDict_GetItemString(modules, "imp"); if (imp == NULL) { imp = PyImport_ImportModule("imp"); if (imp == NULL) { @@ -1822,6 +1689,7 @@ PyImport_Import(PyObject *module_name) PyObject *globals = NULL; PyObject *import = NULL; PyObject *builtins = NULL; + PyObject *modules = NULL; PyObject *r = NULL; /* Initialize constant string objects */ @@ -1876,7 +1744,8 @@ PyImport_Import(PyObject *module_name) goto err; Py_DECREF(r); - r = _PyImport_GetModule(module_name); + modules = PyImport_GetModuleDict(); + r = PyDict_GetItemWithError(modules, module_name); if (r != NULL) { Py_INCREF(r); } diff --git a/Python/importdl.c b/Python/importdl.c index 32fb7e1be21..d8656b94333 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -215,8 +215,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp) else Py_INCREF(path); - PyObject *modules = PyImport_GetModuleDict(); - if (_PyImport_FixupExtensionObject(m, name_unicode, path, modules) < 0) + if (_PyImport_FixupExtensionObject(m, name_unicode, path) < 0) goto error; Py_DECREF(name_unicode); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 3265d701810..0700569ac5a 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -42,7 +42,6 @@ _Py_IDENTIFIER(name); _Py_IDENTIFIER(stdin); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); -_Py_IDENTIFIER(threading); #ifdef __cplusplus extern "C" { @@ -284,6 +283,7 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) { PyObject *importlib; PyObject *impmod; + PyObject *sys_modules; PyObject *value; /* Import _importlib through its frozen version, _frozen_importlib. */ @@ -314,7 +314,11 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) else if (Py_VerboseFlag) { PySys_FormatStderr("import _imp # builtin\n"); } - if (_PyImport_SetModuleString("_imp", impmod) < 0) { + sys_modules = PyImport_GetModuleDict(); + if (Py_VerboseFlag) { + PySys_FormatStderr("import sys # builtin\n"); + } + if (PyDict_SetItemString(sys_modules, "_imp", impmod) < 0) { Py_FatalError("Py_Initialize: can't save _imp to sys.modules"); } @@ -671,20 +675,10 @@ void _Py_InitializeCore(const _PyCoreConfig *config) if (!_PyFloat_Init()) Py_FatalError("Py_InitializeCore: can't init float"); - PyObject *modules = PyDict_New(); - if (modules == NULL) + interp->modules = PyDict_New(); + if (interp->modules == NULL) Py_FatalError("Py_InitializeCore: can't make modules dictionary"); - sysmod = _PySys_BeginInit(); - if (sysmod == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys"); - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys dict"); - Py_INCREF(interp->sysdict); - PyDict_SetItemString(interp->sysdict, "modules", modules); - _PyImport_FixupBuiltin(sysmod, "sys", modules); - /* Init Unicode implementation; relies on the codec registry */ if (_PyUnicode_Init() < 0) Py_FatalError("Py_InitializeCore: can't initialize unicode"); @@ -695,7 +689,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) bimod = _PyBuiltin_Init(); if (bimod == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins modules"); - _PyImport_FixupBuiltin(bimod, "builtins", modules); + _PyImport_FixupBuiltin(bimod, "builtins"); interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins dict"); @@ -704,6 +698,17 @@ void _Py_InitializeCore(const _PyCoreConfig *config) /* initialize builtin exceptions */ _PyExc_Init(bimod); + sysmod = _PySys_BeginInit(); + if (sysmod == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys"); + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys dict"); + Py_INCREF(interp->sysdict); + _PyImport_FixupBuiltin(sysmod, "sys"); + PyDict_SetItemString(interp->sysdict, "modules", + interp->modules); + /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1006,11 +1011,6 @@ Py_FinalizeEx(void) while (_PyGC_CollectIfEnabled() > 0) /* nothing */; #endif - -#ifdef Py_REF_DEBUG - PyObject *showrefcount = _PyDebug_XOptionShowRefCount(); -#endif - /* Destroy all modules */ PyImport_Cleanup(); @@ -1058,10 +1058,7 @@ Py_FinalizeEx(void) /* dump hash stats */ _PyHash_Fini(); -#ifdef Py_REF_DEBUG - if (showrefcount == Py_True) - _PyDebug_PrintTotalRefs(); -#endif + _PY_DEBUG_PRINT_TOTAL_REFS(); #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary @@ -1206,22 +1203,9 @@ Py_NewInterpreter(void) /* XXX The following is lax in error checking */ - PyObject *modules = PyDict_New(); - if (modules == NULL) - Py_FatalError("Py_NewInterpreter: can't make modules dictionary"); + interp->modules = PyDict_New(); - sysmod = _PyImport_FindBuiltin("sys", modules); - if (sysmod != NULL) { - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - goto handle_error; - Py_INCREF(interp->sysdict); - PyDict_SetItemString(interp->sysdict, "modules", modules); - PySys_SetPath(Py_GetPath()); - _PySys_EndInit(interp->sysdict); - } - - bimod = _PyImport_FindBuiltin("builtins", modules); + bimod = _PyImport_FindBuiltin("builtins"); if (bimod != NULL) { interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) @@ -1232,9 +1216,18 @@ Py_NewInterpreter(void) /* initialize builtin exceptions */ _PyExc_Init(bimod); + sysmod = _PyImport_FindBuiltin("sys"); if (bimod != NULL && sysmod != NULL) { PyObject *pstderr; + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + goto handle_error; + Py_INCREF(interp->sysdict); + _PySys_EndInit(interp->sysdict); + PySys_SetPath(Py_GetPath()); + PyDict_SetItemString(interp->sysdict, "modules", + interp->modules); /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1910,13 +1903,14 @@ wait_for_thread_shutdown(void) { _Py_IDENTIFIER(_shutdown); PyObject *result; - PyObject *threading = _PyImport_GetModuleId(&PyId_threading); + PyThreadState *tstate = PyThreadState_GET(); + PyObject *threading = PyMapping_GetItemString(tstate->interp->modules, + "threading"); if (threading == NULL) { /* threading not imported */ PyErr_Clear(); return; } - Py_INCREF(threading); result = _PyObject_CallMethodId(threading, &PyId__shutdown, NULL); if (result == NULL) { PyErr_WriteUnraisable(threading); diff --git a/Python/pystate.c b/Python/pystate.c index 08048428610..41adf03662c 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -90,12 +90,15 @@ PyInterpreterState_New(void) PyMem_RawMalloc(sizeof(PyInterpreterState)); if (interp != NULL) { + interp->modules = NULL; interp->modules_by_index = NULL; interp->sysdict = NULL; interp->builtins = NULL; interp->builtins_copy = NULL; interp->tstate_head = NULL; interp->check_interval = 100; + interp->warnoptions = NULL; + interp->xoptions = NULL; interp->num_threads = 0; interp->pythread_stacksize = 0; interp->codec_search_path = NULL; @@ -153,6 +156,7 @@ PyInterpreterState_Clear(PyInterpreterState *interp) Py_CLEAR(interp->codec_search_path); Py_CLEAR(interp->codec_search_cache); Py_CLEAR(interp->codec_error_registry); + Py_CLEAR(interp->modules); Py_CLEAR(interp->modules_by_index); Py_CLEAR(interp->sysdict); Py_CLEAR(interp->builtins); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index df814fbed97..d1d4a69a8dd 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -113,10 +113,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * err = -1; for (;;) { ret = PyRun_InteractiveOneObject(fp, filename, flags); -#ifdef Py_REF_DEBUG - if (_PyDebug_XOptionShowRefCount() == Py_True) - _PyDebug_PrintTotalRefs(); -#endif + _PY_DEBUG_PRINT_TOTAL_REFS(); if (ret == E_EOF) { err = 0; break; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 5bde4b7b702..dd127a1f7ce 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -36,14 +36,12 @@ extern const char *PyWin_DLLVersionString; _Py_IDENTIFIER(_); _Py_IDENTIFIER(__sizeof__); -_Py_IDENTIFIER(_xoptions); _Py_IDENTIFIER(buffer); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(encoding); _Py_IDENTIFIER(path); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); -_Py_IDENTIFIER(warnoptions); _Py_IDENTIFIER(write); PyObject * @@ -162,11 +160,13 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; + PyInterpreterState *interp = PyThreadState_GET()->interp; + PyObject *modules = interp->modules; PyObject *builtins; static PyObject *newline = NULL; int err; - builtins = _PyImport_GetModuleId(&PyId_builtins); + builtins = _PyDict_GetItemId(modules, &PyId_builtins); if (builtins == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); return NULL; @@ -1481,17 +1481,13 @@ list_builtin_module_names(void) static PyObject * get_warnoptions(void) { - PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; if (warnoptions == NULL || !PyList_Check(warnoptions)) { Py_XDECREF(warnoptions); warnoptions = PyList_New(0); if (warnoptions == NULL) return NULL; - if (_PySys_SetObjectId(&PyId_warnoptions, warnoptions)) { - Py_DECREF(warnoptions); - return NULL; - } - Py_DECREF(warnoptions); + PyThreadState_GET()->interp->warnoptions = warnoptions; } return warnoptions; } @@ -1499,7 +1495,7 @@ get_warnoptions(void) void PySys_ResetWarnOptions(void) { - PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1528,24 +1524,20 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { - PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); + PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } static PyObject * get_xoptions(void) { - PyObject *xoptions = _PySys_GetObjectId(&PyId__xoptions); + PyObject *xoptions = PyThreadState_GET()->interp->xoptions; if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); if (xoptions == NULL) return NULL; - if (_PySys_SetObjectId(&PyId__xoptions, xoptions)) { - Py_DECREF(xoptions); - return NULL; - } - Py_DECREF(xoptions); + PyThreadState_GET()->interp->xoptions = xoptions; } return xoptions; } @@ -1947,7 +1939,7 @@ _PySys_BeginInit(void) PyObject *m, *sysdict, *version_info; int res; - m = _PyModule_CreateInitialized(&sysmodule, PYTHON_API_VERSION); + m = PyModule_Create(&sysmodule); if (m == NULL) return NULL; sysdict = PyModule_GetDict(m); @@ -2094,6 +2086,16 @@ _PySys_BeginInit(void) #undef SET_SYS_FROM_STRING_BORROW /* Updating the sys namespace, returning integer error codes */ +#define SET_SYS_FROM_STRING_BORROW_INT_RESULT(key, value) \ + do { \ + PyObject *v = (value); \ + if (v == NULL) \ + return -1; \ + res = PyDict_SetItemString(sysdict, key, v); \ + if (res < 0) { \ + return res; \ + } \ + } while (0) #define SET_SYS_FROM_STRING_INT_RESULT(key, value) \ do { \ PyObject *v = (value); \ @@ -2138,11 +2140,15 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - if (get_warnoptions() == NULL) + PyObject *warnoptions = get_warnoptions(); + if (warnoptions == NULL) return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); - if (get_xoptions() == NULL) + PyObject *xoptions = get_xoptions(); + if (xoptions == NULL) return -1; + SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); if (PyErr_Occurred()) return -1; @@ -2150,6 +2156,7 @@ _PySys_EndInit(PyObject *sysdict) } #undef SET_SYS_FROM_STRING_INT_RESULT +#undef SET_SYS_FROM_STRING_BORROW_INT_RESULT static PyObject * makepathobject(const wchar_t *path, wchar_t delim) From webhook-mailer at python.org Thu Sep 14 03:36:00 2017 From: webhook-mailer at python.org (Eric Snow) Date: Thu, 14 Sep 2017 07:36:00 -0000 Subject: [Python-checkins] bpo-30860: Fix a refleak. (#3567) Message-ID: https://github.com/python/cpython/commit/dae0276bb6bc7281d59fb0b8f1aab31634ee80dc commit: dae0276bb6bc7281d59fb0b8f1aab31634ee80dc branch: master author: Eric Snow committer: GitHub date: 2017-09-14T00:35:58-07:00 summary: bpo-30860: Fix a refleak. (#3567) Resolves bpo-31420. (This was accidentally reverted when in #3565.) files: M Include/object.h M Include/pystate.h M Objects/object.c M Python/pylifecycle.c M Python/pystate.c M Python/pythonrun.c M Python/sysmodule.c diff --git a/Include/object.h b/Include/object.h index b46d4c30e1e..9bb780e28bc 100644 --- a/Include/object.h +++ b/Include/object.h @@ -727,14 +727,13 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); /* Py_REF_DEBUG also controls the display of refcounts and memory block * allocations at the interactive prompt and at interpreter shutdown */ +PyAPI_FUNC(PyObject *) _PyDebug_XOptionShowRefCount(void); PyAPI_FUNC(void) _PyDebug_PrintTotalRefs(void); -#define _PY_DEBUG_PRINT_TOTAL_REFS() _PyDebug_PrintTotalRefs() #else #define _Py_INC_REFTOTAL #define _Py_DEC_REFTOTAL #define _Py_REF_DEBUG_COMMA #define _Py_CHECK_REFCNT(OP) /* a semicolon */; -#define _PY_DEBUG_PRINT_TOTAL_REFS() #endif /* Py_REF_DEBUG */ #ifdef COUNT_ALLOCS diff --git a/Include/pystate.h b/Include/pystate.h index 09061144605..507a598297e 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -61,8 +61,6 @@ typedef struct _is { /* Used in Python/sysmodule.c. */ int check_interval; - PyObject *warnoptions; - PyObject *xoptions; /* Used in Modules/_threadmodule.c. */ long num_threads; diff --git a/Objects/object.c b/Objects/object.c index 74893e38c71..ed8a62a163a 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -29,20 +29,23 @@ _Py_GetRefTotal(void) return total; } -void -_PyDebug_PrintTotalRefs(void) { - PyObject *xoptions, *value; +PyObject * +_PyDebug_XOptionShowRefCount(void) +{ + PyObject *xoptions = PySys_GetXOptions(); + if (xoptions == NULL) + return NULL; + _Py_IDENTIFIER(showrefcount); + return _PyDict_GetItemId(xoptions, &PyId_showrefcount); +} - xoptions = PySys_GetXOptions(); - if (xoptions == NULL) - return; - value = _PyDict_GetItemId(xoptions, &PyId_showrefcount); - if (value == Py_True) - fprintf(stderr, - "[%" PY_FORMAT_SIZE_T "d refs, " - "%" PY_FORMAT_SIZE_T "d blocks]\n", - _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); +void +_PyDebug_PrintTotalRefs(void) { + fprintf(stderr, + "[%" PY_FORMAT_SIZE_T "d refs, " + "%" PY_FORMAT_SIZE_T "d blocks]\n", + _Py_GetRefTotal(), _Py_GetAllocatedBlocks()); } #endif /* Py_REF_DEBUG */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 0700569ac5a..2aac901ad13 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1011,6 +1011,11 @@ Py_FinalizeEx(void) while (_PyGC_CollectIfEnabled() > 0) /* nothing */; #endif + +#ifdef Py_REF_DEBUG + PyObject *showrefcount = _PyDebug_XOptionShowRefCount(); +#endif + /* Destroy all modules */ PyImport_Cleanup(); @@ -1058,7 +1063,10 @@ Py_FinalizeEx(void) /* dump hash stats */ _PyHash_Fini(); - _PY_DEBUG_PRINT_TOTAL_REFS(); +#ifdef Py_REF_DEBUG + if (showrefcount == Py_True) + _PyDebug_PrintTotalRefs(); +#endif #ifdef Py_TRACE_REFS /* Display all objects still alive -- this can invoke arbitrary diff --git a/Python/pystate.c b/Python/pystate.c index 41adf03662c..53c12361457 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -97,8 +97,6 @@ PyInterpreterState_New(void) interp->builtins_copy = NULL; interp->tstate_head = NULL; interp->check_interval = 100; - interp->warnoptions = NULL; - interp->xoptions = NULL; interp->num_threads = 0; interp->pythread_stacksize = 0; interp->codec_search_path = NULL; diff --git a/Python/pythonrun.c b/Python/pythonrun.c index d1d4a69a8dd..df814fbed97 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -113,7 +113,10 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * err = -1; for (;;) { ret = PyRun_InteractiveOneObject(fp, filename, flags); - _PY_DEBUG_PRINT_TOTAL_REFS(); +#ifdef Py_REF_DEBUG + if (_PyDebug_XOptionShowRefCount() == Py_True) + _PyDebug_PrintTotalRefs(); +#endif if (ret == E_EOF) { err = 0; break; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index dd127a1f7ce..9e13d49417d 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -36,12 +36,14 @@ extern const char *PyWin_DLLVersionString; _Py_IDENTIFIER(_); _Py_IDENTIFIER(__sizeof__); +_Py_IDENTIFIER(_xoptions); _Py_IDENTIFIER(buffer); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(encoding); _Py_IDENTIFIER(path); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); +_Py_IDENTIFIER(warnoptions); _Py_IDENTIFIER(write); PyObject * @@ -1481,13 +1483,17 @@ list_builtin_module_names(void) static PyObject * get_warnoptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); if (warnoptions == NULL || !PyList_Check(warnoptions)) { Py_XDECREF(warnoptions); warnoptions = PyList_New(0); if (warnoptions == NULL) return NULL; - PyThreadState_GET()->interp->warnoptions = warnoptions; + if (_PySys_SetObjectId(&PyId_warnoptions, warnoptions)) { + Py_DECREF(warnoptions); + return NULL; + } + Py_DECREF(warnoptions); } return warnoptions; } @@ -1495,7 +1501,7 @@ get_warnoptions(void) void PySys_ResetWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); if (warnoptions == NULL || !PyList_Check(warnoptions)) return; PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); @@ -1524,20 +1530,24 @@ PySys_AddWarnOption(const wchar_t *s) int PySys_HasWarnOptions(void) { - PyObject *warnoptions = PyThreadState_GET()->interp->warnoptions; + PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions); return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; } static PyObject * get_xoptions(void) { - PyObject *xoptions = PyThreadState_GET()->interp->xoptions; + PyObject *xoptions = _PySys_GetObjectId(&PyId__xoptions); if (xoptions == NULL || !PyDict_Check(xoptions)) { Py_XDECREF(xoptions); xoptions = PyDict_New(); if (xoptions == NULL) return NULL; - PyThreadState_GET()->interp->xoptions = xoptions; + if (_PySys_SetObjectId(&PyId__xoptions, xoptions)) { + Py_DECREF(xoptions); + return NULL; + } + Py_DECREF(xoptions); } return xoptions; } @@ -2086,16 +2096,6 @@ _PySys_BeginInit(void) #undef SET_SYS_FROM_STRING_BORROW /* Updating the sys namespace, returning integer error codes */ -#define SET_SYS_FROM_STRING_BORROW_INT_RESULT(key, value) \ - do { \ - PyObject *v = (value); \ - if (v == NULL) \ - return -1; \ - res = PyDict_SetItemString(sysdict, key, v); \ - if (res < 0) { \ - return res; \ - } \ - } while (0) #define SET_SYS_FROM_STRING_INT_RESULT(key, value) \ do { \ PyObject *v = (value); \ @@ -2140,15 +2140,11 @@ _PySys_EndInit(PyObject *sysdict) SET_SYS_FROM_STRING_INT_RESULT("base_exec_prefix", PyUnicode_FromWideChar(Py_GetExecPrefix(), -1)); - PyObject *warnoptions = get_warnoptions(); - if (warnoptions == NULL) + if (get_warnoptions() == NULL) return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("warnoptions", warnoptions); - PyObject *xoptions = get_xoptions(); - if (xoptions == NULL) + if (get_xoptions() == NULL) return -1; - SET_SYS_FROM_STRING_BORROW_INT_RESULT("_xoptions", xoptions); if (PyErr_Occurred()) return -1; @@ -2156,7 +2152,6 @@ _PySys_EndInit(PyObject *sysdict) } #undef SET_SYS_FROM_STRING_INT_RESULT -#undef SET_SYS_FROM_STRING_BORROW_INT_RESULT static PyObject * makepathobject(const wchar_t *path, wchar_t delim) From webhook-mailer at python.org Thu Sep 14 04:10:33 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 14 Sep 2017 08:10:33 -0000 Subject: [Python-checkins] _ssl_: Fix compiler warning (#3559) Message-ID: https://github.com/python/cpython/commit/5a61559fb0776a9a0f08294ec9003cea13940430 commit: 5a61559fb0776a9a0f08294ec9003cea13940430 branch: master author: Victor Stinner committer: Christian Heimes date: 2017-09-14T10:10:30+02:00 summary: _ssl_: Fix compiler warning (#3559) Cast Py_buffer.len (Py_ssize_t, signed) to size_t (unsigned) to prevent the following warning: Modules/_ssl.c:3089:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] files: M Modules/_ssl.c diff --git a/Modules/_ssl.c b/Modules/_ssl.c index bd22f16fae7..8aaaa3212c1 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3086,7 +3086,7 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, /*[clinic end generated code: output=87599a7f76651a9b input=9bba964595d519be]*/ { #ifdef HAVE_ALPN - if (protos->len > UINT_MAX) { + if ((size_t)protos->len > UINT_MAX) { PyErr_Format(PyExc_OverflowError, "protocols longer than %d bytes", UINT_MAX); return NULL; From webhook-mailer at python.org Thu Sep 14 05:15:14 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Thu, 14 Sep 2017 09:15:14 -0000 Subject: [Python-checkins] [3.6] _ssl_: Fix compiler warning (GH-3559) (#3569) Message-ID: https://github.com/python/cpython/commit/472cc9f366ef16cab72eed21bdc6a24f194fc03a commit: 472cc9f366ef16cab72eed21bdc6a24f194fc03a branch: 3.6 author: Christian Heimes committer: GitHub date: 2017-09-14T11:15:07+02:00 summary: [3.6] _ssl_: Fix compiler warning (GH-3559) (#3569) Cast Py_buffer.len (Py_ssize_t, signed) to size_t (unsigned) to prevent the following warning: Modules/_ssl.c:3089:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]. (cherry picked from commit 5a61559fb0776a9a0f08294ec9003cea13940430) files: M Modules/_ssl.c diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 4a656a145ab..a32fce47ef6 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3024,6 +3024,12 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, /*[clinic end generated code: output=87599a7f76651a9b input=9bba964595d519be]*/ { #ifdef HAVE_ALPN + if ((size_t)protos->len > UINT_MAX) { + PyErr_Format(PyExc_OverflowError, + "protocols longer than %d bytes", UINT_MAX); + return NULL; + } + PyMem_FREE(self->alpn_protocols); self->alpn_protocols = PyMem_Malloc(protos->len); if (!self->alpn_protocols) From solipsis at pitrou.net Thu Sep 14 05:22:15 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 14 Sep 2017 09:22:15 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=69 Message-ID: <20170914092214.90858.696679DD4304FFCA@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [0, 0, 44] references, sum=44 test_multiprocessing_forkserver leaked [0, 0, 19] memory blocks, sum=19 test_multiprocessing_forkserver leaked [0, 0, 2] file descriptors, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogc5PVkH', '--timeout', '7200'] From webhook-mailer at python.org Thu Sep 14 09:45:35 2017 From: webhook-mailer at python.org (Mariatta) Date: Thu, 14 Sep 2017 13:45:35 -0000 Subject: [Python-checkins] Improve code examples in hashlib cookie signing (GH-3562) (GH-3566) Message-ID: https://github.com/python/cpython/commit/c8b6506404540eb06c45a51b04ccc102f8b92813 commit: c8b6506404540eb06c45a51b04ccc102f8b92813 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-14T06:45:31-07:00 summary: Improve code examples in hashlib cookie signing (GH-3562) (GH-3566) The `blake2b` function does not take the `data` keyword argument. The hex digest returned by sign was a string, whereas compare_digest expects bytes-like objects. Typo fix: compare_digesty -> compare_digest (cherry picked from commit 312ffead1eb272535e021e248b5d74ab04b2e72e) files: M Doc/library/hashlib.rst diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 9d563566d49..725dce6fa15 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -506,8 +506,9 @@ to users and later verify them to make sure they weren't tampered with:: >>> AUTH_SIZE = 16 >>> >>> def sign(cookie): - ... h = blake2b(data=cookie, digest_size=AUTH_SIZE, key=SECRET_KEY) - ... return h.hexdigest() + ... h = blake2b(digest_size=AUTH_SIZE, key=SECRET_KEY) + ... h.update(cookie) + ... return h.hexdigest().encode('utf-8') >>> >>> cookie = b'user:vatrogasac' >>> sig = sign(cookie) @@ -517,7 +518,7 @@ to users and later verify them to make sure they weren't tampered with:: True >>> compare_digest(b'user:policajac', sig) False - >>> compare_digesty(cookie, '0102030405060708090a0b0c0d0e0f00') + >>> compare_digest(cookie, b'0102030405060708090a0b0c0d0e0f00') False Even though there's a native keyed hashing mode, BLAKE2 can, of course, be used From webhook-mailer at python.org Thu Sep 14 11:34:49 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 14 Sep 2017 15:34:49 -0000 Subject: [Python-checkins] bpo-31457: Allow for nested LoggerAdapter objects (#3551) Message-ID: https://github.com/python/cpython/commit/1bbd482bcf6ea36bfe488f868810ffe110238ae1 commit: 1bbd482bcf6ea36bfe488f868810ffe110238ae1 branch: master author: ?ukasz Langa committer: GitHub date: 2017-09-14T11:34:47-04:00 summary: bpo-31457: Allow for nested LoggerAdapter objects (#3551) Some of the proxied methods use internal Logger state which isn't proxied, causing failures if an adapter is applied to another adapter. This commit fixes the issue, adds a new test for the use case. files: A Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst M Lib/logging/__init__.py M Lib/test/test_logging.py diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 19b96b813cf..b941eab97d6 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1739,6 +1739,27 @@ def hasHandlers(self): """ return self.logger.hasHandlers() + def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False): + """ + Low-level log implementation, proxied to allow nested logger adapters. + """ + return self.logger._log( + level, + msg, + args, + exc_info=exc_info, + extra=extra, + stack_info=stack_info, + ) + + @property + def manager(self): + return self.logger.manager + + @manager.setter + def set_manager(self, value): + self.logger.manager = value + def __repr__(self): logger = self.logger level = getLevelName(logger.getEffectiveLevel()) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 76f98bb572d..611044d8fa8 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3986,6 +3986,17 @@ def test_has_handlers(self): self.assertFalse(self.logger.hasHandlers()) self.assertFalse(self.adapter.hasHandlers()) + def test_nested(self): + msg = 'Adapters can be nested, yo.' + adapter_adapter = logging.LoggerAdapter(logger=self.adapter, extra=None) + adapter_adapter.log(logging.CRITICAL, msg, self.recording) + + self.assertEqual(len(self.recording.records), 1) + record = self.recording.records[0] + self.assertEqual(record.levelno, logging.CRITICAL) + self.assertEqual(record.msg, msg) + self.assertEqual(record.args, (self.recording,)) + class LoggerTest(BaseTest): diff --git a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst new file mode 100644 index 00000000000..153aa42a62e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst @@ -0,0 +1 @@ +LoggerAdapter objects can now be nested. From webhook-mailer at python.org Thu Sep 14 11:43:10 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 15:43:10 -0000 Subject: [Python-checkins] bpo-31234: Join threads in tests (#3572) Message-ID: https://github.com/python/cpython/commit/18e95b4176256f100429a806d0455406df98f984 commit: 18e95b4176256f100429a806d0455406df98f984 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T08:43:04-07:00 summary: bpo-31234: Join threads in tests (#3572) Call thread.join() on threads to prevent the "dangling threads" warning. files: M Lib/test/test_concurrent_futures.py M Lib/test/test_decimal.py M Lib/test/test_smtplib.py M Lib/test/test_xmlrpc.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 7bc733efb1e..57dc994d284 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -772,6 +772,7 @@ def notification(): t.start() self.assertEqual(f1.result(timeout=5), 42) + t.join() def test_result_with_cancel(self): # TODO(brian at sweetapp.com): This test is timing dependent. @@ -785,6 +786,7 @@ def notification(): t.start() self.assertRaises(futures.CancelledError, f1.result, timeout=5) + t.join() def test_exception_with_timeout(self): self.assertRaises(futures.TimeoutError, @@ -813,6 +815,7 @@ def notification(): t.start() self.assertTrue(isinstance(f1.exception(timeout=5), OSError)) + t.join() @test.support.reap_threads def test_main(): diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 5d9da0e3745..5aea51e8b73 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1618,6 +1618,9 @@ def test_threading(self): for sig in Signals[self.decimal]: self.assertFalse(DefaultContext.flags[sig]) + th1.join() + th2.join() + DefaultContext.prec = save_prec DefaultContext.Emax = save_emax DefaultContext.Emin = save_emin diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 4c9b7d367c8..040ad4e0596 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -611,7 +611,9 @@ def setUp(self): self.sock.settimeout(15) self.port = support.bind_port(self.sock) servargs = (self.evt, self.respdata, self.sock) - threading.Thread(target=server, args=servargs).start() + thread = threading.Thread(target=server, args=servargs) + thread.start() + self.addCleanup(thread.join) self.evt.wait() self.evt.clear() diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index f2b496ac9a6..c9099e05117 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -755,7 +755,9 @@ def setUp(self): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, self.request_count, self.requestHandler) - threading.Thread(target=self.threadFunc, args=serv_args).start() + thread = threading.Thread(target=self.threadFunc, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() @@ -1206,7 +1208,9 @@ def setUp(self): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, 1) - threading.Thread(target=http_server, args=serv_args).start() + thread = threading.Thread(target=http_server, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() From webhook-mailer at python.org Thu Sep 14 11:43:25 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 15:43:25 -0000 Subject: [Python-checkins] bpo-31234: Join threads in test_hashlib (#3573) Message-ID: https://github.com/python/cpython/commit/8dcf22f442320e4c1a5408e67b4c9002ad105f17 commit: 8dcf22f442320e4c1a5408e67b4c9002ad105f17 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T08:43:22-07:00 summary: bpo-31234: Join threads in test_hashlib (#3573) * bpo-31234: Join threads in test_hashlib Use thread.join() to wait until the parallel hash tasks complete rather than using events. Calling thread.join() prevent "dangling thread" warnings. * test_hashlib: minor PEP 8 coding style fixes files: M Lib/test/test_hashlib.py diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index 5c8f090116f..90e6a563a72 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -746,28 +746,28 @@ def test_threaded_hashing(self): hasher = hashlib.sha1() num_threads = 5 smallest_data = b'swineflu' - data = smallest_data*200000 + data = smallest_data * 200000 expected_hash = hashlib.sha1(data*num_threads).hexdigest() - def hash_in_chunks(chunk_size, event): + def hash_in_chunks(chunk_size): index = 0 while index < len(data): - hasher.update(data[index:index+chunk_size]) + hasher.update(data[index:index + chunk_size]) index += chunk_size - event.set() - events = [] + threads = [] for threadnum in range(num_threads): - chunk_size = len(data) // (10**threadnum) + chunk_size = len(data) // (10 ** threadnum) self.assertGreater(chunk_size, 0) self.assertEqual(chunk_size % len(smallest_data), 0) - event = threading.Event() - events.append(event) - threading.Thread(target=hash_in_chunks, - args=(chunk_size, event)).start() - - for event in events: - event.wait() + thread = threading.Thread(target=hash_in_chunks, + args=(chunk_size,)) + threads.append(thread) + + for thread in threads: + thread.start() + for thread in threads: + thread.join() self.assertEqual(expected_hash, hasher.hexdigest()) From webhook-mailer at python.org Thu Sep 14 13:10:27 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 14 Sep 2017 17:10:27 -0000 Subject: [Python-checkins] [3.6] bpo-31457: Allow for nested LoggerAdapter objects (GH-3551) (#3576) Message-ID: https://github.com/python/cpython/commit/20fa05d0223101b8e0005525b94a2eac892348de commit: 20fa05d0223101b8e0005525b94a2eac892348de branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: ?ukasz Langa date: 2017-09-14T13:10:25-04:00 summary: [3.6] bpo-31457: Allow for nested LoggerAdapter objects (GH-3551) (#3576) Some of the proxied methods use internal Logger state which isn't proxied, causing failures if an adapter is applied to another adapter. This commit fixes the issue, adds a new test for the use case. (cherry picked from commit 1bbd482bcf6ea36bfe488f868810ffe110238ae1) files: A Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst M Lib/logging/__init__.py M Lib/test/test_logging.py diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index b44a3b22288..0965536797d 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1697,6 +1697,27 @@ def hasHandlers(self): """ return self.logger.hasHandlers() + def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False): + """ + Low-level log implementation, proxied to allow nested logger adapters. + """ + return self.logger._log( + level, + msg, + args, + exc_info=exc_info, + extra=extra, + stack_info=stack_info, + ) + + @property + def manager(self): + return self.logger.manager + + @manager.setter + def set_manager(self, value): + self.logger.manager = value + def __repr__(self): logger = self.logger level = getLevelName(logger.getEffectiveLevel()) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 4ec02e10093..25046c3c38a 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3955,6 +3955,17 @@ def test_has_handlers(self): self.assertFalse(self.logger.hasHandlers()) self.assertFalse(self.adapter.hasHandlers()) + def test_nested(self): + msg = 'Adapters can be nested, yo.' + adapter_adapter = logging.LoggerAdapter(logger=self.adapter, extra=None) + adapter_adapter.log(logging.CRITICAL, msg, self.recording) + + self.assertEqual(len(self.recording.records), 1) + record = self.recording.records[0] + self.assertEqual(record.levelno, logging.CRITICAL) + self.assertEqual(record.msg, msg) + self.assertEqual(record.args, (self.recording,)) + class LoggerTest(BaseTest): diff --git a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst new file mode 100644 index 00000000000..153aa42a62e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst @@ -0,0 +1 @@ +LoggerAdapter objects can now be nested. From webhook-mailer at python.org Thu Sep 14 14:18:15 2017 From: webhook-mailer at python.org (Eric Snow) Date: Thu, 14 Sep 2017 18:18:15 -0000 Subject: [Python-checkins] bpo-28411: Isolate PyInterpreterState.modules (#3575) Message-ID: https://github.com/python/cpython/commit/d393c1b227f22fb9af66040b2b367c99a4d1fa9a commit: d393c1b227f22fb9af66040b2b367c99a4d1fa9a branch: master author: Eric Snow committer: GitHub date: 2017-09-14T12:18:12-06:00 summary: bpo-28411: Isolate PyInterpreterState.modules (#3575) A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason. Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst M Include/import.h M Include/modsupport.h M Objects/moduleobject.c M Objects/typeobject.c M Python/bltinmodule.c M Python/import.c M Python/importdl.c M Python/pylifecycle.c M Python/sysmodule.c diff --git a/Include/import.h b/Include/import.h index 7e83985b3a4..95c52b0bfba 100644 --- a/Include/import.h +++ b/Include/import.h @@ -38,11 +38,17 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); +#endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); #endif +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -92,14 +98,19 @@ PyAPI_FUNC(int) _PyImport_ReleaseLock(void); PyAPI_FUNC(void) _PyImport_ReInitLock(void); PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin( - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *, + PyObject *); PyAPI_FUNC(int) _PyImport_FixupBuiltin( PyObject *mod, - const char *name /* UTF-8 encoded string */ + const char *name, /* UTF-8 encoded string */ + PyObject *modules ); -PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *); +PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, + PyObject *, PyObject *); struct _inittab { const char *name; /* ASCII encoded string */ diff --git a/Include/modsupport.h b/Include/modsupport.h index 8c7cf39d9a3..73d86a94b95 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -191,6 +191,10 @@ PyAPI_FUNC(int) PyModule_ExecDef(PyObject *module, PyModuleDef *def); PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, int apiver); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyModule_CreateInitialized(struct PyModuleDef*, + int apiver); +#endif #ifdef Py_LIMITED_API #define PyModule_Create(module) \ diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst new file mode 100644 index 00000000000..47f9fa684e5 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst @@ -0,0 +1,3 @@ +Change direct usage of PyInterpreterState.modules to PyImport_GetModuleDict(). +Also introduce more uniformity in other code that deals with sys.modules. +This helps reduce complications when working on sys.modules. diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 5fab06d31df..2be49fbda38 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -162,11 +162,17 @@ _add_methods_to_object(PyObject *module, PyObject *name, PyMethodDef *functions) PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { + if (!_PyImport_IsInitialized(PyThreadState_GET()->interp)) + Py_FatalError("Python import machinery not initialized"); + return _PyModule_CreateInitialized(module, module_api_version); +} + +PyObject * +_PyModule_CreateInitialized(struct PyModuleDef* module, int module_api_version) +{ const char* name; PyModuleObject *m; - PyInterpreterState *interp = PyThreadState_Get()->interp; - if (interp->modules == NULL) - Py_FatalError("Python import machinery not initialized"); + if (!PyModuleDef_Init(module)) return NULL; name = module->m_name; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index dc4d2edc5cf..9ebbb21ef8d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3902,7 +3902,6 @@ import_copyreg(void) { PyObject *copyreg_str; PyObject *copyreg_module; - PyInterpreterState *interp = PyThreadState_GET()->interp; _Py_IDENTIFIER(copyreg); copyreg_str = _PyUnicode_FromId(&PyId_copyreg); @@ -3914,7 +3913,8 @@ import_copyreg(void) by storing a reference to the cached module in a static variable, but this broke when multiple embedded interpreters were in use (see issue #17408 and #19088). */ - copyreg_module = PyDict_GetItemWithError(interp->modules, copyreg_str); + PyObject *modules = PyImport_GetModuleDict(); + copyreg_module = PyDict_GetItemWithError(modules, copyreg_str); if (copyreg_module != NULL) { Py_INCREF(copyreg_module); return copyreg_module; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 5e1f1d3854f..c363cfe8cea 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2685,7 +2685,7 @@ _PyBuiltin_Init(void) PyType_Ready(&PyZip_Type) < 0) return NULL; - mod = PyModule_Create(&builtinsmodule); + mod = _PyModule_CreateInitialized(&builtinsmodule, PYTHON_API_VERSION); if (mod == NULL) return NULL; dict = PyModule_GetDict(mod); diff --git a/Python/import.c b/Python/import.c index 2aacf659351..7aa7a1bdf79 100644 --- a/Python/import.c +++ b/Python/import.c @@ -296,6 +296,17 @@ PyImport_GetModuleDict(void) return interp->modules; } +/* In some corner cases it is important to be sure that the import + machinery has been initialized (or not cleaned up yet). For + example, see issue #4236 and PyModule_Create2(). */ + +int +_PyImport_IsInitialized(PyInterpreterState *interp) +{ + if (interp->modules == NULL) + return 0; + return 1; +} /* List of names to clear in sys */ static const char * const sys_deletes[] = { @@ -323,7 +334,7 @@ PyImport_Cleanup(void) Py_ssize_t pos; PyObject *key, *value, *dict; PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; + PyObject *modules = PyImport_GetModuleDict(); PyObject *weaklist = NULL; const char * const *p; @@ -511,9 +522,9 @@ PyImport_GetMagicTag(void) int _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, - PyObject *filename) + PyObject *filename, PyObject *modules) { - PyObject *modules, *dict, *key; + PyObject *dict, *key; struct PyModuleDef *def; int res; if (extensions == NULL) { @@ -530,7 +541,6 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, PyErr_BadInternalCall(); return -1; } - modules = PyImport_GetModuleDict(); if (PyDict_SetItem(modules, name, mod) < 0) return -1; if (_PyState_AddModule(mod, def) < 0) { @@ -562,14 +572,14 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, } int -_PyImport_FixupBuiltin(PyObject *mod, const char *name) +_PyImport_FixupBuiltin(PyObject *mod, const char *name, PyObject *modules) { int res; PyObject *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return -1; - res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj); + res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj, modules); Py_DECREF(nameobj); return res; } @@ -577,6 +587,14 @@ _PyImport_FixupBuiltin(PyObject *mod, const char *name) PyObject * _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) { + PyObject *modules = PyImport_GetModuleDict(); + return _PyImport_FindExtensionObjectEx(name, filename, modules); +} + +PyObject * +_PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, + PyObject *modules) +{ PyObject *mod, *mdict, *key; PyModuleDef* def; if (extensions == NULL) @@ -592,7 +610,7 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) /* Module does not support repeated initialization */ if (def->m_base.m_copy == NULL) return NULL; - mod = PyImport_AddModuleObject(name); + mod = _PyImport_AddModuleObject(name, modules); if (mod == NULL) return NULL; mdict = PyModule_GetDict(mod); @@ -607,14 +625,14 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) mod = def->m_base.m_init(); if (mod == NULL) return NULL; - if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) { + if (PyDict_SetItem(modules, name, mod) == -1) { Py_DECREF(mod); return NULL; } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) { - PyDict_DelItem(PyImport_GetModuleDict(), name); + PyDict_DelItem(modules, name); Py_DECREF(mod); return NULL; } @@ -626,13 +644,13 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename) } PyObject * -_PyImport_FindBuiltin(const char *name) +_PyImport_FindBuiltin(const char *name, PyObject *modules) { PyObject *res, *nameobj; nameobj = PyUnicode_InternFromString(name); if (nameobj == NULL) return NULL; - res = _PyImport_FindExtensionObject(nameobj, nameobj); + res = _PyImport_FindExtensionObjectEx(nameobj, nameobj, modules); Py_DECREF(nameobj); return res; } @@ -647,6 +665,12 @@ PyObject * PyImport_AddModuleObject(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); + return _PyImport_AddModuleObject(name, modules); +} + +PyObject * +_PyImport_AddModuleObject(PyObject *name, PyObject *modules) +{ PyObject *m; if ((m = PyDict_GetItemWithError(modules, name)) != NULL && @@ -1042,6 +1066,7 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } + PyObject *modules = NULL; for (p = PyImport_Inittab; p->name != NULL; p++) { PyModuleDef *def; if (_PyUnicode_EqualToASCIIString(name, p->name)) { @@ -1067,7 +1092,11 @@ _imp_create_builtin(PyObject *module, PyObject *spec) return NULL; } def->m_base.m_init = p->initfunc; - if (_PyImport_FixupExtensionObject(mod, name, name) < 0) { + if (modules == NULL) { + modules = PyImport_GetModuleDict(); + } + if (_PyImport_FixupExtensionObject(mod, name, name, + modules) < 0) { Py_DECREF(name); return NULL; } @@ -1511,7 +1540,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, Py_INCREF(abs_name); } - mod = PyDict_GetItem(interp->modules, abs_name); + PyObject *modules = PyImport_GetModuleDict(); + mod = PyDict_GetItem(modules, abs_name); if (mod != NULL && mod != Py_None) { _Py_IDENTIFIER(__spec__); _Py_IDENTIFIER(_initializing); @@ -1598,7 +1628,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, goto error; } - final_mod = PyDict_GetItem(interp->modules, to_return); + PyObject *modules = PyImport_GetModuleDict(); + final_mod = PyDict_GetItem(modules, to_return); Py_DECREF(to_return); if (final_mod == NULL) { PyErr_Format(PyExc_KeyError, diff --git a/Python/importdl.c b/Python/importdl.c index d8656b94333..32fb7e1be21 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -215,7 +215,8 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp) else Py_INCREF(path); - if (_PyImport_FixupExtensionObject(m, name_unicode, path) < 0) + PyObject *modules = PyImport_GetModuleDict(); + if (_PyImport_FixupExtensionObject(m, name_unicode, path, modules) < 0) goto error; Py_DECREF(name_unicode); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 2aac901ad13..5c8cf5b9bd5 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -675,9 +675,20 @@ void _Py_InitializeCore(const _PyCoreConfig *config) if (!_PyFloat_Init()) Py_FatalError("Py_InitializeCore: can't init float"); - interp->modules = PyDict_New(); - if (interp->modules == NULL) + PyObject *modules = PyDict_New(); + if (modules == NULL) Py_FatalError("Py_InitializeCore: can't make modules dictionary"); + interp->modules = modules; + + sysmod = _PySys_BeginInit(); + if (sysmod == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys"); + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_InitializeCore: can't initialize sys dict"); + Py_INCREF(interp->sysdict); + PyDict_SetItemString(interp->sysdict, "modules", modules); + _PyImport_FixupBuiltin(sysmod, "sys", modules); /* Init Unicode implementation; relies on the codec registry */ if (_PyUnicode_Init() < 0) @@ -689,7 +700,7 @@ void _Py_InitializeCore(const _PyCoreConfig *config) bimod = _PyBuiltin_Init(); if (bimod == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins modules"); - _PyImport_FixupBuiltin(bimod, "builtins"); + _PyImport_FixupBuiltin(bimod, "builtins", modules); interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) Py_FatalError("Py_InitializeCore: can't initialize builtins dict"); @@ -698,17 +709,6 @@ void _Py_InitializeCore(const _PyCoreConfig *config) /* initialize builtin exceptions */ _PyExc_Init(bimod); - sysmod = _PySys_BeginInit(); - if (sysmod == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys"); - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - Py_FatalError("Py_InitializeCore: can't initialize sys dict"); - Py_INCREF(interp->sysdict); - _PyImport_FixupBuiltin(sysmod, "sys"); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); - /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1211,9 +1211,23 @@ Py_NewInterpreter(void) /* XXX The following is lax in error checking */ - interp->modules = PyDict_New(); + PyObject *modules = PyDict_New(); + if (modules == NULL) + Py_FatalError("Py_NewInterpreter: can't make modules dictionary"); + interp->modules = modules; - bimod = _PyImport_FindBuiltin("builtins"); + sysmod = _PyImport_FindBuiltin("sys", modules); + if (sysmod != NULL) { + interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + goto handle_error; + Py_INCREF(interp->sysdict); + PyDict_SetItemString(interp->sysdict, "modules", modules); + PySys_SetPath(Py_GetPath()); + _PySys_EndInit(interp->sysdict); + } + + bimod = _PyImport_FindBuiltin("builtins", modules); if (bimod != NULL) { interp->builtins = PyModule_GetDict(bimod); if (interp->builtins == NULL) @@ -1224,18 +1238,9 @@ Py_NewInterpreter(void) /* initialize builtin exceptions */ _PyExc_Init(bimod); - sysmod = _PyImport_FindBuiltin("sys"); if (bimod != NULL && sysmod != NULL) { PyObject *pstderr; - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - goto handle_error; - Py_INCREF(interp->sysdict); - _PySys_EndInit(interp->sysdict); - PySys_SetPath(Py_GetPath()); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); /* Set up a preliminary stderr printer until we have enough infrastructure for the io module in place. */ pstderr = PyFile_NewStdPrinter(fileno(stderr)); @@ -1911,9 +1916,8 @@ wait_for_thread_shutdown(void) { _Py_IDENTIFIER(_shutdown); PyObject *result; - PyThreadState *tstate = PyThreadState_GET(); - PyObject *threading = PyMapping_GetItemString(tstate->interp->modules, - "threading"); + PyObject *modules = PyImport_GetModuleDict(); + PyObject *threading = PyMapping_GetItemString(modules, "threading"); if (threading == NULL) { /* threading not imported */ PyErr_Clear(); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 9e13d49417d..d463683df1d 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -162,8 +162,9 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; - PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; + PyObject *modules = PyImport_GetModuleDict(); + if (modules == NULL) + return NULL; PyObject *builtins; static PyObject *newline = NULL; int err; @@ -1949,7 +1950,7 @@ _PySys_BeginInit(void) PyObject *m, *sysdict, *version_info; int res; - m = PyModule_Create(&sysmodule); + m = _PyModule_CreateInitialized(&sysmodule, PYTHON_API_VERSION); if (m == NULL) return NULL; sysdict = PyModule_GetDict(m); From webhook-mailer at python.org Thu Sep 14 14:33:02 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 14 Sep 2017 18:33:02 -0000 Subject: [Python-checkins] bpo-28556: typing.get_type_hints: better globalns for classes and modules (#3582) Message-ID: https://github.com/python/cpython/commit/f350a268a7071ce7d7a5bb86a9b1229782d4963b commit: f350a268a7071ce7d7a5bb86a9b1229782d4963b branch: master author: ?ukasz Langa committer: GitHub date: 2017-09-14T14:33:00-04:00 summary: bpo-28556: typing.get_type_hints: better globalns for classes and modules (#3582) This makes the default behavior (without specifying `globalns` manually) more predictable for users, finds the right globalns automatically. Implementation for classes assumes has a `__module__` attribute and that module is present in `sys.modules`. It does this recursively for all bases in the MRO. For modules, the implementation just uses their `__dict__` directly. This is backwards compatible, will just raise fewer exceptions in naive user code. Originally implemented and reviewed at https://github.com/python/typing/pull/470. files: A Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst M Lib/test/mod_generics_cache.py M Lib/test/test_typing.py M Lib/typing.py diff --git a/Lib/test/mod_generics_cache.py b/Lib/test/mod_generics_cache.py index d9a60b4b28c..6d35c58396d 100644 --- a/Lib/test/mod_generics_cache.py +++ b/Lib/test/mod_generics_cache.py @@ -1,14 +1,53 @@ """Module for testing the behavior of generics across different modules.""" -from typing import TypeVar, Generic +import sys +from textwrap import dedent +from typing import TypeVar, Generic, Optional -T = TypeVar('T') +if sys.version_info[:2] >= (3, 6): + exec(dedent(""" + default_a: Optional['A'] = None + default_b: Optional['B'] = None -class A(Generic[T]): - pass + T = TypeVar('T') -class B(Generic[T]): class A(Generic[T]): - pass + some_b: 'B' + + + class B(Generic[T]): + class A(Generic[T]): + pass + + my_inner_a1: 'B.A' + my_inner_a2: A + my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__ + """)) +else: # This should stay in sync with the syntax above. + __annotations__ = dict( + default_a=Optional['A'], + default_b=Optional['B'], + ) + default_a = None + default_b = None + + T = TypeVar('T') + + + class A(Generic[T]): + __annotations__ = dict( + some_b='B' + ) + + + class B(Generic[T]): + class A(Generic[T]): + pass + + __annotations__ = dict( + my_inner_a1='B.A', + my_inner_a2=A, + my_outer_a='A' # unless somebody calls get_type_hints with localns=B.__dict__ + ) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index a351be1dc3e..87d707c1cde 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ import pickle import re import sys -from unittest import TestCase, main, skipUnless, SkipTest +from unittest import TestCase, main, skipUnless, SkipTest, expectedFailure from copy import copy, deepcopy from typing import Any, NoReturn @@ -30,6 +30,13 @@ import collections as collections_abc # Fallback for PY3.2. +try: + import mod_generics_cache +except ImportError: + # try to use the builtin one, Python 3.5+ + from test import mod_generics_cache + + class BaseTestCase(TestCase): def assertIsSubclass(self, cls, class_or_tuple, msg=None): @@ -836,10 +843,6 @@ def test_subscript_meta(self): self.assertEqual(Callable[..., GenericMeta].__args__, (Ellipsis, GenericMeta)) def test_generic_hashes(self): - try: - from test import mod_generics_cache - except ImportError: # for Python 3.4 and previous versions - import mod_generics_cache class A(Generic[T]): ... @@ -1619,6 +1622,10 @@ def __str__(self): def __add__(self, other): return 0 +class HasForeignBaseClass(mod_generics_cache.A): + some_xrepr: 'XRepr' + other_a: 'mod_generics_cache.A' + async def g_with(am: AsyncContextManager[int]): x: int async with am as x: @@ -1659,8 +1666,18 @@ def test_get_type_hints_modules(self): self.assertEqual(gth(ann_module3), {}) @skipUnless(PY36, 'Python 3.6 required') + @expectedFailure + def test_get_type_hints_modules_forwardref(self): + # FIXME: This currently exposes a bug in typing. Cached forward references + # don't account for the case where there are multiple types of the same + # name coming from different modules in the same program. + mgc_hints = {'default_a': Optional[mod_generics_cache.A], + 'default_b': Optional[mod_generics_cache.B]} + self.assertEqual(gth(mod_generics_cache), mgc_hints) + + @skipUnless(PY36, 'Python 3.6 required') def test_get_type_hints_classes(self): - self.assertEqual(gth(ann_module.C, ann_module.__dict__), + self.assertEqual(gth(ann_module.C), # gth will find the right globalns {'y': Optional[ann_module.C]}) self.assertIsInstance(gth(ann_module.j_class), dict) self.assertEqual(gth(ann_module.M), {'123': 123, 'o': type}) @@ -1671,8 +1688,15 @@ def test_get_type_hints_classes(self): {'y': Optional[ann_module.C]}) self.assertEqual(gth(ann_module.S), {'x': str, 'y': str}) self.assertEqual(gth(ann_module.foo), {'x': int}) - self.assertEqual(gth(NoneAndForward, globals()), + self.assertEqual(gth(NoneAndForward), {'parent': NoneAndForward, 'meaning': type(None)}) + self.assertEqual(gth(HasForeignBaseClass), + {'some_xrepr': XRepr, 'other_a': mod_generics_cache.A, + 'some_b': mod_generics_cache.B}) + self.assertEqual(gth(mod_generics_cache.B), + {'my_inner_a1': mod_generics_cache.B.A, + 'my_inner_a2': mod_generics_cache.B.A, + 'my_outer_a': mod_generics_cache.A}) @skipUnless(PY36, 'Python 3.6 required') def test_respect_no_type_check(self): diff --git a/Lib/typing.py b/Lib/typing.py index 609f813b01e..c00a3a10e1f 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1481,8 +1481,9 @@ def get_type_hints(obj, globalns=None, localns=None): search order is locals first, then globals. - If no dict arguments are passed, an attempt is made to use the - globals from obj, and these are also used as the locals. If the - object does not appear to have globals, an exception is raised. + globals from obj (or the respective module's globals for classes), + and these are also used as the locals. If the object does not appear + to have globals, an empty dictionary is used. - If one dict argument is passed, it is used for both globals and locals. @@ -1493,25 +1494,33 @@ def get_type_hints(obj, globalns=None, localns=None): if getattr(obj, '__no_type_check__', None): return {} - if globalns is None: - globalns = getattr(obj, '__globals__', {}) - if localns is None: - localns = globalns - elif localns is None: - localns = globalns # Classes require a special treatment. if isinstance(obj, type): hints = {} for base in reversed(obj.__mro__): + if globalns is None: + base_globals = sys.modules[base.__module__].__dict__ + else: + base_globals = globalns ann = base.__dict__.get('__annotations__', {}) for name, value in ann.items(): if value is None: value = type(None) if isinstance(value, str): value = _ForwardRef(value) - value = _eval_type(value, globalns, localns) + value = _eval_type(value, base_globals, localns) hints[name] = value return hints + + if globalns is None: + if isinstance(obj, types.ModuleType): + globalns = obj.__dict__ + else: + globalns = getattr(obj, '__globals__', {}) + if localns is None: + localns = globalns + elif localns is None: + localns = globalns hints = getattr(obj, '__annotations__', None) if hints is None: # Return empty annotations for something that _could_ have them. diff --git a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst new file mode 100644 index 00000000000..8464d59a0cb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst @@ -0,0 +1,2 @@ +typing.get_type_hints now finds the right globalns for classes and modules +by default (when no ``globalns`` was specified by the caller). From webhook-mailer at python.org Thu Sep 14 15:30:30 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 19:30:30 -0000 Subject: [Python-checkins] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580) Message-ID: https://github.com/python/cpython/commit/0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab commit: 0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-14T22:30:27+03:00 summary: bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst M Lib/test/test_subprocess.py M Modules/_winapi.c diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 10ef87b8495..00dc37bc2c7 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -2742,6 +2742,15 @@ def test_invalid_args(self): stdout=subprocess.PIPE, close_fds=True) + @support.cpython_only + def test_issue31471(self): + # There shouldn't be an assertion failure in Popen() in case the env + # argument has a bad keys() method. + class BadEnv(dict): + keys = None + with self.assertRaises(TypeError): + subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv()) + def test_close_fds(self): # close file descriptors rc = subprocess.call([sys.executable, "-c", diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst new file mode 100644 index 00000000000..73c444444fc --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env +argument has a bad keys() method. Patch by Oren Milman. diff --git a/Modules/_winapi.c b/Modules/_winapi.c index a81ccafdda9..00a26d515e0 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -723,9 +723,13 @@ getenvironment(PyObject* environment) } keys = PyMapping_Keys(environment); + if (!keys) { + return NULL; + } values = PyMapping_Values(environment); - if (!keys || !values) + if (!values) { goto error; + } envsize = PySequence_Fast_GET_SIZE(keys); if (PySequence_Fast_GET_SIZE(values) != envsize) { From webhook-mailer at python.org Thu Sep 14 15:56:37 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 19:56:37 -0000 Subject: [Python-checkins] [3.6] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3584) Message-ID: https://github.com/python/cpython/commit/f135f62cfd1529cbb9326e53728a22afd05b6bc3 commit: f135f62cfd1529cbb9326e53728a22afd05b6bc3 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-14T22:56:31+03:00 summary: [3.6] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3584) (cherry picked from commit 0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst M Lib/test/test_subprocess.py M Modules/_winapi.c diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index df3f7506a93..391d08cd9c3 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -2735,6 +2735,15 @@ def test_invalid_args(self): stdout=subprocess.PIPE, close_fds=True) + @support.cpython_only + def test_issue31471(self): + # There shouldn't be an assertion failure in Popen() in case the env + # argument has a bad keys() method. + class BadEnv(dict): + keys = None + with self.assertRaises(TypeError): + subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv()) + def test_close_fds(self): # close file descriptors rc = subprocess.call([sys.executable, "-c", diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst new file mode 100644 index 00000000000..73c444444fc --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env +argument has a bad keys() method. Patch by Oren Milman. diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 1606f0da772..b98e7789b78 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -723,9 +723,13 @@ getenvironment(PyObject* environment) } keys = PyMapping_Keys(environment); + if (!keys) { + return NULL; + } values = PyMapping_Values(environment); - if (!keys || !values) + if (!values) { goto error; + } envsize = PySequence_Fast_GET_SIZE(keys); if (PySequence_Fast_GET_SIZE(values) != envsize) { From webhook-mailer at python.org Thu Sep 14 16:00:06 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 20:00:06 -0000 Subject: [Python-checkins] bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (#3545) Message-ID: https://github.com/python/cpython/commit/c8d8e15bfc24abeeaaf3d8be9073276b0c011cdf commit: c8d8e15bfc24abeeaaf3d8be9073276b0c011cdf branch: master author: scoder committer: Serhiy Storchaka date: 2017-09-14T23:00:03+03:00 summary: bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (#3545) * Avoid calling "PyObject_GetAttrString()" (and potentially executing user code) with a live exception set. * Ignore only AttributeError on attribute lookups in ElementTree.XMLParser() and propagate all other exceptions. files: A Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst M Lib/test/test_xml_etree.py M Modules/_elementtree.c diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 233b4da58c3..baa4e1f5342 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -2498,6 +2498,31 @@ def close(self): ('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd')) + def test_builder_lookup_errors(self): + class RaisingBuilder: + def __init__(self, raise_in=None, what=ValueError): + self.raise_in = raise_in + self.what = what + + def __getattr__(self, name): + if name == self.raise_in: + raise self.what(self.raise_in) + def handle(*args): + pass + return handle + + ET.XMLParser(target=RaisingBuilder()) + # cET also checks for 'close' and 'doctype', PyET does it only at need + for event in ('start', 'data', 'end', 'comment', 'pi'): + with self.assertRaisesRegex(ValueError, event): + ET.XMLParser(target=RaisingBuilder(event)) + + ET.XMLParser(target=RaisingBuilder(what=AttributeError)) + for event in ('start', 'data', 'end', 'comment', 'pi'): + parser = ET.XMLParser(target=RaisingBuilder(event, what=AttributeError)) + parser.feed(self.sample1) + self.assertIsNone(parser.close()) + class XMLParserTest(unittest.TestCase): sample1 = b'22' diff --git a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst new file mode 100644 index 00000000000..9ea3599ee0b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst @@ -0,0 +1,2 @@ +The C accelerator module of ElementTree ignored exceptions raised when +looking up TreeBuilder target methods in XMLParser(). diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 98d5e7f5062..28d0181594b 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3260,6 +3260,18 @@ xmlparser_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)self; } +static int +ignore_attribute_error(PyObject *value) +{ + if (value == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + return -1; + } + PyErr_Clear(); + } + return 0; +} + /*[clinic input] _elementtree.XMLParser.__init__ @@ -3314,14 +3326,33 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html, self->target = target; self->handle_start = PyObject_GetAttrString(target, "start"); + if (ignore_attribute_error(self->handle_start)) { + return -1; + } self->handle_data = PyObject_GetAttrString(target, "data"); + if (ignore_attribute_error(self->handle_data)) { + return -1; + } self->handle_end = PyObject_GetAttrString(target, "end"); + if (ignore_attribute_error(self->handle_end)) { + return -1; + } self->handle_comment = PyObject_GetAttrString(target, "comment"); + if (ignore_attribute_error(self->handle_comment)) { + return -1; + } self->handle_pi = PyObject_GetAttrString(target, "pi"); + if (ignore_attribute_error(self->handle_pi)) { + return -1; + } self->handle_close = PyObject_GetAttrString(target, "close"); + if (ignore_attribute_error(self->handle_close)) { + return -1; + } self->handle_doctype = PyObject_GetAttrString(target, "doctype"); - - PyErr_Clear(); + if (ignore_attribute_error(self->handle_doctype)) { + return -1; + } /* configure parser */ EXPAT(SetUserData)(self->parser, self); From webhook-mailer at python.org Thu Sep 14 16:05:24 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 20:05:24 -0000 Subject: [Python-checkins] bpo-31234: Join threads in test_threading (#3579) Message-ID: https://github.com/python/cpython/commit/b8c7be2c523b012e57915182543d06657161057f commit: b8c7be2c523b012e57915182543d06657161057f branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T13:05:21-07:00 summary: bpo-31234: Join threads in test_threading (#3579) Call thread.join() to prevent the "dangling thread" warning. files: M Lib/test/test_threading.py diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 912eb3fa67a..ab383c23332 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -578,6 +578,7 @@ def f(): self.assertFalse(t.is_alive()) # And verify the thread disposed of _tstate_lock. self.assertIsNone(t._tstate_lock) + t.join() def test_repr_stopped(self): # Verify that "stopped" shows up in repr(Thread) appropriately. @@ -604,6 +605,7 @@ def f(): break time.sleep(0.01) self.assertIn(LOOKING_FOR, repr(t)) # we waited at least 5 seconds + t.join() def test_BoundedSemaphore_limit(self): # BoundedSemaphore should raise ValueError if released too often. @@ -918,6 +920,7 @@ def test_start_thread_again(self): thread = threading.Thread() thread.start() self.assertRaises(RuntimeError, thread.start) + thread.join() def test_joining_current_thread(self): current_thread = threading.current_thread() @@ -931,6 +934,7 @@ def test_daemonize_active_thread(self): thread = threading.Thread() thread.start() self.assertRaises(RuntimeError, setattr, thread, "daemon", True) + thread.join() def test_releasing_unacquired_lock(self): lock = threading.Lock() From webhook-mailer at python.org Thu Sep 14 16:07:27 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 20:07:27 -0000 Subject: [Python-checkins] bpo-31234: Add test.support.wait_threads_exit() (#3578) Message-ID: https://github.com/python/cpython/commit/ff40ecda73178dfcad24e26240d684356ef20793 commit: ff40ecda73178dfcad24e26240d684356ef20793 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T13:07:24-07:00 summary: bpo-31234: Add test.support.wait_threads_exit() (#3578) Use _thread.count() to wait until threads exit. The new context manager prevents the "dangling thread" warning. files: M Lib/test/lock_tests.py M Lib/test/support/__init__.py M Lib/test/test_socket.py M Lib/test/test_thread.py M Lib/test/test_threading.py M Lib/test/test_threadsignals.py diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py index e8fa4f999a7..a1ea96d42ce 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -31,6 +31,9 @@ def __init__(self, f, n, wait_before_exit=False): self.started = [] self.finished = [] self._can_exit = not wait_before_exit + self.wait_thread = support.wait_threads_exit() + self.wait_thread.__enter__() + def task(): tid = threading.get_ident() self.started.append(tid) @@ -40,6 +43,7 @@ def task(): self.finished.append(tid) while not self._can_exit: _wait() + try: for i in range(n): start_new_thread(task, ()) @@ -54,13 +58,8 @@ def wait_for_started(self): def wait_for_finished(self): while len(self.finished) < self.n: _wait() - # Wait a little bit longer to prevent the "threading_cleanup() - # failed to cleanup X threads" warning. The loop above is a weak - # synchronization. At the C level, t_bootstrap() can still be - # running and so _thread.count() still accounts the "almost dead" - # thead. - for _ in range(self.n): - _wait() + # Wait for threads exit + self.wait_thread.__exit__(None, None, None) def do_finish(self): self._can_exit = True @@ -227,20 +226,23 @@ def test_reacquire(self): # Lock needs to be released before re-acquiring. lock = self.locktype() phase = [] + def f(): lock.acquire() phase.append(None) lock.acquire() phase.append(None) - start_new_thread(f, ()) - while len(phase) == 0: - _wait() - _wait() - self.assertEqual(len(phase), 1) - lock.release() - while len(phase) == 1: + + with support.wait_threads_exit(): + start_new_thread(f, ()) + while len(phase) == 0: + _wait() _wait() - self.assertEqual(len(phase), 2) + self.assertEqual(len(phase), 1) + lock.release() + while len(phase) == 1: + _wait() + self.assertEqual(len(phase), 2) def test_different_thread(self): # Lock can be released from a different thread. diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index df235050ae2..63f7a910710 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2072,6 +2072,41 @@ def decorator(*args): return decorator + at contextlib.contextmanager +def wait_threads_exit(timeout=60.0): + """ + bpo-31234: Context manager to wait until all threads created in the with + statement exit. + + Use _thread.count() to check if threads exited. Indirectly, wait until + threads exit the internal t_bootstrap() C function of the _thread module. + + threading_setup() and threading_cleanup() are designed to emit a warning + if a test leaves running threads in the background. This context manager + is designed to cleanup threads started by the _thread.start_new_thread() + which doesn't allow to wait for thread exit, whereas thread.Thread has a + join() method. + """ + old_count = _thread._count() + try: + yield + finally: + start_time = time.monotonic() + deadline = start_time + timeout + while True: + count = _thread._count() + if count <= old_count: + break + if time.monotonic() > deadline: + dt = time.monotonic() - start_time + msg = (f"wait_threads() failed to cleanup {count - old_count} " + f"threads after {dt:.1f} seconds " + f"(count: {count}, old count: {old_count})") + raise AssertionError(msg) + time.sleep(0.010) + gc_collect() + + def reap_children(): """Use this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 05d8761241e..01502c805cc 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -271,6 +271,9 @@ def serverExplicitReady(self): self.server_ready.set() def _setUp(self): + self.wait_threads = support.wait_threads_exit() + self.wait_threads.__enter__() + self.server_ready = threading.Event() self.client_ready = threading.Event() self.done = threading.Event() @@ -297,6 +300,7 @@ def _setUp(self): def _tearDown(self): self.__tearDown() self.done.wait() + self.wait_threads.__exit__(None, None, None) if self.queue.qsize(): exc = self.queue.get() diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index 2dd1593eaa0..52f6c798b87 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -59,12 +59,13 @@ def task(self, ident): self.done_mutex.release() def test_starting_threads(self): - # Basic test for thread creation. - for i in range(NUMTASKS): - self.newtask() - verbose_print("waiting for tasks to complete...") - self.done_mutex.acquire() - verbose_print("all tasks done") + with support.wait_threads_exit(): + # Basic test for thread creation. + for i in range(NUMTASKS): + self.newtask() + verbose_print("waiting for tasks to complete...") + self.done_mutex.acquire() + verbose_print("all tasks done") def test_stack_size(self): # Various stack size tests. @@ -94,12 +95,13 @@ def test_nt_and_posix_stack_size(self): verbose_print("trying stack_size = (%d)" % tss) self.next_ident = 0 self.created = 0 - for i in range(NUMTASKS): - self.newtask() + with support.wait_threads_exit(): + for i in range(NUMTASKS): + self.newtask() - verbose_print("waiting for all tasks to complete") - self.done_mutex.acquire() - verbose_print("all tasks done") + verbose_print("waiting for all tasks to complete") + self.done_mutex.acquire() + verbose_print("all tasks done") thread.stack_size(0) @@ -109,25 +111,28 @@ def test__count(self): mut = thread.allocate_lock() mut.acquire() started = [] + def task(): started.append(None) mut.acquire() mut.release() - thread.start_new_thread(task, ()) - while not started: - time.sleep(POLL_SLEEP) - self.assertEqual(thread._count(), orig + 1) - # Allow the task to finish. - mut.release() - # The only reliable way to be sure that the thread ended from the - # interpreter's point of view is to wait for the function object to be - # destroyed. - done = [] - wr = weakref.ref(task, lambda _: done.append(None)) - del task - while not done: - time.sleep(POLL_SLEEP) - self.assertEqual(thread._count(), orig) + + with support.wait_threads_exit(): + thread.start_new_thread(task, ()) + while not started: + time.sleep(POLL_SLEEP) + self.assertEqual(thread._count(), orig + 1) + # Allow the task to finish. + mut.release() + # The only reliable way to be sure that the thread ended from the + # interpreter's point of view is to wait for the function object to be + # destroyed. + done = [] + wr = weakref.ref(task, lambda _: done.append(None)) + del task + while not done: + time.sleep(POLL_SLEEP) + self.assertEqual(thread._count(), orig) def test_save_exception_state_on_error(self): # See issue #14474 @@ -140,16 +145,14 @@ def mywrite(self, *args): except ValueError: pass real_write(self, *args) - c = thread._count() started = thread.allocate_lock() with support.captured_output("stderr") as stderr: real_write = stderr.write stderr.write = mywrite started.acquire() - thread.start_new_thread(task, ()) - started.acquire() - while thread._count() > c: - time.sleep(POLL_SLEEP) + with support.wait_threads_exit(): + thread.start_new_thread(task, ()) + started.acquire() self.assertIn("Traceback", stderr.getvalue()) @@ -181,13 +184,14 @@ def enter(self): class BarrierTest(BasicThreadTest): def test_barrier(self): - self.bar = Barrier(NUMTASKS) - self.running = NUMTASKS - for i in range(NUMTASKS): - thread.start_new_thread(self.task2, (i,)) - verbose_print("waiting for tasks to end") - self.done_mutex.acquire() - verbose_print("tasks done") + with support.wait_threads_exit(): + self.bar = Barrier(NUMTASKS) + self.running = NUMTASKS + for i in range(NUMTASKS): + thread.start_new_thread(self.task2, (i,)) + verbose_print("waiting for tasks to end") + self.done_mutex.acquire() + verbose_print("tasks done") def task2(self, ident): for i in range(NUMTRIPS): @@ -225,11 +229,10 @@ def setUp(self): @unittest.skipUnless(hasattr(os, 'fork'), 'need os.fork') @support.reap_threads def test_forkinthread(self): - running = True status = "not set" def thread1(): - nonlocal running, status + nonlocal status # fork in a thread pid = os.fork() @@ -244,13 +247,11 @@ def thread1(): # parent os.close(self.write_fd) pid, status = os.waitpid(pid, 0) - running = False - thread.start_new_thread(thread1, ()) - self.assertEqual(os.read(self.read_fd, 2), b"OK", - "Unable to fork() in thread") - while running: - time.sleep(POLL_SLEEP) + with support.wait_threads_exit(): + thread.start_new_thread(thread1, ()) + self.assertEqual(os.read(self.read_fd, 2), b"OK", + "Unable to fork() in thread") self.assertEqual(status, 0) def tearDown(self): diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index ab383c23332..af6796cd2e6 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -125,9 +125,10 @@ def f(): done.set() done = threading.Event() ident = [] - _thread.start_new_thread(f, ()) - done.wait() - self.assertIsNotNone(ident[0]) + with support.wait_threads_exit(): + tid = _thread.start_new_thread(f, ()) + done.wait() + self.assertEqual(ident[0], tid) # Kill the "immortal" _DummyThread del threading._active[ident[0]] @@ -165,9 +166,10 @@ def f(mutex): mutex = threading.Lock() mutex.acquire() - tid = _thread.start_new_thread(f, (mutex,)) - # Wait for the thread to finish. - mutex.acquire() + with support.wait_threads_exit(): + tid = _thread.start_new_thread(f, (mutex,)) + # Wait for the thread to finish. + mutex.acquire() self.assertIn(tid, threading._active) self.assertIsInstance(threading._active[tid], threading._DummyThread) #Issue 29376 diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py index 9d927423756..f93dd772555 100644 --- a/Lib/test/test_threadsignals.py +++ b/Lib/test/test_threadsignals.py @@ -4,8 +4,8 @@ import signal import os import sys -from test.support import run_unittest, import_module -thread = import_module('_thread') +from test import support +thread = support.import_module('_thread') import time if (sys.platform[:3] == 'win'): @@ -39,13 +39,15 @@ def send_signals(): class ThreadSignals(unittest.TestCase): def test_signals(self): - # Test signal handling semantics of threads. - # We spawn a thread, have the thread send two signals, and - # wait for it to finish. Check that we got both signals - # and that they were run by the main thread. - signalled_all.acquire() - self.spawnSignallingThread() - signalled_all.acquire() + with support.wait_threads_exit(): + # Test signal handling semantics of threads. + # We spawn a thread, have the thread send two signals, and + # wait for it to finish. Check that we got both signals + # and that they were run by the main thread. + signalled_all.acquire() + self.spawnSignallingThread() + signalled_all.acquire() + # the signals that we asked the kernel to send # will come back, but we don't know when. # (it might even be after the thread exits @@ -115,17 +117,19 @@ def test_rlock_acquire_interruption(self): # thread. def other_thread(): rlock.acquire() - thread.start_new_thread(other_thread, ()) - # Wait until we can't acquire it without blocking... - while rlock.acquire(blocking=False): - rlock.release() - time.sleep(0.01) - signal.alarm(1) - t1 = time.time() - self.assertRaises(KeyboardInterrupt, rlock.acquire, timeout=5) - dt = time.time() - t1 - # See rationale above in test_lock_acquire_interruption - self.assertLess(dt, 3.0) + + with support.wait_threads_exit(): + thread.start_new_thread(other_thread, ()) + # Wait until we can't acquire it without blocking... + while rlock.acquire(blocking=False): + rlock.release() + time.sleep(0.01) + signal.alarm(1) + t1 = time.time() + self.assertRaises(KeyboardInterrupt, rlock.acquire, timeout=5) + dt = time.time() - t1 + # See rationale above in test_lock_acquire_interruption + self.assertLess(dt, 3.0) finally: signal.signal(signal.SIGALRM, oldalrm) @@ -133,6 +137,7 @@ def acquire_retries_on_intr(self, lock): self.sig_recvd = False def my_handler(signal, frame): self.sig_recvd = True + old_handler = signal.signal(signal.SIGUSR1, my_handler) try: def other_thread(): @@ -147,14 +152,16 @@ def other_thread(): # the lock acquisition. Then we'll let it run. time.sleep(0.5) lock.release() - thread.start_new_thread(other_thread, ()) - # Wait until we can't acquire it without blocking... - while lock.acquire(blocking=False): - lock.release() - time.sleep(0.01) - result = lock.acquire() # Block while we receive a signal. - self.assertTrue(self.sig_recvd) - self.assertTrue(result) + + with support.wait_threads_exit(): + thread.start_new_thread(other_thread, ()) + # Wait until we can't acquire it without blocking... + while lock.acquire(blocking=False): + lock.release() + time.sleep(0.01) + result = lock.acquire() # Block while we receive a signal. + self.assertTrue(self.sig_recvd) + self.assertTrue(result) finally: signal.signal(signal.SIGUSR1, old_handler) @@ -193,19 +200,20 @@ def send_signals(): os.kill(process_pid, signal.SIGUSR1) done.release() - # Send the signals from the non-main thread, since the main thread - # is the only one that can process signals. - thread.start_new_thread(send_signals, ()) - timed_acquire() - # Wait for thread to finish - done.acquire() - # This allows for some timing and scheduling imprecision - self.assertLess(self.end - self.start, 2.0) - self.assertGreater(self.end - self.start, 0.3) - # If the signal is received several times before PyErr_CheckSignals() - # is called, the handler will get called less than 40 times. Just - # check it's been called at least once. - self.assertGreater(self.sigs_recvd, 0) + with support.wait_threads_exit(): + # Send the signals from the non-main thread, since the main thread + # is the only one that can process signals. + thread.start_new_thread(send_signals, ()) + timed_acquire() + # Wait for thread to finish + done.acquire() + # This allows for some timing and scheduling imprecision + self.assertLess(self.end - self.start, 2.0) + self.assertGreater(self.end - self.start, 0.3) + # If the signal is received several times before PyErr_CheckSignals() + # is called, the handler will get called less than 40 times. Just + # check it's been called at least once. + self.assertGreater(self.sigs_recvd, 0) finally: signal.signal(signal.SIGUSR1, old_handler) @@ -219,7 +227,7 @@ def test_main(): oldsigs = registerSignals(handle_signals, handle_signals, handle_signals) try: - run_unittest(ThreadSignals) + support.run_unittest(ThreadSignals) finally: registerSignals(*oldsigs) From webhook-mailer at python.org Thu Sep 14 16:52:08 2017 From: webhook-mailer at python.org (=?utf-8?q?=C5=81ukasz?= Langa) Date: Thu, 14 Sep 2017 20:52:08 -0000 Subject: [Python-checkins] [3.6] bpo-28556: typing.get_type_hints: better globalns for classes and modules (GH-3582) (#3583) Message-ID: https://github.com/python/cpython/commit/1658ec07577ef9696cea76fcf7fac2da18403ec5 commit: 1658ec07577ef9696cea76fcf7fac2da18403ec5 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: ?ukasz Langa date: 2017-09-14T16:52:05-04:00 summary: [3.6] bpo-28556: typing.get_type_hints: better globalns for classes and modules (GH-3582) (#3583) This makes the default behavior (without specifying `globalns` manually) more predictable for users, finds the right globalns automatically. Implementation for classes assumes has a `__module__` attribute and that module is present in `sys.modules`. It does this recursively for all bases in the MRO. For modules, the implementation just uses their `__dict__` directly. This is backwards compatible, will just raise fewer exceptions in naive user code. Originally implemented and reviewed at https://github.com/python/typing/pull/470. (cherry picked from commit f350a268a7071ce7d7a5bb86a9b1229782d4963b) files: A Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst M Lib/test/mod_generics_cache.py M Lib/test/test_typing.py M Lib/typing.py diff --git a/Lib/test/mod_generics_cache.py b/Lib/test/mod_generics_cache.py index d9a60b4b28c..6d35c58396d 100644 --- a/Lib/test/mod_generics_cache.py +++ b/Lib/test/mod_generics_cache.py @@ -1,14 +1,53 @@ """Module for testing the behavior of generics across different modules.""" -from typing import TypeVar, Generic +import sys +from textwrap import dedent +from typing import TypeVar, Generic, Optional -T = TypeVar('T') +if sys.version_info[:2] >= (3, 6): + exec(dedent(""" + default_a: Optional['A'] = None + default_b: Optional['B'] = None -class A(Generic[T]): - pass + T = TypeVar('T') -class B(Generic[T]): class A(Generic[T]): - pass + some_b: 'B' + + + class B(Generic[T]): + class A(Generic[T]): + pass + + my_inner_a1: 'B.A' + my_inner_a2: A + my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__ + """)) +else: # This should stay in sync with the syntax above. + __annotations__ = dict( + default_a=Optional['A'], + default_b=Optional['B'], + ) + default_a = None + default_b = None + + T = TypeVar('T') + + + class A(Generic[T]): + __annotations__ = dict( + some_b='B' + ) + + + class B(Generic[T]): + class A(Generic[T]): + pass + + __annotations__ = dict( + my_inner_a1='B.A', + my_inner_a2=A, + my_outer_a='A' # unless somebody calls get_type_hints with localns=B.__dict__ + ) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index ff634e8c2a0..a3b2ea7f03e 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ import pickle import re import sys -from unittest import TestCase, main, skipUnless, SkipTest +from unittest import TestCase, main, skipUnless, SkipTest, expectedFailure from copy import copy, deepcopy from typing import Any, NoReturn @@ -30,6 +30,13 @@ import collections as collections_abc # Fallback for PY3.2. +try: + import mod_generics_cache +except ImportError: + # try to use the builtin one, Python 3.5+ + from test import mod_generics_cache + + class BaseTestCase(TestCase): def assertIsSubclass(self, cls, class_or_tuple, msg=None): @@ -836,10 +843,6 @@ def test_subscript_meta(self): self.assertEqual(Callable[..., GenericMeta].__args__, (Ellipsis, GenericMeta)) def test_generic_hashes(self): - try: - from test import mod_generics_cache - except ImportError: # for Python 3.4 and previous versions - import mod_generics_cache class A(Generic[T]): ... @@ -1619,6 +1622,10 @@ def __str__(self): def __add__(self, other): return 0 +class HasForeignBaseClass(mod_generics_cache.A): + some_xrepr: 'XRepr' + other_a: 'mod_generics_cache.A' + async def g_with(am: AsyncContextManager[int]): x: int async with am as x: @@ -1659,8 +1666,18 @@ def test_get_type_hints_modules(self): self.assertEqual(gth(ann_module3), {}) @skipUnless(PY36, 'Python 3.6 required') + @expectedFailure + def test_get_type_hints_modules_forwardref(self): + # FIXME: This currently exposes a bug in typing. Cached forward references + # don't account for the case where there are multiple types of the same + # name coming from different modules in the same program. + mgc_hints = {'default_a': Optional[mod_generics_cache.A], + 'default_b': Optional[mod_generics_cache.B]} + self.assertEqual(gth(mod_generics_cache), mgc_hints) + + @skipUnless(PY36, 'Python 3.6 required') def test_get_type_hints_classes(self): - self.assertEqual(gth(ann_module.C, ann_module.__dict__), + self.assertEqual(gth(ann_module.C), # gth will find the right globalns {'y': Optional[ann_module.C]}) self.assertIsInstance(gth(ann_module.j_class), dict) self.assertEqual(gth(ann_module.M), {'123': 123, 'o': type}) @@ -1671,8 +1688,15 @@ def test_get_type_hints_classes(self): {'y': Optional[ann_module.C]}) self.assertEqual(gth(ann_module.S), {'x': str, 'y': str}) self.assertEqual(gth(ann_module.foo), {'x': int}) - self.assertEqual(gth(NoneAndForward, globals()), + self.assertEqual(gth(NoneAndForward), {'parent': NoneAndForward, 'meaning': type(None)}) + self.assertEqual(gth(HasForeignBaseClass), + {'some_xrepr': XRepr, 'other_a': mod_generics_cache.A, + 'some_b': mod_generics_cache.B}) + self.assertEqual(gth(mod_generics_cache.B), + {'my_inner_a1': mod_generics_cache.B.A, + 'my_inner_a2': mod_generics_cache.B.A, + 'my_outer_a': mod_generics_cache.A}) @skipUnless(PY36, 'Python 3.6 required') def test_respect_no_type_check(self): diff --git a/Lib/typing.py b/Lib/typing.py index 609f813b01e..c00a3a10e1f 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1481,8 +1481,9 @@ def get_type_hints(obj, globalns=None, localns=None): search order is locals first, then globals. - If no dict arguments are passed, an attempt is made to use the - globals from obj, and these are also used as the locals. If the - object does not appear to have globals, an exception is raised. + globals from obj (or the respective module's globals for classes), + and these are also used as the locals. If the object does not appear + to have globals, an empty dictionary is used. - If one dict argument is passed, it is used for both globals and locals. @@ -1493,25 +1494,33 @@ def get_type_hints(obj, globalns=None, localns=None): if getattr(obj, '__no_type_check__', None): return {} - if globalns is None: - globalns = getattr(obj, '__globals__', {}) - if localns is None: - localns = globalns - elif localns is None: - localns = globalns # Classes require a special treatment. if isinstance(obj, type): hints = {} for base in reversed(obj.__mro__): + if globalns is None: + base_globals = sys.modules[base.__module__].__dict__ + else: + base_globals = globalns ann = base.__dict__.get('__annotations__', {}) for name, value in ann.items(): if value is None: value = type(None) if isinstance(value, str): value = _ForwardRef(value) - value = _eval_type(value, globalns, localns) + value = _eval_type(value, base_globals, localns) hints[name] = value return hints + + if globalns is None: + if isinstance(obj, types.ModuleType): + globalns = obj.__dict__ + else: + globalns = getattr(obj, '__globals__', {}) + if localns is None: + localns = globalns + elif localns is None: + localns = globalns hints = getattr(obj, '__annotations__', None) if hints is None: # Return empty annotations for something that _could_ have them. diff --git a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst new file mode 100644 index 00000000000..8464d59a0cb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst @@ -0,0 +1,2 @@ +typing.get_type_hints now finds the right globalns for classes and modules +by default (when no ``globalns`` was specified by the caller). From webhook-mailer at python.org Thu Sep 14 17:04:58 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 21:04:58 -0000 Subject: [Python-checkins] bpo-31234: Join threads in test_queue (#3586) Message-ID: https://github.com/python/cpython/commit/167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 commit: 167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T14:04:56-07:00 summary: bpo-31234: Join threads in test_queue (#3586) Call thread.join() to prevent the "dangling thread" warning. files: M Lib/test/test_queue.py diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 718ed671b92..e501669eb6e 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -47,28 +47,27 @@ def run(self): class BlockingTestMixin: - def tearDown(self): - self.t = None - def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): - self.t = _TriggerThread(trigger_func, trigger_args) - self.t.start() - self.result = block_func(*block_args) - # If block_func returned before our thread made the call, we failed! - if not self.t.startedEvent.is_set(): - self.fail("blocking function '%r' appeared not to block" % - block_func) - self.t.join(10) # make sure the thread terminates - if self.t.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) - return self.result + thread = _TriggerThread(trigger_func, trigger_args) + thread.start() + try: + self.result = block_func(*block_args) + # If block_func returned before our thread made the call, we failed! + if not thread.startedEvent.is_set(): + self.fail("blocking function '%r' appeared not to block" % + block_func) + return self.result + finally: + thread.join(10) # make sure the thread terminates + if thread.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) # Call this instead if block_func is supposed to raise an exception. def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, trigger_args, expected_exception_class): - self.t = _TriggerThread(trigger_func, trigger_args) - self.t.start() + thread = _TriggerThread(trigger_func, trigger_args) + thread.start() try: try: block_func(*block_args) @@ -78,11 +77,11 @@ def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, self.fail("expected exception of kind %r" % expected_exception_class) finally: - self.t.join(10) # make sure the thread terminates - if self.t.is_alive(): + thread.join(10) # make sure the thread terminates + if thread.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) - if not self.t.startedEvent.is_set(): + if not thread.startedEvent.is_set(): self.fail("trigger thread ended but event never set") @@ -160,8 +159,11 @@ def worker(self, q): def queue_join_test(self, q): self.cum = 0 + threads = [] for i in (0,1): - threading.Thread(target=self.worker, args=(q,)).start() + thread = threading.Thread(target=self.worker, args=(q,)) + thread.start() + threads.append(thread) for i in range(100): q.put(i) q.join() @@ -170,6 +172,8 @@ def queue_join_test(self, q): for i in (0,1): q.put(-1) # instruct the threads to close q.join() # verify that you can join twice + for thread in threads: + thread.join() def test_queue_task_done(self): # Test to make sure a queue task completed successfully. From webhook-mailer at python.org Thu Sep 14 17:40:59 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 21:40:59 -0000 Subject: [Python-checkins] bpo-31234: Add support.join_thread() helper (#3587) Message-ID: https://github.com/python/cpython/commit/b9b69003d91c6ea94b890ce24ed25686d30f1428 commit: b9b69003d91c6ea94b890ce24ed25686d30f1428 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T14:40:56-07:00 summary: bpo-31234: Add support.join_thread() helper (#3587) join_thread() joins a thread but raises an AssertionError if the thread is still alive after timeout seconds. files: M Lib/test/_test_multiprocessing.py M Lib/test/support/__init__.py M Lib/test/test_asynchat.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_asyncore.py M Lib/test/test_imaplib.py M Lib/test/test_logging.py M Lib/test/test_queue.py M Lib/test/test_sched.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index d6fe7d62675..bddcdadfeee 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -21,6 +21,7 @@ import weakref import test.support import test.support.script_helper +from test import support # Skip tests if _multiprocessing wasn't built. @@ -72,6 +73,12 @@ def close_queue(queue): queue.join_thread() +def join_process(process, timeout): + # Since multiprocessing.Process has the same API than threading.Thread + # (join() and is_alive(), the support function can be reused + support.join_thread(process, timeout) + + # # Constants # @@ -477,7 +484,7 @@ def test_many_processes(self): for p in procs: p.start() for p in procs: - p.join(timeout=10) + join_process(p, timeout=10) for p in procs: self.assertEqual(p.exitcode, 0) @@ -489,7 +496,7 @@ def test_many_processes(self): for p in procs: p.terminate() for p in procs: - p.join(timeout=10) + join_process(p, timeout=10) if os.name != 'nt': for p in procs: self.assertEqual(p.exitcode, -signal.SIGTERM) @@ -652,7 +659,7 @@ def test_sys_exit(self): p = self.Process(target=self._test_sys_exit, args=(reason, testfn)) p.daemon = True p.start() - p.join(5) + join_process(p, timeout=5) self.assertEqual(p.exitcode, 1) with open(testfn, 'r') as f: @@ -665,7 +672,7 @@ def test_sys_exit(self): p = self.Process(target=sys.exit, args=(reason,)) p.daemon = True p.start() - p.join(5) + join_process(p, timeout=5) self.assertEqual(p.exitcode, reason) # @@ -1254,8 +1261,7 @@ def test_waitfor(self): state.value += 1 cond.notify() - p.join(5) - self.assertFalse(p.is_alive()) + join_process(p, timeout=5) self.assertEqual(p.exitcode, 0) @classmethod @@ -1291,7 +1297,7 @@ def test_waitfor_timeout(self): state.value += 1 cond.notify() - p.join(5) + join_process(p, timeout=5) self.assertTrue(success.value) @classmethod @@ -4005,7 +4011,7 @@ def test_timeout(self): self.assertEqual(conn.recv(), 456) conn.close() l.close() - p.join(10) + join_process(p, timeout=10) finally: socket.setdefaulttimeout(old_timeout) @@ -4041,7 +4047,7 @@ def child(cls, n, conn): p = multiprocessing.Process(target=cls.child, args=(n-1, conn)) p.start() conn.close() - p.join(timeout=5) + join_process(p, timeout=5) else: conn.send(len(util._afterfork_registry)) conn.close() @@ -4054,7 +4060,7 @@ def test_lock(self): p.start() w.close() new_size = r.recv() - p.join(timeout=5) + join_process(p, timeout=5) self.assertLessEqual(new_size, old_size) # @@ -4109,7 +4115,7 @@ def test_closefd(self): p.start() writer.close() e = reader.recv() - p.join(timeout=5) + join_process(p, timeout=5) finally: self.close(fd) writer.close() diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 63f7a910710..b2e45605b9e 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2107,6 +2107,16 @@ def wait_threads_exit(timeout=60.0): gc_collect() +def join_thread(thread, timeout=30.0): + """Join a thread. Raise an AssertionError if the thread is still alive + after timeout seconds. + """ + thread.join(timeout) + if thread.is_alive(): + msg = f"failed to join the thread in {timeout:.1f} seconds" + raise AssertionError(msg) + + def reap_children(): """Use this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 2362834b85f..1d147c74196 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -123,9 +123,7 @@ def line_terminator_check(self, term, server_chunk): c.push(b"I'm not dead yet!" + term) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -156,9 +154,7 @@ def numeric_terminator_check(self, termlen): c.push(data) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [data[:termlen]]) @@ -178,9 +174,7 @@ def test_none_terminator(self): c.push(data) c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, []) self.assertEqual(c.buffer, data) @@ -192,9 +186,7 @@ def test_simple_producer(self): p = asynchat.simple_producer(data+SERVER_QUIT, buffer_size=8) c.push_with_producer(p) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -204,9 +196,7 @@ def test_string_producer(self): data = b"hello world\nI'm not dead yet!\n" c.push_with_producer(data+SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) @@ -217,9 +207,7 @@ def test_empty_line(self): c.push(b"hello world\n\nI'm not dead yet!\n") c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [b"hello world", b"", b"I'm not dead yet!"]) @@ -238,9 +226,7 @@ def test_close_when_done(self): # where the server echoes all of its data before we can check that it # got any down below. s.start_resend_event.set() - s.join(timeout=TIMEOUT) - if s.is_alive(): - self.fail("join() timed out") + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, []) # the server might have been able to send a byte or two back, but this @@ -261,7 +247,7 @@ def test_push(self): self.assertRaises(TypeError, c.push, 'unicode') c.push(SERVER_QUIT) asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) - s.join(timeout=TIMEOUT) + support.join_thread(s, timeout=TIMEOUT) self.assertEqual(c.contents, [b'bytes', b'bytes', b'bytes']) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 27781a2d91b..33421ce4c37 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -808,7 +808,7 @@ def client(): proto.transport.close() lsock.close() - thread.join(1) + support.join_thread(thread, timeout=1) self.assertFalse(thread.is_alive()) self.assertEqual(proto.state, 'CLOSED') self.assertEqual(proto.nbytes, len(message)) diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index c8e97276ff6..ee0c3b371f8 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -360,9 +360,7 @@ def test_send(self): self.assertEqual(cap.getvalue(), data*2) finally: - t.join(timeout=TIMEOUT) - if t.is_alive(): - self.fail("join() timed out") + support.join_thread(t, timeout=TIMEOUT) @unittest.skipUnless(hasattr(asyncore, 'file_wrapper'), @@ -794,9 +792,7 @@ def test_quick_connect(self): except OSError: pass finally: - t.join(timeout=TIMEOUT) - if t.is_alive(): - self.fail("join() timed out") + support.join_thread(t, timeout=TIMEOUT) class TestAPI_UseIPv4Sockets(BaseTestAPI): family = socket.AF_INET diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 132c58624fe..2b62b05a594 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -220,7 +220,9 @@ def _cleanup(self): # cleanup the server self.server.shutdown() self.server.server_close() - self.thread.join(3.0) + support.join_thread(self.thread, 3.0) + # Explicitly clear the attribute to prevent dangling thread + self.thread = None def test_EOF_without_complete_welcome_message(self): # http://bugs.python.org/issue5949 diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 611044d8fa8..d264d786720 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -791,13 +791,10 @@ def stop(self, timeout=None): to terminate. """ self.close() - self._thread.join(timeout) + support.join_thread(self._thread, timeout) + self._thread = None asyncore.close_all(map=self._map, ignore_all=True) - alive = self._thread.is_alive() - self._thread = None - if alive: - self.fail("join() timed out") class ControlMixin(object): """ @@ -847,11 +844,8 @@ def stop(self, timeout=None): """ self.shutdown() if self._thread is not None: - self._thread.join(timeout) - alive = self._thread.is_alive() + support.join_thread(self._thread, timeout) self._thread = None - if alive: - self.fail("join() timed out") self.server_close() self.ready.clear() @@ -2892,9 +2886,7 @@ def setup_via_listener(self, text, verify=None): finally: t.ready.wait(2.0) logging.config.stopListening() - t.join(2.0) - if t.is_alive(): - self.fail("join() timed out") + support.join_thread(t, 2.0) def test_listen_config_10_ok(self): with support.captured_stdout() as output: diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index e501669eb6e..35466c1eae3 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -58,10 +58,7 @@ def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): block_func) return self.result finally: - thread.join(10) # make sure the thread terminates - if thread.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) + support.join_thread(thread, 10) # make sure the thread terminates # Call this instead if block_func is supposed to raise an exception. def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, @@ -77,10 +74,7 @@ def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, self.fail("expected exception of kind %r" % expected_exception_class) finally: - thread.join(10) # make sure the thread terminates - if thread.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) + support.join_thread(thread, 10) # make sure the thread terminates if not thread.startedEvent.is_set(): self.fail("trigger thread ended but event never set") diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index 794c6374c45..3f84af2a4c2 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -3,6 +3,7 @@ import threading import time import unittest +from test import support TIMEOUT = 10 @@ -81,8 +82,7 @@ def test_enter_concurrent(self): self.assertEqual(q.get(timeout=TIMEOUT), 5) self.assertTrue(q.empty()) timer.advance(1000) - t.join(timeout=TIMEOUT) - self.assertFalse(t.is_alive()) + support.join_thread(t, timeout=TIMEOUT) self.assertTrue(q.empty()) self.assertEqual(timer.time(), 5) @@ -137,8 +137,7 @@ def test_cancel_concurrent(self): self.assertEqual(q.get(timeout=TIMEOUT), 4) self.assertTrue(q.empty()) timer.advance(1000) - t.join(timeout=TIMEOUT) - self.assertFalse(t.is_alive()) + support.join_thread(t, timeout=TIMEOUT) self.assertTrue(q.empty()) self.assertEqual(timer.time(), 4) From webhook-mailer at python.org Thu Sep 14 17:48:40 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Thu, 14 Sep 2017 21:48:40 -0000 Subject: [Python-checkins] bpo-30860: Fix deadcode in obmalloc.c (#3499) Message-ID: https://github.com/python/cpython/commit/ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43 commit: ccb3c7654cc3d031fb93bf443a6ef9cfb11f6b43 branch: master author: Victor Stinner committer: GitHub date: 2017-09-14T14:48:37-07:00 summary: bpo-30860: Fix deadcode in obmalloc.c (#3499) Fix Coverity CID 1417587: _PyMem_Initialize() contains code which is never executed. Replace the runtime check with a build assertion. files: M Objects/obmalloc.c diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 57edf97e206..f2651d7574b 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -297,9 +297,9 @@ _PyMem_Initialize(struct _pymem_runtime_state *state) state->allocators.obj = _pyobject; #ifdef WITH_PYMALLOC + Py_BUILD_ASSERT(NB_SMALL_SIZE_CLASSES == 64); + for (int i = 0; i < 8; i++) { - if (NB_SMALL_SIZE_CLASSES <= i * 8) - break; for (int j = 0; j < 8; j++) { int x = i * 8 + j; poolp *addr = &(state->usedpools[2*(x)]); From webhook-mailer at python.org Thu Sep 14 17:54:12 2017 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Thu, 14 Sep 2017 21:54:12 -0000 Subject: [Python-checkins] bpo-31128: Allow pydoc to bind to arbitrary hostnames (#3011) Message-ID: https://github.com/python/cpython/commit/6a396c9807b1674a24e240731f18e20de97117a5 commit: 6a396c9807b1674a24e240731f18e20de97117a5 branch: master author: Feanil Patel committer: ?ric Araujo date: 2017-09-14T17:54:09-04:00 summary: bpo-31128: Allow pydoc to bind to arbitrary hostnames (#3011) New -n flag allow overriding localhost with custom value, for example to run from containers. files: A Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst M Doc/library/pydoc.rst M Lib/pydoc.py M Lib/test/test_pydoc.py M Misc/ACKS diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst index f1bfab9a3b1..f956b9d2176 100644 --- a/Doc/library/pydoc.rst +++ b/Doc/library/pydoc.rst @@ -70,6 +70,12 @@ will start a HTTP server on port 1234, allowing you to browse the documentation at ``http://localhost:1234/`` in your preferred Web browser. Specifying ``0`` as the port number will select an arbitrary unused port. +:program:`pydoc -n ` will start the server listening at the given +hostname. By default the hostname is 'localhost' but if you want the server to +be reached from other machines, you may want to change the host name that the +server responds to. During development this is especially useful if you want +to run pydoc from within a container. + :program:`pydoc -b` will start the server and additionally open a web browser to a module index page. Each served page has a navigation bar at the top where you can *Get* help on an individual item, *Search* all modules with a @@ -98,3 +104,6 @@ Reference Manual pages. :mod:`pydoc` now uses :func:`inspect.signature` rather than :func:`inspect.getfullargspec` to extract signature information from callables. + +.. versionchanged:: 3.7 + Added the ``-n`` option. diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 5edc77005a8..8dc3c0ace3c 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -16,12 +16,15 @@ class or function within a module or module in a package. If the Run "pydoc -k " to search for a keyword in the synopsis lines of all available modules. +Run "pydoc -n " to start an HTTP server with the given +hostname (default: localhost) on the local machine. + Run "pydoc -p " to start an HTTP server on the given port on the local machine. Port number 0 can be used to get an arbitrary unused port. Run "pydoc -b" to start an HTTP server on an arbitrary unused port and -open a Web browser to interactively browse documentation. The -p option -can be used with the -b option to explicitly specify the server port. +open a Web browser to interactively browse documentation. Combine with +the -n and -p options to control the hostname and port used. Run "pydoc -w " to write out the HTML documentation for a module to a file named ".html". @@ -2162,7 +2165,7 @@ def onerror(modname): # --------------------------------------- enhanced Web browser interface -def _start_server(urlhandler, port): +def _start_server(urlhandler, hostname, port): """Start an HTTP server thread on a specific port. Start an HTML/text server thread, so HTML or text documents can be @@ -2247,8 +2250,8 @@ def log_message(self, *args): class DocServer(http.server.HTTPServer): - def __init__(self, port, callback): - self.host = 'localhost' + def __init__(self, host, port, callback): + self.host = host self.address = (self.host, port) self.callback = callback self.base.__init__(self, self.address, self.handler) @@ -2268,8 +2271,9 @@ def server_activate(self): class ServerThread(threading.Thread): - def __init__(self, urlhandler, port): + def __init__(self, urlhandler, host, port): self.urlhandler = urlhandler + self.host = host self.port = int(port) threading.Thread.__init__(self) self.serving = False @@ -2282,7 +2286,7 @@ def run(self): DocServer.handler = DocHandler DocHandler.MessageClass = email.message.Message DocHandler.urlhandler = staticmethod(self.urlhandler) - docsvr = DocServer(self.port, self.ready) + docsvr = DocServer(self.host, self.port, self.ready) self.docserver = docsvr docsvr.serve_until_quit() except Exception as e: @@ -2304,7 +2308,7 @@ def stop(self): self.serving = False self.url = None - thread = ServerThread(urlhandler, port) + thread = ServerThread(urlhandler, hostname, port) thread.start() # Wait until thread.serving is True to make sure we are # really up before returning. @@ -2568,14 +2572,14 @@ def get_html_page(url): raise TypeError('unknown content type %r for url %s' % (content_type, url)) -def browse(port=0, *, open_browser=True): +def browse(port=0, *, open_browser=True, hostname='localhost'): """Start the enhanced pydoc Web server and open a Web browser. Use port '0' to start the server on an arbitrary port. Set open_browser to False to suppress opening a browser. """ import webbrowser - serverthread = _start_server(_url_handler, port) + serverthread = _start_server(_url_handler, hostname, port) if serverthread.error: print(serverthread.error) return @@ -2622,11 +2626,12 @@ class BadUsage(Exception): pass sys.path.insert(0, '.') try: - opts, args = getopt.getopt(sys.argv[1:], 'bk:p:w') + opts, args = getopt.getopt(sys.argv[1:], 'bk:n:p:w') writing = False start_server = False open_browser = False - port = None + port = 0 + hostname = 'localhost' for opt, val in opts: if opt == '-b': start_server = True @@ -2639,11 +2644,12 @@ class BadUsage(Exception): pass port = val if opt == '-w': writing = True + if opt == '-n': + start_server = True + hostname = val if start_server: - if port is None: - port = 0 - browse(port, open_browser=open_browser) + browse(port, hostname=hostname, open_browser=open_browser) return if not args: raise BadUsage @@ -2679,14 +2685,17 @@ class BadUsage(Exception): pass {cmd} -k Search for a keyword in the synopsis lines of all available modules. +{cmd} -n + Start an HTTP server with the given hostname (default: localhost). + {cmd} -p Start an HTTP server on the given port on the local machine. Port number 0 can be used to get an arbitrary unused port. {cmd} -b Start an HTTP server on an arbitrary unused port and open a Web browser - to interactively browse documentation. The -p option can be used with - the -b option to explicitly specify the server port. + to interactively browse documentation. This option can be used in + combination with -n and/or -p. {cmd} -w ... Write out the HTML documentation for a module to a file in the current diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 1ac08edb48e..52830b49aea 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -909,8 +909,8 @@ def my_url_handler(url, content_type): text = 'the URL sent was: (%s, %s)' % (url, content_type) return text - serverthread = pydoc._start_server(my_url_handler, port=0) - self.assertIn('localhost', serverthread.docserver.address) + serverthread = pydoc._start_server(my_url_handler, hostname='0.0.0.0', port=0) + self.assertIn('0.0.0.0', serverthread.docserver.address) starttime = time.time() timeout = 1 #seconds diff --git a/Misc/ACKS b/Misc/ACKS index 462a74eb056..0f6ac7d898a 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1177,6 +1177,7 @@ Claude Paroz Heikki Partanen Harri Pasanen Ga?l Pasgrimaud +Feanil Patel Ashish Nitin Patil Alecsandru Patrascu Randy Pausch diff --git a/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst b/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst new file mode 100644 index 00000000000..480ec6b2869 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst @@ -0,0 +1 @@ +Allow the pydoc server to bind to arbitrary hostnames. From webhook-mailer at python.org Thu Sep 14 18:51:53 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Thu, 14 Sep 2017 22:51:53 -0000 Subject: [Python-checkins] bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (#3590) Message-ID: https://github.com/python/cpython/commit/d384a81f557dab0b142bfcc9850bc68df46496ef commit: d384a81f557dab0b142bfcc9850bc68df46496ef branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-14T18:51:51-04:00 summary: bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (#3590) Enabled by default was a temporary expedient. The fix is to add a user override to enable. files: A Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst M Lib/idlelib/config-extensions.def M Lib/idlelib/idle_test/test_config.py M Lib/idlelib/idle_test/test_configdialog.py diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index e8d417bac0d..8689fd965e8 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -55,7 +55,7 @@ bell= True # A fake extension for testing and example purposes. When enabled and # invoked, inserts or deletes z-text at beginning of every line. [ZzDummy] -enable= True +enable= False enable_shell = False enable_editor = True z-text= Z diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py index 84b45a63767..abfec7993e0 100644 --- a/Lib/idlelib/idle_test/test_config.py +++ b/Lib/idlelib/idle_test/test_config.py @@ -26,6 +26,7 @@ usermain = testcfg['main'] = config.IdleUserConfParser('') userhigh = testcfg['highlight'] = config.IdleUserConfParser('') userkeys = testcfg['keys'] = config.IdleUserConfParser('') +userextn = testcfg['extensions'] = config.IdleUserConfParser('') def setUpModule(): idleConf.userCfg = testcfg @@ -430,29 +431,22 @@ def test_default_keys(self): sys.platform = current_platform def test_get_extensions(self): - conf = self.mock_config() - - # Add disable extensions - conf.SetOption('extensions', 'DISABLE', 'enable', 'False') - + userextn.read_string(''' + [ZzDummy] + enable = True + [DISABLE] + enable = False + ''') eq = self.assertEqual - eq(conf.GetExtensions(), - ['ZzDummy']) - eq(conf.GetExtensions(active_only=False), - ['ZzDummy', 'DISABLE']) - eq(conf.GetExtensions(editor_only=True), - ['ZzDummy']) - eq(conf.GetExtensions(shell_only=True), - []) - eq(conf.GetExtensions(active_only=False, editor_only=True), - ['ZzDummy', 'DISABLE']) - - # Add user extensions - conf.SetOption('extensions', 'Foobar', 'enable', 'True') - eq(conf.GetExtensions(), - ['ZzDummy', 'Foobar']) # User extensions didn't sort - eq(conf.GetExtensions(active_only=False), - ['ZzDummy', 'DISABLE', 'Foobar']) + iGE = idleConf.GetExtensions + eq(iGE(shell_only=True), []) + eq(iGE(), ['ZzDummy']) + eq(iGE(editor_only=True), ['ZzDummy']) + eq(iGE(active_only=False), ['ZzDummy', 'DISABLE']) + eq(iGE(active_only=False, editor_only=True), ['ZzDummy', 'DISABLE']) + userextn.remove_section('ZzDummy') + userextn.remove_section('DISABLE') + def test_remove_key_bind_names(self): conf = self.mock_config() @@ -462,39 +456,39 @@ def test_remove_key_bind_names(self): ['AutoComplete', 'CodeContext', 'FormatParagraph', 'ParenMatch','ZzDummy']) def test_get_extn_name_for_event(self): - conf = self.mock_config() - + userextn.read_string(''' + [ZzDummy] + enable = True + ''') eq = self.assertEqual - eq(conf.GetExtnNameForEvent('z-in'), 'ZzDummy') - eq(conf.GetExtnNameForEvent('z-out'), None) + eq(idleConf.GetExtnNameForEvent('z-in'), 'ZzDummy') + eq(idleConf.GetExtnNameForEvent('z-out'), None) + userextn.remove_section('ZzDummy') def test_get_extension_keys(self): - conf = self.mock_config() - - eq = self.assertEqual - eq(conf.GetExtensionKeys('ZzDummy'), + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + self.assertEqual(idleConf.GetExtensionKeys('ZzDummy'), {'<>': ['']}) + userextn.remove_section('ZzDummy') # need option key test ## key = [''] if sys.platform == 'darwin' else [''] ## eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) def test_get_extension_bindings(self): - conf = self.mock_config() - - self.assertEqual(conf.GetExtensionBindings('NotExists'), {}) - - #key = [''] if sys.platform == 'darwin' else [''] + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + eq = self.assertEqual + iGEB = idleConf.GetExtensionBindings + eq(iGEB('NotExists'), {}) expect = {'<>': [''], '<>': ['']} - self.assertEqual( - conf.GetExtensionBindings('ZzDummy'), expect) - - # Add non-configuarable bindings - conf.defaultCfg['extensions'].add_section('Foobar') - conf.defaultCfg['extensions'].add_section('Foobar_bindings') - conf.defaultCfg['extensions'].set('Foobar', 'enable', 'True') - conf.defaultCfg['extensions'].set('Foobar_bindings', 'foobar', '') - self.assertEqual(conf.GetExtensionBindings('Foobar'), {'<>': ['']}) + eq(iGEB('ZzDummy'), expect) + userextn.remove_section('ZzDummy') def test_get_keybinding(self): conf = self.mock_config() diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index cae7186415b..dc7f69c2af8 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -820,6 +820,7 @@ def test_custom_name(self): self.assertEqual(d.load_keys_list.called, 1) def test_keybinding(self): + idleConf.SetOption('extensions', 'ZzDummy', 'enable', 'True') d = self.page d.custom_name.set('my custom keys') d.bindingslist.delete(0, 'end') diff --git a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst new file mode 100644 index 00000000000..5999e9a8f27 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst @@ -0,0 +1 @@ +IDLE - make tests pass with zzdummy extension disabled by default. From webhook-mailer at python.org Thu Sep 14 19:13:24 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 14 Sep 2017 23:13:24 -0000 Subject: [Python-checkins] [3.6] bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (GH-3545) (#3585) Message-ID: https://github.com/python/cpython/commit/49caab46f687eb201898fb6c2c40d47bdcb0e58b commit: 49caab46f687eb201898fb6c2c40d47bdcb0e58b branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-15T02:13:21+03:00 summary: [3.6] bpo-31455: Fix an assertion failure in ElementTree.XMLParser(). (GH-3545) (#3585) * Avoid calling "PyObject_GetAttrString()" (and potentially executing user code) with a live exception set. * Ignore only AttributeError on attribute lookups in ElementTree.XMLParser() and propagate all other exceptions. (cherry picked from commit c8d8e15bfc24abeeaaf3d8be9073276b0c011cdf) files: A Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst M Lib/test/test_xml_etree.py M Modules/_elementtree.c diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 15af1fc5336..ad0ffb31aa4 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -2476,6 +2476,31 @@ def close(self): ('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd')) + def test_builder_lookup_errors(self): + class RaisingBuilder: + def __init__(self, raise_in=None, what=ValueError): + self.raise_in = raise_in + self.what = what + + def __getattr__(self, name): + if name == self.raise_in: + raise self.what(self.raise_in) + def handle(*args): + pass + return handle + + ET.XMLParser(target=RaisingBuilder()) + # cET also checks for 'close' and 'doctype', PyET does it only at need + for event in ('start', 'data', 'end', 'comment', 'pi'): + with self.assertRaisesRegex(ValueError, event): + ET.XMLParser(target=RaisingBuilder(event)) + + ET.XMLParser(target=RaisingBuilder(what=AttributeError)) + for event in ('start', 'data', 'end', 'comment', 'pi'): + parser = ET.XMLParser(target=RaisingBuilder(event, what=AttributeError)) + parser.feed(self.sample1) + self.assertIsNone(parser.close()) + class XMLParserTest(unittest.TestCase): sample1 = b'22' diff --git a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst new file mode 100644 index 00000000000..9ea3599ee0b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst @@ -0,0 +1,2 @@ +The C accelerator module of ElementTree ignored exceptions raised when +looking up TreeBuilder target methods in XMLParser(). diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index ccf5e6a78fd..cf3e687c8c6 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3224,6 +3224,18 @@ xmlparser_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)self; } +static int +ignore_attribute_error(PyObject *value) +{ + if (value == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + return -1; + } + PyErr_Clear(); + } + return 0; +} + /*[clinic input] _elementtree.XMLParser.__init__ @@ -3270,14 +3282,33 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html, self->target = target; self->handle_start = PyObject_GetAttrString(target, "start"); + if (ignore_attribute_error(self->handle_start)) { + return -1; + } self->handle_data = PyObject_GetAttrString(target, "data"); + if (ignore_attribute_error(self->handle_data)) { + return -1; + } self->handle_end = PyObject_GetAttrString(target, "end"); + if (ignore_attribute_error(self->handle_end)) { + return -1; + } self->handle_comment = PyObject_GetAttrString(target, "comment"); + if (ignore_attribute_error(self->handle_comment)) { + return -1; + } self->handle_pi = PyObject_GetAttrString(target, "pi"); + if (ignore_attribute_error(self->handle_pi)) { + return -1; + } self->handle_close = PyObject_GetAttrString(target, "close"); + if (ignore_attribute_error(self->handle_close)) { + return -1; + } self->handle_doctype = PyObject_GetAttrString(target, "doctype"); - - PyErr_Clear(); + if (ignore_attribute_error(self->handle_doctype)) { + return -1; + } /* configure parser */ EXPAT(SetUserData)(self->parser, self); From webhook-mailer at python.org Thu Sep 14 20:34:46 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 15 Sep 2017 00:34:46 -0000 Subject: [Python-checkins] [3.6] bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (GH-3590) (#3591) Message-ID: https://github.com/python/cpython/commit/7b62416d86dce368470c5d1acbb55295a23d87f8 commit: 7b62416d86dce368470c5d1acbb55295a23d87f8 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-14T20:34:42-04:00 summary: [3.6] bpo-31480: IDLE - fix tests to pass with zzdummy extension disabled. (GH-3590) (#3591) Enabled by default was a temporary expedient. The fix is to add a user override to enable. (cherry picked from commit d384a81f557dab0b142bfcc9850bc68df46496ef) files: A Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst M Lib/idlelib/config-extensions.def M Lib/idlelib/idle_test/test_config.py M Lib/idlelib/idle_test/test_configdialog.py diff --git a/Lib/idlelib/config-extensions.def b/Lib/idlelib/config-extensions.def index e8d417bac0d..8689fd965e8 100644 --- a/Lib/idlelib/config-extensions.def +++ b/Lib/idlelib/config-extensions.def @@ -55,7 +55,7 @@ bell= True # A fake extension for testing and example purposes. When enabled and # invoked, inserts or deletes z-text at beginning of every line. [ZzDummy] -enable= True +enable= False enable_shell = False enable_editor = True z-text= Z diff --git a/Lib/idlelib/idle_test/test_config.py b/Lib/idlelib/idle_test/test_config.py index 84b45a63767..abfec7993e0 100644 --- a/Lib/idlelib/idle_test/test_config.py +++ b/Lib/idlelib/idle_test/test_config.py @@ -26,6 +26,7 @@ usermain = testcfg['main'] = config.IdleUserConfParser('') userhigh = testcfg['highlight'] = config.IdleUserConfParser('') userkeys = testcfg['keys'] = config.IdleUserConfParser('') +userextn = testcfg['extensions'] = config.IdleUserConfParser('') def setUpModule(): idleConf.userCfg = testcfg @@ -430,29 +431,22 @@ def test_default_keys(self): sys.platform = current_platform def test_get_extensions(self): - conf = self.mock_config() - - # Add disable extensions - conf.SetOption('extensions', 'DISABLE', 'enable', 'False') - + userextn.read_string(''' + [ZzDummy] + enable = True + [DISABLE] + enable = False + ''') eq = self.assertEqual - eq(conf.GetExtensions(), - ['ZzDummy']) - eq(conf.GetExtensions(active_only=False), - ['ZzDummy', 'DISABLE']) - eq(conf.GetExtensions(editor_only=True), - ['ZzDummy']) - eq(conf.GetExtensions(shell_only=True), - []) - eq(conf.GetExtensions(active_only=False, editor_only=True), - ['ZzDummy', 'DISABLE']) - - # Add user extensions - conf.SetOption('extensions', 'Foobar', 'enable', 'True') - eq(conf.GetExtensions(), - ['ZzDummy', 'Foobar']) # User extensions didn't sort - eq(conf.GetExtensions(active_only=False), - ['ZzDummy', 'DISABLE', 'Foobar']) + iGE = idleConf.GetExtensions + eq(iGE(shell_only=True), []) + eq(iGE(), ['ZzDummy']) + eq(iGE(editor_only=True), ['ZzDummy']) + eq(iGE(active_only=False), ['ZzDummy', 'DISABLE']) + eq(iGE(active_only=False, editor_only=True), ['ZzDummy', 'DISABLE']) + userextn.remove_section('ZzDummy') + userextn.remove_section('DISABLE') + def test_remove_key_bind_names(self): conf = self.mock_config() @@ -462,39 +456,39 @@ def test_remove_key_bind_names(self): ['AutoComplete', 'CodeContext', 'FormatParagraph', 'ParenMatch','ZzDummy']) def test_get_extn_name_for_event(self): - conf = self.mock_config() - + userextn.read_string(''' + [ZzDummy] + enable = True + ''') eq = self.assertEqual - eq(conf.GetExtnNameForEvent('z-in'), 'ZzDummy') - eq(conf.GetExtnNameForEvent('z-out'), None) + eq(idleConf.GetExtnNameForEvent('z-in'), 'ZzDummy') + eq(idleConf.GetExtnNameForEvent('z-out'), None) + userextn.remove_section('ZzDummy') def test_get_extension_keys(self): - conf = self.mock_config() - - eq = self.assertEqual - eq(conf.GetExtensionKeys('ZzDummy'), + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + self.assertEqual(idleConf.GetExtensionKeys('ZzDummy'), {'<>': ['']}) + userextn.remove_section('ZzDummy') # need option key test ## key = [''] if sys.platform == 'darwin' else [''] ## eq(conf.GetExtensionKeys('ZoomHeight'), {'<>': key}) def test_get_extension_bindings(self): - conf = self.mock_config() - - self.assertEqual(conf.GetExtensionBindings('NotExists'), {}) - - #key = [''] if sys.platform == 'darwin' else [''] + userextn.read_string(''' + [ZzDummy] + enable = True + ''') + eq = self.assertEqual + iGEB = idleConf.GetExtensionBindings + eq(iGEB('NotExists'), {}) expect = {'<>': [''], '<>': ['']} - self.assertEqual( - conf.GetExtensionBindings('ZzDummy'), expect) - - # Add non-configuarable bindings - conf.defaultCfg['extensions'].add_section('Foobar') - conf.defaultCfg['extensions'].add_section('Foobar_bindings') - conf.defaultCfg['extensions'].set('Foobar', 'enable', 'True') - conf.defaultCfg['extensions'].set('Foobar_bindings', 'foobar', '') - self.assertEqual(conf.GetExtensionBindings('Foobar'), {'<>': ['']}) + eq(iGEB('ZzDummy'), expect) + userextn.remove_section('ZzDummy') def test_get_keybinding(self): conf = self.mock_config() diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index cae7186415b..dc7f69c2af8 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -820,6 +820,7 @@ def test_custom_name(self): self.assertEqual(d.load_keys_list.called, 1) def test_keybinding(self): + idleConf.SetOption('extensions', 'ZzDummy', 'enable', 'True') d = self.page d.custom_name.set('my custom keys') d.bindingslist.delete(0, 'end') diff --git a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst new file mode 100644 index 00000000000..5999e9a8f27 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst @@ -0,0 +1 @@ +IDLE - make tests pass with zzdummy extension disabled by default. From lp_benchmark_robot at intel.com Thu Sep 14 20:49:50 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 14 Sep 2017 17:49:50 -0700 Subject: [Python-checkins] [1 down, 64 flat] Results for Python (master branch) 2017-09-14 Message-ID: <8ffa9de0-c63a-4ce1-b3e4-2ab850dbd231@orsmsx110.amr.corp.intel.com> Results for project python/master, build date: 2017-09-14 03:05:04-07:00. - commit: 5a61559 - previous commit: b8f4163 - revision date: 2017-09-14 10:10:30+02:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.099% | -0.770% | +2.668% | +8.606% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.800% | +0.902% | +19.310% | +13.703% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.491% | +1.118% | +21.058% | +12.031% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.852% | -0.359% | +18.191% | +13.956% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.307% | +2.795% | +5.226% | +9.747% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.236% | +0.627% | +10.606% | +10.739% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.623% | +1.067% | +8.239% | +10.316% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.717% | +0.397% | +3.759% | +5.639% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 5.215% | -3.509% | +4.307% | +20.460% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 6.639% | -2.359% | +4.489% | +14.980% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 0.936% | +0.199% | +3.571% | +5.846% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 1.006% | +0.358% | +6.630% | +4.611% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.897% | -0.294% | +3.455% | +6.530% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.414% | +0.360% | +7.318% | +12.527% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.199% | -0.177% | +5.675% | +8.945% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.802% | -0.161% | +6.807% | +10.705% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.341% | +0.150% | +9.777% | +10.666% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.979% | -1.226% | +6.154% | +10.422% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.915% | -0.687% | +3.274% | +9.955% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 4.477% | +1.622% | +1.198% | +10.839% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.716% | +0.380% | +5.685% | +12.511% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.812% | +0.584% | +47.593% | +10.899% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.613% | +0.400% | +6.941% | +13.590% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.599% | +0.412% | +18.872% | +10.442% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.774% | -0.229% | +7.501% | +10.342% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 0.859% | -1.455% | +2.869% | +6.362% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.257% | +0.447% | -1.446% | +2.079% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.931% | +0.803% | +2.605% | +8.391% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.423% | +0.103% | +5.238% | +7.383% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.516% | +0.516% | +1.484% | +23.010% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_dict| 0.257% | -1.653% | +0.899% | +23.364% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.343% | +0.204% | +5.410% | +19.249% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 4.677% | -0.108% | +10.837% | +10.205% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.263% | -0.066% | +0.138% | +10.200% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.128% | -0.410% | +8.618% | +4.524% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.097% | -0.829% | +0.205% | +4.532% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.596% | -0.532% | +8.736% | +13.659% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.687% | +1.727% | -10.311% | +12.909% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.307% | -0.201% | -2.172% | +12.494% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 3.754% | -0.895% | -3.621% | +2.769% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 1.702% | +1.020% | +12.377% | +3.434% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.682% | +0.372% | +7.689% | +14.689% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.069% | +0.510% | +1.151% | +1.426% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.514% | -1.029% | +26.568% | +9.660% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.257% | +0.284% | +5.157% | +5.764% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.685% | -0.293% | +15.234% | +8.229% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 1.440% | +0.041% | +1.160% | -1.705% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 2.262% | -0.777% | +4.628% | +3.660% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.976% | -0.046% | +4.225% | +8.354% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.668% | +0.080% | +3.706% | +5.835% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.389% | +2.326% | +1.882% | +8.789% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.139% | +0.212% | +11.160% | +8.748% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.686% | +0.698% | +9.261% | +7.254% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.249% | -1.178% | +9.848% | +10.968% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.100% | +1.199% | +9.884% | +12.666% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.604% | -0.203% | +23.908% | +9.457% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.518% | -0.533% | +4.592% | +7.303% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.676% | -0.215% | +1.974% | +0.327% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 5.858% | +7.782% | +8.986% | +19.996% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 2.842% | -2.026% | -1.500% | +22.085% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.750% | -0.832% | +6.453% | +7.466% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.016% | +0.100% | +5.996% | +7.571% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.126% | -0.053% | +2.281% | +7.266% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.993% | -4.547% | -9.463% | +12.618% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.214% | +0.265% | +6.150% | +8.625% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-64-flat-results-for-python-master-branch-2017-09-14 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Thu Sep 14 21:13:19 2017 From: webhook-mailer at python.org (Barry Warsaw) Date: Fri, 15 Sep 2017 01:13:19 -0000 Subject: [Python-checkins] bpo-31338 (#3374) Message-ID: https://github.com/python/cpython/commit/b2e5794870eb4728ddfaafc0f79a40299576434f commit: b2e5794870eb4728ddfaafc0f79a40299576434f branch: master author: Barry Warsaw committer: GitHub date: 2017-09-14T18:13:16-07:00 summary: bpo-31338 (#3374) * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros. files: A Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst M Doc/c-api/intro.rst M Include/pymacro.h M Modules/_datetimemodule.c M Modules/_pickle.c M Modules/_tracemalloc.c M Modules/mathmodule.c M Objects/abstract.c M Objects/bytesobject.c M Objects/dictobject.c M Objects/longobject.c M Objects/stringlib/eq.h M Objects/unicodeobject.c M Parser/grammar1.c M Python/ast.c M Python/ceval.c M Python/compile.c M Python/formatter_unicode.c M Python/pyhash.c M Python/pystrtod.c M Python/pytime.c M Python/wordcode_helpers.h diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index 74681d2c851..4942b1a4698 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -17,11 +17,11 @@ common use. The second reason is to use Python as a component in a larger application; this technique is generally referred to as :dfn:`embedding` Python in an application. -Writing an extension module is a relatively well-understood process, where a -"cookbook" approach works well. There are several tools that automate the -process to some extent. While people have embedded Python in other -applications since its early existence, the process of embedding Python is less -straightforward than writing an extension. +Writing an extension module is a relatively well-understood process, where a +"cookbook" approach works well. There are several tools that automate the +process to some extent. While people have embedded Python in other +applications since its early existence, the process of embedding Python is +less straightforward than writing an extension. Many API functions are useful independent of whether you're embedding or extending Python; moreover, most applications that embed Python will need to @@ -30,6 +30,16 @@ familiar with writing an extension before attempting to embed Python in a real application. +Coding standards +================ + +If you're writing C code for inclusion in CPython, you **must** follow the +guidelines and standards defined in :PEP:`7`. These guidelines apply +regardless of the version of Python you are contributing to. Following these +conventions is not necessary for your own third party extension modules, +unless you eventually expect to contribute them to Python. + + .. _api-includes: Include Files @@ -81,6 +91,48 @@ header files do properly declare the entry points to be ``extern "C"``, so there is no need to do anything special to use the API from C++. +Useful macros +============= + +Several useful macros are defined in the Python header files. Many are +defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`). +Others of a more general utility are defined here. This is not necessarily a +complete listing. + +.. c:macro:: Py_UNREACHABLE() + + Use this when you have a code path that you do not expect to be reached. + For example, in the ``default:`` clause in a ``switch`` statement for which + all possible values are covered in ``case`` statements. Use this in places + where you might be tempted to put an ``assert(0)`` or ``abort()`` call. + +.. c:macro:: Py_ABS(x) + + Return the absolute value of ``x``. + +.. c:macro:: Py_MIN(x, y) + + Return the minimum value between ``x`` and ``y``. + +.. c:macro:: Py_MAX(x, y) + + Return the maximum value between ``x`` and ``y``. + +.. c:macro:: Py_STRINGIFY(x) + + Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns + ``"123"``. + +.. c:macro:: Py_MEMBER_SIZE(type, member) + + Return the size of a structure (``type``) ``member`` in bytes. + +.. c:macro:: Py_CHARMASK(c) + + Argument must be a character or an integer in the range [-128, 127] or [0, + 255]. This macro returns ``c`` cast to an ``unsigned char``. + + .. _api-objects: Objects, Types and Reference Counts diff --git a/Include/pymacro.h b/Include/pymacro.h index 69577b73651..3f6ddbe9977 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -95,4 +95,6 @@ #define Py_UNUSED(name) _unused_ ## name #endif +#define Py_UNREACHABLE() abort() + #endif /* Py_PYMACRO_H */ diff --git a/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst b/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst new file mode 100644 index 00000000000..01878e5d43f --- /dev/null +++ b/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst @@ -0,0 +1,3 @@ +Added the ``Py_UNREACHABLE()`` macro for code paths which are never expected +to be reached. This and a few other useful macros are now documented in the +C API manual. diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 1b68ff3b372..619ac84bf74 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1453,8 +1453,7 @@ diff_to_bool(int diff, int op) case Py_LT: istrue = diff < 0; break; case Py_GT: istrue = diff > 0; break; default: - assert(! "op unknown"); - istrue = 0; /* To shut up compiler */ + Py_UNREACHABLE(); } result = istrue ? Py_True : Py_False; Py_INCREF(result); diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 3165b4e6d68..fb69f14b53d 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -750,8 +750,7 @@ _PyMemoTable_Lookup(PyMemoTable *self, PyObject *key) if (entry->me_key == NULL || entry->me_key == key) return entry; } - assert(0); /* Never reached */ - return NULL; + Py_UNREACHABLE(); } /* Returns -1 on failure, 0 on success. */ diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index feb32a09078..386f2f11ba7 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -726,7 +726,7 @@ tracemalloc_realloc(void *ctx, void *ptr, size_t new_size) The GIL and the table lock ensures that only one thread is allocating memory. */ - assert(0 && "should never happen"); + Py_UNREACHABLE(); } TABLES_UNLOCK(); } diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index c19620d6bdc..5d9fe5aa71a 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -105,8 +105,7 @@ sinpi(double x) r = sin(pi*(y-2.0)); break; default: - assert(0); /* should never get here */ - r = -1.23e200; /* silence gcc warning */ + Py_UNREACHABLE(); } return copysign(1.0, x)*r; } diff --git a/Objects/abstract.c b/Objects/abstract.c index 998bcb12b80..38484b79a1b 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1984,7 +1984,7 @@ _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation) goto Done; default: - assert(!"unknown operation"); + Py_UNREACHABLE(); } } diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index d91cb7d8724..6a4eb67808a 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -868,7 +868,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, switch(c) { default: - assert(0 && "'type' not in [diuoxX]"); + Py_UNREACHABLE(); case 'd': case 'i': case 'u': diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 81c7f7f2436..6ba2cc975fc 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -643,8 +643,7 @@ lookdict_index(PyDictKeysObject *k, Py_hash_t hash, Py_ssize_t index) perturb >>= PERTURB_SHIFT; i = mask & (i*5 + perturb + 1); } - assert(0); /* NOT REACHED */ - return DKIX_ERROR; + Py_UNREACHABLE(); } /* @@ -723,8 +722,7 @@ lookdict(PyDictObject *mp, PyObject *key, perturb >>= PERTURB_SHIFT; i = (i*5 + perturb + 1) & mask; } - assert(0); /* NOT REACHED */ - return 0; + Py_UNREACHABLE(); } /* Specialized version for string-only keys */ @@ -766,9 +764,7 @@ lookdict_unicode(PyDictObject *mp, PyObject *key, perturb >>= PERTURB_SHIFT; i = mask & (i*5 + perturb + 1); } - - assert(0); /* NOT REACHED */ - return 0; + Py_UNREACHABLE(); } /* Faster version of lookdict_unicode when it is known that no keys @@ -810,8 +806,7 @@ lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, perturb >>= PERTURB_SHIFT; i = mask & (i*5 + perturb + 1); } - assert(0); /* NOT REACHED */ - return 0; + Py_UNREACHABLE(); } /* Version of lookdict for split tables. @@ -856,8 +851,7 @@ lookdict_split(PyDictObject *mp, PyObject *key, perturb >>= PERTURB_SHIFT; i = mask & (i*5 + perturb + 1); } - assert(0); /* NOT REACHED */ - return 0; + Py_UNREACHABLE(); } int @@ -3603,7 +3597,7 @@ dictiter_reduce(dictiterobject *di) else if (Py_TYPE(di) == &PyDictIterValue_Type) element = dictiter_iternextvalue(&tmp); else - assert(0); + Py_UNREACHABLE(); if (element) { if (PyList_Append(list, element)) { Py_DECREF(element); diff --git a/Objects/longobject.c b/Objects/longobject.c index 4862b76da6b..3b07585669e 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1806,8 +1806,7 @@ long_format_binary(PyObject *aa, int base, int alternate, bits = 1; break; default: - assert(0); /* shouldn't ever get here */ - bits = 0; /* to silence gcc warning */ + Py_UNREACHABLE(); } /* Compute exact length 'sz' of output string. */ @@ -2169,8 +2168,8 @@ PyLong_FromString(const char *str, char **pend, int base) } } if (str[0] == '_') { - /* May not start with underscores. */ - goto onError; + /* May not start with underscores. */ + goto onError; } start = str; diff --git a/Objects/stringlib/eq.h b/Objects/stringlib/eq.h index f8fd384a372..ff22f913712 100644 --- a/Objects/stringlib/eq.h +++ b/Objects/stringlib/eq.h @@ -10,8 +10,7 @@ unicode_eq(PyObject *aa, PyObject *bb) PyUnicodeObject *b = (PyUnicodeObject *)bb; if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) { - assert(0 && "unicode_eq ready fail"); - return 0; + Py_UNREACHABLE(); } if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b)) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c4d93fca045..bb1c0830fc5 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -768,7 +768,7 @@ make_bloom_mask(int kind, void* ptr, Py_ssize_t len) BLOOM_UPDATE(Py_UCS4, mask, ptr, len); break; default: - assert(0); + Py_UNREACHABLE(); } return mask; @@ -869,8 +869,7 @@ findchar(const void *s, int kind, else return ucs4lib_rfind_char((Py_UCS4 *) s, size, ch); default: - assert(0); - return -1; + Py_UNREACHABLE(); } } @@ -1520,8 +1519,7 @@ _copy_characters(PyObject *to, Py_ssize_t to_start, ); } else { - assert(0); - return -1; + Py_UNREACHABLE(); } } else { @@ -2079,7 +2077,7 @@ PyUnicode_FromWideChar(const wchar_t *u, Py_ssize_t size) #endif break; default: - assert(0 && "Impossible state"); + Py_UNREACHABLE(); } return unicode_result(unicode); @@ -2172,8 +2170,7 @@ kind_maxchar_limit(unsigned int kind) case PyUnicode_4BYTE_KIND: return 0x10000; default: - assert(0 && "invalid kind"); - return MAX_UNICODE; + Py_UNREACHABLE(); } } @@ -2317,8 +2314,7 @@ _PyUnicode_FindMaxChar(PyObject *unicode, Py_ssize_t start, Py_ssize_t end) case PyUnicode_4BYTE_KIND: return ucs4lib_find_max_char(startptr, endptr); default: - assert(0); - return 0; + Py_UNREACHABLE(); } } @@ -4068,7 +4064,7 @@ PyUnicode_AsUnicodeAndSize(PyObject *unicode, Py_ssize_t *size) *w = *four_bytes; if (w > wchar_end) { - assert(0 && "Miscalculated string end"); + Py_UNREACHABLE(); } } *w = 0; @@ -4120,7 +4116,7 @@ PyUnicode_AsUnicodeAndSize(PyObject *unicode, Py_ssize_t *size) #endif } else { - assert(0 && "This should never happen."); + Py_UNREACHABLE(); } } } @@ -5134,7 +5130,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size) #endif if (ch > 0xFF) { #if SIZEOF_WCHAR_T == 4 - assert(0); + Py_UNREACHABLE(); #else assert(ch > 0xFFFF && ch <= MAX_UNICODE); /* compute and append the two surrogates: */ @@ -5187,7 +5183,7 @@ _PyUnicode_AsUTF8String(PyObject *unicode, const char *errors) switch (kind) { default: - assert(0); + Py_UNREACHABLE(); case PyUnicode_1BYTE_KIND: /* the string cannot be ASCII, or PyUnicode_UTF8() would be set */ assert(!PyUnicode_IS_ASCII(unicode)); @@ -9294,7 +9290,7 @@ any_find_slice(PyObject* s1, PyObject* s2, result = ucs4lib_find_slice(buf1, len1, buf2, len2, start, end); break; default: - assert(0); result = -2; + Py_UNREACHABLE(); } } else { @@ -9312,7 +9308,7 @@ any_find_slice(PyObject* s1, PyObject* s2, result = ucs4lib_rfind_slice(buf1, len1, buf2, len2, start, end); break; default: - assert(0); result = -2; + Py_UNREACHABLE(); } } @@ -9386,8 +9382,7 @@ _PyUnicode_InsertThousandsGrouping( (Py_UCS4 *) thousands_sep_data, thousands_sep_len); break; default: - assert(0); - return -1; + Py_UNREACHABLE(); } if (unicode != NULL && thousands_sep_kind != kind) { if (thousands_sep_kind < kind) @@ -9465,7 +9460,7 @@ PyUnicode_Count(PyObject *str, ); break; default: - assert(0); result = 0; + Py_UNREACHABLE(); } if (kind2 != kind1) @@ -9881,8 +9876,7 @@ case_operation(PyObject *self, memcpy(outdata, tmp, sizeof(Py_UCS4) * newlength); break; default: - assert(0); - break; + Py_UNREACHABLE(); } leave: PyMem_FREE(tmp); @@ -10105,7 +10099,7 @@ _PyUnicode_JoinArray(PyObject *separator, PyObject **items, Py_ssize_t seqlen) for (; i_ < (length); ++i_, ++to_) *to_ = (value); \ break; \ } \ - default: assert(0); \ + default: Py_UNREACHABLE(); \ } \ } while (0) @@ -10229,8 +10223,7 @@ PyUnicode_Splitlines(PyObject *string, int keepends) PyUnicode_GET_LENGTH(string), keepends); break; default: - assert(0); - list = 0; + Py_UNREACHABLE(); } return list; } @@ -10275,8 +10268,7 @@ split(PyObject *self, PyUnicode_GET_LENGTH(self), maxcount ); default: - assert(0); - return NULL; + Py_UNREACHABLE(); } if (PyUnicode_READY(substring) == -1) @@ -10367,8 +10359,7 @@ rsplit(PyObject *self, PyUnicode_GET_LENGTH(self), maxcount ); default: - assert(0); - return NULL; + Py_UNREACHABLE(); } if (PyUnicode_READY(substring) == -1) @@ -10434,8 +10425,7 @@ anylib_find(int kind, PyObject *str1, void *buf1, Py_ssize_t len1, case PyUnicode_4BYTE_KIND: return ucs4lib_find(buf1, len1, buf2, len2, offset); } - assert(0); - return -1; + Py_UNREACHABLE(); } static Py_ssize_t @@ -10453,8 +10443,7 @@ anylib_count(int kind, PyObject *sstr, void* sbuf, Py_ssize_t slen, case PyUnicode_4BYTE_KIND: return ucs4lib_count(sbuf, slen, buf1, len1, maxcount); } - assert(0); - return 0; + Py_UNREACHABLE(); } static void @@ -10909,7 +10898,7 @@ unicode_compare(PyObject *str1, PyObject *str2) COMPARE(Py_UCS1, Py_UCS4); break; default: - assert(0); + Py_UNREACHABLE(); } break; } @@ -10928,7 +10917,7 @@ unicode_compare(PyObject *str1, PyObject *str2) COMPARE(Py_UCS2, Py_UCS4); break; default: - assert(0); + Py_UNREACHABLE(); } break; } @@ -10956,12 +10945,12 @@ unicode_compare(PyObject *str1, PyObject *str2) break; } default: - assert(0); + Py_UNREACHABLE(); } break; } default: - assert(0); + Py_UNREACHABLE(); } if (len1 == len2) @@ -11285,8 +11274,7 @@ PyUnicode_Contains(PyObject *str, PyObject *substr) result = ucs4lib_find(buf1, len1, buf2, len2, 0) != -1; break; default: - result = -1; - assert(0); + Py_UNREACHABLE(); } if (kind2 != kind1) @@ -11511,7 +11499,7 @@ unicode_count(PyObject *self, PyObject *args) ); break; default: - assert(0); iresult = 0; + Py_UNREACHABLE(); } result = PyLong_FromSsize_t(iresult); @@ -12985,8 +12973,7 @@ PyUnicode_Partition(PyObject *str_obj, PyObject *sep_obj) out = ucs4lib_partition(str_obj, buf1, len1, sep_obj, buf2, len2); break; default: - assert(0); - out = 0; + Py_UNREACHABLE(); } if (kind2 != kind1) @@ -13043,8 +13030,7 @@ PyUnicode_RPartition(PyObject *str_obj, PyObject *sep_obj) out = ucs4lib_rpartition(str_obj, buf1, len1, sep_obj, buf2, len2); break; default: - assert(0); - out = 0; + Py_UNREACHABLE(); } if (kind2 != kind1) @@ -13627,8 +13613,7 @@ _PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer, case PyUnicode_2BYTE_KIND: maxchar = 0xffff; break; case PyUnicode_4BYTE_KIND: maxchar = 0x10ffff; break; default: - assert(0 && "invalid kind"); - return -1; + Py_UNREACHABLE(); } return _PyUnicodeWriter_PrepareInternal(writer, 0, maxchar); @@ -13770,7 +13755,7 @@ _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer, break; } default: - assert(0); + Py_UNREACHABLE(); } writer->pos += len; @@ -14204,7 +14189,7 @@ _PyUnicode_FormatLong(PyObject *val, int alt, int prec, int type) switch (type) { default: - assert(!"'type' not in [diuoxX]"); + Py_UNREACHABLE(); case 'd': case 'i': case 'u': @@ -14362,7 +14347,7 @@ mainformatlong(PyObject *v, switch(type) { default: - assert(0 && "'type' not in [diuoxX]"); + Py_UNREACHABLE(); case 'd': case 'i': case 'u': @@ -15373,8 +15358,7 @@ _Py_ReleaseInternedUnicodeStrings(void) for (i = 0; i < n; i++) { s = PyList_GET_ITEM(keys, i); if (PyUnicode_READY(s) == -1) { - assert(0 && "could not ready string"); - fprintf(stderr, "could not ready string\n"); + Py_UNREACHABLE(); } switch (PyUnicode_CHECK_INTERNED(s)) { case SSTATE_NOT_INTERNED: diff --git a/Parser/grammar1.c b/Parser/grammar1.c index 30a6f07cad9..9e9904158da 100644 --- a/Parser/grammar1.c +++ b/Parser/grammar1.c @@ -25,8 +25,7 @@ PyGrammar_FindDFA(grammar *g, int type) if (d->d_type == type) return d; } - assert(0); - /* NOTREACHED */ + Py_UNREACHABLE(); #endif } diff --git a/Python/ast.c b/Python/ast.c index 7d30e5f864f..fd42c0073de 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -100,8 +100,7 @@ expr_context_name(expr_context_ty ctx) case Param: return "Param"; default: - assert(0); - return "(unknown)"; + Py_UNREACHABLE(); } } @@ -759,8 +758,7 @@ num_stmts(const node *n) Py_FatalError(buf); } } - assert(0); - return 0; + Py_UNREACHABLE(); } /* Transform the CST rooted at node * to the appropriate AST diff --git a/Python/ceval.c b/Python/ceval.c index 08533a42bf2..5b810f29d12 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -274,7 +274,7 @@ PyEval_RestoreThread(PyThreadState *tstate) if (_Py_IsFinalizing() && !_Py_CURRENTLY_FINALIZING(tstate)) { drop_gil(tstate); PyThread_exit_thread(); - assert(0); /* unreachable */ + Py_UNREACHABLE(); } errno = err; } @@ -3430,7 +3430,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) /* This should never be reached. Every opcode should end with DISPATCH() or goto error. */ - assert(0); + Py_UNREACHABLE(); error: diff --git a/Python/compile.c b/Python/compile.c index e547c2fd591..df5070aad2a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1350,8 +1350,7 @@ get_const_value(expr_ty e) case NameConstant_kind: return e->v.NameConstant.value; default: - assert(!is_const(e)); - return NULL; + Py_UNREACHABLE(); } } diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c index 9192bfd6a67..2df749493bf 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -351,8 +351,7 @@ calc_padding(Py_ssize_t nchars, Py_ssize_t width, Py_UCS4 align, *n_lpadding = 0; else { /* We should never have an unspecified alignment. */ - *n_lpadding = 0; - assert(0); + Py_UNREACHABLE(); } *n_rpadding = *n_total - nchars - *n_lpadding; @@ -569,9 +568,7 @@ calc_number_widths(NumberFieldWidths *spec, Py_ssize_t n_prefix, break; default: /* Shouldn't get here, but treat it as '>' */ - spec->n_lpadding = n_padding; - assert(0); - break; + Py_UNREACHABLE(); } } diff --git a/Python/pyhash.c b/Python/pyhash.c index a2ec2309c70..8a6bd60c105 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -175,7 +175,7 @@ _Py_HashBytes(const void *src, Py_ssize_t len) case 2: hash = ((hash << 5) + hash) + *p++; /* fallthrough */ case 1: hash = ((hash << 5) + hash) + *p++; break; default: - assert(0); + Py_UNREACHABLE(); } hash ^= len; hash ^= (Py_uhash_t) _Py_HashSecret.djbx33a.suffix; diff --git a/Python/pystrtod.c b/Python/pystrtod.c index 64d0c52e487..f19d2399b38 100644 --- a/Python/pystrtod.c +++ b/Python/pystrtod.c @@ -431,8 +431,8 @@ _Py_string_to_number_with_underscores( error: PyMem_Free(dup); PyErr_Format(PyExc_ValueError, - "could not convert string to %s: " - "%R", what, obj); + "could not convert string to %s: " + "%R", what, obj); return NULL; } @@ -1061,7 +1061,7 @@ format_float_short(double d, char format_code, something starting with a digit, an 'I', or 'N' */ strncpy(p, "ERR", 3); /* p += 3; */ - assert(0); + Py_UNREACHABLE(); } goto exit; } diff --git a/Python/pytime.c b/Python/pytime.c index 7edb534596e..8f275d29839 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -630,10 +630,7 @@ _PyTime_GetSystemClock(void) _PyTime_t t; if (pygettimeofday(&t, NULL, 0) < 0) { /* should not happen, _PyTime_Init() checked the clock at startup */ - assert(0); - - /* use a fixed value instead of a random value from the stack */ - t = 0; + Py_UNREACHABLE(); } return t; } @@ -663,7 +660,7 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) return -1; } /* Hello, time traveler! */ - assert(0); + Py_UNREACHABLE(); } *tp = t * MS_TO_NS; @@ -771,10 +768,7 @@ _PyTime_GetMonotonicClock(void) if (pymonotonic(&t, NULL, 0) < 0) { /* should not happen, _PyTime_Init() checked that monotonic clock at startup */ - assert(0); - - /* use a fixed value instead of a random value from the stack */ - t = 0; + Py_UNREACHABLE(); } return t; } diff --git a/Python/wordcode_helpers.h b/Python/wordcode_helpers.h index cce81c1d24e..c8f7a0f41f9 100644 --- a/Python/wordcode_helpers.h +++ b/Python/wordcode_helpers.h @@ -39,6 +39,6 @@ write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode, *codestr++ = PACKOPARG(opcode, oparg & 0xff); break; default: - assert(0); + Py_UNREACHABLE(); } } From webhook-mailer at python.org Thu Sep 14 22:52:21 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 15 Sep 2017 02:52:21 -0000 Subject: [Python-checkins] [3.6] bpo-31462: IDLE - remove trailing whitespaces (GH-3564) (#3594) Message-ID: https://github.com/python/cpython/commit/93d5f91fff5740b463980797a04f3d5f1d5f1a51 commit: 93d5f91fff5740b463980797a04f3d5f1d5f1a51 branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-09-14T22:52:16-04:00 summary: [3.6] bpo-31462: IDLE - remove trailing whitespaces (GH-3564) (#3594) Reproduction of Idlelib changes in Serhiy's 3.7 patch. files: M Lib/idlelib/ChangeLog M Lib/idlelib/README.txt M Lib/idlelib/idle_test/README.txt diff --git a/Lib/idlelib/ChangeLog b/Lib/idlelib/ChangeLog index 0c36664512b..d7d7e1efdb1 100644 --- a/Lib/idlelib/ChangeLog +++ b/Lib/idlelib/ChangeLog @@ -27,9 +27,9 @@ IDLEfork ChangeLog * INSTALLATION, setup.py: INSTALLATION: Remove the coexist.patch instructions - + **************** setup.py: - + Remove the idles script, add some words on IDLE Fork to the long_description, and clean up some line spacing. @@ -42,30 +42,30 @@ IDLEfork ChangeLog * PyShell.py, idle, idles: Implement idle command interface as suggested by GvR [idle-dev] 16 July **************** PyShell: Added functionality: - + usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ... - + idle file(s) (without options) edit the file(s) - + -c cmd run the command in a shell -d enable the debugger -i open an interactive shell -i file(s) open a shell and also an editor window for each file -r script run a file as a script in a shell -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window - + Remaining arguments are applied to the command (-c) or script (-r). - + ****************** idles: Removed the idles script, not needed - + ****************** idle: Removed the IdleConf references, not required anymore 2001-07-16 17:08 kbk * INSTALLATION, coexist.patch: Added installation instructions. - + Added a patch which modifies idlefork so that it can co-exist with "official" IDLE in the site-packages directory. This patch is not necessary if only idlefork IDLE is installed. See INSTALLATION for @@ -74,7 +74,7 @@ IDLEfork ChangeLog 2001-07-16 15:50 kbk * idles: Add a script "idles" which opens a Python Shell window. - + The default behaviour of idlefork idle is to open an editor window instead of a shell. Complex expressions may be run in a fresh environment by selecting "run". There are times, however, when a @@ -90,7 +90,7 @@ IDLEfork ChangeLog * PyShell.py, setup.py: Add a script "idles" which opens a Python Shell window. - + The default behaviour of idlefork idle is to open an editor window instead of a shell. Complex expressions may be run in a fresh environment by selecting "run". There are times, however, when a @@ -110,13 +110,13 @@ IDLEfork ChangeLog * setup.py: Installing Idle to site-packages via Distutils does not copy the Idle help.txt file. - + Ref SF Python Patch 422471 2001-07-14 15:26 kbk * keydefs.py: py-cvs-2001_07_13 (Rev 1.3) merge - + "Make copy, cut and paste events case insensitive. Reported by Patrick K. O'Brien on idle-dev. (Should other bindings follow suit?)" --GvR @@ -124,7 +124,7 @@ IDLEfork ChangeLog 2001-07-14 15:21 kbk * idle.py: py-cvs-2001_07_13 (Rev 1.4) merge - + "Move the action of loading the configuration to the IdleConf module rather than the idle.py script. This has advantages and disadvantages; the biggest advantage being that we can more easily @@ -133,21 +133,21 @@ IDLEfork ChangeLog 2001-07-14 15:18 kbk * extend.txt: py-cvs-2001_07_13 (Rev 1.4) merge - + "Quick update to the extension mechanism (extend.py is gone, long live config.txt)" --GvR 2001-07-14 15:15 kbk * StackViewer.py: py-cvs-2001_07_13 (Rev 1.16) merge - + "Refactored, with some future plans in mind. This now uses the new gotofileline() method defined in FileList.py" --GvR 2001-07-14 15:10 kbk * PyShell.py: py-cvs-2001_07_13 (Rev 1.34) merge - + "Amazing. A very subtle change in policy in descr-branch actually found a bug here. Here's the deal: Class PyShell derives from class OutputWindow. Method PyShell.close() wants to invoke its @@ -166,19 +166,19 @@ IDLEfork ChangeLog 2001-07-14 14:59 kbk * PyParse.py: py-cvs-2001_07_13 (Rel 1.9) merge - + "Taught IDLE's autoident parser that "yield" is a keyword that begins a stmt. Along w/ the preceding change to keyword.py, making all this work w/ a future-stmt just looks harder and harder." --tim_one - + (From Rel 1.8: "Hack to make this still work with Python 1.5.2. ;-( " --fdrake) 2001-07-14 14:51 kbk * IdleConf.py: py-cvs-2001_07_13 (Rel 1.7) merge - + "Move the action of loading the configuration to the IdleConf module rather than the idle.py script. This has advantages and disadvantages; the biggest advantage being that we can more easily @@ -187,11 +187,11 @@ IDLEfork ChangeLog 2001-07-14 14:45 kbk * FileList.py: py-cvs-2000_07_13 (Rev 1.9) merge - + "Delete goodname() method, which is unused. Add gotofileline(), a convenience method which I intend to use in a variant. Rename test() to _test()." --GvR - + This was an interesting merge. The join completely missed removing goodname(), which was adjacent, but outside of, a small conflict. I only caught it by comparing the 1.1.3.2/1.1.3.3 diff. CVS ain't @@ -245,13 +245,13 @@ IDLEfork ChangeLog 2001-07-14 10:13 kbk * PyShell.py: cvs-py-rel2_1 (Rev 1.29 - 1.33) merge - + Merged the following py-cvs revs without conflict: 1.29 Reduce copyright text output at startup 1.30 Delay setting sys.args until Tkinter is fully initialized 1.31 Whitespace normalization 1.32 Turn syntax warning into error when interactive 1.33 Fix warning initialization bug - + Note that module is extensively modified wrt py-cvs 2001-07-14 06:33 kbk @@ -317,14 +317,14 @@ IDLEfork ChangeLog 2001-07-13 13:35 kbk * EditorWindow.py: py-cvs-rel2_1 (Rev 1.33 - 1.37) merge - + VP IDLE version depended on VP's ExecBinding.py and spawn.py to get the path to the Windows Doc directory (relative to python.exe). Removed this conflicting code in favor of py-cvs updates which on Windows use a hard coded path relative to the location of this module. py-cvs updates include support for webbrowser.py. Module still has BrowserControl.py for 1.5.2 support. - + At this point, the differences wrt py-cvs relate to menu functionality. @@ -1194,7 +1194,7 @@ Wed Mar 10 05:18:02 1999 Guido van Rossum ====================================================================== Python release 1.5.2b2, IDLE version 0.3 ====================================================================== - + Wed Feb 17 22:47:41 1999 Guido van Rossum * NEWS.txt: News in 0.3. @@ -1330,7 +1330,7 @@ Sat Jan 9 22:01:33 1999 Guido van Rossum ====================================================================== Python release 1.5.2b1, IDLE version 0.2 ====================================================================== - + Fri Jan 8 17:26:02 1999 Guido van Rossum * README.txt, NEWS.txt: What's new in this release. diff --git a/Lib/idlelib/README.txt b/Lib/idlelib/README.txt index 51e8ef5888c..c784a1a0b61 100644 --- a/Lib/idlelib/README.txt +++ b/Lib/idlelib/README.txt @@ -206,7 +206,7 @@ Window # windows Help - About IDLE # eEW.about_dialog, help_about.AboutDialog + About IDLE # eEW.about_dialog, help_about.AboutDialog --- IDLE Help # eEW.help_dialog, helpshow_idlehelp Python Doc # eEW.python_docs @@ -230,7 +230,7 @@ Help Center Insert # eEW.center_insert_event - + CODE STYLE -- Generally PEP 8. import diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt index a54e74ddda2..c580fb9e793 100644 --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -164,7 +164,7 @@ python -m idlelib.idle_test.htest 5. Test Coverage Install the coverage package into your Python 3.6 site-packages -directory. (Its exact location depends on the OS). +directory. (Its exact location depends on the OS). > python3 -m pip install coverage (On Windows, replace 'python3 with 'py -3.6' or perhaps just 'python'.) From webhook-mailer at python.org Thu Sep 14 23:28:27 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Fri, 15 Sep 2017 03:28:27 -0000 Subject: [Python-checkins] bpo-31464: asdl_c.py no longer emits trailing spaces in Python-ast.h. (#3568) Message-ID: https://github.com/python/cpython/commit/5d84cb368c0c3e475c25171c302068c4dfc3e396 commit: 5d84cb368c0c3e475c25171c302068c4dfc3e396 branch: master author: Serhiy Storchaka committer: Benjamin Peterson date: 2017-09-14T20:28:22-07:00 summary: bpo-31464: asdl_c.py no longer emits trailing spaces in Python-ast.h. (#3568) files: M Include/Python-ast.h M Parser/asdl_c.py diff --git a/Include/Python-ast.h b/Include/Python-ast.h index d4a4ba3ab27..26dfef8fe15 100644 --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -48,19 +48,19 @@ struct _mod { asdl_seq *body; string docstring; } Module; - + struct { asdl_seq *body; } Interactive; - + struct { expr_ty body; } Expression; - + struct { asdl_seq *body; } Suite; - + } v; }; @@ -83,7 +83,7 @@ struct _stmt { expr_ty returns; string docstring; } FunctionDef; - + struct { identifier name; arguments_ty args; @@ -92,7 +92,7 @@ struct _stmt { expr_ty returns; string docstring; } AsyncFunctionDef; - + struct { identifier name; asdl_seq *bases; @@ -101,108 +101,108 @@ struct _stmt { asdl_seq *decorator_list; string docstring; } ClassDef; - + struct { expr_ty value; } Return; - + struct { asdl_seq *targets; } Delete; - + struct { asdl_seq *targets; expr_ty value; } Assign; - + struct { expr_ty target; operator_ty op; expr_ty value; } AugAssign; - + struct { expr_ty target; expr_ty annotation; expr_ty value; int simple; } AnnAssign; - + struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } For; - + struct { expr_ty target; expr_ty iter; asdl_seq *body; asdl_seq *orelse; } AsyncFor; - + struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } While; - + struct { expr_ty test; asdl_seq *body; asdl_seq *orelse; } If; - + struct { asdl_seq *items; asdl_seq *body; } With; - + struct { asdl_seq *items; asdl_seq *body; } AsyncWith; - + struct { expr_ty exc; expr_ty cause; } Raise; - + struct { asdl_seq *body; asdl_seq *handlers; asdl_seq *orelse; asdl_seq *finalbody; } Try; - + struct { expr_ty test; expr_ty msg; } Assert; - + struct { asdl_seq *names; } Import; - + struct { identifier module; asdl_seq *names; int level; } ImportFrom; - + struct { asdl_seq *names; } Global; - + struct { asdl_seq *names; } Nonlocal; - + struct { expr_ty value; } Expr; - + } v; int lineno; int col_offset; @@ -224,145 +224,145 @@ struct _expr { boolop_ty op; asdl_seq *values; } BoolOp; - + struct { expr_ty left; operator_ty op; expr_ty right; } BinOp; - + struct { unaryop_ty op; expr_ty operand; } UnaryOp; - + struct { arguments_ty args; expr_ty body; } Lambda; - + struct { expr_ty test; expr_ty body; expr_ty orelse; } IfExp; - + struct { asdl_seq *keys; asdl_seq *values; } Dict; - + struct { asdl_seq *elts; } Set; - + struct { expr_ty elt; asdl_seq *generators; } ListComp; - + struct { expr_ty elt; asdl_seq *generators; } SetComp; - + struct { expr_ty key; expr_ty value; asdl_seq *generators; } DictComp; - + struct { expr_ty elt; asdl_seq *generators; } GeneratorExp; - + struct { expr_ty value; } Await; - + struct { expr_ty value; } Yield; - + struct { expr_ty value; } YieldFrom; - + struct { expr_ty left; asdl_int_seq *ops; asdl_seq *comparators; } Compare; - + struct { expr_ty func; asdl_seq *args; asdl_seq *keywords; } Call; - + struct { object n; } Num; - + struct { string s; } Str; - + struct { expr_ty value; int conversion; expr_ty format_spec; } FormattedValue; - + struct { asdl_seq *values; } JoinedStr; - + struct { bytes s; } Bytes; - + struct { singleton value; } NameConstant; - + struct { constant value; } Constant; - + struct { expr_ty value; identifier attr; expr_context_ty ctx; } Attribute; - + struct { expr_ty value; slice_ty slice; expr_context_ty ctx; } Subscript; - + struct { expr_ty value; expr_context_ty ctx; } Starred; - + struct { identifier id; expr_context_ty ctx; } Name; - + struct { asdl_seq *elts; expr_context_ty ctx; } List; - + struct { asdl_seq *elts; expr_context_ty ctx; } Tuple; - + } v; int lineno; int col_offset; @@ -377,15 +377,15 @@ struct _slice { expr_ty upper; expr_ty step; } Slice; - + struct { asdl_seq *dims; } ExtSlice; - + struct { expr_ty value; } Index; - + } v; }; @@ -405,7 +405,7 @@ struct _excepthandler { identifier name; asdl_seq *body; } ExceptHandler; - + } v; int lineno; int col_offset; diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index f6c3a661172..a43d2e7b834 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -94,8 +94,9 @@ def emit(self, s, depth, reflow=True): else: lines = [s] for line in lines: - line = (" " * TABSIZE * depth) + line + "\n" - self.file.write(line) + if line: + line = (" " * TABSIZE * depth) + line + self.file.write(line + "\n") class TypeDefVisitor(EmitVisitor): From webhook-mailer at python.org Fri Sep 15 03:20:13 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 15 Sep 2017 07:20:13 -0000 Subject: [Python-checkins] [2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595) Message-ID: https://github.com/python/cpython/commit/c7f165fe652651c32833245fc902c790a4f173fa commit: c7f165fe652651c32833245fc902c790a4f173fa branch: 2.7 author: Oren Milman committer: Serhiy Storchaka date: 2017-09-15T10:20:11+03:00 summary: [2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595) files: M PC/_subprocess.c diff --git a/PC/_subprocess.c b/PC/_subprocess.c index f73d14f5793..fc9aaa46113 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -341,9 +341,13 @@ getenvironment(PyObject* environment) envsize = PyMapping_Length(environment); keys = PyMapping_Keys(environment); + if (!keys) { + return NULL; + } values = PyMapping_Values(environment); - if (!keys || !values) + if (!values) { goto error; + } out = PyString_FromStringAndSize(NULL, 2048); if (! out) From solipsis at pitrou.net Fri Sep 15 05:22:09 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 15 Sep 2017 09:22:09 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=11 Message-ID: <20170915092208.91124.985637747F9ECBA6@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, 0] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogJdMb5U', '--timeout', '7200'] From webhook-mailer at python.org Fri Sep 15 08:37:45 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 15 Sep 2017 12:37:45 -0000 Subject: [Python-checkins] bpo-31234: Join timers in test_threading (#3598) Message-ID: https://github.com/python/cpython/commit/da3e5cf961f9bcc4bb376386cfe7a2865325086c commit: da3e5cf961f9bcc4bb376386cfe7a2865325086c branch: master author: Victor Stinner committer: GitHub date: 2017-09-15T05:37:42-07:00 summary: bpo-31234: Join timers in test_threading (#3598) Call the .join() method of threading.Timer timers to prevent the "threading_cleanup() failed to cleanup 1 threads" warning. files: M Lib/test/test_threading.py diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index af6796cd2e6..f7c3680bda3 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -1099,6 +1099,8 @@ def test_init_immutable_default_args(self): self.callback_event.wait() self.assertEqual(len(self.callback_args), 2) self.assertEqual(self.callback_args, [((), {}), ((), {})]) + timer1.join() + timer2.join() def _callback_spy(self, *args, **kwargs): self.callback_args.append((args[:], kwargs.copy())) From webhook-mailer at python.org Fri Sep 15 09:55:34 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 15 Sep 2017 13:55:34 -0000 Subject: [Python-checkins] bpo-31234: test_multiprocessing: wait 30 seconds (#3599) Message-ID: https://github.com/python/cpython/commit/11f0807a407551d498bb6bd8cc932636f75f1cd7 commit: 11f0807a407551d498bb6bd8cc932636f75f1cd7 branch: master author: Victor Stinner committer: GitHub date: 2017-09-15T06:55:31-07:00 summary: bpo-31234: test_multiprocessing: wait 30 seconds (#3599) Give 30 seconds to join_process(), instead of 5 or 10 seconds, to wait until the process completes. files: M Lib/test/_test_multiprocessing.py diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index bddcdadfeee..fda20f1f408 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -63,6 +63,9 @@ # # +# Timeout to wait until a process completes +TIMEOUT = 30.0 # seconds + def latin(s): return s.encode('latin') @@ -73,10 +76,10 @@ def close_queue(queue): queue.join_thread() -def join_process(process, timeout): +def join_process(process): # Since multiprocessing.Process has the same API than threading.Thread # (join() and is_alive(), the support function can be reused - support.join_thread(process, timeout) + support.join_thread(process, timeout=TIMEOUT) # @@ -484,7 +487,7 @@ def test_many_processes(self): for p in procs: p.start() for p in procs: - join_process(p, timeout=10) + join_process(p) for p in procs: self.assertEqual(p.exitcode, 0) @@ -496,7 +499,7 @@ def test_many_processes(self): for p in procs: p.terminate() for p in procs: - join_process(p, timeout=10) + join_process(p) if os.name != 'nt': for p in procs: self.assertEqual(p.exitcode, -signal.SIGTERM) @@ -659,7 +662,7 @@ def test_sys_exit(self): p = self.Process(target=self._test_sys_exit, args=(reason, testfn)) p.daemon = True p.start() - join_process(p, timeout=5) + join_process(p) self.assertEqual(p.exitcode, 1) with open(testfn, 'r') as f: @@ -672,7 +675,7 @@ def test_sys_exit(self): p = self.Process(target=sys.exit, args=(reason,)) p.daemon = True p.start() - join_process(p, timeout=5) + join_process(p) self.assertEqual(p.exitcode, reason) # @@ -1261,7 +1264,7 @@ def test_waitfor(self): state.value += 1 cond.notify() - join_process(p, timeout=5) + join_process(p) self.assertEqual(p.exitcode, 0) @classmethod @@ -1288,7 +1291,7 @@ def test_waitfor_timeout(self): args=(cond, state, success, sem)) p.daemon = True p.start() - self.assertTrue(sem.acquire(timeout=10)) + self.assertTrue(sem.acquire(timeout=TIMEOUT)) # Only increment 3 times, so state == 4 is never reached. for i in range(3): @@ -1297,7 +1300,7 @@ def test_waitfor_timeout(self): state.value += 1 cond.notify() - join_process(p, timeout=5) + join_process(p) self.assertTrue(success.value) @classmethod @@ -3079,7 +3082,7 @@ class _TestPicklingConnections(BaseTestCase): @classmethod def tearDownClass(cls): from multiprocessing import resource_sharer - resource_sharer.stop(timeout=5) + resource_sharer.stop(timeout=TIMEOUT) @classmethod def _listener(cls, conn, families): @@ -4011,7 +4014,7 @@ def test_timeout(self): self.assertEqual(conn.recv(), 456) conn.close() l.close() - join_process(p, timeout=10) + join_process(p) finally: socket.setdefaulttimeout(old_timeout) @@ -4047,7 +4050,7 @@ def child(cls, n, conn): p = multiprocessing.Process(target=cls.child, args=(n-1, conn)) p.start() conn.close() - join_process(p, timeout=5) + join_process(p) else: conn.send(len(util._afterfork_registry)) conn.close() @@ -4060,7 +4063,7 @@ def test_lock(self): p.start() w.close() new_size = r.recv() - join_process(p, timeout=5) + join_process(p) self.assertLessEqual(new_size, old_size) # @@ -4115,7 +4118,7 @@ def test_closefd(self): p.start() writer.close() e = reader.recv() - join_process(p, timeout=5) + join_process(p) finally: self.close(fd) writer.close() From webhook-mailer at python.org Fri Sep 15 12:25:30 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 15 Sep 2017 16:25:30 -0000 Subject: [Python-checkins] bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) Message-ID: https://github.com/python/cpython/commit/da67e0d644bd3185efdaa4d15cc2ac0828ca83f9 commit: da67e0d644bd3185efdaa4d15cc2ac0828ca83f9 branch: master author: Michael Seifert committer: Serhiy Storchaka date: 2017-09-15T19:25:27+03:00 summary: bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) files: M Doc/c-api/structures.rst M Doc/c-api/typeobj.rst diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 67e4f9d4b9d..797b9045fa8 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -294,3 +294,43 @@ definition with the same method name. read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies :c:macro:`READONLY`. Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` members can be deleted. (They are set to *NULL*). + + +.. c:type:: PyGetSetDef + + Structure to define property-like access for a type. See also description of + the :c:member:`PyTypeObject.tp_getset` slot. + + +-------------+------------------+-----------------------------------+ + | Field | C Type | Meaning | + +=============+==================+===================================+ + | name | const char \* | attribute name | + +-------------+------------------+-----------------------------------+ + | get | getter | C Function to get the attribute | + +-------------+------------------+-----------------------------------+ + | set | setter | optional C function to set or | + | | | delete the attribute, if omitted | + | | | the attribute is readonly | + +-------------+------------------+-----------------------------------+ + | doc | const char \* | optional docstring | + +-------------+------------------+-----------------------------------+ + | closure | void \* | optional function pointer, | + | | | providing additional data for | + | | | getter and setter | + +-------------+------------------+-----------------------------------+ + + The ``get`` function takes one :c:type:`PyObject\*` parameter (the + instance) and a function pointer (the associated ``closure``):: + + typedef PyObject *(*getter)(PyObject *, void *); + + It should return a new reference on success or *NULL* with a set exception + on failure. + + ``set`` functions take two :c:type:`PyObject\*` parameters (the instance and + the value to be set) and a function pointer (the associated ``closure``):: + + typedef int (*setter)(PyObject *, PyObject *, void *); + + In case the attribute should be deleted the second parameter is *NULL*. + Should return ``0`` on success or ``-1`` with a set exception on failure. diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 2f0081aa3db..0b4577f5b95 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -719,21 +719,6 @@ type objects) *must* have the :attr:`ob_size` field. This field is not inherited by subtypes (computed attributes are inherited through a different mechanism). - .. XXX belongs elsewhere - - Docs for PyGetSetDef:: - - typedef PyObject *(*getter)(PyObject *, void *); - typedef int (*setter)(PyObject *, PyObject *, void *); - - typedef struct PyGetSetDef { - const char *name; /* attribute name */ - getter get; /* C function to get the attribute */ - setter set; /* C function to set or delete the attribute */ - const char *doc; /* optional doc string */ - void *closure; /* optional additional data for getter and setter */ - } PyGetSetDef; - .. c:member:: PyTypeObject* PyTypeObject.tp_base From webhook-mailer at python.org Fri Sep 15 13:01:00 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Fri, 15 Sep 2017 17:01:00 -0000 Subject: [Python-checkins] Fix description in Python 3.7 What's New (#3603) Message-ID: https://github.com/python/cpython/commit/992f613fe6611f4a3e614a219d0ccb76bc4906d6 commit: 992f613fe6611f4a3e614a219d0ccb76bc4906d6 branch: master author: Paul Romano committer: Serhiy Storchaka date: 2017-09-15T20:00:57+03:00 summary: Fix description in Python 3.7 What's New (#3603) files: M Doc/whatsnew/3.7.rst diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 44911ccc354..870ca066923 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -296,9 +296,8 @@ Optimizations (Contributed by Serhiy Storchaka in :issue:`24821`.) * Fast implementation from standard C library is now used for functions - :func:`~math.tgamma`, :func:`~math.lgamma`, :func:`~math.erf` and - :func:`~math.erfc` in the :mod:`math` module. (Contributed by Serhiy - Storchaka in :issue:`26121`.) + :func:`~math.erf` and :func:`~math.erfc` in the :mod:`math` module. + (Contributed by Serhiy Storchaka in :issue:`26121`.) * The :func:`os.fwalk` function has been sped up by 2 times. This was done using the :func:`os.scandir` function. From webhook-mailer at python.org Fri Sep 15 13:05:30 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 15 Sep 2017 17:05:30 -0000 Subject: [Python-checkins] bpo-314777: IDLE - improve rstrip entry in doc (#3602) Message-ID: https://github.com/python/cpython/commit/ff702890027f404dbf5faab6730d1169b3251f66 commit: ff702890027f404dbf5faab6730d1169b3251f66 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-15T13:05:28-04:00 summary: bpo-314777: IDLE - improve rstrip entry in doc (#3602) 'Strip trailing whitespace' is not limited to spaces. Wording caters to beginners who do know know the meaning of 'whitespace'. Multiline string literals are not skipped. * News blurb. files: A Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 0faeb6df934..af153593e3c 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -190,7 +190,9 @@ Format Paragraph paragraph will be formatted to less than N columns, where N defaults to 72. Strip trailing whitespace - Remove any space characters after the last non-space character of a line. + Remove trailing space and other whitespace characters after the last + non-whitespace character of a line by applying str.rstrip to each line, + including lines within multiline strings. .. index:: single: Run script diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 9005157dd98..33ae8842055 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -227,7 +227,9 @@ multiline string or selected line in a string. All lines in the paragraph will be formatted to less than N columns, where N defaults to 72.
        Strip trailing whitespace
        -
        Remove any space characters after the last non-space character of a line.
        +
        Remove trailing space and other whitespace characters after the last +non-whitespace character of a line by applying str.rstrip to each line, +including lines within multiline strings.
        @@ -779,7 +781,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
        - Last updated on Sep 12, 2017. + Last updated on Sep 15, 2017. Found a bug?
        Created using Sphinx 1.3.6. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst new file mode 100644 index 00000000000..4b47ed3f53b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst @@ -0,0 +1,2 @@ +IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more +than blank spaces. Multiline string literals are not skipped. From webhook-mailer at python.org Fri Sep 15 14:26:08 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 15 Sep 2017 18:26:08 -0000 Subject: [Python-checkins] bpo-31386: Custom wrap_bio and wrap_socket type (#3426) Message-ID: https://github.com/python/cpython/commit/4df60f18c64ba2835e68bf3eed08d8002a00f4ac commit: 4df60f18c64ba2835e68bf3eed08d8002a00f4ac branch: master author: Christian Heimes committer: GitHub date: 2017-09-15T20:26:05+02:00 summary: bpo-31386: Custom wrap_bio and wrap_socket type (#3426) SSLSocket.wrap_bio() and SSLSocket.wrap_socket() hard-code SSLObject and SSLSocket as return types. In the light of future deprecation of ssl.wrap_socket() module function and direct instantiation of SSLSocket, it is desirable to make the return type of SSLSocket.wrap_bio() and SSLSocket.wrap_socket() customizable. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst M Doc/library/ssl.rst M Lib/ssl.py M Lib/test/test_ssl.py diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 200ab0454ef..eb4d8ace3de 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1593,8 +1593,9 @@ to speed up repeated connections from the same clients. do_handshake_on_connect=True, suppress_ragged_eofs=True, \ server_hostname=None, session=None) - Wrap an existing Python socket *sock* and return an :class:`SSLSocket` - object. *sock* must be a :data:`~socket.SOCK_STREAM` socket; other socket + Wrap an existing Python socket *sock* and return an instance of + :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). + *sock* must be a :data:`~socket.SOCK_STREAM` socket; other socket types are unsupported. The returned SSL socket is tied to the context, its settings and @@ -1617,12 +1618,25 @@ to speed up repeated connections from the same clients. .. versionchanged:: 3.6 *session* argument was added. + .. versionchanged:: 3.7 + The method returns on instance of :attr:`SSLContext.sslsocket_class` + instead of hard-coded :class:`SSLSocket`. + +.. attribute:: SSLContext.sslsocket_class + + The return type of :meth:`SSLContext.wrap_sockets`, defaults to + :class:`SSLSocket`. The attribute can be overridden on instance of class + in order to return a custom subclass of :class:`SSLSocket`. + + .. versionadded:: 3.7 + .. method:: SSLContext.wrap_bio(incoming, outgoing, server_side=False, \ server_hostname=None, session=None) - Create a new :class:`SSLObject` instance by wrapping the BIO objects - *incoming* and *outgoing*. The SSL routines will read input data from the - incoming BIO and write data to the outgoing BIO. + Wrap the BIO objects *incoming* and *outgoing* and return an instance of + attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL + routines will read input data from the incoming BIO and write data to the + outgoing BIO. The *server_side*, *server_hostname* and *session* parameters have the same meaning as in :meth:`SSLContext.wrap_socket`. @@ -1630,6 +1644,18 @@ to speed up repeated connections from the same clients. .. versionchanged:: 3.6 *session* argument was added. + .. versionchanged:: 3.7 + The method returns on instance of :attr:`SSLContext.sslobject_class` + instead of hard-coded :class:`SSLObject`. + +.. attribute:: SSLContext.sslobject_class + + The return type of :meth:`SSLContext.wrap_bio`, defaults to + :class:`SSLObject`. The attribute can be overridden on instance of class + in order to return a custom subclass of :class:`SSLObject`. + + .. versionadded:: 3.7 + .. method:: SSLContext.session_stats() Get statistics about the SSL sessions created or managed by this context. diff --git a/Lib/ssl.py b/Lib/ssl.py index 062e8021180..2849deee07e 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -383,10 +383,11 @@ class Purpose(_ASN1Object, _Enum): class SSLContext(_SSLContext): """An SSLContext holds various SSL-related configuration options and data, such as certificates and possibly a private key.""" - - __slots__ = ('protocol', '__weakref__') _windows_cert_stores = ("CA", "ROOT") + sslsocket_class = None # SSLSocket is assigned later. + sslobject_class = None # SSLObject is assigned later. + def __new__(cls, protocol=PROTOCOL_TLS, *args, **kwargs): self = _SSLContext.__new__(cls, protocol) if protocol != _SSLv2_IF_EXISTS: @@ -400,17 +401,21 @@ def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None, session=None): - return SSLSocket(sock=sock, server_side=server_side, - do_handshake_on_connect=do_handshake_on_connect, - suppress_ragged_eofs=suppress_ragged_eofs, - server_hostname=server_hostname, - _context=self, _session=session) + return self.sslsocket_class( + sock=sock, + server_side=server_side, + do_handshake_on_connect=do_handshake_on_connect, + suppress_ragged_eofs=suppress_ragged_eofs, + server_hostname=server_hostname, + _context=self, + _session=session + ) def wrap_bio(self, incoming, outgoing, server_side=False, server_hostname=None, session=None): sslobj = self._wrap_bio(incoming, outgoing, server_side=server_side, server_hostname=server_hostname) - return SSLObject(sslobj, session=session) + return self.sslobject_class(sslobj, session=session) def set_npn_protocols(self, npn_protocols): protos = bytearray() @@ -1135,6 +1140,11 @@ def version(self): return self._sslobj.version() +# Python does not support forward declaration of types. +SSLContext.sslsocket_class = SSLSocket +SSLContext.sslobject_class = SSLObject + + def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_TLS, ca_certs=None, diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 523322da2f6..fb5958f1a5e 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1359,6 +1359,22 @@ def test_context_client_server(self): self.assertFalse(ctx.check_hostname) self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) + def test_context_custom_class(self): + class MySSLSocket(ssl.SSLSocket): + pass + + class MySSLObject(ssl.SSLObject): + pass + + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ctx.sslsocket_class = MySSLSocket + ctx.sslobject_class = MySSLObject + + with ctx.wrap_socket(socket.socket(), server_side=True) as sock: + self.assertIsInstance(sock, MySSLSocket) + obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO()) + self.assertIsInstance(obj, MySSLObject) + class SSLErrorTests(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst b/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst new file mode 100644 index 00000000000..95a6c2b48b3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst @@ -0,0 +1,2 @@ +Make return types of SSLContext.wrap_bio() and SSLContext.wrap_socket() +customizable. From webhook-mailer at python.org Fri Sep 15 14:27:26 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 15 Sep 2017 18:27:26 -0000 Subject: [Python-checkins] bpo-31474: Fix -Wint-in-bool-context warnings (#3581) Message-ID: https://github.com/python/cpython/commit/fd39e2a6845f33a74fbb0671c434c0d84a5ec2f3 commit: fd39e2a6845f33a74fbb0671c434c0d84a5ec2f3 branch: 2.7 author: Christian Heimes committer: GitHub date: 2017-09-15T20:27:23+02:00 summary: bpo-31474: Fix -Wint-in-bool-context warnings (#3581) Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Build/2017-09-14-19-38-19.bpo-31474.0s_mpD.rst M Include/pymem.h diff --git a/Include/pymem.h b/Include/pymem.h index 10b5bea5eb8..2c239df590d 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -72,9 +72,9 @@ PyAPI_FUNC(void) PyMem_Free(void *); /* Returns NULL to indicate error if a negative size or size larger than Py_ssize_t can represent is supplied. Helps prevents security holes. */ #define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ - : malloc((n) ? (n) : 1)) + : malloc(((n) != 0) ? (n) : 1)) #define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ - : realloc((p), (n) ? (n) : 1)) + : realloc((p), ((n) != 0) ? (n) : 1)) #define PyMem_FREE free #endif /* PYMALLOC_DEBUG */ diff --git a/Misc/NEWS.d/next/Build/2017-09-14-19-38-19.bpo-31474.0s_mpD.rst b/Misc/NEWS.d/next/Build/2017-09-14-19-38-19.bpo-31474.0s_mpD.rst new file mode 100644 index 00000000000..41505aa4f7e --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-14-19-38-19.bpo-31474.0s_mpD.rst @@ -0,0 +1 @@ +Fix -Wint-in-bool-context warnings in PyMem_MALLOC and PyMem_REALLOC macros From webhook-mailer at python.org Fri Sep 15 14:27:33 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 15 Sep 2017 18:27:33 -0000 Subject: [Python-checkins] bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058) Message-ID: https://github.com/python/cpython/commit/a170fa162dc03f0a014373349e548954fff2e567 commit: a170fa162dc03f0a014373349e548954fff2e567 branch: master author: Christian Heimes committer: GitHub date: 2017-09-15T20:27:30+02:00 summary: bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058) Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER. Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst M Lib/asyncio/test_utils.py M Lib/ftplib.py M Lib/ssl.py M Lib/test/test_asyncio/test_events.py M Lib/test/test_ftplib.py M Lib/test/test_httplib.py M Lib/test/test_imaplib.py M Lib/test/test_logging.py M Lib/test/test_poplib.py M Lib/test/test_smtpnet.py M Lib/test/test_ssl.py M Lib/test/test_urllib2_localnet.py diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index ecb3fca097b..65805947fda 100644 --- a/Lib/asyncio/test_utils.py +++ b/Lib/asyncio/test_utils.py @@ -45,7 +45,7 @@ def dummy_ssl_context(): if ssl is None: return None else: - return ssl.SSLContext(ssl.PROTOCOL_SSLv23) + return ssl.SSLContext(ssl.PROTOCOL_TLS) def run_briefly(loop): diff --git a/Lib/ftplib.py b/Lib/ftplib.py index a02e595cb02..05840d49236 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -719,7 +719,7 @@ class FTP_TLS(FTP): '221 Goodbye.' >>> ''' - ssl_version = ssl.PROTOCOL_SSLv23 + ssl_version = ssl.PROTOCOL_TLS_CLIENT def __init__(self, host='', user='', passwd='', acct='', keyfile=None, certfile=None, context=None, @@ -753,7 +753,7 @@ def auth(self): '''Set up secure control connection by using TLS/SSL.''' if isinstance(self.sock, ssl.SSLSocket): raise ValueError("Already using TLS") - if self.ssl_version >= ssl.PROTOCOL_SSLv23: + if self.ssl_version >= ssl.PROTOCOL_TLS: resp = self.voidcmd('AUTH TLS') else: resp = self.voidcmd('AUTH SSL') diff --git a/Lib/ssl.py b/Lib/ssl.py index 2849deee07e..24f24b17bf1 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -522,7 +522,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, context.load_default_certs(purpose) return context -def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None, +def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=CERT_NONE, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): @@ -541,9 +541,12 @@ def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None, # by default. context = SSLContext(protocol) + if not check_hostname: + context.check_hostname = False if cert_reqs is not None: context.verify_mode = cert_reqs - context.check_hostname = check_hostname + if check_hostname: + context.check_hostname = True if keyfile and not certfile: raise ValueError("certfile must be specified") diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 33421ce4c37..736f703c2fb 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -824,13 +824,13 @@ def test_ssl_connect_accepted_socket(self): 'SSL not supported with proactor event loops before Python 3.5' ) - server_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) server_context.load_cert_chain(ONLYCERT, ONLYKEY) if hasattr(server_context, 'check_hostname'): server_context.check_hostname = False server_context.verify_mode = ssl.CERT_NONE - client_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) if hasattr(server_context, 'check_hostname'): client_context.check_hostname = False client_context.verify_mode = ssl.CERT_NONE @@ -985,7 +985,7 @@ def test_create_unix_server_path_socket_error(self): self.loop.run_until_complete(f) def _create_ssl_context(self, certfile, keyfile=None): - sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) sslcontext.options |= ssl.OP_NO_SSLv2 sslcontext.load_cert_chain(certfile, keyfile) return sslcontext @@ -1082,7 +1082,7 @@ def test_create_server_ssl_verify_failed(self): server, host, port = self._make_ssl_server( lambda: proto, SIGNED_CERTFILE) - sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) sslcontext_client.options |= ssl.OP_NO_SSLv2 sslcontext_client.verify_mode = ssl.CERT_REQUIRED if hasattr(sslcontext_client, 'check_hostname'): @@ -1116,7 +1116,7 @@ def test_create_unix_server_ssl_verify_failed(self): server, path = self._make_ssl_unix_server( lambda: proto, SIGNED_CERTFILE) - sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) sslcontext_client.options |= ssl.OP_NO_SSLv2 sslcontext_client.verify_mode = ssl.CERT_REQUIRED if hasattr(sslcontext_client, 'check_hostname'): @@ -1150,7 +1150,7 @@ def test_create_server_ssl_match_failed(self): server, host, port = self._make_ssl_server( lambda: proto, SIGNED_CERTFILE) - sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) sslcontext_client.options |= ssl.OP_NO_SSLv2 sslcontext_client.verify_mode = ssl.CERT_REQUIRED sslcontext_client.load_verify_locations( @@ -1183,7 +1183,7 @@ def test_create_unix_server_ssl_verified(self): server, path = self._make_ssl_unix_server( lambda: proto, SIGNED_CERTFILE) - sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) sslcontext_client.options |= ssl.OP_NO_SSLv2 sslcontext_client.verify_mode = ssl.CERT_REQUIRED sslcontext_client.load_verify_locations(cafile=SIGNING_CA) @@ -1212,7 +1212,7 @@ def test_create_server_ssl_verified(self): server, host, port = self._make_ssl_server( lambda: proto, SIGNED_CERTFILE) - sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) sslcontext_client.options |= ssl.OP_NO_SSLv2 sslcontext_client.verify_mode = ssl.CERT_REQUIRED sslcontext_client.load_verify_locations(cafile=SIGNING_CA) diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index 5880a1e941d..f1b0185b2bf 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -902,17 +902,11 @@ def test_auth_issued_twice(self): self.client.auth() self.assertRaises(ValueError, self.client.auth) - def test_auth_ssl(self): - try: - self.client.ssl_version = ssl.PROTOCOL_SSLv23 - self.client.auth() - self.assertRaises(ValueError, self.client.auth) - finally: - self.client.ssl_version = ssl.PROTOCOL_TLSv1 - def test_context(self): self.client.quit() - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ctx.check_hostname = False + ctx.verify_mode = ssl.CERT_NONE self.assertRaises(ValueError, ftplib.FTP_TLS, keyfile=CERTFILE, context=ctx) self.assertRaises(ValueError, ftplib.FTP_TLS, certfile=CERTFILE, @@ -941,9 +935,9 @@ def test_ccc(self): def test_check_hostname(self): self.client.quit() - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.check_hostname = True + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + self.assertEqual(ctx.check_hostname, True) ctx.load_verify_locations(CAFILE) self.client = ftplib.FTP_TLS(context=ctx, timeout=TIMEOUT) diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 68f6946a3a1..ab798a2525e 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1583,8 +1583,9 @@ def test_networked_good_cert(self): import ssl support.requires('network') with support.transient_internet('self-signed.pythontest.net'): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertEqual(context.verify_mode, ssl.CERT_REQUIRED) + self.assertEqual(context.check_hostname, True) context.load_verify_locations(CERT_selfsigned_pythontestdotnet) h = client.HTTPSConnection('self-signed.pythontest.net', 443, context=context) h.request('GET', '/') @@ -1599,8 +1600,7 @@ def test_networked_bad_cert(self): import ssl support.requires('network') with support.transient_internet('self-signed.pythontest.net'): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.load_verify_locations(CERT_localhost) h = client.HTTPSConnection('self-signed.pythontest.net', 443, context=context) with self.assertRaises(ssl.SSLError) as exc_info: @@ -1620,8 +1620,7 @@ def test_local_good_hostname(self): # The (valid) cert validates the HTTP hostname import ssl server = self.make_server(CERT_localhost) - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.load_verify_locations(CERT_localhost) h = client.HTTPSConnection('localhost', server.port, context=context) self.addCleanup(h.close) @@ -1634,9 +1633,7 @@ def test_local_bad_hostname(self): # The (valid) cert doesn't validate the HTTP hostname import ssl server = self.make_server(CERT_fakehostname) - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED - context.check_hostname = True + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.load_verify_locations(CERT_fakehostname) h = client.HTTPSConnection('localhost', server.port, context=context) with self.assertRaises(ssl.CertificateError): diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 2b62b05a594..4a45be65724 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -479,9 +479,9 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): server_class = SecureTCPServer def test_ssl_raises(self): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ssl_context.verify_mode = ssl.CERT_REQUIRED - ssl_context.check_hostname = True + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertEqual(ssl_context.verify_mode, ssl.CERT_REQUIRED) + self.assertEqual(ssl_context.check_hostname, True) ssl_context.load_verify_locations(CAFILE) with self.assertRaisesRegex(ssl.CertificateError, @@ -492,9 +492,7 @@ def test_ssl_raises(self): client.shutdown() def test_ssl_verified(self): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ssl_context.verify_mode = ssl.CERT_REQUIRED - ssl_context.check_hostname = True + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ssl_context.load_verify_locations(CAFILE) _, server = self._setup(SimpleIMAPHandler) @@ -871,9 +869,7 @@ class ThreadedNetworkedTestsSSL(ThreadedNetworkedTests): @reap_threads def test_ssl_verified(self): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ssl_context.verify_mode = ssl.CERT_REQUIRED - ssl_context.check_hostname = True + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ssl_context.load_verify_locations(CAFILE) with self.assertRaisesRegex( @@ -953,7 +949,9 @@ def tearDown(self): pass def create_ssl_context(self): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE ssl_context.load_cert_chain(CERTFILE) return ssl_context diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index d264d786720..fb0de9de046 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1792,7 +1792,7 @@ def test_output(self): else: here = os.path.dirname(__file__) localhost_cert = os.path.join(here, "keycert.pem") - sslctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) sslctx.load_cert_chain(localhost_cert) context = ssl.create_default_context(cafile=localhost_cert) diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 721ea252011..9ba678f2039 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -352,10 +352,10 @@ def test_stls(self): @requires_ssl def test_stls_context(self): expected = b'+OK Begin TLS negotiation' - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_verify_locations(CAFILE) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.check_hostname = True + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + self.assertEqual(ctx.check_hostname, True) with self.assertRaises(ssl.CertificateError): resp = self.client.stls(context=ctx) self.client = poplib.POP3("localhost", self.server.port, timeout=3) @@ -392,7 +392,9 @@ def test__all__(self): self.assertIn('POP3_SSL', poplib.__all__) def test_context(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ctx.check_hostname = False + ctx.verify_mode = ssl.CERT_NONE self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, self.server.port, keyfile=CERTFILE, context=ctx) self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py index cc9bab43f4f..b69cd9de627 100644 --- a/Lib/test/test_smtpnet.py +++ b/Lib/test/test_smtpnet.py @@ -25,7 +25,9 @@ class SmtpTest(unittest.TestCase): def test_connect_starttls(self): support.get_attribute(smtplib, 'SMTP_SSL') - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE with support.transient_internet(self.testServer): server = smtplib.SMTP(self.testServer, self.remotePort) try: @@ -58,7 +60,9 @@ def test_connect_default_port(self): server.quit() def test_connect_using_sslcontext(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE support.get_attribute(smtplib, 'SMTP_SSL') with support.transient_internet(self.testServer): server = smtplib.SMTP_SSL(self.testServer, self.remotePort, context=context) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index fb5958f1a5e..2978b8b3ebd 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -60,7 +60,9 @@ def data_file(*name): # Two keys and certs signed by the same CA (for SNI tests) SIGNED_CERTFILE = data_file("keycert3.pem") +SIGNED_CERTFILE_HOSTNAME = 'localhost' SIGNED_CERTFILE2 = data_file("keycert4.pem") +SIGNED_CERTFILE2_HOSTNAME = 'fakehostname' # Same certificate as pycacert.pem, but without extra text in file SIGNING_CA = data_file("capath", "ceff1710.0") # cert with all kinds of subject alt names @@ -147,6 +149,8 @@ def test_wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLS, *, **kwargs): context = ssl.SSLContext(ssl_version) if cert_reqs is not None: + if cert_reqs == ssl.CERT_NONE: + context.check_hostname = False context.verify_mode = cert_reqs if ca_certs is not None: context.load_verify_locations(ca_certs) @@ -156,6 +160,28 @@ def test_wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLS, *, context.set_ciphers(ciphers) return context.wrap_socket(sock, **kwargs) + +def testing_context(server_cert=SIGNED_CERTFILE): + """Create context + + client_context, server_context, hostname = testing_context() + """ + if server_cert == SIGNED_CERTFILE: + hostname = SIGNED_CERTFILE_HOSTNAME + elif server_cert == SIGNED_CERTFILE2: + hostname = SIGNED_CERTFILE2_HOSTNAME + else: + raise ValueError(server_cert) + + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + client_context.load_verify_locations(SIGNING_CA) + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + server_context.load_cert_chain(server_cert) + + return client_context, server_context, hostname + + class BasicSocketTests(unittest.TestCase): def test_constants(self): @@ -177,6 +203,7 @@ def test_constants(self): if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1): ssl.OP_NO_TLSv1_1 ssl.OP_NO_TLSv1_2 + self.assertEqual(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv23) def test_str_for_enums(self): # Make sure that the PROTOCOL_* constants have enum-like string @@ -447,8 +474,7 @@ def bad_cert_test(self, certfile): self.addCleanup(sock.close) with self.assertRaises(ssl.SSLError): test_wrap_socket(sock, - certfile=certfile, - ssl_version=ssl.PROTOCOL_TLSv1) + certfile=certfile) def test_empty_cert(self): """Wrapping with an empty cert file""" @@ -621,7 +647,7 @@ def fail(cert, hostname): def test_server_side(self): # server_hostname doesn't work for server sockets - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) with socket.socket() as sock: self.assertRaises(ValueError, ctx.wrap_socket, sock, True, server_hostname="some.hostname") @@ -772,7 +798,7 @@ def test_unsupported_dtls(self): with self.assertRaises(NotImplementedError) as cx: test_wrap_socket(s, cert_reqs=ssl.CERT_NONE) self.assertEqual(str(cx.exception), "only stream sockets are supported") - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) with self.assertRaises(NotImplementedError) as cx: ctx.wrap_socket(s) self.assertEqual(str(cx.exception), "only stream sockets are supported") @@ -877,7 +903,7 @@ def test_protocol(self): self.assertEqual(ctx.protocol, proto) def test_ciphers(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.set_ciphers("ALL") ctx.set_ciphers("DEFAULT") with self.assertRaisesRegex(ssl.SSLError, "No cipher can be selected"): @@ -885,7 +911,7 @@ def test_ciphers(self): @unittest.skipIf(ssl.OPENSSL_VERSION_INFO < (1, 0, 2, 0, 0), 'OpenSSL too old') def test_get_ciphers(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.set_ciphers('AESGCM') names = set(d['name'] for d in ctx.get_ciphers()) self.assertIn('AES256-GCM-SHA384', names) @@ -893,7 +919,7 @@ def test_get_ciphers(self): @skip_if_broken_ubuntu_ssl def test_options(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) # SSLContext also enables these by default @@ -912,8 +938,8 @@ def test_options(self): with self.assertRaises(ValueError): ctx.options = 0 - def test_verify_mode(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + def test_verify_mode_protocol(self): + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) # Default value self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) ctx.verify_mode = ssl.CERT_OPTIONAL @@ -927,10 +953,19 @@ def test_verify_mode(self): with self.assertRaises(ValueError): ctx.verify_mode = 42 + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) + self.assertFalse(ctx.check_hostname) + + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + self.assertTrue(ctx.check_hostname) + + @unittest.skipUnless(have_verify_flags(), "verify_flags need OpenSSL > 0.9.8") def test_verify_flags(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) # default value tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0) self.assertEqual(ctx.verify_flags, ssl.VERIFY_DEFAULT | tf) @@ -948,7 +983,7 @@ def test_verify_flags(self): ctx.verify_flags = None def test_load_cert_chain(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) # Combined key and cert in a single file ctx.load_cert_chain(CERTFILE, keyfile=None) ctx.load_cert_chain(CERTFILE, keyfile=CERTFILE) @@ -961,7 +996,7 @@ def test_load_cert_chain(self): with self.assertRaisesRegex(ssl.SSLError, "PEM lib"): ctx.load_cert_chain(EMPTYCERT) # Separate key and cert - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_cert_chain(ONLYCERT, ONLYKEY) ctx.load_cert_chain(certfile=ONLYCERT, keyfile=ONLYKEY) ctx.load_cert_chain(certfile=BYTES_ONLYCERT, keyfile=BYTES_ONLYKEY) @@ -972,7 +1007,7 @@ def test_load_cert_chain(self): with self.assertRaisesRegex(ssl.SSLError, "PEM lib"): ctx.load_cert_chain(certfile=ONLYKEY, keyfile=ONLYCERT) # Mismatching key and cert - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) with self.assertRaisesRegex(ssl.SSLError, "key values mismatch"): ctx.load_cert_chain(CAFILE_CACERT, ONLYKEY) # Password protected key and cert @@ -1031,7 +1066,7 @@ def getpass(self): ctx.load_cert_chain(CERTFILE, password=getpass_exception) def test_load_verify_locations(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_verify_locations(CERTFILE) ctx.load_verify_locations(cafile=CERTFILE, capath=None) ctx.load_verify_locations(BYTES_CERTFILE) @@ -1059,7 +1094,7 @@ def test_load_verify_cadata(self): neuronio_der = ssl.PEM_cert_to_DER_cert(neuronio_pem) # test PEM - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 0) ctx.load_verify_locations(cadata=cacert_pem) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 1) @@ -1070,20 +1105,20 @@ def test_load_verify_cadata(self): self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) # combined - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) combined = "\n".join((cacert_pem, neuronio_pem)) ctx.load_verify_locations(cadata=combined) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) # with junk around the certs - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) combined = ["head", cacert_pem, "other", neuronio_pem, "again", neuronio_pem, "tail"] ctx.load_verify_locations(cadata="\n".join(combined)) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) # test DER - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_verify_locations(cadata=cacert_der) ctx.load_verify_locations(cadata=neuronio_der) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) @@ -1092,13 +1127,13 @@ def test_load_verify_cadata(self): self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) # combined - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) combined = b"".join((cacert_der, neuronio_der)) ctx.load_verify_locations(cadata=combined) self.assertEqual(ctx.cert_store_stats()["x509_ca"], 2) # error cases - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self.assertRaises(TypeError, ctx.load_verify_locations, cadata=object) with self.assertRaisesRegex(ssl.SSLError, "no start line"): @@ -1108,7 +1143,7 @@ def test_load_verify_cadata(self): def test_load_dh_params(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_dh_params(DHFILE) if os.name != 'nt': ctx.load_dh_params(BYTES_DHFILE) @@ -1141,12 +1176,12 @@ def test_session_stats(self): def test_set_default_verify_paths(self): # There's not much we can do to test that it acts as expected, # so just check it doesn't crash or raise an exception. - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.set_default_verify_paths() @unittest.skipUnless(ssl.HAS_ECDH, "ECDH disabled on this OpenSSL build") def test_set_ecdh_curve(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.set_ecdh_curve("prime256v1") ctx.set_ecdh_curve(b"prime256v1") self.assertRaises(TypeError, ctx.set_ecdh_curve) @@ -1156,7 +1191,7 @@ def test_set_ecdh_curve(self): @needs_sni def test_sni_callback(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) # set_servername_callback expects a callable, or None self.assertRaises(TypeError, ctx.set_servername_callback) @@ -1173,7 +1208,7 @@ def dummycallback(sock, servername, ctx): def test_sni_callback_refcycle(self): # Reference cycles through the servername callback are detected # and cleared. - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) def dummycallback(sock, servername, ctx, cycle=ctx): pass ctx.set_servername_callback(dummycallback) @@ -1183,7 +1218,7 @@ def dummycallback(sock, servername, ctx, cycle=ctx): self.assertIs(wr(), None) def test_cert_store_stats(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self.assertEqual(ctx.cert_store_stats(), {'x509_ca': 0, 'crl': 0, 'x509': 0}) ctx.load_cert_chain(CERTFILE) @@ -1197,7 +1232,7 @@ def test_cert_store_stats(self): {'x509_ca': 1, 'crl': 0, 'x509': 2}) def test_get_ca_certs(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self.assertEqual(ctx.get_ca_certs(), []) # CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE ctx.load_verify_locations(CERTFILE) @@ -1225,24 +1260,24 @@ def test_get_ca_certs(self): self.assertEqual(ctx.get_ca_certs(True), [der]) def test_load_default_certs(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_default_certs() - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_default_certs(ssl.Purpose.SERVER_AUTH) ctx.load_default_certs() - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_default_certs(ssl.Purpose.CLIENT_AUTH) - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self.assertRaises(TypeError, ctx.load_default_certs, None) self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH') @unittest.skipIf(sys.platform == "win32", "not-Windows specific") @unittest.skipIf(IS_LIBRESSL, "LibreSSL doesn't support env vars") def test_load_default_certs_env(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) with support.EnvironmentVarGuard() as env: env["SSL_CERT_DIR"] = CAPATH env["SSL_CERT_FILE"] = CERTFILE @@ -1252,11 +1287,11 @@ def test_load_default_certs_env(self): @unittest.skipUnless(sys.platform == "win32", "Windows specific") @unittest.skipIf(hasattr(sys, "gettotalrefcount"), "Debug build does not share environment between CRTs") def test_load_default_certs_env_windows(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_default_certs() stats = ctx.cert_store_stats() - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) with support.EnvironmentVarGuard() as env: env["SSL_CERT_DIR"] = CAPATH env["SSL_CERT_FILE"] = CERTFILE @@ -1282,28 +1317,27 @@ def _assert_context_options(self, ctx): def test_create_default_context(self): ctx = ssl.create_default_context() - self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23) + self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) self.assertTrue(ctx.check_hostname) self._assert_context_options(ctx) - with open(SIGNING_CA) as f: cadata = f.read() ctx = ssl.create_default_context(cafile=SIGNING_CA, capath=CAPATH, cadata=cadata) - self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23) + self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) self._assert_context_options(ctx) ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) - self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23) + self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) self._assert_context_options(ctx) def test__create_stdlib_context(self): ctx = ssl._create_stdlib_context() - self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23) + self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) self.assertFalse(ctx.check_hostname) self._assert_context_options(ctx) @@ -1322,12 +1356,12 @@ def test__create_stdlib_context(self): self._assert_context_options(ctx) ctx = ssl._create_stdlib_context(purpose=ssl.Purpose.CLIENT_AUTH) - self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23) + self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) self._assert_context_options(ctx) def test_check_hostname(self): - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) self.assertFalse(ctx.check_hostname) # Requires CERT_REQUIRED or CERT_OPTIONAL @@ -1390,7 +1424,7 @@ def test_str(self): def test_lib_reason(self): # Test the library and reason attributes - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) with self.assertRaises(ssl.SSLError) as cm: ctx.load_dh_params(CERTFILE) self.assertEqual(cm.exception.library, 'PEM') @@ -1401,7 +1435,9 @@ def test_lib_reason(self): def test_subclass(self): # Check that the appropriate SSLError subclass is raised # (this only tests one of them) - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ctx.check_hostname = False + ctx.verify_mode = ssl.CERT_NONE with socket.socket() as s: s.bind(("127.0.0.1", 0)) s.listen() @@ -1562,7 +1598,7 @@ def test_non_blocking_connect_ex(self): def test_connect_with_context(self): # Same as test_connect, but with a separately created context - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: s.connect(self.server_addr) self.assertEqual({}, s.getpeercert()) @@ -1582,7 +1618,7 @@ def test_connect_with_context_fail(self): # This should fail because we have no verification certs. Connection # failure crashes ThreadedEchoServer, so run this in an independent # test method. - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_REQUIRED s = ctx.wrap_socket(socket.socket(socket.AF_INET)) self.addCleanup(s.close) @@ -1595,7 +1631,7 @@ def test_connect_capath(self): # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must # contain both versions of each certificate (same content, different # filename) for this test to be portable across OpenSSL releases. - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_verify_locations(capath=CAPATH) with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: @@ -1603,7 +1639,7 @@ def test_connect_capath(self): cert = s.getpeercert() self.assertTrue(cert) # Same with a bytes `capath` argument - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_verify_locations(capath=BYTES_CAPATH) with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: @@ -1615,7 +1651,7 @@ def test_connect_cadata(self): with open(SIGNING_CA) as f: pem = f.read() der = ssl.PEM_cert_to_DER_cert(pem) - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_verify_locations(cadata=pem) with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: @@ -1624,7 +1660,7 @@ def test_connect_cadata(self): self.assertTrue(cert) # same with DER - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_verify_locations(cadata=der) with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: @@ -1696,11 +1732,11 @@ def test_ciphers(self): def test_get_ca_certs_capath(self): # capath certs are loaded on request - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ctx.verify_mode = ssl.CERT_REQUIRED + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_verify_locations(capath=CAPATH) self.assertEqual(ctx.get_ca_certs(), []) - with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s: + with ctx.wrap_socket(socket.socket(socket.AF_INET), + server_hostname='localhost') as s: s.connect(self.server_addr) cert = s.getpeercert() self.assertTrue(cert) @@ -1709,10 +1745,12 @@ def test_get_ca_certs_capath(self): @needs_sni def test_context_setget(self): # Check that the context of a connected socket can be replaced. - ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - ctx2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ctx1.load_verify_locations(capath=CAPATH) + ctx2 = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ctx2.load_verify_locations(capath=CAPATH) s = socket.socket(socket.AF_INET) - with ctx1.wrap_socket(s) as ss: + with ctx1.wrap_socket(s, server_hostname='localhost') as ss: ss.connect(self.server_addr) self.assertIs(ss.context, ctx1) self.assertIs(ss._sslobj.context, ctx1) @@ -1763,11 +1801,12 @@ def test_bio_handshake(self): sock.connect(self.server_addr) incoming = ssl.MemoryBIO() outgoing = ssl.MemoryBIO() - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - ctx.verify_mode = ssl.CERT_REQUIRED + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + self.assertTrue(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) ctx.load_verify_locations(SIGNING_CA) - ctx.check_hostname = True - sslobj = ctx.wrap_bio(incoming, outgoing, False, 'localhost') + sslobj = ctx.wrap_bio(incoming, outgoing, False, + SIGNED_CERTFILE_HOSTNAME) self.assertIs(sslobj._sslobj.owner, sslobj) self.assertIsNone(sslobj.cipher()) self.assertIsNone(sslobj.version()) @@ -1796,7 +1835,7 @@ def test_bio_read_write_data(self): sock.connect(self.server_addr) incoming = ssl.MemoryBIO() outgoing = ssl.MemoryBIO() - ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) ctx.verify_mode = ssl.CERT_NONE sslobj = ctx.wrap_bio(incoming, outgoing, False) self.ssl_io_loop(sock, incoming, outgoing, sslobj.do_handshake) @@ -2008,7 +2047,7 @@ def __init__(self, certificate=None, ssl_version=None, else: self.context = ssl.SSLContext(ssl_version if ssl_version is not None - else ssl.PROTOCOL_TLSv1) + else ssl.PROTOCOL_TLS_SERVER) self.context.verify_mode = (certreqs if certreqs is not None else ssl.CERT_NONE) if cacerts: @@ -2271,7 +2310,7 @@ def try_protocol_combo(server_protocol, client_protocol, expect_success, # NOTE: we must enable "ALL" ciphers on the client, otherwise an # SSLv23 client will send an SSLv3 hello (rather than SSLv2) # starting from OpenSSL 1.0.0 (see issue #8322). - if client_context.protocol == ssl.PROTOCOL_SSLv23: + if client_context.protocol == ssl.PROTOCOL_TLS: client_context.set_ciphers("ALL") for ctx in (client_context, server_context): @@ -2317,17 +2356,13 @@ def test_echo(self): server_params_test(context, context, chatty=True, connectionchatty=True) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - client_context.load_verify_locations(SIGNING_CA) - server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) - # server_context.load_verify_locations(SIGNING_CA) - server_context.load_cert_chain(SIGNED_CERTFILE2) + client_context, server_context, hostname = testing_context() with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER): server_params_test(client_context=client_context, server_context=server_context, chatty=True, connectionchatty=True, - sni_name='fakehostname') + sni_name=hostname) client_context.check_hostname = False with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT): @@ -2335,7 +2370,7 @@ def test_echo(self): server_params_test(client_context=server_context, server_context=client_context, chatty=True, connectionchatty=True, - sni_name='fakehostname') + sni_name=hostname) self.assertIn('called a function you should not call', str(e.exception)) @@ -2355,44 +2390,41 @@ def test_echo(self): self.assertIn('called a function you should not call', str(e.exception)) - def test_getpeercert(self): if support.verbose: sys.stdout.write("\n") - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = ThreadedEchoServer(context=context, chatty=False) + + client_context, server_context, hostname = testing_context() + server = ThreadedEchoServer(context=server_context, chatty=False) with server: - s = context.wrap_socket(socket.socket(), - do_handshake_on_connect=False) - s.connect((HOST, server.port)) - # getpeercert() raise ValueError while the handshake isn't - # done. - with self.assertRaises(ValueError): - s.getpeercert() - s.do_handshake() - cert = s.getpeercert() - self.assertTrue(cert, "Can't get peer certificate.") - cipher = s.cipher() - if support.verbose: - sys.stdout.write(pprint.pformat(cert) + '\n') - sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') - if 'subject' not in cert: - self.fail("No subject field in certificate: %s." % - pprint.pformat(cert)) - if ((('organizationName', 'Python Software Foundation'),) - not in cert['subject']): - self.fail( - "Missing or invalid 'organizationName' field in certificate subject; " - "should be 'Python Software Foundation'.") - self.assertIn('notBefore', cert) - self.assertIn('notAfter', cert) - before = ssl.cert_time_to_seconds(cert['notBefore']) - after = ssl.cert_time_to_seconds(cert['notAfter']) - self.assertLess(before, after) - s.close() + with client_context.wrap_socket(socket.socket(), + do_handshake_on_connect=False, + server_hostname=hostname) as s: + s.connect((HOST, server.port)) + # getpeercert() raise ValueError while the handshake isn't + # done. + with self.assertRaises(ValueError): + s.getpeercert() + s.do_handshake() + cert = s.getpeercert() + self.assertTrue(cert, "Can't get peer certificate.") + cipher = s.cipher() + if support.verbose: + sys.stdout.write(pprint.pformat(cert) + '\n') + sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') + if 'subject' not in cert: + self.fail("No subject field in certificate: %s." % + pprint.pformat(cert)) + if ((('organizationName', 'Python Software Foundation'),) + not in cert['subject']): + self.fail( + "Missing or invalid 'organizationName' field in certificate subject; " + "should be 'Python Software Foundation'.") + self.assertIn('notBefore', cert) + self.assertIn('notAfter', cert) + before = ssl.cert_time_to_seconds(cert['notBefore']) + after = ssl.cert_time_to_seconds(cert['notAfter']) + self.assertLess(before, after) @unittest.skipUnless(have_verify_flags(), "verify_flags need OpenSSL > 0.9.8") @@ -2400,39 +2432,38 @@ def test_crl_check(self): if support.verbose: sys.stdout.write("\n") - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) + client_context, server_context, hostname = testing_context() - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(SIGNING_CA) tf = getattr(ssl, "VERIFY_X509_TRUSTED_FIRST", 0) - self.assertEqual(context.verify_flags, ssl.VERIFY_DEFAULT | tf) + self.assertEqual(client_context.verify_flags, ssl.VERIFY_DEFAULT | tf) # VERIFY_DEFAULT should pass server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: s.connect((HOST, server.port)) cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") # VERIFY_CRL_CHECK_LEAF without a loaded CRL file fails - context.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF + client_context.verify_flags |= ssl.VERIFY_CRL_CHECK_LEAF server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: with self.assertRaisesRegex(ssl.SSLError, "certificate verify failed"): s.connect((HOST, server.port)) # now load a CRL file. The CRL file is signed by the CA. - context.load_verify_locations(CRLFILE) + client_context.load_verify_locations(CRLFILE) server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: s.connect((HOST, server.port)) cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") @@ -2441,19 +2472,13 @@ def test_check_hostname(self): if support.verbose: sys.stdout.write("\n") - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.verify_mode = ssl.CERT_REQUIRED - context.check_hostname = True - context.load_verify_locations(SIGNING_CA) + client_context, server_context, hostname = testing_context() # correct hostname should verify server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with context.wrap_socket(socket.socket(), - server_hostname="localhost") as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: s.connect((HOST, server.port)) cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") @@ -2461,8 +2486,8 @@ def test_check_hostname(self): # incorrect hostname should raise an exception server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with context.wrap_socket(socket.socket(), - server_hostname="invalid") as s: + with client_context.wrap_socket(socket.socket(), + server_hostname="invalid") as s: with self.assertRaisesRegex(ssl.CertificateError, "hostname 'invalid' doesn't match 'localhost'"): s.connect((HOST, server.port)) @@ -2473,7 +2498,7 @@ def test_check_hostname(self): with socket.socket() as s: with self.assertRaisesRegex(ValueError, "check_hostname requires server_hostname"): - context.wrap_socket(s) + client_context.wrap_socket(s) def test_wrong_cert(self): """Connecting when the server rejects the client's certificate @@ -2489,9 +2514,7 @@ def test_wrong_cert(self): connectionchatty=False) with server, \ socket.socket() as sock, \ - test_wrap_socket(sock, - certfile=certfile, - ssl_version=ssl.PROTOCOL_TLSv1) as s: + test_wrap_socket(sock, certfile=certfile) as s: try: # Expect either an SSL error about the server rejecting # the connection, or a low-level connection reset (which @@ -2561,7 +2584,7 @@ def test_ssl_cert_verify_error(self): server = ThreadedEchoServer(context=server_context, chatty=True) with server: with context.wrap_socket(socket.socket(), - server_hostname="localhost") as s: + server_hostname=SIGNED_CERTFILE_HOSTNAME) as s: try: s.connect((HOST, server.port)) except ssl.SSLError as e: @@ -2582,28 +2605,28 @@ def test_protocol_sslv2(self): try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False) + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False) if hasattr(ssl, 'PROTOCOL_SSLv3'): try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False) try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) # SSLv23 client with specific SSL options if no_sslv2_implies_sslv3_hello(): # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_SSLv2) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_SSLv3) - try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1) @skip_if_broken_ubuntu_ssl - def test_protocol_sslv23(self): + def test_PROTOCOL_TLS(self): """Connecting to an SSLv23 server with various client options""" if support.verbose: sys.stdout.write("\n") if hasattr(ssl, 'PROTOCOL_SSLv2'): try: - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv2, True) except OSError as x: # this fails on some older versions of OpenSSL (0.9.7l, for instance) if support.verbose: @@ -2611,28 +2634,28 @@ def test_protocol_sslv23(self): " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" % str(x)) if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1') + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1') if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_OPTIONAL) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True, ssl.CERT_OPTIONAL) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_OPTIONAL) if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, ssl.CERT_REQUIRED) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True, ssl.CERT_REQUIRED) + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1', ssl.CERT_REQUIRED) # Server with specific SSL options if hasattr(ssl, 'PROTOCOL_SSLv3'): - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, False, + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv3, False, server_options=ssl.OP_NO_SSLv3) # Will choose TLSv1 - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True, + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS, True, server_options=ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, False, + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, False, server_options=ssl.OP_NO_TLSv1) @@ -2648,12 +2671,12 @@ def test_protocol_sslv3(self): try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, 'SSLv3', ssl.CERT_REQUIRED) if hasattr(ssl, 'PROTOCOL_SSLv2'): try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_SSLv3) try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) if no_sslv2_implies_sslv3_hello(): # No SSLv2 => client will use an SSLv3 hello on recent OpenSSLs - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, + try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_SSLv2) @skip_if_broken_ubuntu_ssl @@ -2668,7 +2691,7 @@ def test_protocol_tlsv1(self): try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) if hasattr(ssl, 'PROTOCOL_SSLv3'): try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1) @skip_if_broken_ubuntu_ssl @@ -2684,14 +2707,13 @@ def test_protocol_tlsv1_1(self): try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv2, False) if hasattr(ssl, 'PROTOCOL_SSLv3'): try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1_1) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1') try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1, False) try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_1, False) - @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_2"), "TLS version 1.2 not supported.") @@ -2707,10 +2729,10 @@ def test_protocol_tlsv1_2(self): try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv2, False) if hasattr(ssl, 'PROTOCOL_SSLv3'): try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_SSLv23, False, + try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1_2) - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2') + try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1_2, 'TLSv1.2') try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1, False) try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_2, False) try_protocol_combo(ssl.PROTOCOL_TLSv1_2, ssl.PROTOCOL_TLSv1_1, False) @@ -2721,7 +2743,6 @@ def test_starttls(self): msgs = (b"msg 1", b"MSG 2", b"STARTTLS", b"MSG 3", b"msg 4", b"ENDTLS", b"msg 5", b"msg 6") server = ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_TLSv1, starttls_server=True, chatty=True, connectionchatty=True) @@ -2749,7 +2770,7 @@ def test_starttls(self): sys.stdout.write( " client: read %r from server, starting TLS...\n" % msg) - conn = test_wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) + conn = test_wrap_socket(s) wrapped = True elif indata == b"ENDTLS" and msg.startswith(b"ok"): # ENDTLS ok, switch back to clear text @@ -2836,7 +2857,7 @@ def test_recv_send(self): server = ThreadedEchoServer(CERTFILE, certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, + ssl_version=ssl.PROTOCOL_TLS_SERVER, cacerts=CERTFILE, chatty=True, connectionchatty=False) @@ -2846,7 +2867,7 @@ def test_recv_send(self): certfile=CERTFILE, ca_certs=CERTFILE, cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + ssl_version=ssl.PROTOCOL_TLS_CLIENT) s.connect((HOST, server.port)) # helper methods for standardising recv* method signatures def _recv_into(): @@ -2988,7 +3009,7 @@ def test_recv_zero(self): def test_nonblocking_send(self): server = ThreadedEchoServer(CERTFILE, certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, + ssl_version=ssl.PROTOCOL_TLS_SERVER, cacerts=CERTFILE, chatty=True, connectionchatty=False) @@ -2998,7 +3019,7 @@ def test_nonblocking_send(self): certfile=CERTFILE, ca_certs=CERTFILE, cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + ssl_version=ssl.PROTOCOL_TLS_CLIENT) s.connect((HOST, server.port)) s.setblocking(False) @@ -3067,7 +3088,7 @@ def serve(): def test_server_accept(self): # Issue #16357: accept() on a SSLSocket created through # SSLContext.wrap_socket(). - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(CERTFILE) context.load_cert_chain(CERTFILE) @@ -3104,28 +3125,28 @@ def serve(): self.assertEqual(peer, client_addr) def test_getpeercert_enotconn(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) with context.wrap_socket(socket.socket()) as sock: with self.assertRaises(OSError) as cm: sock.getpeercert() self.assertEqual(cm.exception.errno, errno.ENOTCONN) def test_do_handshake_enotconn(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) with context.wrap_socket(socket.socket()) as sock: with self.assertRaises(OSError) as cm: sock.do_handshake() self.assertEqual(cm.exception.errno, errno.ENOTCONN) def test_default_ciphers(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) try: # Force a set of weak ciphers on our client context context.set_ciphers("DES") except ssl.SSLError: self.skipTest("no DES cipher available") with ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_SSLv23, + ssl_version=ssl.PROTOCOL_TLS, chatty=False) as server: with context.wrap_socket(socket.socket()) as s: with self.assertRaises(OSError): @@ -3137,14 +3158,19 @@ def test_version_basic(self): Basic tests for SSLSocket.version(). More tests are done in the test_protocol_*() methods. """ - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE with ThreadedEchoServer(CERTFILE, - ssl_version=ssl.PROTOCOL_TLSv1, + ssl_version=ssl.PROTOCOL_TLS_SERVER, chatty=False) as server: with context.wrap_socket(socket.socket()) as s: self.assertIs(s.version(), None) s.connect((HOST, server.port)) - self.assertEqual(s.version(), 'TLSv1') + if ssl.OPENSSL_VERSION_INFO >= (1, 0, 2): + self.assertEqual(s.version(), 'TLSv1.2') + else: # 0.9.8 to 1.0.1 + self.assertIn(s.version(), ('TLSv1', 'TLSv1.2')) self.assertIs(s.version(), None) @unittest.skipUnless(ssl.HAS_TLSv1_3, @@ -3169,7 +3195,7 @@ def test_tls1_3(self): def test_default_ecdh_curve(self): # Issue #21015: elliptic curve-based Diffie Hellman key exchange # should be enabled by default on SSL contexts. - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) context.load_cert_chain(CERTFILE) # TLSv1.3 defaults to PFS key agreement and no longer has KEA in # cipher name. @@ -3194,7 +3220,7 @@ def test_tls_unique_channel_binding(self): server = ThreadedEchoServer(CERTFILE, certreqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1, + ssl_version=ssl.PROTOCOL_TLS_SERVER, cacerts=CERTFILE, chatty=True, connectionchatty=False) @@ -3204,7 +3230,7 @@ def test_tls_unique_channel_binding(self): certfile=CERTFILE, ca_certs=CERTFILE, cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + ssl_version=ssl.PROTOCOL_TLS_CLIENT) s.connect((HOST, server.port)) # get the data cb_data = s.get_channel_binding("tls-unique") @@ -3229,7 +3255,7 @@ def test_tls_unique_channel_binding(self): certfile=CERTFILE, ca_certs=CERTFILE, cert_reqs=ssl.CERT_NONE, - ssl_version=ssl.PROTOCOL_TLSv1) + ssl_version=ssl.PROTOCOL_TLS_CLIENT) s.connect((HOST, server.port)) new_cb_data = s.get_channel_binding("tls-unique") if support.verbose: @@ -3246,10 +3272,10 @@ def test_tls_unique_channel_binding(self): s.close() def test_compression(self): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) + client_context, server_context, hostname = testing_context() + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) if support.verbose: sys.stdout.write(" got compression: {!r}\n".format(stats['compression'])) self.assertIn(stats['compression'], { None, 'ZLIB', 'RLE' }) @@ -3257,21 +3283,22 @@ def test_compression(self): @unittest.skipUnless(hasattr(ssl, 'OP_NO_COMPRESSION'), "ssl.OP_NO_COMPRESSION needed for this test") def test_compression_disabled(self): - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - context.options |= ssl.OP_NO_COMPRESSION - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) + client_context, server_context, hostname = testing_context() + client_context.options |= ssl.OP_NO_COMPRESSION + server_context.options |= ssl.OP_NO_COMPRESSION + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) self.assertIs(stats['compression'], None) def test_dh_params(self): # Check we can get a connection with ephemeral Diffie-Hellman - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - context.load_dh_params(DHFILE) - context.set_ciphers("kEDH") - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) + client_context, server_context, hostname = testing_context() + server_context.load_dh_params(DHFILE) + server_context.set_ciphers("kEDH") + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) cipher = stats["cipher"][0] parts = cipher.split("-") if "ADH" not in parts and "EDH" not in parts and "DHE" not in parts: @@ -3279,22 +3306,20 @@ def test_dh_params(self): def test_selected_alpn_protocol(self): # selected_alpn_protocol() is None unless ALPN is used. - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) + client_context, server_context, hostname = testing_context() + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) self.assertIs(stats['client_alpn_protocol'], None) @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support required") def test_selected_alpn_protocol_if_server_uses_alpn(self): # selected_alpn_protocol() is None unless ALPN is used by the client. - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.load_verify_locations(CERTFILE) - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(CERTFILE) + client_context, server_context, hostname = testing_context() server_context.set_alpn_protocols(['foo', 'bar']) stats = server_params_test(client_context, server_context, - chatty=True, connectionchatty=True) + chatty=True, connectionchatty=True, + sni_name=hostname) self.assertIs(stats['client_alpn_protocol'], None) @unittest.skipUnless(ssl.HAS_ALPN, "ALPN support needed for this test") @@ -3307,18 +3332,16 @@ def test_alpn_protocols(self): (['http/3.0', 'http/4.0'], None) ] for client_protocols, expected in protocol_tests: - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - server_context.load_cert_chain(CERTFILE) + client_context, server_context, hostname = testing_context() server_context.set_alpn_protocols(server_protocols) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - client_context.load_cert_chain(CERTFILE) client_context.set_alpn_protocols(client_protocols) try: stats = server_params_test(client_context, server_context, chatty=True, - connectionchatty=True) + connectionchatty=True, + sni_name=hostname) except ssl.SSLError as e: stats = e @@ -3341,10 +3364,10 @@ def test_alpn_protocols(self): def test_selected_npn_protocol(self): # selected_npn_protocol() is None unless NPN is used - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - context.load_cert_chain(CERTFILE) - stats = server_params_test(context, context, - chatty=True, connectionchatty=True) + client_context, server_context, hostname = testing_context() + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True, + sni_name=hostname) self.assertIs(stats['client_npn_protocol'], None) @unittest.skipUnless(ssl.HAS_NPN, "NPN support needed for this test") @@ -3357,15 +3380,12 @@ def test_npn_protocols(self): (['abc', 'def'], 'abc') ] for client_protocols, expected in protocol_tests: - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(CERTFILE) + client_context, server_context, hostname = testing_context() server_context.set_npn_protocols(server_protocols) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.load_cert_chain(CERTFILE) client_context.set_npn_protocols(client_protocols) stats = server_params_test(client_context, server_context, - chatty=True, connectionchatty=True) - + chatty=True, connectionchatty=True, + sni_name=hostname) msg = "failed trying %s (s) and %s (c).\n" \ "was expecting %s, but got %%s from the %%s" \ % (str(server_protocols), str(client_protocols), @@ -3377,12 +3397,11 @@ def test_npn_protocols(self): self.assertEqual(server_result, expected, msg % (server_result, "server")) def sni_contexts(self): - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) server_context.load_cert_chain(SIGNED_CERTFILE) - other_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + other_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) other_context.load_cert_chain(SIGNED_CERTFILE2) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) client_context.load_verify_locations(SIGNING_CA) return server_context, other_context, client_context @@ -3395,6 +3414,8 @@ def test_sni_callback(self): calls = [] server_context, other_context, client_context = self.sni_contexts() + client_context.check_hostname = False + def servername_cb(ssl_sock, server_name, initial_context): calls.append((server_name, initial_context)) if server_name is not None: @@ -3416,7 +3437,7 @@ def servername_cb(ssl_sock, server_name, initial_context): chatty=True, sni_name=None) self.assertEqual(calls, [(None, server_context)]) - self.check_common_name(stats, 'localhost') + self.check_common_name(stats, SIGNED_CERTFILE_HOSTNAME) # Check disabling the callback calls = [] @@ -3426,7 +3447,7 @@ def servername_cb(ssl_sock, server_name, initial_context): chatty=True, sni_name='notfunny') # Certificate didn't change - self.check_common_name(stats, 'localhost') + self.check_common_name(stats, SIGNED_CERTFILE_HOSTNAME) self.assertEqual(calls, []) @needs_sni @@ -3437,7 +3458,6 @@ def test_sni_callback_alert(self): def cb_returning_alert(ssl_sock, server_name, initial_context): return ssl.ALERT_DESCRIPTION_ACCESS_DENIED server_context.set_servername_callback(cb_returning_alert) - with self.assertRaises(ssl.SSLError) as cm: stats = server_params_test(client_context, server_context, chatty=False, @@ -3480,11 +3500,7 @@ def cb_wrong_return_type(ssl_sock, server_name, initial_context): self.assertIn("TypeError", stderr.getvalue()) def test_shared_ciphers(self): - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED - client_context.load_verify_locations(SIGNING_CA) + client_context, server_context, hostname = testing_context() if ssl.OPENSSL_VERSION_INFO >= (1, 0, 2): client_context.set_ciphers("AES128:AES256") server_context.set_ciphers("AES256") @@ -3496,7 +3512,8 @@ def test_shared_ciphers(self): alg1 = "3DES" alg2 = "DES-CBC3" - stats = server_params_test(client_context, server_context) + stats = server_params_test(client_context, server_context, + sni_name=hostname) ciphers = stats['server_shared_ciphers'][0] self.assertGreater(len(ciphers), 0) for name, tls_version, bits in ciphers: @@ -3504,14 +3521,12 @@ def test_shared_ciphers(self): self.fail(name) def test_read_write_after_close_raises_valuerror(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - server = ThreadedEchoServer(context=context, chatty=False) + client_context, server_context, hostname = testing_context() + server = ThreadedEchoServer(context=server_context, chatty=False) with server: - s = context.wrap_socket(socket.socket()) + s = client_context.wrap_socket(socket.socket(), + server_hostname=hostname) s.connect((HOST, server.port)) s.close() @@ -3523,7 +3538,7 @@ def test_sendfile(self): with open(support.TESTFN, 'wb') as f: f.write(TEST_DATA) self.addCleanup(support.unlink, support.TESTFN) - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context = ssl.SSLContext(ssl.PROTOCOL_TLS) context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(CERTFILE) context.load_cert_chain(CERTFILE) @@ -3536,14 +3551,11 @@ def test_sendfile(self): self.assertEqual(s.recv(1024), TEST_DATA) def test_session(self): - server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - server_context.load_cert_chain(SIGNED_CERTFILE) - client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) - client_context.verify_mode = ssl.CERT_REQUIRED - client_context.load_verify_locations(SIGNING_CA) + client_context, server_context, hostname = testing_context() # first connection without session - stats = server_params_test(client_context, server_context) + stats = server_params_test(client_context, server_context, + sni_name=hostname) session = stats['session'] self.assertTrue(session.id) self.assertGreater(session.time, 0) @@ -3557,7 +3569,8 @@ def test_session(self): self.assertEqual(sess_stat['hits'], 0) # reuse session - stats = server_params_test(client_context, server_context, session=session) + stats = server_params_test(client_context, server_context, + session=session, sni_name=hostname) sess_stat = server_context.session_stats() self.assertEqual(sess_stat['accept'], 2) self.assertEqual(sess_stat['hits'], 1) @@ -3570,7 +3583,8 @@ def test_session(self): self.assertGreaterEqual(session2.timeout, session.timeout) # another one without session - stats = server_params_test(client_context, server_context) + stats = server_params_test(client_context, server_context, + sni_name=hostname) self.assertFalse(stats['session_reused']) session3 = stats['session'] self.assertNotEqual(session3.id, session.id) @@ -3580,7 +3594,8 @@ def test_session(self): self.assertEqual(sess_stat['hits'], 1) # reuse session again - stats = server_params_test(client_context, server_context, session=session) + stats = server_params_test(client_context, server_context, + session=session, sni_name=hostname) self.assertTrue(stats['session_reused']) session4 = stats['session'] self.assertEqual(session4.id, session.id) @@ -3592,23 +3607,17 @@ def test_session(self): self.assertEqual(sess_stat['hits'], 2) def test_session_handling(self): - context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context.verify_mode = ssl.CERT_REQUIRED - context.load_verify_locations(CERTFILE) - context.load_cert_chain(CERTFILE) - - context2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23) - context2.verify_mode = ssl.CERT_REQUIRED - context2.load_verify_locations(CERTFILE) - context2.load_cert_chain(CERTFILE) + client_context, server_context, hostname = testing_context() + client_context2, _, _ = testing_context() # TODO: session reuse does not work with TLS 1.3 - context.options |= ssl.OP_NO_TLSv1_3 - context2.options |= ssl.OP_NO_TLSv1_3 + client_context.options |= ssl.OP_NO_TLSv1_3 + client_context2.options |= ssl.OP_NO_TLSv1_3 - server = ThreadedEchoServer(context=context, chatty=False) + server = ThreadedEchoServer(context=server_context, chatty=False) with server: - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: # session is None before handshake self.assertEqual(s.session, None) self.assertEqual(s.session_reused, None) @@ -3619,7 +3628,8 @@ def test_session_handling(self): s.session = object self.assertEqual(str(e.exception), 'Value is not a SSLSession.') - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: s.connect((HOST, server.port)) # cannot set session after handshake with self.assertRaises(ValueError) as e: @@ -3627,7 +3637,8 @@ def test_session_handling(self): self.assertEqual(str(e.exception), 'Cannot set session after handshake.') - with context.wrap_socket(socket.socket()) as s: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: # can set session before handshake and before the # connection was established s.session = session @@ -3636,7 +3647,8 @@ def test_session_handling(self): self.assertEqual(s.session, session) self.assertEqual(s.session_reused, True) - with context2.wrap_socket(socket.socket()) as s: + with client_context2.wrap_socket(socket.socket(), + server_hostname=hostname) as s: # cannot re-use session with a different SSLContext with self.assertRaises(ValueError) as e: s.session = session diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index 741d136a92c..b2d1e5f9804 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -594,7 +594,7 @@ def test_https_sni(self): def cb_sni(ssl_sock, server_name, initial_context): nonlocal sni_name sni_name = server_name - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) context.set_servername_callback(cb_sni) handler = self.start_https_server(context=context, certfile=CERT_localhost) context = ssl.create_default_context(cafile=CERT_localhost) diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst b/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst new file mode 100644 index 00000000000..87bc8cfabaf --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst @@ -0,0 +1 @@ +Prefer PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER protocols for SSLContext. From webhook-mailer at python.org Fri Sep 15 14:30:00 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Fri, 15 Sep 2017 18:30:00 -0000 Subject: [Python-checkins] bpo-31431: SSLContext.check_hostname auto-sets CERT_REQUIRED (#3531) Message-ID: https://github.com/python/cpython/commit/e82c034496512139e9ea3f68ceda86c04bc7baab commit: e82c034496512139e9ea3f68ceda86c04bc7baab branch: master author: Christian Heimes committer: GitHub date: 2017-09-15T20:29:57+02:00 summary: bpo-31431: SSLContext.check_hostname auto-sets CERT_REQUIRED (#3531) Signed-off-by: Christian Heimes files: A Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst M Doc/library/ssl.rst M Lib/test/test_ssl.py M Modules/_ssl.c diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index eb4d8ace3de..1f3e8d5f781 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1674,7 +1674,10 @@ to speed up repeated connections from the same clients. :meth:`SSLSocket.do_handshake`. The context's :attr:`~SSLContext.verify_mode` must be set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass *server_hostname* to - :meth:`~SSLContext.wrap_socket` in order to match the hostname. + :meth:`~SSLContext.wrap_socket` in order to match the hostname. Enabling + hostname checking automatically sets :attr:`~SSLContext.verify_mode` from + :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be set back to + :data:`CERT_NONE` as long as hostname checking is enabled. Example:: @@ -1691,6 +1694,13 @@ to speed up repeated connections from the same clients. .. versionadded:: 3.4 + .. versionchanged:: 3.7 + + :attr:`~SSLContext.verify_mode` is now automatically changed + to :data:`CERT_REQUIRED` when hostname checking is enabled and + :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously + the same operation would have failed with a :exc:`ValueError`. + .. note:: This features requires OpenSSL 0.9.8f or newer. diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 2978b8b3ebd..aa2429ac982 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1363,24 +1363,45 @@ def test__create_stdlib_context(self): def test_check_hostname(self): ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) self.assertFalse(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) - # Requires CERT_REQUIRED or CERT_OPTIONAL - with self.assertRaises(ValueError): - ctx.check_hostname = True + # Auto set CERT_REQUIRED + ctx.check_hostname = True + self.assertTrue(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + ctx.check_hostname = False ctx.verify_mode = ssl.CERT_REQUIRED self.assertFalse(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + + # Changing verify_mode does not affect check_hostname + ctx.check_hostname = False + ctx.verify_mode = ssl.CERT_NONE + ctx.check_hostname = False + self.assertFalse(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) + # Auto set ctx.check_hostname = True self.assertTrue(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + ctx.check_hostname = False ctx.verify_mode = ssl.CERT_OPTIONAL + ctx.check_hostname = False + self.assertFalse(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL) + # keep CERT_OPTIONAL ctx.check_hostname = True self.assertTrue(ctx.check_hostname) + self.assertEqual(ctx.verify_mode, ssl.CERT_OPTIONAL) # Cannot set CERT_NONE with check_hostname enabled with self.assertRaises(ValueError): ctx.verify_mode = ssl.CERT_NONE ctx.check_hostname = False self.assertFalse(ctx.check_hostname) + ctx.verify_mode = ssl.CERT_NONE + self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) def test_context_client_server(self): # PROTOCOL_TLS_CLIENT has sane defaults diff --git a/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst b/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst new file mode 100644 index 00000000000..6083fd65bd1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst @@ -0,0 +1,2 @@ +SSLContext.check_hostname now automatically sets SSLContext.verify_mode to +ssl.CERT_REQUIRED instead of failing with a ValueError. diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 8aaaa3212c1..73abad3dcf1 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3227,10 +3227,10 @@ set_check_hostname(PySSLContext *self, PyObject *arg, void *c) return -1; if (check_hostname && SSL_CTX_get_verify_mode(self->ctx) == SSL_VERIFY_NONE) { - PyErr_SetString(PyExc_ValueError, - "check_hostname needs a SSL context with either " - "CERT_OPTIONAL or CERT_REQUIRED"); - return -1; + /* check_hostname = True sets verify_mode = CERT_REQUIRED */ + if (_set_verify_mode(self->ctx, PY_SSL_CERT_REQUIRED) == -1) { + return -1; + } } self->check_hostname = check_hostname; return 0; From webhook-mailer at python.org Fri Sep 15 15:09:20 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 15 Sep 2017 19:09:20 -0000 Subject: [Python-checkins] [3.6] bpo-314777: IDLE - improve rstrip entry in doc (GH-3602) (#3605) Message-ID: https://github.com/python/cpython/commit/4d72945a28bc9e535a74b42eb0b40702c2f69e16 commit: 4d72945a28bc9e535a74b42eb0b40702c2f69e16 branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-09-15T15:09:17-04:00 summary: [3.6] bpo-314777: IDLE - improve rstrip entry in doc (GH-3602) (#3605) 'Strip trailing whitespace' is not limited to spaces. Wording caters to beginners who do know know the meaning of 'whitespace'. Multiline string literals are not skipped. (cherry picked from commit ff70289) files: A Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst M Doc/library/idle.rst M Lib/idlelib/help.html diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 0faeb6df934..af153593e3c 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -190,7 +190,9 @@ Format Paragraph paragraph will be formatted to less than N columns, where N defaults to 72. Strip trailing whitespace - Remove any space characters after the last non-space character of a line. + Remove trailing space and other whitespace characters after the last + non-whitespace character of a line by applying str.rstrip to each line, + including lines within multiline strings. .. index:: single: Run script diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 9005157dd98..33ae8842055 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -227,7 +227,9 @@ multiline string or selected line in a string. All lines in the paragraph will be formatted to less than N columns, where N defaults to 72.
        Strip trailing whitespace
        -
        Remove any space characters after the last non-space character of a line.
        +
        Remove trailing space and other whitespace characters after the last +non-whitespace character of a line by applying str.rstrip to each line, +including lines within multiline strings.
        @@ -779,7 +781,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
        - Last updated on Sep 12, 2017. + Last updated on Sep 15, 2017. Found a bug?
        Created using Sphinx 1.3.6. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst new file mode 100644 index 00000000000..4b47ed3f53b --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst @@ -0,0 +1,2 @@ +IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more +than blank spaces. Multiline string literals are not skipped. From webhook-mailer at python.org Fri Sep 15 18:35:23 2017 From: webhook-mailer at python.org (Eric Snow) Date: Fri, 15 Sep 2017 22:35:23 -0000 Subject: [Python-checkins] bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593) Message-ID: https://github.com/python/cpython/commit/3f9eee6eb4b25fe1926eaa5f00e02344b126f54d commit: 3f9eee6eb4b25fe1926eaa5f00e02344b126f54d branch: master author: Eric Snow committer: GitHub date: 2017-09-15T16:35:20-06:00 summary: bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593) The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst M Doc/c-api/import.rst M Include/import.h M Modules/_pickle.c M Modules/pyexpat.c M Objects/typeobject.c M Python/_warnings.c M Python/ceval.c M Python/import.c M Python/pylifecycle.c M Python/sysmodule.c diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index 7c16ece0586..8cdc256e7c9 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -204,6 +204,13 @@ Importing Modules Return the dictionary used for the module administration (a.k.a. ``sys.modules``). Note that this is a per-interpreter variable. +.. c:function:: PyObject* PyImport_GetModule(PyObject *name) + + Return the already imported module with the given name. If the + module has not been imported yet then returns NULL but does not set + an error. Returns NULL and sets an error if the lookup failed. + + .. versionadded:: 3.7 .. c:function:: PyObject* PyImport_GetImporter(PyObject *path) diff --git a/Include/import.h b/Include/import.h index 95c52b0bfba..c30f3ea3394 100644 --- a/Include/import.h +++ b/Include/import.h @@ -38,8 +38,14 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( ); #endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); +PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); +PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name, + PyObject *modules); +PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); +PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); #endif #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst new file mode 100644 index 00000000000..a45f9d86248 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst @@ -0,0 +1,4 @@ +Switch to the abstract API when dealing with ``PyInterpreterState.modules``. +This allows later support for all dict subclasses and other Mapping +implementations. Also add a ``PyImport_GetModule()`` function to reduce +a bunch of duplicated code. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index fb69f14b53d..d531dee2565 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1649,13 +1649,40 @@ getattribute(PyObject *obj, PyObject *name, int allow_qualname) return attr; } +static int +_checkmodule(PyObject *module_name, PyObject *module, + PyObject *global, PyObject *dotted_path) +{ + if (module == Py_None) { + return -1; + } + if (PyUnicode_Check(module_name) && + _PyUnicode_EqualToASCIIString(module_name, "__main__")) { + return -1; + } + + PyObject *candidate = get_deep_attribute(module, dotted_path, NULL); + if (candidate == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } + return -1; + } + if (candidate != global) { + Py_DECREF(candidate); + return -1; + } + Py_DECREF(candidate); + return 0; +} + static PyObject * whichmodule(PyObject *global, PyObject *dotted_path) { PyObject *module_name; - PyObject *modules_dict; - PyObject *module; + PyObject *module = NULL; Py_ssize_t i; + PyObject *modules; _Py_IDENTIFIER(__module__); _Py_IDENTIFIER(modules); _Py_IDENTIFIER(__main__); @@ -1678,35 +1705,48 @@ whichmodule(PyObject *global, PyObject *dotted_path) assert(module_name == NULL); /* Fallback on walking sys.modules */ - modules_dict = _PySys_GetObjectId(&PyId_modules); - if (modules_dict == NULL) { + modules = _PySys_GetObjectId(&PyId_modules); + if (modules == NULL) { PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); return NULL; } - - i = 0; - while (PyDict_Next(modules_dict, &i, &module_name, &module)) { - PyObject *candidate; - if (PyUnicode_Check(module_name) && - _PyUnicode_EqualToASCIIString(module_name, "__main__")) - continue; - if (module == Py_None) - continue; - - candidate = get_deep_attribute(module, dotted_path, NULL); - if (candidate == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + if (PyDict_CheckExact(modules)) { + i = 0; + while (PyDict_Next(modules, &i, &module_name, &module)) { + if (_checkmodule(module_name, module, global, dotted_path) == 0) { + Py_INCREF(module_name); + return module_name; + } + if (PyErr_Occurred()) { return NULL; - PyErr_Clear(); - continue; + } } - - if (candidate == global) { - Py_INCREF(module_name); - Py_DECREF(candidate); - return module_name; + } + else { + PyObject *iterator = PyObject_GetIter(modules); + if (iterator == NULL) { + return NULL; } - Py_DECREF(candidate); + while ((module_name = PyIter_Next(iterator))) { + module = PyObject_GetItem(modules, module_name); + if (module == NULL) { + Py_DECREF(module_name); + Py_DECREF(iterator); + return NULL; + } + if (_checkmodule(module_name, module, global, dotted_path) == 0) { + Py_DECREF(module); + Py_DECREF(iterator); + return module_name; + } + Py_DECREF(module); + Py_DECREF(module_name); + if (PyErr_Occurred()) { + Py_DECREF(iterator); + return NULL; + } + } + Py_DECREF(iterator); } /* If no module is found, use __main__. */ @@ -6424,9 +6464,7 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, /*[clinic end generated code: output=becc08d7f9ed41e3 input=e2e6a865de093ef4]*/ { PyObject *global; - PyObject *modules_dict; PyObject *module; - _Py_IDENTIFIER(modules); /* Try to map the old names used in Python 2.x to the new ones used in Python 3.x. We do this only with old pickle protocols and when the @@ -6483,25 +6521,16 @@ _pickle_Unpickler_find_class_impl(UnpicklerObject *self, } } - modules_dict = _PySys_GetObjectId(&PyId_modules); - if (modules_dict == NULL) { - PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); - return NULL; - } - - module = PyDict_GetItemWithError(modules_dict, module_name); + module = PyImport_GetModule(module_name); if (module == NULL) { if (PyErr_Occurred()) return NULL; module = PyImport_Import(module_name); if (module == NULL) return NULL; - global = getattribute(module, global_name, self->proto >= 4); - Py_DECREF(module); - } - else { - global = getattribute(module, global_name, self->proto >= 4); } + global = getattribute(module, global_name, self->proto >= 4); + Py_DECREF(module); return global; } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index d9cfa3e2085..c8a01d4e088 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1643,7 +1643,6 @@ MODULE_INITFUNC(void) PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; - PyObject *sys_modules; PyObject *tmpnum, *tmpstr; PyObject *codes_dict; PyObject *rev_codes_dict; @@ -1693,11 +1692,6 @@ MODULE_INITFUNC(void) */ PyModule_AddStringConstant(m, "native_encoding", "UTF-8"); - sys_modules = PySys_GetObject("modules"); - if (sys_modules == NULL) { - Py_DECREF(m); - return NULL; - } d = PyModule_GetDict(m); if (d == NULL) { Py_DECREF(m); @@ -1707,7 +1701,7 @@ MODULE_INITFUNC(void) if (errors_module == NULL) { errors_module = PyModule_New(MODULE_NAME ".errors"); if (errors_module != NULL) { - PyDict_SetItem(sys_modules, errmod_name, errors_module); + _PyImport_SetModule(errmod_name, errors_module); /* gives away the reference to errors_module */ PyModule_AddObject(m, "errors", errors_module); } @@ -1717,7 +1711,7 @@ MODULE_INITFUNC(void) if (model_module == NULL) { model_module = PyModule_New(MODULE_NAME ".model"); if (model_module != NULL) { - PyDict_SetItem(sys_modules, modelmod_name, model_module); + _PyImport_SetModule(modelmod_name, model_module); /* gives away the reference to model_module */ PyModule_AddObject(m, "model", model_module); } diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9ebbb21ef8d..662c493ff2d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3913,10 +3913,8 @@ import_copyreg(void) by storing a reference to the cached module in a static variable, but this broke when multiple embedded interpreters were in use (see issue #17408 and #19088). */ - PyObject *modules = PyImport_GetModuleDict(); - copyreg_module = PyDict_GetItemWithError(modules, copyreg_str); + copyreg_module = PyImport_GetModule(copyreg_str); if (copyreg_module != NULL) { - Py_INCREF(copyreg_module); return copyreg_module; } if (PyErr_Occurred()) { diff --git a/Python/_warnings.c b/Python/_warnings.c index ba004859df8..f6688b04067 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -38,7 +38,6 @@ static PyObject * get_warnings_attr(const char *attr, int try_import) { static PyObject *warnings_str = NULL; - PyObject *all_modules; PyObject *warnings_module, *obj; if (warnings_str == NULL) { @@ -58,13 +57,9 @@ get_warnings_attr(const char *attr, int try_import) } } else { - all_modules = PyImport_GetModuleDict(); - - warnings_module = PyDict_GetItem(all_modules, warnings_str); + warnings_module = PyImport_GetModule(warnings_str); if (warnings_module == NULL) return NULL; - - Py_INCREF(warnings_module); } if (!PyObject_HasAttrString(warnings_module, attr)) { diff --git a/Python/ceval.c b/Python/ceval.c index 5b810f29d12..8cc5094a3f4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4935,13 +4935,12 @@ import_from(PyObject *v, PyObject *name) Py_DECREF(pkgname); return NULL; } - x = PyDict_GetItem(PyImport_GetModuleDict(), fullmodname); + x = PyImport_GetModule(fullmodname); Py_DECREF(fullmodname); if (x == NULL) { goto error; } Py_DECREF(pkgname); - Py_INCREF(x); return x; error: pkgpath = PyModule_GetFilenameObject(v); diff --git a/Python/import.c b/Python/import.c index 7aa7a1bdf79..5e841ca782d 100644 --- a/Python/import.c +++ b/Python/import.c @@ -291,8 +291,9 @@ PyObject * PyImport_GetModuleDict(void) { PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->modules == NULL) + if (interp->modules == NULL) { Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); + } return interp->modules; } @@ -308,6 +309,55 @@ _PyImport_IsInitialized(PyInterpreterState *interp) return 1; } +PyObject * +_PyImport_GetModuleId(struct _Py_Identifier *nameid) +{ + PyObject *name = _PyUnicode_FromId(nameid); /* borrowed */ + if (name == NULL) { + return NULL; + } + return PyImport_GetModule(name); +} + +int +_PyImport_SetModule(PyObject *name, PyObject *m) +{ + PyObject *modules = PyImport_GetModuleDict(); + return PyObject_SetItem(modules, name, m); +} + +int +_PyImport_SetModuleString(const char *name, PyObject *m) +{ + PyObject *modules = PyImport_GetModuleDict(); + return PyMapping_SetItemString(modules, name, m); +} + +PyObject * +PyImport_GetModule(PyObject *name) +{ + PyObject *m; + PyObject *modules = PyImport_GetModuleDict(); + if (modules == NULL) { + PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules"); + return NULL; + } + Py_INCREF(modules); + if (PyDict_CheckExact(modules)) { + m = PyDict_GetItemWithError(modules, name); /* borrowed */ + Py_XINCREF(m); + } + else { + m = PyObject_GetItem(modules, name); + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + } + } + Py_DECREF(modules); + return m; +} + + /* List of names to clear in sys */ static const char * const sys_deletes[] = { "path", "argv", "ps1", "ps2", @@ -387,21 +437,51 @@ PyImport_Cleanup(void) if (PyErr_Occurred()) \ PyErr_Clear(); \ } +#define CLEAR_MODULE(name, mod) \ + if (PyModule_Check(mod)) { \ + if (Py_VerboseFlag && PyUnicode_Check(name)) \ + PySys_FormatStderr("# cleanup[2] removing %U\n", name); \ + STORE_MODULE_WEAKREF(name, mod); \ + PyObject_SetItem(modules, name, Py_None); \ + } /* Remove all modules from sys.modules, hoping that garbage collection can reclaim most of them. */ - pos = 0; - while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyModule_Check(value)) { - if (Py_VerboseFlag && PyUnicode_Check(key)) - PySys_FormatStderr("# cleanup[2] removing %U\n", key); - STORE_MODULE_WEAKREF(key, value); - PyDict_SetItem(modules, key, Py_None); + if (PyDict_CheckExact(modules)) { + pos = 0; + while (PyDict_Next(modules, &pos, &key, &value)) { + CLEAR_MODULE(key, value); + } + } + else { + PyObject *iterator = PyObject_GetIter(modules); + if (iterator == NULL) { + PyErr_Clear(); + } + else { + while ((key = PyIter_Next(iterator))) { + value = PyObject_GetItem(modules, key); + if (value == NULL) { + PyErr_Clear(); + continue; + } + CLEAR_MODULE(key, value); + Py_DECREF(value); + Py_DECREF(key); + } + Py_DECREF(iterator); } } /* Clear the modules dict. */ - PyDict_Clear(modules); + if (PyDict_CheckExact(modules)) { + PyDict_Clear(modules); + } + else { + _Py_IDENTIFIER(clear); + if (_PyObject_CallMethodId(modules, &PyId_clear, "") == NULL) + PyErr_Clear(); + } /* Restore the original builtins dict, to ensure that any user data gets cleared. */ dict = PyDict_Copy(interp->builtins); @@ -541,10 +621,10 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, PyErr_BadInternalCall(); return -1; } - if (PyDict_SetItem(modules, name, mod) < 0) + if (PyObject_SetItem(modules, name, mod) < 0) return -1; if (_PyState_AddModule(mod, def) < 0) { - PyDict_DelItem(modules, name); + PyMapping_DelItem(modules, name); return -1; } if (def->m_size == -1) { @@ -625,14 +705,14 @@ _PyImport_FindExtensionObjectEx(PyObject *name, PyObject *filename, mod = def->m_base.m_init(); if (mod == NULL) return NULL; - if (PyDict_SetItem(modules, name, mod) == -1) { + if (PyObject_SetItem(modules, name, mod) == -1) { Py_DECREF(mod); return NULL; } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) { - PyDict_DelItem(modules, name); + PyMapping_DelItem(modules, name); Py_DECREF(mod); return NULL; } @@ -672,18 +752,27 @@ PyObject * _PyImport_AddModuleObject(PyObject *name, PyObject *modules) { PyObject *m; - - if ((m = PyDict_GetItemWithError(modules, name)) != NULL && - PyModule_Check(m)) { - return m; + if (PyDict_CheckExact(modules)) { + m = PyDict_GetItemWithError(modules, name); + } + else { + m = PyObject_GetItem(modules, name); + // For backward-comaptibility we copy the behavior + // of PyDict_GetItemWithError(). + if (PyErr_ExceptionMatches(PyExc_KeyError)) { + PyErr_Clear(); + } } if (PyErr_Occurred()) { return NULL; } + if (m != NULL && PyModule_Check(m)) { + return m; + } m = PyModule_NewObject(name); if (m == NULL) return NULL; - if (PyDict_SetItem(modules, name, m) != 0) { + if (PyObject_SetItem(modules, name, m) != 0) { Py_DECREF(m); return NULL; } @@ -710,11 +799,13 @@ static void remove_module(PyObject *name) { PyObject *modules = PyImport_GetModuleDict(); - if (PyDict_GetItem(modules, name) == NULL) - return; - if (PyDict_DelItem(modules, name) < 0) + if (PyMapping_DelItem(modules, name) < 0) { + if (!PyMapping_HasKey(modules, name)) { + return; + } Py_FatalError("import: deleting existing key in" "sys.modules failed"); + } } @@ -823,7 +914,6 @@ module_dict_for_exec(PyObject *name) static PyObject * exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object) { - PyObject *modules = PyImport_GetModuleDict(); PyObject *v, *m; v = PyEval_EvalCode(code_object, module_dict, module_dict); @@ -833,15 +923,14 @@ exec_code_in_module(PyObject *name, PyObject *module_dict, PyObject *code_object } Py_DECREF(v); - if ((m = PyDict_GetItem(modules, name)) == NULL) { + m = PyImport_GetModule(name); + if (m == NULL) { PyErr_Format(PyExc_ImportError, "Loaded module %R not found in sys.modules", name); return NULL; } - Py_INCREF(m); - return m; } @@ -1540,8 +1629,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, Py_INCREF(abs_name); } - PyObject *modules = PyImport_GetModuleDict(); - mod = PyDict_GetItem(modules, abs_name); + mod = PyImport_GetModule(abs_name); if (mod != NULL && mod != Py_None) { _Py_IDENTIFIER(__spec__); _Py_IDENTIFIER(_initializing); @@ -1550,7 +1638,6 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, PyObject *spec; int initializing = 0; - Py_INCREF(mod); /* Optimization: only call _bootstrap._lock_unlock_module() if __spec__._initializing is true. NOTE: because of this, initializing must be set *before* @@ -1579,6 +1666,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, } } else { + Py_XDECREF(mod); mod = _PyObject_CallMethodIdObjArgs(interp->importlib, &PyId__find_and_load, abs_name, interp->import_func, NULL); @@ -1628,8 +1716,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, goto error; } - PyObject *modules = PyImport_GetModuleDict(); - final_mod = PyDict_GetItem(modules, to_return); + final_mod = PyImport_GetModule(to_return); Py_DECREF(to_return); if (final_mod == NULL) { PyErr_Format(PyExc_KeyError, @@ -1637,7 +1724,6 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, to_return); goto error; } - Py_INCREF(final_mod); } } else { @@ -1682,19 +1768,16 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals PyObject * PyImport_ReloadModule(PyObject *m) { + _Py_IDENTIFIER(imp); _Py_IDENTIFIER(reload); PyObject *reloaded_module = NULL; - PyObject *modules = PyImport_GetModuleDict(); - PyObject *imp = PyDict_GetItemString(modules, "imp"); + PyObject *imp = _PyImport_GetModuleId(&PyId_imp); if (imp == NULL) { imp = PyImport_ImportModule("imp"); if (imp == NULL) { return NULL; } } - else { - Py_INCREF(imp); - } reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); Py_DECREF(imp); @@ -1720,7 +1803,6 @@ PyImport_Import(PyObject *module_name) PyObject *globals = NULL; PyObject *import = NULL; PyObject *builtins = NULL; - PyObject *modules = NULL; PyObject *r = NULL; /* Initialize constant string objects */ @@ -1775,12 +1857,8 @@ PyImport_Import(PyObject *module_name) goto err; Py_DECREF(r); - modules = PyImport_GetModuleDict(); - r = PyDict_GetItemWithError(modules, module_name); - if (r != NULL) { - Py_INCREF(r); - } - else if (!PyErr_Occurred()) { + r = PyImport_GetModule(module_name); + if (r == NULL && !PyErr_Occurred()) { PyErr_SetObject(PyExc_KeyError, module_name); } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 5c8cf5b9bd5..7adbc29406e 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -42,6 +42,7 @@ _Py_IDENTIFIER(name); _Py_IDENTIFIER(stdin); _Py_IDENTIFIER(stdout); _Py_IDENTIFIER(stderr); +_Py_IDENTIFIER(threading); #ifdef __cplusplus extern "C" { @@ -283,7 +284,6 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) { PyObject *importlib; PyObject *impmod; - PyObject *sys_modules; PyObject *value; /* Import _importlib through its frozen version, _frozen_importlib. */ @@ -314,11 +314,7 @@ initimport(PyInterpreterState *interp, PyObject *sysmod) else if (Py_VerboseFlag) { PySys_FormatStderr("import _imp # builtin\n"); } - sys_modules = PyImport_GetModuleDict(); - if (Py_VerboseFlag) { - PySys_FormatStderr("import sys # builtin\n"); - } - if (PyDict_SetItemString(sys_modules, "_imp", impmod) < 0) { + if (_PyImport_SetModuleString("_imp", impmod) < 0) { Py_FatalError("Py_Initialize: can't save _imp to sys.modules"); } @@ -1916,8 +1912,7 @@ wait_for_thread_shutdown(void) { _Py_IDENTIFIER(_shutdown); PyObject *result; - PyObject *modules = PyImport_GetModuleDict(); - PyObject *threading = PyMapping_GetItemString(modules, "threading"); + PyObject *threading = _PyImport_GetModuleId(&PyId_threading); if (threading == NULL) { /* threading not imported */ PyErr_Clear(); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index d463683df1d..6d2cc96b5eb 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -162,18 +162,16 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; - PyObject *modules = PyImport_GetModuleDict(); - if (modules == NULL) - return NULL; PyObject *builtins; static PyObject *newline = NULL; int err; - builtins = _PyDict_GetItemId(modules, &PyId_builtins); + builtins = _PyImport_GetModuleId(&PyId_builtins); if (builtins == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); return NULL; } + Py_DECREF(builtins); /* Print value except if None */ /* After printing, also assign to '_' */ From lp_benchmark_robot at intel.com Fri Sep 15 19:53:26 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 15 Sep 2017 16:53:26 -0700 Subject: [Python-checkins] [2 down, 3 up, 60 flat] Results for Python (master branch) 2017-09-15 Message-ID: Results for project python/master, build date: 2017-09-15 03:05:06-07:00. - commit: 5d84cb3 - previous commit: 5a61559 - revision date: 2017-09-14 20:28:22-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.102% | +1.079% | +3.719% | +7.703% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.775% | -2.384% | +17.386% | +14.073% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.007% | -2.448% | +19.126% | +11.840% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.390% | -0.973% | +17.395% | +9.087% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.718% | -3.677% | +1.741% | +17.033% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.711% | +1.103% | +11.592% | +10.276% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.747% | -0.380% | +7.890% | +10.194% | +-----+------------------------+--------+------------+------------+------------+ | :-( | crypto_pyaes| 0.542% | -2.485% | +1.367% | +8.665% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 3.627% | +4.275% | +8.398% | +17.886% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.082% | +5.293% | +9.545% | +11.064% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.520% | +0.817% | +4.359% | +5.635% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.647% | +0.063% | +6.689% | +4.640% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.759% | -0.288% | +3.176% | +4.379% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.167% | +0.820% | +8.079% | +10.854% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.027% | +1.149% | +6.758% | +9.773% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 1.030% | -0.269% | +6.556% | +10.376% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.985% | -0.506% | +9.320% | +11.004% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.838% | +2.526% | +8.524% | +9.224% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.983% | +0.715% | +3.965% | +7.614% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 3.775% | -1.194% | +0.018% | +11.285% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.665% | +1.771% | +7.355% | +7.993% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.593% | -1.312% | +46.906% | +10.575% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 2.103% | +1.569% | +8.402% | +9.846% | +-----+------------------------+--------+------------+------------+------------+ | :-( | mako| 0.814% | -3.510% | +16.024% | +13.327% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.792% | +0.825% | +8.265% | +11.224% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 0.887% | +0.052% | +2.920% | +6.028% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.795% | -0.168% | -1.617% | +1.419% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.679% | -0.132% | +2.476% | +8.801% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.240% | +0.695% | +5.897% | +9.012% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.393% | -0.775% | +0.721% | +21.570% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.352% | -0.688% | +0.217% | +24.036% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.728% | -0.235% | +5.187% | +19.375% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 1.809% | +1.824% | +12.463% | +9.691% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.172% | +0.206% | +0.343% | +10.214% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.136% | +1.057% | +9.584% | +1.595% | +-----+------------------------+--------+------------+------------+------------+ | :-) | python_startup_no_site| 0.101% | +1.364% | +1.566% | +1.424% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.944% | -0.615% | +8.174% | +13.152% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.778% | +0.981% | -9.229% | +10.782% | +-----+------------------------+--------+------------+------------+------------+ | :-) | regex_dna| 0.760% | +3.785% | +1.695% | +6.281% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 1.991% | +4.308% | +0.842% | +2.435% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 1.166% | -2.201% | +10.448% | +2.131% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.585% | -0.764% | +6.984% | +15.446% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.680% | -0.334% | +0.820% | +2.313% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.346% | +0.556% | +26.976% | +9.210% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.993% | -0.597% | +4.591% | +4.422% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 1.300% | -0.903% | +14.469% | +8.653% | +-----+------------------------+--------+------------+------------+------------+ | :-) | scimark_sparse_mat_mult| 1.343% | +4.855% | +5.959% | -7.571% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.507% | +2.036% | +6.570% | +1.063% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.999% | +1.216% | +5.390% | +4.867% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.242% | +1.729% | +5.371% | +3.462% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 2.816% | -0.432% | +1.458% | +8.422% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.423% | +0.656% | +11.743% | +7.779% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.985% | +1.158% | +10.312% | +5.803% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.537% | +1.938% | +11.595% | +7.877% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.399% | +1.160% | +10.929% | +9.408% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.632% | -1.763% | +22.566% | +6.985% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.363% | +1.685% | +6.200% | +6.298% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.967% | +0.003% | +1.977% | +2.049% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 9.841% | -4.171% | +5.190% | +22.054% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.694% | +0.402% | -1.092% | +22.076% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.744% | +0.685% | +7.094% | +6.771% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.917% | +0.851% | +6.796% | +6.857% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.251% | +0.222% | +2.498% | +5.909% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.867% | +0.993% | -8.376% | +12.013% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.023% | +1.474% | +7.534% | +7.161% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/2-down-3-up-60-flat-results-for-python-master-branch-2017-09-15 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Fri Sep 15 19:55:54 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Fri, 15 Sep 2017 23:55:54 -0000 Subject: [Python-checkins] [3.6] bpo-31234: Join threads in tests (#3589) Message-ID: https://github.com/python/cpython/commit/2c1c2ca2548f943d6323859f17612aa5a4a19165 commit: 2c1c2ca2548f943d6323859f17612aa5a4a19165 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-15T16:55:47-07:00 summary: [3.6] bpo-31234: Join threads in tests (#3589) * bpo-31234: Join threads in tests (#3572) Call thread.join() on threads to prevent the "dangling threads" warning. (cherry picked from commit 18e95b4176256f100429a806d0455406df98f984) * bpo-31234: Join threads in test_hashlib (#3573) * bpo-31234: Join threads in test_hashlib Use thread.join() to wait until the parallel hash tasks complete rather than using events. Calling thread.join() prevent "dangling thread" warnings. * test_hashlib: minor PEP 8 coding style fixes (cherry picked from commit 8dcf22f442320e4c1a5408e67b4c9002ad105f17) * bpo-31234: Join threads in test_threading (#3579) Call thread.join() to prevent the "dangling thread" warning. (cherry picked from commit b8c7be2c523b012e57915182543d06657161057f) * bpo-31234: Join threads in test_queue (#3586) Call thread.join() to prevent the "dangling thread" warning. (cherry picked from commit 167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5) * bpo-31234: Join timers in test_threading (#3598) Call the .join() method of threading.Timer timers to prevent the "threading_cleanup() failed to cleanup 1 threads" warning. (cherry picked from commit da3e5cf961f9bcc4bb376386cfe7a2865325086c) files: M Lib/test/test_concurrent_futures.py M Lib/test/test_decimal.py M Lib/test/test_hashlib.py M Lib/test/test_queue.py M Lib/test/test_smtplib.py M Lib/test/test_threading.py M Lib/test/test_xmlrpc.py diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index e5d6b7e09b5..667878429fc 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -776,6 +776,7 @@ def notification(): t.start() self.assertEqual(f1.result(timeout=5), 42) + t.join() def test_result_with_cancel(self): # TODO(brian at sweetapp.com): This test is timing dependent. @@ -789,6 +790,7 @@ def notification(): t.start() self.assertRaises(futures.CancelledError, f1.result, timeout=5) + t.join() def test_exception_with_timeout(self): self.assertRaises(futures.TimeoutError, @@ -817,6 +819,7 @@ def notification(): t.start() self.assertTrue(isinstance(f1.exception(timeout=5), OSError)) + t.join() @test.support.reap_threads def test_main(): diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 617a37eec82..57094ad6695 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1614,6 +1614,9 @@ def test_threading(self): for sig in Signals[self.decimal]: self.assertFalse(DefaultContext.flags[sig]) + th1.join() + th2.join() + DefaultContext.prec = save_prec DefaultContext.Emax = save_emax DefaultContext.Emin = save_emin diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py index f748b461907..647719ea62c 100644 --- a/Lib/test/test_hashlib.py +++ b/Lib/test/test_hashlib.py @@ -750,28 +750,28 @@ def test_threaded_hashing(self): hasher = hashlib.sha1() num_threads = 5 smallest_data = b'swineflu' - data = smallest_data*200000 + data = smallest_data * 200000 expected_hash = hashlib.sha1(data*num_threads).hexdigest() - def hash_in_chunks(chunk_size, event): + def hash_in_chunks(chunk_size): index = 0 while index < len(data): - hasher.update(data[index:index+chunk_size]) + hasher.update(data[index:index + chunk_size]) index += chunk_size - event.set() - events = [] + threads = [] for threadnum in range(num_threads): - chunk_size = len(data) // (10**threadnum) + chunk_size = len(data) // (10 ** threadnum) self.assertGreater(chunk_size, 0) self.assertEqual(chunk_size % len(smallest_data), 0) - event = threading.Event() - events.append(event) - threading.Thread(target=hash_in_chunks, - args=(chunk_size, event)).start() - - for event in events: - event.wait() + thread = threading.Thread(target=hash_in_chunks, + args=(chunk_size,)) + threads.append(thread) + + for thread in threads: + thread.start() + for thread in threads: + thread.join() self.assertEqual(expected_hash, hasher.hexdigest()) diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py index 4ccaa39adff..c6860958dda 100644 --- a/Lib/test/test_queue.py +++ b/Lib/test/test_queue.py @@ -46,28 +46,27 @@ def run(self): class BlockingTestMixin: - def tearDown(self): - self.t = None - def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): - self.t = _TriggerThread(trigger_func, trigger_args) - self.t.start() - self.result = block_func(*block_args) - # If block_func returned before our thread made the call, we failed! - if not self.t.startedEvent.is_set(): - self.fail("blocking function '%r' appeared not to block" % - block_func) - self.t.join(10) # make sure the thread terminates - if self.t.is_alive(): - self.fail("trigger function '%r' appeared to not return" % - trigger_func) - return self.result + thread = _TriggerThread(trigger_func, trigger_args) + thread.start() + try: + self.result = block_func(*block_args) + # If block_func returned before our thread made the call, we failed! + if not thread.startedEvent.is_set(): + self.fail("blocking function '%r' appeared not to block" % + block_func) + return self.result + finally: + thread.join(10) # make sure the thread terminates + if thread.is_alive(): + self.fail("trigger function '%r' appeared to not return" % + trigger_func) # Call this instead if block_func is supposed to raise an exception. def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, trigger_args, expected_exception_class): - self.t = _TriggerThread(trigger_func, trigger_args) - self.t.start() + thread = _TriggerThread(trigger_func, trigger_args) + thread.start() try: try: block_func(*block_args) @@ -77,11 +76,11 @@ def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, self.fail("expected exception of kind %r" % expected_exception_class) finally: - self.t.join(10) # make sure the thread terminates - if self.t.is_alive(): + thread.join(10) # make sure the thread terminates + if thread.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) - if not self.t.startedEvent.is_set(): + if not thread.startedEvent.is_set(): self.fail("trigger thread ended but event never set") @@ -159,8 +158,11 @@ def worker(self, q): def queue_join_test(self, q): self.cum = 0 + threads = [] for i in (0,1): - threading.Thread(target=self.worker, args=(q,)).start() + thread = threading.Thread(target=self.worker, args=(q,)) + thread.start() + threads.append(thread) for i in range(100): q.put(i) q.join() @@ -169,6 +171,8 @@ def queue_join_test(self, q): for i in (0,1): q.put(-1) # instruct the threads to close q.join() # verify that you can join twice + for thread in threads: + thread.join() def test_queue_task_done(self): # Test to make sure a queue task completed successfully. diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 28539f360f5..dd3a6eeca69 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -604,7 +604,9 @@ def setUp(self): self.sock.settimeout(15) self.port = support.bind_port(self.sock) servargs = (self.evt, self.respdata, self.sock) - threading.Thread(target=server, args=servargs).start() + thread = threading.Thread(target=server, args=servargs) + thread.start() + self.addCleanup(thread.join) self.evt.wait() self.evt.clear() diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 162a72ea03f..9cadc0f1c02 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -575,6 +575,7 @@ def f(): self.assertFalse(t.is_alive()) # And verify the thread disposed of _tstate_lock. self.assertIsNone(t._tstate_lock) + t.join() def test_repr_stopped(self): # Verify that "stopped" shows up in repr(Thread) appropriately. @@ -601,6 +602,7 @@ def f(): break time.sleep(0.01) self.assertIn(LOOKING_FOR, repr(t)) # we waited at least 5 seconds + t.join() def test_BoundedSemaphore_limit(self): # BoundedSemaphore should raise ValueError if released too often. @@ -915,6 +917,7 @@ def test_start_thread_again(self): thread = threading.Thread() thread.start() self.assertRaises(RuntimeError, thread.start) + thread.join() def test_joining_current_thread(self): current_thread = threading.current_thread() @@ -928,6 +931,7 @@ def test_daemonize_active_thread(self): thread = threading.Thread() thread.start() self.assertRaises(RuntimeError, setattr, thread, "daemon", True) + thread.join() def test_releasing_unacquired_lock(self): lock = threading.Lock() @@ -1090,6 +1094,8 @@ def test_init_immutable_default_args(self): self.callback_event.wait() self.assertEqual(len(self.callback_args), 2) self.assertEqual(self.callback_args, [((), {}), ((), {})]) + timer1.join() + timer2.join() def _callback_spy(self, *args, **kwargs): self.callback_args.append((args[:], kwargs.copy())) diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index e98a3a7160f..f9bf304010e 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -759,7 +759,9 @@ def setUp(self): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, self.request_count, self.requestHandler) - threading.Thread(target=self.threadFunc, args=serv_args).start() + thread = threading.Thread(target=self.threadFunc, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() @@ -1211,7 +1213,9 @@ def setUp(self): self.evt = threading.Event() # start server thread to handle requests serv_args = (self.evt, 1) - threading.Thread(target=http_server, args=serv_args).start() + thread = threading.Thread(target=http_server, args=serv_args) + thread.start() + self.addCleanup(thread.join) # wait for the server to be ready self.evt.wait() From webhook-mailer at python.org Sat Sep 16 01:42:31 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 16 Sep 2017 05:42:31 -0000 Subject: [Python-checkins] bpo-31488: IDLE - update former extensions when options change. (#3612) Message-ID: https://github.com/python/cpython/commit/5777ecc438790f3d324d52f2ccdad56e667e0cb3 commit: 5777ecc438790f3d324d52f2ccdad56e667e0cb3 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-16T01:42:28-04:00 summary: bpo-31488: IDLE - update former extensions when options change. (#3612) When apply changes, call .reload on each class with non-key options. Change ParenMatch so that updates affect current instances. files: A Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst M Lib/idlelib/configdialog.py M Lib/idlelib/idle_test/test_parenmatch.py M Lib/idlelib/parenmatch.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 683c36e9776..7feae5d6199 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -27,8 +27,14 @@ from idlelib.query import SectionName, HelpSource from idlelib.tabbedpages import TabbedPageSet from idlelib.textview import view_text +from idlelib.autocomplete import AutoComplete +from idlelib.codecontext import CodeContext +from idlelib.parenmatch import ParenMatch +from idlelib.paragraph import FormatParagraph changes = ConfigChanges() +# Reload changed options in the following classes. +reloadables = (AutoComplete, CodeContext, ParenMatch, FormatParagraph) class ConfigDialog(Toplevel): @@ -220,6 +226,8 @@ def activate_config_changes(self): instance.set_notabs_indentwidth() instance.ApplyKeybindings() instance.reset_help_menu_entries() + for klass in reloadables: + klass.reload() def create_page_extensions(self): """Part of the config dialog used for configuring IDLE extensions. diff --git a/Lib/idlelib/idle_test/test_parenmatch.py b/Lib/idlelib/idle_test/test_parenmatch.py index 6943a70c997..3caa2754a6d 100644 --- a/Lib/idlelib/idle_test/test_parenmatch.py +++ b/Lib/idlelib/idle_test/test_parenmatch.py @@ -58,7 +58,7 @@ def test_paren_styles(self): ('expression', ('1.10', '1.15'), ('1.10', '1.16'))): with self.subTest(style=style): text.delete('1.0', 'end') - pm.set_style(style) + pm.STYLE = style text.insert('insert', 'def foobar(a, b') pm.flash_paren_event('event') diff --git a/Lib/idlelib/parenmatch.py b/Lib/idlelib/parenmatch.py index 12212150c6d..983ca20675a 100644 --- a/Lib/idlelib/parenmatch.py +++ b/Lib/idlelib/parenmatch.py @@ -45,10 +45,8 @@ def __init__(self, editwin): # and deactivate_restore (which calls event_delete). editwin.text.bind(self.RESTORE_VIRTUAL_EVENT_NAME, self.restore_event) - self.bell = self.text.bell if self.BELL else lambda: None self.counter = 0 self.is_restore_active = 0 - self.set_style(self.STYLE) @classmethod def reload(cls): @@ -75,27 +73,11 @@ def deactivate_restore(self): self.text.event_delete(self.RESTORE_VIRTUAL_EVENT_NAME, seq) self.is_restore_active = False - def set_style(self, style): - "Set tag and timeout functions." - self.STYLE = style - self.create_tag = ( - self.create_tag_opener if style in {"opener", "default"} else - self.create_tag_parens if style == "parens" else - self.create_tag_expression) # "expression" or unknown - - self.set_timeout = (self.set_timeout_last if self.FLASH_DELAY else - self.set_timeout_none) - def flash_paren_event(self, event): "Handle editor 'show surrounding parens' event (menu or shortcut)." indices = (HyperParser(self.editwin, "insert") .get_surrounding_brackets()) - if indices is None: - self.bell() - return "break" - self.activate_restore() - self.create_tag(indices) - self.set_timeout() + self.finish_paren_event(indices) return "break" def paren_closed_event(self, event): @@ -108,13 +90,19 @@ def paren_closed_event(self, event): if not hp.is_in_code(): return indices = hp.get_surrounding_brackets(_openers[closer], True) - if indices is None: - self.bell() + self.finish_paren_event(indices) + return # Allow calltips to see ')' + + def finish_paren_event(self, indices): + if indices is None and self.BELL: + self.text.bell() return self.activate_restore() - self.create_tag(indices) - self.set_timeout() - return + # self.create_tag(indices) + self.tagfuncs.get(self.STYLE, self.create_tag_expression)(self, indices) + # self.set_timeout() + (self.set_timeout_last if self.FLASH_DELAY else + self.set_timeout_none)() def restore_event(self, event=None): "Remove effect of doing match." @@ -152,6 +140,13 @@ def create_tag_expression(self, indices): self.text.tag_add("paren", indices[0], rightindex) self.text.tag_config("paren", self.HILITE_CONFIG) + tagfuncs = { + 'opener': create_tag_opener, + 'default': create_tag_opener, + 'parens': create_tag_parens, + 'expression': create_tag_expression, + } + # any one of the set_timeout_XXX methods can be used depending on # the style diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst new file mode 100644 index 00000000000..258fc1ba75d --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst @@ -0,0 +1,4 @@ +IDLE - Update non-key options in former extension classes. When applying +configdialog changes, call .reload for each feature class. Change ParenMatch +so updated options affect existing instances attached to existing editor +windows. From webhook-mailer at python.org Sat Sep 16 02:14:37 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 16 Sep 2017 06:14:37 -0000 Subject: [Python-checkins] [3.6] bpo-31488: IDLE - update former extensions when options change. (GH-3612) (#3613) Message-ID: https://github.com/python/cpython/commit/77b52e463ab9f8bea7703ff9c03c06b3ec889db7 commit: 77b52e463ab9f8bea7703ff9c03c06b3ec889db7 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-16T02:14:34-04:00 summary: [3.6] bpo-31488: IDLE - update former extensions when options change. (GH-3612) (#3613) When apply ConfigDialog changes, call .reload on each class with non-key options. Change ParenMatch so that updates affect current instances. (cherry picked from commit 5777ecc438790f3d324d52f2ccdad56e667e0cb3) files: A Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst M Lib/idlelib/configdialog.py M Lib/idlelib/idle_test/test_parenmatch.py M Lib/idlelib/parenmatch.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 683c36e9776..7feae5d6199 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -27,8 +27,14 @@ from idlelib.query import SectionName, HelpSource from idlelib.tabbedpages import TabbedPageSet from idlelib.textview import view_text +from idlelib.autocomplete import AutoComplete +from idlelib.codecontext import CodeContext +from idlelib.parenmatch import ParenMatch +from idlelib.paragraph import FormatParagraph changes = ConfigChanges() +# Reload changed options in the following classes. +reloadables = (AutoComplete, CodeContext, ParenMatch, FormatParagraph) class ConfigDialog(Toplevel): @@ -220,6 +226,8 @@ def activate_config_changes(self): instance.set_notabs_indentwidth() instance.ApplyKeybindings() instance.reset_help_menu_entries() + for klass in reloadables: + klass.reload() def create_page_extensions(self): """Part of the config dialog used for configuring IDLE extensions. diff --git a/Lib/idlelib/idle_test/test_parenmatch.py b/Lib/idlelib/idle_test/test_parenmatch.py index 6943a70c997..3caa2754a6d 100644 --- a/Lib/idlelib/idle_test/test_parenmatch.py +++ b/Lib/idlelib/idle_test/test_parenmatch.py @@ -58,7 +58,7 @@ def test_paren_styles(self): ('expression', ('1.10', '1.15'), ('1.10', '1.16'))): with self.subTest(style=style): text.delete('1.0', 'end') - pm.set_style(style) + pm.STYLE = style text.insert('insert', 'def foobar(a, b') pm.flash_paren_event('event') diff --git a/Lib/idlelib/parenmatch.py b/Lib/idlelib/parenmatch.py index 12212150c6d..983ca20675a 100644 --- a/Lib/idlelib/parenmatch.py +++ b/Lib/idlelib/parenmatch.py @@ -45,10 +45,8 @@ def __init__(self, editwin): # and deactivate_restore (which calls event_delete). editwin.text.bind(self.RESTORE_VIRTUAL_EVENT_NAME, self.restore_event) - self.bell = self.text.bell if self.BELL else lambda: None self.counter = 0 self.is_restore_active = 0 - self.set_style(self.STYLE) @classmethod def reload(cls): @@ -75,27 +73,11 @@ def deactivate_restore(self): self.text.event_delete(self.RESTORE_VIRTUAL_EVENT_NAME, seq) self.is_restore_active = False - def set_style(self, style): - "Set tag and timeout functions." - self.STYLE = style - self.create_tag = ( - self.create_tag_opener if style in {"opener", "default"} else - self.create_tag_parens if style == "parens" else - self.create_tag_expression) # "expression" or unknown - - self.set_timeout = (self.set_timeout_last if self.FLASH_DELAY else - self.set_timeout_none) - def flash_paren_event(self, event): "Handle editor 'show surrounding parens' event (menu or shortcut)." indices = (HyperParser(self.editwin, "insert") .get_surrounding_brackets()) - if indices is None: - self.bell() - return "break" - self.activate_restore() - self.create_tag(indices) - self.set_timeout() + self.finish_paren_event(indices) return "break" def paren_closed_event(self, event): @@ -108,13 +90,19 @@ def paren_closed_event(self, event): if not hp.is_in_code(): return indices = hp.get_surrounding_brackets(_openers[closer], True) - if indices is None: - self.bell() + self.finish_paren_event(indices) + return # Allow calltips to see ')' + + def finish_paren_event(self, indices): + if indices is None and self.BELL: + self.text.bell() return self.activate_restore() - self.create_tag(indices) - self.set_timeout() - return + # self.create_tag(indices) + self.tagfuncs.get(self.STYLE, self.create_tag_expression)(self, indices) + # self.set_timeout() + (self.set_timeout_last if self.FLASH_DELAY else + self.set_timeout_none)() def restore_event(self, event=None): "Remove effect of doing match." @@ -152,6 +140,13 @@ def create_tag_expression(self, indices): self.text.tag_add("paren", indices[0], rightindex) self.text.tag_config("paren", self.HILITE_CONFIG) + tagfuncs = { + 'opener': create_tag_opener, + 'default': create_tag_opener, + 'parens': create_tag_parens, + 'expression': create_tag_expression, + } + # any one of the set_timeout_XXX methods can be used depending on # the style diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst new file mode 100644 index 00000000000..258fc1ba75d --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst @@ -0,0 +1,4 @@ +IDLE - Update non-key options in former extension classes. When applying +configdialog changes, call .reload for each feature class. Change ParenMatch +so updated options affect existing instances attached to existing editor +windows. From solipsis at pitrou.net Sat Sep 16 05:22:50 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 16 Sep 2017 09:22:50 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170916092250.61399.4B7E926A9981C195@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-2, 2, 0] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogRtB0tD', '--timeout', '7200'] From webhook-mailer at python.org Sat Sep 16 07:29:37 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 16 Sep 2017 11:29:37 -0000 Subject: [Python-checkins] bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) (#3607) Message-ID: https://github.com/python/cpython/commit/51ea80697b023595cdd79c7696589a04cc581693 commit: 51ea80697b023595cdd79c7696589a04cc581693 branch: 3.6 author: Michael Seifert committer: Serhiy Storchaka date: 2017-09-16T14:29:33+03:00 summary: bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) (#3607) (cherry picked from commit da67e0d644bd3185efdaa4d15cc2ac0828ca83f9) files: M Doc/c-api/structures.rst M Doc/c-api/typeobj.rst diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index c080f317bee..675f6f26921 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -294,3 +294,43 @@ definition with the same method name. read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies :c:macro:`READONLY`. Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` members can be deleted. (They are set to *NULL*). + + +.. c:type:: PyGetSetDef + + Structure to define property-like access for a type. See also description of + the :c:member:`PyTypeObject.tp_getset` slot. + + +-------------+------------------+-----------------------------------+ + | Field | C Type | Meaning | + +=============+==================+===================================+ + | name | char \* | attribute name | + +-------------+------------------+-----------------------------------+ + | get | getter | C Function to get the attribute | + +-------------+------------------+-----------------------------------+ + | set | setter | optional C function to set or | + | | | delete the attribute, if omitted | + | | | the attribute is readonly | + +-------------+------------------+-----------------------------------+ + | doc | char \* | optional docstring | + +-------------+------------------+-----------------------------------+ + | closure | void \* | optional function pointer, | + | | | providing additional data for | + | | | getter and setter | + +-------------+------------------+-----------------------------------+ + + The ``get`` function takes one :c:type:`PyObject\*` parameter (the + instance) and a function pointer (the associated ``closure``):: + + typedef PyObject *(*getter)(PyObject *, void *); + + It should return a new reference on success or *NULL* with a set exception + on failure. + + ``set`` functions take two :c:type:`PyObject\*` parameters (the instance and + the value to be set) and a function pointer (the associated ``closure``):: + + typedef int (*setter)(PyObject *, PyObject *, void *); + + In case the attribute should be deleted the second parameter is *NULL*. + Should return ``0`` on success or ``-1`` with a set exception on failure. diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index ac6fd0b53fc..0b4577f5b95 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -719,21 +719,6 @@ type objects) *must* have the :attr:`ob_size` field. This field is not inherited by subtypes (computed attributes are inherited through a different mechanism). - .. XXX belongs elsewhere - - Docs for PyGetSetDef:: - - typedef PyObject *(*getter)(PyObject *, void *); - typedef int (*setter)(PyObject *, PyObject *, void *); - - typedef struct PyGetSetDef { - char *name; /* attribute name */ - getter get; /* C function to get the attribute */ - setter set; /* C function to set or delete the attribute */ - char *doc; /* optional doc string */ - void *closure; /* optional additional data for getter and setter */ - } PyGetSetDef; - .. c:member:: PyTypeObject* PyTypeObject.tp_base From webhook-mailer at python.org Sat Sep 16 07:30:10 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 16 Sep 2017 11:30:10 -0000 Subject: [Python-checkins] bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) (#3609) Message-ID: https://github.com/python/cpython/commit/41376241e364e4f84cd14631634604edbd105da0 commit: 41376241e364e4f84cd14631634604edbd105da0 branch: 2.7 author: Michael Seifert committer: Serhiy Storchaka date: 2017-09-16T14:30:07+03:00 summary: bpo-29916: Include PyGetSetDef in C API extension documentation. (#831) (#3609) (cherry picked from commit da67e0d644bd3185efdaa4d15cc2ac0828ca83f9) files: M Doc/c-api/structures.rst M Doc/c-api/typeobj.rst diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 782cec29d83..af6a8c38cd0 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -320,6 +320,46 @@ definition with the same method name. members can be deleted. (They are set to *NULL*). +.. c:type:: PyGetSetDef + + Structure to define property-like access for a type. See also description of + the :c:member:`PyTypeObject.tp_getset` slot. + + +-------------+------------------+-----------------------------------+ + | Field | C Type | Meaning | + +=============+==================+===================================+ + | name | char \* | attribute name | + +-------------+------------------+-----------------------------------+ + | get | getter | C Function to get the attribute | + +-------------+------------------+-----------------------------------+ + | set | setter | optional C function to set or | + | | | delete the attribute, if omitted | + | | | the attribute is readonly | + +-------------+------------------+-----------------------------------+ + | doc | char \* | optional docstring | + +-------------+------------------+-----------------------------------+ + | closure | void \* | optional function pointer, | + | | | providing additional data for | + | | | getter and setter | + +-------------+------------------+-----------------------------------+ + + The ``get`` function takes one :c:type:`PyObject\*` parameter (the + instance) and a function pointer (the associated ``closure``):: + + typedef PyObject *(*getter)(PyObject *, void *); + + It should return a new reference on success or *NULL* with a set exception + on failure. + + ``set`` functions take two :c:type:`PyObject\*` parameters (the instance and + the value to be set) and a function pointer (the associated ``closure``):: + + typedef int (*setter)(PyObject *, PyObject *, void *); + + In case the attribute should be deleted the second parameter is *NULL*. + Should return ``0`` on success or ``-1`` with a set exception on failure. + + .. c:function:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name) Return a bound method object for an extension type implemented in C. This diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 2ebbd52a381..18edcdd7e5a 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -825,21 +825,6 @@ The next fields, up to and including :c:member:`~PyTypeObject.tp_weaklist`, only This field is not inherited by subtypes (computed attributes are inherited through a different mechanism). - .. XXX belongs elsewhere - - Docs for PyGetSetDef:: - - typedef PyObject *(*getter)(PyObject *, void *); - typedef int (*setter)(PyObject *, PyObject *, void *); - - typedef struct PyGetSetDef { - char *name; /* attribute name */ - getter get; /* C function to get the attribute */ - setter set; /* C function to set or delete the attribute */ - char *doc; /* optional doc string */ - void *closure; /* optional additional data for getter and setter */ - } PyGetSetDef; - .. c:member:: PyTypeObject* PyTypeObject.tp_base From webhook-mailer at python.org Sat Sep 16 13:43:32 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 16 Sep 2017 17:43:32 -0000 Subject: [Python-checkins] bpo-31458: Clarify that Changelog is built from Misc/NEWS.d directory (GH-3617) Message-ID: https://github.com/python/cpython/commit/0ec8c4bd10dcfd8e580628868efdd3df91038898 commit: 0ec8c4bd10dcfd8e580628868efdd3df91038898 branch: master author: Mariatta committer: GitHub date: 2017-09-16T10:43:30-07:00 summary: bpo-31458: Clarify that Changelog is built from Misc/NEWS.d directory (GH-3617) files: M Doc/whatsnew/index.rst diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst index 20b599e3163..721dc03f42a 100644 --- a/Doc/whatsnew/index.rst +++ b/Doc/whatsnew/index.rst @@ -28,8 +28,10 @@ anyone wishing to stay up-to-date after a new release. 2.1.rst 2.0.rst -The "Changelog" is a HTML version of the file :source:`Misc/NEWS.d` which -contains *all* nontrivial changes to Python for the current version. +The "Changelog" is an HTML version of the `file built +`_ from the contents of the +:source:`Misc/NEWS.d` directory tree, which contains *all* nontrivial changes +to Python for the current version. .. toctree:: :maxdepth: 2 From webhook-mailer at python.org Sat Sep 16 14:33:36 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Sat, 16 Sep 2017 18:33:36 -0000 Subject: [Python-checkins] 2.7.14 final version bumps Message-ID: https://github.com/python/cpython/commit/84471935ed2f62b8c5758fd544c7d37076fe0fa5 commit: 84471935ed2f62b8c5758fd544c7d37076fe0fa5 branch: 2.7 author: Benjamin Peterson committer: Benjamin Peterson date: 2017-09-16T10:38:35-07:00 summary: 2.7.14 final version bumps files: M Include/patchlevel.h M Misc/NEWS M README diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 37544502ef9..8d05b91f012 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,11 +23,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 14 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.14rc1" +#define PY_VERSION "2.7.14" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS index 8489e8be7d4..b5d5dd945f1 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,17 @@ Python News +++++++++++ +What's New in Python 2.7.14? +============================ + +*Release date: 2017-09-16* + +Extension Modules +----------------- + +- bpo-31170: Update vendorized expat to 2.2.4. + + What's New in Python 2.7.14 release candidate 1? ================================================ diff --git a/README b/README index e28fe50f3d6..00a6b394655 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 2.7.14 release candidate 1 -================================================= +This is Python version 2.7.14 +============================= Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation. All rights From webhook-mailer at python.org Sat Sep 16 14:44:31 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 16 Sep 2017 18:44:31 -0000 Subject: [Python-checkins] bpo-31458: Clarify that Changelog is built from Misc/NEWS.d directory (GH-3617) (GH-3618) Message-ID: https://github.com/python/cpython/commit/d3cba8175ca48d33a4e0117109a44935a1cec658 commit: d3cba8175ca48d33a4e0117109a44935a1cec658 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-16T11:44:27-07:00 summary: bpo-31458: Clarify that Changelog is built from Misc/NEWS.d directory (GH-3617) (GH-3618) (cherry picked from commit 0ec8c4bd10dcfd8e580628868efdd3df91038898) files: M Doc/whatsnew/index.rst diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst index 63e6a7bafa9..aacdb22200c 100644 --- a/Doc/whatsnew/index.rst +++ b/Doc/whatsnew/index.rst @@ -27,8 +27,10 @@ anyone wishing to stay up-to-date after a new release. 2.1.rst 2.0.rst -The "Changelog" is a HTML version of the file :source:`Misc/NEWS.d` which -contains *all* nontrivial changes to Python for the current version. +The "Changelog" is an HTML version of the `file built +`_ from the contents of the +:source:`Misc/NEWS.d` directory tree, which contains *all* nontrivial changes +to Python for the current version. .. toctree:: :maxdepth: 2 From webhook-mailer at python.org Sat Sep 16 14:46:45 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 16 Sep 2017 18:46:45 -0000 Subject: [Python-checkins] Improve f-strings documentation (GH-3604) Message-ID: https://github.com/python/cpython/commit/f3618970690b08ed88e430ba8017859b4fafc3f9 commit: f3618970690b08ed88e430ba8017859b4fafc3f9 branch: master author: Mariatta committer: GitHub date: 2017-09-16T11:46:43-07:00 summary: Improve f-strings documentation (GH-3604) Provide additional examples of using format specifiers in f-strings Added examples for using integer and date format specifiers. files: M Doc/reference/lexical_analysis.rst diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 1a7c6f9c753..baf1f09dff2 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -676,6 +676,12 @@ Some examples of formatted string literals:: >>> value = decimal.Decimal("12.34567") >>> f"result: {value:{width}.{precision}}" # nested fields 'result: 12.35' + >>> today = datetime(year=2017, month=1, day=27) + >>> f"{today:%b %d, %Y}" # using date format specifier + 'January 27, 2017' + >>> number = 1024 + >>> f"{number:#0x}" # using integer presentation type as format specifier + '0x400' A consequence of sharing the same syntax as regular string literals is that characters in the replacement fields must not conflict with the From webhook-mailer at python.org Sat Sep 16 15:01:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Sat, 16 Sep 2017 19:01:34 -0000 Subject: [Python-checkins] bpo-31487: Improve f-strings documentation (GH-3604) (GH-3619) Message-ID: https://github.com/python/cpython/commit/46c1052404c1a6e4d35af8e96613db8a4be75b52 commit: 46c1052404c1a6e4d35af8e96613db8a4be75b52 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-16T12:01:32-07:00 summary: bpo-31487: Improve f-strings documentation (GH-3604) (GH-3619) Provide additional examples of using format specifiers in f-strings Added examples for using integer and date format specifiers. (cherry picked from commit f3618970690b08ed88e430ba8017859b4fafc3f9) files: M Doc/reference/lexical_analysis.rst diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index fff31a3ce4f..3305f460d4d 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -676,6 +676,12 @@ Some examples of formatted string literals:: >>> value = decimal.Decimal("12.34567") >>> f"result: {value:{width}.{precision}}" # nested fields 'result: 12.35' + >>> today = datetime(year=2017, month=1, day=27) + >>> f"{today:%b %d, %Y}" # using date format specifier + 'January 27, 2017' + >>> number = 1024 + >>> f"{number:#0x}" # using integer presentation type as format specifier + '0x400' A consequence of sharing the same syntax as regular string literals is that characters in the replacement fields must not conflict with the From webhook-mailer at python.org Sun Sep 17 00:56:58 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 17 Sep 2017 04:56:58 -0000 Subject: [Python-checkins] bpo-31493: Fix code context update and font update timers. (#3622) Message-ID: https://github.com/python/cpython/commit/a6bb313c70f8619e6dc4af5cef7d73fa3bbd59ca commit: a6bb313c70f8619e6dc4af5cef7d73fa3bbd59ca branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-17T00:56:56-04:00 summary: bpo-31493: Fix code context update and font update timers. (#3622) Canceling timers prevents a warning message when test_idle completes. (This is the minimum fix needed before upcoming releases.) files: A Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst M Lib/idlelib/codecontext.py diff --git a/Lib/idlelib/codecontext.py b/Lib/idlelib/codecontext.py index 779b5b88cf3..316e5109e6c 100644 --- a/Lib/idlelib/codecontext.py +++ b/Lib/idlelib/codecontext.py @@ -22,15 +22,14 @@ UPDATEINTERVAL = 100 # millisec FONTUPDATEINTERVAL = 1000 # millisec -getspacesfirstword =\ - lambda s, c=re.compile(r"^(\s*)(\w*)"): c.match(s).groups() +def getspacesfirstword(s, c=re.compile(r"^(\s*)(\w*)")): + return c.match(s).groups() class CodeContext: - bgcolor = idleConf.GetOption("extensions", "CodeContext", - "bgcolor", type="str", default="LightGray") - fgcolor = idleConf.GetOption("extensions", "CodeContext", - "fgcolor", type="str", default="Black") + bgcolor = "LightGray" + fgcolor = "Black" + def __init__(self, editwin): self.editwin = editwin self.text = editwin.text @@ -43,19 +42,25 @@ def __init__(self, editwin): # starts the toplevel 'block' of the module. self.info = [(0, -1, "", False)] self.topvisible = 1 - self.reload() # Start two update cycles, one for context lines, one for font changes. - self.text.after(UPDATEINTERVAL, self.timer_event) - self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + self.t1 = self.text.after(UPDATEINTERVAL, self.timer_event) + self.t2 = self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) @classmethod def reload(cls): cls.context_depth = idleConf.GetOption("extensions", "CodeContext", "numlines", type="int", default=3) - cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", - "bgcolor", type="str", default="LightGray") - cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", - "fgcolor", type="str", default="Black") +## cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", +## "bgcolor", type="str", default="LightGray") +## cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", +## "fgcolor", type="str", default="Black") + + def __del__(self): + try: + self.text.after_cancel(self.t1) + self.text.after_cancel(self.t2) + except: + pass def toggle_code_context_event(self, event=None): if not self.label: @@ -74,14 +79,12 @@ def toggle_code_context_event(self, event=None): border = 0 for widget in widgets: border += widget.tk.getint(widget.cget('border')) - self.label = tkinter.Label(self.editwin.top, - text="\n" * (self.context_depth - 1), - anchor=W, justify=LEFT, - font=self.textfont, - bg=self.bgcolor, fg=self.fgcolor, - width=1, #don't request more than we get - padx=padx, border=border, - relief=SUNKEN) + self.label = tkinter.Label( + self.editwin.top, text="\n" * (self.context_depth - 1), + anchor=W, justify=LEFT, font=self.textfont, + bg=self.bgcolor, fg=self.fgcolor, + width=1, #don't request more than we get + padx=padx, border=border, relief=SUNKEN) # Pack the label widget before and above the text_frame widget, # thus ensuring that it will appear directly above text_frame self.label.pack(side=TOP, fill=X, expand=False, @@ -89,9 +92,6 @@ def toggle_code_context_event(self, event=None): else: self.label.destroy() self.label = None - idleConf.SetOption("main", "Theme", "contexton", - str(self.label is not None)) - idleConf.SaveUserCfgFiles() return "break" def get_line_info(self, linenum): @@ -172,14 +172,14 @@ def update_code_context(self): def timer_event(self): if self.label: self.update_code_context() - self.text.after(UPDATEINTERVAL, self.timer_event) + self.t1 = self.text.after(UPDATEINTERVAL, self.timer_event) def font_timer_event(self): newtextfont = self.text["font"] if self.label and newtextfont != self.textfont: self.textfont = newtextfont self.label["font"] = self.textfont - self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + self.t2 = self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) CodeContext.reload() diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst new file mode 100644 index 00000000000..7fbf7b27795 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst @@ -0,0 +1,3 @@ +IDLE code context -- fix code update and font update timers. + +Canceling timers prevents a warning message when test_idle completes. From webhook-mailer at python.org Sun Sep 17 02:01:58 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 17 Sep 2017 06:01:58 -0000 Subject: [Python-checkins] [3.6] bpo-31493: Fix code context update and font update timers. (GH-3622) (#3623) Message-ID: https://github.com/python/cpython/commit/b417332bf44af93c8acda4b7197181d4b62c16a4 commit: b417332bf44af93c8acda4b7197181d4b62c16a4 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-17T02:01:53-04:00 summary: [3.6] bpo-31493: Fix code context update and font update timers. (GH-3622) (#3623) Canceling timers prevents a warning message when test_idle completes. (This is the minimum fix needed before upcoming releases.) (cherry picked from commit a6bb313c70f8619e6dc4af5cef7d73fa3bbd59ca) files: A Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst M Lib/idlelib/codecontext.py diff --git a/Lib/idlelib/codecontext.py b/Lib/idlelib/codecontext.py index 779b5b88cf3..316e5109e6c 100644 --- a/Lib/idlelib/codecontext.py +++ b/Lib/idlelib/codecontext.py @@ -22,15 +22,14 @@ UPDATEINTERVAL = 100 # millisec FONTUPDATEINTERVAL = 1000 # millisec -getspacesfirstword =\ - lambda s, c=re.compile(r"^(\s*)(\w*)"): c.match(s).groups() +def getspacesfirstword(s, c=re.compile(r"^(\s*)(\w*)")): + return c.match(s).groups() class CodeContext: - bgcolor = idleConf.GetOption("extensions", "CodeContext", - "bgcolor", type="str", default="LightGray") - fgcolor = idleConf.GetOption("extensions", "CodeContext", - "fgcolor", type="str", default="Black") + bgcolor = "LightGray" + fgcolor = "Black" + def __init__(self, editwin): self.editwin = editwin self.text = editwin.text @@ -43,19 +42,25 @@ def __init__(self, editwin): # starts the toplevel 'block' of the module. self.info = [(0, -1, "", False)] self.topvisible = 1 - self.reload() # Start two update cycles, one for context lines, one for font changes. - self.text.after(UPDATEINTERVAL, self.timer_event) - self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + self.t1 = self.text.after(UPDATEINTERVAL, self.timer_event) + self.t2 = self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) @classmethod def reload(cls): cls.context_depth = idleConf.GetOption("extensions", "CodeContext", "numlines", type="int", default=3) - cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", - "bgcolor", type="str", default="LightGray") - cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", - "fgcolor", type="str", default="Black") +## cls.bgcolor = idleConf.GetOption("extensions", "CodeContext", +## "bgcolor", type="str", default="LightGray") +## cls.fgcolor = idleConf.GetOption("extensions", "CodeContext", +## "fgcolor", type="str", default="Black") + + def __del__(self): + try: + self.text.after_cancel(self.t1) + self.text.after_cancel(self.t2) + except: + pass def toggle_code_context_event(self, event=None): if not self.label: @@ -74,14 +79,12 @@ def toggle_code_context_event(self, event=None): border = 0 for widget in widgets: border += widget.tk.getint(widget.cget('border')) - self.label = tkinter.Label(self.editwin.top, - text="\n" * (self.context_depth - 1), - anchor=W, justify=LEFT, - font=self.textfont, - bg=self.bgcolor, fg=self.fgcolor, - width=1, #don't request more than we get - padx=padx, border=border, - relief=SUNKEN) + self.label = tkinter.Label( + self.editwin.top, text="\n" * (self.context_depth - 1), + anchor=W, justify=LEFT, font=self.textfont, + bg=self.bgcolor, fg=self.fgcolor, + width=1, #don't request more than we get + padx=padx, border=border, relief=SUNKEN) # Pack the label widget before and above the text_frame widget, # thus ensuring that it will appear directly above text_frame self.label.pack(side=TOP, fill=X, expand=False, @@ -89,9 +92,6 @@ def toggle_code_context_event(self, event=None): else: self.label.destroy() self.label = None - idleConf.SetOption("main", "Theme", "contexton", - str(self.label is not None)) - idleConf.SaveUserCfgFiles() return "break" def get_line_info(self, linenum): @@ -172,14 +172,14 @@ def update_code_context(self): def timer_event(self): if self.label: self.update_code_context() - self.text.after(UPDATEINTERVAL, self.timer_event) + self.t1 = self.text.after(UPDATEINTERVAL, self.timer_event) def font_timer_event(self): newtextfont = self.text["font"] if self.label and newtextfont != self.textfont: self.textfont = newtextfont self.label["font"] = self.textfont - self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) + self.t2 = self.text.after(FONTUPDATEINTERVAL, self.font_timer_event) CodeContext.reload() diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst new file mode 100644 index 00000000000..7fbf7b27795 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst @@ -0,0 +1,3 @@ +IDLE code context -- fix code update and font update timers. + +Canceling timers prevents a warning message when test_idle completes. From solipsis at pitrou.net Sun Sep 17 05:22:35 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 17 Sep 2017 09:22:35 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=14 Message-ID: <20170917092235.62160.DD503A55953F68CA@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 8] memory blocks, sum=8 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, -1, 2] memory blocks, sum=1 test_multiprocessing_forkserver leaked [-2, 1, 0] memory blocks, sum=-1 test_multiprocessing_spawn leaked [0, 2, 0] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogi7CoK8', '--timeout', '7200'] From webhook-mailer at python.org Sun Sep 17 06:45:41 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 17 Sep 2017 10:45:41 -0000 Subject: [Python-checkins] bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (#3615) Message-ID: https://github.com/python/cpython/commit/30b61b51e05d2d43e8e2e783b0a9df738535423b commit: 30b61b51e05d2d43e8e2e783b0a9df738535423b branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-17T13:45:38+03:00 summary: bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (#3615) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst M Lib/ctypes/test/test_anon.py M Modules/_ctypes/stgdict.c diff --git a/Lib/ctypes/test/test_anon.py b/Lib/ctypes/test/test_anon.py index d892b598985..d378392ebe2 100644 --- a/Lib/ctypes/test/test_anon.py +++ b/Lib/ctypes/test/test_anon.py @@ -1,4 +1,5 @@ import unittest +import test.support from ctypes import * class AnonTest(unittest.TestCase): @@ -35,6 +36,18 @@ def test_anon_nonmember(self): {"_fields_": [], "_anonymous_": ["x"]})) + @test.support.cpython_only + def test_issue31490(self): + # There shouldn't be an assertion failure in case the class has an + # attribute whose name is specified in _anonymous_ but not in _fields_. + + # AttributeError: 'x' is specified in _anonymous_ but not in _fields_ + with self.assertRaises(AttributeError): + class Name(Structure): + _fields_ = [] + _anonymous_ = ["x"] + x = 42 + def test_nested(self): class ANON_S(Structure): _fields_ = [("a", c_int)] diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst new file mode 100644 index 00000000000..d95e825f132 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst @@ -0,0 +1,3 @@ +Fix an assertion failure in `ctypes` class definition, in case the class has +an attribute whose name is specified in ``_anonymous_`` but not in +``_fields_``. Patch by Oren Milman. diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index 3496c5706cb..b66c6ecd2f3 100644 --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -302,7 +302,15 @@ MakeAnonFields(PyObject *type) Py_DECREF(anon_names); return -1; } - assert(Py_TYPE(descr) == &PyCField_Type); + if (Py_TYPE(descr) != &PyCField_Type) { + PyErr_Format(PyExc_AttributeError, + "'%U' is specified in _anonymous_ but not in " + "_fields_", + fname); + Py_DECREF(anon_names); + Py_DECREF(descr); + return -1; + } descr->anonymous = 1; /* descr is in the field descriptor. */ From webhook-mailer at python.org Sun Sep 17 10:43:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 17 Sep 2017 14:43:34 -0000 Subject: [Python-checkins] bpo-31487: Update F-strings doc example (GH-3627) Message-ID: https://github.com/python/cpython/commit/63c591c0b0b57870a606e8edc59afe6264e7504d commit: 63c591c0b0b57870a606e8edc59afe6264e7504d branch: master author: Mariatta committer: GitHub date: 2017-09-17T07:43:31-07:00 summary: bpo-31487: Update F-strings doc example (GH-3627) Shorten the comment to: "using integer format specifier" files: M Doc/reference/lexical_analysis.rst diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index baf1f09dff2..684119a4439 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -680,7 +680,7 @@ Some examples of formatted string literals:: >>> f"{today:%b %d, %Y}" # using date format specifier 'January 27, 2017' >>> number = 1024 - >>> f"{number:#0x}" # using integer presentation type as format specifier + >>> f"{number:#0x}" # using integer format specifier '0x400' A consequence of sharing the same syntax as regular string literals is From webhook-mailer at python.org Sun Sep 17 10:57:11 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 17 Sep 2017 14:57:11 -0000 Subject: [Python-checkins] bpo-31487: Update F-strings doc example (GH-3627) (GH-3628) Message-ID: https://github.com/python/cpython/commit/4f6bae9677c0e5398e64c503fd3c19cae94567da commit: 4f6bae9677c0e5398e64c503fd3c19cae94567da branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-17T07:57:08-07:00 summary: bpo-31487: Update F-strings doc example (GH-3627) (GH-3628) Shorten the comment to: "using integer format specifier" (cherry picked from commit 63c591c0b0b57870a606e8edc59afe6264e7504d) files: M Doc/reference/lexical_analysis.rst diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 3305f460d4d..c2fd2b74caa 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -680,7 +680,7 @@ Some examples of formatted string literals:: >>> f"{today:%b %d, %Y}" # using date format specifier 'January 27, 2017' >>> number = 1024 - >>> f"{number:#0x}" # using integer presentation type as format specifier + >>> f"{number:#0x}" # using integer format specifier '0x400' A consequence of sharing the same syntax as regular string literals is From webhook-mailer at python.org Sun Sep 17 12:04:32 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Sun, 17 Sep 2017 16:04:32 -0000 Subject: [Python-checkins] bpo-31482: Missing bytes support for random.seed() version 1 (#3614) Message-ID: https://github.com/python/cpython/commit/132a7d7cdbc7cb89fa1c1f4e8192241c3d68f549 commit: 132a7d7cdbc7cb89fa1c1f4e8192241c3d68f549 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-17T09:04:30-07:00 summary: bpo-31482: Missing bytes support for random.seed() version 1 (#3614) bpo-31482: Missing bytes support for random.seed() version 1 #3614 files: A Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst M Lib/random.py M Lib/test/test_random.py diff --git a/Lib/random.py b/Lib/random.py index 01c0c3d25fb..91065b7e303 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -110,9 +110,10 @@ def seed(self, a=None, version=2): """ if version == 1 and isinstance(a, (str, bytes)): + a = a.decode('latin-1') if isinstance(a, bytes) else a x = ord(a[0]) << 7 if a else 0 - for c in a: - x = ((1000003 * x) ^ ord(c)) & 0xFFFFFFFFFFFFFFFF + for c in map(ord, a): + x = ((1000003 * x) ^ c) & 0xFFFFFFFFFFFFFFFF x ^= len(a) a = -2 if x == -1 else x diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index fbb1cf6696e..5d12aee1695 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -430,6 +430,33 @@ def test_bug_27706(self): ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1', '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2']) + def test_bug_31482(self): + # Verify that version 1 seeds are unaffected by hash randomization + # when the seeds are expressed as bytes rather than strings. + # The hash(b) values listed are the Python2.7 hash() values + # which were used for seeding. + + self.gen.seed(b'nofar', version=1) # hash('nofar') == 5990528763808513177 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.8645314505ad7p-1', '0x1.afb1f82e40a40p-5', + '0x1.2a59d2285e971p-1', '0x1.56977142a7880p-6']) + + self.gen.seed(b'rachel', version=1) # hash('rachel') == -9091735575445484789 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.0b294cc856fcdp-1', '0x1.2ad22d79e77b8p-3', + '0x1.3052b9c072678p-2', '0x1.578f332106574p-3']) + + self.gen.seed(b'', version=1) # hash('') == 0 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1', + '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2']) + + b = b'\x00\x20\x40\x60\x80\xA0\xC0\xE0\xF0' + self.gen.seed(b, version=1) # hash(b) == 5015594239749365497 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.52c2fde444d23p-1', '0x1.875174f0daea4p-2', + '0x1.9e9b2c50e5cd2p-1', '0x1.fa57768bd321cp-2']) + def test_setstate_first_arg(self): self.assertRaises(ValueError, self.gen.setstate, (1, None, None)) diff --git a/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst b/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst new file mode 100644 index 00000000000..ed7a4175cd7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst @@ -0,0 +1 @@ +``random.seed()`` now works with bytes in version=1 From webhook-mailer at python.org Sun Sep 17 14:11:07 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 17 Sep 2017 18:11:07 -0000 Subject: [Python-checkins] bpo-31497: Add private helper _PyType_Name(). (#3630) Message-ID: https://github.com/python/cpython/commit/4ab46d794961491ed185c195d53da7ee6a16e646 commit: 4ab46d794961491ed185c195d53da7ee6a16e646 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-17T21:11:04+03:00 summary: bpo-31497: Add private helper _PyType_Name(). (#3630) This function returns the last component of tp_name after a dot. Returns tp_name itself if it doesn't contain a dot. files: M Include/object.h M Modules/_functoolsmodule.c M Modules/itertoolsmodule.c M Objects/exceptions.c M Objects/odictobject.c M Objects/typeobject.c diff --git a/Include/object.h b/Include/object.h index 9bb780e28bc..cb57359ea23 100644 --- a/Include/object.h +++ b/Include/object.h @@ -501,6 +501,7 @@ PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, PyObject *, PyObject *); #ifndef Py_LIMITED_API +PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *); PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *); PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index e109b336466..a571045bcc7 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -1284,7 +1284,7 @@ PyInit__functools(void) { int i; PyObject *m; - char *name; + const char *name; PyTypeObject *typelist[] = { &partial_type, &lru_cache_type, @@ -1306,10 +1306,9 @@ PyInit__functools(void) Py_DECREF(m); return NULL; } - name = strchr(typelist[i]->tp_name, '.'); - assert (name != NULL); + name = _PyType_Name(typelist[i]); Py_INCREF(typelist[i]); - PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); + PyModule_AddObject(m, name, (PyObject *)typelist[i]); } return m; } diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index d7a1ef07428..0e5cbbd18dd 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4630,7 +4630,7 @@ PyInit_itertools(void) { int i; PyObject *m; - char *name; + const char *name; PyTypeObject *typelist[] = { &accumulate_type, &combinations_type, @@ -4663,10 +4663,9 @@ PyInit_itertools(void) for (i=0 ; typelist[i] != NULL ; i++) { if (PyType_Ready(typelist[i]) < 0) return NULL; - name = strchr(typelist[i]->tp_name, '.'); - assert (name != NULL); + name = _PyType_Name(typelist[i]); Py_INCREF(typelist[i]); - PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); + PyModule_AddObject(m, name, (PyObject *)typelist[i]); } return m; diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 1b70be786a4..42b3fc7bb1b 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -116,13 +116,7 @@ BaseException_str(PyBaseExceptionObject *self) static PyObject * BaseException_repr(PyBaseExceptionObject *self) { - const char *name; - const char *dot; - - name = Py_TYPE(self)->tp_name; - dot = (const char *) strrchr(name, '.'); - if (dot != NULL) name = dot+1; - + const char *name = _PyType_Name(Py_TYPE(self)); return PyUnicode_FromFormat("%s%R", name, self->args); } diff --git a/Objects/odictobject.c b/Objects/odictobject.c index 8ad8f384c41..afacb36f6b3 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1471,16 +1471,9 @@ odict_repr(PyODictObject *self) int i; _Py_IDENTIFIER(items); PyObject *pieces = NULL, *result = NULL; - const char *classname; - - classname = strrchr(Py_TYPE(self)->tp_name, '.'); - if (classname == NULL) - classname = Py_TYPE(self)->tp_name; - else - classname++; if (PyODict_SIZE(self) == 0) - return PyUnicode_FromFormat("%s()", classname); + return PyUnicode_FromFormat("%s()", _PyType_Name(Py_TYPE(self))); i = Py_ReprEnter((PyObject *)self); if (i != 0) { @@ -1532,7 +1525,8 @@ odict_repr(PyODictObject *self) goto Done; } - result = PyUnicode_FromFormat("%s(%R)", classname, pieces); + result = PyUnicode_FromFormat("%s(%R)", + _PyType_Name(Py_TYPE(self)), pieces); Done: Py_XDECREF(pieces); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 662c493ff2d..190a8b2aa48 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -388,11 +388,22 @@ check_set_special_type_attr(PyTypeObject *type, PyObject *value, const char *nam return 1; } +const char * +_PyType_Name(PyTypeObject *type) +{ + const char *s = strrchr(type->tp_name, '.'); + if (s == NULL) { + s = type->tp_name; + } + else { + s++; + } + return s; +} + static PyObject * type_name(PyTypeObject *type, void *context) { - const char *s; - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { PyHeapTypeObject* et = (PyHeapTypeObject*)type; @@ -400,12 +411,7 @@ type_name(PyTypeObject *type, void *context) return et->ht_name; } else { - s = strrchr(type->tp_name, '.'); - if (s == NULL) - s = type->tp_name; - else - s++; - return PyUnicode_FromString(s); + return PyUnicode_FromString(_PyType_Name(type)); } } @@ -418,7 +424,7 @@ type_qualname(PyTypeObject *type, void *context) return et->ht_qualname; } else { - return type_name(type, context); + return PyUnicode_FromString(_PyType_Name(type)); } } From webhook-mailer at python.org Sun Sep 17 20:13:28 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 18 Sep 2017 00:13:28 -0000 Subject: [Python-checkins] bpo-31502: IDLE Configdialog again deletes custom themes and keysets. (#3634) Message-ID: https://github.com/python/cpython/commit/0efc7c67a2f8a184e93f9a491305c81ef2e24250 commit: 0efc7c67a2f8a184e93f9a491305c81ef2e24250 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-17T20:13:25-04:00 summary: bpo-31502: IDLE Configdialog again deletes custom themes and keysets. (#3634) This reverses a never-released regression resulting from bpo-31287. files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 7feae5d6199..0f530c66a11 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -1237,7 +1237,7 @@ def save_new(self, theme_name, theme): def askyesno(self, *args, **kwargs): # Make testing easier. Could change implementation. - messagebox.askyesno(*args, **kwargs) + return messagebox.askyesno(*args, **kwargs) def delete_custom(self): """Handle event to delete custom theme. @@ -1683,7 +1683,7 @@ def save_new_key_set(keyset_name, keyset): def askyesno(self, *args, **kwargs): # Make testing easier. Could change implementation. - messagebox.askyesno(*args, **kwargs) + return messagebox.askyesno(*args, **kwargs) def delete_custom_keys(self): """Handle event to delete a custom key set. From webhook-mailer at python.org Sun Sep 17 20:14:24 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 18 Sep 2017 00:14:24 -0000 Subject: [Python-checkins] bpo-30928: Update idlelib/NEWS.txt to 2017 Sep 17. (#3635) Message-ID: https://github.com/python/cpython/commit/55679e0ec76ee3b30ca609948f47bb02a8e0a078 commit: 55679e0ec76ee3b30ca609948f47bb02a8e0a078 branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-17T20:14:21-04:00 summary: bpo-30928: Update idlelib/NEWS.txt to 2017 Sep 17. (#3635) files: M Lib/idlelib/NEWS.txt diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 86906b80abe..cc03860a33e 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,25 @@ Released on 2018-06-18? ======================== +bpo-31493: Fix code context update and font update timers. +Canceling timers prevents a warning message when test_idle completes. + +bpo-31488: Update non-key options in former extension classes. +When applying configdialog changes, call .reload for each feature class. +Change ParenMatch so updated options affect existing instances attached +to existing editor windows. + +bpo-31477: Improve rstrip entry in IDLE doc. +Strip Trailing Whitespace strips more than blank spaces. +Multiline string literals are not skipped. + +bpo-31480: fix tests to pass with zzdummy extension disabled. (#3590) +To see the example in action, enable it on options extensions tab. + +bpo-31421: Document how IDLE runs tkinter programs. +IDLE calls tcl/tk update in the background in order to make live +interaction and experimentatin with tkinter applications much easier. + bpo-bpo-31414: Fix tk entry box tests by deleting first. Adding to an int entry is not the same as deleting and inserting because int('') will fail. Patch by Terry Jan Reedy. From webhook-mailer at python.org Sun Sep 17 20:39:26 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 18 Sep 2017 00:39:26 -0000 Subject: [Python-checkins] [3.6] bpo-31502: IDLE Configdialog again deletes custom themes and keysets. (GH-3634) (#3636) Message-ID: https://github.com/python/cpython/commit/6b4d8ba0971355027b8981a45a0a62ac1ef9a456 commit: 6b4d8ba0971355027b8981a45a0a62ac1ef9a456 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-17T20:39:24-04:00 summary: [3.6] bpo-31502: IDLE Configdialog again deletes custom themes and keysets. (GH-3634) (#3636) This reverses a never-released regression resulting from bpo-31287. (cherry picked from commit 0efc7c67a2f8a184e93f9a491305c81ef2e24250) files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 7feae5d6199..0f530c66a11 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -1237,7 +1237,7 @@ def save_new(self, theme_name, theme): def askyesno(self, *args, **kwargs): # Make testing easier. Could change implementation. - messagebox.askyesno(*args, **kwargs) + return messagebox.askyesno(*args, **kwargs) def delete_custom(self): """Handle event to delete custom theme. @@ -1683,7 +1683,7 @@ def save_new_key_set(keyset_name, keyset): def askyesno(self, *args, **kwargs): # Make testing easier. Could change implementation. - messagebox.askyesno(*args, **kwargs) + return messagebox.askyesno(*args, **kwargs) def delete_custom_keys(self): """Handle event to delete a custom key set. From webhook-mailer at python.org Sun Sep 17 20:56:18 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 18 Sep 2017 00:56:18 -0000 Subject: [Python-checkins] bpo-31501: Operator precedence description for arithmetic operators (#3633) Message-ID: https://github.com/python/cpython/commit/9b47af65375fab9318e88ccb061394a36c8c6c33 commit: 9b47af65375fab9318e88ccb061394a36c8c6c33 branch: master author: svelankar <17737361+svelankar at users.noreply.github.com> committer: Raymond Hettinger date: 2017-09-17T17:56:16-07:00 summary: bpo-31501: Operator precedence description for arithmetic operators (#3633) files: M Doc/reference/expressions.rst diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index ddcbd5567c1..094b92841e2 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1687,8 +1687,8 @@ precedence and have a left-to-right chaining feature as described in the | ``+``, ``-`` | Addition and subtraction | +-----------------------------------------------+-------------------------------------+ | ``*``, ``@``, ``/``, ``//``, ``%`` | Multiplication, matrix | -| | multiplication division, | -| | remainder [#]_ | +| | multiplication, division, floor | +| | division, remainder [#]_ | +-----------------------------------------------+-------------------------------------+ | ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT | +-----------------------------------------------+-------------------------------------+ From webhook-mailer at python.org Sun Sep 17 21:10:57 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Mon, 18 Sep 2017 01:10:57 -0000 Subject: [Python-checkins] [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017 Sep 17. (GH-3635) (#3637) Message-ID: https://github.com/python/cpython/commit/84c89ef4e5086e71e3d9ee65cd3620bf8174c9ac commit: 84c89ef4e5086e71e3d9ee65cd3620bf8174c9ac branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-17T21:10:54-04:00 summary: [3.6] bpo-30928: Update idlelib/NEWS.txt to 2017 Sep 17. (GH-3635) (#3637) (cherry picked from commit 55679e0ec76ee3b30ca609948f47bb02a8e0a078) files: M Lib/idlelib/NEWS.txt diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 23cc9805133..f03e9cde8c9 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,25 @@ Released on 2017-09-25? ======================== +bpo-31493: Fix code context update and font update timers. +Canceling timers prevents a warning message when test_idle completes. + +bpo-31488: Update non-key options in former extension classes. +When applying configdialog changes, call .reload for each feature class. +Change ParenMatch so updated options affect existing instances attached +to existing editor windows. + +bpo-31477: Improve rstrip entry in IDLE doc. +Strip Trailing Whitespace strips more than blank spaces. +Multiline string literals are not skipped. + +bpo-31480: fix tests to pass with zzdummy extension disabled. (#3590) +To see the example in action, enable it on options extensions tab. + +bpo-31421: Document how IDLE runs tkinter programs. +IDLE calls tcl/tk update in the background in order to make live +interaction and experimentatin with tkinter applications much easier. + bpo-bpo-31414: Fix tk entry box tests by deleting first. Adding to an int entry is not the same as deleting and inserting because int('') will fail. Patch by Terry Jan Reedy. From solipsis at pitrou.net Mon Sep 18 05:23:09 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 18 Sep 2017 09:23:09 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=10 Message-ID: <20170918092309.40596.93C762CA9DE48199@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [1, 0, -2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogWf6wTH', '--timeout', '7200'] From webhook-mailer at python.org Mon Sep 18 08:29:40 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 18 Sep 2017 12:29:40 -0000 Subject: [Python-checkins] bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash (#3641) Message-ID: https://github.com/python/cpython/commit/e727d41ffcd91b21ce82026ec8c8381d34a16209 commit: e727d41ffcd91b21ce82026ec8c8381d34a16209 branch: master author: Victor Stinner committer: GitHub date: 2017-09-18T05:29:37-07:00 summary: bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash (#3641) * bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash xml.etree: xmlparser_gc_clear() now sets self.parser to NULL to prevent a crash in xmlparser_dealloc() if xmlparser_gc_clear() was called previously by the garbage collector, because the parser was part of a reference cycle. Co-Authored-By: Serhiy Storchaka files: A Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst M Lib/test/test_xml_etree_c.py M Modules/_elementtree.c diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 171a3f88b9a..25517a7269c 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -65,6 +65,26 @@ def test_trashcan(self): del root support.gc_collect() + def test_parser_ref_cycle(self): + # bpo-31499: xmlparser_dealloc() crashed with a segmentation fault when + # xmlparser_gc_clear() was called previously by the garbage collector, + # when the parser was part of a reference cycle. + + def parser_ref_cycle(): + parser = cET.XMLParser() + # Create a reference cycle using an exception to keep the frame + # alive, so the parser will be destroyed by the garbage collector + try: + raise ValueError + except ValueError as exc: + err = exc + + # Create a parser part of reference cycle + parser_ref_cycle() + # Trigger an explicit garbage collection to break the reference cycle + # and so destroy the parser + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst new file mode 100644 index 00000000000..22af29fdecb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst @@ -0,0 +1 @@ +xml.etree: Fix a crash when a parser is part of a reference cycle. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 28d0181594b..bddac851d9c 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3411,7 +3411,11 @@ xmlparser_gc_traverse(XMLParserObject *self, visitproc visit, void *arg) static int xmlparser_gc_clear(XMLParserObject *self) { - EXPAT(ParserFree)(self->parser); + if (self->parser != NULL) { + XML_Parser parser = self->parser; + self->parser = NULL; + EXPAT(ParserFree)(parser); + } Py_CLEAR(self->handle_close); Py_CLEAR(self->handle_pi); From webhook-mailer at python.org Mon Sep 18 08:48:25 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 18 Sep 2017 12:48:25 -0000 Subject: [Python-checkins] [3.6] bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash (GH-3641) (#3645) Message-ID: https://github.com/python/cpython/commit/8afd7ab12d7f8915b549cf04af384b495ec73d22 commit: 8afd7ab12d7f8915b549cf04af384b495ec73d22 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-18T05:48:23-07:00 summary: [3.6] bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash (GH-3641) (#3645) * bpo-31499, xml.etree: Fix xmlparser_gc_clear() crash xml.etree: xmlparser_gc_clear() now sets self.parser to NULL to prevent a crash in xmlparser_dealloc() if xmlparser_gc_clear() was called previously by the garbage collector, because the parser was part of a reference cycle. Co-Authored-By: Serhiy Storchaka (cherry picked from commit e727d41ffcd91b21ce82026ec8c8381d34a16209) files: A Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst M Lib/test/test_xml_etree_c.py M Modules/_elementtree.c diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index 7c60699f912..b2200d31f59 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -64,6 +64,26 @@ def test_trashcan(self): del root support.gc_collect() + def test_parser_ref_cycle(self): + # bpo-31499: xmlparser_dealloc() crashed with a segmentation fault when + # xmlparser_gc_clear() was called previously by the garbage collector, + # when the parser was part of a reference cycle. + + def parser_ref_cycle(): + parser = cET.XMLParser() + # Create a reference cycle using an exception to keep the frame + # alive, so the parser will be destroyed by the garbage collector + try: + raise ValueError + except ValueError as exc: + err = exc + + # Create a parser part of reference cycle + parser_ref_cycle() + # Trigger an explicit garbage collection to break the reference cycle + # and so destroy the parser + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst new file mode 100644 index 00000000000..22af29fdecb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst @@ -0,0 +1 @@ +xml.etree: Fix a crash when a parser is part of a reference cycle. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index cf3e687c8c6..a6d6c61dd24 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3367,7 +3367,11 @@ xmlparser_gc_traverse(XMLParserObject *self, visitproc visit, void *arg) static int xmlparser_gc_clear(XMLParserObject *self) { - EXPAT(ParserFree)(self->parser); + if (self->parser != NULL) { + XML_Parser parser = self->parser; + self->parser = NULL; + EXPAT(ParserFree)(parser); + } Py_CLEAR(self->handle_close); Py_CLEAR(self->handle_pi); From webhook-mailer at python.org Mon Sep 18 11:49:48 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 18 Sep 2017 15:49:48 -0000 Subject: [Python-checkins] os.test_utime_current(): tolerate 50 ms delta (#3646) Message-ID: https://github.com/python/cpython/commit/a8e7d903d7c4dd3a64412016e9f44f0e75f1fb3f commit: a8e7d903d7c4dd3a64412016e9f44f0e75f1fb3f branch: master author: Victor Stinner committer: GitHub date: 2017-09-18T08:49:45-07:00 summary: os.test_utime_current(): tolerate 50 ms delta (#3646) files: M Lib/test/test_os.py diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index c3c82381abf..d7d08cece3c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -619,14 +619,13 @@ def _test_utime_current(self, set_time): if not self.support_subsecond(self.fname): delta = 1.0 - elif os.name == 'nt': + else: # On Windows, the usual resolution of time.time() is 15.6 ms. # bpo-30649: Tolerate 50 ms for slow Windows buildbots. + # + # x86 Gentoo Refleaks 3.x once failed with dt=20.2 ms. So use + # also 50 ms on other platforms. delta = 0.050 - else: - # bpo-30649: PPC64 Fedora 3.x buildbot requires - # at least a delta of 14 ms - delta = 0.020 st = os.stat(self.fname) msg = ("st_time=%r, current=%r, dt=%r" % (st.st_mtime, current, st.st_mtime - current)) From webhook-mailer at python.org Mon Sep 18 16:04:28 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Mon, 18 Sep 2017 20:04:28 -0000 Subject: [Python-checkins] Restore dummy_threading and _dummy_thread, but deprecate them (bpo-31370) (#3648) Message-ID: https://github.com/python/cpython/commit/b43c4caf81b10e5c7ebaeb3a712c6db584f60bbd commit: b43c4caf81b10e5c7ebaeb3a712c6db584f60bbd branch: master author: Antoine Pitrou committer: GitHub date: 2017-09-18T22:04:20+02:00 summary: Restore dummy_threading and _dummy_thread, but deprecate them (bpo-31370) (#3648) files: A Lib/_dummy_thread.py A Lib/dummy_threading.py A Lib/test/test_dummy_thread.py A Lib/test/test_dummy_threading.py M Doc/library/_dummy_thread.rst M Doc/library/_thread.rst M Doc/library/concurrency.rst M Doc/library/dummy_threading.rst M Doc/library/threading.rst diff --git a/Doc/library/_dummy_thread.rst b/Doc/library/_dummy_thread.rst index ebce74d5a22..7dccbc55475 100644 --- a/Doc/library/_dummy_thread.rst +++ b/Doc/library/_dummy_thread.rst @@ -6,18 +6,15 @@ **Source code:** :source:`Lib/_dummy_thread.py` --------------- - -This module provides a duplicate interface to the :mod:`_thread` module. It is -meant to be imported when the :mod:`_thread` module is not provided on a -platform. +.. deprecated:: 3.7 + Python now always has threading enabled. Please use :mod:`_thread` + (or, better, :mod:`threading`) instead. -Suggested usage is:: +-------------- - try: - import _thread - except ImportError: - import _dummy_thread as _thread +This module provides a duplicate interface to the :mod:`_thread` module. +It was meant to be imported when the :mod:`_thread` module was not provided +on a platform. Be careful to not use this module where deadlock might occur from a thread being created that blocks waiting for another thread to be created. This often occurs diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst index 0d2d818f5f9..67cb70944f4 100644 --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -23,14 +23,10 @@ threading API built on top of this module. single: pthreads pair: threads; POSIX -The module is optional. It is supported on Windows, Linux, SGI IRIX, Solaris -2.x, as well as on systems that have a POSIX thread (a.k.a. "pthread") -implementation. For systems lacking the :mod:`_thread` module, the -:mod:`_dummy_thread` module is available. It duplicates this module's interface -and can be used as a drop-in replacement. - -It defines the following constants and functions: +.. versionchanged:: 3.7 + This module used to be optional, it is now always available. +This module defines the following constants and functions: .. exception:: error diff --git a/Doc/library/concurrency.rst b/Doc/library/concurrency.rst index 0de281bd149..826bf86d081 100644 --- a/Doc/library/concurrency.rst +++ b/Doc/library/concurrency.rst @@ -26,6 +26,6 @@ The following are support modules for some of the above services: .. toctree:: - dummy_threading.rst _thread.rst _dummy_thread.rst + dummy_threading.rst diff --git a/Doc/library/dummy_threading.rst b/Doc/library/dummy_threading.rst index 30a3ebba674..dfc3289abb1 100644 --- a/Doc/library/dummy_threading.rst +++ b/Doc/library/dummy_threading.rst @@ -6,20 +6,15 @@ **Source code:** :source:`Lib/dummy_threading.py` --------------- - -This module provides a duplicate interface to the :mod:`threading` module. It -is meant to be imported when the :mod:`_thread` module is not provided on a -platform. +.. deprecated:: 3.7 + Python now always has threading enabled. Please use :mod:`threading` instead. -Suggested usage is:: +-------------- - try: - import threading - except ImportError: - import dummy_threading as threading +This module provides a duplicate interface to the :mod:`threading` module. +It was meant to be imported when the :mod:`_thread` module was not provided +on a platform. Be careful to not use this module where deadlock might occur from a thread being created that blocks waiting for another thread to be created. This often occurs with blocking I/O. - diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 021e29e7124..8c3a2cd4f65 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -11,8 +11,8 @@ This module constructs higher-level threading interfaces on top of the lower level :mod:`_thread` module. See also the :mod:`queue` module. -The :mod:`dummy_threading` module is provided for situations where -:mod:`threading` cannot be used because :mod:`_thread` is missing. +.. versionchanged:: 3.7 + This module used to be optional, it is now always available. .. note:: diff --git a/Lib/_dummy_thread.py b/Lib/_dummy_thread.py new file mode 100644 index 00000000000..a2cae54b058 --- /dev/null +++ b/Lib/_dummy_thread.py @@ -0,0 +1,163 @@ +"""Drop-in replacement for the thread module. + +Meant to be used as a brain-dead substitute so that threaded code does +not need to be rewritten for when the thread module is not present. + +Suggested usage is:: + + try: + import _thread + except ImportError: + import _dummy_thread as _thread + +""" +# Exports only things specified by thread documentation; +# skipping obsolete synonyms allocate(), start_new(), exit_thread(). +__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', + 'interrupt_main', 'LockType'] + +# A dummy value +TIMEOUT_MAX = 2**31 + +# NOTE: this module can be imported early in the extension building process, +# and so top level imports of other modules should be avoided. Instead, all +# imports are done when needed on a function-by-function basis. Since threads +# are disabled, the import lock should not be an issue anyway (??). + +error = RuntimeError + +def start_new_thread(function, args, kwargs={}): + """Dummy implementation of _thread.start_new_thread(). + + Compatibility is maintained by making sure that ``args`` is a + tuple and ``kwargs`` is a dictionary. If an exception is raised + and it is SystemExit (which can be done by _thread.exit()) it is + caught and nothing is done; all other exceptions are printed out + by using traceback.print_exc(). + + If the executed function calls interrupt_main the KeyboardInterrupt will be + raised when the function returns. + + """ + if type(args) != type(tuple()): + raise TypeError("2nd arg must be a tuple") + if type(kwargs) != type(dict()): + raise TypeError("3rd arg must be a dict") + global _main + _main = False + try: + function(*args, **kwargs) + except SystemExit: + pass + except: + import traceback + traceback.print_exc() + _main = True + global _interrupt + if _interrupt: + _interrupt = False + raise KeyboardInterrupt + +def exit(): + """Dummy implementation of _thread.exit().""" + raise SystemExit + +def get_ident(): + """Dummy implementation of _thread.get_ident(). + + Since this module should only be used when _threadmodule is not + available, it is safe to assume that the current process is the + only thread. Thus a constant can be safely returned. + """ + return 1 + +def allocate_lock(): + """Dummy implementation of _thread.allocate_lock().""" + return LockType() + +def stack_size(size=None): + """Dummy implementation of _thread.stack_size().""" + if size is not None: + raise error("setting thread stack size not supported") + return 0 + +def _set_sentinel(): + """Dummy implementation of _thread._set_sentinel().""" + return LockType() + +class LockType(object): + """Class implementing dummy implementation of _thread.LockType. + + Compatibility is maintained by maintaining self.locked_status + which is a boolean that stores the state of the lock. Pickling of + the lock, though, should not be done since if the _thread module is + then used with an unpickled ``lock()`` from here problems could + occur from this class not having atomic methods. + + """ + + def __init__(self): + self.locked_status = False + + def acquire(self, waitflag=None, timeout=-1): + """Dummy implementation of acquire(). + + For blocking calls, self.locked_status is automatically set to + True and returned appropriately based on value of + ``waitflag``. If it is non-blocking, then the value is + actually checked and not set if it is already acquired. This + is all done so that threading.Condition's assert statements + aren't triggered and throw a little fit. + + """ + if waitflag is None or waitflag: + self.locked_status = True + return True + else: + if not self.locked_status: + self.locked_status = True + return True + else: + if timeout > 0: + import time + time.sleep(timeout) + return False + + __enter__ = acquire + + def __exit__(self, typ, val, tb): + self.release() + + def release(self): + """Release the dummy lock.""" + # XXX Perhaps shouldn't actually bother to test? Could lead + # to problems for complex, threaded code. + if not self.locked_status: + raise error + self.locked_status = False + return True + + def locked(self): + return self.locked_status + + def __repr__(self): + return "<%s %s.%s object at %s>" % ( + "locked" if self.locked_status else "unlocked", + self.__class__.__module__, + self.__class__.__qualname__, + hex(id(self)) + ) + +# Used to signal that interrupt_main was called in a "thread" +_interrupt = False +# True when not executing in a "thread" +_main = True + +def interrupt_main(): + """Set _interrupt flag to True to have start_new_thread raise + KeyboardInterrupt upon exiting.""" + if _main: + raise KeyboardInterrupt + else: + global _interrupt + _interrupt = True diff --git a/Lib/dummy_threading.py b/Lib/dummy_threading.py new file mode 100644 index 00000000000..1bb7eee338a --- /dev/null +++ b/Lib/dummy_threading.py @@ -0,0 +1,78 @@ +"""Faux ``threading`` version using ``dummy_thread`` instead of ``thread``. + +The module ``_dummy_threading`` is added to ``sys.modules`` in order +to not have ``threading`` considered imported. Had ``threading`` been +directly imported it would have made all subsequent imports succeed +regardless of whether ``_thread`` was available which is not desired. + +""" +from sys import modules as sys_modules + +import _dummy_thread + +# Declaring now so as to not have to nest ``try``s to get proper clean-up. +holding_thread = False +holding_threading = False +holding__threading_local = False + +try: + # Could have checked if ``_thread`` was not in sys.modules and gone + # a different route, but decided to mirror technique used with + # ``threading`` below. + if '_thread' in sys_modules: + held_thread = sys_modules['_thread'] + holding_thread = True + # Must have some module named ``_thread`` that implements its API + # in order to initially import ``threading``. + sys_modules['_thread'] = sys_modules['_dummy_thread'] + + if 'threading' in sys_modules: + # If ``threading`` is already imported, might as well prevent + # trying to import it more than needed by saving it if it is + # already imported before deleting it. + held_threading = sys_modules['threading'] + holding_threading = True + del sys_modules['threading'] + + if '_threading_local' in sys_modules: + # If ``_threading_local`` is already imported, might as well prevent + # trying to import it more than needed by saving it if it is + # already imported before deleting it. + held__threading_local = sys_modules['_threading_local'] + holding__threading_local = True + del sys_modules['_threading_local'] + + import threading + # Need a copy of the code kept somewhere... + sys_modules['_dummy_threading'] = sys_modules['threading'] + del sys_modules['threading'] + sys_modules['_dummy__threading_local'] = sys_modules['_threading_local'] + del sys_modules['_threading_local'] + from _dummy_threading import * + from _dummy_threading import __all__ + +finally: + # Put back ``threading`` if we overwrote earlier + + if holding_threading: + sys_modules['threading'] = held_threading + del held_threading + del holding_threading + + # Put back ``_threading_local`` if we overwrote earlier + + if holding__threading_local: + sys_modules['_threading_local'] = held__threading_local + del held__threading_local + del holding__threading_local + + # Put back ``thread`` if we overwrote, else del the entry we made + if holding_thread: + sys_modules['_thread'] = held_thread + del held_thread + else: + del sys_modules['_thread'] + del holding_thread + + del _dummy_thread + del sys_modules diff --git a/Lib/test/test_dummy_thread.py b/Lib/test/test_dummy_thread.py new file mode 100644 index 00000000000..0840be67d56 --- /dev/null +++ b/Lib/test/test_dummy_thread.py @@ -0,0 +1,255 @@ +import _dummy_thread as _thread +import time +import queue +import random +import unittest +from test import support +from unittest import mock + +DELAY = 0 + + +class LockTests(unittest.TestCase): + """Test lock objects.""" + + def setUp(self): + # Create a lock + self.lock = _thread.allocate_lock() + + def test_initlock(self): + #Make sure locks start locked + self.assertFalse(self.lock.locked(), + "Lock object is not initialized unlocked.") + + def test_release(self): + # Test self.lock.release() + self.lock.acquire() + self.lock.release() + self.assertFalse(self.lock.locked(), + "Lock object did not release properly.") + + def test_LockType_context_manager(self): + with _thread.LockType(): + pass + self.assertFalse(self.lock.locked(), + "Acquired Lock was not released") + + def test_improper_release(self): + #Make sure release of an unlocked thread raises RuntimeError + self.assertRaises(RuntimeError, self.lock.release) + + def test_cond_acquire_success(self): + #Make sure the conditional acquiring of the lock works. + self.assertTrue(self.lock.acquire(0), + "Conditional acquiring of the lock failed.") + + def test_cond_acquire_fail(self): + #Test acquiring locked lock returns False + self.lock.acquire(0) + self.assertFalse(self.lock.acquire(0), + "Conditional acquiring of a locked lock incorrectly " + "succeeded.") + + def test_uncond_acquire_success(self): + #Make sure unconditional acquiring of a lock works. + self.lock.acquire() + self.assertTrue(self.lock.locked(), + "Uncondional locking failed.") + + def test_uncond_acquire_return_val(self): + #Make sure that an unconditional locking returns True. + self.assertIs(self.lock.acquire(1), True, + "Unconditional locking did not return True.") + self.assertIs(self.lock.acquire(), True) + + def test_uncond_acquire_blocking(self): + #Make sure that unconditional acquiring of a locked lock blocks. + def delay_unlock(to_unlock, delay): + """Hold on to lock for a set amount of time before unlocking.""" + time.sleep(delay) + to_unlock.release() + + self.lock.acquire() + start_time = int(time.time()) + _thread.start_new_thread(delay_unlock,(self.lock, DELAY)) + if support.verbose: + print() + print("*** Waiting for thread to release the lock "\ + "(approx. %s sec.) ***" % DELAY) + self.lock.acquire() + end_time = int(time.time()) + if support.verbose: + print("done") + self.assertGreaterEqual(end_time - start_time, DELAY, + "Blocking by unconditional acquiring failed.") + + @mock.patch('time.sleep') + def test_acquire_timeout(self, mock_sleep): + """Test invoking acquire() with a positive timeout when the lock is + already acquired. Ensure that time.sleep() is invoked with the given + timeout and that False is returned.""" + + self.lock.acquire() + retval = self.lock.acquire(waitflag=0, timeout=1) + self.assertTrue(mock_sleep.called) + mock_sleep.assert_called_once_with(1) + self.assertEqual(retval, False) + + def test_lock_representation(self): + self.lock.acquire() + self.assertIn("locked", repr(self.lock)) + self.lock.release() + self.assertIn("unlocked", repr(self.lock)) + + +class MiscTests(unittest.TestCase): + """Miscellaneous tests.""" + + def test_exit(self): + self.assertRaises(SystemExit, _thread.exit) + + def test_ident(self): + self.assertIsInstance(_thread.get_ident(), int, + "_thread.get_ident() returned a non-integer") + self.assertGreater(_thread.get_ident(), 0) + + def test_LockType(self): + self.assertIsInstance(_thread.allocate_lock(), _thread.LockType, + "_thread.LockType is not an instance of what " + "is returned by _thread.allocate_lock()") + + def test_set_sentinel(self): + self.assertIsInstance(_thread._set_sentinel(), _thread.LockType, + "_thread._set_sentinel() did not return a " + "LockType instance.") + + def test_interrupt_main(self): + #Calling start_new_thread with a function that executes interrupt_main + # should raise KeyboardInterrupt upon completion. + def call_interrupt(): + _thread.interrupt_main() + + self.assertRaises(KeyboardInterrupt, + _thread.start_new_thread, + call_interrupt, + tuple()) + + def test_interrupt_in_main(self): + self.assertRaises(KeyboardInterrupt, _thread.interrupt_main) + + def test_stack_size_None(self): + retval = _thread.stack_size(None) + self.assertEqual(retval, 0) + + def test_stack_size_not_None(self): + with self.assertRaises(_thread.error) as cm: + _thread.stack_size("") + self.assertEqual(cm.exception.args[0], + "setting thread stack size not supported") + + +class ThreadTests(unittest.TestCase): + """Test thread creation.""" + + def test_arg_passing(self): + #Make sure that parameter passing works. + def arg_tester(queue, arg1=False, arg2=False): + """Use to test _thread.start_new_thread() passes args properly.""" + queue.put((arg1, arg2)) + + testing_queue = queue.Queue(1) + _thread.start_new_thread(arg_tester, (testing_queue, True, True)) + result = testing_queue.get() + self.assertTrue(result[0] and result[1], + "Argument passing for thread creation " + "using tuple failed") + + _thread.start_new_thread( + arg_tester, + tuple(), + {'queue':testing_queue, 'arg1':True, 'arg2':True}) + + result = testing_queue.get() + self.assertTrue(result[0] and result[1], + "Argument passing for thread creation " + "using kwargs failed") + + _thread.start_new_thread( + arg_tester, + (testing_queue, True), + {'arg2':True}) + + result = testing_queue.get() + self.assertTrue(result[0] and result[1], + "Argument passing for thread creation using both tuple" + " and kwargs failed") + + def test_multi_thread_creation(self): + def queue_mark(queue, delay): + time.sleep(delay) + queue.put(_thread.get_ident()) + + thread_count = 5 + testing_queue = queue.Queue(thread_count) + + if support.verbose: + print() + print("*** Testing multiple thread creation " + "(will take approx. %s to %s sec.) ***" % ( + DELAY, thread_count)) + + for count in range(thread_count): + if DELAY: + local_delay = round(random.random(), 1) + else: + local_delay = 0 + _thread.start_new_thread(queue_mark, + (testing_queue, local_delay)) + time.sleep(DELAY) + if support.verbose: + print('done') + self.assertEqual(testing_queue.qsize(), thread_count, + "Not all %s threads executed properly " + "after %s sec." % (thread_count, DELAY)) + + def test_args_not_tuple(self): + """ + Test invoking start_new_thread() with a non-tuple value for "args". + Expect TypeError with a meaningful error message to be raised. + """ + with self.assertRaises(TypeError) as cm: + _thread.start_new_thread(mock.Mock(), []) + self.assertEqual(cm.exception.args[0], "2nd arg must be a tuple") + + def test_kwargs_not_dict(self): + """ + Test invoking start_new_thread() with a non-dict value for "kwargs". + Expect TypeError with a meaningful error message to be raised. + """ + with self.assertRaises(TypeError) as cm: + _thread.start_new_thread(mock.Mock(), tuple(), kwargs=[]) + self.assertEqual(cm.exception.args[0], "3rd arg must be a dict") + + def test_SystemExit(self): + """ + Test invoking start_new_thread() with a function that raises + SystemExit. + The exception should be discarded. + """ + func = mock.Mock(side_effect=SystemExit()) + try: + _thread.start_new_thread(func, tuple()) + except SystemExit: + self.fail("start_new_thread raised SystemExit.") + + @mock.patch('traceback.print_exc') + def test_RaiseException(self, mock_print_exc): + """ + Test invoking start_new_thread() with a function that raises exception. + + The exception should be discarded and the traceback should be printed + via traceback.print_exc() + """ + func = mock.Mock(side_effect=Exception) + _thread.start_new_thread(func, tuple()) + self.assertTrue(mock_print_exc.called) diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py new file mode 100644 index 00000000000..a0c2972a60e --- /dev/null +++ b/Lib/test/test_dummy_threading.py @@ -0,0 +1,60 @@ +from test import support +import unittest +import dummy_threading as _threading +import time + +class DummyThreadingTestCase(unittest.TestCase): + + class TestThread(_threading.Thread): + + def run(self): + global running + global sema + global mutex + # Uncomment if testing another module, such as the real 'threading' + # module. + #delay = random.random() * 2 + delay = 0 + if support.verbose: + print('task', self.name, 'will run for', delay, 'sec') + sema.acquire() + mutex.acquire() + running += 1 + if support.verbose: + print(running, 'tasks are running') + mutex.release() + time.sleep(delay) + if support.verbose: + print('task', self.name, 'done') + mutex.acquire() + running -= 1 + if support.verbose: + print(self.name, 'is finished.', running, 'tasks are running') + mutex.release() + sema.release() + + def setUp(self): + self.numtasks = 10 + global sema + sema = _threading.BoundedSemaphore(value=3) + global mutex + mutex = _threading.RLock() + global running + running = 0 + self.threads = [] + + def test_tasks(self): + for i in range(self.numtasks): + t = self.TestThread(name=""%i) + self.threads.append(t) + t.start() + + if support.verbose: + print('waiting for all tasks to complete') + for t in self.threads: + t.join() + if support.verbose: + print('all tasks done') + +if __name__ == '__main__': + unittest.main() From webhook-mailer at python.org Mon Sep 18 17:50:47 2017 From: webhook-mailer at python.org (Antoine Pitrou) Date: Mon, 18 Sep 2017 21:50:47 -0000 Subject: [Python-checkins] Trivial cleanups following bpo-31370 (#3649) Message-ID: https://github.com/python/cpython/commit/88c60c9668f0aa732693517a60b851cc1dfce0cb commit: 88c60c9668f0aa732693517a60b851cc1dfce0cb branch: master author: Antoine Pitrou committer: GitHub date: 2017-09-18T23:50:44+02:00 summary: Trivial cleanups following bpo-31370 (#3649) * Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module files: M Lib/_pydecimal.py M Lib/importlib/_bootstrap.py M Lib/importlib/_bootstrap_external.py M Lib/test/ssl_servers.py M Lib/test/support/__init__.py M Lib/test/test_httplib.py M Lib/test/test_idle.py M Lib/test/test_multiprocessing_main_handling.py M Lib/test/test_thread.py M Lib/test/test_threadsignals.py M Lib/test/test_tools/test_sundry.py M Lib/test/test_winreg.py M Lib/test/test_wsgiref.py M Lib/test/test_xmlrpc.py M Python/importlib.h M Python/importlib_external.h diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index a43c75fc3e5..a1662bbd671 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -431,10 +431,7 @@ class FloatOperation(DecimalException, TypeError): ##### Context Functions ################################################## # The getcontext() and setcontext() function manage access to a thread-local -# current context. Py2.4 offers direct support for thread locals. If that -# is not available, use threading.current_thread() which is slower but will -# work for older Pythons. If threads are not part of the build, create a -# mock threading object with threading.local() returning the module namespace. +# current context. import threading diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index fbd9392d418..755a6344654 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -1121,25 +1121,13 @@ def _setup(sys_module, _imp_module): # Directly load built-in modules needed during bootstrap. self_module = sys.modules[__name__] - for builtin_name in ('_warnings',): + for builtin_name in ('_thread', '_warnings', '_weakref'): if builtin_name not in sys.modules: builtin_module = _builtin_from_name(builtin_name) else: builtin_module = sys.modules[builtin_name] setattr(self_module, builtin_name, builtin_module) - # Directly load the _thread module (needed during bootstrap). - try: - thread_module = _builtin_from_name('_thread') - except ImportError: - # Python was built without threads - thread_module = None - setattr(self_module, '_thread', thread_module) - - # Directly load the _weakref module (needed during bootstrap). - weakref_module = _builtin_from_name('_weakref') - setattr(self_module, '_weakref', weakref_module) - def _install(sys_module, _imp_module): """Install importers for builtin and frozen modules""" diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 32354042f6f..e9f870bf7f4 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1411,11 +1411,7 @@ def _setup(_bootstrap_module): setattr(self_module, 'path_separators', ''.join(path_separators)) # Directly load the _thread module (needed during bootstrap). - try: - thread_module = _bootstrap._builtin_from_name('_thread') - except ImportError: - # Python was built without threads - thread_module = None + thread_module = _bootstrap._builtin_from_name('_thread') setattr(self_module, '_thread', thread_module) # Directly load the _weakref module (needed during bootstrap). diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py index 81464679bd0..bfe533c4801 100644 --- a/Lib/test/ssl_servers.py +++ b/Lib/test/ssl_servers.py @@ -2,13 +2,13 @@ import sys import ssl import pprint +import threading import urllib.parse # Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer. from http.server import (HTTPServer as _HTTPServer, SimpleHTTPRequestHandler, BaseHTTPRequestHandler) from test import support -threading = support.import_module("threading") here = os.path.dirname(__file__) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index b2e45605b9e..4f60507919f 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2060,7 +2060,6 @@ def threading_cleanup(*original_values): def reap_threads(func): """Use this function when threads are being used. This will ensure that the threads are cleaned up even when the test fails. - If threading is unavailable this function does nothing. """ @functools.wraps(func) def decorator(*args): diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index ab798a2525e..bec994ed293 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -5,6 +5,7 @@ import os import array import socket +import threading import unittest TestCase = unittest.TestCase @@ -1077,8 +1078,6 @@ def test_read1_bound_content_length(self): def test_response_fileno(self): # Make sure fd returned by fileno is valid. - threading = support.import_module("threading") - serv = socket.socket( socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP) self.addCleanup(serv.close) diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py index b7ef70ddbaf..31fffd94a08 100644 --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -1,7 +1,7 @@ import unittest from test.support import import_module -# Skip test if _thread or _tkinter wasn't built, if idlelib is missing, +# Skip test if _tkinter wasn't built, if idlelib is missing, # or if tcl/tk is not the 8.5+ needed for ttk widgets. tk = import_module('tkinter') # imports _tkinter if tk.TkVersion < 8.5: diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py index a9c5d69fae2..fd93184914a 100644 --- a/Lib/test/test_multiprocessing_main_handling.py +++ b/Lib/test/test_multiprocessing_main_handling.py @@ -1,7 +1,6 @@ # tests __main__ module handling in multiprocessing from test import support -# Skip tests if _thread or _multiprocessing wasn't built. -support.import_module('_thread') +# Skip tests if _multiprocessing wasn't built. support.import_module('_multiprocessing') import importlib diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index 52f6c798b87..64ffe460529 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -2,7 +2,7 @@ import unittest import random from test import support -thread = support.import_module('_thread') +import _thread as thread import time import sys import weakref diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py index f93dd772555..67a1c581d79 100644 --- a/Lib/test/test_threadsignals.py +++ b/Lib/test/test_threadsignals.py @@ -5,7 +5,7 @@ import os import sys from test import support -thread = support.import_module('_thread') +import _thread as thread import time if (sys.platform[:3] == 'win'): diff --git a/Lib/test/test_tools/test_sundry.py b/Lib/test/test_tools/test_sundry.py index 39e541b45bd..2f9db9424f6 100644 --- a/Lib/test/test_tools/test_sundry.py +++ b/Lib/test/test_tools/test_sundry.py @@ -40,7 +40,6 @@ def test_sundry_windows(self): for name in self.windows_only: import_tool(name) - @unittest.skipIf(not support.threading, "test requires _thread module") def test_analyze_dxp_import(self): if hasattr(sys, 'getdxp'): import_tool('analyze_dxp') diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index 2be61ae15df..11d054e16cd 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -4,7 +4,7 @@ import os, sys, errno import unittest from test import support -threading = support.import_module("threading") +import threading from platform import machine # Do this first so test will be skipped if module doesn't exist diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py index 7708e206840..8422b308d79 100644 --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -18,6 +18,7 @@ import re import signal import sys +import threading import unittest @@ -253,7 +254,6 @@ def test_interrupted_write(self): # BaseHandler._write() and _flush() have to write all data, even if # it takes multiple send() calls. Test this by interrupting a send() # call with a Unix signal. - threading = support.import_module("threading") pthread_kill = support.get_attribute(signal, "pthread_kill") def app(environ, start_response): diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index c9099e05117..15b7ae5581f 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -1175,13 +1175,7 @@ def test_gzip_decode_limit(self): class ServerProxyTestCase(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) - if threading: - self.url = URL - else: - # Without threading, http_server() and http_multi_server() will not - # be executed and URL is still equal to None. 'http://' is a just - # enough to choose the scheme (HTTP) - self.url = 'http://' + self.url = URL def test_close(self): p = xmlrpclib.ServerProxy(self.url) diff --git a/Python/importlib.h b/Python/importlib.h index f552616f99b..b962a38a0ba 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -1707,8 +1707,8 @@ const unsigned char _Py_M__importlib[] = { 0,0,0,114,11,0,0,0,218,18,95,98,117,105,108,116, 105,110,95,102,114,111,109,95,110,97,109,101,66,4,0,0, 115,8,0,0,0,0,1,10,1,8,1,12,1,114,197,0, - 0,0,99,2,0,0,0,0,0,0,0,12,0,0,0,12, - 0,0,0,67,0,0,0,115,244,0,0,0,124,1,97,0, + 0,0,99,2,0,0,0,0,0,0,0,10,0,0,0,5, + 0,0,0,67,0,0,0,115,174,0,0,0,124,1,97,0, 124,0,97,1,116,2,116,1,131,1,125,2,120,86,116,1, 106,3,160,4,161,0,68,0,93,72,92,2,125,3,125,4, 116,5,124,4,124,2,131,2,114,28,124,3,116,1,106,6, @@ -1719,101 +1719,94 @@ const unsigned char _Py_M__importlib[] = { 100,5,68,0,93,46,125,8,124,8,116,1,106,3,107,7, 114,144,116,13,124,8,131,1,125,9,110,10,116,1,106,3, 124,8,25,0,125,9,116,14,124,7,124,8,124,9,131,3, - 1,0,113,120,87,0,121,12,116,13,100,2,131,1,125,10, - 87,0,110,24,4,0,116,15,107,10,114,206,1,0,1,0, - 1,0,100,3,125,10,89,0,110,2,88,0,116,14,124,7, - 100,2,124,10,131,3,1,0,116,13,100,4,131,1,125,11, - 116,14,124,7,100,4,124,11,131,3,1,0,100,3,83,0, - 41,6,122,250,83,101,116,117,112,32,105,109,112,111,114,116, - 108,105,98,32,98,121,32,105,109,112,111,114,116,105,110,103, - 32,110,101,101,100,101,100,32,98,117,105,108,116,45,105,110, - 32,109,111,100,117,108,101,115,32,97,110,100,32,105,110,106, - 101,99,116,105,110,103,32,116,104,101,109,10,32,32,32,32, - 105,110,116,111,32,116,104,101,32,103,108,111,98,97,108,32, - 110,97,109,101,115,112,97,99,101,46,10,10,32,32,32,32, - 65,115,32,115,121,115,32,105,115,32,110,101,101,100,101,100, - 32,102,111,114,32,115,121,115,46,109,111,100,117,108,101,115, - 32,97,99,99,101,115,115,32,97,110,100,32,95,105,109,112, - 32,105,115,32,110,101,101,100,101,100,32,116,111,32,108,111, - 97,100,32,98,117,105,108,116,45,105,110,10,32,32,32,32, - 109,111,100,117,108,101,115,44,32,116,104,111,115,101,32,116, - 119,111,32,109,111,100,117,108,101,115,32,109,117,115,116,32, - 98,101,32,101,120,112,108,105,99,105,116,108,121,32,112,97, - 115,115,101,100,32,105,110,46,10,10,32,32,32,32,114,167, - 0,0,0,114,20,0,0,0,78,114,56,0,0,0,41,1, - 114,167,0,0,0,41,16,114,49,0,0,0,114,14,0,0, - 0,114,13,0,0,0,114,80,0,0,0,218,5,105,116,101, - 109,115,114,171,0,0,0,114,70,0,0,0,114,142,0,0, - 0,114,76,0,0,0,114,152,0,0,0,114,129,0,0,0, - 114,134,0,0,0,114,1,0,0,0,114,197,0,0,0,114, - 5,0,0,0,114,71,0,0,0,41,12,218,10,115,121,115, - 95,109,111,100,117,108,101,218,11,95,105,109,112,95,109,111, - 100,117,108,101,90,11,109,111,100,117,108,101,95,116,121,112, - 101,114,15,0,0,0,114,84,0,0,0,114,94,0,0,0, - 114,83,0,0,0,90,11,115,101,108,102,95,109,111,100,117, - 108,101,90,12,98,117,105,108,116,105,110,95,110,97,109,101, - 90,14,98,117,105,108,116,105,110,95,109,111,100,117,108,101, - 90,13,116,104,114,101,97,100,95,109,111,100,117,108,101,90, - 14,119,101,97,107,114,101,102,95,109,111,100,117,108,101,114, + 1,0,113,120,87,0,100,4,83,0,41,6,122,250,83,101, + 116,117,112,32,105,109,112,111,114,116,108,105,98,32,98,121, + 32,105,109,112,111,114,116,105,110,103,32,110,101,101,100,101, + 100,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, + 101,115,32,97,110,100,32,105,110,106,101,99,116,105,110,103, + 32,116,104,101,109,10,32,32,32,32,105,110,116,111,32,116, + 104,101,32,103,108,111,98,97,108,32,110,97,109,101,115,112, + 97,99,101,46,10,10,32,32,32,32,65,115,32,115,121,115, + 32,105,115,32,110,101,101,100,101,100,32,102,111,114,32,115, + 121,115,46,109,111,100,117,108,101,115,32,97,99,99,101,115, + 115,32,97,110,100,32,95,105,109,112,32,105,115,32,110,101, + 101,100,101,100,32,116,111,32,108,111,97,100,32,98,117,105, + 108,116,45,105,110,10,32,32,32,32,109,111,100,117,108,101, + 115,44,32,116,104,111,115,101,32,116,119,111,32,109,111,100, + 117,108,101,115,32,109,117,115,116,32,98,101,32,101,120,112, + 108,105,99,105,116,108,121,32,112,97,115,115,101,100,32,105, + 110,46,10,10,32,32,32,32,114,20,0,0,0,114,167,0, + 0,0,114,56,0,0,0,78,41,3,114,20,0,0,0,114, + 167,0,0,0,114,56,0,0,0,41,15,114,49,0,0,0, + 114,14,0,0,0,114,13,0,0,0,114,80,0,0,0,218, + 5,105,116,101,109,115,114,171,0,0,0,114,70,0,0,0, + 114,142,0,0,0,114,76,0,0,0,114,152,0,0,0,114, + 129,0,0,0,114,134,0,0,0,114,1,0,0,0,114,197, + 0,0,0,114,5,0,0,0,41,10,218,10,115,121,115,95, + 109,111,100,117,108,101,218,11,95,105,109,112,95,109,111,100, + 117,108,101,90,11,109,111,100,117,108,101,95,116,121,112,101, + 114,15,0,0,0,114,84,0,0,0,114,94,0,0,0,114, + 83,0,0,0,90,11,115,101,108,102,95,109,111,100,117,108, + 101,90,12,98,117,105,108,116,105,110,95,110,97,109,101,90, + 14,98,117,105,108,116,105,110,95,109,111,100,117,108,101,114, 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,6, - 95,115,101,116,117,112,73,4,0,0,115,50,0,0,0,0, + 95,115,101,116,117,112,73,4,0,0,115,36,0,0,0,0, 9,4,1,4,3,8,1,20,1,10,1,10,1,6,1,10, 1,6,2,2,1,10,1,14,3,10,1,10,1,10,1,10, - 2,10,1,16,3,2,1,12,1,14,2,10,1,12,3,8, - 1,114,201,0,0,0,99,2,0,0,0,0,0,0,0,2, - 0,0,0,3,0,0,0,67,0,0,0,115,38,0,0,0, - 116,0,124,0,124,1,131,2,1,0,116,1,106,2,160,3, - 116,4,161,1,1,0,116,1,106,2,160,3,116,5,161,1, - 1,0,100,1,83,0,41,2,122,48,73,110,115,116,97,108, - 108,32,105,109,112,111,114,116,101,114,115,32,102,111,114,32, - 98,117,105,108,116,105,110,32,97,110,100,32,102,114,111,122, - 101,110,32,109,111,100,117,108,101,115,78,41,6,114,201,0, - 0,0,114,14,0,0,0,114,166,0,0,0,114,110,0,0, - 0,114,142,0,0,0,114,152,0,0,0,41,2,114,199,0, - 0,0,114,200,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,8,95,105,110,115,116,97,108,108, - 120,4,0,0,115,6,0,0,0,0,2,10,2,12,1,114, - 202,0,0,0,99,0,0,0,0,0,0,0,0,1,0,0, - 0,4,0,0,0,67,0,0,0,115,32,0,0,0,100,1, - 100,2,108,0,125,0,124,0,97,1,124,0,160,2,116,3, - 106,4,116,5,25,0,161,1,1,0,100,2,83,0,41,3, - 122,57,73,110,115,116,97,108,108,32,105,109,112,111,114,116, - 101,114,115,32,116,104,97,116,32,114,101,113,117,105,114,101, - 32,101,120,116,101,114,110,97,108,32,102,105,108,101,115,121, - 115,116,101,109,32,97,99,99,101,115,115,114,19,0,0,0, - 78,41,6,218,26,95,102,114,111,122,101,110,95,105,109,112, - 111,114,116,108,105,98,95,101,120,116,101,114,110,97,108,114, - 116,0,0,0,114,202,0,0,0,114,14,0,0,0,114,80, - 0,0,0,114,1,0,0,0,41,1,114,203,0,0,0,114, - 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,27, - 95,105,110,115,116,97,108,108,95,101,120,116,101,114,110,97, - 108,95,105,109,112,111,114,116,101,114,115,128,4,0,0,115, - 6,0,0,0,0,3,8,1,4,1,114,204,0,0,0,41, - 2,78,78,41,1,78,41,2,78,114,19,0,0,0,41,51, - 114,3,0,0,0,114,116,0,0,0,114,12,0,0,0,114, - 16,0,0,0,114,51,0,0,0,114,29,0,0,0,114,36, - 0,0,0,114,17,0,0,0,114,18,0,0,0,114,41,0, - 0,0,114,42,0,0,0,114,45,0,0,0,114,57,0,0, - 0,114,59,0,0,0,114,69,0,0,0,114,75,0,0,0, - 114,78,0,0,0,114,85,0,0,0,114,96,0,0,0,114, - 97,0,0,0,114,103,0,0,0,114,79,0,0,0,114,129, - 0,0,0,114,134,0,0,0,114,137,0,0,0,114,92,0, - 0,0,114,81,0,0,0,114,140,0,0,0,114,141,0,0, - 0,114,82,0,0,0,114,142,0,0,0,114,152,0,0,0, - 114,157,0,0,0,114,163,0,0,0,114,165,0,0,0,114, - 170,0,0,0,114,174,0,0,0,90,15,95,69,82,82,95, - 77,83,71,95,80,82,69,70,73,88,114,176,0,0,0,114, - 179,0,0,0,218,6,111,98,106,101,99,116,114,180,0,0, - 0,114,181,0,0,0,114,182,0,0,0,114,189,0,0,0, - 114,193,0,0,0,114,196,0,0,0,114,197,0,0,0,114, - 201,0,0,0,114,202,0,0,0,114,204,0,0,0,114,10, - 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, - 0,0,218,8,60,109,111,100,117,108,101,62,25,0,0,0, - 115,96,0,0,0,4,0,4,2,8,8,8,8,4,2,4, - 3,16,4,14,68,14,21,14,16,8,37,8,17,8,11,14, - 8,8,11,8,12,8,16,8,36,14,27,14,101,16,26,10, - 45,14,60,8,17,8,17,8,24,8,29,8,23,8,15,14, - 73,14,77,14,13,8,9,8,9,10,47,8,16,4,1,8, - 2,8,27,6,3,8,16,10,15,8,31,8,27,18,35,8, - 7,8,47,8,8, + 2,10,1,114,201,0,0,0,99,2,0,0,0,0,0,0, + 0,2,0,0,0,3,0,0,0,67,0,0,0,115,38,0, + 0,0,116,0,124,0,124,1,131,2,1,0,116,1,106,2, + 160,3,116,4,161,1,1,0,116,1,106,2,160,3,116,5, + 161,1,1,0,100,1,83,0,41,2,122,48,73,110,115,116, + 97,108,108,32,105,109,112,111,114,116,101,114,115,32,102,111, + 114,32,98,117,105,108,116,105,110,32,97,110,100,32,102,114, + 111,122,101,110,32,109,111,100,117,108,101,115,78,41,6,114, + 201,0,0,0,114,14,0,0,0,114,166,0,0,0,114,110, + 0,0,0,114,142,0,0,0,114,152,0,0,0,41,2,114, + 199,0,0,0,114,200,0,0,0,114,10,0,0,0,114,10, + 0,0,0,114,11,0,0,0,218,8,95,105,110,115,116,97, + 108,108,108,4,0,0,115,6,0,0,0,0,2,10,2,12, + 1,114,202,0,0,0,99,0,0,0,0,0,0,0,0,1, + 0,0,0,4,0,0,0,67,0,0,0,115,32,0,0,0, + 100,1,100,2,108,0,125,0,124,0,97,1,124,0,160,2, + 116,3,106,4,116,5,25,0,161,1,1,0,100,2,83,0, + 41,3,122,57,73,110,115,116,97,108,108,32,105,109,112,111, + 114,116,101,114,115,32,116,104,97,116,32,114,101,113,117,105, + 114,101,32,101,120,116,101,114,110,97,108,32,102,105,108,101, + 115,121,115,116,101,109,32,97,99,99,101,115,115,114,19,0, + 0,0,78,41,6,218,26,95,102,114,111,122,101,110,95,105, + 109,112,111,114,116,108,105,98,95,101,120,116,101,114,110,97, + 108,114,116,0,0,0,114,202,0,0,0,114,14,0,0,0, + 114,80,0,0,0,114,1,0,0,0,41,1,114,203,0,0, + 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, + 218,27,95,105,110,115,116,97,108,108,95,101,120,116,101,114, + 110,97,108,95,105,109,112,111,114,116,101,114,115,116,4,0, + 0,115,6,0,0,0,0,3,8,1,4,1,114,204,0,0, + 0,41,2,78,78,41,1,78,41,2,78,114,19,0,0,0, + 41,51,114,3,0,0,0,114,116,0,0,0,114,12,0,0, + 0,114,16,0,0,0,114,51,0,0,0,114,29,0,0,0, + 114,36,0,0,0,114,17,0,0,0,114,18,0,0,0,114, + 41,0,0,0,114,42,0,0,0,114,45,0,0,0,114,57, + 0,0,0,114,59,0,0,0,114,69,0,0,0,114,75,0, + 0,0,114,78,0,0,0,114,85,0,0,0,114,96,0,0, + 0,114,97,0,0,0,114,103,0,0,0,114,79,0,0,0, + 114,129,0,0,0,114,134,0,0,0,114,137,0,0,0,114, + 92,0,0,0,114,81,0,0,0,114,140,0,0,0,114,141, + 0,0,0,114,82,0,0,0,114,142,0,0,0,114,152,0, + 0,0,114,157,0,0,0,114,163,0,0,0,114,165,0,0, + 0,114,170,0,0,0,114,174,0,0,0,90,15,95,69,82, + 82,95,77,83,71,95,80,82,69,70,73,88,114,176,0,0, + 0,114,179,0,0,0,218,6,111,98,106,101,99,116,114,180, + 0,0,0,114,181,0,0,0,114,182,0,0,0,114,189,0, + 0,0,114,193,0,0,0,114,196,0,0,0,114,197,0,0, + 0,114,201,0,0,0,114,202,0,0,0,114,204,0,0,0, + 114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,218,8,60,109,111,100,117,108,101,62,25,0, + 0,0,115,96,0,0,0,4,0,4,2,8,8,8,8,4, + 2,4,3,16,4,14,68,14,21,14,16,8,37,8,17,8, + 11,14,8,8,11,8,12,8,16,8,36,14,27,14,101,16, + 26,10,45,14,60,8,17,8,17,8,24,8,29,8,23,8, + 15,14,73,14,77,14,13,8,9,8,9,10,47,8,16,4, + 1,8,2,8,27,6,3,8,16,10,15,8,31,8,27,18, + 35,8,7,8,35,8,8, }; diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 1216a2c94d5..83fe39c0762 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -2289,7 +2289,7 @@ const unsigned char _Py_M__importlib_external[] = { 0,114,159,0,0,0,80,5,0,0,115,8,0,0,0,0, 5,12,1,8,1,8,1,114,159,0,0,0,99,1,0,0, 0,0,0,0,0,12,0,0,0,12,0,0,0,67,0,0, - 0,115,188,1,0,0,124,0,97,0,116,0,106,1,97,1, + 0,115,156,1,0,0,124,0,97,0,116,0,106,1,97,1, 116,0,106,2,97,2,116,1,106,3,116,4,25,0,125,1, 120,56,100,26,68,0,93,48,125,2,124,2,116,1,106,3, 107,7,114,58,116,0,160,5,124,2,161,1,125,3,110,10, @@ -2306,17 +2306,15 @@ const unsigned char _Py_M__importlib_external[] = { 116,9,100,12,131,1,130,1,116,6,124,1,100,13,124,8, 131,3,1,0,116,6,124,1,100,14,124,7,131,3,1,0, 116,6,124,1,100,15,100,16,160,10,124,6,161,1,131,3, - 1,0,121,14,116,0,160,5,100,17,161,1,125,9,87,0, - 110,26,4,0,116,9,107,10,144,1,114,52,1,0,1,0, - 1,0,100,18,125,9,89,0,110,2,88,0,116,6,124,1, - 100,17,124,9,131,3,1,0,116,0,160,5,100,19,161,1, - 125,10,116,6,124,1,100,19,124,10,131,3,1,0,124,5, - 100,7,107,2,144,1,114,120,116,0,160,5,100,20,161,1, - 125,11,116,6,124,1,100,21,124,11,131,3,1,0,116,6, - 124,1,100,22,116,11,131,0,131,3,1,0,116,12,160,13, + 1,0,116,0,160,5,100,17,161,1,125,9,116,6,124,1, + 100,17,124,9,131,3,1,0,116,0,160,5,100,18,161,1, + 125,10,116,6,124,1,100,18,124,10,131,3,1,0,124,5, + 100,7,107,2,144,1,114,88,116,0,160,5,100,19,161,1, + 125,11,116,6,124,1,100,20,124,11,131,3,1,0,116,6, + 124,1,100,21,116,11,131,0,131,3,1,0,116,12,160,13, 116,2,160,14,161,0,161,1,1,0,124,5,100,7,107,2, - 144,1,114,184,116,15,160,16,100,23,161,1,1,0,100,24, - 116,12,107,6,144,1,114,184,100,25,116,17,95,18,100,18, + 144,1,114,152,116,15,160,16,100,22,161,1,1,0,100,23, + 116,12,107,6,144,1,114,152,100,24,116,17,95,18,100,25, 83,0,41,27,122,205,83,101,116,117,112,32,116,104,101,32, 112,97,116,104,45,98,97,115,101,100,32,105,109,112,111,114, 116,101,114,115,32,102,111,114,32,105,109,112,111,114,116,108, @@ -2345,10 +2343,10 @@ const unsigned char _Py_M__importlib_external[] = { 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, 112,111,115,105,120,32,111,114,32,110,116,114,3,0,0,0, 114,27,0,0,0,114,23,0,0,0,114,32,0,0,0,90, - 7,95,116,104,114,101,97,100,78,90,8,95,119,101,97,107, - 114,101,102,90,6,119,105,110,114,101,103,114,167,0,0,0, - 114,7,0,0,0,122,4,46,112,121,119,122,6,95,100,46, - 112,121,100,84,41,4,114,52,0,0,0,114,63,0,0,0, + 7,95,116,104,114,101,97,100,90,8,95,119,101,97,107,114, + 101,102,90,6,119,105,110,114,101,103,114,167,0,0,0,114, + 7,0,0,0,122,4,46,112,121,119,122,6,95,100,46,112, + 121,100,84,78,41,4,114,52,0,0,0,114,63,0,0,0, 114,24,1,0,0,114,140,0,0,0,41,19,114,118,0,0, 0,114,8,0,0,0,114,143,0,0,0,114,235,0,0,0, 114,109,0,0,0,90,18,95,98,117,105,108,116,105,110,95, @@ -2368,64 +2366,64 @@ const unsigned char _Py_M__importlib_external[] = { 101,90,14,119,101,97,107,114,101,102,95,109,111,100,117,108, 101,90,13,119,105,110,114,101,103,95,109,111,100,117,108,101, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 6,95,115,101,116,117,112,91,5,0,0,115,82,0,0,0, + 6,95,115,101,116,117,112,91,5,0,0,115,76,0,0,0, 0,8,4,1,6,1,6,3,10,1,10,1,10,1,12,2, 10,1,16,3,22,1,14,2,22,1,8,1,10,1,10,1, 4,2,2,1,10,1,6,1,14,1,12,2,8,1,12,1, - 12,1,18,3,2,1,14,1,16,2,10,1,12,3,10,1, - 12,3,10,1,10,1,12,3,14,1,14,1,10,1,10,1, - 10,1,114,30,1,0,0,99,1,0,0,0,0,0,0,0, - 2,0,0,0,4,0,0,0,67,0,0,0,115,50,0,0, - 0,116,0,124,0,131,1,1,0,116,1,131,0,125,1,116, - 2,106,3,160,4,116,5,106,6,124,1,142,0,103,1,161, - 1,1,0,116,2,106,7,160,8,116,9,161,1,1,0,100, - 1,83,0,41,2,122,41,73,110,115,116,97,108,108,32,116, - 104,101,32,112,97,116,104,45,98,97,115,101,100,32,105,109, - 112,111,114,116,32,99,111,109,112,111,110,101,110,116,115,46, - 78,41,10,114,30,1,0,0,114,159,0,0,0,114,8,0, - 0,0,114,252,0,0,0,114,147,0,0,0,114,4,1,0, - 0,114,17,1,0,0,218,9,109,101,116,97,95,112,97,116, - 104,114,161,0,0,0,114,247,0,0,0,41,2,114,29,1, - 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, - 97,100,101,114,115,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,218,8,95,105,110,115,116,97,108,108,159,5, - 0,0,115,8,0,0,0,0,2,8,1,6,1,20,1,114, - 32,1,0,0,41,1,114,0,0,0,0,41,2,114,1,0, - 0,0,114,2,0,0,0,41,1,114,49,0,0,0,41,1, - 78,41,3,78,78,78,41,3,78,78,78,41,2,114,62,0, - 0,0,114,62,0,0,0,41,1,78,41,1,78,41,58,114, - 111,0,0,0,114,12,0,0,0,90,37,95,67,65,83,69, - 95,73,78,83,69,78,83,73,84,73,86,69,95,80,76,65, - 84,70,79,82,77,83,95,66,89,84,69,83,95,75,69,89, - 114,11,0,0,0,114,13,0,0,0,114,19,0,0,0,114, - 21,0,0,0,114,30,0,0,0,114,40,0,0,0,114,41, - 0,0,0,114,45,0,0,0,114,46,0,0,0,114,48,0, - 0,0,114,58,0,0,0,218,4,116,121,112,101,218,8,95, - 95,99,111,100,101,95,95,114,142,0,0,0,114,17,0,0, - 0,114,132,0,0,0,114,16,0,0,0,114,20,0,0,0, - 90,17,95,82,65,87,95,77,65,71,73,67,95,78,85,77, - 66,69,82,114,77,0,0,0,114,76,0,0,0,114,88,0, - 0,0,114,78,0,0,0,90,23,68,69,66,85,71,95,66, - 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, - 90,27,79,80,84,73,77,73,90,69,68,95,66,89,84,69, - 67,79,68,69,95,83,85,70,70,73,88,69,83,114,83,0, - 0,0,114,89,0,0,0,114,95,0,0,0,114,99,0,0, - 0,114,101,0,0,0,114,120,0,0,0,114,127,0,0,0, - 114,139,0,0,0,114,145,0,0,0,114,148,0,0,0,114, - 153,0,0,0,218,6,111,98,106,101,99,116,114,160,0,0, - 0,114,165,0,0,0,114,166,0,0,0,114,181,0,0,0, - 114,191,0,0,0,114,206,0,0,0,114,214,0,0,0,114, - 219,0,0,0,114,225,0,0,0,114,220,0,0,0,114,226, - 0,0,0,114,245,0,0,0,114,247,0,0,0,114,4,1, - 0,0,114,22,1,0,0,114,159,0,0,0,114,30,1,0, - 0,114,32,1,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,218,8,60,109,111,100, - 117,108,101,62,24,0,0,0,115,108,0,0,0,4,0,4, - 1,4,1,2,1,6,3,8,17,8,5,8,5,8,6,8, - 12,8,10,8,9,8,5,8,7,10,22,10,124,16,1,12, - 2,4,1,4,2,6,2,6,2,8,2,16,45,8,34,8, - 19,8,12,8,12,8,28,8,17,10,55,10,12,10,10,8, - 14,6,3,4,1,14,67,14,64,14,29,16,110,14,41,18, - 45,18,16,4,3,18,53,14,60,14,42,14,127,0,5,14, - 127,0,22,10,23,8,11,8,68, + 12,1,18,3,10,1,12,3,10,1,12,3,10,1,10,1, + 12,3,14,1,14,1,10,1,10,1,10,1,114,30,1,0, + 0,99,1,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,50,0,0,0,116,0,124,0,131, + 1,1,0,116,1,131,0,125,1,116,2,106,3,160,4,116, + 5,106,6,124,1,142,0,103,1,161,1,1,0,116,2,106, + 7,160,8,116,9,161,1,1,0,100,1,83,0,41,2,122, + 41,73,110,115,116,97,108,108,32,116,104,101,32,112,97,116, + 104,45,98,97,115,101,100,32,105,109,112,111,114,116,32,99, + 111,109,112,111,110,101,110,116,115,46,78,41,10,114,30,1, + 0,0,114,159,0,0,0,114,8,0,0,0,114,252,0,0, + 0,114,147,0,0,0,114,4,1,0,0,114,17,1,0,0, + 218,9,109,101,116,97,95,112,97,116,104,114,161,0,0,0, + 114,247,0,0,0,41,2,114,29,1,0,0,90,17,115,117, + 112,112,111,114,116,101,100,95,108,111,97,100,101,114,115,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,8, + 95,105,110,115,116,97,108,108,155,5,0,0,115,8,0,0, + 0,0,2,8,1,6,1,20,1,114,32,1,0,0,41,1, + 114,0,0,0,0,41,2,114,1,0,0,0,114,2,0,0, + 0,41,1,114,49,0,0,0,41,1,78,41,3,78,78,78, + 41,3,78,78,78,41,2,114,62,0,0,0,114,62,0,0, + 0,41,1,78,41,1,78,41,58,114,111,0,0,0,114,12, + 0,0,0,90,37,95,67,65,83,69,95,73,78,83,69,78, + 83,73,84,73,86,69,95,80,76,65,84,70,79,82,77,83, + 95,66,89,84,69,83,95,75,69,89,114,11,0,0,0,114, + 13,0,0,0,114,19,0,0,0,114,21,0,0,0,114,30, + 0,0,0,114,40,0,0,0,114,41,0,0,0,114,45,0, + 0,0,114,46,0,0,0,114,48,0,0,0,114,58,0,0, + 0,218,4,116,121,112,101,218,8,95,95,99,111,100,101,95, + 95,114,142,0,0,0,114,17,0,0,0,114,132,0,0,0, + 114,16,0,0,0,114,20,0,0,0,90,17,95,82,65,87, + 95,77,65,71,73,67,95,78,85,77,66,69,82,114,77,0, + 0,0,114,76,0,0,0,114,88,0,0,0,114,78,0,0, + 0,90,23,68,69,66,85,71,95,66,89,84,69,67,79,68, + 69,95,83,85,70,70,73,88,69,83,90,27,79,80,84,73, + 77,73,90,69,68,95,66,89,84,69,67,79,68,69,95,83, + 85,70,70,73,88,69,83,114,83,0,0,0,114,89,0,0, + 0,114,95,0,0,0,114,99,0,0,0,114,101,0,0,0, + 114,120,0,0,0,114,127,0,0,0,114,139,0,0,0,114, + 145,0,0,0,114,148,0,0,0,114,153,0,0,0,218,6, + 111,98,106,101,99,116,114,160,0,0,0,114,165,0,0,0, + 114,166,0,0,0,114,181,0,0,0,114,191,0,0,0,114, + 206,0,0,0,114,214,0,0,0,114,219,0,0,0,114,225, + 0,0,0,114,220,0,0,0,114,226,0,0,0,114,245,0, + 0,0,114,247,0,0,0,114,4,1,0,0,114,22,1,0, + 0,114,159,0,0,0,114,30,1,0,0,114,32,1,0,0, + 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,8,60,109,111,100,117,108,101,62,24,0, + 0,0,115,108,0,0,0,4,0,4,1,4,1,2,1,6, + 3,8,17,8,5,8,5,8,6,8,12,8,10,8,9,8, + 5,8,7,10,22,10,124,16,1,12,2,4,1,4,2,6, + 2,6,2,8,2,16,45,8,34,8,19,8,12,8,12,8, + 28,8,17,10,55,10,12,10,10,8,14,6,3,4,1,14, + 67,14,64,14,29,16,110,14,41,18,45,18,16,4,3,18, + 53,14,60,14,42,14,127,0,5,14,127,0,22,10,23,8, + 11,8,64, }; From lp_benchmark_robot at intel.com Mon Sep 18 20:27:00 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 18 Sep 2017 17:27:00 -0700 Subject: [Python-checkins] [2 down, 4 up, 59 flat] Results for Python (master branch) 2017-09-18 Message-ID: <73d02eac-1b02-440c-a6ba-f7b2a2eab2b6@orsmsx109.amr.corp.intel.com> Results for project python/master, build date: 2017-09-18 03:05:14-07:00. - commit: 9b47af6 - previous commit: 5d84cb3 - revision date: 2017-09-17 17:56:16-07:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.166% | -0.362% | +3.370% | +8.400% | +-----+------------------------+--------+------------+------------+------------+ | :-) | call_method| 1.182% | +3.562% | +20.329% | +14.070% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.050% | +2.828% | +21.413% | +12.559% | +-----+------------------------+--------+------------+------------+------------+ | :-) | call_method_unknown| 0.968% | +3.196% | +20.035% | +12.105% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 1.696% | +2.896% | +4.587% | +12.227% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.623% | -1.396% | +10.358% | +9.129% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.680% | -1.608% | +6.409% | +10.810% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.586% | +2.030% | +3.370% | +4.907% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 3.914% | +0.440% | +8.801% | +17.895% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.439% | -1.058% | +8.588% | +14.847% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.218% | -1.019% | +3.384% | +6.036% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.442% | -0.390% | +6.326% | +4.137% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.891% | -1.335% | +1.884% | +7.085% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.151% | -1.450% | +6.745% | +11.987% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 2.199% | -1.037% | +5.792% | +10.537% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.927% | +0.435% | +6.963% | +9.618% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.728% | -0.360% | +8.994% | +11.407% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.938% | -0.455% | +8.107% | +8.980% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.053% | -0.200% | +3.773% | +9.047% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.154% | +2.714% | +2.732% | +10.006% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.717% | -1.166% | +6.275% | +12.018% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 3.503% | -0.868% | +46.445% | +13.524% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.608% | -0.611% | +7.842% | +13.624% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 1.120% | +1.496% | +17.280% | +12.496% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.481% | -1.085% | +7.270% | +10.167% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.728% | +1.528% | +4.403% | +4.872% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.571% | +0.772% | -0.833% | +2.070% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.870% | -0.984% | +1.517% | +7.204% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.506% | -1.999% | +4.016% | +9.655% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.287% | +0.720% | +1.436% | +19.432% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_dict| 0.325% | +1.767% | +1.980% | +18.303% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.912% | +1.141% | +6.269% | +17.103% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.242% | -1.397% | +11.240% | +9.573% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.251% | -0.189% | +0.154% | +9.281% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.129% | -0.729% | +8.925% | +5.008% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.097% | -0.580% | +0.995% | +4.972% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.266% | +0.960% | +9.056% | +12.970% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 5.192% | +0.266% | -8.939% | +11.920% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.529% | +0.136% | +1.828% | +7.765% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 1.200% | +0.357% | +1.196% | -0.650% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.552% | -2.842% | +7.903% | +3.670% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.523% | +0.547% | +7.492% | +15.274% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.570% | +0.685% | +1.500% | +1.014% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 1.529% | +0.247% | +27.157% | +7.705% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 1.569% | +0.821% | +5.374% | +4.085% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.401% | +0.027% | +14.492% | +7.958% | +-----+------------------------+--------+------------+------------+------------+ | :-( | scimark_sparse_mat_mult| 1.830% | -4.398% | +1.822% | -3.711% | +-----+------------------------+--------+------------+------------+------------+ | :-( | spectral_norm| 1.259% | -8.430% | -1.307% | +8.649% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.923% | -0.740% | +4.690% | +9.270% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.807% | -1.369% | +4.075% | +6.042% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.755% | +1.945% | +3.375% | +7.200% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.206% | +0.038% | +11.777% | +9.277% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 2.326% | -1.734% | +8.756% | +8.230% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.391% | +0.239% | +11.806% | +9.487% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.215% | -1.809% | +9.317% | +13.466% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 5.748% | +0.597% | +23.029% | +9.526% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.365% | -0.789% | +5.459% | +6.895% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.471% | +0.653% | +2.617% | -2.721% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 7.862% | +3.706% | +8.704% | +18.539% | +-----+------------------------+--------+------------+------------+------------+ | :-) | unpickle_list| 0.791% | +3.392% | +2.338% | +17.511% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 1.863% | +0.880% | +7.912% | +5.593% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.558% | -0.863% | +5.991% | +8.045% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.002% | -0.766% | +1.751% | +7.122% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.515% | +0.947% | -7.350% | +11.276% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.231% | -0.867% | +6.732% | +8.689% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/2-down-4-up-59-flat-results-for-python-master-branch-2017-09-18 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Mon Sep 18 22:42:48 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 19 Sep 2017 02:42:48 -0000 Subject: [Python-checkins] Update Mac installer Welcome and ReadMe files for 3.7.0a1 Message-ID: https://github.com/python/cpython/commit/380c5fbc6f9b89e013cd7dbb540316a59e4ddb63 commit: 380c5fbc6f9b89e013cd7dbb540316a59e4ddb63 branch: master author: Ned Deily committer: Ned Deily date: 2017-09-18T22:22:58-04:00 summary: Update Mac installer Welcome and ReadMe files for 3.7.0a1 files: M Mac/BuildScript/resources/ReadMe.rtf M Mac/BuildScript/resources/Welcome.rtf diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf index ac68786999d..dba96b6068c 100644 --- a/Mac/BuildScript/resources/ReadMe.rtf +++ b/Mac/BuildScript/resources/ReadMe.rtf @@ -1,4 +1,4 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf750 +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;} {\colortbl;\red255\green255\blue255;} {\*\expandedcolortbl;;} @@ -7,38 +7,25 @@ \f0\fs24 \cf0 This package will install Python $FULL_VERSION for Mac OS X $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): $ARCHITECTURES.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0 -\b \cf0 \ul \ulc0 Which installer variant should I use? -\b0 \ulnone \ -\ +\b \cf0 NOTE: +\b0 This is an early developer preview of the next feature release of Python 3. Many features are yet to be added and existing features may change substantially or be deleted prior to the feature code freeze.\ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 - -\b \cf0 **NEW** -\b0 For Python 3.6, the python.org website now provides only one installer variant for download: one that installs a -\i 64-bit/32-bit Intel -\i0 Python capable of running on -\i Mac OS X 10.6 (Snow Leopard) -\i0 or later. This ReadMe was installed with the -\i $MACOSX_DEPLOYMENT_TARGET -\i0 variant. By default, Python will automatically run in 64-bit mode if your system supports it. The Python installed by this installer is built with private copies of some third-party libraries not included with or newer than those in OS X itself. The list of these libraries is included at the end of the License.rtf file. -\b \ul \ -\ -Certificate verification and OpenSSL\ +\cf0 \ \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\b0 \cf0 \ulnone \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 +\b \cf0 \ul \ulc0 Certificate verification and OpenSSL\ -\b \cf0 **NEW** -\b0 This variant of Python 3.6 now includes its own private copy of OpenSSL 1.0.2. Unlike previous releases, the deprecated Apple-supplied OpenSSL libraries are no longer used. This also means that the trust certificates in system and user keychains managed by the +\b0 \ulnone \ +This variant of Python 3.7 includes its own private copy of OpenSSL 1.0.2. The deprecated Apple-supplied OpenSSL libraries are no longer used. This means that the trust certificates in system and user keychains managed by the \i Keychain Access \i0 application and the \i security \i0 command line utility are no longer used as defaults by the Python \f1 ssl -\f0 module. For 3.6.0, a sample command script is included in -\f1 /Applications/Python 3.6 +\f0 module. For this preview release, a sample command script is included in +\f1 /Applications/Python 3.7 \f0 to install a curated bundle of default root certificates from the third-party \f1 certifi \f0 package ({\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi/certifi"}}{\fldrslt https://pypi.python.org/pypi/certifi}}). If you choose to use @@ -47,18 +34,17 @@ Certificate verification and OpenSSL\ \ The bundled \f1 pip -\f0 included with the Python 3.6 installer has its own default certificate store for verifying download connections.\ +\f0 included with this installer has its own default certificate store for verifying download connections.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 -\b \cf0 \ul Update your version of Tcl/Tk to use IDLE or other Tk applications +\b \ul Update your version of Tcl/Tk to use IDLE or other Tk applications \b0 \ulnone \ \ To use IDLE or other programs that use the Tkinter graphical user interface toolkit, you need to install a newer third-party version of the \i Tcl/Tk \i0 frameworks. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of \i Tcl/Tk -\i0 for this version of Python and of Mac OS X. For the initial release of Python 3.6, the installer is still linked with Tcl/Tk 8.5.\ +\i0 for this version of Python and of Mac OS X. For this developer preview, the installer is still linked with Tcl/Tk 8.5.\ \b \ul \ Other changes\ diff --git a/Mac/BuildScript/resources/Welcome.rtf b/Mac/BuildScript/resources/Welcome.rtf index 3a9ab04454d..528e2513af7 100644 --- a/Mac/BuildScript/resources/Welcome.rtf +++ b/Mac/BuildScript/resources/Welcome.rtf @@ -1,7 +1,7 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1504 +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf830 \cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;\csgray\c100000;} +{\*\expandedcolortbl;;} \paperw11905\paperh16837\margl1440\margr1440\vieww12200\viewh10880\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0 @@ -17,14 +17,12 @@ \b IDLE \b0 .\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0 -\b \cf0 NEW: -\b0 There are important changes in this release regarding network security and trust certificates. Please see the ReadMe for more details.\ +\b NOTE: +\b0 This is an early developer preview of the next feature release of Python 3. Many features are yet to be added and existing features may change substantially or be deleted prior to the feature code freeze.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\partightenfactor0 -\b \cf0 IMPORTANT: +\b IMPORTANT: \b0 \b IDLE \b0 and other programs using the From webhook-mailer at python.org Tue Sep 19 03:02:34 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 19 Sep 2017 07:02:34 -0000 Subject: [Python-checkins] Update pydoc topics and NEWS blurbs for 3.6.3rc1 Message-ID: https://github.com/python/cpython/commit/2f61f6417a4af3618d01ece70b152f677cb1bcbb commit: 2f61f6417a4af3618d01ece70b152f677cb1bcbb branch: 3.6 author: Ned Deily committer: Ned Deily date: 2017-09-18T23:04:41-04:00 summary: Update pydoc topics and NEWS blurbs for 3.6.3rc1 files: A Misc/NEWS.d/3.6.3rc1.rst D Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst D Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst D Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst D Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst D Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst D Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst D Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst D Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst D Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst D Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst D Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst D Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst D Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst D Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst D Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst D Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst D Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst D Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst D Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst D Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst D Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst D Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst D Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst D Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst D Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst D Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst D Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst D Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst D Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst D Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst D Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst D Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst D Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst D Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst D Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst D Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst D Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst D Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst D Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst D Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst D Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst D Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst D Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst D Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst D Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst D Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst D Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst D Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst D Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst D Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst D Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst D Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst D Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst D Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst D Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst D Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst D Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst D Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst D Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst D Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst D Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst D Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst D Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst D Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst D Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst D Misc/NEWS.d/next/Library/2017-07-26-04-46-12.bpo-30595.-zJ7d8.rst D Misc/NEWS.d/next/Library/2017-07-26-15-15-00.bpo-30119.DZ6C_S.rst D Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst D Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst D Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst D Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst D Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst D Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst D Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst D Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst D Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst D Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst D Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst D Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst D Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst D Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst D Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst D Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst D Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst D Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst D Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst D Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst D Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst D Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst D Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst D Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst D Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst D Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst D Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst D Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst D Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst D Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst D Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst D Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst D Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst D Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst D Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst D Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst D Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst M Lib/pydoc_data/topics.py diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 015afb30b45..deb540d526e 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Jun 17 04:32:54 2017 +# Autogenerated by Sphinx on Mon Sep 18 23:00:11 2017 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -8558,7 +8558,7 @@ '\n' 'The potential uses for metaclasses are boundless. Some ideas ' 'that have\n' - 'been explored include logging, interface checking, ' + 'been explored include enum, logging, interface checking, ' 'automatic\n' 'delegation, automatic property creation, proxies, ' 'frameworks, and\n' @@ -10332,27 +10332,22 @@ '*******************\n' '\n' 'Any object can be tested for truth value, for use in an "if" or\n' - '"while" condition or as operand of the Boolean operations below. ' - 'The\n' - 'following values are considered false:\n' - '\n' - '* "None"\n' - '\n' - '* "False"\n' + '"while" condition or as operand of the Boolean operations below.\n' '\n' - '* zero of any numeric type, for example, "0", "0.0", "0j".\n' - '\n' - '* any empty sequence, for example, "\'\'", "()", "[]".\n' + 'By default, an object is considered true unless its class defines\n' + 'either a "__bool__()" method that returns "False" or a "__len__()"\n' + 'method that returns zero, when called with the object. [1] Here ' + 'are\n' + 'most of the built-in objects considered false:\n' '\n' - '* any empty mapping, for example, "{}".\n' + '* constants defined to be false: "None" and "False".\n' '\n' - '* instances of user-defined classes, if the class defines a\n' - ' "__bool__()" or "__len__()" method, when that method returns the\n' - ' integer zero or "bool" value "False". [1]\n' + '* zero of any numeric type: "0", "0.0", "0j", "Decimal(0)",\n' + ' "Fraction(0, 1)"\n' '\n' - 'All other values are considered true --- so objects of many types ' - 'are\n' - 'always true.\n' + '* empty sequences and collections: "\'\'", "()", "[]", "{}", ' + '"set()",\n' + ' "range(0)"\n' '\n' 'Operations and built-in functions that have a Boolean result ' 'always\n' @@ -12401,7 +12396,7 @@ 'operations.\n' ' Lists also provide the following additional method:\n' '\n' - ' sort(*, key=None, reverse=None)\n' + ' sort(*, key=None, reverse=False)\n' '\n' ' This method sorts the list in place, using only "<" ' 'comparisons\n' diff --git a/Misc/NEWS.d/3.6.3rc1.rst b/Misc/NEWS.d/3.6.3rc1.rst new file mode 100644 index 00000000000..b16592bf1a5 --- /dev/null +++ b/Misc/NEWS.d/3.6.3rc1.rst @@ -0,0 +1,1259 @@ +.. bpo: 29781 +.. date: 2017-09-05-15-26-30 +.. nonce: LwYtBP +.. release date: 2017-09-18 +.. section: Security + +SSLObject.version() now correctly returns None when handshake over BIO has +not been performed yet. + +.. + +.. bpo: 30947 +.. date: 2017-08-16-16-35-59 +.. nonce: iNMmm4 +.. section: Security + +Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security +fixes. + +.. + +.. bpo: 31471 +.. date: 2017-09-14-19-47-57 +.. nonce: 0yiA5Q +.. section: Core and Builtins + +Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env +argument has a bad keys() method. Patch by Oren Milman. + +.. + +.. bpo: 31418 +.. date: 2017-09-13-13-03-52 +.. nonce: rS-FlC +.. section: Core and Builtins + +Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an +exception with a bad ``__module__`` attribute. Patch by Oren Milman. + +.. + +.. bpo: 31416 +.. date: 2017-09-11-12-54-35 +.. nonce: 2hlQFd +.. section: Core and Builtins + +Fix assertion failures in case of a bad warnings.filters or +warnings.defaultaction. Patch by Oren Milman. + +.. + +.. bpo: 31411 +.. date: 2017-09-11-08-50-41 +.. nonce: HZz82I +.. section: Core and Builtins + +Raise a TypeError instead of SystemError in case warnings.onceregistry is +not a dictionary. Patch by Oren Milman. + +.. + +.. bpo: 31373 +.. date: 2017-09-06-15-25-59 +.. nonce: dC4jd4 +.. section: Core and Builtins + +Fix several possible instances of undefined behavior due to floating-point +demotions. + +.. + +.. bpo: 30465 +.. date: 2017-09-06-10-47-29 +.. nonce: oe-3GD +.. section: Core and Builtins + +Location information (``lineno`` and ``col_offset``) in f-strings is now +(mostly) correct. This fixes tools like flake8 from showing warnings on the +wrong line (typically the first line of the file). + +.. + +.. bpo: 31343 +.. date: 2017-09-04-14-57-27 +.. nonce: Kl_fS5 +.. section: Core and Builtins + +Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray +plans to remove the functions from sys/types.h. + +.. + +.. bpo: 31291 +.. date: 2017-08-28-11-51-29 +.. nonce: t8QggK +.. section: Core and Builtins + +Fix an assertion failure in `zipimport.zipimporter.get_data` on Windows, +when the return value of ``pathname.replace('/','\\')`` isn't a string. +Patch by Oren Milman. + +.. + +.. bpo: 31271 +.. date: 2017-08-25-20-43-22 +.. nonce: YMduKF +.. section: Core and Builtins + +Fix an assertion failure in the write() method of `io.TextIOWrapper`, when +the encoder doesn't return a bytes object. Patch by Oren Milman. + +.. + +.. bpo: 31243 +.. date: 2017-08-24-13-34-49 +.. nonce: dRJzqR +.. section: Core and Builtins + +Fix a crash in some methods of `io.TextIOWrapper`, when the decoder's state +is invalid. Patch by Oren Milman. + +.. + +.. bpo: 30721 +.. date: 2017-08-18-15-15-20 +.. nonce: Hmc56z +.. section: Core and Builtins + +``print`` now shows correct usage hint for using Python 2 redirection +syntax. Patch by Sanyam Khurana. + +.. + +.. bpo: 31070 +.. date: 2017-08-09-09-40-54 +.. nonce: oDyLiI +.. section: Core and Builtins + +Fix a race condition in importlib _get_module_lock(). + +.. + +.. bpo: 31095 +.. date: 2017-08-01-18-48-30 +.. nonce: bXWZDb +.. section: Core and Builtins + +Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call +``PyObject_GC_UnTrack()``. + +.. + +.. bpo: 31071 +.. date: 2017-07-31-13-28-53 +.. nonce: P9UBDy +.. section: Core and Builtins + +Avoid masking original TypeError in call with * unpacking when other +arguments are passed. + +.. + +.. bpo: 30978 +.. date: 2017-07-21-07-39-05 +.. nonce: f0jODc +.. section: Core and Builtins + +str.format_map() now passes key lookup exceptions through. Previously any +exception was replaced with a KeyError exception. + +.. + +.. bpo: 30808 +.. date: 2017-07-17-12-12-59 +.. nonce: bA3zOv +.. section: Core and Builtins + +Use _Py_atomic API for concurrency-sensitive signal state. + +.. + +.. bpo: 30876 +.. date: 2017-07-11-06-31-32 +.. nonce: x35jZX +.. section: Core and Builtins + +Relative import from unloaded package now reimports the package instead of +failing with SystemError. Relative import from non-package now fails with +ImportError rather than SystemError. + +.. + +.. bpo: 30703 +.. date: 2017-06-28-21-07-32 +.. nonce: ULCdFp +.. section: Core and Builtins + +Improve signal delivery. + +Avoid using Py_AddPendingCall from signal handler, to avoid calling signal- +unsafe functions. The tests I'm adding here fail without the rest of the +patch, on Linux and OS X. This means our signal delivery logic had defects +(some signals could be lost). + +.. + +.. bpo: 30765 +.. date: 2017-06-26-14-29-50 +.. nonce: Q5iBmf +.. section: Core and Builtins + +Avoid blocking in pthread_mutex_lock() when PyThread_acquire_lock() is asked +not to block. + +.. + +.. bpo: 31161 +.. date: 06 +.. nonce: FcUAA0 +.. section: Core and Builtins + +Make sure the 'Missing parentheses' syntax error message is only applied to +SyntaxError, not to subclasses. Patch by Martijn Pieters. + +.. + +.. bpo: 30814 +.. date: 05 +.. nonce: HcYsfM +.. section: Core and Builtins + +Fixed a race condition when import a submodule from a package. + +.. + +.. bpo: 30597 +.. date: 04 +.. nonce: 7erHiP +.. section: Core and Builtins + +``print`` now shows expected input in custom error message when used as a +Python 2 statement. Patch by Sanyam Khurana. + +.. + +.. bpo: 31499 +.. date: 2017-09-18-10-57-04 +.. nonce: BydYhf +.. section: Library + +xml.etree: Fix a crash when a parser is part of a reference cycle. + +.. + +.. bpo: 28556 +.. date: 2017-09-14-11-02-56 +.. nonce: EUOiYs +.. section: Library + +typing.get_type_hints now finds the right globalns for classes and modules +by default (when no ``globalns`` was specified by the caller). + +.. + +.. bpo: 28556 +.. date: 2017-09-13-23-27-39 +.. nonce: UmTQvv +.. section: Library + +Speed improvements to the ``typing`` module. Original PRs by Ivan +Levkivskyi and Mitar. + +.. + +.. bpo: 31544 +.. date: 2017-09-13-19-55-35 +.. nonce: beTh6t +.. section: Library + +The C accelerator module of ElementTree ignored exceptions raised when +looking up TreeBuilder target methods in XMLParser(). + +.. + +.. bpo: 31234 +.. date: 2017-09-13-18-05-56 +.. nonce: lGkcPg +.. section: Library + +socket.create_connection() now fixes manually a reference cycle: clear the +variable storing the last exception on success. + +.. + +.. bpo: 31457 +.. date: 2017-09-13-13-33-39 +.. nonce: bIVBtI +.. section: Library + +LoggerAdapter objects can now be nested. + +.. + +.. bpo: 31400 +.. date: 2017-09-08-14-19-57 +.. nonce: YOTPKi +.. section: Library + +Improves SSL error handling to avoid losing error numbers. + +.. + +.. bpo: 28958 +.. date: 2017-09-06-19-41-01 +.. nonce: x4-K5F +.. section: Library + +ssl.SSLContext() now uses OpenSSL error information when a context cannot be +instantiated. + +.. + +.. bpo: 27340 +.. date: 2017-09-06-06-50-41 +.. nonce: GgekV5 +.. section: Library + +SSLSocket.sendall() now uses memoryview to create slices of data. This fixes +support for all bytes-like object. It is also more efficient and avoids +costly copies. + +.. + +.. bpo: 31178 +.. date: 2017-09-05-14-55-28 +.. nonce: JrSFo7 +.. section: Library + +Fix string concatenation bug in rare error path in the subprocess module + +.. + +.. bpo: 31350 +.. date: 2017-09-05-10-30-48 +.. nonce: dXJ-7N +.. section: Library + +Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. + +.. + +.. bpo: 31170 +.. date: 2017-09-04-23-41-35 +.. nonce: QGmJ1t +.. section: Library + +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 + +.. + +.. bpo: 29136 +.. date: 2017-09-04-16-39-49 +.. nonce: vSn1oR +.. section: Library + +Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. + +.. + +.. bpo: 29212 +.. date: 2017-09-03-14-31-00 +.. nonce: bicycl +.. section: Library + +Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non +repr() based thread name by default when no thread_name_prefix is supplied. +They will now identify themselves as "ThreadPoolExecutor-y_n". + +.. + +.. bpo: 9146 +.. date: 2017-09-03-14-10-00 +.. nonce: _-oo-_ +.. section: Library + +Fix a segmentation fault in _hashopenssl when standard hash functions such +as md5 are not available in the linked OpenSSL library. As in some special +FIPS-140 build environments. + +.. + +.. bpo: 27144 +.. date: 2017-08-30-11-26-14 +.. nonce: PEDJsE +.. section: Library + +The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` now +avoid keeping a reference to yielded objects. + +.. + +.. bpo: 10746 +.. date: 2017-08-28-13-01-05 +.. nonce: nmAvfu +.. section: Library + +Fix ctypes producing wrong PEP 3118 type codes for integer types. + +.. + +.. bpo: 22536 +.. date: 2017-08-23 +.. nonce: _narf_ +.. section: Library + +The subprocess module now sets the filename when FileNotFoundError is raised +on POSIX systems due to the executable or cwd not being found. + +.. + +.. bpo: 31249 +.. date: 2017-08-22-12-44-48 +.. nonce: STPbb9 +.. section: Library + +concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now breaks a +reference cycle between an exception object and the WorkItem object. + +.. + +.. bpo: 31247 +.. date: 2017-08-21-17-50-27 +.. nonce: 8S3zJp +.. section: Library + +xmlrpc.server now explicitly breaks reference cycles when using +sys.exc_info() in code handling exceptions. + +.. + +.. bpo: 30102 +.. date: 2017-08-16-21-14-31 +.. nonce: 1sPqmc +.. section: Library + +The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on +OpenSSL < 1.1.0. The function detects CPU features and enables optimizations +on some CPU architectures such as POWER8. Patch is based on research from +Gustavo Serra Scalet. + +.. + +.. bpo: 31185 +.. date: 2017-08-11-19-30-00 +.. nonce: i6TPgL +.. section: Library + +Fixed miscellaneous errors in asyncio speedup module. + +.. + +.. bpo: 31135 +.. date: 2017-08-08-14-44-37 +.. nonce: HH94xR +.. section: Library + +ttk: fix the destroy() method of LabeledScale and OptionMenu classes. Call +the parent destroy() method even if the used attribute doesn't exist. The +LabeledScale.destroy() method now also explicitly clears label and scale +attributes to help the garbage collector to destroy all widgets. + +.. + +.. bpo: 31107 +.. date: 2017-08-02-12-48-15 +.. nonce: 1t2hn5 +.. section: Library + +Fix `copyreg._slotnames()` mangled attribute calculation for classes whose +name begins with an underscore. Patch by Shane Harvey. + +.. + +.. bpo: 31061 +.. date: 2017-08-01-09-32-58 +.. nonce: husAYX +.. section: Library + +Fixed a crash when using asyncio and threads. + +.. + +.. bpo: 30502 +.. date: 2017-07-27-11-33-58 +.. nonce: GJlfU8 +.. section: Library + +Fix handling of long oids in ssl. Based on patch by Christian Heimes. + +.. + +.. bpo: 30119 +.. date: 2017-07-26-15-15-00 +.. nonce: DZ6C_S +.. section: Library + +ftplib.FTP.putline() now throws ValueError on commands that contains CR or +LF. Patch by Dong-hee Na. + +.. + +.. bpo: 30595 +.. date: 2017-07-26-04-46-12 +.. nonce: -zJ7d8 +.. section: Library + +multiprocessing.Queue.get() with a timeout now polls its reader in non- +blocking mode if it succeeded to aquire the lock but the acquire took longer +than the timeout. + +.. + +.. bpo: 29403 +.. date: 2017-07-20-02-29-49 +.. nonce: 3RinCV +.. section: Library + +Fix ``unittest.mock``'s autospec to not fail on method-bound builtin +functions. Patch by Aaron Gallagher. + +.. + +.. bpo: 30961 +.. date: 2017-07-18-23-47-51 +.. nonce: 064jz0 +.. section: Library + +Fix decrementing a borrowed reference in tracemalloc. + +.. + +.. bpo: 25684 +.. date: 2017-07-17-11-35-00 +.. nonce: usELVx +.. section: Library + +Change ``ttk.OptionMenu`` radiobuttons to be unique across instances of +``OptionMenu``. + +.. + +.. bpo: 30886 +.. date: 2017-07-10-12-14-22 +.. nonce: nqQj34 +.. section: Library + +Fix multiprocessing.Queue.join_thread(): it now waits until the thread +completes, even if the thread was started by the same process which created +the queue. + +.. + +.. bpo: 29854 +.. date: 2017-07-07-02-18-57 +.. nonce: J8wKb_ +.. section: Library + +Fix segfault in readline when using readline's history-size option. Patch +by Nir Soffer. + +.. + +.. bpo: 30319 +.. date: 2017-07-04-13-48-21 +.. nonce: hg_3TX +.. section: Library + +socket.close() now ignores ECONNRESET error. + +.. + +.. bpo: 30828 +.. date: 2017-07-04-13-10-52 +.. nonce: CLvEvV +.. section: Library + +Fix out of bounds write in `asyncio.CFuture.remove_done_callback()`. + +.. + +.. bpo: 30807 +.. date: 2017-06-29-22-04-44 +.. nonce: sLtjY- +.. section: Library + +signal.setitimer() may disable the timer when passed a tiny value. + +Tiny values (such as 1e-6) are valid non-zero values for setitimer(), which +is specified as taking microsecond-resolution intervals. However, on some +platform, our conversion routine could convert 1e-6 into a zero interval, +therefore disabling the timer instead of (re-)scheduling it. + +.. + +.. bpo: 30441 +.. date: 2017-06-29-14-25-14 +.. nonce: 3Wh9kc +.. section: Library + +Fix bug when modifying os.environ while iterating over it + +.. + +.. bpo: 30532 +.. date: 2017-06-26-11-01-59 +.. nonce: qTeL1o +.. section: Library + +Fix email header value parser dropping folding white space in certain cases. + +.. + +.. bpo: 30879 +.. date: 03 +.. nonce: N3KI-o +.. section: Library + +os.listdir() and os.scandir() now emit bytes names when called with bytes- +like argument. + +.. + +.. bpo: 30746 +.. date: 02 +.. nonce: 7drQI0 +.. section: Library + +Prohibited the '=' character in environment variable names in +``os.putenv()`` and ``os.spawn*()``. + +.. + +.. bpo: 29755 +.. date: 01 +.. nonce: diQcY_ +.. section: Library + +Fixed the lgettext() family of functions in the gettext module. They now +always return bytes. + +.. + +.. bpo: 31294 +.. date: 2017-09-07-20-49-09 +.. nonce: WgI18w +.. section: Documentation + +Fix incomplete code snippet in the ZeroMQSocketListener and +ZeroMQSocketHandler examples and adapt them to Python 3. + +.. + +.. bpo: 21649 +.. date: 2017-09-06-10-11-57 +.. nonce: EUvqA9 +.. section: Documentation + +Add RFC 7525 and Mozilla server side TLS links to SSL documentation. + +.. + +.. bpo: 30803 +.. date: 2017-07-29-14-55-50 +.. nonce: 6hutqQ +.. section: Documentation + +Clarify doc on truth value testing. Original patch by Peter Thomassen. + +.. + +.. bpo: 31320 +.. date: 2017-09-05-14-23-35 +.. nonce: JRDHx7 +.. section: Tests + +Silence traceback in test_ssl + +.. + +.. bpo: 25674 +.. date: 2017-09-04-13-03-55 +.. nonce: whVTXh +.. section: Tests + +Remove sha256.tbs-internet.com ssl test + +.. + +.. bpo: 30715 +.. date: 2017-07-25-15-27-44 +.. nonce: Sp7bTF +.. section: Tests + +Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves +like OpenSSL 1.0.2 and no longer aborts handshake. + +.. + +.. bpo: 30822 +.. date: 2017-07-20-14-29-54 +.. nonce: X0wREo +.. section: Tests + +regrtest: Exclude tzdata from regrtest --all. When running the test suite +using --use=all / -u all, exclude tzdata since it makes test_datetime too +slow (15-20 min on some buildbots) which then times out on some buildbots. +Fix also regrtest command line parser to allow passing -u extralargefile to +run test_zipfile64. + +.. + +.. bpo: 30854 +.. date: 2017-07-05-16-54-59 +.. nonce: sPADRI +.. section: Build + +Fix compile error when compiling --without-threads. Patch by Masayuki +Yamamoto. + +.. + +.. bpo: 30389 +.. date: 2017-09-06-17-14-54 +.. nonce: 9Dizrx +.. section: Windows + +Adds detection of Visual Studio 2017 to distutils on Windows. + +.. + +.. bpo: 31340 +.. date: 2017-09-04-13-19-05 +.. nonce: MbkzLi +.. section: Windows + +Change to building with MSVC v141 (included with Visual Studio 2017) + +.. + +.. bpo: 30581 +.. date: 2017-08-04-10-05-19 +.. nonce: OQhR7l +.. section: Windows + +os.cpu_count() now returns the correct number of processors on Windows when +the number of logical processors is greater than 64. + +.. + +.. bpo: 30731 +.. date: 2017-07-13-11-22-53 +.. nonce: nmMDwI +.. section: Windows + +Add a missing xmlns to python.manifest so that it matches the schema. + +.. + +.. bpo: 31493 +.. date: 2017-09-16-23-43-39 +.. nonce: nmHMCR +.. section: IDLE + +IDLE code context -- fix code update and font update timers. + +Canceling timers prevents a warning message when test_idle completes. + +.. + +.. bpo: 31488 +.. date: 2017-09-16-01-21-20 +.. nonce: 0rtXIT +.. section: IDLE + +IDLE - Update non-key options in former extension classes. When applying +configdialog changes, call .reload for each feature class. Change ParenMatch +so updated options affect existing instances attached to existing editor +windows. + +.. + +.. bpo: 31477 +.. date: 2017-09-15-12-38-47 +.. nonce: n__6sa +.. section: IDLE + +IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more +than blank spaces. Multiline string literals are not skipped. + +.. + +.. bpo: 31480 +.. date: 2017-09-14-17-53-53 +.. nonce: 4WJ0pl +.. section: IDLE + +IDLE - make tests pass with zzdummy extension disabled by default. + +.. + +.. bpo: 31421 +.. date: 2017-09-12-08-38-27 +.. nonce: mYfQNq +.. section: IDLE + +Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the +background in order to make live + +interaction and experimentatin with tkinter applications much easier. + +.. + +.. bpo: 31414 +.. date: 2017-09-11-15-46-05 +.. nonce: wiepgK +.. section: IDLE + +IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is +not the same as deleting and inserting because int('') will fail. + +.. + +.. bpo: 31051 +.. date: 2017-08-30-00-06-58 +.. nonce: 50Jp_Q +.. section: IDLE + +Rearrange IDLE condigdialog GenPage into Window, Editor, and Help sections. + +.. + +.. bpo: 30617 +.. date: 2017-08-27-16-49-36 +.. nonce: UHnswr +.. section: IDLE + +IDLE - Add docstrings and tests for outwin subclass of editor. + +Move some data and functions from the class to module level. Patch by Cheryl +Sabella. + +.. + +.. bpo: 31287 +.. date: 2017-08-27-15-31-33 +.. nonce: aZERfI +.. section: IDLE + +IDLE - Do not modify tkinter.message in test_configdialog. + +.. + +.. bpo: 27099 +.. date: 2017-08-24-13-48-16 +.. nonce: rENefC +.. section: IDLE + +Convert IDLE's built-in 'extensions' to regular features. + +About 10 IDLE features were implemented as supposedly optional extensions. +Their different behavior could be confusing or worse for users and not good +for maintenance. Hence the conversion. + +The main difference for users is that user configurable key bindings for +builtin features are now handled uniformly. Now, editing a binding in a +keyset only affects its value in the keyset. All bindings are defined +together in the system-specific default keysets in config- extensions.def. +All custom keysets are saved as a whole in config- extension.cfg. All take +effect as soon as one clicks Apply or Ok. + +The affected events are '<>', '<>', +'<>', '<>', '<>', '<>', '<>', and '<>'. Any (global) +customizations made before 3.6.3 will not affect their keyset- specific +customization after 3.6.3. and vice versa. + +Inital patch by Charles Wohlganger. + +.. + +.. bpo: 31206 +.. date: 2017-08-18-14-13-42 +.. nonce: F1-tKK +.. section: IDLE + +IDLE: Factor HighPage(Frame) class from ConfigDialog. Patch by Cheryl +Sabella. + +.. + +.. bpo: 31001 +.. date: 2017-08-17-15-00-20 +.. nonce: KLxYHC +.. section: IDLE + +Add tests for configdialog highlight tab. Patch by Cheryl Sabella. + +.. + +.. bpo: 31205 +.. date: 2017-08-15-12-58-23 +.. nonce: iuziZ5 +.. section: IDLE + +IDLE: Factor KeysPage(Frame) class from ConfigDialog. The slightly modified +tests continue to pass. Patch by Cheryl Sabella. + +.. + +.. bpo: 31130 +.. date: 2017-08-07-14-02-56 +.. nonce: FbsC7f +.. section: IDLE + +IDLE -- stop leaks in test_configdialog. Initial patch by Victor Stinner. + +.. + +.. bpo: 31002 +.. date: 2017-08-03-17-54-02 +.. nonce: kUSgTE +.. section: IDLE + +Add tests for configdialog keys tab. Patch by Cheryl Sabella. + +.. + +.. bpo: 19903 +.. date: 2017-08-03-14-08-42 +.. nonce: sqE1FS +.. section: IDLE + +IDLE: Calltips use `inspect.signature` instead of `inspect.getfullargspec`. +This improves calltips for builtins converted to use Argument Clinic. Patch +by Louie Lu. + +.. + +.. bpo: 31083 +.. date: 2017-07-31-23-20-51 +.. nonce: 991FXm +.. section: IDLE + +IDLE - Add an outline of a TabPage class in configdialog. Update existing +classes to match outline. Initial patch by Cheryl Sabella. + +.. + +.. bpo: 31050 +.. date: 2017-07-30-17-39-59 +.. nonce: AXR3kP +.. section: IDLE + +Factor GenPage(Frame) class from ConfigDialog. The slightly modified tests +continue to pass. Patch by Cheryl Sabella. + +.. + +.. bpo: 31004 +.. date: 2017-07-30-01-00-58 +.. nonce: m8cc1t +.. section: IDLE + +IDLE - Factor FontPage(Frame) class from ConfigDialog. + +Slightly modified tests continue to pass. Fix General tests. Patch mostly by +Cheryl Sabella. + +.. + +.. bpo: 30781 +.. date: 2017-07-28-18-59-06 +.. nonce: ud5m18 +.. section: IDLE + +IDLE - Use ttk widgets in ConfigDialog. Patches by Terry Jan Reedy and +Cheryl Sabella. + +.. + +.. bpo: 31060 +.. date: 2017-07-27-14-48-42 +.. nonce: GdY_VY +.. section: IDLE + +IDLE - Finish rearranging methods of ConfigDialog Grouping methods +pertaining to each tab and the buttons will aid writing tests and improving +the tabs and will enable splitting the groups into classes. + +.. + +.. bpo: 30853 +.. date: 2017-07-27-10-01-14 +.. nonce: enPvvc +.. section: IDLE + +IDLE -- Factor a VarTrace class out of ConfigDialog. + +Instance tracers manages pairs consisting of a tk variable and a callback +function. When tracing is turned on, setting the variable calls the +function. Test coverage for the new class is 100%. + +.. + +.. bpo: 31003 +.. date: 2017-07-25-01-28-35 +.. nonce: bYINVH +.. section: IDLE + +IDLE: Add more tests for General tab. + +.. + +.. bpo: 30993 +.. date: 2017-07-22-18-08-41 +.. nonce: 34vJkB +.. section: IDLE + +IDLE - Improve configdialog font page and tests. + +In configdialog: Document causal pathways in create_font_tab docstring. +Simplify some attribute names. Move set_samples calls to var_changed_font +(idea from Cheryl Sabella). Move related functions to positions after the +create widgets function. + +In test_configdialog: Fix test_font_set so not order dependent. Fix renamed +test_indent_scale so it tests the widget. Adjust tests for movement of +set_samples call. Add tests for load functions. Put all font tests in one +class and tab indent tests in another. Except for two lines, these tests +completely cover the related functions. + +.. + +.. bpo: 30981 +.. date: 2017-07-21-01-55-14 +.. nonce: ZFvQPt +.. section: IDLE + +IDLE -- Add more configdialog font page tests. + +.. + +.. bpo: 28523 +.. date: 2017-07-21-00-54-52 +.. nonce: OPcqYJ +.. section: IDLE + +IDLE: replace 'colour' with 'color' in configdialog. + +.. + +.. bpo: 30917 +.. date: 2017-07-17-23-35-57 +.. nonce: hSiuuO +.. section: IDLE + +Add tests for idlelib.config.IdleConf. Increase coverage from 46% to 96%. +Patch by Louie Lu. + +.. + +.. bpo: 30934 +.. date: 2017-07-15-22-26-57 +.. nonce: BanuSB +.. section: IDLE + +Document coverage details for idlelib tests. + +* Add section to idlelib/idle-test/README.txt. + +* Include check that branches are taken both ways. + +* Exclude IDLE-specific code that does not run during unit tests. + +.. + +.. bpo: 30913 +.. date: 2017-07-13-23-07-33 +.. nonce: aezn_e +.. section: IDLE + +IDLE: Document ConfigDialog tk Vars, methods, and widgets in docstrings This +will facilitate improving the dialog and splitting up the class. Original +patch by Cheryl Sabella. + +.. + +.. bpo: 30899 +.. date: 2017-07-11-02-26-17 +.. nonce: SQmVO8 +.. section: IDLE + +IDLE: Add tests for ConfigParser subclasses in config. Patch by Louie Lu. + +.. + +.. bpo: 30881 +.. date: 2017-07-11-02-21-42 +.. nonce: 4KAq_9 +.. section: IDLE + +IDLE: Add docstrings to browser.py. Patch by Cheryl Sabella. + +.. + +.. bpo: 30851 +.. date: 2017-07-09-23-53-00 +.. nonce: AHXBYa +.. section: IDLE + +IDLE: Remove unused variables in configdialog. One is a duplicate, one is +set but cannot be altered by users. Patch by Cheryl Sabella. + +.. + +.. bpo: 30870 +.. date: 2017-07-08-17-57-04 +.. nonce: IcR2pf +.. section: IDLE + +IDLE: In Settings dialog, select font with Up, Down keys as well as mouse. +Initial patch by Louie Lu. + +.. + +.. bpo: 8231 +.. date: 2017-07-07-21-10-55 +.. nonce: yEge3L +.. section: IDLE + +IDLE: call config.IdleConf.GetUserCfgDir only once. + +.. + +.. bpo: 30779 +.. date: 2017-07-07-20-26-37 +.. nonce: 8KXEXN +.. section: IDLE + +IDLE: Factor ConfigChanges class from configdialog, put in config; test. * +In config, put dump test code in a function; run it and unittest in 'if +__name__ == '__main__'. * Add class config.ConfigChanges based on +changes_class_v4.py on bpo issue. * Add class test_config.ChangesTest, +partly using configdialog_tests_v1.py. * Revise configdialog to use +ConfigChanges; see tracker msg297804. * Revise test_configdialog to match +configdialog changes. * Remove configdialog functions unused or moved to +ConfigChanges. Cheryl Sabella contributed parts of the patch. + +.. + +.. bpo: 30777 +.. date: 2017-07-04-22-45-46 +.. nonce: uxzlMB +.. section: IDLE + +IDLE: configdialog - Add docstrings and fix comments. Patch by Cheryl +Sabella. + +.. + +.. bpo: 30495 +.. date: 2017-06-29-18-23-06 +.. nonce: qIWgc4 +.. section: IDLE + +IDLE: Improve textview with docstrings, PEP8 names, and more tests. Patch by +Cheryl Sabella. + +.. + +.. bpo: 30723 +.. date: 2017-06-27-19-05-40 +.. nonce: rQh06y +.. section: IDLE + +IDLE: Make several improvements to parenmatch. Add 'parens' style to +highlight both opener and closer. Make 'default' style, which is not +default, a synonym for 'opener'. Make time-delay work the same with all +styles. Add help for config dialog extensions tab, including help for +parenmatch. Add new tests. Original patch by Charles Wohlganger. + +.. + +.. bpo: 30674 +.. date: 2017-06-27-01-40-34 +.. nonce: ppK_q8 +.. section: IDLE + +IDLE: add docstrings to grep module. Patch by Cheryl Sabella + +.. + +.. bpo: 21519 +.. date: 2017-06-27-00-29-56 +.. nonce: fTj9T0 +.. section: IDLE + +IDLE's basic custom key entry dialog now detects duplicates properly. +Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 29910 +.. date: 2017-06-26-22-45-27 +.. nonce: mqHh7u +.. section: IDLE + +IDLE no longer deletes a character after commenting out a region by a key +shortcut. Add ``return 'break'`` for this and other potential conflicts +between IDLE and default key bindings. + +.. + +.. bpo: 30728 +.. date: 2017-06-26-15-47-13 +.. nonce: qH4TGL +.. section: IDLE + +Review and change idlelib.configdialog names. Lowercase method and attribute +names. Replace 'colour' with 'color', expand overly cryptic names, delete +unneeded underscores. Replace ``import *`` with specific imports. Patches by +Cheryl Sabella. + +.. + +.. bpo: 6739 +.. date: 2017-06-26-00-28-59 +.. nonce: x5MfhB +.. section: IDLE + +IDLE: Verify user-entered key sequences by trying to bind them with tk. Add +tests for all 3 validation functions. Original patch by G Polo. Tests added +by Cheryl Sabella. + +.. + +.. bpo: 30983 +.. date: 2017-08-18-17-19-23 +.. nonce: ggGz9z +.. section: Tools/Demos + +gdb integration commands (py-bt, etc.) work on optimized shared builds now, +too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines +PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to +use py-bt, py-up, and a few other Python-specific gdb integrations. The +problem is fixed by only looking for _PyEval_EvalFrameDefault frames in +python-gdb.py. Original patch by Bruno "Polaco" Penteado. diff --git a/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst b/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst deleted file mode 100644 index f75aea420ad..00000000000 --- a/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix compile error when compiling --without-threads. -Patch by Masayuki Yamamoto. diff --git a/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst b/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst deleted file mode 100644 index 0114fee02a4..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/04.bpo-30597.7erHiP.rst +++ /dev/null @@ -1,2 +0,0 @@ -``print`` now shows expected input in custom error message when used as a -Python 2 statement. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst b/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst deleted file mode 100644 index 8d63a46cbde..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/05.bpo-30814.HcYsfM.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a race condition when import a submodule from a package. diff --git a/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst b/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst deleted file mode 100644 index 3ecd404373b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/06.bpo-31161.FcUAA0.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make sure the 'Missing parentheses' syntax error message is only applied to -SyntaxError, not to subclasses. Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst b/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst deleted file mode 100644 index 08d76cb965e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid blocking in pthread_mutex_lock() when PyThread_acquire_lock() is asked -not to block. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst b/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst deleted file mode 100644 index 9adeb450aee..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst +++ /dev/null @@ -1,6 +0,0 @@ -Improve signal delivery. - -Avoid using Py_AddPendingCall from signal handler, to avoid calling signal- -unsafe functions. The tests I'm adding here fail without the rest of the -patch, on Linux and OS X. This means our signal delivery logic had defects -(some signals could be lost). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst deleted file mode 100644 index 4f3f4d29190..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst +++ /dev/null @@ -1,3 +0,0 @@ -Relative import from unloaded package now reimports the package instead of -failing with SystemError. Relative import from non-package now fails with -ImportError rather than SystemError. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst deleted file mode 100644 index 8adbbe7dc3a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst +++ /dev/null @@ -1 +0,0 @@ -Use _Py_atomic API for concurrency-sensitive signal state. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst deleted file mode 100644 index bb67a9fb244..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst +++ /dev/null @@ -1,2 +0,0 @@ -str.format_map() now passes key lookup exceptions through. -Previously any exception was replaced with a KeyError exception. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst deleted file mode 100644 index c34d4751bfa..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid masking original TypeError in call with * unpacking when other -arguments are passed. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst deleted file mode 100644 index ca1f8bafba6..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call -``PyObject_GC_UnTrack()``. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst deleted file mode 100644 index 8f9d7b534b5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a race condition in importlib _get_module_lock(). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst deleted file mode 100644 index da553d654ec..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst +++ /dev/null @@ -1,2 +0,0 @@ -``print`` now shows correct usage hint for using Python 2 redirection -syntax. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst deleted file mode 100644 index 166458f2b78..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a crash in some methods of `io.TextIOWrapper`, when the decoder's state -is invalid. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst deleted file mode 100644 index 7bb78801057..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in the write() method of `io.TextIOWrapper`, when -the encoder doesn't return a bytes object. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst deleted file mode 100644 index 0576785c7df..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix an assertion failure in `zipimport.zipimporter.get_data` on Windows, -when the return value of ``pathname.replace('/','\\')`` isn't a string. -Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst deleted file mode 100644 index 7def54336fd..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray -plans to remove the functions from sys/types.h. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst deleted file mode 100644 index 0d9138ed82d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst +++ /dev/null @@ -1,3 +0,0 @@ -Location information (``lineno`` and ``col_offset``) in f-strings is now -(mostly) correct. This fixes tools like flake8 from showing warnings on the -wrong line (typically the first line of the file). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst deleted file mode 100644 index 3ffb4093470..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix several possible instances of undefined behavior due to floating-point -demotions. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst deleted file mode 100644 index ad1b4b8870a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst +++ /dev/null @@ -1,2 +0,0 @@ -Raise a TypeError instead of SystemError in case warnings.onceregistry is -not a dictionary. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst deleted file mode 100644 index 148a5c8eda5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix assertion failures in case of a bad warnings.filters or -warnings.defaultaction. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst deleted file mode 100644 index 6d6cbd81142..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an -exception with a bad ``__module__`` attribute. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst deleted file mode 100644 index 73c444444fc..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env -argument has a bad keys() method. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst b/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst deleted file mode 100644 index 4699713ee6e..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst +++ /dev/null @@ -1 +0,0 @@ -Clarify doc on truth value testing. Original patch by Peter Thomassen. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst deleted file mode 100644 index a09985aa3d8..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst +++ /dev/null @@ -1 +0,0 @@ -Add RFC 7525 and Mozilla server side TLS links to SSL documentation. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst deleted file mode 100644 index 2c8f8507697..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix incomplete code snippet in the ZeroMQSocketListener and -ZeroMQSocketHandler examples and adapt them to Python 3. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst deleted file mode 100644 index fee904d9e78..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Verify user-entered key sequences by trying to bind them with tk. Add -tests for all 3 validation functions. Original patch by G Polo. Tests added -by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst deleted file mode 100644 index 014eff369de..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst +++ /dev/null @@ -1,4 +0,0 @@ -Review and change idlelib.configdialog names. -Lowercase method and attribute names. -Replace 'colour' with 'color', expand overly cryptic names, delete unneeded underscores. -Replace ``import *`` with specific imports. Patches by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst deleted file mode 100644 index 5157f8bb923..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE no longer deletes a character after commenting out a region by a key -shortcut. Add ``return 'break'`` for this and other potential conflicts -between IDLE and default key bindings. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst deleted file mode 100644 index b224f6b892b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE's basic custom key entry dialog now detects duplicates properly. -Original patch by Saimadhav Heblikar. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst deleted file mode 100644 index 4b718fef017..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: add docstrings to grep module. Patch by Cheryl Sabella diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst deleted file mode 100644 index ceb42a2bbca..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE: Make several improvements to parenmatch. Add 'parens' style to -highlight both opener and closer. Make 'default' style, which is not -default, a synonym for 'opener'. Make time-delay work the same with all -styles. Add help for config dialog extensions tab, including help for -parenmatch. Add new tests. Original patch by Charles Wohlganger. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst b/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst deleted file mode 100644 index 5e046e0069e..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Improve textview with docstrings, PEP8 names, and more tests. Patch by -Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst b/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst deleted file mode 100644 index b7118bf2c25..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: configdialog - Add docstrings and fix comments. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst b/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst deleted file mode 100644 index 1d0dc181304..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst +++ /dev/null @@ -1,8 +0,0 @@ -IDLE: Factor ConfigChanges class from configdialog, put in config; test. * -In config, put dump test code in a function; run it and unittest in 'if -__name__ == '__main__'. * Add class config.ConfigChanges based on -changes_class_v4.py on bpo issue. * Add class test_config.ChangesTest, -partly using configdialog_tests_v1.py. * Revise configdialog to use -ConfigChanges; see tracker msg297804. * Revise test_configdialog to match -configdialog changes. * Remove configdialog functions unused or moved to -ConfigChanges. Cheryl Sabella contributed parts of the patch. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst b/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst deleted file mode 100644 index c96cc4e1438..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: call config.IdleConf.GetUserCfgDir only once. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst b/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst deleted file mode 100644 index 1bd0cbb6abf..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: In Settings dialog, select font with Up, Down keys as well as mouse. -Initial patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst b/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst deleted file mode 100644 index 5ed7c8bb1af..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Remove unused variables in configdialog. One is a duplicate, one is -set but cannot be altered by users. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst b/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst deleted file mode 100644 index 4e4e0e69a01..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add docstrings to browser.py. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst b/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst deleted file mode 100644 index 665c7cd5bbf..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add tests for ConfigParser subclasses in config. Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst b/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst deleted file mode 100644 index 23a9fe86ccb..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Document ConfigDialog tk Vars, methods, and widgets in docstrings This -will facilitate improving the dialog and splitting up the class. Original -patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst b/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst deleted file mode 100644 index 53beb43159c..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst +++ /dev/null @@ -1,7 +0,0 @@ -Document coverage details for idlelib tests. - -* Add section to idlelib/idle-test/README.txt. - -* Include check that branches are taken both ways. - -* Exclude IDLE-specific code that does not run during unit tests. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst b/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst deleted file mode 100644 index c2cc9ccdd11..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add tests for idlelib.config.IdleConf. -Increase coverage from 46% to 96%. -Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst b/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst deleted file mode 100644 index d7c5f54c7c3..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: replace 'colour' with 'color' in configdialog. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst b/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst deleted file mode 100644 index 48d477ed2e1..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE -- Add more configdialog font page tests. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst b/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst deleted file mode 100644 index 04c94349165..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE - Improve configdialog font page and tests. - -In configdialog: Document causal pathways in create_font_tab docstring. Simplify some attribute names. Move set_samples calls to var_changed_font (idea from Cheryl Sabella). Move related functions to positions after the create widgets function. - -In test_configdialog: Fix test_font_set so not order dependent. Fix renamed test_indent_scale so it tests the widget. Adjust tests for movement of set_samples call. Add tests for load functions. Put all font tests in one class and tab indent tests in another. Except for two lines, these tests completely cover the related functions. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst b/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst deleted file mode 100644 index f3dab0fd9e6..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add more tests for General tab. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst b/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst deleted file mode 100644 index 9cabca193b9..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE -- Factor a VarTrace class out of ConfigDialog. - -Instance tracers manages pairs consisting of a tk variable and a -callback function. When tracing is turned on, setting the variable -calls the function. Test coverage for the new class is 100%. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst b/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst deleted file mode 100644 index 1d202c7fa2c..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE - Finish rearranging methods of ConfigDialog Grouping methods -pertaining to each tab and the buttons will aid writing tests and improving -the tabs and will enable splitting the groups into classes. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst b/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst deleted file mode 100644 index 3031adff717..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE - Use ttk widgets in ConfigDialog. -Patches by Terry Jan Reedy and Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst b/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst deleted file mode 100644 index 47fed949d10..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Factor FontPage(Frame) class from ConfigDialog. - -Slightly modified tests continue to pass. Fix General tests. Patch mostly by -Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst b/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst deleted file mode 100644 index e33b2e231d6..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Factor GenPage(Frame) class from ConfigDialog. The slightly modified tests -continue to pass. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst deleted file mode 100644 index 3bb337562de..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE - Add an outline of a TabPage class in configdialog. -Update existing classes to match outline. -Initial patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst b/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst deleted file mode 100644 index f25fc80c3dd..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Calltips use `inspect.signature` instead of `inspect.getfullargspec`. -This improves calltips for builtins converted to use Argument Clinic. -Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst b/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst deleted file mode 100644 index 1708be72b8b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst +++ /dev/null @@ -1 +0,0 @@ -Add tests for configdialog keys tab. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst b/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst deleted file mode 100644 index c57728fda22..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE -- stop leaks in test_configdialog. Initial patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst b/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst deleted file mode 100644 index 007a2e2fc55..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Factor KeysPage(Frame) class from ConfigDialog. The slightly -modified tests continue to pass. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst b/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst deleted file mode 100644 index 5e1eeee0419..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst +++ /dev/null @@ -1 +0,0 @@ -Add tests for configdialog highlight tab. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst b/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst deleted file mode 100644 index ba984065e88..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Factor HighPage(Frame) class from ConfigDialog. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst deleted file mode 100644 index 9b59fbabe53..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst +++ /dev/null @@ -1,20 +0,0 @@ -Convert IDLE's built-in 'extensions' to regular features. - -About 10 IDLE features were implemented as supposedly optional -extensions. Their different behavior could be confusing or worse for -users and not good for maintenance. Hence the conversion. - -The main difference for users is that user configurable key bindings -for builtin features are now handled uniformly. Now, editing a binding -in a keyset only affects its value in the keyset. All bindings are -defined together in the system-specific default keysets in config- -extensions.def. All custom keysets are saved as a whole in config- -extension.cfg. All take effect as soon as one clicks Apply or Ok. - -The affected events are '<>', '<>', -'<>', '<>', '<>', -'<>', '<>', and '<>'. Any -(global) customizations made before 3.6.3 will not affect their keyset- -specific customization after 3.6.3. and vice versa. - -Inital patch by Charles Wohlganger. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst b/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst deleted file mode 100644 index 9cd55573f87..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE - Do not modify tkinter.message in test_configdialog. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst b/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst deleted file mode 100644 index 262674c32dc..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Add docstrings and tests for outwin subclass of editor. - -Move some data and functions from the class to module level. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst b/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst deleted file mode 100644 index fe515911b0d..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst +++ /dev/null @@ -1 +0,0 @@ -Rearrange IDLE condigdialog GenPage into Window, Editor, and Help sections. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst deleted file mode 100644 index aa49d882d0a..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is -not the same as deleting and inserting because int('') will fail. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst deleted file mode 100644 index f3e4ab22320..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst +++ /dev/null @@ -1,4 +0,0 @@ -Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the -background in order to make live - -interaction and experimentatin with tkinter applications much easier. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst deleted file mode 100644 index 5999e9a8f27..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE - make tests pass with zzdummy extension disabled by default. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst deleted file mode 100644 index 4b47ed3f53b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more -than blank spaces. Multiline string literals are not skipped. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst deleted file mode 100644 index 258fc1ba75d..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Update non-key options in former extension classes. When applying -configdialog changes, call .reload for each feature class. Change ParenMatch -so updated options affect existing instances attached to existing editor -windows. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst deleted file mode 100644 index 7fbf7b27795..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE code context -- fix code update and font update timers. - -Canceling timers prevents a warning message when test_idle completes. diff --git a/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst b/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst deleted file mode 100644 index f4f1b277c18..00000000000 --- a/Misc/NEWS.d/next/Library/01.bpo-29755.diQcY_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the lgettext() family of functions in the gettext module. They now -always return bytes. diff --git a/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst b/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst deleted file mode 100644 index 94803bb5f1d..00000000000 --- a/Misc/NEWS.d/next/Library/02.bpo-30746.7drQI0.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prohibited the '=' character in environment variable names in -``os.putenv()`` and ``os.spawn*()``. diff --git a/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst b/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst deleted file mode 100644 index 862c114aef8..00000000000 --- a/Misc/NEWS.d/next/Library/03.bpo-30879.N3KI-o.rst +++ /dev/null @@ -1,2 +0,0 @@ -os.listdir() and os.scandir() now emit bytes names when called with bytes- -like argument. diff --git a/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst b/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst deleted file mode 100644 index adce85fbc2b..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst +++ /dev/null @@ -1 +0,0 @@ -Fix email header value parser dropping folding white space in certain cases. diff --git a/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst b/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst deleted file mode 100644 index 55dd6136c8d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst +++ /dev/null @@ -1 +0,0 @@ -Fix bug when modifying os.environ while iterating over it diff --git a/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst b/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst deleted file mode 100644 index ce6f48a61f6..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst +++ /dev/null @@ -1,6 +0,0 @@ -signal.setitimer() may disable the timer when passed a tiny value. - -Tiny values (such as 1e-6) are valid non-zero values for setitimer(), which -is specified as taking microsecond-resolution intervals. However, on some -platform, our conversion routine could convert 1e-6 into a zero interval, -therefore disabling the timer instead of (re-)scheduling it. diff --git a/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst b/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst deleted file mode 100644 index 8924962d071..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst +++ /dev/null @@ -1 +0,0 @@ -Fix out of bounds write in `asyncio.CFuture.remove_done_callback()`. diff --git a/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst b/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst deleted file mode 100644 index 1112d2f3737..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst +++ /dev/null @@ -1 +0,0 @@ -socket.close() now ignores ECONNRESET error. diff --git a/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst b/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst deleted file mode 100644 index 5c439087dcb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix segfault in readline when using readline's history-size option. Patch -by Nir Soffer. diff --git a/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst b/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst deleted file mode 100644 index fedd6cd0474..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix multiprocessing.Queue.join_thread(): it now waits until the thread -completes, even if the thread was started by the same process which created -the queue. diff --git a/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst b/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst deleted file mode 100644 index 61d6b29cafc..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst +++ /dev/null @@ -1,2 +0,0 @@ -Change ``ttk.OptionMenu`` radiobuttons to be unique across instances of -``OptionMenu``. diff --git a/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst b/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst deleted file mode 100644 index b89c6d4769d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst +++ /dev/null @@ -1 +0,0 @@ -Fix decrementing a borrowed reference in tracemalloc. diff --git a/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst b/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst deleted file mode 100644 index 95bcd1007de..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``unittest.mock``'s autospec to not fail on method-bound builtin -functions. Patch by Aaron Gallagher. diff --git a/Misc/NEWS.d/next/Library/2017-07-26-04-46-12.bpo-30595.-zJ7d8.rst b/Misc/NEWS.d/next/Library/2017-07-26-04-46-12.bpo-30595.-zJ7d8.rst deleted file mode 100644 index 4a2a3901cc6..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-26-04-46-12.bpo-30595.-zJ7d8.rst +++ /dev/null @@ -1,3 +0,0 @@ -multiprocessing.Queue.get() with a timeout now polls its reader in non- -blocking mode if it succeeded to aquire the lock but the acquire took longer -than the timeout. diff --git a/Misc/NEWS.d/next/Library/2017-07-26-15-15-00.bpo-30119.DZ6C_S.rst b/Misc/NEWS.d/next/Library/2017-07-26-15-15-00.bpo-30119.DZ6C_S.rst deleted file mode 100644 index a37d3703842..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-26-15-15-00.bpo-30119.DZ6C_S.rst +++ /dev/null @@ -1,2 +0,0 @@ -ftplib.FTP.putline() now throws ValueError on commands that contains CR or -LF. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst deleted file mode 100644 index 522bdf669e9..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst +++ /dev/null @@ -1 +0,0 @@ -Fix handling of long oids in ssl. Based on patch by Christian Heimes. diff --git a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst deleted file mode 100644 index 650e5f95f94..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a crash when using asyncio and threads. diff --git a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst deleted file mode 100644 index 3c2a15528d8..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix `copyreg._slotnames()` mangled attribute calculation for classes whose -name begins with an underscore. Patch by Shane Harvey. diff --git a/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst b/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst deleted file mode 100644 index 60068fb648f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst +++ /dev/null @@ -1,4 +0,0 @@ -ttk: fix the destroy() method of LabeledScale and OptionMenu classes. -Call the parent destroy() method even if the used attribute doesn't -exist. The LabeledScale.destroy() method now also explicitly clears label and -scale attributes to help the garbage collector to destroy all widgets. diff --git a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst deleted file mode 100644 index bdaa4ea35da..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed miscellaneous errors in asyncio speedup module. diff --git a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst deleted file mode 100644 index 13c07e39fdc..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst +++ /dev/null @@ -1,4 +0,0 @@ -The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on -OpenSSL < 1.1.0. The function detects CPU features and enables optimizations -on some CPU architectures such as POWER8. Patch is based on research from -Gustavo Serra Scalet. diff --git a/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst b/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst deleted file mode 100644 index 6879384eb8f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst +++ /dev/null @@ -1,2 +0,0 @@ -xmlrpc.server now explicitly breaks reference cycles when using -sys.exc_info() in code handling exceptions. diff --git a/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst b/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst deleted file mode 100644 index f11a66802d1..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst +++ /dev/null @@ -1,2 +0,0 @@ -concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now breaks a -reference cycle between an exception object and the WorkItem object. diff --git a/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst b/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst deleted file mode 100644 index bd238f95b8a..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst +++ /dev/null @@ -1,2 +0,0 @@ -The subprocess module now sets the filename when FileNotFoundError -is raised on POSIX systems due to the executable or cwd not being found. diff --git a/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst b/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst deleted file mode 100644 index e7625631002..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ctypes producing wrong PEP 3118 type codes for integer types. diff --git a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst deleted file mode 100644 index 857fad0c852..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` -now avoid keeping a reference to yielded objects. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst b/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst deleted file mode 100644 index 8c45bcef5fd..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-03-14-10-00.bpo-9146._-oo-_.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix a segmentation fault in _hashopenssl when standard hash functions -such as md5 are not available in the linked OpenSSL library. As in -some special FIPS-140 build environments. diff --git a/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst b/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst deleted file mode 100644 index ad4e939c42d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-03-14-31-00.bpo-29212.bicycl.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non repr() -based thread name by default when no thread_name_prefix is supplied. They will -now identify themselves as "ThreadPoolExecutor-y_n". diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst deleted file mode 100644 index e76997ef836..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst +++ /dev/null @@ -1 +0,0 @@ -Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. diff --git a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst deleted file mode 100644 index 2505007dac0..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst +++ /dev/null @@ -1,3 +0,0 @@ -expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial -characters for UTF-8 input (libexpat bug 115): -https://github.com/libexpat/libexpat/issues/115 diff --git a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst deleted file mode 100644 index 299cf3c9d54..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst +++ /dev/null @@ -1 +0,0 @@ -Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. diff --git a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst deleted file mode 100644 index df018e0c37e..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst +++ /dev/null @@ -1 +0,0 @@ -Fix string concatenation bug in rare error path in the subprocess module diff --git a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst deleted file mode 100644 index 2d05e10fc14..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst +++ /dev/null @@ -1,3 +0,0 @@ -SSLSocket.sendall() now uses memoryview to create slices of data. This fixes -support for all bytes-like object. It is also more efficient and avoids -costly copies. diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst deleted file mode 100644 index eb4e206be37..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst +++ /dev/null @@ -1,2 +0,0 @@ -ssl.SSLContext() now uses OpenSSL error information when a context cannot be -instantiated. diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst deleted file mode 100644 index 1321300dbd4..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst +++ /dev/null @@ -1 +0,0 @@ -Improves SSL error handling to avoid losing error numbers. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst deleted file mode 100644 index 153aa42a62e..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst +++ /dev/null @@ -1 +0,0 @@ -LoggerAdapter objects can now be nested. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst deleted file mode 100644 index e522e8e9527..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst +++ /dev/null @@ -1,2 +0,0 @@ -socket.create_connection() now fixes manually a reference cycle: clear the -variable storing the last exception on success. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst deleted file mode 100644 index 9ea3599ee0b..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst +++ /dev/null @@ -1,2 +0,0 @@ -The C accelerator module of ElementTree ignored exceptions raised when -looking up TreeBuilder target methods in XMLParser(). diff --git a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst deleted file mode 100644 index efc5918ca07..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Speed improvements to the ``typing`` module. Original PRs by Ivan -Levkivskyi and Mitar. diff --git a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst deleted file mode 100644 index 8464d59a0cb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst +++ /dev/null @@ -1,2 +0,0 @@ -typing.get_type_hints now finds the right globalns for classes and modules -by default (when no ``globalns`` was specified by the caller). diff --git a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst deleted file mode 100644 index 22af29fdecb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst +++ /dev/null @@ -1 +0,0 @@ -xml.etree: Fix a crash when a parser is part of a reference cycle. diff --git a/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst b/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst deleted file mode 100644 index 3caca9a79b4..00000000000 --- a/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security -fixes. diff --git a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst deleted file mode 100644 index b9106a5f744..00000000000 --- a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst +++ /dev/null @@ -1,2 +0,0 @@ -SSLObject.version() now correctly returns None when handshake over BIO has -not been performed yet. diff --git a/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst b/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst deleted file mode 100644 index 53557f66fef..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst +++ /dev/null @@ -1,5 +0,0 @@ -regrtest: Exclude tzdata from regrtest --all. When running the test suite -using --use=all / -u all, exclude tzdata since it makes test_datetime too -slow (15-20 min on some buildbots) which then times out on some buildbots. -Fix also regrtest command line parser to allow passing -u extralargefile to -run test_zipfile64. diff --git a/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst b/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst deleted file mode 100644 index 88394e585c5..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves -like OpenSSL 1.0.2 and no longer aborts handshake. diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst deleted file mode 100644 index 383d1b43615..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst +++ /dev/null @@ -1 +0,0 @@ -Remove sha256.tbs-internet.com ssl test diff --git a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst deleted file mode 100644 index 8b7163dfe79..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst +++ /dev/null @@ -1 +0,0 @@ -Silence traceback in test_ssl diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst b/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst deleted file mode 100644 index 404263e9ac8..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst +++ /dev/null @@ -1,6 +0,0 @@ -gdb integration commands (py-bt, etc.) work on optimized shared builds now, -too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines -PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to -use py-bt, py-up, and a few other Python-specific gdb integrations. The -problem is fixed by only looking for _PyEval_EvalFrameDefault frames in -python-gdb.py. Original patch by Bruno "Polaco" Penteado. diff --git a/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst b/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst deleted file mode 100644 index 8a65a9e022c..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst +++ /dev/null @@ -1 +0,0 @@ -Add a missing xmlns to python.manifest so that it matches the schema. diff --git a/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst b/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst deleted file mode 100644 index 6591fa0df00..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst +++ /dev/null @@ -1,2 +0,0 @@ -os.cpu_count() now returns the correct number of processors on Windows -when the number of logical processors is greater than 64. diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst deleted file mode 100644 index 065596fcc85..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst +++ /dev/null @@ -1 +0,0 @@ -Change to building with MSVC v141 (included with Visual Studio 2017) diff --git a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst deleted file mode 100644 index 7c72e315142..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst +++ /dev/null @@ -1 +0,0 @@ -Adds detection of Visual Studio 2017 to distutils on Windows. From webhook-mailer at python.org Tue Sep 19 03:14:08 2017 From: webhook-mailer at python.org (Ned Deily) Date: Tue, 19 Sep 2017 07:14:08 -0000 Subject: [Python-checkins] Update PyDoc topics and NEWS blurbs for 3.7.0a1 Message-ID: https://github.com/python/cpython/commit/450ceea33169e8a7717d3e2fffb009141a99c479 commit: 450ceea33169e8a7717d3e2fffb009141a99c479 branch: master author: Ned Deily committer: Ned Deily date: 2017-09-19T01:01:36-04:00 summary: Update PyDoc topics and NEWS blurbs for 3.7.0a1 files: A Misc/NEWS.d/3.7.0a1.rst D Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst D Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst D Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst D Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst D Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst D Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst D Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst D Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst D Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst D Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst D Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst D Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst D Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst D Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst D Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst D Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst D Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst D Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst D Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst D Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst D Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst D Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst D Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst D Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst D Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst D Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst D Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst D Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst D Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst D Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst D Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst D Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst D Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst D Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst D Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst D Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst D Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst D Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst D Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst D Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst D Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst D Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst D Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst D Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst D Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst D Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst D Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst D Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst D Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst D Misc/NEWS.d/next/C API/2017-07-03-17-25-40.bpo-30832.PcTAEP.rst D Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst D Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst D Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst D Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst D Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst D Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst D Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst D Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst D Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst D Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst D Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst D Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst D Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst D Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst D Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst D Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst D Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst D Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst D Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst D Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst D Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst D Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst D Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst D Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst D Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst D Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst D Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst D Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst D Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst D Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst D Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst D Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst D Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst D Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst D Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst D Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst D Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst D Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst D Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst D Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst D Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst D Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst D Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst D Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst D Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst D Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst D Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst D Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst D Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst D Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst D Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst D Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst D Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst D Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst D Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst D Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst D Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst D Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst D Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst D Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst D Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst D Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst D Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst D Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst D Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst D Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst D Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst D Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst D Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst D Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst D Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst D Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst D Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst D Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst D Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst D Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst D Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst D Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst D Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst D Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst D Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst D Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst D Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst D Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst D Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst D Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst D Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst D Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst D Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst D Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst D Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst D Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst D Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst D Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst D Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst D Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst D Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst D Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst D Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst D Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst D Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst D Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst D Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst D Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst D Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst D Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst D Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst D Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst D Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst D Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst D Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst D Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst D Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst D Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst D Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst D Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst D Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst D Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst D Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst D Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst D Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst D Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-08-12-00-29.bpo-30747.g2kZRT.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst D Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst D Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst D Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst D Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst D Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst D Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst D Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst D Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst D Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst D Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst D Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst D Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst D Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst D Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst D Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst D Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst D Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst D Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst D Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst D Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst D Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst D Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst D Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst D Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst D Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst D Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst D Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst D Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst D Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst D Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst D Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst D Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst D Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst D Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst D Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst D Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst D Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst D Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst D Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst D Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst D Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst D Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst D Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst D Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst D Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst D Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst D Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst D Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst D Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst D Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst D Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst D Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst D Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst D Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst D Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst D Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst D Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst D Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst D Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst D Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst D Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst D Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst D Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst D Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst D Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst D Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst D Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst D Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst D Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst D Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst D Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst D Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst D Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst D Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst D Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst D Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst D Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst D Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst D Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst D Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst D Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst D Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst D Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst D Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst D Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst D Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst D Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst D Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst D Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst D Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst D Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst D Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst D Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst D Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst D Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst D Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst D Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst D Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst D Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst D Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst D Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst D Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst D Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst D Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst D Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst D Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst D Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst D Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst D Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst D Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst D Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst D Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst D Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst D Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst D Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst D Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst D Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst D Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst D Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst D Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst D Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst D Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst D Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst D Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst D Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst D Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst D Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst D Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst D Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst D Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst D Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst D Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst D Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst D Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst D Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst D Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst D Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst D Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst D Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst D Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst D Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst D Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst D Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst D Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst D Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst D Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst D Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst D Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst D Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst D Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst D Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst D Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst D Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst D Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst D Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst D Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst D Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst D Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst D Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst D Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst D Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst D Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst D Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst D Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst D Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst D Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst D Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst D Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst D Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst D Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst D Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst D Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst D Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst D Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst D Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst D Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst D Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst D Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst D Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst D Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst D Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst D Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst D Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst D Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst D Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst D Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst D Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst D Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst D Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst D Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst D Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst D Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst D Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst D Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst D Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst D Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst D Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst D Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst D Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst D Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst D Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst D Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst D Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst D Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst D Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst D Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst D Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst D Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst D Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst D Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst D Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst D Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst D Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst D Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst D Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst D Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst D Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst D Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst D Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst D Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst D Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst D Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst D Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst D Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst D Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst D Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst D Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst D Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst D Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst D Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst D Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst D Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst D Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst D Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst D Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst D Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst D Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst D Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst D Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst D Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst D Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst D Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst D Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst D Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst D Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst D Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst D Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst D Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst D Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst D Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst D Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst D Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst D Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst D Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst D Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst D Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst D Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst D Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst D Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst D Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst D Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst D Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst D Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst D Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst D Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst D Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst D Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst D Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst D Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst D Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst D Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst D Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst D Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst D Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst D Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst D Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst D Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst D Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst D Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst D Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst D Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst D Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst D Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst D Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst D Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst D Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst D Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst D Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst D Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst D Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst D Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst D Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst D Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst D Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst D Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst D Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst D Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst D Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst D Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst D Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst D Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst D Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst D Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst D Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst D Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst D Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst D Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst D Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst D Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst D Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst D Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst D Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst D Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst D Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst D Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst D Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst D Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst D Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst D Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst D Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst D Misc/NEWS.d/next/Library/2017-06-24-18-55-58.bpo-30596.VhB8iG.rst D Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst D Misc/NEWS.d/next/Library/2017-06-29-00-07-22.bpo-29293.Z6WZjD.rst D Misc/NEWS.d/next/Library/2017-06-29-00-17-38.bpo-29585.x2V0my.rst D Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst D Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst D Misc/NEWS.d/next/Library/2017-06-30-23-05-47.bpo-30302.itwK_k.rst D Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst D Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst D Misc/NEWS.d/next/Library/2017-07-04-22-00-20.bpo-30794.qFwozm.rst D Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst D Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst D Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst D Misc/NEWS.d/next/Library/2017-07-17-12-32-47.bpo-30946.DUo-uA.rst D Misc/NEWS.d/next/Library/2017-07-18-13-24-50.bpo-19896.-S0IWu.rst D Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst D Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst D Misc/NEWS.d/next/Library/2017-07-22-12-12-42.bpo-26732.lYLWBH.rst D Misc/NEWS.d/next/Library/2017-07-23-11-33-10.bpo-30919.5dYRru.rst D Misc/NEWS.d/next/Library/2017-07-26-13-18-29.bpo-5288.o_xEGj.rst D Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst D Misc/NEWS.d/next/Library/2017-07-30-10-07-58.bpo-30522.gAX1N-.rst D Misc/NEWS.d/next/Library/2017-07-30-22-00-12.bpo-30987.228rW0.rst D Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst D Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst D Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst D Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst D Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst D Misc/NEWS.d/next/Library/2017-08-08-15-14-34.bpo-24700.44mvNV.rst D Misc/NEWS.d/next/Library/2017-08-09-13-45-23.bpo-31072.NLXDPV.rst D Misc/NEWS.d/next/Library/2017-08-10-13-20-02.bpo-31151.730VBI.rst D Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst D Misc/NEWS.d/next/Library/2017-08-12-09-25-55.bpo-5001.huQi2Y.rst D Misc/NEWS.d/next/Library/2017-08-13-09-17-01.bpo-31183.-2_YGj.rst D Misc/NEWS.d/next/Library/2017-08-16-20-28-06.bpo-18966.mjHWk2.rst D Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst D Misc/NEWS.d/next/Library/2017-08-17-20-29-45.bpo-31109.7qtC64.rst D Misc/NEWS.d/next/Library/2017-08-18-17-16-38.bpo-5001.gwnthq.rst D Misc/NEWS.d/next/Library/2017-08-21-12-31-53.bpo-31238.Gg0LRH.rst D Misc/NEWS.d/next/Library/2017-08-21-16-06-19.bpo-23835.da_4Kz.rst D Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst D Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst D Misc/NEWS.d/next/Library/2017-08-23-00-31-32.bpo-29741.EBn_DM.rst D Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst D Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst D Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst D Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst D Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst D Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst D Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst D Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst D Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst D Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst D Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst D Misc/NEWS.d/next/Library/2017-09-05-17-43-00.bpo-14191.vhh2xx.rst D Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst D Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst D Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst D Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst D Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst D Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst D Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst D Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst D Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst D Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst D Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst D Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst D Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst D Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst D Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst D Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst D Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst D Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst D Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst D Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst D Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst D Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst D Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst D Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst D Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst D Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst D Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst D Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst D Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst D Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst D Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst D Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst D Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst D Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst D Misc/NEWS.d/next/Tests/2017-06-30-11-20-20.bpo-30695.lo7FQX.rst D Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst D Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst D Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst D Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst D Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst D Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst D Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst D Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst D Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst D Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst D Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst D Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst D Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst D Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst D Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst D Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst D Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst D Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst D Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst D Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst D Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst D Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst D Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst D Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst D Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst D Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst D Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst D Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst D Misc/NEWS.d/next/Windows/2017-06-27-07-04-06.bpo-23451.bl_QOB.rst D Misc/NEWS.d/next/Windows/2017-06-28-03-08-22.bpo-30362.XxeVMB.rst D Misc/NEWS.d/next/Windows/2017-06-28-03-20-48.bpo-30291.zBpOl6.rst D Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst D Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst D Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst D Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst D Misc/NEWS.d/next/Windows/2017-09-05-19-46-52.bpo-31358.n1Fjxc.rst D Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst D Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst M Lib/pydoc_data/topics.py diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 3579484fd0e..8d64ad44c79 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Sep 12 10:47:11 2016 -topics = {'assert': '\n' - 'The "assert" statement\n' +# Autogenerated by Sphinx on Tue Sep 19 00:59:47 2017 +topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' 'Assert statements are a convenient way to insert debugging ' @@ -39,8 +38,7 @@ 'Assignments to "__debug__" are illegal. The value for the ' 'built-in\n' 'variable is determined when the interpreter starts.\n', - 'assignment': '\n' - 'Assignment statements\n' + 'assignment': 'Assignment statements\n' '*********************\n' '\n' 'Assignment statements are used to (re)bind names to values and ' @@ -405,8 +403,7 @@ 'See also: **PEP 526** - Variable and attribute annotation ' 'syntax\n' ' **PEP 484** - Type hints\n', - 'atom-identifiers': '\n' - 'Identifiers (Names)\n' + 'atom-identifiers': 'Identifiers (Names)\n' '*******************\n' '\n' 'An identifier occurring as an atom is a name. See ' @@ -446,8 +443,7 @@ 'happen. If the class name consists only of underscores, ' 'no\n' 'transformation is done.\n', - 'atom-literals': '\n' - 'Literals\n' + 'atom-literals': 'Literals\n' '********\n' '\n' 'Python supports string and bytes literals and various ' @@ -476,8 +472,7 @@ 'may obtain\n' 'the same object or a different object with the same ' 'value.\n', - 'attribute-access': '\n' - 'Customizing attribute access\n' + 'attribute-access': 'Customizing attribute access\n' '****************************\n' '\n' 'The following methods can be defined to customize the ' @@ -747,23 +742,15 @@ '__slots__\n' '=========\n' '\n' - 'By default, instances of classes have a dictionary for ' - 'attribute\n' - 'storage. This wastes space for objects having very few ' - 'instance\n' - 'variables. The space consumption can become acute when ' - 'creating large\n' - 'numbers of instances.\n' + '*__slots__* allow us to explicitly declare data members ' + '(like\n' + 'properties) and deny the creation of *__dict__* and ' + '*__weakref__*\n' + '(unless explicitly declared in *__slots__* or available ' + 'in a parent.)\n' '\n' - 'The default can be overridden by defining *__slots__* in ' - 'a class\n' - 'definition. The *__slots__* declaration takes a sequence ' - 'of instance\n' - 'variables and reserves just enough space in each ' - 'instance to hold a\n' - 'value for each variable. Space is saved because ' - '*__dict__* is not\n' - 'created for each instance.\n' + 'The space saved over using *__dict__* can be ' + 'significant.\n' '\n' 'object.__slots__\n' '\n' @@ -783,9 +770,9 @@ '\n' '* When inheriting from a class without *__slots__*, the ' '*__dict__*\n' - ' attribute of that class will always be accessible, so ' - 'a *__slots__*\n' - ' definition in the subclass is meaningless.\n' + ' and *__weakref__* attribute of the instances will ' + 'always be\n' + ' accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' @@ -819,13 +806,16 @@ 'the class\n' ' attribute would overwrite the descriptor assignment.\n' '\n' - '* The action of a *__slots__* declaration is limited to ' - 'the class\n' - ' where it is defined. As a result, subclasses will ' - 'have a *__dict__*\n' - ' unless they also define *__slots__* (which must only ' - 'contain names\n' - ' of any *additional* slots).\n' + '* The action of a *__slots__* declaration is not limited ' + 'to the\n' + ' class where it is defined. *__slots__* declared in ' + 'parents are\n' + ' available in child classes. However, child subclasses ' + 'will get a\n' + ' *__dict__* and *__weakref__* unless they also define ' + '*__slots__*\n' + ' (which should only contain names of any *additional* ' + 'slots).\n' '\n' '* If a class defines a slot also defined in a base ' 'class, the\n' @@ -850,9 +840,16 @@ '\n' '* *__class__* assignment works only if both classes have ' 'the same\n' - ' *__slots__*.\n', - 'attribute-references': '\n' - 'Attribute references\n' + ' *__slots__*.\n' + '\n' + '* Multiple inheritance with multiple slotted parent ' + 'classes can be\n' + ' used, but only one parent is allowed to have ' + 'attributes created by\n' + ' slots (the other bases must have empty slot layouts) - ' + 'violations\n' + ' raise "TypeError".\n', + 'attribute-references': 'Attribute references\n' '********************\n' '\n' 'An attribute reference is a primary followed by a ' @@ -875,8 +872,7 @@ 'determined by the object. Multiple evaluations of ' 'the same attribute\n' 'reference may yield different objects.\n', - 'augassign': '\n' - 'Augmented assignment statements\n' + 'augassign': 'Augmented assignment statements\n' '*******************************\n' '\n' 'Augmented assignment is the combination, in a single statement, ' @@ -940,8 +936,7 @@ 'about\n' 'class and instance attributes applies as for regular ' 'assignments.\n', - 'binary': '\n' - 'Binary arithmetic operations\n' + 'binary': 'Binary arithmetic operations\n' '****************************\n' '\n' 'The binary arithmetic operations have the conventional priority\n' @@ -1029,8 +1024,7 @@ 'The "-" (subtraction) operator yields the difference of its ' 'arguments.\n' 'The numeric arguments are first converted to a common type.\n', - 'bitwise': '\n' - 'Binary bitwise operations\n' + 'bitwise': 'Binary bitwise operations\n' '*************************\n' '\n' 'Each of the three bitwise operations has a different priority ' @@ -1050,8 +1044,7 @@ 'The "|" operator yields the bitwise (inclusive) OR of its ' 'arguments,\n' 'which must be integers.\n', - 'bltin-code-objects': '\n' - 'Code Objects\n' + 'bltin-code-objects': 'Code Objects\n' '************\n' '\n' 'Code objects are used by the implementation to ' @@ -1074,8 +1067,7 @@ '\n' 'See The standard type hierarchy for more ' 'information.\n', - 'bltin-ellipsis-object': '\n' - 'The Ellipsis Object\n' + 'bltin-ellipsis-object': 'The Ellipsis Object\n' '*******************\n' '\n' 'This object is commonly used by slicing (see ' @@ -1087,8 +1079,7 @@ '"Ellipsis" singleton.\n' '\n' 'It is written as "Ellipsis" or "...".\n', - 'bltin-null-object': '\n' - 'The Null Object\n' + 'bltin-null-object': 'The Null Object\n' '***************\n' '\n' "This object is returned by functions that don't " @@ -1100,8 +1091,7 @@ 'same singleton.\n' '\n' 'It is written as "None".\n', - 'bltin-type-objects': '\n' - 'Type Objects\n' + 'bltin-type-objects': 'Type Objects\n' '************\n' '\n' 'Type objects represent the various object types. An ' @@ -1113,8 +1103,7 @@ 'all standard built-in types.\n' '\n' 'Types are written like this: "".\n', - 'booleans': '\n' - 'Boolean operations\n' + 'booleans': 'Boolean operations\n' '******************\n' '\n' ' or_test ::= and_test | or_test "or" and_test\n' @@ -1163,8 +1152,7 @@ 'its\n' 'argument (for example, "not \'foo\'" produces "False" rather ' 'than "\'\'".)\n', - 'break': '\n' - 'The "break" statement\n' + 'break': 'The "break" statement\n' '*********************\n' '\n' ' break_stmt ::= "break"\n' @@ -1185,8 +1173,7 @@ 'clause, that "finally" clause is executed before really leaving ' 'the\n' 'loop.\n', - 'callable-types': '\n' - 'Emulating callable objects\n' + 'callable-types': 'Emulating callable objects\n' '**************************\n' '\n' 'object.__call__(self[, args...])\n' @@ -1195,8 +1182,7 @@ 'this method\n' ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' ' "x.__call__(arg1, arg2, ...)".\n', - 'calls': '\n' - 'Calls\n' + 'calls': 'Calls\n' '*****\n' '\n' 'A call calls a callable object (e.g., a *function*) with a ' @@ -1217,7 +1203,8 @@ ' ("," "*" expression | "," ' 'keyword_item)*\n' ' keywords_arguments ::= (keyword_item | "**" expression)\n' - ' ("," keyword_item | "**" expression)*\n' + ' ("," keyword_item | "," "**" ' + 'expression)*\n' ' keyword_item ::= identifier "=" expression\n' '\n' 'An optional trailing comma may be present after the positional and\n' @@ -1316,7 +1303,7 @@ ' 2 1\n' ' >>> f(a=1, *(2,))\n' ' Traceback (most recent call last):\n' - ' File "", line 1, in ?\n' + ' File "", line 1, in \n' " TypeError: f() got multiple values for keyword argument 'a'\n" ' >>> f(1, *(2,))\n' ' 1 2\n' @@ -1382,8 +1369,7 @@ ' The class must define a "__call__()" method; the effect is then ' 'the\n' ' same as if that method was called.\n', - 'class': '\n' - 'Class definitions\n' + 'class': 'Class definitions\n' '*****************\n' '\n' 'A class definition defines a class object (see section The ' @@ -1469,8 +1455,7 @@ '\n' 'See also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n' ' Class Decorators\n', - 'comparisons': '\n' - 'Comparisons\n' + 'comparisons': 'Comparisons\n' '***********\n' '\n' 'Unlike C, all comparison operations in Python have the same ' @@ -1623,7 +1608,7 @@ 'restriction that\n' ' ranges do not support order comparison. Equality ' 'comparison across\n' - ' these types results in unequality, and ordering comparison ' + ' these types results in inequality, and ordering comparison ' 'across\n' ' these types raises "TypeError".\n' '\n' @@ -1687,7 +1672,7 @@ 'they\n' ' have equal *(key, value)* pairs. Equality comparison of the ' 'keys and\n' - ' elements enforces reflexivity.\n' + ' values enforces reflexivity.\n' '\n' ' Order comparisons ("<", ">", "<=", and ">=") raise ' '"TypeError".\n' @@ -1762,6 +1747,12 @@ ' to sequences, but not to sets or mappings). See also the\n' ' "total_ordering()" decorator.\n' '\n' + '* The "hash()" result should be consistent with equality. ' + 'Objects\n' + ' that are equal should either have the same hash value, or ' + 'be marked\n' + ' as unhashable.\n' + '\n' 'Python does not enforce these consistency rules. In fact, ' 'the\n' 'not-a-number values are an example for not following these ' @@ -1773,9 +1764,9 @@ '\n' 'The operators "in" and "not in" test for membership. "x in ' 's"\n' - 'evaluates to true if *x* is a member of *s*, and false ' - 'otherwise. "x\n' - 'not in s" returns the negation of "x in s". All built-in ' + 'evaluates to "True" if *x* is a member of *s*, and "False" ' + 'otherwise.\n' + '"x not in s" returns the negation of "x in s". All built-in ' 'sequences\n' 'and set types support this as well as dictionary, for which ' '"in" tests\n' @@ -1786,30 +1777,32 @@ 'for e in\n' 'y)".\n' '\n' - 'For the string and bytes types, "x in y" is true if and only ' - 'if *x* is\n' - 'a substring of *y*. An equivalent test is "y.find(x) != ' - '-1". Empty\n' - 'strings are always considered to be a substring of any other ' - 'string,\n' - 'so """ in "abc"" will return "True".\n' + 'For the string and bytes types, "x in y" is "True" if and ' + 'only if *x*\n' + 'is a substring of *y*. An equivalent test is "y.find(x) != ' + '-1".\n' + 'Empty strings are always considered to be a substring of any ' + 'other\n' + 'string, so """ in "abc"" will return "True".\n' '\n' 'For user-defined classes which define the "__contains__()" ' 'method, "x\n' - 'in y" is true if and only if "y.__contains__(x)" is true.\n' + 'in y" returns "True" if "y.__contains__(x)" returns a true ' + 'value, and\n' + '"False" otherwise.\n' '\n' 'For user-defined classes which do not define "__contains__()" ' 'but do\n' - 'define "__iter__()", "x in y" is true if some value "z" with ' - '"x == z"\n' - 'is produced while iterating over "y". If an exception is ' + 'define "__iter__()", "x in y" is "True" if some value "z" ' + 'with "x ==\n' + 'z" is produced while iterating over "y". If an exception is ' 'raised\n' 'during the iteration, it is as if "in" raised that ' 'exception.\n' '\n' 'Lastly, the old-style iteration protocol is tried: if a class ' 'defines\n' - '"__getitem__()", "x in y" is true if and only if there is a ' + '"__getitem__()", "x in y" is "True" if and only if there is a ' 'non-\n' 'negative integer index *i* such that "x == y[i]", and all ' 'lower\n' @@ -1833,8 +1826,7 @@ 'is determined using the "id()" function. "x is not y" yields ' 'the\n' 'inverse truth value. [4]\n', - 'compound': '\n' - 'Compound statements\n' + 'compound': 'Compound statements\n' '*******************\n' '\n' 'Compound statements contain (groups of) other statements; they ' @@ -2613,7 +2605,8 @@ 'functions, even if they do not contain "await" or "async" ' 'keywords.\n' '\n' - 'It is a "SyntaxError" to use "yield" expressions in "async def"\n' + 'It is a "SyntaxError" to use "yield from" expressions in "async ' + 'def"\n' 'coroutines.\n' '\n' 'An example of a coroutine function:\n' @@ -2724,8 +2717,7 @@ ' body is transformed into the namespace\'s "__doc__" item ' 'and\n' " therefore the class's *docstring*.\n", - 'context-managers': '\n' - 'With Statement Context Managers\n' + 'context-managers': 'With Statement Context Managers\n' '*******************************\n' '\n' 'A *context manager* is an object that defines the ' @@ -2787,8 +2779,7 @@ ' The specification, background, and examples for the ' 'Python "with"\n' ' statement.\n', - 'continue': '\n' - 'The "continue" statement\n' + 'continue': 'The "continue" statement\n' '************************\n' '\n' ' continue_stmt ::= "continue"\n' @@ -2805,8 +2796,7 @@ '"finally" clause, that "finally" clause is executed before ' 'really\n' 'starting the next loop cycle.\n', - 'conversions': '\n' - 'Arithmetic conversions\n' + 'conversions': 'Arithmetic conversions\n' '**********************\n' '\n' 'When a description of an arithmetic operator below uses the ' @@ -2832,8 +2822,7 @@ "left argument to the '%' operator). Extensions must define " 'their own\n' 'conversion behavior.\n', - 'customization': '\n' - 'Basic customization\n' + 'customization': 'Basic customization\n' '*******************\n' '\n' 'object.__new__(cls[, ...])\n' @@ -2855,11 +2844,11 @@ ' Typical implementations create a new instance of the ' 'class by\n' ' invoking the superclass\'s "__new__()" method using\n' - ' "super(currentclass, cls).__new__(cls[, ...])" with ' - 'appropriate\n' - ' arguments and then modifying the newly-created instance ' - 'as\n' - ' necessary before returning it.\n' + ' "super().__new__(cls[, ...])" with appropriate arguments ' + 'and then\n' + ' modifying the newly-created instance as necessary before ' + 'returning\n' + ' it.\n' '\n' ' If "__new__()" returns an instance of *cls*, then the ' 'new\n' @@ -2894,7 +2883,7 @@ ' any, must explicitly call it to ensure proper ' 'initialization of the\n' ' base class part of the instance; for example:\n' - ' "BaseClass.__init__(self, [args...])".\n' + ' "super().__init__([args...])".\n' '\n' ' Because "__new__()" and "__init__()" work together in ' 'constructing\n' @@ -3043,8 +3032,8 @@ '\n' 'object.__bytes__(self)\n' '\n' - ' Called by "bytes()" to compute a byte-string ' - 'representation of an\n' + ' Called by bytes to compute a byte-string representation ' + 'of an\n' ' object. This should return a "bytes" object.\n' '\n' 'object.__format__(self, format_spec)\n' @@ -3077,6 +3066,11 @@ '"object" itself\n' ' raises a "TypeError" if passed any non-empty string.\n' '\n' + ' Changed in version 3.7: "object.__format__(x, \'\')" is ' + 'now\n' + ' equivalent to "str(x)" rather than "format(str(self), ' + '\'\')".\n' + '\n' 'object.__lt__(self, other)\n' 'object.__le__(self, other)\n' 'object.__eq__(self, other)\n' @@ -3152,15 +3146,18 @@ 'on members\n' ' of hashed collections including "set", "frozenset", and ' '"dict".\n' - ' "__hash__()" should return an integer. The only ' - 'required property\n' + ' "__hash__()" should return an integer. The only required ' + 'property\n' ' is that objects which compare equal have the same hash ' 'value; it is\n' - ' advised to somehow mix together (e.g. using exclusive ' - 'or) the hash\n' - ' values for the components of the object that also play a ' - 'part in\n' - ' comparison of objects.\n' + ' advised to mix together the hash values of the ' + 'components of the\n' + ' object that also play a part in comparison of objects by ' + 'packing\n' + ' them into a tuple and hashing the tuple. Example:\n' + '\n' + ' def __hash__(self):\n' + ' return hash((self.name, self.nick, self.color))\n' '\n' ' Note: "hash()" truncates the value returned from an ' "object's\n" @@ -3211,8 +3208,8 @@ 'attempts to\n' ' retrieve their hash value, and will also be correctly ' 'identified as\n' - ' unhashable when checking "isinstance(obj, ' - 'collections.Hashable)".\n' + ' unhashable when checking "isinstance(obj,\n' + ' collections.abc.Hashable)".\n' '\n' ' If a class that overrides "__eq__()" needs to retain ' 'the\n' @@ -3229,8 +3226,8 @@ 'that\n' ' explicitly raises a "TypeError" would be incorrectly ' 'identified as\n' - ' hashable by an "isinstance(obj, collections.Hashable)" ' - 'call.\n' + ' hashable by an "isinstance(obj, ' + 'collections.abc.Hashable)" call.\n' '\n' ' Note: By default, the "__hash__()" values of str, bytes ' 'and\n' @@ -3272,8 +3269,7 @@ ' neither "__len__()" nor "__bool__()", all its instances ' 'are\n' ' considered true.\n', - 'debugger': '\n' - '"pdb" --- The Python Debugger\n' + 'debugger': '"pdb" --- The Python Debugger\n' '*****************************\n' '\n' '**Source code:** Lib/pdb.py\n' @@ -3360,7 +3356,7 @@ ' >>> import mymodule\n' ' >>> mymodule.test()\n' ' Traceback (most recent call last):\n' - ' File "", line 1, in ?\n' + ' File "", line 1, in \n' ' File "./mymodule.py", line 4, in test\n' ' test2()\n' ' File "./mymodule.py", line 3, in test2\n' @@ -3702,7 +3698,7 @@ ' end). This is because any time you resume execution (even ' 'with a\n' ' simple next or step), you may encounter another ' - 'breakpoint--which\n' + 'breakpoint?which\n' ' could have its own command list, leading to ambiguities about ' 'which\n' ' list to execute.\n' @@ -3938,8 +3934,7 @@ '[1] Whether a frame is considered to originate in a certain ' 'module\n' ' is determined by the "__name__" in the frame globals.\n', - 'del': '\n' - 'The "del" statement\n' + 'del': 'The "del" statement\n' '*******************\n' '\n' ' del_stmt ::= "del" target_list\n' @@ -3968,8 +3963,7 @@ 'Changed in version 3.2: Previously it was illegal to delete a name\n' 'from the local namespace if it occurs as a free variable in a nested\n' 'block.\n', - 'dict': '\n' - 'Dictionary displays\n' + 'dict': 'Dictionary displays\n' '*******************\n' '\n' 'A dictionary display is a possibly empty series of key/datum pairs\n' @@ -4013,8 +4007,7 @@ 'should be *hashable*, which excludes all mutable objects.) Clashes\n' 'between duplicate keys are not detected; the last datum (textually\n' 'rightmost in the display) stored for a given key value prevails.\n', - 'dynamic-features': '\n' - 'Interaction with dynamic features\n' + 'dynamic-features': 'Interaction with dynamic features\n' '*********************************\n' '\n' 'Name resolution of free variables occurs at runtime, not ' @@ -4027,16 +4020,6 @@ ' i = 42\n' ' f()\n' '\n' - 'There are several cases where Python statements are ' - 'illegal when used\n' - 'in conjunction with nested scopes that contain free ' - 'variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is ' - 'illegal to\n' - 'delete the name. An error will be reported at compile ' - 'time.\n' - '\n' 'The "eval()" and "exec()" functions do not have access ' 'to the full\n' 'environment for resolving names. Names may be resolved ' @@ -4050,8 +4033,7 @@ 'override the global and local namespace. If only one ' 'namespace is\n' 'specified, it is used for both.\n', - 'else': '\n' - 'The "if" statement\n' + 'else': 'The "if" statement\n' '******************\n' '\n' 'The "if" statement is used for conditional execution:\n' @@ -4068,8 +4050,7 @@ '(and no other part of the "if" statement is executed or evaluated).\n' 'If all expressions are false, the suite of the "else" clause, if\n' 'present, is executed.\n', - 'exceptions': '\n' - 'Exceptions\n' + 'exceptions': 'Exceptions\n' '**********\n' '\n' 'Exceptions are a means of breaking out of the normal flow of ' @@ -4145,8 +4126,7 @@ ' these operations is not available at the time the module ' 'is\n' ' compiled.\n', - 'execmodel': '\n' - 'Execution model\n' + 'execmodel': 'Execution model\n' '***************\n' '\n' '\n' @@ -4343,6 +4323,13 @@ 'Builtins and restricted execution\n' '---------------------------------\n' '\n' + '**CPython implementation detail:** Users should not touch\n' + '"__builtins__"; it is strictly an implementation detail. ' + 'Users\n' + 'wanting to override values in the builtins namespace should ' + '"import"\n' + 'the "builtins" module and modify its attributes appropriately.\n' + '\n' 'The builtins namespace associated with the execution of a code ' 'block\n' 'is actually found by looking up the name "__builtins__" in its ' @@ -4355,16 +4342,7 @@ 'in any\n' 'other module, "__builtins__" is an alias for the dictionary of ' 'the\n' - '"builtins" module itself. "__builtins__" can be set to a ' - 'user-created\n' - 'dictionary to create a weak form of restricted execution.\n' - '\n' - '**CPython implementation detail:** Users should not touch\n' - '"__builtins__"; it is strictly an implementation detail. ' - 'Users\n' - 'wanting to override values in the builtins namespace should ' - '"import"\n' - 'the "builtins" module and modify its attributes appropriately.\n' + '"builtins" module itself.\n' '\n' '\n' 'Interaction with dynamic features\n' @@ -4380,14 +4358,6 @@ ' i = 42\n' ' f()\n' '\n' - 'There are several cases where Python statements are illegal ' - 'when used\n' - 'in conjunction with nested scopes that contain free variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is ' - 'illegal to\n' - 'delete the name. An error will be reported at compile time.\n' - '\n' 'The "eval()" and "exec()" functions do not have access to the ' 'full\n' 'environment for resolving names. Names may be resolved in the ' @@ -4477,8 +4447,7 @@ ' these operations is not available at the time the module ' 'is\n' ' compiled.\n', - 'exprlists': '\n' - 'Expression lists\n' + 'exprlists': 'Expression lists\n' '****************\n' '\n' ' expression_list ::= expression ( "," expression )* [","]\n' @@ -4515,8 +4484,7 @@ 'value of that expression. (To create an empty tuple, use an ' 'empty pair\n' 'of parentheses: "()".)\n', - 'floating': '\n' - 'Floating point literals\n' + 'floating': 'Floating point literals\n' '***********************\n' '\n' 'Floating point literals are described by the following lexical\n' @@ -4552,8 +4520,7 @@ 'Changed in version 3.6: Underscores are now allowed for ' 'grouping\n' 'purposes in literals.\n', - 'for': '\n' - 'The "for" statement\n' + 'for': 'The "for" statement\n' '*******************\n' '\n' 'The "for" statement is used to iterate over the elements of a ' @@ -4625,8 +4592,7 @@ '\n' ' for x in a[:]:\n' ' if x < 0: a.remove(x)\n', - 'formatstrings': '\n' - 'Format String Syntax\n' + 'formatstrings': 'Format String Syntax\n' '********************\n' '\n' 'The "str.format()" method and the "Formatter" class share ' @@ -5066,9 +5032,9 @@ 'be formatted\n' 'with the floating point presentation types listed below ' '(except "\'n\'"\n' - 'and None). When doing so, "float()" is used to convert the ' - 'integer to\n' - 'a floating point number before formatting.\n' + 'and "None"). When doing so, "float()" is used to convert ' + 'the integer\n' + 'to a floating point number before formatting.\n' '\n' 'The available presentation types for floating point and ' 'decimal values\n' @@ -5345,8 +5311,7 @@ ' 9 9 11 1001\n' ' 10 A 12 1010\n' ' 11 B 13 1011\n', - 'function': '\n' - 'Function definitions\n' + 'function': 'Function definitions\n' '********************\n' '\n' 'A function definition defines a user-defined function object ' @@ -5515,8 +5480,7 @@ '\n' ' **PEP 3107** - Function Annotations\n' ' The original specification for function annotations.\n', - 'global': '\n' - 'The "global" statement\n' + 'global': 'The "global" statement\n' '**********************\n' '\n' ' global_stmt ::= "global" identifier ("," identifier)*\n' @@ -5547,8 +5511,8 @@ 'change\n' 'the meaning of the program.\n' '\n' - '**Programmer\'s note:** the "global" is a directive to the ' - 'parser. It\n' + '**Programmer\'s note:** "global" is a directive to the parser. ' + 'It\n' 'applies only to code parsed at the same time as the "global"\n' 'statement. In particular, a "global" statement contained in a ' 'string\n' @@ -5560,8 +5524,7 @@ 'code containing the function call. The same applies to the ' '"eval()"\n' 'and "compile()" functions.\n', - 'id-classes': '\n' - 'Reserved classes of identifiers\n' + 'id-classes': 'Reserved classes of identifiers\n' '*******************************\n' '\n' 'Certain classes of identifiers (besides keywords) have ' @@ -5609,8 +5572,7 @@ ' to help avoid name clashes between "private" attributes of ' 'base and\n' ' derived classes. See section Identifiers (Names).\n', - 'identifiers': '\n' - 'Identifiers and keywords\n' + 'identifiers': 'Identifiers and keywords\n' '************************\n' '\n' 'Identifiers (also referred to as *names*) are described by ' @@ -5758,8 +5720,7 @@ ' to help avoid name clashes between "private" attributes of ' 'base and\n' ' derived classes. See section Identifiers (Names).\n', - 'if': '\n' - 'The "if" statement\n' + 'if': 'The "if" statement\n' '******************\n' '\n' 'The "if" statement is used for conditional execution:\n' @@ -5775,8 +5736,7 @@ '(and no other part of the "if" statement is executed or evaluated).\n' 'If all expressions are false, the suite of the "else" clause, if\n' 'present, is executed.\n', - 'imaginary': '\n' - 'Imaginary literals\n' + 'imaginary': 'Imaginary literals\n' '******************\n' '\n' 'Imaginary literals are described by the following lexical ' @@ -5796,8 +5756,7 @@ '\n' ' 3.14j 10.j 10j .001j 1e100j 3.14e-10j ' '3.14_15_93j\n', - 'import': '\n' - 'The "import" statement\n' + 'import': 'The "import" statement\n' '**********************\n' '\n' ' import_stmt ::= "import" module ["as" name] ( "," module ' @@ -6058,13 +6017,13 @@ '\n' ' **PEP 236** - Back to the __future__\n' ' The original proposal for the __future__ mechanism.\n', - 'in': '\n' - 'Membership test operations\n' + 'in': 'Membership test operations\n' '**************************\n' '\n' 'The operators "in" and "not in" test for membership. "x in s"\n' - 'evaluates to true if *x* is a member of *s*, and false otherwise. "x\n' - 'not in s" returns the negation of "x in s". All built-in sequences\n' + 'evaluates to "True" if *x* is a member of *s*, and "False" otherwise.\n' + '"x not in s" returns the negation of "x in s". All built-in ' + 'sequences\n' 'and set types support this as well as dictionary, for which "in" ' 'tests\n' 'whether the dictionary has a given key. For container types such as\n' @@ -6072,30 +6031,29 @@ 'expression "x in y" is equivalent to "any(x is e or x == e for e in\n' 'y)".\n' '\n' - 'For the string and bytes types, "x in y" is true if and only if *x* ' - 'is\n' - 'a substring of *y*. An equivalent test is "y.find(x) != -1". Empty\n' - 'strings are always considered to be a substring of any other string,\n' - 'so """ in "abc"" will return "True".\n' + 'For the string and bytes types, "x in y" is "True" if and only if *x*\n' + 'is a substring of *y*. An equivalent test is "y.find(x) != -1".\n' + 'Empty strings are always considered to be a substring of any other\n' + 'string, so """ in "abc"" will return "True".\n' '\n' 'For user-defined classes which define the "__contains__()" method, "x\n' - 'in y" is true if and only if "y.__contains__(x)" is true.\n' + 'in y" returns "True" if "y.__contains__(x)" returns a true value, and\n' + '"False" otherwise.\n' '\n' 'For user-defined classes which do not define "__contains__()" but do\n' - 'define "__iter__()", "x in y" is true if some value "z" with "x == z"\n' - 'is produced while iterating over "y". If an exception is raised\n' + 'define "__iter__()", "x in y" is "True" if some value "z" with "x ==\n' + 'z" is produced while iterating over "y". If an exception is raised\n' 'during the iteration, it is as if "in" raised that exception.\n' '\n' 'Lastly, the old-style iteration protocol is tried: if a class defines\n' - '"__getitem__()", "x in y" is true if and only if there is a non-\n' + '"__getitem__()", "x in y" is "True" if and only if there is a non-\n' 'negative integer index *i* such that "x == y[i]", and all lower\n' 'integer indices do not raise "IndexError" exception. (If any other\n' 'exception is raised, it is as if "in" raised that exception).\n' '\n' 'The operator "not in" is defined to have the inverse true value of\n' '"in".\n', - 'integers': '\n' - 'Integer literals\n' + 'integers': 'Integer literals\n' '****************\n' '\n' 'Integer literals are described by the following lexical ' @@ -6141,8 +6099,7 @@ 'Changed in version 3.6: Underscores are now allowed for ' 'grouping\n' 'purposes in literals.\n', - 'lambda': '\n' - 'Lambdas\n' + 'lambda': 'Lambdas\n' '*******\n' '\n' ' lambda_expr ::= "lambda" [parameter_list]: expression\n' @@ -6165,8 +6122,7 @@ 'Note that functions created with lambda expressions cannot ' 'contain\n' 'statements or annotations.\n', - 'lists': '\n' - 'List displays\n' + 'lists': 'List displays\n' '*************\n' '\n' 'A list display is a possibly empty series of expressions enclosed ' @@ -6183,8 +6139,7 @@ 'from left to right and placed into the list object in that order.\n' 'When a comprehension is supplied, the list is constructed from the\n' 'elements resulting from the comprehension.\n', - 'naming': '\n' - 'Naming and binding\n' + 'naming': 'Naming and binding\n' '******************\n' '\n' '\n' @@ -6341,6 +6296,12 @@ 'Builtins and restricted execution\n' '=================================\n' '\n' + '**CPython implementation detail:** Users should not touch\n' + '"__builtins__"; it is strictly an implementation detail. Users\n' + 'wanting to override values in the builtins namespace should ' + '"import"\n' + 'the "builtins" module and modify its attributes appropriately.\n' + '\n' 'The builtins namespace associated with the execution of a code ' 'block\n' 'is actually found by looking up the name "__builtins__" in its ' @@ -6353,15 +6314,7 @@ 'any\n' 'other module, "__builtins__" is an alias for the dictionary of ' 'the\n' - '"builtins" module itself. "__builtins__" can be set to a ' - 'user-created\n' - 'dictionary to create a weak form of restricted execution.\n' - '\n' - '**CPython implementation detail:** Users should not touch\n' - '"__builtins__"; it is strictly an implementation detail. Users\n' - 'wanting to override values in the builtins namespace should ' - '"import"\n' - 'the "builtins" module and modify its attributes appropriately.\n' + '"builtins" module itself.\n' '\n' '\n' 'Interaction with dynamic features\n' @@ -6377,14 +6330,6 @@ ' i = 42\n' ' f()\n' '\n' - 'There are several cases where Python statements are illegal when ' - 'used\n' - 'in conjunction with nested scopes that contain free variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is illegal ' - 'to\n' - 'delete the name. An error will be reported at compile time.\n' - '\n' 'The "eval()" and "exec()" functions do not have access to the ' 'full\n' 'environment for resolving names. Names may be resolved in the ' @@ -6397,8 +6342,7 @@ 'override the global and local namespace. If only one namespace ' 'is\n' 'specified, it is used for both.\n', - 'nonlocal': '\n' - 'The "nonlocal" statement\n' + 'nonlocal': 'The "nonlocal" statement\n' '************************\n' '\n' ' nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n' @@ -6429,8 +6373,7 @@ '\n' ' **PEP 3104** - Access to Names in Outer Scopes\n' ' The specification for the "nonlocal" statement.\n', - 'numbers': '\n' - 'Numeric literals\n' + 'numbers': 'Numeric literals\n' '****************\n' '\n' 'There are three types of numeric literals: integers, floating ' @@ -6444,8 +6387,7 @@ 'is actually an expression composed of the unary operator \'"-"\' ' 'and the\n' 'literal "1".\n', - 'numeric-types': '\n' - 'Emulating numeric types\n' + 'numeric-types': 'Emulating numeric types\n' '***********************\n' '\n' 'The following methods can be defined to emulate numeric ' @@ -6621,8 +6563,7 @@ ' "__index__()" is defined "__int__()" should also be ' 'defined, and\n' ' both should return the same value.\n', - 'objects': '\n' - 'Objects, values and types\n' + 'objects': 'Objects, values and types\n' '*************************\n' '\n' "*Objects* are Python's abstraction for data. All data in a " @@ -6750,8 +6691,7 @@ 'created empty lists. (Note that "c = d = []" assigns the same ' 'object\n' 'to both "c" and "d".)\n', - 'operator-summary': '\n' - 'Operator precedence\n' + 'operator-summary': 'Operator precedence\n' '*******************\n' '\n' 'The following table summarizes the operator precedence ' @@ -6812,7 +6752,9 @@ 'Addition and subtraction |\n' '+-------------------------------------------------+---------------------------------------+\n' '| "*", "@", "/", "//", "%" | ' - 'Multiplication, matrix multiplication |\n' + 'Multiplication, matrix |\n' + '| | ' + 'multiplication, division, floor |\n' '| | ' 'division, remainder [5] |\n' '+-------------------------------------------------+---------------------------------------+\n' @@ -6924,8 +6866,7 @@ 'arithmetic\n' ' or bitwise unary operator on its right, that is, ' '"2**-1" is "0.5".\n', - 'pass': '\n' - 'The "pass" statement\n' + 'pass': 'The "pass" statement\n' '********************\n' '\n' ' pass_stmt ::= "pass"\n' @@ -6938,8 +6879,7 @@ ' def f(arg): pass # a function that does nothing (yet)\n' '\n' ' class C: pass # a class with no methods (yet)\n', - 'power': '\n' - 'The power operator\n' + 'power': 'The power operator\n' '******************\n' '\n' 'The power operator binds more tightly than unary operators on its\n' @@ -6973,8 +6913,7 @@ 'Raising a negative number to a fractional power results in a ' '"complex"\n' 'number. (In earlier versions it raised a "ValueError".)\n', - 'raise': '\n' - 'The "raise" statement\n' + 'raise': 'The "raise" statement\n' '*********************\n' '\n' ' raise_stmt ::= "raise" [expression ["from" expression]]\n' @@ -7024,7 +6963,7 @@ ' ...\n' ' Traceback (most recent call last):\n' ' File "", line 2, in \n' - ' ZeroDivisionError: int division or modulo by zero\n' + ' ZeroDivisionError: division by zero\n' '\n' ' The above exception was the direct cause of the following ' 'exception:\n' @@ -7046,7 +6985,7 @@ ' ...\n' ' Traceback (most recent call last):\n' ' File "", line 2, in \n' - ' ZeroDivisionError: int division or modulo by zero\n' + ' ZeroDivisionError: division by zero\n' '\n' ' During handling of the above exception, another exception ' 'occurred:\n' @@ -7055,12 +6994,31 @@ ' File "", line 4, in \n' ' RuntimeError: Something bad happened\n' '\n' + 'Exception chaining can be explicitly suppressed by specifying ' + '"None"\n' + 'in the "from" clause:\n' + '\n' + ' >>> try:\n' + ' ... print(1 / 0)\n' + ' ... except:\n' + ' ... raise RuntimeError("Something bad happened") from None\n' + ' ...\n' + ' Traceback (most recent call last):\n' + ' File "", line 4, in \n' + ' RuntimeError: Something bad happened\n' + '\n' 'Additional information on exceptions can be found in section\n' 'Exceptions, and information about handling exceptions is in ' 'section\n' - 'The try statement.\n', - 'return': '\n' - 'The "return" statement\n' + 'The try statement.\n' + '\n' + 'Changed in version 3.3: "None" is now permitted as "Y" in "raise X\n' + 'from Y".\n' + '\n' + 'New in version 3.3: The "__suppress_context__" attribute to ' + 'suppress\n' + 'automatic display of the exception context.\n', + 'return': 'The "return" statement\n' '**********************\n' '\n' ' return_stmt ::= "return" [expression_list]\n' @@ -7087,9 +7045,15 @@ 'generator is done and will cause "StopIteration" to be raised. ' 'The\n' 'returned value (if any) is used as an argument to construct\n' - '"StopIteration" and becomes the "StopIteration.value" attribute.\n', - 'sequence-types': '\n' - 'Emulating container types\n' + '"StopIteration" and becomes the "StopIteration.value" attribute.\n' + '\n' + 'In an asynchronous generator function, an empty "return" ' + 'statement\n' + 'indicates that the asynchronous generator is done and will cause\n' + '"StopAsyncIteration" to be raised. A non-empty "return" statement ' + 'is\n' + 'a syntax error in an asynchronous generator function.\n', + 'sequence-types': 'Emulating container types\n' '*************************\n' '\n' 'The following methods can be defined to implement ' @@ -7114,7 +7078,7 @@ '"update()"\n' "behaving similar to those for Python's standard dictionary " 'objects.\n' - 'The "collections" module provides a "MutableMapping" ' + 'The "collections.abc" module provides a "MutableMapping" ' 'abstract base\n' 'class to help create those methods from a base set of ' '"__getitem__()",\n' @@ -7161,6 +7125,16 @@ ' returns zero is considered to be false in a Boolean ' 'context.\n' '\n' + ' **CPython implementation detail:** In CPython, the ' + 'length is\n' + ' required to be at most "sys.maxsize". If the length is ' + 'larger than\n' + ' "sys.maxsize" some features (such as "len()") may ' + 'raise\n' + ' "OverflowError". To prevent raising "OverflowError" by ' + 'truth value\n' + ' testing, an object must define a "__bool__()" method.\n' + '\n' 'object.__length_hint__(self)\n' '\n' ' Called to implement "operator.length_hint()". Should ' @@ -7310,8 +7284,7 @@ ' iteration protocol via "__getitem__()", see this ' 'section in the\n' ' language reference.\n', - 'shifting': '\n' - 'Shifting operations\n' + 'shifting': 'Shifting operations\n' '*******************\n' '\n' 'The shifting operations have lower priority than the arithmetic\n' @@ -7328,15 +7301,8 @@ 'A right shift by *n* bits is defined as floor division by ' '"pow(2,n)".\n' 'A left shift by *n* bits is defined as multiplication with ' - '"pow(2,n)".\n' - '\n' - 'Note: In the current implementation, the right-hand operand is\n' - ' required to be at most "sys.maxsize". If the right-hand ' - 'operand is\n' - ' larger than "sys.maxsize" an "OverflowError" exception is ' - 'raised.\n', - 'slicings': '\n' - 'Slicings\n' + '"pow(2,n)".\n', + 'slicings': 'Slicings\n' '********\n' '\n' 'A slicing selects a range of items in a sequence object (e.g., ' @@ -7387,8 +7353,7 @@ 'as lower bound, upper bound and stride, respectively, ' 'substituting\n' '"None" for missing expressions.\n', - 'specialattrs': '\n' - 'Special Attributes\n' + 'specialattrs': 'Special Attributes\n' '******************\n' '\n' 'The implementation adds a few special read-only attributes ' @@ -7473,8 +7438,7 @@ '[5] To format only a tuple you should therefore provide a\n' ' singleton tuple whose only element is the tuple to be ' 'formatted.\n', - 'specialnames': '\n' - 'Special method names\n' + 'specialnames': 'Special method names\n' '********************\n' '\n' 'A class can implement certain operations that are invoked by ' @@ -7540,11 +7504,11 @@ ' Typical implementations create a new instance of the ' 'class by\n' ' invoking the superclass\'s "__new__()" method using\n' - ' "super(currentclass, cls).__new__(cls[, ...])" with ' - 'appropriate\n' - ' arguments and then modifying the newly-created instance ' - 'as\n' - ' necessary before returning it.\n' + ' "super().__new__(cls[, ...])" with appropriate arguments ' + 'and then\n' + ' modifying the newly-created instance as necessary before ' + 'returning\n' + ' it.\n' '\n' ' If "__new__()" returns an instance of *cls*, then the ' 'new\n' @@ -7579,7 +7543,7 @@ ' any, must explicitly call it to ensure proper ' 'initialization of the\n' ' base class part of the instance; for example:\n' - ' "BaseClass.__init__(self, [args...])".\n' + ' "super().__init__([args...])".\n' '\n' ' Because "__new__()" and "__init__()" work together in ' 'constructing\n' @@ -7726,8 +7690,8 @@ '\n' 'object.__bytes__(self)\n' '\n' - ' Called by "bytes()" to compute a byte-string ' - 'representation of an\n' + ' Called by bytes to compute a byte-string representation ' + 'of an\n' ' object. This should return a "bytes" object.\n' '\n' 'object.__format__(self, format_spec)\n' @@ -7760,6 +7724,11 @@ 'itself\n' ' raises a "TypeError" if passed any non-empty string.\n' '\n' + ' Changed in version 3.7: "object.__format__(x, \'\')" is ' + 'now\n' + ' equivalent to "str(x)" rather than "format(str(self), ' + '\'\')".\n' + '\n' 'object.__lt__(self, other)\n' 'object.__le__(self, other)\n' 'object.__eq__(self, other)\n' @@ -7835,15 +7804,18 @@ 'on members\n' ' of hashed collections including "set", "frozenset", and ' '"dict".\n' - ' "__hash__()" should return an integer. The only required ' + ' "__hash__()" should return an integer. The only required ' 'property\n' ' is that objects which compare equal have the same hash ' 'value; it is\n' - ' advised to somehow mix together (e.g. using exclusive or) ' - 'the hash\n' - ' values for the components of the object that also play a ' - 'part in\n' - ' comparison of objects.\n' + ' advised to mix together the hash values of the components ' + 'of the\n' + ' object that also play a part in comparison of objects by ' + 'packing\n' + ' them into a tuple and hashing the tuple. Example:\n' + '\n' + ' def __hash__(self):\n' + ' return hash((self.name, self.nick, self.color))\n' '\n' ' Note: "hash()" truncates the value returned from an ' "object's\n" @@ -7893,8 +7865,8 @@ 'attempts to\n' ' retrieve their hash value, and will also be correctly ' 'identified as\n' - ' unhashable when checking "isinstance(obj, ' - 'collections.Hashable)".\n' + ' unhashable when checking "isinstance(obj,\n' + ' collections.abc.Hashable)".\n' '\n' ' If a class that overrides "__eq__()" needs to retain the\n' ' implementation of "__hash__()" from a parent class, the ' @@ -7910,8 +7882,8 @@ 'that\n' ' explicitly raises a "TypeError" would be incorrectly ' 'identified as\n' - ' hashable by an "isinstance(obj, collections.Hashable)" ' - 'call.\n' + ' hashable by an "isinstance(obj, ' + 'collections.abc.Hashable)" call.\n' '\n' ' Note: By default, the "__hash__()" values of str, bytes ' 'and\n' @@ -8221,23 +8193,14 @@ '__slots__\n' '---------\n' '\n' - 'By default, instances of classes have a dictionary for ' - 'attribute\n' - 'storage. This wastes space for objects having very few ' - 'instance\n' - 'variables. The space consumption can become acute when ' - 'creating large\n' - 'numbers of instances.\n' + '*__slots__* allow us to explicitly declare data members ' + '(like\n' + 'properties) and deny the creation of *__dict__* and ' + '*__weakref__*\n' + '(unless explicitly declared in *__slots__* or available in a ' + 'parent.)\n' '\n' - 'The default can be overridden by defining *__slots__* in a ' - 'class\n' - 'definition. The *__slots__* declaration takes a sequence of ' - 'instance\n' - 'variables and reserves just enough space in each instance to ' - 'hold a\n' - 'value for each variable. Space is saved because *__dict__* ' - 'is not\n' - 'created for each instance.\n' + 'The space saved over using *__dict__* can be significant.\n' '\n' 'object.__slots__\n' '\n' @@ -8257,9 +8220,9 @@ '\n' '* When inheriting from a class without *__slots__*, the ' '*__dict__*\n' - ' attribute of that class will always be accessible, so a ' - '*__slots__*\n' - ' definition in the subclass is meaningless.\n' + ' and *__weakref__* attribute of the instances will always ' + 'be\n' + ' accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' @@ -8291,13 +8254,16 @@ 'class\n' ' attribute would overwrite the descriptor assignment.\n' '\n' - '* The action of a *__slots__* declaration is limited to the ' - 'class\n' - ' where it is defined. As a result, subclasses will have a ' - '*__dict__*\n' - ' unless they also define *__slots__* (which must only ' - 'contain names\n' - ' of any *additional* slots).\n' + '* The action of a *__slots__* declaration is not limited to ' + 'the\n' + ' class where it is defined. *__slots__* declared in ' + 'parents are\n' + ' available in child classes. However, child subclasses will ' + 'get a\n' + ' *__dict__* and *__weakref__* unless they also define ' + '*__slots__*\n' + ' (which should only contain names of any *additional* ' + 'slots).\n' '\n' '* If a class defines a slot also defined in a base class, ' 'the\n' @@ -8324,6 +8290,14 @@ 'same\n' ' *__slots__*.\n' '\n' + '* Multiple inheritance with multiple slotted parent classes ' + 'can be\n' + ' used, but only one parent is allowed to have attributes ' + 'created by\n' + ' slots (the other bases must have empty slot layouts) - ' + 'violations\n' + ' raise "TypeError".\n' + '\n' '\n' 'Customizing class creation\n' '==========================\n' @@ -8503,9 +8477,10 @@ 'defined at the\n' 'class scope. Class variables must be accessed through the ' 'first\n' - 'parameter of instance or class methods, and cannot be ' - 'accessed at all\n' - 'from static methods.\n' + 'parameter of instance or class methods, or through the ' + 'implicit\n' + 'lexically scoped "__class__" reference described in the next ' + 'section.\n' '\n' '\n' 'Creating the class object\n' @@ -8535,6 +8510,38 @@ 'passed to the\n' 'method.\n' '\n' + '**CPython implementation detail:** In CPython 3.6 and later, ' + 'the\n' + '"__class__" cell is passed to the metaclass as a ' + '"__classcell__" entry\n' + 'in the class namespace. If present, this must be propagated ' + 'up to the\n' + '"type.__new__" call in order for the class to be ' + 'initialised\n' + 'correctly. Failing to do so will result in a ' + '"DeprecationWarning" in\n' + 'Python 3.6, and a "RuntimeWarning" in the future.\n' + '\n' + 'When using the default metaclass "type", or any metaclass ' + 'that\n' + 'ultimately calls "type.__new__", the following additional\n' + 'customisation steps are invoked after creating the class ' + 'object:\n' + '\n' + '* first, "type.__new__" collects all of the descriptors in ' + 'the class\n' + ' namespace that define a "__set_name__()" method;\n' + '\n' + '* second, all of these "__set_name__" methods are called ' + 'with the\n' + ' class being defined and the assigned name of that ' + 'particular\n' + ' descriptor; and\n' + '\n' + '* finally, the "__init_subclass__()" hook is called on the ' + 'immediate\n' + ' parent of the new class in its method resolution order.\n' + '\n' 'After the class object is created, it is passed to the ' 'class\n' 'decorators included in the class definition (if any) and the ' @@ -8562,7 +8569,7 @@ '\n' 'The potential uses for metaclasses are boundless. Some ideas ' 'that have\n' - 'been explored include logging, interface checking, ' + 'been explored include enum, logging, interface checking, ' 'automatic\n' 'delegation, automatic property creation, proxies, ' 'frameworks, and\n' @@ -8701,7 +8708,7 @@ '"update()"\n' "behaving similar to those for Python's standard dictionary " 'objects.\n' - 'The "collections" module provides a "MutableMapping" ' + 'The "collections.abc" module provides a "MutableMapping" ' 'abstract base\n' 'class to help create those methods from a base set of ' '"__getitem__()",\n' @@ -8747,6 +8754,15 @@ ' returns zero is considered to be false in a Boolean ' 'context.\n' '\n' + ' **CPython implementation detail:** In CPython, the length ' + 'is\n' + ' required to be at most "sys.maxsize". If the length is ' + 'larger than\n' + ' "sys.maxsize" some features (such as "len()") may raise\n' + ' "OverflowError". To prevent raising "OverflowError" by ' + 'truth value\n' + ' testing, an object must define a "__bool__()" method.\n' + '\n' 'object.__length_hint__(self)\n' '\n' ' Called to implement "operator.length_hint()". Should ' @@ -9229,8 +9245,7 @@ 'special method *must* be set on the class object itself in ' 'order to be\n' 'consistently invoked by the interpreter).\n', - 'string-methods': '\n' - 'String Methods\n' + 'string-methods': 'String Methods\n' '**************\n' '\n' 'Strings implement all of the common sequence operations, ' @@ -9467,12 +9482,11 @@ 'characters\n' ' and there is at least one character, false otherwise. ' 'Decimal\n' - ' characters are those from general category "Nd". This ' - 'category\n' - ' includes digit characters, and all characters that can ' - 'be used to\n' - ' form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC ' - 'DIGIT ZERO.\n' + ' characters are those that can be used to form numbers ' + 'in base 10,\n' + ' e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a ' + 'decimal character\n' + ' is a character in the Unicode General Category "Nd".\n' '\n' 'str.isdigit()\n' '\n' @@ -9482,10 +9496,13 @@ 'include decimal\n' ' characters and digits that need special handling, such ' 'as the\n' - ' compatibility superscript digits. Formally, a digit is ' - 'a character\n' - ' that has the property value Numeric_Type=Digit or\n' - ' Numeric_Type=Decimal.\n' + ' compatibility superscript digits. This covers digits ' + 'which cannot\n' + ' be used to form numbers in base 10, like the Kharosthi ' + 'numbers.\n' + ' Formally, a digit is a character that has the property ' + 'value\n' + ' Numeric_Type=Digit or Numeric_Type=Decimal.\n' '\n' 'str.isidentifier()\n' '\n' @@ -9570,13 +9587,13 @@ 'str.join(iterable)\n' '\n' ' Return a string which is the concatenation of the ' - 'strings in the\n' - ' *iterable* *iterable*. A "TypeError" will be raised if ' - 'there are\n' - ' any non-string values in *iterable*, including "bytes" ' - 'objects.\n' - ' The separator between elements is the string providing ' - 'this method.\n' + 'strings in\n' + ' *iterable*. A "TypeError" will be raised if there are ' + 'any non-\n' + ' string values in *iterable*, including "bytes" ' + 'objects. The\n' + ' separator between elements is the string providing this ' + 'method.\n' '\n' 'str.ljust(width[, fillchar])\n' '\n' @@ -9626,7 +9643,7 @@ ' Unicode ordinals (integers) or characters (strings of ' 'length 1) to\n' ' Unicode ordinals, strings (of arbitrary lengths) or ' - 'None.\n' + '"None".\n' ' Character keys will then be converted to ordinals.\n' '\n' ' If there are two arguments, they must be strings of ' @@ -9637,7 +9654,7 @@ 'is a third\n' ' argument, it must be a string, whose characters will be ' 'mapped to\n' - ' None in the result.\n' + ' "None" in the result.\n' '\n' 'str.partition(sep)\n' '\n' @@ -10031,8 +10048,7 @@ " '00042'\n" ' >>> "-42".zfill(5)\n' " '-0042'\n", - 'strings': '\n' - 'String and Bytes literals\n' + 'strings': 'String and Bytes literals\n' '*************************\n' '\n' 'String literals are described by the following lexical ' @@ -10266,8 +10282,7 @@ 'followed by a newline is interpreted as those two characters as ' 'part\n' 'of the literal, *not* as a line continuation.\n', - 'subscriptions': '\n' - 'Subscriptions\n' + 'subscriptions': 'Subscriptions\n' '*************\n' '\n' 'A subscription selects an item of a sequence (string, tuple ' @@ -10324,32 +10339,26 @@ "A string's items are characters. A character is not a " 'separate data\n' 'type but a string of exactly one character.\n', - 'truth': '\n' - 'Truth Value Testing\n' + 'truth': 'Truth Value Testing\n' '*******************\n' '\n' 'Any object can be tested for truth value, for use in an "if" or\n' - '"while" condition or as operand of the Boolean operations below. ' - 'The\n' - 'following values are considered false:\n' - '\n' - '* "None"\n' - '\n' - '* "False"\n' + '"while" condition or as operand of the Boolean operations below.\n' '\n' - '* zero of any numeric type, for example, "0", "0.0", "0j".\n' - '\n' - '* any empty sequence, for example, "\'\'", "()", "[]".\n' + 'By default, an object is considered true unless its class defines\n' + 'either a "__bool__()" method that returns "False" or a "__len__()"\n' + 'method that returns zero, when called with the object. [1] Here ' + 'are\n' + 'most of the built-in objects considered false:\n' '\n' - '* any empty mapping, for example, "{}".\n' + '* constants defined to be false: "None" and "False".\n' '\n' - '* instances of user-defined classes, if the class defines a\n' - ' "__bool__()" or "__len__()" method, when that method returns the\n' - ' integer zero or "bool" value "False". [1]\n' + '* zero of any numeric type: "0", "0.0", "0j", "Decimal(0)",\n' + ' "Fraction(0, 1)"\n' '\n' - 'All other values are considered true --- so objects of many types ' - 'are\n' - 'always true.\n' + '* empty sequences and collections: "\'\'", "()", "[]", "{}", ' + '"set()",\n' + ' "range(0)"\n' '\n' 'Operations and built-in functions that have a Boolean result ' 'always\n' @@ -10357,8 +10366,7 @@ 'otherwise stated. (Important exception: the Boolean operations ' '"or"\n' 'and "and" always return one of their operands.)\n', - 'try': '\n' - 'The "try" statement\n' + 'try': 'The "try" statement\n' '*******************\n' '\n' 'The "try" statement specifies exception handlers and/or cleanup code\n' @@ -10505,8 +10513,7 @@ 'Exceptions, and information on using the "raise" statement to ' 'generate\n' 'exceptions may be found in section The raise statement.\n', - 'types': '\n' - 'The standard type hierarchy\n' + 'types': 'The standard type hierarchy\n' '***************************\n' '\n' 'Below is a list of the types that are built into Python. ' @@ -10706,11 +10713,11 @@ '8-bit\n' ' bytes, represented by integers in the range 0 <= x < 256.\n' ' Bytes literals (like "b\'abc\'") and the built-in ' - 'function\n' - ' "bytes()" can be used to construct bytes objects. Also,\n' - ' bytes objects can be decoded to strings via the ' - '"decode()"\n' - ' method.\n' + '"bytes()"\n' + ' constructor can be used to create bytes objects. Also, ' + 'bytes\n' + ' objects can be decoded to strings via the "decode()" ' + 'method.\n' '\n' ' Mutable sequences\n' ' Mutable sequences can be changed after they are created. ' @@ -10736,7 +10743,7 @@ ' the built-in "bytearray()" constructor. Aside from being\n' ' mutable (and hence unhashable), byte arrays otherwise ' 'provide\n' - ' the same interface and functionality as immutable bytes\n' + ' the same interface and functionality as immutable "bytes"\n' ' objects.\n' '\n' ' The extension module "array" provides an additional example ' @@ -10902,7 +10909,11 @@ '| Read-only |\n' ' | | contain bindings for the ' '| |\n' - " | | function's free variables. " + " | | function's free variables. See " + '| |\n' + ' | | below for information on the ' + '| |\n' + ' | | "cell_contents" attribute. ' '| |\n' ' ' '+---------------------------+---------------------------------+-------------+\n' @@ -10941,6 +10952,9 @@ ' attributes on built-in functions may be supported in the\n' ' future.*\n' '\n' + ' A cell object has the attribute "cell_contents". This can be\n' + ' used to get the value of the cell, as well as set the value.\n' + '\n' " Additional information about a function's definition can be\n" ' retrieved from its code object; see the description of ' 'internal\n' @@ -11064,6 +11078,27 @@ 'statements.\n' ' See also the Coroutine Objects section.\n' '\n' + ' Asynchronous generator functions\n' + ' A function or method which is defined using "async def" and\n' + ' which uses the "yield" statement is called a *asynchronous\n' + ' generator function*. Such a function, when called, returns ' + 'an\n' + ' asynchronous iterator object which can be used in an "async ' + 'for"\n' + ' statement to execute the body of the function.\n' + '\n' + ' Calling the asynchronous iterator\'s "aiterator.__anext__()"\n' + ' method will return an *awaitable* which when awaited will\n' + ' execute until it provides a value using the "yield" ' + 'expression.\n' + ' When the function executes an empty "return" statement or ' + 'falls\n' + ' off the end, a "StopAsyncIteration" exception is raised and ' + 'the\n' + ' asynchronous iterator will have reached the end of the set ' + 'of\n' + ' values to be yielded.\n' + '\n' ' Built-in functions\n' ' A built-in function object is a wrapper around a C function.\n' ' Examples of built-in functions are "len()" and "math.sin()"\n' @@ -11200,14 +11235,14 @@ 'the\n' ' dictionary containing the class\'s namespace; "__bases__" is a ' 'tuple\n' - ' (possibly empty or a singleton) containing the base classes, in ' - 'the\n' - ' order of their occurrence in the base class list; "__doc__" is ' - 'the\n' - " class's documentation string, or None if undefined;\n" - ' "__annotations__" (optional) is a dictionary containing ' - '*variable\n' - ' annotations* collected during class body execution.\n' + ' containing the base classes, in the order of their occurrence ' + 'in\n' + ' the base class list; "__doc__" is the class\'s documentation ' + 'string,\n' + ' or "None" if undefined; "__annotations__" (optional) is a\n' + ' dictionary containing *variable annotations* collected during ' + 'class\n' + ' body execution.\n' '\n' 'Class instances\n' ' A class instance is created by calling a class object (see ' @@ -11363,17 +11398,26 @@ ' bytecode string of the code object).\n' '\n' ' Special writable attributes: "f_trace", if not "None", is a\n' - ' function called at the start of each source code line (this ' - 'is\n' - ' used by the debugger); "f_lineno" is the current line number ' - 'of\n' - ' the frame --- writing to this from within a trace function ' - 'jumps\n' - ' to the given line (only for the bottom-most frame). A ' - 'debugger\n' - ' can implement a Jump command (aka Set Next Statement) by ' + ' function called for various events during code execution ' + '(this\n' + ' is used by the debugger). Normally an event is triggered for\n' + ' each new source line - this can be disabled by setting\n' + ' "f_trace_lines" to "False".\n' + '\n' + ' Implementations *may* allow per-opcode events to be requested ' + 'by\n' + ' setting "f_trace_opcodes" to "True". Note that this may lead ' + 'to\n' + ' undefined interpreter behaviour if exceptions raised by the\n' + ' trace function escape to the function being traced.\n' + '\n' + ' "f_lineno" is the current line number of the frame --- ' 'writing\n' - ' to f_lineno.\n' + ' to this from within a trace function jumps to the given line\n' + ' (only for the bottom-most frame). A debugger can implement ' + 'a\n' + ' Jump command (aka Set Next Statement) by writing to ' + 'f_lineno.\n' '\n' ' Frame objects support one method:\n' '\n' @@ -11487,8 +11531,7 @@ ' under "User-defined methods". Class method objects are ' 'created\n' ' by the built-in "classmethod()" constructor.\n', - 'typesfunctions': '\n' - 'Functions\n' + 'typesfunctions': 'Functions\n' '*********\n' '\n' 'Function objects are created by function definitions. The ' @@ -11505,8 +11548,7 @@ 'different object types.\n' '\n' 'See Function definitions for more information.\n', - 'typesmapping': '\n' - 'Mapping Types --- "dict"\n' + 'typesmapping': 'Mapping Types --- "dict"\n' '************************\n' '\n' 'A *mapping* object maps *hashable* values to arbitrary ' @@ -11863,8 +11905,7 @@ " {'bacon'}\n" " >>> keys ^ {'sausage', 'juice'}\n" " {'juice', 'sausage', 'bacon', 'spam'}\n", - 'typesmethods': '\n' - 'Methods\n' + 'typesmethods': 'Methods\n' '*******\n' '\n' 'Methods are functions that are called using the attribute ' @@ -11921,8 +11962,7 @@ " 'my name is method'\n" '\n' 'See The standard type hierarchy for more information.\n', - 'typesmodules': '\n' - 'Modules\n' + 'typesmodules': 'Modules\n' '*******\n' '\n' 'The only special operation on a module is attribute access: ' @@ -11959,8 +11999,7 @@ 'written as\n' '"".\n', - 'typesseq': '\n' - 'Sequence Types --- "list", "tuple", "range"\n' + 'typesseq': 'Sequence Types --- "list", "tuple", "range"\n' '*******************************************\n' '\n' 'There are three basic sequence types: lists, tuples, and range\n' @@ -11993,7 +12032,7 @@ 'comparison operations. The "+" (concatenation) and "*" ' '(repetition)\n' 'operations have the same priority as the corresponding numeric\n' - 'operations.\n' + 'operations. [3]\n' '\n' '+----------------------------+----------------------------------+------------+\n' '| Operation | Result ' @@ -12108,9 +12147,9 @@ '\n' '3. If *i* or *j* is negative, the index is relative to the end ' 'of\n' - ' the string: "len(s) + i" or "len(s) + j" is substituted. But ' - 'note\n' - ' that "-0" is still "0".\n' + ' sequence *s*: "len(s) + i" or "len(s) + j" is substituted. ' + 'But\n' + ' note that "-0" is still "0".\n' '\n' '4. The slice of *s* from *i* to *j* is defined as the sequence ' 'of\n' @@ -12129,12 +12168,17 @@ ' (j-i)/k". In other words, the indices are "i", "i+k", ' '"i+2*k",\n' ' "i+3*k" and so on, stopping when *j* is reached (but never\n' - ' including *j*). If *i* or *j* is greater than "len(s)", use\n' - ' "len(s)". If *i* or *j* are omitted or "None", they become ' - '"end"\n' - ' values (which end depends on the sign of *k*). Note, *k* ' - 'cannot be\n' - ' zero. If *k* is "None", it is treated like "1".\n' + ' including *j*). When *k* is positive, *i* and *j* are ' + 'reduced to\n' + ' "len(s)" if they are greater. When *k* is negative, *i* and ' + '*j* are\n' + ' reduced to "len(s) - 1" if they are greater. If *i* or *j* ' + 'are\n' + ' omitted or "None", they become "end" values (which end ' + 'depends on\n' + ' the sign of *k*). Note, *k* cannot be zero. If *k* is ' + '"None", it\n' + ' is treated like "1".\n' '\n' '6. Concatenating immutable sequences always results in a new\n' ' object. This means that building up a sequence by repeated\n' @@ -12291,8 +12335,8 @@ '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.remove(x)" | remove the first item from ' '*s* | (3) |\n' - '| | where "s[i] == ' - 'x" | |\n' + '| | where "s[i]" is equal to ' + '*x* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.reverse()" | reverses the items of *s* ' 'in | (4) |\n' @@ -12379,7 +12423,7 @@ 'operations.\n' ' Lists also provide the following additional method:\n' '\n' - ' sort(*, key=None, reverse=None)\n' + ' sort(*, key=None, reverse=False)\n' '\n' ' This method sorts the list in place, using only "<" ' 'comparisons\n' @@ -12652,8 +12696,7 @@ ' * The linspace recipe shows how to implement a lazy version ' 'of\n' ' range that suitable for floating point applications.\n', - 'typesseq-mutable': '\n' - 'Mutable Sequence Types\n' + 'typesseq-mutable': 'Mutable Sequence Types\n' '**********************\n' '\n' 'The operations in the following table are defined on ' @@ -12747,8 +12790,8 @@ '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.remove(x)" | remove the first item ' 'from *s* | (3) |\n' - '| | where "s[i] == ' - 'x" | |\n' + '| | where "s[i]" is equal ' + 'to *x* | |\n' '+--------------------------------+----------------------------------+-----------------------+\n' '| "s.reverse()" | reverses the items of ' '*s* in | (4) |\n' @@ -12793,8 +12836,7 @@ 'referenced multiple\n' ' times, as explained for "s * n" under Common Sequence ' 'Operations.\n', - 'unary': '\n' - 'Unary arithmetic and bitwise operations\n' + 'unary': 'Unary arithmetic and bitwise operations\n' '***************************************\n' '\n' 'All unary arithmetic and bitwise operations have the same ' @@ -12816,8 +12858,7 @@ 'In all three cases, if the argument does not have the proper type, ' 'a\n' '"TypeError" exception is raised.\n', - 'while': '\n' - 'The "while" statement\n' + 'while': 'The "while" statement\n' '*********************\n' '\n' 'The "while" statement is used for repeated execution as long as an\n' @@ -12841,8 +12882,7 @@ 'executed in the first suite skips the rest of the suite and goes ' 'back\n' 'to testing the expression.\n', - 'with': '\n' - 'The "with" statement\n' + 'with': 'The "with" statement\n' '********************\n' '\n' 'The "with" statement is used to wrap the execution of a block with\n' @@ -12915,8 +12955,7 @@ ' The specification, background, and examples for the Python ' '"with"\n' ' statement.\n', - 'yield': '\n' - 'The "yield" statement\n' + 'yield': 'The "yield" statement\n' '*********************\n' '\n' ' yield_stmt ::= yield_expression\n' diff --git a/Misc/NEWS.d/3.7.0a1.rst b/Misc/NEWS.d/3.7.0a1.rst new file mode 100644 index 00000000000..005ef437c57 --- /dev/null +++ b/Misc/NEWS.d/3.7.0a1.rst @@ -0,0 +1,6456 @@ +.. bpo: 29781 +.. date: 2017-09-05-15-26-30 +.. nonce: LwYtBP +.. release date: 2017-09-19 +.. section: Security + +SSLObject.version() now correctly returns None when handshake over BIO has +not been performed yet. + +.. + +.. bpo: 29505 +.. date: 2017-08-23-17-02-55 +.. nonce: BL6Yt8 +.. section: Security + +Add fuzz tests for float(str), int(str), unicode(str); for oss-fuzz. + +.. + +.. bpo: 30947 +.. date: 2017-08-16-16-35-59 +.. nonce: iNMmm4 +.. section: Security + +Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security +fixes. + +.. + +.. bpo: 30730 +.. date: 0347 +.. nonce: rJsyTH +.. original section: Library +.. section: Security + +Prevent environment variables injection in subprocess on Windows. Prevent +passing other environment variables and command arguments. + +.. + +.. bpo: 30694 +.. date: 0344 +.. nonce: WkMWM_ +.. original section: Library +.. section: Security + +Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security +vulnerabilities including: CVE-2017-9233 (External entity infinite loop +DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix +regression bugs from 2.2.0's fix to CVE-2016-0718) and CVE-2012-0876 +(Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os- +specific entropy sources like getrandom) doesn't impact Python, since Python +already gets entropy from the OS to set the expat secret using +``XML_SetHashSalt()``. + +.. + +.. bpo: 30500 +.. date: 0342 +.. nonce: 1VG7R- +.. original section: Library +.. section: Security + +Fix urllib.parse.splithost() to correctly parse fragments. For example, +``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the +``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an +authentification (``login at host``). + +.. + +.. bpo: 29591 +.. date: 0338 +.. nonce: ExKblw +.. original section: Library +.. section: Security + +Update expat copy from 2.1.1 to 2.2.0 to get fixes of CVE-2016-0718 and +CVE-2016-4472. See https://sourceforge.net/p/expat/bugs/537/ for more +information. + +.. + +.. bpo: 31490 +.. date: 2017-09-16-13-32-35 +.. nonce: r7m2sj +.. section: Core and Builtins + +Fix an assertion failure in `ctypes` class definition, in case the class has +an attribute whose name is specified in ``_anonymous_`` but not in +``_fields_``. Patch by Oren Milman. + +.. + +.. bpo: 31471 +.. date: 2017-09-14-19-47-57 +.. nonce: 0yiA5Q +.. section: Core and Builtins + +Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env +argument has a bad keys() method. Patch by Oren Milman. + +.. + +.. bpo: 31418 +.. date: 2017-09-13-13-03-52 +.. nonce: rS-FlC +.. section: Core and Builtins + +Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an +exception with a bad ``__module__`` attribute. Patch by Oren Milman. + +.. + +.. bpo: 31416 +.. date: 2017-09-11-12-54-35 +.. nonce: 2hlQFd +.. section: Core and Builtins + +Fix assertion failures in case of a bad warnings.filters or +warnings.defaultaction. Patch by Oren Milman. + +.. + +.. bpo: 28411 +.. date: 2017-09-11-09-24-21 +.. nonce: 12SpAm +.. section: Core and Builtins + +Change direct usage of PyInterpreterState.modules to +PyImport_GetModuleDict(). Also introduce more uniformity in other code that +deals with sys.modules. This helps reduce complications when working on +sys.modules. + +.. + +.. bpo: 28411 +.. date: 2017-09-11-09-11-20 +.. nonce: Ax91lz +.. section: Core and Builtins + +Switch to the abstract API when dealing with ``PyInterpreterState.modules``. +This allows later support for all dict subclasses and other Mapping +implementations. Also add a ``PyImport_GetModule()`` function to reduce a +bunch of duplicated code. + +.. + +.. bpo: 31411 +.. date: 2017-09-11-08-50-41 +.. nonce: HZz82I +.. section: Core and Builtins + +Raise a TypeError instead of SystemError in case warnings.onceregistry is +not a dictionary. Patch by Oren Milman. + +.. + +.. bpo: 31344 +.. date: 2017-09-06-20-25-47 +.. nonce: XpFs-q +.. section: Core and Builtins + +For finer control of tracing behaviour when testing the interpreter, two new +frame attributes have been added to control the emission of particular trace +events: ``f_trace_lines`` (``True`` by default) to turn off per-line trace +events; and ``f_trace_opcodes`` (``False`` by default) to turn on per-opcode +trace events. + +.. + +.. bpo: 31373 +.. date: 2017-09-06-15-25-59 +.. nonce: dC4jd4 +.. section: Core and Builtins + +Fix several possible instances of undefined behavior due to floating-point +demotions. + +.. + +.. bpo: 30465 +.. date: 2017-09-06-10-47-29 +.. nonce: oe-3GD +.. section: Core and Builtins + +Location information (``lineno`` and ``col_offset``) in f-strings is now +(mostly) correct. This fixes tools like flake8 from showing warnings on the +wrong line (typically the first line of the file). + +.. + +.. bpo: 30860 +.. date: 2017-09-05-13-47-49 +.. nonce: MROpZw +.. section: Core and Builtins + +Consolidate CPython's global runtime state under a single struct. This +improves discoverability of the runtime state. + +.. + +.. bpo: 31347 +.. date: 2017-09-04-16-35-06 +.. nonce: KDuf2w +.. section: Core and Builtins + +Fix possible undefined behavior in _PyObject_FastCall_Prepend. + +.. + +.. bpo: 31343 +.. date: 2017-09-04-14-57-27 +.. nonce: Kl_fS5 +.. section: Core and Builtins + +Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray +plans to remove the functions from sys/types.h. + +.. + +.. bpo: 31291 +.. date: 2017-08-28-11-51-29 +.. nonce: t8QggK +.. section: Core and Builtins + +Fix an assertion failure in `zipimport.zipimporter.get_data` on Windows, +when the return value of ``pathname.replace('/','\\')`` isn't a string. +Patch by Oren Milman. + +.. + +.. bpo: 31271 +.. date: 2017-08-25-20-43-22 +.. nonce: YMduKF +.. section: Core and Builtins + +Fix an assertion failure in the write() method of `io.TextIOWrapper`, when +the encoder doesn't return a bytes object. Patch by Oren Milman. + +.. + +.. bpo: 31243 +.. date: 2017-08-24-13-34-49 +.. nonce: dRJzqR +.. section: Core and Builtins + +Fix a crash in some methods of `io.TextIOWrapper`, when the decoder's state +is invalid. Patch by Oren Milman. + +.. + +.. bpo: 30721 +.. date: 2017-08-18-15-15-20 +.. nonce: Hmc56z +.. section: Core and Builtins + +``print`` now shows correct usage hint for using Python 2 redirection +syntax. Patch by Sanyam Khurana. + +.. + +.. bpo: 31070 +.. date: 2017-08-09-09-40-54 +.. nonce: oDyLiI +.. section: Core and Builtins + +Fix a race condition in importlib _get_module_lock(). + +.. + +.. bpo: 30747 +.. date: 2017-08-08-12-00-29 +.. nonce: g2kZRT +.. section: Core and Builtins + +Add a non-dummy implementation of _Py_atomic_store and _Py_atomic_load on +MSVC. + +.. + +.. bpo: 31095 +.. date: 2017-08-01-18-48-30 +.. nonce: bXWZDb +.. section: Core and Builtins + +Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call +``PyObject_GC_UnTrack()``. + +.. + +.. bpo: 31071 +.. date: 2017-07-31-13-28-53 +.. nonce: P9UBDy +.. section: Core and Builtins + +Avoid masking original TypeError in call with * unpacking when other +arguments are passed. + +.. + +.. bpo: 30978 +.. date: 2017-07-21-07-39-05 +.. nonce: f0jODc +.. section: Core and Builtins + +str.format_map() now passes key lookup exceptions through. Previously any +exception was replaced with a KeyError exception. + +.. + +.. bpo: 30808 +.. date: 2017-07-17-12-12-59 +.. nonce: bA3zOv +.. section: Core and Builtins + +Use _Py_atomic API for concurrency-sensitive signal state. + +.. + +.. bpo: 30876 +.. date: 2017-07-11-06-31-32 +.. nonce: x35jZX +.. section: Core and Builtins + +Relative import from unloaded package now reimports the package instead of +failing with SystemError. Relative import from non-package now fails with +ImportError rather than SystemError. + +.. + +.. bpo: 30703 +.. date: 2017-06-28-21-07-32 +.. nonce: ULCdFp +.. section: Core and Builtins + +Improve signal delivery. + +Avoid using Py_AddPendingCall from signal handler, to avoid calling signal- +unsafe functions. The tests I'm adding here fail without the rest of the +patch, on Linux and OS X. This means our signal delivery logic had defects +(some signals could be lost). + +.. + +.. bpo: 30765 +.. date: 2017-06-26-14-29-50 +.. nonce: Q5iBmf +.. section: Core and Builtins + +Avoid blocking in pthread_mutex_lock() when PyThread_acquire_lock() is asked +not to block. + +.. + +.. bpo: 31161 +.. date: 0470 +.. nonce: FcUAA0 +.. section: Core and Builtins + +Make sure the 'Missing parentheses' syntax error message is only applied to +SyntaxError, not to subclasses. Patch by Martijn Pieters. + +.. + +.. bpo: 30814 +.. date: 0469 +.. nonce: HcYsfM +.. section: Core and Builtins + +Fixed a race condition when import a submodule from a package. + +.. + +.. bpo: 30736 +.. date: 0468 +.. nonce: kA4J9v +.. section: Core and Builtins + +The internal unicodedata database has been upgraded to Unicode 10.0. + +.. + +.. bpo: 30604 +.. date: 0467 +.. nonce: zGPGoX +.. section: Core and Builtins + +Move co_extra_freefuncs from per-thread to per-interpreter to avoid crashes. + +.. + +.. bpo: 30597 +.. date: 0466 +.. nonce: 7erHiP +.. section: Core and Builtins + +``print`` now shows expected input in custom error message when used as a +Python 2 statement. Patch by Sanyam Khurana. + +.. + +.. bpo: 30682 +.. date: 0465 +.. nonce: zZm88E +.. section: Core and Builtins + +Removed a too-strict assertion that failed for certain f-strings, such as +eval("f'\\\n'") and eval("f'\\\r'"). + +.. + +.. bpo: 30501 +.. date: 0464 +.. nonce: BWJByG +.. section: Core and Builtins + +The compiler now produces more optimal code for complex condition +expressions in the "if", "while" and "assert" statement, the "if" +expression, and generator expressions and comprehensions. + +.. + +.. bpo: 28180 +.. date: 0463 +.. nonce: f_IHor +.. section: Core and Builtins + +Implement PEP 538 (legacy C locale coercion). This means that when a +suitable coercion target locale is available, both the core interpreter and +locale-aware C extensions will assume the use of UTF-8 as the default text +encoding, rather than ASCII. + +.. + +.. bpo: 30486 +.. date: 0462 +.. nonce: KZi3nB +.. section: Core and Builtins + +Allows setting cell values for __closure__. Patch by Lisa Roach. + +.. + +.. bpo: 30537 +.. date: 0461 +.. nonce: sGC27r +.. section: Core and Builtins + +itertools.islice now accepts integer-like objects (having an __index__ +method) as start, stop, and slice arguments + +.. + +.. bpo: 25324 +.. date: 0460 +.. nonce: l12VjO +.. section: Core and Builtins + +Tokens needed for parsing in Python moved to C. ``COMMENT``, ``NL`` and +``ENCODING``. This way the tokens and tok_names in the token module don't +get changed when you import the tokenize module. + +.. + +.. bpo: 29104 +.. date: 0459 +.. nonce: u26yCx +.. section: Core and Builtins + +Fixed parsing backslashes in f-strings. + +.. + +.. bpo: 27945 +.. date: 0458 +.. nonce: p29r3O +.. section: Core and Builtins + +Fixed various segfaults with dict when input collections are mutated during +searching, inserting or comparing. Based on patches by Duane Griffin and +Tim Mitchell. + +.. + +.. bpo: 25794 +.. date: 0457 +.. nonce: xfPwqm +.. section: Core and Builtins + +Fixed type.__setattr__() and type.__delattr__() for non-interned attribute +names. Based on patch by Eryk Sun. + +.. + +.. bpo: 30039 +.. date: 0456 +.. nonce: e0u4DG +.. section: Core and Builtins + +If a KeyboardInterrupt happens when the interpreter is in the middle of +resuming a chain of nested 'yield from' or 'await' calls, it's now correctly +delivered to the innermost frame. + +.. + +.. bpo: 28974 +.. date: 0455 +.. nonce: jVewS0 +.. section: Core and Builtins + +``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than +``format(str(self), '')``. + +.. + +.. bpo: 30024 +.. date: 0454 +.. nonce: kSOlED +.. section: Core and Builtins + +Circular imports involving absolute imports with binding a submodule to a +name are now supported. + +.. + +.. bpo: 12414 +.. date: 0453 +.. nonce: T9ix8O +.. section: Core and Builtins + +sys.getsizeof() on a code object now returns the sizes which includes the +code struct and sizes of objects which it references. Patch by Dong-hee Na. + +.. + +.. bpo: 29839 +.. date: 0452 +.. nonce: rUmfay +.. section: Core and Builtins + +len() now raises ValueError rather than OverflowError if __len__() returned +a large negative integer. + +.. + +.. bpo: 11913 +.. date: 0451 +.. nonce: 5uiMX9 +.. section: Core and Builtins + +README.rst is now included in the list of distutils standard READMEs and +therefore included in source distributions. + +.. + +.. bpo: 29914 +.. date: 0450 +.. nonce: nqFSRR +.. section: Core and Builtins + +Fixed default implementations of __reduce__ and __reduce_ex__(). +object.__reduce__() no longer takes arguments, object.__reduce_ex__() now +requires one argument. + +.. + +.. bpo: 29949 +.. date: 0449 +.. nonce: DevGPS +.. section: Core and Builtins + +Fix memory usage regression of set and frozenset object. + +.. + +.. bpo: 29935 +.. date: 0448 +.. nonce: vgjdJo +.. section: Core and Builtins + +Fixed error messages in the index() method of tuple, list and deque when +pass indices of wrong type. + +.. + +.. bpo: 29816 +.. date: 0447 +.. nonce: 0H75Nl +.. section: Core and Builtins + +Shift operation now has less opportunity to raise OverflowError. ValueError +always is raised rather than OverflowError for negative counts. Shifting +zero with non-negative count always returns zero. + +.. + +.. bpo: 24821 +.. date: 0446 +.. nonce: 4DINGV +.. section: Core and Builtins + +Fixed the slowing down to 25 times in the searching of some unlucky Unicode +characters. + +.. + +.. bpo: 29102 +.. date: 0445 +.. nonce: AW4YPj +.. section: Core and Builtins + +Add a unique ID to PyInterpreterState. This makes it easier to identify +each subinterpreter. + +.. + +.. bpo: 29894 +.. date: 0444 +.. nonce: Vev6t- +.. section: Core and Builtins + +The deprecation warning is emitted if __complex__ returns an instance of a +strict subclass of complex. In a future versions of Python this can be an +error. + +.. + +.. bpo: 29859 +.. date: 0443 +.. nonce: Z1MLcA +.. section: Core and Builtins + +Show correct error messages when any of the pthread_* calls in +thread_pthread.h fails. + +.. + +.. bpo: 29849 +.. date: 0442 +.. nonce: hafvBD +.. section: Core and Builtins + +Fix a memory leak when an ImportError is raised during from import. + +.. + +.. bpo: 28856 +.. date: 0441 +.. nonce: AFRmo4 +.. section: Core and Builtins + +Fix an oversight that %b format for bytes should support objects follow the +buffer protocol. + +.. + +.. bpo: 29723 +.. date: 0440 +.. nonce: M5omgP +.. section: Core and Builtins + +The ``sys.path[0]`` initialization change for bpo-29139 caused a regression +by revealing an inconsistency in how sys.path is initialized when executing +``__main__`` from a zipfile, directory, or other import location. The +interpreter now consistently avoids ever adding the import location's parent +directory to ``sys.path``, and ensures no other ``sys.path`` entries are +inadvertently modified when inserting the import location named on the +command line. + +.. + +.. bpo: 29568 +.. date: 0439 +.. nonce: 3EtOC- +.. section: Core and Builtins + +Escaped percent "%%" in the format string for classic string formatting no +longer allows any characters between two percents. + +.. + +.. bpo: 29714 +.. date: 0438 +.. nonce: z-BhVd +.. section: Core and Builtins + +Fix a regression that bytes format may fail when containing zero bytes +inside. + +.. + +.. bpo: 29695 +.. date: 0437 +.. nonce: z75xXa +.. section: Core and Builtins + +bool(), float(), list() and tuple() no longer take keyword arguments. The +first argument of int() can now be passes only as positional argument. + +.. + +.. bpo: 28893 +.. date: 0436 +.. nonce: WTKnpj +.. section: Core and Builtins + +Set correct __cause__ for errors about invalid awaitables returned from +__aiter__ and __anext__. + +.. + +.. bpo: 28876 +.. date: 0435 +.. nonce: cU-sGT +.. section: Core and Builtins + +``bool(range)`` works even if ``len(range)`` raises :exc:`OverflowError`. + +.. + +.. bpo: 29683 +.. date: 0434 +.. nonce: G5iS-P +.. section: Core and Builtins + +Fixes to memory allocation in _PyCode_SetExtra. Patch by Brian Coleman. + +.. + +.. bpo: 29684 +.. date: 0433 +.. nonce: wTgEoh +.. section: Core and Builtins + +Fix minor regression of PyEval_CallObjectWithKeywords. It should raise +TypeError when kwargs is not a dict. But it might cause segv when args=NULL +and kwargs is not a dict. + +.. + +.. bpo: 28598 +.. date: 0432 +.. nonce: QxbzQn +.. section: Core and Builtins + +Support __rmod__ for subclasses of str being called before str.__mod__. +Patch by Martijn Pieters. + +.. + +.. bpo: 29607 +.. date: 0431 +.. nonce: 7NvBA1 +.. section: Core and Builtins + +Fix stack_effect computation for CALL_FUNCTION_EX. Patch by Matthieu +Dartiailh. + +.. + +.. bpo: 29602 +.. date: 0430 +.. nonce: qyyskC +.. section: Core and Builtins + +Fix incorrect handling of signed zeros in complex constructor for complex +subclasses and for inputs having a __complex__ method. Patch by Serhiy +Storchaka. + +.. + +.. bpo: 29347 +.. date: 0429 +.. nonce: 1RPPGN +.. section: Core and Builtins + +Fixed possibly dereferencing undefined pointers when creating weakref +objects. + +.. + +.. bpo: 29463 +.. date: 0428 +.. nonce: h2bg8A +.. section: Core and Builtins + +Add ``docstring`` field to Module, ClassDef, FunctionDef, and +AsyncFunctionDef ast nodes. docstring is not first stmt in their body +anymore. It affects ``co_firstlineno`` and ``co_lnotab`` of code object for +module and class. + +.. + +.. bpo: 29438 +.. date: 0427 +.. nonce: IKxD6I +.. section: Core and Builtins + +Fixed use-after-free problem in key sharing dict. + +.. + +.. bpo: 29546 +.. date: 0426 +.. nonce: PS1I1T +.. section: Core and Builtins + +Set the 'path' and 'name' attribute on ImportError for ``from ... import +...``. + +.. + +.. bpo: 29546 +.. date: 0425 +.. nonce: O1rmG_ +.. section: Core and Builtins + +Improve from-import error message with location + +.. + +.. bpo: 29478 +.. date: 0424 +.. nonce: rTQ-qy +.. section: Core and Builtins + +If max_line_length=None is specified while using the Compat32 policy, it is +no longer ignored. Patch by Mircea Cosbuc. + +.. + +.. bpo: 29319 +.. date: 0423 +.. nonce: KLDUZf +.. section: Core and Builtins + +Prevent RunMainFromImporter overwriting sys.path[0]. + +.. + +.. bpo: 29337 +.. date: 0422 +.. nonce: bjX8AE +.. section: Core and Builtins + +Fixed possible BytesWarning when compare the code objects. Warnings could be +emitted at compile time. + +.. + +.. bpo: 29327 +.. date: 0421 +.. nonce: XXQarW +.. section: Core and Builtins + +Fixed a crash when pass the iterable keyword argument to sorted(). + +.. + +.. bpo: 29034 +.. date: 0420 +.. nonce: 7-uEDT +.. section: Core and Builtins + +Fix memory leak and use-after-free in os module (path_converter). + +.. + +.. bpo: 29159 +.. date: 0419 +.. nonce: gEn_kP +.. section: Core and Builtins + +Fix regression in bytes(x) when x.__index__() raises Exception. + +.. + +.. bpo: 29049 +.. date: 0418 +.. nonce: KpVXBw +.. section: Core and Builtins + +Call _PyObject_GC_TRACK() lazily when calling Python function. Calling +function is up to 5% faster. + +.. + +.. bpo: 28927 +.. date: 0417 +.. nonce: 9fxf6y +.. section: Core and Builtins + +bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not +only spaces. Patch by Robert Xiao. + +.. + +.. bpo: 28932 +.. date: 0416 +.. nonce: QnLx8A +.. section: Core and Builtins + +Do not include if it does not exist. + +.. + +.. bpo: 25677 +.. date: 0415 +.. nonce: RWhZrb +.. section: Core and Builtins + +Correct the positioning of the syntax error caret for indented blocks. Based +on patch by Michael Layzell. + +.. + +.. bpo: 29000 +.. date: 0414 +.. nonce: K6wQ-3 +.. section: Core and Builtins + +Fixed bytes formatting of octals with zero padding in alternate form. + +.. + +.. bpo: 18896 +.. date: 0413 +.. nonce: Pqe0bg +.. section: Core and Builtins + +Python function can now have more than 255 parameters. +collections.namedtuple() now supports tuples with more than 255 elements. + +.. + +.. bpo: 28596 +.. date: 0412 +.. nonce: snIJRd +.. section: Core and Builtins + +The preferred encoding is UTF-8 on Android. Patch written by Chi Hsuan Yen. + +.. + +.. bpo: 22257 +.. date: 0411 +.. nonce: 2a8zxB +.. section: Core and Builtins + +Clean up interpreter startup (see PEP 432). + +.. + +.. bpo: 26919 +.. date: 0410 +.. nonce: Cm7MSa +.. section: Core and Builtins + +On Android, operating system data is now always encoded/decoded to/from +UTF-8, instead of the locale encoding to avoid inconsistencies with +os.fsencode() and os.fsdecode() which are already using UTF-8. + +.. + +.. bpo: 28991 +.. date: 0409 +.. nonce: lGA0FK +.. section: Core and Builtins + +functools.lru_cache() was susceptible to an obscure reentrancy bug +triggerable by a monkey-patched len() function. + +.. + +.. bpo: 28147 +.. date: 0408 +.. nonce: CnK_xf +.. section: Core and Builtins + +Fix a memory leak in split-table dictionaries: setattr() must not convert +combined table into split table. Patch written by INADA Naoki. + +.. + +.. bpo: 28739 +.. date: 0407 +.. nonce: w1fvhk +.. section: Core and Builtins + +f-string expressions are no longer accepted as docstrings and by +ast.literal_eval() even if they do not include expressions. + +.. + +.. bpo: 28512 +.. date: 0406 +.. nonce: i-pv6d +.. section: Core and Builtins + +Fixed setting the offset attribute of SyntaxError by +PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +.. + +.. bpo: 28918 +.. date: 0405 +.. nonce: SFVuPz +.. section: Core and Builtins + +Fix the cross compilation of xxlimited when Python has been built with +Py_DEBUG defined. + +.. + +.. bpo: 23722 +.. date: 0404 +.. nonce: e8BH5h +.. section: Core and Builtins + +Rather than silently producing a class that doesn't support zero-argument +``super()`` in methods, failing to pass the new ``__classcell__`` namespace +entry up to ``type.__new__`` now results in a ``DeprecationWarning`` and a +class that supports zero-argument ``super()``. + +.. + +.. bpo: 28797 +.. date: 0403 +.. nonce: _A0_Z5 +.. section: Core and Builtins + +Modifying the class __dict__ inside the __set_name__ method of a descriptor +that is used inside that class no longer prevents calling the __set_name__ +method of other descriptors. + +.. + +.. bpo: 28799 +.. date: 0402 +.. nonce: cP6V1N +.. section: Core and Builtins + +Remove the ``PyEval_GetCallStats()`` function and deprecate the untested and +undocumented ``sys.callstats()`` function. Remove the ``CALL_PROFILE`` +special build: use the :func:`sys.setprofile` function, :mod:`cProfile` or +:mod:`profile` to profile function calls. + +.. + +.. bpo: 12844 +.. date: 0401 +.. nonce: pdr3gY +.. section: Core and Builtins + +More than 255 arguments can now be passed to a function. + +.. + +.. bpo: 28782 +.. date: 0400 +.. nonce: foJV_E +.. section: Core and Builtins + +Fix a bug in the implementation ``yield from`` when checking if the next +instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). + +.. + +.. bpo: 28774 +.. date: 0399 +.. nonce: cEehAr +.. section: Core and Builtins + +Fix error position of the unicode error in ASCII and Latin1 encoders when a +string returned by the error handler contains multiple non-encodable +characters (non-ASCII for the ASCII codec, characters out of the +U+0000-U+00FF range for Latin1). + +.. + +.. bpo: 28731 +.. date: 0398 +.. nonce: oNF59u +.. section: Core and Builtins + +Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of +dict literal with constant keys up to 30%. + +.. + +.. bpo: 28532 +.. date: 0397 +.. nonce: KEYJny +.. section: Core and Builtins + +Show sys.version when -V option is supplied twice. + +.. + +.. bpo: 27100 +.. date: 0396 +.. nonce: poVjXq +.. section: Core and Builtins + +The with-statement now checks for __enter__ before it checks for __exit__. +This gives less confusing error messages when both methods are missing. +Patch by Jonathan Ellington. + +.. + +.. bpo: 28746 +.. date: 0395 +.. nonce: r5MXdB +.. section: Core and Builtins + +Fix the set_inheritable() file descriptor method on platforms that do not +have the ioctl FIOCLEX and FIONCLEX commands. + +.. + +.. bpo: 26920 +.. date: 0394 +.. nonce: 1URwGb +.. section: Core and Builtins + +Fix not getting the locale's charset upon initializing the interpreter, on +platforms that do not have langinfo. + +.. + +.. bpo: 28648 +.. date: 0393 +.. nonce: z7B52W +.. section: Core and Builtins + +Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode +astral characters. Patch by Xiang Zhang. + +.. + +.. bpo: 28665 +.. date: 0392 +.. nonce: v4nx86 +.. section: Core and Builtins + +Improve speed of the STORE_DEREF opcode by 40%. + +.. + +.. bpo: 19398 +.. date: 0391 +.. nonce: RYbEGH +.. section: Core and Builtins + +Extra slash no longer added to sys.path components in case of empty compile- +time PYTHONPATH components. + +.. + +.. bpo: 28621 +.. date: 0390 +.. nonce: eCD7n- +.. section: Core and Builtins + +Sped up converting int to float by reusing faster bits counting +implementation. Patch by Adrian Wielgosik. + +.. + +.. bpo: 28580 +.. date: 0389 +.. nonce: 8bqBmG +.. section: Core and Builtins + +Optimize iterating split table values. Patch by Xiang Zhang. + +.. + +.. bpo: 28583 +.. date: 0388 +.. nonce: F-QAx1 +.. section: Core and Builtins + +PyDict_SetDefault didn't combine split table when needed. Patch by Xiang +Zhang. + +.. + +.. bpo: 28128 +.. date: 0387 +.. nonce: Lc2sFu +.. section: Core and Builtins + +Deprecation warning for invalid str and byte escape sequences now prints +better information about where the error occurs. Patch by Serhiy Storchaka +and Eric Smith. + +.. + +.. bpo: 28509 +.. date: 0386 +.. nonce: _Fa4Uq +.. section: Core and Builtins + +dict.update() no longer allocate unnecessary large memory. + +.. + +.. bpo: 28426 +.. date: 0385 +.. nonce: E_quyK +.. section: Core and Builtins + +Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. + +.. + +.. bpo: 28517 +.. date: 0384 +.. nonce: ExPkm9 +.. section: Core and Builtins + +Fixed of-by-one error in the peephole optimizer that caused keeping +unreachable code. + +.. + +.. bpo: 28214 +.. date: 0383 +.. nonce: 6ECJox +.. section: Core and Builtins + +Improved exception reporting for problematic __set_name__ attributes. + +.. + +.. bpo: 23782 +.. date: 0382 +.. nonce: lonDzj +.. section: Core and Builtins + +Fixed possible memory leak in _PyTraceback_Add() and exception loss in +PyTraceBack_Here(). + +.. + +.. bpo: 28183 +.. date: 0381 +.. nonce: MJZeNd +.. section: Core and Builtins + +Optimize and cleanup dict iteration. + +.. + +.. bpo: 26081 +.. date: 0380 +.. nonce: _x5vjl +.. section: Core and Builtins + +Added C implementation of asyncio.Future. Original patch by Yury Selivanov. + +.. + +.. bpo: 28379 +.. date: 0379 +.. nonce: DuXlco +.. section: Core and Builtins + +Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang +Zhang. + +.. + +.. bpo: 28376 +.. date: 0378 +.. nonce: oPD-5D +.. section: Core and Builtins + +The type of long range iterator is now registered as Iterator. Patch by Oren +Milman. + +.. + +.. bpo: 28376 +.. date: 0377 +.. nonce: yTEhEo +.. section: Core and Builtins + +Creating instances of range_iterator by calling range_iterator type now is +disallowed. Calling iter() on range instance is the only way. Patch by Oren +Milman. + +.. + +.. bpo: 26906 +.. date: 0376 +.. nonce: YBjcwI +.. section: Core and Builtins + +Resolving special methods of uninitialized type now causes implicit +initialization of the type instead of a fail. + +.. + +.. bpo: 18287 +.. date: 0375 +.. nonce: k6jffS +.. section: Core and Builtins + +PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas +Koep. + +.. + +.. bpo: 24098 +.. date: 0374 +.. nonce: XqlP_1 +.. section: Core and Builtins + +Fixed possible crash when AST is changed in process of compiling it. + +.. + +.. bpo: 28201 +.. date: 0373 +.. nonce: GWUxAy +.. section: Core and Builtins + +Dict reduces possibility of 2nd conflict in hash table when hashes have same +lower bits. + +.. + +.. bpo: 28350 +.. date: 0372 +.. nonce: 8M5Eg9 +.. section: Core and Builtins + +String constants with null character no longer interned. + +.. + +.. bpo: 26617 +.. date: 0371 +.. nonce: Gh5LvN +.. section: Core and Builtins + +Fix crash when GC runs during weakref callbacks. + +.. + +.. bpo: 27942 +.. date: 0370 +.. nonce: ZGuhns +.. section: Core and Builtins + +String constants now interned recursively in tuples and frozensets. + +.. + +.. bpo: 28289 +.. date: 0369 +.. nonce: l1kHlV +.. section: Core and Builtins + +ImportError.__init__ now resets not specified attributes. + +.. + +.. bpo: 21578 +.. date: 0368 +.. nonce: GI1bhj +.. section: Core and Builtins + +Fixed misleading error message when ImportError called with invalid keyword +args. + +.. + +.. bpo: 28203 +.. date: 0367 +.. nonce: LRn5vp +.. section: Core and Builtins + +Fix incorrect type in complex(1.0, {2:3}) error message. Patch by Soumya +Sharma. + +.. + +.. bpo: 28086 +.. date: 0366 +.. nonce: JsQPMQ +.. section: Core and Builtins + +Single var-positional argument of tuple subtype was passed unscathed to the +C-defined function. Now it is converted to exact tuple. + +.. + +.. bpo: 28214 +.. date: 0365 +.. nonce: zQF8Em +.. section: Core and Builtins + +Now __set_name__ is looked up on the class instead of the instance. + +.. + +.. bpo: 27955 +.. date: 0364 +.. nonce: HC4pZ4 +.. section: Core and Builtins + +Fallback on reading /dev/urandom device when the getrandom() syscall fails +with EPERM, for example when blocked by SECCOMP. + +.. + +.. bpo: 28192 +.. date: 0363 +.. nonce: eR6stU +.. section: Core and Builtins + +Don't import readline in isolated mode. + +.. + +.. bpo: 27441 +.. date: 0362 +.. nonce: scPKax +.. section: Core and Builtins + +Remove some redundant assignments to ob_size in longobject.c. Thanks Oren +Milman. + +.. + +.. bpo: 27222 +.. date: 0361 +.. nonce: 74PvFk +.. section: Core and Builtins + +Clean up redundant code in long_rshift function. Thanks Oren Milman. + +.. + +.. bpo: 0 +.. date: 0360 +.. nonce: 9EbOiD +.. section: Core and Builtins + +Upgrade internal unicode databases to Unicode version 9.0.0. + +.. + +.. bpo: 28131 +.. date: 0359 +.. nonce: owq0wW +.. section: Core and Builtins + +Fix a regression in zipimport's compile_source(). zipimport should use the +same optimization level as the interpreter. + +.. + +.. bpo: 28126 +.. date: 0358 +.. nonce: Qf6-uQ +.. section: Core and Builtins + +Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize +memcpy(). + +.. + +.. bpo: 28120 +.. date: 0357 +.. nonce: e5xc1i +.. section: Core and Builtins + +Fix dict.pop() for splitted dictionary when trying to remove a "pending key" +(Not yet inserted in split-table). Patch by Xiang Zhang. + +.. + +.. bpo: 26182 +.. date: 0356 +.. nonce: jYlqTO +.. section: Core and Builtins + +Raise DeprecationWarning when async and await keywords are used as +variable/attribute/class/function name. + +.. + +.. bpo: 26182 +.. date: 0355 +.. nonce: a8JXK2 +.. section: Core and Builtins + +Fix a refleak in code that raises DeprecationWarning. + +.. + +.. bpo: 28721 +.. date: 0354 +.. nonce: BO9BUF +.. section: Core and Builtins + +Fix asynchronous generators aclose() and athrow() to handle +StopAsyncIteration propagation properly. + +.. + +.. bpo: 26110 +.. date: 0353 +.. nonce: KRaID6 +.. section: Core and Builtins + +Speed-up method calls: add LOAD_METHOD and CALL_METHOD opcodes. + +.. + +.. bpo: 31499 +.. date: 2017-09-18-10-57-04 +.. nonce: BydYhf +.. section: Library + +xml.etree: Fix a crash when a parser is part of a reference cycle. + +.. + +.. bpo: 31482 +.. date: 2017-09-16-01-53-11 +.. nonce: 39s5dS +.. section: Library + +``random.seed()`` now works with bytes in version=1 + +.. + +.. bpo: 28556 +.. date: 2017-09-14-11-02-56 +.. nonce: EUOiYs +.. section: Library + +typing.get_type_hints now finds the right globalns for classes and modules +by default (when no ``globalns`` was specified by the caller). + +.. + +.. bpo: 28556 +.. date: 2017-09-13-23-27-39 +.. nonce: UmTQvv +.. section: Library + +Speed improvements to the ``typing`` module. Original PRs by Ivan +Levkivskyi and Mitar. + +.. + +.. bpo: 31544 +.. date: 2017-09-13-19-55-35 +.. nonce: beTh6t +.. section: Library + +The C accelerator module of ElementTree ignored exceptions raised when +looking up TreeBuilder target methods in XMLParser(). + +.. + +.. bpo: 31234 +.. date: 2017-09-13-18-05-56 +.. nonce: lGkcPg +.. section: Library + +socket.create_connection() now fixes manually a reference cycle: clear the +variable storing the last exception on success. + +.. + +.. bpo: 31457 +.. date: 2017-09-13-13-33-39 +.. nonce: bIVBtI +.. section: Library + +LoggerAdapter objects can now be nested. + +.. + +.. bpo: 31431 +.. date: 2017-09-13-07-37-20 +.. nonce: dj994R +.. section: Library + +SSLContext.check_hostname now automatically sets SSLContext.verify_mode to +ssl.CERT_REQUIRED instead of failing with a ValueError. + +.. + +.. bpo: 31233 +.. date: 2017-09-13-02-17-11 +.. nonce: r-IPIu +.. section: Library + +socketserver.ThreadingMixIn now keeps a list of non-daemonic threads to wait +until all these threads complete in server_close(). + +.. + +.. bpo: 28638 +.. date: 2017-09-08-14-31-15 +.. nonce: lfbVyH +.. section: Library + +Changed the implementation strategy for collections.namedtuple() to +substantially reduce the use of exec() in favor of precomputed methods. As a +result, the *verbose* parameter and *_source* attribute are no longer +supported. The benefits include 1) having a smaller memory footprint for +applications using multiple named tuples, 2) faster creation of the named +tuple class (approx 4x to 6x depending on how it is measured), and 3) minor +speed-ups for instance creation using __new__, _make, and _replace. (The +primary patch contributor is Jelle Zijlstra with further improvements by +INADA Naoki, Serhiy Storchaka, and Raymond Hettinger.) + +.. + +.. bpo: 31400 +.. date: 2017-09-08-14-19-57 +.. nonce: YOTPKi +.. section: Library + +Improves SSL error handling to avoid losing error numbers. + +.. + +.. bpo: 27629 +.. date: 2017-09-07-12-15-56 +.. nonce: 7xJXEy +.. section: Library + +Make return types of SSLContext.wrap_bio() and SSLContext.wrap_socket() +customizable. + +.. + +.. bpo: 28958 +.. date: 2017-09-06-19-41-01 +.. nonce: x4-K5F +.. section: Library + +ssl.SSLContext() now uses OpenSSL error information when a context cannot be +instantiated. + +.. + +.. bpo: 28182 +.. date: 2017-09-06-18-49-16 +.. nonce: hRP8Bk +.. section: Library + +The SSL module now raises SSLCertVerificationError when OpenSSL fails to +verify the peer's certificate. The exception contains more information about +the error. + +.. + +.. bpo: 27340 +.. date: 2017-09-06-06-50-41 +.. nonce: GgekV5 +.. section: Library + +SSLSocket.sendall() now uses memoryview to create slices of data. This fixes +support for all bytes-like object. It is also more efficient and avoids +costly copies. + +.. + +.. bpo: 14191 +.. date: 2017-09-05-17-43-00 +.. nonce: vhh2xx +.. section: Library + +A new function ``argparse.ArgumentParser.parse_intermixed_args`` provides +the ability to parse command lines where there user intermixes options and +positional arguments. + +.. + +.. bpo: 31178 +.. date: 2017-09-05-14-55-28 +.. nonce: JrSFo7 +.. section: Library + +Fix string concatenation bug in rare error path in the subprocess module + +.. + +.. bpo: 31350 +.. date: 2017-09-05-10-30-48 +.. nonce: dXJ-7N +.. section: Library + +Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. + +.. + +.. bpo: 31170 +.. date: 2017-09-04-23-41-35 +.. nonce: QGmJ1t +.. section: Library + +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 + +.. + +.. bpo: 29136 +.. date: 2017-09-04-16-39-49 +.. nonce: vSn1oR +.. section: Library + +Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. + +.. + +.. bpo: 1198569 +.. date: 2017-09-04-10-53-06 +.. nonce: vhh2nY +.. section: Library + +``string.Template`` subclasses can optionally define ``braceidpattern`` if +they want to specify different placeholder patterns inside and outside the +braces. If None (the default) it falls back to ``idpattern``. + +.. + +.. bpo: 31326 +.. date: 2017-09-01-18-48-06 +.. nonce: TB05tV +.. section: Library + +concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the +call queue. Moreover, shutdown(wait=True) now also join the call queue +thread, to prevent leaking a dangling thread. + +.. + +.. bpo: 27144 +.. date: 2017-08-30-11-26-14 +.. nonce: PEDJsE +.. section: Library + +The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` now +avoid keeping a reference to yielded objects. + +.. + +.. bpo: 31281 +.. date: 2017-08-29-07-14-14 +.. nonce: DcFyNs +.. section: Library + +Fix ``fileinput.FileInput(files, inplace=True)`` when ``files`` contain +``pathlib.Path`` objects. + +.. + +.. bpo: 10746 +.. date: 2017-08-28-13-01-05 +.. nonce: nmAvfu +.. section: Library + +Fix ctypes producing wrong PEP 3118 type codes for integer types. + +.. + +.. bpo: 27584 +.. date: 2017-08-24-14-03-14 +.. nonce: r11JHZ +.. section: Library + +``AF_VSOCK`` has been added to the socket interface which allows +communication between virtual machines and their host. + +.. + +.. bpo: 22536 +.. date: 2017-08-23 +.. nonce: _narf_ +.. section: Library + +The subprocess module now sets the filename when FileNotFoundError is raised +on POSIX systems due to the executable or cwd not being found. + +.. + +.. bpo: 29741 +.. date: 2017-08-23-00-31-32 +.. nonce: EBn_DM +.. section: Library + +Update some methods in the _pyio module to also accept integer types. Patch +by Oren Milman. + +.. + +.. bpo: 31249 +.. date: 2017-08-22-12-44-48 +.. nonce: STPbb9 +.. section: Library + +concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now breaks a +reference cycle between an exception object and the WorkItem object. + +.. + +.. bpo: 31247 +.. date: 2017-08-21-17-50-27 +.. nonce: 8S3zJp +.. section: Library + +xmlrpc.server now explicitly breaks reference cycles when using +sys.exc_info() in code handling exceptions. + +.. + +.. bpo: 23835 +.. date: 2017-08-21-16-06-19 +.. nonce: da_4Kz +.. section: Library + +configparser: reading defaults in the ``ConfigParser()`` constructor is now +using ``read_dict()``, making its behavior consistent with the rest of the +parser. Non-string keys and values in the defaults dictionary are now being +implicitly converted to strings. Patch by James Tocknell. + +.. + +.. bpo: 31238 +.. date: 2017-08-21-12-31-53 +.. nonce: Gg0LRH +.. section: Library + +pydoc: the stop() method of the private ServerThread class now waits until +DocServer.serve_until_quit() completes and then explicitly sets its +docserver attribute to None to break a reference cycle. + +.. + +.. bpo: 5001 +.. date: 2017-08-18-17-16-38 +.. nonce: gwnthq +.. section: Library + +Many asserts in `multiprocessing` are now more informative, and some error +types have been changed to more specific ones. + +.. + +.. bpo: 31109 +.. date: 2017-08-17-20-29-45 +.. nonce: 7qtC64 +.. section: Library + +Convert zipimport to use Argument Clinic. + +.. + +.. bpo: 30102 +.. date: 2017-08-16-21-14-31 +.. nonce: 1sPqmc +.. section: Library + +The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on +OpenSSL < 1.1.0. The function detects CPU features and enables optimizations +on some CPU architectures such as POWER8. Patch is based on research from +Gustavo Serra Scalet. + +.. + +.. bpo: 18966 +.. date: 2017-08-16-20-28-06 +.. nonce: mjHWk2 +.. section: Library + +Non-daemonic threads created by a multiprocessing.Process are now joined on +child exit. + +.. + +.. bpo: 31183 +.. date: 2017-08-13-09-17-01 +.. nonce: -2_YGj +.. section: Library + +`dis` now works with asynchronous generator and coroutine objects. Patch by +George Collins based on diagnosis by Luciano Ramalho. + +.. + +.. bpo: 5001 +.. date: 2017-08-12-09-25-55 +.. nonce: huQi2Y +.. section: Library + +There are a number of uninformative asserts in the `multiprocessing` module, +as noted in issue 5001. This change fixes two of the most potentially +problematic ones, since they are in error-reporting code, in the +`multiprocessing.managers.convert_to_error` function. (It also makes more +informative a ValueError message.) The only potentially problematic change +is that the AssertionError is now a TypeError; however, this should also +help distinguish it from an AssertionError being *reported* by the +function/its caller (such as in issue 31169). - Patch by Allen W. Smith +(drallensmith on github). + +.. + +.. bpo: 31185 +.. date: 2017-08-11-19-30-00 +.. nonce: i6TPgL +.. section: Library + +Fixed miscellaneous errors in asyncio speedup module. + +.. + +.. bpo: 31151 +.. date: 2017-08-10-13-20-02 +.. nonce: 730VBI +.. section: Library + +socketserver.ForkingMixIn.server_close() now waits until all child processes +completed to prevent leaking zombie processes. + +.. + +.. bpo: 31072 +.. date: 2017-08-09-13-45-23 +.. nonce: NLXDPV +.. section: Library + +Add an ``include_file`` parameter to ``zipapp.create_archive()`` + +.. + +.. bpo: 24700 +.. date: 2017-08-08-15-14-34 +.. nonce: 44mvNV +.. section: Library + +Optimize array.array comparison. It is now from 10x up to 70x faster when +comparing arrays holding values of the same integer type. + +.. + +.. bpo: 31135 +.. date: 2017-08-08-14-44-37 +.. nonce: HH94xR +.. section: Library + +ttk: fix the destroy() method of LabeledScale and OptionMenu classes. Call +the parent destroy() method even if the used attribute doesn't exist. The +LabeledScale.destroy() method now also explicitly clears label and scale +attributes to help the garbage collector to destroy all widgets. + +.. + +.. bpo: 31107 +.. date: 2017-08-02-12-48-15 +.. nonce: 1t2hn5 +.. section: Library + +Fix `copyreg._slotnames()` mangled attribute calculation for classes whose +name begins with an underscore. Patch by Shane Harvey. + +.. + +.. bpo: 31080 +.. date: 2017-08-01-18-26-55 +.. nonce: 2CFVCO +.. section: Library + +Allow `logging.config.fileConfig` to accept kwargs and/or args. + +.. + +.. bpo: 30897 +.. date: 2017-08-01-15-56-50 +.. nonce: OuT1-Y +.. section: Library + +``pathlib.Path`` objects now include an ``is_mount()`` method (only +implemented on POSIX). This is similar to ``os.path.ismount(p)``. Patch by +Cooper Ry Lees. + +.. + +.. bpo: 31061 +.. date: 2017-08-01-09-32-58 +.. nonce: husAYX +.. section: Library + +Fixed a crash when using asyncio and threads. + +.. + +.. bpo: 30987 +.. date: 2017-07-30-22-00-12 +.. nonce: 228rW0 +.. section: Library + +Added support for CAN ISO-TP protocol in the socket module. + +.. + +.. bpo: 30522 +.. date: 2017-07-30-10-07-58 +.. nonce: gAX1N- +.. section: Library + +Added a ``setStream`` method to ``logging.StreamHandler`` to allow the +stream to be set after creation. + +.. + +.. bpo: 30502 +.. date: 2017-07-27-11-33-58 +.. nonce: GJlfU8 +.. section: Library + +Fix handling of long oids in ssl. Based on patch by Christian Heimes. + +.. + +.. bpo: 5288 +.. date: 2017-07-26-13-18-29 +.. nonce: o_xEGj +.. section: Library + +Support tzinfo objects with sub-minute offsets. + +.. + +.. bpo: 30919 +.. date: 2017-07-23-11-33-10 +.. nonce: 5dYRru +.. section: Library + +Fix shared memory performance regression in multiprocessing in 3.x. + +Shared memory used anonymous memory mappings in 2.x, while 3.x mmaps actual +files. Try to be careful to do as little disk I/O as possible. + +.. + +.. bpo: 26732 +.. date: 2017-07-22-12-12-42 +.. nonce: lYLWBH +.. section: Library + +Fix too many fds in processes started with the "forkserver" method. + +A child process would inherit as many fds as the number of still-running +children. + +.. + +.. bpo: 29403 +.. date: 2017-07-20-02-29-49 +.. nonce: 3RinCV +.. section: Library + +Fix ``unittest.mock``'s autospec to not fail on method-bound builtin +functions. Patch by Aaron Gallagher. + +.. + +.. bpo: 30961 +.. date: 2017-07-18-23-47-51 +.. nonce: 064jz0 +.. section: Library + +Fix decrementing a borrowed reference in tracemalloc. + +.. + +.. bpo: 19896 +.. date: 2017-07-18-13-24-50 +.. nonce: -S0IWu +.. section: Library + +Fix multiprocessing.sharedctypes to recognize typecodes ``'q'`` and ``'Q'``. + +.. + +.. bpo: 30946 +.. date: 2017-07-17-12-32-47 +.. nonce: DUo-uA +.. section: Library + +Remove obsolete code in readline module for platforms where GNU readline is +older than 2.1 or where select() is not available. + +.. + +.. bpo: 25684 +.. date: 2017-07-17-11-35-00 +.. nonce: usELVx +.. section: Library + +Change ``ttk.OptionMenu`` radiobuttons to be unique across instances of +``OptionMenu``. + +.. + +.. bpo: 30886 +.. date: 2017-07-10-12-14-22 +.. nonce: nqQj34 +.. section: Library + +Fix multiprocessing.Queue.join_thread(): it now waits until the thread +completes, even if the thread was started by the same process which created +the queue. + +.. + +.. bpo: 29854 +.. date: 2017-07-07-02-18-57 +.. nonce: J8wKb_ +.. section: Library + +Fix segfault in readline when using readline's history-size option. Patch +by Nir Soffer. + +.. + +.. bpo: 30794 +.. date: 2017-07-04-22-00-20 +.. nonce: qFwozm +.. section: Library + +Added multiprocessing.Process.kill method to terminate using the SIGKILL +signal on Unix. + +.. + +.. bpo: 30319 +.. date: 2017-07-04-13-48-21 +.. nonce: hg_3TX +.. section: Library + +socket.close() now ignores ECONNRESET error. + +.. + +.. bpo: 30828 +.. date: 2017-07-04-13-10-52 +.. nonce: CLvEvV +.. section: Library + +Fix out of bounds write in `asyncio.CFuture.remove_done_callback()`. + +.. + +.. bpo: 30302 +.. date: 2017-06-30-23-05-47 +.. nonce: itwK_k +.. section: Library + +Use keywords in the ``repr`` of ``datetime.timedelta``. + +.. + +.. bpo: 30807 +.. date: 2017-06-29-22-04-44 +.. nonce: sLtjY- +.. section: Library + +signal.setitimer() may disable the timer when passed a tiny value. + +Tiny values (such as 1e-6) are valid non-zero values for setitimer(), which +is specified as taking microsecond-resolution intervals. However, on some +platform, our conversion routine could convert 1e-6 into a zero interval, +therefore disabling the timer instead of (re-)scheduling it. + +.. + +.. bpo: 30441 +.. date: 2017-06-29-14-25-14 +.. nonce: 3Wh9kc +.. section: Library + +Fix bug when modifying os.environ while iterating over it + +.. + +.. bpo: 29585 +.. date: 2017-06-29-00-17-38 +.. nonce: x2V0my +.. section: Library + +Avoid importing ``sysconfig`` from ``site`` to improve startup speed. Python +startup is about 5% faster on Linux and 30% faster on macOS. + +.. + +.. bpo: 29293 +.. date: 2017-06-29-00-07-22 +.. nonce: Z6WZjD +.. section: Library + +Add missing parameter "n" on multiprocessing.Condition.notify(). + +The doc claims multiprocessing.Condition behaves like threading.Condition, +but its notify() method lacked the optional "n" argument (to specify the +number of sleepers to wake up) that threading.Condition.notify() accepts. + +.. + +.. bpo: 30532 +.. date: 2017-06-26-11-01-59 +.. nonce: qTeL1o +.. section: Library + +Fix email header value parser dropping folding white space in certain cases. + +.. + +.. bpo: 30596 +.. date: 2017-06-24-18-55-58 +.. nonce: VhB8iG +.. section: Library + +Add a ``close()`` method to ``multiprocessing.Process``. + +.. + +.. bpo: 9146 +.. date: 2017-05-24-00-00-00 +.. nonce: pinky_ +.. section: Library + +Fix a segmentation fault in _hashopenssl when standard hash functions such +as md5 are not available in the linked OpenSSL library. As in some special +FIPS-140 build environments. + +.. + +.. bpo: 29169 +.. date: 0352 +.. nonce: 8ypApm +.. section: Library + +Update zlib to 1.2.11. + +.. + +.. bpo: 30119 +.. date: 0351 +.. nonce: 4UMLNh +.. section: Library + +ftplib.FTP.putline() now throws ValueError on commands that contains CR or +LF. Patch by Dong-hee Na. + +.. + +.. bpo: 30879 +.. date: 0350 +.. nonce: N3KI-o +.. section: Library + +os.listdir() and os.scandir() now emit bytes names when called with bytes- +like argument. + +.. + +.. bpo: 30746 +.. date: 0349 +.. nonce: 7drQI0 +.. section: Library + +Prohibited the '=' character in environment variable names in +``os.putenv()`` and ``os.spawn*()``. + +.. + +.. bpo: 30664 +.. date: 0348 +.. nonce: oyqiUl +.. section: Library + +The description of a unittest subtest now preserves the order of keyword +arguments of TestCase.subTest(). + +.. + +.. bpo: 21071 +.. date: 0346 +.. nonce: Sw37rs +.. section: Library + +struct.Struct.format type is now :class:`str` instead of :class:`bytes`. + +.. + +.. bpo: 29212 +.. date: 0345 +.. nonce: HmTdef +.. section: Library + +Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non +repr() based thread name by default when no thread_name_prefix is supplied. +They will now identify themselves as "ThreadPoolExecutor-y_n". + +.. + +.. bpo: 29755 +.. date: 0343 +.. nonce: diQcY_ +.. section: Library + +Fixed the lgettext() family of functions in the gettext module. They now +always return bytes. + +.. + +.. bpo: 30616 +.. date: 0341 +.. nonce: I2mDTz +.. section: Library + +Functional API of enum allows to create empty enums. Patched by Dong-hee Na + +.. + +.. bpo: 30038 +.. date: 0340 +.. nonce: vb4DWk +.. section: Library + +Fix race condition between signal delivery and wakeup file descriptor. Patch +by Nathaniel Smith. + +.. + +.. bpo: 23894 +.. date: 0339 +.. nonce: k2pADV +.. section: Library + +lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. + +.. + +.. bpo: 24744 +.. date: 0337 +.. nonce: NKxUj3 +.. section: Library + +pkgutil.walk_packages function now raises ValueError if *path* is a string. +Patch by Sanyam Khurana. + +.. + +.. bpo: 24484 +.. date: 0336 +.. nonce: vFem8K +.. section: Library + +Avoid race condition in multiprocessing cleanup. + +.. + +.. bpo: 30589 +.. date: 0335 +.. nonce: xyZGM0 +.. section: Library + +Fix multiprocessing.Process.exitcode to return the opposite of the signal +number when the process is killed by a signal (instead of 255) when using +the "forkserver" method. + +.. + +.. bpo: 28994 +.. date: 0334 +.. nonce: 9vzun1 +.. section: Library + +The traceback no longer displayed for SystemExit raised in a callback +registered by atexit. + +.. + +.. bpo: 30508 +.. date: 0333 +.. nonce: wNWRS2 +.. section: Library + +Don't log exceptions if Task/Future "cancel()" method was called. + +.. + +.. bpo: 30645 +.. date: 0332 +.. nonce: xihJ4Y +.. section: Library + +Fix path calculation in `imp.load_package()`, fixing it for cases when a +package is only shipped with bytecodes. Patch by Alexandru Ardelean. + +.. + +.. bpo: 11822 +.. date: 0331 +.. nonce: GQmKw3 +.. section: Library + +The dis.dis() function now is able to disassemble nested code objects. + +.. + +.. bpo: 30624 +.. date: 0330 +.. nonce: g5oVSn +.. section: Library + +selectors does not take KeyboardInterrupt and SystemExit into account, +leaving a fd in a bad state in case of error. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 30595 +.. date: 0329 +.. nonce: d0nRRA +.. section: Library + +multiprocessing.Queue.get() with a timeout now polls its reader in non- +blocking mode if it succeeded to acquire the lock but the acquire took +longer than the timeout. + +.. + +.. bpo: 28556 +.. date: 0328 +.. nonce: mESP7G +.. section: Library + +Updates to typing module: Add generic AsyncContextManager, add support for +ContextManager on all versions. Original PRs by Jelle Zijlstra and Ivan +Levkivskyi + +.. + +.. bpo: 30605 +.. date: 0327 +.. nonce: XqGz1r +.. section: Library + +re.compile() no longer raises a BytesWarning when compiling a bytes instance +with misplaced inline modifier. Patch by Roy Williams. + +.. + +.. bpo: 29870 +.. date: 0326 +.. nonce: p960Ih +.. section: Library + +Fix ssl sockets leaks when connection is aborted in asyncio/ssl +implementation. Patch by Micha?l Sgha?er. + +.. + +.. bpo: 29743 +.. date: 0325 +.. nonce: en2P4s +.. section: Library + +Closing transport during handshake process leaks open socket. Patch by +Nikolay Kim + +.. + +.. bpo: 27585 +.. date: 0324 +.. nonce: 0Ugqqu +.. section: Library + +Fix waiter cancellation in asyncio.Lock. Patch by Mathieu Sornay. + +.. + +.. bpo: 30014 +.. date: 0323 +.. nonce: x7Yx6o +.. section: Library + +modify() method of poll(), epoll() and devpoll() based classes of selectors +module is around 10% faster. Patch by Giampaolo Rodola'. + +.. + +.. bpo: 30418 +.. date: 0322 +.. nonce: EwISQm +.. section: Library + +On Windows, subprocess.Popen.communicate() now also ignore EINVAL on +stdin.write() if the child process is still running but closed the pipe. + +.. + +.. bpo: 30463 +.. date: 0321 +.. nonce: CdOuSl +.. section: Library + +Addded empty __slots__ to abc.ABC. This allows subclassers to deny __dict__ +and __weakref__ creation. Patch by Aaron Hall. + +.. + +.. bpo: 30520 +.. date: 0320 +.. nonce: VYzaSn +.. section: Library + +Loggers are now pickleable. + +.. + +.. bpo: 30557 +.. date: 0319 +.. nonce: uykrLf +.. section: Library + +faulthandler now correctly filters and displays exception codes on Windows + +.. + +.. bpo: 30526 +.. date: 0318 +.. nonce: 7zTG30 +.. section: Library + +Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through attribute. + +.. + +.. bpo: 30245 +.. date: 0317 +.. nonce: Xoa_8Y +.. section: Library + +Fix possible overflow when organize struct.pack_into error message. Patch +by Yuan Liu. + +.. + +.. bpo: 30378 +.. date: 0316 +.. nonce: R_19_5 +.. section: Library + +Fix the problem that logging.handlers.SysLogHandler cannot handle IPv6 +addresses. + +.. + +.. bpo: 16500 +.. date: 0315 +.. nonce: 9ypo9k +.. section: Library + +Allow registering at-fork handlers. + +.. + +.. bpo: 30470 +.. date: 0314 +.. nonce: wAYhUc +.. section: Library + +Deprecate invalid ctypes call protection on Windows. Patch by Mariatta +Wijaya. + +.. + +.. bpo: 30414 +.. date: 0313 +.. nonce: jGl1Lb +.. section: Library + +multiprocessing.Queue._feed background running thread do not break from main +loop on exception. + +.. + +.. bpo: 30003 +.. date: 0312 +.. nonce: BOl9HE +.. section: Library + +Fix handling escape characters in HZ codec. Based on patch by Ma Lin. + +.. + +.. bpo: 30149 +.. date: 0311 +.. nonce: hE649r +.. section: Library + +inspect.signature() now supports callables with variable-argument parameters +wrapped with partialmethod. Patch by Dong-hee Na. + +.. + +.. bpo: 30436 +.. date: 0310 +.. nonce: b3zqE7 +.. section: Library + +importlib.find_spec() raises ModuleNotFoundError instead of AttributeError +if the specified parent module is not a package (i.e. lacks a __path__ +attribute). + +.. + +.. bpo: 30301 +.. date: 0309 +.. nonce: ywOkjN +.. section: Library + +Fix AttributeError when using SimpleQueue.empty() under *spawn* and +*forkserver* start methods. + +.. + +.. bpo: 30375 +.. date: 0308 +.. nonce: 9c8qM7 +.. section: Library + +Warnings emitted when compile a regular expression now always point to the +line in the user code. Previously they could point into inners of the re +module if emitted from inside of groups or conditionals. + +.. + +.. bpo: 30329 +.. date: 0307 +.. nonce: EuT36N +.. section: Library + +imaplib and poplib now catch the Windows socket WSAEINVAL error (code 10022) +on shutdown(SHUT_RDWR): An invalid operation was attempted. This error +occurs sometimes on SSL connections. + +.. + +.. bpo: 29196 +.. date: 0306 +.. nonce: qBq9eB +.. section: Library + +Removed previously deprecated in Python 2.4 classes Plist, Dict and +_InternalDict in the plistlib module. Dict values in the result of +functions readPlist() and readPlistFromBytes() are now normal dicts. You no +longer can use attribute access to access items of these dictionaries. + +.. + +.. bpo: 9850 +.. date: 0305 +.. nonce: c6SMxt +.. section: Library + +The :mod:`macpath` is now deprecated and will be removed in Python 3.8. + +.. + +.. bpo: 30299 +.. date: 0304 +.. nonce: O-5d4A +.. section: Library + +Compiling regular expression in debug mode on CPython now displays the +compiled bytecode in human readable form. + +.. + +.. bpo: 30048 +.. date: 0303 +.. nonce: ELRx8R +.. section: Library + +Fixed ``Task.cancel()`` can be ignored when the task is running coroutine +and the coroutine returned without any more ``await``. + +.. + +.. bpo: 30266 +.. date: 0302 +.. nonce: YJzHAH +.. section: Library + +contextlib.AbstractContextManager now supports anti-registration by setting +__enter__ = None or __exit__ = None, following the pattern introduced in +bpo-25958. Patch by Jelle Zijlstra. + +.. + +.. bpo: 30340 +.. date: 0301 +.. nonce: kvtGm- +.. section: Library + +Enhanced regular expressions optimization. This increased the performance of +matching some patterns up to 25 times. + +.. + +.. bpo: 30298 +.. date: 0300 +.. nonce: ZN-bWo +.. section: Library + +Weaken the condition of deprecation warnings for inline modifiers. Now +allowed several subsequential inline modifiers at the start of the pattern +(e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments now are +allowed before and between inline modifiers (e.g. ``'(?x) (?i) (?s)...'``). + +.. + +.. bpo: 30285 +.. date: 0299 +.. nonce: s1vpsO +.. section: Library + +Optimized case-insensitive matching and searching of regular expressions. + +.. + +.. bpo: 29990 +.. date: 0298 +.. nonce: HWV6KE +.. section: Library + +Fix range checking in GB18030 decoder. Original patch by Ma Lin. + +.. + +.. bpo: 29979 +.. date: 0297 +.. nonce: jGBMyE +.. section: Library + +rewrite cgi.parse_multipart, reusing the FieldStorage class and making its +results consistent with those of FieldStorage for multipart/form-data +requests. Patch by Pierre Quentel. + +.. + +.. bpo: 30243 +.. date: 0296 +.. nonce: RHQt0v +.. section: Library + +Removed the __init__ methods of _json's scanner and encoder. Misusing them +could cause memory leaks or crashes. Now scanner and encoder objects are +completely initialized in the __new__ methods. + +.. + +.. bpo: 30215 +.. date: 0295 +.. nonce: SY8738 +.. section: Library + +Compiled regular expression objects with the re.LOCALE flag no longer depend +on the locale at compile time. Only the locale at matching time affects the +result of matching. + +.. + +.. bpo: 30185 +.. date: 0294 +.. nonce: Tiu1n8 +.. section: Library + +Avoid KeyboardInterrupt tracebacks in forkserver helper process when Ctrl-C +is received. + +.. + +.. bpo: 30103 +.. date: 0293 +.. nonce: mmPjf5 +.. section: Library + +binascii.b2a_uu() and uu.encode() now support using ``'`'`` as zero instead +of space. + +.. + +.. bpo: 28556 +.. date: 0292 +.. nonce: 51gjbP +.. section: Library + +Various updates to typing module: add typing.NoReturn type, use +WrapperDescriptorType, minor bug-fixes. Original PRs by Jim Fasarakis- +Hilliard and Ivan Levkivskyi. + +.. + +.. bpo: 30205 +.. date: 0291 +.. nonce: BsxO34 +.. section: Library + +Fix getsockname() for unbound AF_UNIX sockets on Linux. + +.. + +.. bpo: 30228 +.. date: 0290 +.. nonce: nF8Ov4 +.. section: Library + +The seek() and tell() methods of io.FileIO now set the internal seekable +attribute to avoid one syscall on open() (in buffered or text mode). + +.. + +.. bpo: 30190 +.. date: 0289 +.. nonce: 5E7Hyb +.. section: Library + +unittest's assertAlmostEqual and assertNotAlmostEqual provide a better +message in case of failure which includes the difference between left and +right arguments. (patch by Giampaolo Rodola') + +.. + +.. bpo: 30101 +.. date: 0288 +.. nonce: hxUqSL +.. section: Library + +Add support for curses.A_ITALIC. + +.. + +.. bpo: 29822 +.. date: 0287 +.. nonce: G7dX13 +.. section: Library + +inspect.isabstract() now works during __init_subclass__. Patch by Nate +Soares. + +.. + +.. bpo: 29960 +.. date: 0286 +.. nonce: g0wr3r +.. section: Library + +Preserve generator state when _random.Random.setstate() raises an exception. +Patch by Bryan Olson. + +.. + +.. bpo: 30070 +.. date: 0285 +.. nonce: XM_B41 +.. section: Library + +Fixed leaks and crashes in errors handling in the parser module. + +.. + +.. bpo: 22352 +.. date: 0284 +.. nonce: gIQ5qC +.. section: Library + +Column widths in the output of dis.dis() are now adjusted for large line +numbers and instruction offsets. + +.. + +.. bpo: 30061 +.. date: 0283 +.. nonce: 2w_dX9 +.. section: Library + +Fixed crashes in IOBase methods __next__() and readlines() when readline() +or __next__() respectively return non-sizeable object. Fixed possible other +errors caused by not checking results of PyObject_Size(), PySequence_Size(), +or PyMapping_Size(). + +.. + +.. bpo: 30218 +.. date: 0282 +.. nonce: ab5oIg +.. section: Library + +Fix PathLike support for shutil.unpack_archive. Patch by Jelle Zijlstra. + +.. + +.. bpo: 10076 +.. date: 0281 +.. nonce: qCnwly +.. section: Library + +Compiled regular expression and match objects in the re module now support +copy.copy() and copy.deepcopy() (they are considered atomic). + +.. + +.. bpo: 30068 +.. date: 0280 +.. nonce: n4q47r +.. section: Library + +_io._IOBase.readlines will check if it's closed first when hint is present. + +.. + +.. bpo: 29694 +.. date: 0279 +.. nonce: LWKxb1 +.. section: Library + +Fixed race condition in pathlib mkdir with flags parents=True. Patch by +Armin Rigo. + +.. + +.. bpo: 29692 +.. date: 0278 +.. nonce: oyWrAE +.. section: Library + +Fixed arbitrary unchaining of RuntimeError exceptions in +contextlib.contextmanager. Patch by Siddharth Velankar. + +.. + +.. bpo: 26187 +.. date: 0277 +.. nonce: aViyiR +.. section: Library + +Test that sqlite3 trace callback is not called multiple times when schema is +changing. Indirectly fixed by switching to use sqlite3_prepare_v2() in +bpo-9303. Patch by Aviv Palivoda. + +.. + +.. bpo: 30017 +.. date: 0276 +.. nonce: cKBuhU +.. section: Library + +Allowed calling the close() method of the zip entry writer object multiple +times. Writing to a closed writer now always produces a ValueError. + +.. + +.. bpo: 29998 +.. date: 0275 +.. nonce: poeIKD +.. section: Library + +Pickling and copying ImportError now preserves name and path attributes. + +.. + +.. bpo: 29995 +.. date: 0274 +.. nonce: b3mOqx +.. section: Library + +re.escape() now escapes only regex special characters. + +.. + +.. bpo: 29962 +.. date: 0273 +.. nonce: r-ibsN +.. section: Library + +Add math.remainder operation, implementing remainder as specified in IEEE +754. + +.. + +.. bpo: 29649 +.. date: 0272 +.. nonce: 2eIxQ8 +.. section: Library + +Improve struct.pack_into() exception messages for problems with the buffer +size and offset. Patch by Andrew Nester. + +.. + +.. bpo: 29654 +.. date: 0271 +.. nonce: xRFPge +.. section: Library + +Support If-Modified-Since HTTP header (browser cache). Patch by Pierre +Quentel. + +.. + +.. bpo: 29931 +.. date: 0270 +.. nonce: tfcTwK +.. section: Library + +Fixed comparison check for ipaddress.ip_interface objects. Patch by Sanjay +Sundaresan. + +.. + +.. bpo: 29953 +.. date: 0269 +.. nonce: Q1hSt- +.. section: Library + +Fixed memory leaks in the replace() method of datetime and time objects when +pass out of bound fold argument. + +.. + +.. bpo: 29942 +.. date: 0268 +.. nonce: CsGNuT +.. section: Library + +Fix a crash in itertools.chain.from_iterable when encountering long runs of +empty iterables. + +.. + +.. bpo: 10030 +.. date: 0267 +.. nonce: ZdhU3k +.. section: Library + +Sped up reading encrypted ZIP files by 2 times. + +.. + +.. bpo: 29204 +.. date: 0266 +.. nonce: 8Hbqn2 +.. section: Library + +Element.getiterator() and the html parameter of XMLParser() were deprecated +only in the documentation (since Python 3.2 and 3.4 correspondintly). Now +using them emits a deprecation warning. + +.. + +.. bpo: 27863 +.. date: 0265 +.. nonce: pPYHHI +.. section: Library + +Fixed multiple crashes in ElementTree caused by race conditions and wrong +types. + +.. + +.. bpo: 25996 +.. date: 0264 +.. nonce: L2_giP +.. section: Library + +Added support of file descriptors in os.scandir() on Unix. os.fwalk() is +sped up by 2 times by using os.scandir(). + +.. + +.. bpo: 28699 +.. date: 0263 +.. nonce: wZztZP +.. section: Library + +Fixed a bug in pools in multiprocessing.pool that raising an exception at +the very first of an iterable may swallow the exception or make the program +hang. Patch by Davin Potts and Xiang Zhang. + +.. + +.. bpo: 23890 +.. date: 0262 +.. nonce: GCFAAZ +.. section: Library + +unittest.TestCase.assertRaises() now manually breaks a reference cycle to +not keep objects alive longer than expected. + +.. + +.. bpo: 29901 +.. date: 0261 +.. nonce: QdgMvW +.. section: Library + +The zipapp module now supports general path-like objects, not just +pathlib.Path. + +.. + +.. bpo: 25803 +.. date: 0260 +.. nonce: CPDR0W +.. section: Library + +Avoid incorrect errors raised by Path.mkdir(exist_ok=True) when the OS gives +priority to errors such as EACCES over EEXIST. + +.. + +.. bpo: 29861 +.. date: 0259 +.. nonce: t2ZoRK +.. section: Library + +Release references to tasks, their arguments and their results as soon as +they are finished in multiprocessing.Pool. + +.. + +.. bpo: 19930 +.. date: 0258 +.. nonce: QCjO6A +.. section: Library + +The mode argument of os.makedirs() no longer affects the file permission +bits of newly-created intermediate-level directories. + +.. + +.. bpo: 29884 +.. date: 0257 +.. nonce: kWXR8W +.. section: Library + +faulthandler: Restore the old sigaltstack during teardown. Patch by +Christophe Zeitouny. + +.. + +.. bpo: 25455 +.. date: 0256 +.. nonce: ZsahHN +.. section: Library + +Fixed crashes in repr of recursive buffered file-like objects. + +.. + +.. bpo: 29800 +.. date: 0255 +.. nonce: d2xASa +.. section: Library + +Fix crashes in partial.__repr__ if the keys of partial.keywords are not +strings. Patch by Michael Seifert. + +.. + +.. bpo: 8256 +.. date: 0254 +.. nonce: jAwGQH +.. section: Library + +Fixed possible failing or crashing input() if attributes "encoding" or +"errors" of sys.stdin or sys.stdout are not set or are not strings. + +.. + +.. bpo: 28692 +.. date: 0253 +.. nonce: CDt-Gb +.. section: Library + +Using non-integer value for selecting a plural form in gettext is now +deprecated. + +.. + +.. bpo: 26121 +.. date: 0252 +.. nonce: LX-pQA +.. section: Library + +Use C library implementation for math functions erf() and erfc(). + +.. + +.. bpo: 29619 +.. date: 0251 +.. nonce: WIGVxO +.. section: Library + +os.stat() and os.DirEntry.inode() now convert inode (st_ino) using unsigned +integers. + +.. + +.. bpo: 28298 +.. date: 0250 +.. nonce: PNOPsT +.. section: Library + +Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big intables +(objects that have __int__) as elements. + +.. + +.. bpo: 29645 +.. date: 0249 +.. nonce: XCxTHM +.. section: Library + +Speed up importing the webbrowser module. webbrowser.register() is now +thread-safe. + +.. + +.. bpo: 28231 +.. date: 0248 +.. nonce: MG1X09 +.. section: Library + +The zipfile module now accepts path-like objects for external paths. + +.. + +.. bpo: 26915 +.. date: 0247 +.. nonce: qShJZO +.. section: Library + +index() and count() methods of collections.abc.Sequence now check identity +before checking equality when do comparisons. + +.. + +.. bpo: 28682 +.. date: 0246 +.. nonce: hUxdej +.. section: Library + +Added support for bytes paths in os.fwalk(). + +.. + +.. bpo: 29728 +.. date: 0245 +.. nonce: 37jMwb +.. section: Library + +Add new :data:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constant. Patch by +Nathaniel J. Smith. + +.. + +.. bpo: 29623 +.. date: 0244 +.. nonce: D3-NP2 +.. section: Library + +Allow use of path-like object as a single argument in ConfigParser.read(). +Patch by David Ellis. + +.. + +.. bpo: 9303 +.. date: 0243 +.. nonce: kDZRSd +.. section: Library + +Migrate sqlite3 module to _v2 API. Patch by Aviv Palivoda. + +.. + +.. bpo: 28963 +.. date: 0242 +.. nonce: tPl8dq +.. section: Library + +Fix out of bound iteration in asyncio.Future.remove_done_callback +implemented in C. + +.. + +.. bpo: 29704 +.. date: 0241 +.. nonce: WHbx27 +.. section: Library + +asyncio.subprocess.SubprocessStreamProtocol no longer closes before all +pipes are closed. + +.. + +.. bpo: 29271 +.. date: 0240 +.. nonce: y8Vj2v +.. section: Library + +Fix Task.current_task and Task.all_tasks implemented in C to accept None +argument as their pure Python implementation. + +.. + +.. bpo: 29703 +.. date: 0239 +.. nonce: ZdsPCR +.. section: Library + +Fix asyncio to support instantiation of new event loops in child processes. + +.. + +.. bpo: 29615 +.. date: 0238 +.. nonce: OpFKzg +.. section: Library + +SimpleXMLRPCDispatcher no longer chains KeyError (or any other exception) to +exception(s) raised in the dispatched methods. Patch by Petr Motejlek. + +.. + +.. bpo: 7769 +.. date: 0237 +.. nonce: xGRJWh +.. section: Library + +Method register_function() of xmlrpc.server.SimpleXMLRPCDispatcher and its +subclasses can now be used as a decorator. + +.. + +.. bpo: 29376 +.. date: 0236 +.. nonce: rrJhJy +.. section: Library + +Fix assertion error in threading._DummyThread.is_alive(). + +.. + +.. bpo: 28624 +.. date: 0235 +.. nonce: 43TJib +.. section: Library + +Add a test that checks that cwd parameter of Popen() accepts PathLike +objects. Patch by Sayan Chowdhury. + +.. + +.. bpo: 28518 +.. date: 0234 +.. nonce: o-Q2Nw +.. section: Library + +Start a transaction implicitly before a DML statement. Patch by Aviv +Palivoda. + +.. + +.. bpo: 29742 +.. date: 0233 +.. nonce: 8hqfEO +.. section: Library + +get_extra_info() raises exception if get called on closed ssl transport. +Patch by Nikolay Kim. + +.. + +.. bpo: 16285 +.. date: 0232 +.. nonce: 4f5gbp +.. section: Library + +urrlib.parse.quote is now based on RFC 3986 and hence includes '~' in the +set of characters that is not quoted by default. Patch by Christian Theune +and Ratnadeep Debnath. + +.. + +.. bpo: 29532 +.. date: 0231 +.. nonce: YCwVQn +.. section: Library + +Altering a kwarg dictionary passed to functools.partial() no longer affects +a partial object after creation. + +.. + +.. bpo: 29110 +.. date: 0230 +.. nonce: wmE-_T +.. section: Library + +Fix file object leak in aifc.open() when file is given as a filesystem path +and is not in valid AIFF format. Patch by Anthony Zhang. + +.. + +.. bpo: 22807 +.. date: 0229 +.. nonce: VmoSkZ +.. section: Library + +Add uuid.SafeUUID and uuid.UUID.is_safe to relay information from the +platform about whether generated UUIDs are generated with a multiprocessing +safe method. + +.. + +.. bpo: 29576 +.. date: 0228 +.. nonce: F-b8_5 +.. section: Library + +Improve some deprecations in importlib. Some deprecated methods now emit +DeprecationWarnings and have better descriptive messages. + +.. + +.. bpo: 29534 +.. date: 0227 +.. nonce: Ug3HPU +.. section: Library + +Fixed different behaviour of Decimal.from_float() for _decimal and +_pydecimal. Thanks Andrew Nester. + +.. + +.. bpo: 10379 +.. date: 0226 +.. nonce: mRlZsT +.. section: Library + +locale.format_string now supports the 'monetary' keyword argument, and +locale.format is deprecated. + +.. + +.. bpo: 29851 +.. date: 0225 +.. nonce: jqs_5s +.. section: Library + +importlib.reload() now raises ModuleNotFoundError if the module lacks a +spec. + +.. + +.. bpo: 28556 +.. date: 0224 +.. nonce: p6967e +.. section: Library + +Various updates to typing module: typing.Counter, typing.ChainMap, improved +ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, Manuel +Krebber, and ?ukasz Langa. + +.. + +.. bpo: 29100 +.. date: 0223 +.. nonce: LAAERS +.. section: Library + +Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check +minimum and maximum years. + +.. + +.. bpo: 29416 +.. date: 0222 +.. nonce: KJGyI_ +.. section: Library + +Prevent infinite loop in pathlib.Path.mkdir + +.. + +.. bpo: 29444 +.. date: 0221 +.. nonce: cEwgmk +.. section: Library + +Fixed out-of-bounds buffer access in the group() method of the match object. +Based on patch by WGH. + +.. + +.. bpo: 29377 +.. date: 0220 +.. nonce: 4AvSrC +.. section: Library + +Add WrapperDescriptorType, MethodWrapperType, and MethodDescriptorType +built-in types to types module. Original patch by Manuel Krebber. + +.. + +.. bpo: 29218 +.. date: 0219 +.. nonce: -Qoti0 +.. section: Library + +Unused install_misc command is now removed. It has been documented as +unused since 2000. Patch by Eric N. Vander Weele. + +.. + +.. bpo: 29368 +.. date: 0218 +.. nonce: nTtA_V +.. section: Library + +The extend() method is now called instead of the append() method when +unpickle collections.deque and other list-like objects. This can speed up +unpickling to 2 times. + +.. + +.. bpo: 29338 +.. date: 0217 +.. nonce: EpvQJl +.. section: Library + +The help of a builtin or extension class now includes the constructor +signature if __text_signature__ is provided for the class. + +.. + +.. bpo: 29335 +.. date: 0216 +.. nonce: _KC7IK +.. section: Library + +Fix subprocess.Popen.wait() when the child process has exited to a stopped +instead of terminated state (ex: when under ptrace). + +.. + +.. bpo: 29290 +.. date: 0215 +.. nonce: XBqptF +.. section: Library + +Fix a regression in argparse that help messages would wrap at non-breaking +spaces. + +.. + +.. bpo: 28735 +.. date: 0214 +.. nonce: admHLO +.. section: Library + +Fixed the comparison of mock.MagickMock with mock.ANY. + +.. + +.. bpo: 29197 +.. date: 0213 +.. nonce: sZssFZ +.. section: Library + +Removed deprecated function ntpath.splitunc(). + +.. + +.. bpo: 29210 +.. date: 0212 +.. nonce: y1UHWf +.. section: Library + +Removed support of deprecated argument "exclude" in tarfile.TarFile.add(). + +.. + +.. bpo: 29219 +.. date: 0211 +.. nonce: kxui7t +.. section: Library + +Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances. + +.. + +.. bpo: 29192 +.. date: 0210 +.. nonce: mY31H8 +.. section: Library + +Removed deprecated features in the http.cookies module. + +.. + +.. bpo: 29193 +.. date: 0209 +.. nonce: CgcjEx +.. section: Library + +A format string argument for string.Formatter.format() is now positional- +only. + +.. + +.. bpo: 29195 +.. date: 0208 +.. nonce: vK5LjU +.. section: Library + +Removed support of deprecated undocumented keyword arguments in methods of +regular expression objects. + +.. + +.. bpo: 28969 +.. date: 0207 +.. nonce: j3HJYO +.. section: Library + +Fixed race condition in C implementation of functools.lru_cache. KeyError +could be raised when cached function with full cache was simultaneously +called from differen threads with the same uncached arguments. + +.. + +.. bpo: 20804 +.. date: 0206 +.. nonce: XyZhvi +.. section: Library + +The unittest.mock.sentinel attributes now preserve their identity when they +are copied or pickled. + +.. + +.. bpo: 29142 +.. date: 0205 +.. nonce: xo6kAv +.. section: Library + +In urllib.request, suffixes in no_proxy environment variable with leading +dots could match related hostnames again (e.g. .b.c matches a.b.c). Patch by +Milan Oberkirch. + +.. + +.. bpo: 28961 +.. date: 0204 +.. nonce: Rt93vg +.. section: Library + +Fix unittest.mock._Call helper: don't ignore the name parameter anymore. +Patch written by Jiajun Huang. + +.. + +.. bpo: 15812 +.. date: 0203 +.. nonce: R1U-Ec +.. section: Library + +inspect.getframeinfo() now correctly shows the first line of a context. +Patch by Sam Breese. + +.. + +.. bpo: 28985 +.. date: 0202 +.. nonce: TMWJFg +.. section: Library + +Update authorizer constants in sqlite3 module. Patch by Dingyuan Wang. + +.. + +.. bpo: 29079 +.. date: 0201 +.. nonce: g4YLix +.. section: Library + +Prevent infinite loop in pathlib.resolve() on Windows + +.. + +.. bpo: 13051 +.. date: 0200 +.. nonce: YzC1Te +.. section: Library + +Fixed recursion errors in large or resized curses.textpad.Textbox. Based on +patch by Tycho Andersen. + +.. + +.. bpo: 9770 +.. date: 0199 +.. nonce: WJJnwP +.. section: Library + +curses.ascii predicates now work correctly with negative integers. + +.. + +.. bpo: 28427 +.. date: 0198 +.. nonce: vUd-va +.. section: Library + +old keys should not remove new values from WeakValueDictionary when +collecting from another thread. + +.. + +.. bpo: 28923 +.. date: 0197 +.. nonce: naVULD +.. section: Library + +Remove editor artifacts from Tix.py. + +.. + +.. bpo: 28871 +.. date: 0196 +.. nonce: cPMXCJ +.. section: Library + +Fixed a crash when deallocate deep ElementTree. + +.. + +.. bpo: 19542 +.. date: 0195 +.. nonce: 5tCkaK +.. section: Library + +Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() +when a GC collection happens in another thread. + +.. + +.. bpo: 20191 +.. date: 0194 +.. nonce: Q7uZCS +.. section: Library + +Fixed a crash in resource.prlimit() when passing a sequence that doesn't own +its elements as limits. + +.. + +.. bpo: 16255 +.. date: 0193 +.. nonce: p2YA85 +.. section: Library + +subprocess.Popen uses /system/bin/sh on Android as the shell, instead of +/bin/sh. + +.. + +.. bpo: 28779 +.. date: 0192 +.. nonce: t-mjED +.. section: Library + +multiprocessing.set_forkserver_preload() would crash the forkserver process +if a preloaded module instantiated some multiprocessing objects such as +locks. + +.. + +.. bpo: 26937 +.. date: 0191 +.. nonce: c9kgiA +.. section: Library + +The chown() method of the tarfile.TarFile class does not fail now when the +grp module cannot be imported, as for example on Android platforms. + +.. + +.. bpo: 28847 +.. date: 0190 +.. nonce: GiWd9w +.. section: Library + +dbm.dumb now supports reading read-only files and no longer writes the index +file when it is not changed. A deprecation warning is now emitted if the +index file is missed and recreated in the 'r' and 'w' modes (will be an +error in future Python releases). + +.. + +.. bpo: 27030 +.. date: 0189 +.. nonce: GoGlFH +.. section: Library + +Unknown escapes consisting of ``'\'`` and an ASCII letter in re.sub() +replacement templates regular expressions now are errors. + +.. + +.. bpo: 28835 +.. date: 0188 +.. nonce: iWBYH7 +.. section: Library + +Fix a regression introduced in warnings.catch_warnings(): call +warnings.showwarning() if it was overridden inside the context manager. + +.. + +.. bpo: 27172 +.. date: 0187 +.. nonce: mVKfLT +.. section: Library + +To assist with upgrades from 2.7, the previously documented deprecation of +``inspect.getfullargspec()`` has been reversed. This decision may be +revisited again after the Python 2.7 branch is no longer officially +supported. + +.. + +.. bpo: 28740 +.. date: 0186 +.. nonce: rY8kz- +.. section: Library + +Add sys.getandroidapilevel(): return the build time API version of Android +as an integer. Function only available on Android. + +.. + +.. bpo: 26273 +.. date: 0185 +.. nonce: ilNIWN +.. section: Library + +Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and +:data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by +Omar Sandoval. + +.. + +.. bpo: 28752 +.. date: 0184 +.. nonce: Q-4oRE +.. section: Library + +Restored the __reduce__() methods of datetime objects. + +.. + +.. bpo: 28727 +.. date: 0183 +.. nonce: ubZP_b +.. section: Library + +Regular expression patterns, _sre.SRE_Pattern objects created by +re.compile(), become comparable (only x==y and x!=y operators). This change +should fix the issue #18383: don't duplicate warning filters when the +warnings module is reloaded (thing usually only done in unit tests). + +.. + +.. bpo: 20572 +.. date: 0182 +.. nonce: NCRmvz +.. section: Library + +Remove the subprocess.Popen.wait endtime parameter. It was deprecated in +3.4 and undocumented prior to that. + +.. + +.. bpo: 25659 +.. date: 0181 +.. nonce: lE2IlT +.. section: Library + +In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() +methods on abstract classes like Array. + +.. + +.. bpo: 28548 +.. date: 0180 +.. nonce: IeNrnG +.. section: Library + +In the "http.server" module, parse the protocol version if possible, to +avoid using HTTP 0.9 in some error responses. + +.. + +.. bpo: 19717 +.. date: 0179 +.. nonce: HXCAIz +.. section: Library + +Makes Path.resolve() succeed on paths that do not exist. Patch by Vajrasky +Kok + +.. + +.. bpo: 28563 +.. date: 0178 +.. nonce: iweEiw +.. section: Library + +Fixed possible DoS and arbitrary code execution when handle plural form +selections in the gettext module. The expression parser now supports exact +syntax supported by GNU gettext. + +.. + +.. bpo: 28387 +.. date: 0177 +.. nonce: 1clJu7 +.. section: Library + +Fixed possible crash in _io.TextIOWrapper deallocator when the garbage +collector is invoked in other thread. Based on patch by Sebastian Cufre. + +.. + +.. bpo: 27517 +.. date: 0176 +.. nonce: 1CYM8A +.. section: Library + +LZMA compressor and decompressor no longer raise exceptions if given empty +data twice. Patch by Benjamin Fogle. + +.. + +.. bpo: 28549 +.. date: 0175 +.. nonce: ShnM2y +.. section: Library + +Fixed segfault in curses's addch() with ncurses6. + +.. + +.. bpo: 28449 +.. date: 0174 +.. nonce: 5JK6ES +.. section: Library + +tarfile.open() with mode "r" or "r:" now tries to open a tar file with +compression before trying to open it without compression. Otherwise it had +50% chance failed with ignore_zeros=True. + +.. + +.. bpo: 23262 +.. date: 0173 +.. nonce: 6EVB7N +.. section: Library + +The webbrowser module now supports Firefox 36+ and derived browsers. Based +on patch by Oleg Broytman. + +.. + +.. bpo: 24241 +.. date: 0172 +.. nonce: y7N12p +.. section: Library + +The webbrowser in an X environment now prefers using the default browser +directly. Also, the webbrowser register() function now has a documented +'preferred' argument, to specify browsers to be returned by get() with no +arguments. Patch by David Steele + +.. + +.. bpo: 27939 +.. date: 0171 +.. nonce: mTfADV +.. section: Library + +Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by +representing the scale as float value internally in Tk. tkinter.IntVar now +works if float value is set to underlying Tk variable. + +.. + +.. bpo: 28255 +.. date: 0170 +.. nonce: G3iOPm +.. section: Library + +calendar.TextCalendar.prweek() no longer prints a space after a weeks's +calendar. calendar.TextCalendar.pryear() no longer prints redundant newline +after a year's calendar. Based on patch by Xiang Zhang. + +.. + +.. bpo: 28255 +.. date: 0169 +.. nonce: fHNZu0 +.. section: Library + +calendar.TextCalendar.prmonth() no longer prints a space at the start of new +line after printing a month's calendar. Patch by Xiang Zhang. + +.. + +.. bpo: 20491 +.. date: 0168 +.. nonce: ObgnQ2 +.. section: Library + +The textwrap.TextWrapper class now honors non-breaking spaces. Based on +patch by Kaarle Ritvanen. + +.. + +.. bpo: 28353 +.. date: 0167 +.. nonce: sKGbLL +.. section: Library + +os.fwalk() no longer fails on broken links. + +.. + +.. bpo: 28430 +.. date: 0166 +.. nonce: 4MiEYT +.. section: Library + +Fix iterator of C implemented asyncio.Future doesn't accept non-None value +is passed to it.send(val). + +.. + +.. bpo: 27025 +.. date: 0165 +.. nonce: foAViS +.. section: Library + +Generated names for Tkinter widgets now start by the "!" prefix for +readability. + +.. + +.. bpo: 25464 +.. date: 0164 +.. nonce: HDUTCu +.. section: Library + +Fixed HList.header_exists() in tkinter.tix module by addin a workaround to +Tix library bug. + +.. + +.. bpo: 28488 +.. date: 0163 +.. nonce: TgO112 +.. section: Library + +shutil.make_archive() no longer adds entry "./" to ZIP archive. + +.. + +.. bpo: 25953 +.. date: 0162 +.. nonce: EKKJAQ +.. section: Library + +re.sub() now raises an error for invalid numerical group reference in +replacement template even if the pattern is not found in the string. Error +message for invalid group reference now includes the group index and the +position of the reference. Based on patch by SilentGhost. + +.. + +.. bpo: 28469 +.. date: 0161 +.. nonce: QZW1Np +.. section: Library + +timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead of 1, 10, +100,... for autoranging. + +.. + +.. bpo: 28115 +.. date: 0160 +.. nonce: 4FIjIE +.. section: Library + +Command-line interface of the zipfile module now uses argparse. Added +support of long options. + +.. + +.. bpo: 18219 +.. date: 0159 +.. nonce: 1ANQN1 +.. section: Library + +Optimize csv.DictWriter for large number of columns. Patch by Mariatta +Wijaya. + +.. + +.. bpo: 28448 +.. date: 0158 +.. nonce: 5bduWe +.. section: Library + +Fix C implemented asyncio.Future didn't work on Windows. + +.. + +.. bpo: 23214 +.. date: 0157 +.. nonce: -4Q5Z7 +.. section: Library + +In the "io" module, the argument to BufferedReader and BytesIO's read1() +methods is now optional and can be -1, matching the BufferedIOBase +specification. + +.. + +.. bpo: 28480 +.. date: 0156 +.. nonce: 9lHw6m +.. section: Library + +Fix error building socket module when multithreading is disabled. + +.. + +.. bpo: 28240 +.. date: 0155 +.. nonce: hqzQvS +.. section: Library + +timeit: remove ``-c/--clock`` and ``-t/--time`` command line options which +were deprecated since Python 3.3. + +.. + +.. bpo: 28240 +.. date: 0154 +.. nonce: IwQMgd +.. section: Library + +timeit now repeats the benchmarks 5 times instead of only 3 to make +benchmarks more reliable. + +.. + +.. bpo: 28240 +.. date: 0153 +.. nonce: cXljq- +.. section: Library + +timeit autorange now uses a single loop iteration if the benchmark takes +less than 10 seconds, instead of 10 iterations. "python3 -m timeit -s +'import time' 'time.sleep(1)'" now takes 4 seconds instead of 40 seconds. + +.. + +.. bpo: 0 +.. date: 0152 +.. nonce: 5Y0ngw +.. section: Library + +Distutils.sdist now looks for README and setup.py files with case +sensitivity. This behavior matches that found in Setuptools 6.0 and later. +See `setuptools 100 `_ for +rationale. + +.. + +.. bpo: 24452 +.. date: 0151 +.. nonce: pVsjt0 +.. section: Library + +Make webbrowser support Chrome on Mac OS X. Patch by Ned Batchelder. + +.. + +.. bpo: 20766 +.. date: 0150 +.. nonce: 4kvCzx +.. section: Library + +Fix references leaked by pdb in the handling of SIGINT handlers. + +.. + +.. bpo: 27998 +.. date: 0149 +.. nonce: CPhy4H +.. section: Library + +Fixed bytes path support in os.scandir() on Windows. Patch by Eryk Sun. + +.. + +.. bpo: 28317 +.. date: 0148 +.. nonce: LgHleA +.. section: Library + +The disassembler now decodes FORMAT_VALUE argument. + +.. + +.. bpo: 28380 +.. date: 0147 +.. nonce: jKPMzH +.. section: Library + +unittest.mock Mock autospec functions now properly support assert_called, +assert_not_called, and assert_called_once. + +.. + +.. bpo: 28229 +.. date: 0146 +.. nonce: BKAxcS +.. section: Library + +lzma module now supports pathlib. + +.. + +.. bpo: 28321 +.. date: 0145 +.. nonce: bQ-IIX +.. section: Library + +Fixed writing non-BMP characters with binary format in plistlib. + +.. + +.. bpo: 28225 +.. date: 0144 +.. nonce: 6N28nu +.. section: Library + +bz2 module now supports pathlib. Initial patch by Ethan Furman. + +.. + +.. bpo: 28227 +.. date: 0143 +.. nonce: 7lUz8i +.. section: Library + +gzip now supports pathlib. Patch by Ethan Furman. + +.. + +.. bpo: 28332 +.. date: 0142 +.. nonce: Ed8fNk +.. section: Library + +Deprecated silent truncations in socket.htons and socket.ntohs. Original +patch by Oren Milman. + +.. + +.. bpo: 27358 +.. date: 0141 +.. nonce: t288Iv +.. section: Library + +Optimized merging var-keyword arguments and improved error message when +passing a non-mapping as a var-keyword argument. + +.. + +.. bpo: 28257 +.. date: 0140 +.. nonce: SVD_IH +.. section: Library + +Improved error message when passing a non-iterable as a var-positional +argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. + +.. + +.. bpo: 28322 +.. date: 0139 +.. nonce: l9hzap +.. section: Library + +Fixed possible crashes when unpickle itertools objects from incorrect pickle +data. Based on patch by John Leitch. + +.. + +.. bpo: 28228 +.. date: 0138 +.. nonce: 1qBwdM +.. section: Library + +imghdr now supports pathlib. + +.. + +.. bpo: 28226 +.. date: 0137 +.. nonce: nMXiwU +.. section: Library + +compileall now supports pathlib. + +.. + +.. bpo: 28314 +.. date: 0136 +.. nonce: N7YrkN +.. section: Library + +Fix function declaration (C flags) for the getiterator() method of +xml.etree.ElementTree.Element. + +.. + +.. bpo: 28148 +.. date: 0135 +.. nonce: Flzndx +.. section: Library + +Stop using localtime() and gmtime() in the time module. + +Introduced platform independent _PyTime_localtime API that is similar to +POSIX localtime_r, but available on all platforms. Patch by Ed Schouten. + +.. + +.. bpo: 28253 +.. date: 0134 +.. nonce: aLfmhe +.. section: Library + +Fixed calendar functions for extreme months: 0001-01 and 9999-12. + +Methods itermonthdays() and itermonthdays2() are reimplemented so that they +don't call itermonthdates() which can cause datetime.date under/overflow. + +.. + +.. bpo: 28275 +.. date: 0133 +.. nonce: EhWIsz +.. section: Library + +Fixed possible use after free in the decompress() methods of the +LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. + +.. + +.. bpo: 27897 +.. date: 0132 +.. nonce: I0Ppmx +.. section: Library + +Fixed possible crash in sqlite3.Connection.create_collation() if pass +invalid string-like object as a name. Patch by Xiang Zhang. + +.. + +.. bpo: 18844 +.. date: 0131 +.. nonce: fQsEdn +.. section: Library + +random.choices() now has k as a keyword-only argument to improve the +readability of common cases and come into line with the signature used in +other languages. + +.. + +.. bpo: 18893 +.. date: 0130 +.. nonce: osiX5c +.. section: Library + +Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by +Madison May. + +.. + +.. bpo: 27611 +.. date: 0129 +.. nonce: A_ArH_ +.. section: Library + +Fixed support of default root window in the tkinter.tix module. Added the +master parameter in the DisplayStyle constructor. + +.. + +.. bpo: 27348 +.. date: 0128 +.. nonce: tDx7Vw +.. section: Library + +In the traceback module, restore the formatting of exception messages like +"Exception: None". This fixes a regression introduced in 3.5a2. + +.. + +.. bpo: 25651 +.. date: 0127 +.. nonce: 3UhyPo +.. section: Library + +Allow falsy values to be used for msg parameter of subTest(). + +.. + +.. bpo: 27778 +.. date: 0126 +.. nonce: Yyo1aP +.. section: Library + +Fix a memory leak in os.getrandom() when the getrandom() is interrupted by a +signal and a signal handler raises a Python exception. + +.. + +.. bpo: 28200 +.. date: 0125 +.. nonce: 4IEbr7 +.. section: Library + +Fix memory leak on Windows in the os module (fix path_converter() function). + +.. + +.. bpo: 25400 +.. date: 0124 +.. nonce: d9Qn0E +.. section: Library + +RobotFileParser now correctly returns default values for crawl_delay and +request_rate. Initial patch by Peter Wirtz. + +.. + +.. bpo: 27932 +.. date: 0123 +.. nonce: mtgl-6 +.. section: Library + +Prevent memory leak in win32_ver(). + +.. + +.. bpo: 0 +.. date: 0122 +.. nonce: iPpjqX +.. section: Library + +Fix UnboundLocalError in socket._sendfile_use_sendfile. + +.. + +.. bpo: 28075 +.. date: 0121 +.. nonce: aLiUs9 +.. section: Library + +Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch +by Eryk Sun. + +.. + +.. bpo: 22493 +.. date: 0120 +.. nonce: Mv_hZf +.. section: Library + +Warning message emitted by using inline flags in the middle of regular +expression now contains a (truncated) regex pattern. Patch by Tim Graham. + +.. + +.. bpo: 25270 +.. date: 0119 +.. nonce: jrZruM +.. section: Library + +Prevent codecs.escape_encode() from raising SystemError when an empty +bytestring is passed. + +.. + +.. bpo: 28181 +.. date: 0118 +.. nonce: NGc4Yv +.. section: Library + +Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +.. + +.. bpo: 25895 +.. date: 0117 +.. nonce: j92qoQ +.. section: Library + +Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh +and Markus Holtermann. + +.. + +.. bpo: 28114 +.. date: 0116 +.. nonce: gmFXsA +.. section: Library + +Fix a crash in parse_envlist() when env contains byte strings. Patch by Eryk +Sun. + +.. + +.. bpo: 27599 +.. date: 0115 +.. nonce: itvm8T +.. section: Library + +Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +.. + +.. bpo: 27906 +.. date: 0114 +.. nonce: TBBXrv +.. section: Library + +Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. + +.. + +.. bpo: 28174 +.. date: 0113 +.. nonce: CV1UdI +.. section: Library + +Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael +Larson. + +.. + +.. bpo: 26654 +.. date: 0112 +.. nonce: XtzTE9 +.. section: Library + +Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. + +.. + +.. bpo: 26909 +.. date: 0111 +.. nonce: ASiakT +.. section: Library + +Fix slow pipes IO in asyncio. Patch by INADA Naoki. + +.. + +.. bpo: 28176 +.. date: 0110 +.. nonce: sU8R6L +.. section: Library + +Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +.. + +.. bpo: 27759 +.. date: 0109 +.. nonce: qpMDGq +.. section: Library + +Fix selectors incorrectly retain invalid file descriptors. Patch by Mark +Williams. + +.. + +.. bpo: 28325 +.. date: 0108 +.. nonce: wAHmnK +.. section: Library + +Remove vestigial MacOS 9 macurl2path module and its tests. + +.. + +.. bpo: 28368 +.. date: 0107 +.. nonce: n594X4 +.. section: Library + +Refuse monitoring processes if the child watcher has no loop attached. Patch +by Vincent Michel. + +.. + +.. bpo: 28369 +.. date: 0106 +.. nonce: 8DTANe +.. section: Library + +Raise RuntimeError when transport's FD is used with add_reader, add_writer, +etc. + +.. + +.. bpo: 28370 +.. date: 0105 +.. nonce: 18jBuZ +.. section: Library + +Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. + +.. + +.. bpo: 28371 +.. date: 0104 +.. nonce: U9Zqdk +.. section: Library + +Deprecate passing asyncio.Handles to run_in_executor. + +.. + +.. bpo: 28372 +.. date: 0103 +.. nonce: njcIPk +.. section: Library + +Fix asyncio to support formatting of non-python coroutines. + +.. + +.. bpo: 28399 +.. date: 0102 +.. nonce: QKIqRX +.. section: Library + +Remove UNIX socket from FS before binding. Patch by ????????? ????. + +.. + +.. bpo: 27972 +.. date: 0101 +.. nonce: ZK-GFm +.. section: Library + +Prohibit Tasks to await on themselves. + +.. + +.. bpo: 24142 +.. date: 0100 +.. nonce: IrZnFs +.. section: Library + +Reading a corrupt config file left configparser in an invalid state. +Original patch by Florian H?ch. + +.. + +.. bpo: 29581 +.. date: 0099 +.. nonce: gHCrxP +.. section: Library + +ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base classes to +use keyword parameters in __init_subclass__. Patch by Nate Soares. + +.. + +.. bpo: 25532 +.. date: 0098 +.. nonce: ey4Yez +.. section: Library + +inspect.unwrap() will now only try to unwrap an object +sys.getrecursionlimit() times, to protect against objects which create a new +object on every attribute access. + +.. + +.. bpo: 30177 +.. date: 0097 +.. nonce: JGIJNL +.. section: Library + +path.resolve(strict=False) no longer cuts the path after the first element +not present in the filesystem. Patch by Antoine Pietri. + +.. + +.. bpo: 31294 +.. date: 2017-09-07-20-49-09 +.. nonce: WgI18w +.. section: Documentation + +Fix incomplete code snippet in the ZeroMQSocketListener and +ZeroMQSocketHandler examples and adapt them to Python 3. + +.. + +.. bpo: 21649 +.. date: 2017-09-06-10-11-57 +.. nonce: EUvqA9 +.. section: Documentation + +Add RFC 7525 and Mozilla server side TLS links to SSL documentation. + +.. + +.. bpo: 31128 +.. date: 2017-08-31 +.. nonce: uoa3cr +.. section: Documentation + +Allow the pydoc server to bind to arbitrary hostnames. + +.. + +.. bpo: 30803 +.. date: 2017-07-29-14-55-50 +.. nonce: 6hutqQ +.. section: Documentation + +Clarify doc on truth value testing. Original patch by Peter Thomassen. + +.. + +.. bpo: 30176 +.. date: 0060 +.. nonce: VivmCg +.. section: Documentation + +Add missing attribute related constants in curses documentation. + +.. + +.. bpo: 30052 +.. date: 0059 +.. nonce: TpmpaF +.. section: Documentation + +the link targets for :func:`bytes` and :func:`bytearray` are now their +respective type definitions, rather than the corresponding builtin function +entries. Use :ref:`bytes ` and :ref:`bytearray ` +to reference the latter. + +In order to ensure this and future cross-reference updates are applied +automatically, the daily documentation builds now disable the default output +caching features in Sphinx. + +.. + +.. bpo: 26985 +.. date: 0058 +.. nonce: NB5_9S +.. section: Documentation + +Add missing info of code object in inspect documentation. + +.. + +.. bpo: 19824 +.. date: 0057 +.. nonce: We9an6 +.. section: Documentation + +Improve the documentation for, and links to, template strings by emphasizing +their utility for internationalization, and by clarifying some usage +constraints. (See also: bpo-20314, bpo-12518) + +.. + +.. bpo: 28929 +.. date: 0056 +.. nonce: Md7kb0 +.. section: Documentation + +Link the documentation to its source file on GitHub. + +.. + +.. bpo: 25008 +.. date: 0055 +.. nonce: CeIzyU +.. section: Documentation + +Document smtpd.py as effectively deprecated and add a pointer to aiosmtpd, a +third-party asyncio-based replacement. + +.. + +.. bpo: 26355 +.. date: 0054 +.. nonce: SDq_8Y +.. section: Documentation + +Add canonical header link on each page to corresponding major version of the +documentation. Patch by Matthias Bussonnier. + +.. + +.. bpo: 29349 +.. date: 0053 +.. nonce: PjSo-t +.. section: Documentation + +Fix Python 2 syntax in code for building the documentation. + +.. + +.. bpo: 23722 +.. date: 0052 +.. nonce: nFjY3C +.. section: Documentation + +The data model reference and the porting section in the 3.6 What's New guide +now cover the additional ``__classcell__`` handling needed for custom +metaclasses to fully support PEP 487 and zero-argument ``super()``. + +.. + +.. bpo: 28513 +.. date: 0051 +.. nonce: L3joAz +.. section: Documentation + +Documented command-line interface of zipfile. + +.. + +.. bpo: 29639 +.. date: 2017-09-08-15-59-07 +.. nonce: yIZecp +.. section: Tests + +test.support.HOST is now "localhost", a new HOSTv4 constant has been added +for your ``127.0.0.1`` needs, similar to the existing HOSTv6 constant. + +.. + +.. bpo: 31320 +.. date: 2017-09-05-14-23-35 +.. nonce: JRDHx7 +.. section: Tests + +Silence traceback in test_ssl + +.. + +.. bpo: 31346 +.. date: 2017-09-04-16-21-18 +.. nonce: xni1VR +.. section: Tests + +Prefer PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER protocols for SSLContext. + +.. + +.. bpo: 25674 +.. date: 2017-09-04-13-03-55 +.. nonce: whVTXh +.. section: Tests + +Remove sha256.tbs-internet.com ssl test + +.. + +.. bpo: 30715 +.. date: 2017-07-25-15-27-44 +.. nonce: Sp7bTF +.. section: Tests + +Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves +like OpenSSL 1.0.2 and no longer aborts handshake. + +.. + +.. bpo: 30822 +.. date: 2017-07-20-14-29-54 +.. nonce: X0wREo +.. section: Tests + +regrtest: Exclude tzdata from regrtest --all. When running the test suite +using --use=all / -u all, exclude tzdata since it makes test_datetime too +slow (15-20 min on some buildbots) which then times out on some buildbots. +Fix also regrtest command line parser to allow passing -u extralargefile to +run test_zipfile64. + +.. + +.. bpo: 30695 +.. date: 2017-06-30-11-20-20 +.. nonce: lo7FQX +.. section: Tests + +Add the `set_nomemory(start, stop)` and `remove_mem_hooks()` functions to +the _testcapi module. + +.. + +.. bpo: 30357 +.. date: 0012 +.. nonce: n4CPEa +.. section: Tests + +test_thread: setUp() now uses support.threading_setup() and +support.threading_cleanup() to wait until threads complete to avoid random +side effects on following tests. Initial patch written by Grzegorz Grzywacz. + +.. + +.. bpo: 30197 +.. date: 0011 +.. nonce: c5wRfu +.. section: Tests + +Enhanced functions swap_attr() and swap_item() in the test.support module. +They now work when delete replaced attribute or item inside the with +statement. The old value of the attribute or item (or None if it doesn't +exist) now will be assigned to the target of the "as" clause, if there is +one. + +.. + +.. bpo: 24932 +.. date: 0010 +.. nonce: XLTzvR +.. section: Tests + +Use proper command line parsing in _testembed + +.. + +.. bpo: 28950 +.. date: 0009 +.. nonce: 1W8Glo +.. section: Tests + +Disallow -j0 to be combined with -T/-l in regrtest command line arguments. + +.. + +.. bpo: 28683 +.. date: 0008 +.. nonce: Fp-Hdq +.. section: Tests + +Fix the tests that bind() a unix socket and raise PermissionError on Android +for a non-root user. + +.. + +.. bpo: 26936 +.. date: 0007 +.. nonce: XSZSVS +.. section: Tests + +Fix the test_socket failures on Android - getservbyname(), getservbyport() +and getaddrinfo() are broken on some Android API levels. + +.. + +.. bpo: 28666 +.. date: 0006 +.. nonce: RtTk-4 +.. section: Tests + +Now test.support.rmtree is able to remove unwritable or unreadable +directories. + +.. + +.. bpo: 23839 +.. date: 0005 +.. nonce: zsT_L9 +.. section: Tests + +Various caches now are cleared before running every test file. + +.. + +.. bpo: 26944 +.. date: 0004 +.. nonce: ChZ_BO +.. section: Tests + +Fix test_posix for Android where 'id -G' is entirely wrong or missing the +effective gid. + +.. + +.. bpo: 28409 +.. date: 0003 +.. nonce: Q2IlxJ +.. section: Tests + +regrtest: fix the parser of command line arguments. + +.. + +.. bpo: 28217 +.. date: 0002 +.. nonce: Y37OKV +.. section: Tests + +Adds _testconsole module to test console input. + +.. + +.. bpo: 26939 +.. date: 0001 +.. nonce: 7j_W5R +.. section: Tests + +Add the support.setswitchinterval() function to fix test_functools hanging +on the Android armv7 qemu emulator. + +.. + +.. bpo: 31354 +.. date: 2017-09-08-11-48-11 +.. nonce: 4f-VJK +.. section: Build + +Allow --with-lto to be used on all builds, not just `make profile-opt`. + +.. + +.. bpo: 31370 +.. date: 2017-09-06-23-14-08 +.. nonce: -j4kN4 +.. section: Build + +Remove support for building --without-threads. + +This option is not really useful anymore in the 21st century. Removing lots +of conditional paths allows us to simplify the code base, including in +difficult to maintain low-level internal code. + +.. + +.. bpo: 31341 +.. date: 2017-09-04-14-43-46 +.. nonce: XLuZFk +.. section: Build + +Per PEP 11, support for the IRIX operating system was removed. + +.. + +.. bpo: 30854 +.. date: 2017-07-05-16-54-59 +.. nonce: sPADRI +.. section: Build + +Fix compile error when compiling --without-threads. Patch by Masayuki +Yamamoto. + +.. + +.. bpo: 30687 +.. date: 0050 +.. nonce: 8mqHnu +.. section: Build + +Locate msbuild.exe on Windows when building rather than vcvarsall.bat + +.. + +.. bpo: 20210 +.. date: 0049 +.. nonce: MN_n-r +.. section: Build + +Support the *disabled* marker in Setup files. Extension modules listed after +this marker are not built at all, neither by the Makefile nor by setup.py. + +.. + +.. bpo: 29941 +.. date: 0048 +.. nonce: ylh45A +.. section: Build + +Add ``--with-assertions`` configure flag to explicitly enable C ``assert()`` +checks. Defaults to off. ``--with-pydebug`` implies ``--with-assertions``. + +.. + +.. bpo: 28787 +.. date: 0047 +.. nonce: vhH_6a +.. section: Build + +Fix out-of-tree builds of Python when configured with ``--with--dtrace``. + +.. + +.. bpo: 29243 +.. date: 0046 +.. nonce: WDK4hT +.. section: Build + +Prevent unnecessary rebuilding of Python during ``make test``, ``make +install`` and some other make targets when configured with ``--enable- +optimizations``. + +.. + +.. bpo: 23404 +.. date: 0045 +.. nonce: PdYVWg +.. section: Build + +Don't regenerate generated files based on file modification time anymore: +the action is now explicit. Replace ``make touch`` with ``make regen-all``. + +.. + +.. bpo: 29643 +.. date: 0044 +.. nonce: 4WLIJQ +.. section: Build + +Fix ``--enable-optimization`` didn't work. + +.. + +.. bpo: 27593 +.. date: 0043 +.. nonce: v87xEr +.. section: Build + +sys.version and the platform module python_build(), python_branch(), and +python_revision() functions now use git information rather than hg when +building from a repo. + +.. + +.. bpo: 29572 +.. date: 0042 +.. nonce: iZ1XKK +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2k. + +.. + +.. bpo: 27659 +.. date: 0041 +.. nonce: i8UzRC +.. section: Build + +Prohibit implicit C function declarations: use -Werror=implicit-function- +declaration when possible (GCC and Clang, but it depends on the compiler +version). Patch written by Chi Hsuan Yen. + +.. + +.. bpo: 29384 +.. date: 0040 +.. nonce: v3IqBE +.. section: Build + +Remove old Be OS helper scripts. + +.. + +.. bpo: 26851 +.. date: 0039 +.. nonce: R5243g +.. section: Build + +Set Android compilation and link flags. + +.. + +.. bpo: 28768 +.. date: 0038 +.. nonce: b9_a6E +.. section: Build + +Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto + +.. + +.. bpo: 29080 +.. date: 0037 +.. nonce: b3qLQT +.. section: Build + +Removes hard dependency on hg.exe from PCBuild/build.bat + +.. + +.. bpo: 23903 +.. date: 0036 +.. nonce: JXJ889 +.. section: Build + +Added missed names to PC/python3.def. + +.. + +.. bpo: 28762 +.. date: 0035 +.. nonce: Ru0YN_ +.. section: Build + +lockf() is available on Android API level 24, but the F_LOCK macro is not +defined in android-ndk-r13. + +.. + +.. bpo: 28538 +.. date: 0034 +.. nonce: FqtN7v +.. section: Build + +Fix the compilation error that occurs because if_nameindex() is available on +Android API level 24, but the if_nameindex structure is not defined. + +.. + +.. bpo: 20211 +.. date: 0033 +.. nonce: gpNptI +.. section: Build + +Do not add the directory for installing C header files and the directory for +installing object code libraries to the cross compilation search paths. +Original patch by Thomas Petazzoni. + +.. + +.. bpo: 28849 +.. date: 0032 +.. nonce: AzRRF5 +.. section: Build + +Do not define sys.implementation._multiarch on Android. + +.. + +.. bpo: 10656 +.. date: 0031 +.. nonce: pR8FFU +.. section: Build + +Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael +Haubenwallner. + +.. + +.. bpo: 26359 +.. date: 0030 +.. nonce: CLz6qy +.. section: Build + +Rename --with-optimiations to --enable-optimizations. + +.. + +.. bpo: 28444 +.. date: 0029 +.. nonce: zkc9nT +.. section: Build + +Fix missing extensions modules when cross compiling. + +.. + +.. bpo: 28208 +.. date: 0028 +.. nonce: DtoP1i +.. section: Build + +Update Windows build and OS X installers to use SQLite 3.14.2. + +.. + +.. bpo: 28248 +.. date: 0027 +.. nonce: KY_-en +.. section: Build + +Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +.. + +.. bpo: 21124 +.. date: 0026 +.. nonce: 1bbArU +.. section: Build + +Fix building the _struct module on Cygwin by passing ``NULL`` instead of +``&PyType_Type`` to PyVarObject_HEAD_INIT. Patch by Masayuki Yamamoto. + +.. + +.. bpo: 13756 +.. date: 0025 +.. nonce: sslhpC +.. section: Build + +Fix building extensions modules on Cygwin. Patch by Roumen Petrov, based on +original patch by Jason Tishler. + +.. + +.. bpo: 21085 +.. date: 0024 +.. nonce: 2VvyUF +.. section: Build + +Add configure check for siginfo_t.si_band, which Cygwin does not provide. +Patch by Masayuki Yamamoto with review and rebase by Erik Bray. + +.. + +.. bpo: 28258 +.. date: 0023 +.. nonce: iKtAHd +.. section: Build + +Fixed build with Estonian locale (python-config and distclean targets in +Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +.. + +.. bpo: 26661 +.. date: 0022 +.. nonce: Z_HNbs +.. section: Build + +setup.py now detects system libffi with multiarch wrapper. + +.. + +.. bpo: 27979 +.. date: 0021 +.. nonce: fR0KgM +.. section: Build + +A full copy of libffi is no longer bundled for use when building _ctypes on +non-OSX UNIX platforms. An installed copy of libffi is now required when +building _ctypes on such platforms. + +.. + +.. bpo: 15819 +.. date: 0020 +.. nonce: QVDr3E +.. section: Build + +Remove redundant include search directory option for building outside the +source tree. + +.. + +.. bpo: 28676 +.. date: 0019 +.. nonce: Wxf6Ds +.. section: Build + +Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth +Rees. + +.. + +.. bpo: 31392 +.. date: 2017-09-07-20-09-04 +.. nonce: h92bWF +.. section: Windows + +Update Windows build to use OpenSSL 1.1.0f + +.. + +.. bpo: 30389 +.. date: 2017-09-06-17-14-54 +.. nonce: 9Dizrx +.. section: Windows + +Adds detection of Visual Studio 2017 to distutils on Windows. + +.. + +.. bpo: 31358 +.. date: 2017-09-05-19-46-52 +.. nonce: n1Fjxc +.. section: Windows + +zlib is no longer bundled in the CPython source, instead it is downloaded on +demand just like bz2, lzma, OpenSSL, Tcl/Tk, and SQLite. + +.. + +.. bpo: 31340 +.. date: 2017-09-04-13-19-05 +.. nonce: MbkzLi +.. section: Windows + +Change to building with MSVC v141 (included with Visual Studio 2017) + +.. + +.. bpo: 30581 +.. date: 2017-08-04-10-05-19 +.. nonce: OQhR7l +.. section: Windows + +os.cpu_count() now returns the correct number of processors on Windows when +the number of logical processors is greater than 64. + +.. + +.. bpo: 30916 +.. date: 2017-07-15-00-40-12 +.. nonce: BpCrro +.. section: Windows + +Pre-build OpenSSL, Tcl and Tk and include the binaries in the build. + +.. + +.. bpo: 30731 +.. date: 2017-07-13-11-22-53 +.. nonce: nmMDwI +.. section: Windows + +Add a missing xmlns to python.manifest so that it matches the schema. + +.. + +.. bpo: 30291 +.. date: 2017-06-28-03-20-48 +.. nonce: zBpOl6 +.. section: Windows + +Allow requiring 64-bit interpreters from py.exe using -64 suffix. +Contributed by Steve (Gadget) Barnes. + +.. + +.. bpo: 30362 +.. date: 2017-06-28-03-08-22 +.. nonce: XxeVMB +.. section: Windows + +Adds list options (-0, -0p) to py.exe launcher. Contributed by Steve Barnes. + +.. + +.. bpo: 23451 +.. date: 2017-06-27-07-04-06 +.. nonce: bl_QOB +.. section: Windows + +Fix socket deprecation warnings in socketmodule.c. Patch by Segev Finer. + +.. + +.. bpo: 30450 +.. date: 0088 +.. nonce: qsaK8y +.. section: Windows + +The build process on Windows no longer depends on Subversion, instead +pulling external code from GitHub via a Python script. If Python 3.6 is not +found on the system (via ``py -3.6``), NuGet is used to download a copy of +32-bit Python. + +.. + +.. bpo: 29579 +.. date: 0087 +.. nonce: 07B-FQ +.. section: Windows + +Removes readme.txt from the installer. + +.. + +.. bpo: 25778 +.. date: 0086 +.. nonce: 8uKJ82 +.. section: Windows + +winreg does not truncate string correctly (Patch by Eryk Sun) + +.. + +.. bpo: 28896 +.. date: 0085 +.. nonce: qOcBBL +.. section: Windows + +Deprecate WindowsRegistryFinder and disable it by default + +.. + +.. bpo: 28522 +.. date: 0084 +.. nonce: XHMQa7 +.. section: Windows + +Fixes mishandled buffer reallocation in getpathp.c + +.. + +.. bpo: 28402 +.. date: 0083 +.. nonce: v9zETJ +.. section: Windows + +Adds signed catalog files for stdlib on Windows. + +.. + +.. bpo: 28333 +.. date: 0082 +.. nonce: KnpeO4 +.. section: Windows + +Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun) + +.. + +.. bpo: 28251 +.. date: 0081 +.. nonce: tR_AFs +.. section: Windows + +Improvements to help manuals on Windows. + +.. + +.. bpo: 28110 +.. date: 0080 +.. nonce: cnkP5F +.. section: Windows + +launcher.msi has different product codes between 32-bit and 64-bit + +.. + +.. bpo: 28161 +.. date: 0079 +.. nonce: hF91LI +.. section: Windows + +Opening CON for write access fails + +.. + +.. bpo: 28162 +.. date: 0078 +.. nonce: 3FHPVD +.. section: Windows + +WindowsConsoleIO readall() fails if first line starts with Ctrl+Z + +.. + +.. bpo: 28163 +.. date: 0077 +.. nonce: -DUgJw +.. section: Windows + +WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle + +.. + +.. bpo: 28164 +.. date: 0076 +.. nonce: 5MfN0J +.. section: Windows + +_PyIO_get_console_type fails for various paths + +.. + +.. bpo: 28137 +.. date: 0075 +.. nonce: C1uvzY +.. section: Windows + +Renames Windows path file to ._pth + +.. + +.. bpo: 28138 +.. date: 0074 +.. nonce: pNdv64 +.. section: Windows + +Windows ._pth file should allow import site + +.. + +.. bpo: 31493 +.. date: 2017-09-16-23-43-39 +.. nonce: nmHMCR +.. section: IDLE + +IDLE code context -- fix code update and font update timers. + +Canceling timers prevents a warning message when test_idle completes. + +.. + +.. bpo: 31488 +.. date: 2017-09-16-01-21-20 +.. nonce: 0rtXIT +.. section: IDLE + +IDLE - Update non-key options in former extension classes. When applying +configdialog changes, call .reload for each feature class. Change ParenMatch +so updated options affect existing instances attached to existing editor +windows. + +.. + +.. bpo: 31477 +.. date: 2017-09-15-12-38-47 +.. nonce: n__6sa +.. section: IDLE + +IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more +than blank spaces. Multiline string literals are not skipped. + +.. + +.. bpo: 31480 +.. date: 2017-09-14-17-53-53 +.. nonce: 4WJ0pl +.. section: IDLE + +IDLE - make tests pass with zzdummy extension disabled by default. + +.. + +.. bpo: 31421 +.. date: 2017-09-12-08-38-27 +.. nonce: mYfQNq +.. section: IDLE + +Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the +background in order to make live + +interaction and experimentatin with tkinter applications much easier. + +.. + +.. bpo: 31414 +.. date: 2017-09-11-15-46-05 +.. nonce: wiepgK +.. section: IDLE + +IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is +not the same as deleting and inserting because int('') will fail. + +.. + +.. bpo: 31051 +.. date: 2017-08-30-00-06-58 +.. nonce: 50Jp_Q +.. section: IDLE + +Rearrange IDLE condigdialog GenPage into Window, Editor, and Help sections. + +.. + +.. bpo: 30617 +.. date: 2017-08-27-16-49-36 +.. nonce: UHnswr +.. section: IDLE + +IDLE - Add docstrings and tests for outwin subclass of editor. + +Move some data and functions from the class to module level. Patch by Cheryl +Sabella. + +.. + +.. bpo: 31287 +.. date: 2017-08-27-15-31-33 +.. nonce: aZERfI +.. section: IDLE + +IDLE - Do not modify tkinter.message in test_configdialog. + +.. + +.. bpo: 27099 +.. date: 2017-08-24-13-48-16 +.. nonce: rENefC +.. section: IDLE + +Convert IDLE's built-in 'extensions' to regular features. + +About 10 IDLE features were implemented as supposedly optional extensions. +Their different behavior could be confusing or worse for users and not good +for maintenance. Hence the conversion. + +The main difference for users is that user configurable key bindings for +builtin features are now handled uniformly. Now, editing a binding in a +keyset only affects its value in the keyset. All bindings are defined +together in the system-specific default keysets in config- extensions.def. +All custom keysets are saved as a whole in config- extension.cfg. All take +effect as soon as one clicks Apply or Ok. + +The affected events are '<>', '<>', +'<>', '<>', '<>', '<>', '<>', and '<>'. Any (global) +customizations made before 3.6.3 will not affect their keyset- specific +customization after 3.6.3. and vice versa. + +Inital patch by Charles Wohlganger. + +.. + +.. bpo: 31206 +.. date: 2017-08-18-14-13-42 +.. nonce: F1-tKK +.. section: IDLE + +IDLE: Factor HighPage(Frame) class from ConfigDialog. Patch by Cheryl +Sabella. + +.. + +.. bpo: 31001 +.. date: 2017-08-17-15-00-20 +.. nonce: KLxYHC +.. section: IDLE + +Add tests for configdialog highlight tab. Patch by Cheryl Sabella. + +.. + +.. bpo: 31205 +.. date: 2017-08-15-12-58-23 +.. nonce: iuziZ5 +.. section: IDLE + +IDLE: Factor KeysPage(Frame) class from ConfigDialog. The slightly modified +tests continue to pass. Patch by Cheryl Sabella. + +.. + +.. bpo: 31130 +.. date: 2017-08-07-14-02-56 +.. nonce: FbsC7f +.. section: IDLE + +IDLE -- stop leaks in test_configdialog. Initial patch by Victor Stinner. + +.. + +.. bpo: 31002 +.. date: 2017-08-03-17-54-02 +.. nonce: kUSgTE +.. section: IDLE + +Add tests for configdialog keys tab. Patch by Cheryl Sabella. + +.. + +.. bpo: 19903 +.. date: 2017-08-03-14-08-42 +.. nonce: sqE1FS +.. section: IDLE + +IDLE: Calltips use `inspect.signature` instead of `inspect.getfullargspec`. +This improves calltips for builtins converted to use Argument Clinic. Patch +by Louie Lu. + +.. + +.. bpo: 31083 +.. date: 2017-07-31-23-20-51 +.. nonce: 991FXm +.. section: IDLE + +IDLE - Add an outline of a TabPage class in configdialog. Update existing +classes to match outline. Initial patch by Cheryl Sabella. + +.. + +.. bpo: 31050 +.. date: 2017-07-30-17-39-59 +.. nonce: AXR3kP +.. section: IDLE + +Factor GenPage(Frame) class from ConfigDialog. The slightly modified tests +continue to pass. Patch by Cheryl Sabella. + +.. + +.. bpo: 31004 +.. date: 2017-07-30-01-00-58 +.. nonce: m8cc1t +.. section: IDLE + +IDLE - Factor FontPage(Frame) class from ConfigDialog. + +Slightly modified tests continue to pass. Fix General tests. Patch mostly by +Cheryl Sabella. + +.. + +.. bpo: 30781 +.. date: 2017-07-28-18-59-06 +.. nonce: ud5m18 +.. section: IDLE + +IDLE - Use ttk widgets in ConfigDialog. Patches by Terry Jan Reedy and +Cheryl Sabella. + +.. + +.. bpo: 31060 +.. date: 2017-07-27-14-48-42 +.. nonce: GdY_VY +.. section: IDLE + +IDLE - Finish rearranging methods of ConfigDialog Grouping methods +pertaining to each tab and the buttons will aid writing tests and improving +the tabs and will enable splitting the groups into classes. + +.. + +.. bpo: 30853 +.. date: 2017-07-27-10-01-14 +.. nonce: enPvvc +.. section: IDLE + +IDLE -- Factor a VarTrace class out of ConfigDialog. + +Instance tracers manages pairs consisting of a tk variable and a callback +function. When tracing is turned on, setting the variable calls the +function. Test coverage for the new class is 100%. + +.. + +.. bpo: 31003 +.. date: 2017-07-25-01-28-35 +.. nonce: bYINVH +.. section: IDLE + +IDLE: Add more tests for General tab. + +.. + +.. bpo: 30993 +.. date: 2017-07-22-18-08-41 +.. nonce: 34vJkB +.. section: IDLE + +IDLE - Improve configdialog font page and tests. + +In configdialog: Document causal pathways in create_font_tab docstring. +Simplify some attribute names. Move set_samples calls to var_changed_font +(idea from Cheryl Sabella). Move related functions to positions after the +create widgets function. + +In test_configdialog: Fix test_font_set so not order dependent. Fix renamed +test_indent_scale so it tests the widget. Adjust tests for movement of +set_samples call. Add tests for load functions. Put all font tests in one +class and tab indent tests in another. Except for two lines, these tests +completely cover the related functions. + +.. + +.. bpo: 30981 +.. date: 2017-07-21-01-55-14 +.. nonce: ZFvQPt +.. section: IDLE + +IDLE -- Add more configdialog font page tests. + +.. + +.. bpo: 28523 +.. date: 2017-07-21-00-54-52 +.. nonce: OPcqYJ +.. section: IDLE + +IDLE: replace 'colour' with 'color' in configdialog. + +.. + +.. bpo: 30917 +.. date: 2017-07-17-23-35-57 +.. nonce: hSiuuO +.. section: IDLE + +Add tests for idlelib.config.IdleConf. Increase coverage from 46% to 96%. +Patch by Louie Lu. + +.. + +.. bpo: 30934 +.. date: 2017-07-15-22-26-57 +.. nonce: BanuSB +.. section: IDLE + +Document coverage details for idlelib tests. + +* Add section to idlelib/idle-test/README.txt. + +* Include check that branches are taken both ways. + +* Exclude IDLE-specific code that does not run during unit tests. + +.. + +.. bpo: 30913 +.. date: 2017-07-13-23-07-33 +.. nonce: aezn_e +.. section: IDLE + +IDLE: Document ConfigDialog tk Vars, methods, and widgets in docstrings This +will facilitate improving the dialog and splitting up the class. Original +patch by Cheryl Sabella. + +.. + +.. bpo: 30899 +.. date: 2017-07-11-02-26-17 +.. nonce: SQmVO8 +.. section: IDLE + +IDLE: Add tests for ConfigParser subclasses in config. Patch by Louie Lu. + +.. + +.. bpo: 30881 +.. date: 2017-07-11-02-21-42 +.. nonce: 4KAq_9 +.. section: IDLE + +IDLE: Add docstrings to browser.py. Patch by Cheryl Sabella. + +.. + +.. bpo: 30851 +.. date: 2017-07-09-23-53-00 +.. nonce: AHXBYa +.. section: IDLE + +IDLE: Remove unused variables in configdialog. One is a duplicate, one is +set but cannot be altered by users. Patch by Cheryl Sabella. + +.. + +.. bpo: 30870 +.. date: 2017-07-08-17-57-04 +.. nonce: IcR2pf +.. section: IDLE + +IDLE: In Settings dialog, select font with Up, Down keys as well as mouse. +Initial patch by Louie Lu. + +.. + +.. bpo: 8231 +.. date: 2017-07-07-21-10-55 +.. nonce: yEge3L +.. section: IDLE + +IDLE: call config.IdleConf.GetUserCfgDir only once. + +.. + +.. bpo: 30779 +.. date: 2017-07-07-20-26-37 +.. nonce: 8KXEXN +.. section: IDLE + +IDLE: Factor ConfigChanges class from configdialog, put in config; test. * +In config, put dump test code in a function; run it and unittest in 'if +__name__ == '__main__'. * Add class config.ConfigChanges based on +changes_class_v4.py on bpo issue. * Add class test_config.ChangesTest, +partly using configdialog_tests_v1.py. * Revise configdialog to use +ConfigChanges; see tracker msg297804. * Revise test_configdialog to match +configdialog changes. * Remove configdialog functions unused or moved to +ConfigChanges. Cheryl Sabella contributed parts of the patch. + +.. + +.. bpo: 30777 +.. date: 2017-07-04-22-45-46 +.. nonce: uxzlMB +.. section: IDLE + +IDLE: configdialog - Add docstrings and fix comments. Patch by Cheryl +Sabella. + +.. + +.. bpo: 30495 +.. date: 2017-06-29-18-23-06 +.. nonce: qIWgc4 +.. section: IDLE + +IDLE: Improve textview with docstrings, PEP8 names, and more tests. Patch by +Cheryl Sabella. + +.. + +.. bpo: 30723 +.. date: 2017-06-27-19-05-40 +.. nonce: rQh06y +.. section: IDLE + +IDLE: Make several improvements to parenmatch. Add 'parens' style to +highlight both opener and closer. Make 'default' style, which is not +default, a synonym for 'opener'. Make time-delay work the same with all +styles. Add help for config dialog extensions tab, including help for +parenmatch. Add new tests. Original patch by Charles Wohlganger. + +.. + +.. bpo: 30674 +.. date: 2017-06-27-01-40-34 +.. nonce: ppK_q8 +.. section: IDLE + +IDLE: add docstrings to grep module. Patch by Cheryl Sabella + +.. + +.. bpo: 21519 +.. date: 2017-06-27-00-29-56 +.. nonce: fTj9T0 +.. section: IDLE + +IDLE's basic custom key entry dialog now detects duplicates properly. +Original patch by Saimadhav Heblikar. + +.. + +.. bpo: 29910 +.. date: 2017-06-26-22-45-27 +.. nonce: mqHh7u +.. section: IDLE + +IDLE no longer deletes a character after commenting out a region by a key +shortcut. Add ``return 'break'`` for this and other potential conflicts +between IDLE and default key bindings. + +.. + +.. bpo: 30728 +.. date: 2017-06-26-15-47-13 +.. nonce: qH4TGL +.. section: IDLE + +Review and change idlelib.configdialog names. Lowercase method and attribute +names. Replace 'colour' with 'color', expand overly cryptic names, delete +unneeded underscores. Replace ``import *`` with specific imports. Patches by +Cheryl Sabella. + +.. + +.. bpo: 6739 +.. date: 2017-06-26-00-28-59 +.. nonce: x5MfhB +.. section: IDLE + +IDLE: Verify user-entered key sequences by trying to bind them with tk. Add +tests for all 3 validation functions. Original patch by G Polo. Tests added +by Cheryl Sabella. + +.. + +.. bpo: 15786 +.. date: 0096 +.. nonce: _XRbaR +.. section: IDLE + +Fix several problems with IDLE's autocompletion box. The following should +now work: clicking on selection box items; using the scrollbar; selecting an +item by hitting Return. Hangs on MacOSX should no longer happen. Patch by +Louie Lu. + +.. + +.. bpo: 25514 +.. date: 0095 +.. nonce: 882pXa +.. section: IDLE + +Add doc subsubsection about IDLE failure to start. Popup no-connection +message directs users to this section. + +.. + +.. bpo: 30642 +.. date: 0094 +.. nonce: 3Zujzt +.. section: IDLE + +Fix reference leaks in IDLE tests. Patches by Louie Lu and Terry Jan Reedy. + +.. + +.. bpo: 30495 +.. date: 0093 +.. nonce: I3i5vL +.. section: IDLE + +Add docstrings for textview.py and use PEP8 names. Patches by Cheryl Sabella +and Terry Jan Reedy. + +.. + +.. bpo: 30290 +.. date: 0092 +.. nonce: fZ3kod +.. section: IDLE + +Help-about: use pep8 names and add tests. Increase coverage to 100%. Patches +by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. + +.. + +.. bpo: 30303 +.. date: 0091 +.. nonce: 2L2F-4 +.. section: IDLE + +Add _utest option to textview; add new tests. Increase coverage to 100%. +Patches by Louie Lu and Terry Jan Reedy. + +.. + +.. bpo: 29071 +.. date: 0090 +.. nonce: FCOpJn +.. section: IDLE + +IDLE colors f-string prefixes (but not invalid ur prefixes). + +.. + +.. bpo: 28572 +.. date: 0089 +.. nonce: 1_duKY +.. section: IDLE + +Add 10% to coverage of IDLE's test_configdialog. Update and augment +description of the configuration system. + +.. + +.. bpo: 30983 +.. date: 2017-08-18-17-19-23 +.. nonce: ggGz9z +.. section: Tools/Demos + +gdb integration commands (py-bt, etc.) work on optimized shared builds now, +too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines +PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to +use py-bt, py-up, and a few other Python-specific gdb integrations. The +problem is fixed by only looking for _PyEval_EvalFrameDefault frames in +python-gdb.py. Original patch by Bruno "Polaco" Penteado. + +.. + +.. bpo: 29748 +.. date: 0018 +.. nonce: 6pV6s9 +.. section: Tools/Demos + +Added the slice index converter in Argument Clinic. + +.. + +.. bpo: 24037 +.. date: 0017 +.. nonce: KPFC7o +.. section: Tools/Demos + +Argument Clinic now uses the converter `bool(accept={int})` rather than +`int` for semantical booleans. This avoids repeating the default value for +Python and C and will help in converting to `bool` in future. + +.. + +.. bpo: 29367 +.. date: 0016 +.. nonce: 4dOKL0 +.. section: Tools/Demos + +python-gdb.py now supports also ``method-wrapper`` (``wrapperobject``) +objects. + +.. + +.. bpo: 28023 +.. date: 0015 +.. nonce: 4gzSGp +.. section: Tools/Demos + +Fix python-gdb.py didn't support new dict implementation. + +.. + +.. bpo: 15369 +.. date: 0014 +.. nonce: bdZ3n- +.. section: Tools/Demos + +The pybench and pystone microbenchmark have been removed from Tools. Please +use the new Python benchmark suite https://github.com/python/performance +which is more reliable and includes a portable version of pybench working on +Python 2 and Python 3. + +.. + +.. bpo: 28102 +.. date: 0013 +.. nonce: 5fKaek +.. section: Tools/Demos + +The zipfile module CLI now prints usage to stderr. Patch by Stephen J. +Turnbull. + +.. + +.. bpo: 31338 +.. date: 2017-09-05-17-51-12 +.. nonce: LjA43Y +.. section: C API + +Added the ``Py_UNREACHABLE()`` macro for code paths which are never expected +to be reached. This and a few other useful macros are now documented in the +C API manual. + +.. + +.. bpo: 30832 +.. date: 2017-07-03-17-25-40 +.. nonce: PcTAEP +.. section: C API + +Remove own implementation for thread-local storage. + +CPython has provided the own implementation for thread-local storage (TLS) +on Python/thread.c, it's used in the case which a platform has not supplied +native TLS. However, currently all supported platforms (Windows and +pthreads) have provided native TLS and defined the Py_HAVE_NATIVE_TLS macro +with unconditional in any case. + +.. + +.. bpo: 30708 +.. date: 0073 +.. nonce: np-l1j +.. section: C API + +PyUnicode_AsWideCharString() now raises a ValueError if the second argument +is NULL and the wchar_t\* string contains null characters. + +.. + +.. bpo: 16500 +.. date: 0072 +.. nonce: lRpooa +.. section: C API + +Deprecate PyOS_AfterFork() and add PyOS_BeforeFork(), +PyOS_AfterFork_Parent() and PyOS_AfterFork_Child(). + +.. + +.. bpo: 6532 +.. date: 0071 +.. nonce: qcH6k1 +.. section: C API + +The type of results of PyThread_start_new_thread() and +PyThread_get_thread_ident(), and the id parameter of +PyThreadState_SetAsyncExc() changed from "long" to "unsigned long". + +.. + +.. bpo: 27867 +.. date: 0070 +.. nonce: J-8CGo +.. section: C API + +Function PySlice_GetIndicesEx() is deprecated and replaced with a macro if +Py_LIMITED_API is not set or set to the value between 0x03050400 and +0x03060000 (not including) or 0x03060100 or higher. Added functions +PySlice_Unpack() and PySlice_AdjustIndices(). + +.. + +.. bpo: 29083 +.. date: 0069 +.. nonce: tGTjr_ +.. section: C API + +Fixed the declaration of some public API functions. PyArg_VaParse() and +PyArg_VaParseTupleAndKeywords() were not available in limited API. +PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() +were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is +defined. + +.. + +.. bpo: 28769 +.. date: 0068 +.. nonce: Ecmtn8 +.. section: C API + +The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8() is now of +type ``const char *`` rather of ``char *``. + +.. + +.. bpo: 29058 +.. date: 0067 +.. nonce: 0wNVP8 +.. section: C API + +All stable API extensions added after Python 3.2 are now available only when +Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python +version supporting this API. + +.. + +.. bpo: 28822 +.. date: 0066 +.. nonce: gMqwvb +.. section: C API + +The index parameters *start* and *end* of PyUnicode_FindChar() are now +adjusted to behave like ``str[start:end]``. + +.. + +.. bpo: 28808 +.. date: 0065 +.. nonce: A03X6r +.. section: C API + +PyUnicode_CompareWithASCIIString() now never raises exceptions. + +.. + +.. bpo: 28761 +.. date: 0064 +.. nonce: iOgCoX +.. section: C API + +The fields name and doc of structures PyMemberDef, PyGetSetDef, +PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of +type ``const char *`` rather of ``char *``. + +.. + +.. bpo: 28748 +.. date: 0063 +.. nonce: AMgb_G +.. section: C API + +Private variable _Py_PackageContext is now of type ``const char *`` rather +of ``char *``. + +.. + +.. bpo: 19569 +.. date: 0062 +.. nonce: IPke0J +.. section: C API + +Compiler warnings are now emitted if use most of deprecated functions. + +.. + +.. bpo: 28426 +.. date: 0061 +.. nonce: zPwvbI +.. section: C API + +Deprecated undocumented functions PyUnicode_AsEncodedObject(), +PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and +PyUnicode_AsEncodedUnicode(). diff --git a/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst b/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst deleted file mode 100644 index 89dcfc79aab..00000000000 --- a/Misc/NEWS.d/next/Build/0019.bpo-28676.Wxf6Ds.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth -Rees. diff --git a/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst b/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst deleted file mode 100644 index b5fdd6c8b66..00000000000 --- a/Misc/NEWS.d/next/Build/0020.bpo-15819.QVDr3E.rst +++ /dev/null @@ -1,2 +0,0 @@ -Remove redundant include search directory option for building outside the -source tree. diff --git a/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst b/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst deleted file mode 100644 index 305fea89328..00000000000 --- a/Misc/NEWS.d/next/Build/0021.bpo-27979.fR0KgM.rst +++ /dev/null @@ -1,3 +0,0 @@ -A full copy of libffi is no longer bundled for use when building _ctypes on -non-OSX UNIX platforms. An installed copy of libffi is now required when -building _ctypes on such platforms. diff --git a/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst b/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst deleted file mode 100644 index af6057ab781..00000000000 --- a/Misc/NEWS.d/next/Build/0022.bpo-26661.Z_HNbs.rst +++ /dev/null @@ -1 +0,0 @@ -setup.py now detects system libffi with multiarch wrapper. diff --git a/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst b/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst deleted file mode 100644 index b53e9479e5a..00000000000 --- a/Misc/NEWS.d/next/Build/0023.bpo-28258.iKtAHd.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed build with Estonian locale (python-config and distclean targets in -Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. diff --git a/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst b/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst deleted file mode 100644 index f470ccdea6a..00000000000 --- a/Misc/NEWS.d/next/Build/0024.bpo-21085.2VvyUF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add configure check for siginfo_t.si_band, which Cygwin does not provide. -Patch by Masayuki Yamamoto with review and rebase by Erik Bray. diff --git a/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst b/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst deleted file mode 100644 index b898c922d24..00000000000 --- a/Misc/NEWS.d/next/Build/0025.bpo-13756.sslhpC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix building extensions modules on Cygwin. Patch by Roumen Petrov, based on -original patch by Jason Tishler. diff --git a/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst b/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst deleted file mode 100644 index 85743127a28..00000000000 --- a/Misc/NEWS.d/next/Build/0026.bpo-21124.1bbArU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix building the _struct module on Cygwin by passing ``NULL`` instead of -``&PyType_Type`` to PyVarObject_HEAD_INIT. Patch by Masayuki Yamamoto. diff --git a/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst b/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst deleted file mode 100644 index 18d36930524..00000000000 --- a/Misc/NEWS.d/next/Build/0027.bpo-28248.KY_-en.rst +++ /dev/null @@ -1 +0,0 @@ -Update Windows build and OS X installers to use OpenSSL 1.0.2j. diff --git a/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst b/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst deleted file mode 100644 index 2deaf02c6dd..00000000000 --- a/Misc/NEWS.d/next/Build/0028.bpo-28208.DtoP1i.rst +++ /dev/null @@ -1 +0,0 @@ -Update Windows build and OS X installers to use SQLite 3.14.2. diff --git a/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst b/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst deleted file mode 100644 index 1df68241ca9..00000000000 --- a/Misc/NEWS.d/next/Build/0029.bpo-28444.zkc9nT.rst +++ /dev/null @@ -1 +0,0 @@ -Fix missing extensions modules when cross compiling. diff --git a/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst b/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst deleted file mode 100644 index 581ddaf48c4..00000000000 --- a/Misc/NEWS.d/next/Build/0030.bpo-26359.CLz6qy.rst +++ /dev/null @@ -1 +0,0 @@ -Rename --with-optimiations to --enable-optimizations. diff --git a/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst b/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst deleted file mode 100644 index 62cc5469b05..00000000000 --- a/Misc/NEWS.d/next/Build/0031.bpo-10656.pR8FFU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael -Haubenwallner. diff --git a/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst b/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst deleted file mode 100644 index 9aac0219edc..00000000000 --- a/Misc/NEWS.d/next/Build/0032.bpo-28849.AzRRF5.rst +++ /dev/null @@ -1 +0,0 @@ -Do not define sys.implementation._multiarch on Android. diff --git a/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst b/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst deleted file mode 100644 index 8bbea8d6a8a..00000000000 --- a/Misc/NEWS.d/next/Build/0033.bpo-20211.gpNptI.rst +++ /dev/null @@ -1,3 +0,0 @@ -Do not add the directory for installing C header files and the directory for -installing object code libraries to the cross compilation search paths. -Original patch by Thomas Petazzoni. diff --git a/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst b/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst deleted file mode 100644 index ddaf34a5c74..00000000000 --- a/Misc/NEWS.d/next/Build/0034.bpo-28538.FqtN7v.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the compilation error that occurs because if_nameindex() is available on -Android API level 24, but the if_nameindex structure is not defined. diff --git a/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst b/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst deleted file mode 100644 index 0bfb77e442b..00000000000 --- a/Misc/NEWS.d/next/Build/0035.bpo-28762.Ru0YN_.rst +++ /dev/null @@ -1,2 +0,0 @@ -lockf() is available on Android API level 24, but the F_LOCK macro is not -defined in android-ndk-r13. diff --git a/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst b/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst deleted file mode 100644 index 39ff22212a0..00000000000 --- a/Misc/NEWS.d/next/Build/0036.bpo-23903.JXJ889.rst +++ /dev/null @@ -1 +0,0 @@ -Added missed names to PC/python3.def. diff --git a/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst b/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst deleted file mode 100644 index 3a4b7bf4e12..00000000000 --- a/Misc/NEWS.d/next/Build/0037.bpo-29080.b3qLQT.rst +++ /dev/null @@ -1 +0,0 @@ -Removes hard dependency on hg.exe from PCBuild/build.bat diff --git a/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst b/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst deleted file mode 100644 index 702e14e1a94..00000000000 --- a/Misc/NEWS.d/next/Build/0038.bpo-28768.b9_a6E.rst +++ /dev/null @@ -1 +0,0 @@ -Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto diff --git a/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst b/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst deleted file mode 100644 index 1b34a703d33..00000000000 --- a/Misc/NEWS.d/next/Build/0039.bpo-26851.R5243g.rst +++ /dev/null @@ -1 +0,0 @@ -Set Android compilation and link flags. diff --git a/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst b/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst deleted file mode 100644 index ccd28085fcc..00000000000 --- a/Misc/NEWS.d/next/Build/0040.bpo-29384.v3IqBE.rst +++ /dev/null @@ -1 +0,0 @@ -Remove old Be OS helper scripts. diff --git a/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst b/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst deleted file mode 100644 index d7206592860..00000000000 --- a/Misc/NEWS.d/next/Build/0041.bpo-27659.i8UzRC.rst +++ /dev/null @@ -1,3 +0,0 @@ -Prohibit implicit C function declarations: use -Werror=implicit-function- -declaration when possible (GCC and Clang, but it depends on the compiler -version). Patch written by Chi Hsuan Yen. diff --git a/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst b/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst deleted file mode 100644 index 9bf71f90d81..00000000000 --- a/Misc/NEWS.d/next/Build/0042.bpo-29572.iZ1XKK.rst +++ /dev/null @@ -1 +0,0 @@ -Update Windows build and OS X installers to use OpenSSL 1.0.2k. diff --git a/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst b/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst deleted file mode 100644 index 5b345e67a86..00000000000 --- a/Misc/NEWS.d/next/Build/0043.bpo-27593.v87xEr.rst +++ /dev/null @@ -1,3 +0,0 @@ -sys.version and the platform module python_build(), python_branch(), and -python_revision() functions now use git information rather than hg when -building from a repo. diff --git a/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst b/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst deleted file mode 100644 index 65b958ffef4..00000000000 --- a/Misc/NEWS.d/next/Build/0044.bpo-29643.4WLIJQ.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``--enable-optimization`` didn't work. diff --git a/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst b/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst deleted file mode 100644 index 0addfd094f1..00000000000 --- a/Misc/NEWS.d/next/Build/0045.bpo-23404.PdYVWg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Don't regenerate generated files based on file modification time anymore: -the action is now explicit. Replace ``make touch`` with ``make regen-all``. diff --git a/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst b/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst deleted file mode 100644 index 378e49f67bc..00000000000 --- a/Misc/NEWS.d/next/Build/0046.bpo-29243.WDK4hT.rst +++ /dev/null @@ -1,3 +0,0 @@ -Prevent unnecessary rebuilding of Python during ``make test``, ``make -install`` and some other make targets when configured with ``--enable- -optimizations``. diff --git a/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst b/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst deleted file mode 100644 index 13ff8372e5c..00000000000 --- a/Misc/NEWS.d/next/Build/0047.bpo-28787.vhH_6a.rst +++ /dev/null @@ -1 +0,0 @@ -Fix out-of-tree builds of Python when configured with ``--with--dtrace``. diff --git a/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst b/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst deleted file mode 100644 index d36c9c0c8cd..00000000000 --- a/Misc/NEWS.d/next/Build/0048.bpo-29941.ylh45A.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add ``--with-assertions`` configure flag to explicitly enable C ``assert()`` -checks. Defaults to off. ``--with-pydebug`` implies ``--with-assertions``. diff --git a/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst b/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst deleted file mode 100644 index 3eb76d7764f..00000000000 --- a/Misc/NEWS.d/next/Build/0049.bpo-20210.MN_n-r.rst +++ /dev/null @@ -1,2 +0,0 @@ -Support the *disabled* marker in Setup files. Extension modules listed after -this marker are not built at all, neither by the Makefile nor by setup.py. diff --git a/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst b/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst deleted file mode 100644 index 9f37c075b84..00000000000 --- a/Misc/NEWS.d/next/Build/0050.bpo-30687.8mqHnu.rst +++ /dev/null @@ -1 +0,0 @@ -Locate msbuild.exe on Windows when building rather than vcvarsall.bat diff --git a/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst b/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst deleted file mode 100644 index f75aea420ad..00000000000 --- a/Misc/NEWS.d/next/Build/2017-07-05-16-54-59.bpo-30854.sPADRI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix compile error when compiling --without-threads. -Patch by Masayuki Yamamoto. diff --git a/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst b/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst deleted file mode 100644 index 1429d8b0e7d..00000000000 --- a/Misc/NEWS.d/next/Build/2017-09-04-14-43-46.bpo-31341.XLuZFk.rst +++ /dev/null @@ -1 +0,0 @@ -Per PEP 11, support for the IRIX operating system was removed. diff --git a/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst b/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst deleted file mode 100644 index 3e66eadcdb7..00000000000 --- a/Misc/NEWS.d/next/Build/2017-09-06-23-14-08.bpo-31370.-j4kN4.rst +++ /dev/null @@ -1,5 +0,0 @@ -Remove support for building --without-threads. - -This option is not really useful anymore in the 21st century. Removing lots -of conditional paths allows us to simplify the code base, including in -difficult to maintain low-level internal code. diff --git a/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst b/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst deleted file mode 100644 index b63c9ea6e01..00000000000 --- a/Misc/NEWS.d/next/Build/2017-09-08-11-48-11.bpo-31354.4f-VJK.rst +++ /dev/null @@ -1 +0,0 @@ -Allow --with-lto to be used on all builds, not just `make profile-opt`. diff --git a/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst b/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst deleted file mode 100644 index 9f18b725113..00000000000 --- a/Misc/NEWS.d/next/C API/0061.bpo-28426.zPwvbI.rst +++ /dev/null @@ -1,3 +0,0 @@ -Deprecated undocumented functions PyUnicode_AsEncodedObject(), -PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and -PyUnicode_AsEncodedUnicode(). diff --git a/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst b/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst deleted file mode 100644 index 703569af382..00000000000 --- a/Misc/NEWS.d/next/C API/0062.bpo-19569.IPke0J.rst +++ /dev/null @@ -1 +0,0 @@ -Compiler warnings are now emitted if use most of deprecated functions. diff --git a/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst b/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst deleted file mode 100644 index c0de814654f..00000000000 --- a/Misc/NEWS.d/next/C API/0063.bpo-28748.AMgb_G.rst +++ /dev/null @@ -1,2 +0,0 @@ -Private variable _Py_PackageContext is now of type ``const char *`` rather -of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst b/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst deleted file mode 100644 index 659edc15bfe..00000000000 --- a/Misc/NEWS.d/next/C API/0064.bpo-28761.iOgCoX.rst +++ /dev/null @@ -1,3 +0,0 @@ -The fields name and doc of structures PyMemberDef, PyGetSetDef, -PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of -type ``const char *`` rather of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst b/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst deleted file mode 100644 index 61276cdcc3d..00000000000 --- a/Misc/NEWS.d/next/C API/0065.bpo-28808.A03X6r.rst +++ /dev/null @@ -1 +0,0 @@ -PyUnicode_CompareWithASCIIString() now never raises exceptions. diff --git a/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst b/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst deleted file mode 100644 index 63a13c88528..00000000000 --- a/Misc/NEWS.d/next/C API/0066.bpo-28822.gMqwvb.rst +++ /dev/null @@ -1,2 +0,0 @@ -The index parameters *start* and *end* of PyUnicode_FindChar() are now -adjusted to behave like ``str[start:end]``. diff --git a/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst b/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst deleted file mode 100644 index 6f2fd6d05e7..00000000000 --- a/Misc/NEWS.d/next/C API/0067.bpo-29058.0wNVP8.rst +++ /dev/null @@ -1,3 +0,0 @@ -All stable API extensions added after Python 3.2 are now available only when -Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python -version supporting this API. diff --git a/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst b/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst deleted file mode 100644 index e2e7570ca98..00000000000 --- a/Misc/NEWS.d/next/C API/0068.bpo-28769.Ecmtn8.rst +++ /dev/null @@ -1,2 +0,0 @@ -The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8() is now of -type ``const char *`` rather of ``char *``. diff --git a/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst b/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst deleted file mode 100644 index 639fc25c972..00000000000 --- a/Misc/NEWS.d/next/C API/0069.bpo-29083.tGTjr_.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fixed the declaration of some public API functions. PyArg_VaParse() and -PyArg_VaParseTupleAndKeywords() were not available in limited API. -PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() -were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is -defined. diff --git a/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst b/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst deleted file mode 100644 index dbfeede9bfc..00000000000 --- a/Misc/NEWS.d/next/C API/0070.bpo-27867.J-8CGo.rst +++ /dev/null @@ -1,4 +0,0 @@ -Function PySlice_GetIndicesEx() is deprecated and replaced with a macro if -Py_LIMITED_API is not set or set to the value between 0x03050400 and -0x03060000 (not including) or 0x03060100 or higher. Added functions -PySlice_Unpack() and PySlice_AdjustIndices(). diff --git a/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst b/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst deleted file mode 100644 index 82b8e6b0b2f..00000000000 --- a/Misc/NEWS.d/next/C API/0071.bpo-6532.qcH6k1.rst +++ /dev/null @@ -1,3 +0,0 @@ -The type of results of PyThread_start_new_thread() and -PyThread_get_thread_ident(), and the id parameter of -PyThreadState_SetAsyncExc() changed from "long" to "unsigned long". diff --git a/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst b/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst deleted file mode 100644 index 521aea80bd6..00000000000 --- a/Misc/NEWS.d/next/C API/0072.bpo-16500.lRpooa.rst +++ /dev/null @@ -1,2 +0,0 @@ -Deprecate PyOS_AfterFork() and add PyOS_BeforeFork(), -PyOS_AfterFork_Parent() and PyOS_AfterFork_Child(). diff --git a/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst b/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst deleted file mode 100644 index f74ca22b184..00000000000 --- a/Misc/NEWS.d/next/C API/0073.bpo-30708.np-l1j.rst +++ /dev/null @@ -1,2 +0,0 @@ -PyUnicode_AsWideCharString() now raises a ValueError if the second argument -is NULL and the wchar_t\* string contains null characters. diff --git a/Misc/NEWS.d/next/C API/2017-07-03-17-25-40.bpo-30832.PcTAEP.rst b/Misc/NEWS.d/next/C API/2017-07-03-17-25-40.bpo-30832.PcTAEP.rst deleted file mode 100644 index 1cdacf3913a..00000000000 --- a/Misc/NEWS.d/next/C API/2017-07-03-17-25-40.bpo-30832.PcTAEP.rst +++ /dev/null @@ -1,7 +0,0 @@ -Remove own implementation for thread-local storage. - -CPython has provided the own implementation for thread-local storage (TLS) -on Python/thread.c, it's used in the case which a platform has not supplied -native TLS. However, currently all supported platforms (Windows and pthreads) -have provided native TLS and defined the Py_HAVE_NATIVE_TLS macro with -unconditional in any case. diff --git a/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst b/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst deleted file mode 100644 index 01878e5d43f..00000000000 --- a/Misc/NEWS.d/next/C API/2017-09-05-17-51-12.bpo-31338.LjA43Y.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added the ``Py_UNREACHABLE()`` macro for code paths which are never expected -to be reached. This and a few other useful macros are now documented in the -C API manual. diff --git a/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst b/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst deleted file mode 100644 index b0f63ad24e9..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0353.bpo-26110.KRaID6.rst +++ /dev/null @@ -1 +0,0 @@ -Speed-up method calls: add LOAD_METHOD and CALL_METHOD opcodes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst b/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst deleted file mode 100644 index 3dbd1a3168f..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0354.bpo-28721.BO9BUF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix asynchronous generators aclose() and athrow() to handle -StopAsyncIteration propagation properly. diff --git a/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst b/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst deleted file mode 100644 index e856dd28e9f..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0355.bpo-26182.a8JXK2.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a refleak in code that raises DeprecationWarning. diff --git a/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst b/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst deleted file mode 100644 index a02818573c2..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0356.bpo-26182.jYlqTO.rst +++ /dev/null @@ -1,2 +0,0 @@ -Raise DeprecationWarning when async and await keywords are used as -variable/attribute/class/function name. diff --git a/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst b/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst deleted file mode 100644 index 55775ebab3f..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0357.bpo-28120.e5xc1i.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix dict.pop() for splitted dictionary when trying to remove a "pending key" -(Not yet inserted in split-table). Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst b/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst deleted file mode 100644 index 162ee3815cd..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0358.bpo-28126.Qf6-uQ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize -memcpy(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst b/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst deleted file mode 100644 index f532fa17d19..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0359.bpo-28131.owq0wW.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a regression in zipimport's compile_source(). zipimport should use the -same optimization level as the interpreter. diff --git a/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst b/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst deleted file mode 100644 index b72692d191f..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0360.bpo-0.9EbOiD.rst +++ /dev/null @@ -1 +0,0 @@ -Upgrade internal unicode databases to Unicode version 9.0.0. diff --git a/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst b/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst deleted file mode 100644 index 93410fa121c..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0361.bpo-27222.74PvFk.rst +++ /dev/null @@ -1 +0,0 @@ -Clean up redundant code in long_rshift function. Thanks Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst b/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst deleted file mode 100644 index 2dd799d63b3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0362.bpo-27441.scPKax.rst +++ /dev/null @@ -1,2 +0,0 @@ -Remove some redundant assignments to ob_size in longobject.c. Thanks Oren -Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst b/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst deleted file mode 100644 index cc6e57cb3d6..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0363.bpo-28192.eR6stU.rst +++ /dev/null @@ -1 +0,0 @@ -Don't import readline in isolated mode. diff --git a/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst b/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst deleted file mode 100644 index d977df70dcc..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0364.bpo-27955.HC4pZ4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fallback on reading /dev/urandom device when the getrandom() syscall fails -with EPERM, for example when blocked by SECCOMP. diff --git a/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst b/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst deleted file mode 100644 index 29afe9cb122..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0365.bpo-28214.zQF8Em.rst +++ /dev/null @@ -1 +0,0 @@ -Now __set_name__ is looked up on the class instead of the instance. diff --git a/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst b/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst deleted file mode 100644 index faa9e3cf46e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0366.bpo-28086.JsQPMQ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Single var-positional argument of tuple subtype was passed unscathed to the -C-defined function. Now it is converted to exact tuple. diff --git a/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst b/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst deleted file mode 100644 index 687a7e9aeb3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0367.bpo-28203.LRn5vp.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix incorrect type in complex(1.0, {2:3}) error message. Patch by Soumya -Sharma. diff --git a/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst b/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst deleted file mode 100644 index 15c4de36950..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0368.bpo-21578.GI1bhj.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed misleading error message when ImportError called with invalid keyword -args. diff --git a/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst b/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst deleted file mode 100644 index 577e3f0a9b2..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0369.bpo-28289.l1kHlV.rst +++ /dev/null @@ -1 +0,0 @@ -ImportError.__init__ now resets not specified attributes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst b/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst deleted file mode 100644 index ca8dfef90ae..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0370.bpo-27942.ZGuhns.rst +++ /dev/null @@ -1 +0,0 @@ -String constants now interned recursively in tuples and frozensets. diff --git a/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst b/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst deleted file mode 100644 index c3a41396df8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0371.bpo-26617.Gh5LvN.rst +++ /dev/null @@ -1 +0,0 @@ -Fix crash when GC runs during weakref callbacks. diff --git a/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst b/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst deleted file mode 100644 index 013b3e13fab..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0372.bpo-28350.8M5Eg9.rst +++ /dev/null @@ -1 +0,0 @@ -String constants with null character no longer interned. diff --git a/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst b/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst deleted file mode 100644 index d1b56f52909..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0373.bpo-28201.GWUxAy.rst +++ /dev/null @@ -1,2 +0,0 @@ -Dict reduces possibility of 2nd conflict in hash table when hashes have same -lower bits. diff --git a/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst b/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst deleted file mode 100644 index 82897ed22f3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0374.bpo-24098.XqlP_1.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed possible crash when AST is changed in process of compiling it. diff --git a/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst b/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst deleted file mode 100644 index 5ed03823842..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0375.bpo-18287.k6jffS.rst +++ /dev/null @@ -1,2 +0,0 @@ -PyType_Ready() now checks that tp_name is not NULL. Original patch by Niklas -Koep. diff --git a/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst b/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst deleted file mode 100644 index 9927fc9441b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0376.bpo-26906.YBjcwI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Resolving special methods of uninitialized type now causes implicit -initialization of the type instead of a fail. diff --git a/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst b/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst deleted file mode 100644 index 48cd8ca3547..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0377.bpo-28376.yTEhEo.rst +++ /dev/null @@ -1,3 +0,0 @@ -Creating instances of range_iterator by calling range_iterator type now is -disallowed. Calling iter() on range instance is the only way. Patch by Oren -Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst b/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst deleted file mode 100644 index 0beccca88e9..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0378.bpo-28376.oPD-5D.rst +++ /dev/null @@ -1,2 +0,0 @@ -The type of long range iterator is now registered as Iterator. Patch by Oren -Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst b/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst deleted file mode 100644 index 023812b6291..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0379.bpo-28379.DuXlco.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang -Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst b/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst deleted file mode 100644 index ada55163762..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0380.bpo-26081._x5vjl.rst +++ /dev/null @@ -1 +0,0 @@ -Added C implementation of asyncio.Future. Original patch by Yury Selivanov. diff --git a/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst b/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst deleted file mode 100644 index 2453de1d600..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0381.bpo-28183.MJZeNd.rst +++ /dev/null @@ -1 +0,0 @@ -Optimize and cleanup dict iteration. diff --git a/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst b/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst deleted file mode 100644 index 36e85d8f2dc..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0382.bpo-23782.lonDzj.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible memory leak in _PyTraceback_Add() and exception loss in -PyTraceBack_Here(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst b/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst deleted file mode 100644 index b73c752dc2e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0383.bpo-28214.6ECJox.rst +++ /dev/null @@ -1 +0,0 @@ -Improved exception reporting for problematic __set_name__ attributes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst b/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst deleted file mode 100644 index 96ef7e082d5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0384.bpo-28517.ExPkm9.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed of-by-one error in the peephole optimizer that caused keeping -unreachable code. diff --git a/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst b/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst deleted file mode 100644 index f21b3db00cf..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0385.bpo-28426.E_quyK.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. diff --git a/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst b/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst deleted file mode 100644 index 040b7e7764e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0386.bpo-28509._Fa4Uq.rst +++ /dev/null @@ -1 +0,0 @@ -dict.update() no longer allocate unnecessary large memory. diff --git a/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst b/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst deleted file mode 100644 index aac57afe022..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0387.bpo-28128.Lc2sFu.rst +++ /dev/null @@ -1,3 +0,0 @@ -Deprecation warning for invalid str and byte escape sequences now prints -better information about where the error occurs. Patch by Serhiy Storchaka -and Eric Smith. diff --git a/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst b/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst deleted file mode 100644 index 9ead27d33de..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0388.bpo-28583.F-QAx1.rst +++ /dev/null @@ -1,2 +0,0 @@ -PyDict_SetDefault didn't combine split table when needed. Patch by Xiang -Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst b/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst deleted file mode 100644 index cfc9737b72b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0389.bpo-28580.8bqBmG.rst +++ /dev/null @@ -1 +0,0 @@ -Optimize iterating split table values. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst b/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst deleted file mode 100644 index 41d9b728140..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0390.bpo-28621.eCD7n-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Sped up converting int to float by reusing faster bits counting -implementation. Patch by Adrian Wielgosik. diff --git a/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst b/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst deleted file mode 100644 index ba89b2a113f..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0391.bpo-19398.RYbEGH.rst +++ /dev/null @@ -1,2 +0,0 @@ -Extra slash no longer added to sys.path components in case of empty compile- -time PYTHONPATH components. diff --git a/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst b/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst deleted file mode 100644 index b9e965d11de..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0392.bpo-28665.v4nx86.rst +++ /dev/null @@ -1 +0,0 @@ -Improve speed of the STORE_DEREF opcode by 40%. diff --git a/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst b/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst deleted file mode 100644 index 48b17ff194a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0393.bpo-28648.z7B52W.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode -astral characters. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst b/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst deleted file mode 100644 index 7d003d075f9..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0394.bpo-26920.1URwGb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix not getting the locale's charset upon initializing the interpreter, on -platforms that do not have langinfo. diff --git a/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst b/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst deleted file mode 100644 index 28a6112e89b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0395.bpo-28746.r5MXdB.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the set_inheritable() file descriptor method on platforms that do not -have the ioctl FIOCLEX and FIONCLEX commands. diff --git a/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst b/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst deleted file mode 100644 index a5c27b6fa4b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0396.bpo-27100.poVjXq.rst +++ /dev/null @@ -1,3 +0,0 @@ -The with-statement now checks for __enter__ before it checks for __exit__. -This gives less confusing error messages when both methods are missing. -Patch by Jonathan Ellington. diff --git a/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst b/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst deleted file mode 100644 index 3a058ac82c3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0397.bpo-28532.KEYJny.rst +++ /dev/null @@ -1 +0,0 @@ -Show sys.version when -V option is supplied twice. diff --git a/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst b/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst deleted file mode 100644 index a2fa1d5027e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0398.bpo-28731.oNF59u.rst +++ /dev/null @@ -1,2 +0,0 @@ -Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of -dict literal with constant keys up to 30%. diff --git a/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst b/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst deleted file mode 100644 index 1f67061b168..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0399.bpo-28774.cEehAr.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix error position of the unicode error in ASCII and Latin1 encoders when a -string returned by the error handler contains multiple non-encodable -characters (non-ASCII for the ASCII codec, characters out of the -U+0000-U+00FF range for Latin1). diff --git a/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst b/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst deleted file mode 100644 index 7a1ab498406..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0400.bpo-28782.foJV_E.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a bug in the implementation ``yield from`` when checking if the next -instruction is YIELD_FROM. Regression introduced by WORDCODE (issue #26647). diff --git a/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst b/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst deleted file mode 100644 index 3704fbaf0fb..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0401.bpo-12844.pdr3gY.rst +++ /dev/null @@ -1 +0,0 @@ -More than 255 arguments can now be passed to a function. diff --git a/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst b/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst deleted file mode 100644 index 95fe72c0e71..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0402.bpo-28799.cP6V1N.rst +++ /dev/null @@ -1,4 +0,0 @@ -Remove the ``PyEval_GetCallStats()`` function and deprecate the untested and -undocumented ``sys.callstats()`` function. Remove the ``CALL_PROFILE`` -special build: use the :func:`sys.setprofile` function, :mod:`cProfile` or -:mod:`profile` to profile function calls. diff --git a/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst b/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst deleted file mode 100644 index 8735cad80ca..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0403.bpo-28797._A0_Z5.rst +++ /dev/null @@ -1,3 +0,0 @@ -Modifying the class __dict__ inside the __set_name__ method of a descriptor -that is used inside that class no longer prevents calling the __set_name__ -method of other descriptors. diff --git a/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst b/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst deleted file mode 100644 index b387559db31..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0404.bpo-23722.e8BH5h.rst +++ /dev/null @@ -1,4 +0,0 @@ -Rather than silently producing a class that doesn't support zero-argument -``super()`` in methods, failing to pass the new ``__classcell__`` namespace -entry up to ``type.__new__`` now results in a ``DeprecationWarning`` and a -class that supports zero-argument ``super()``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst b/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst deleted file mode 100644 index a3b924753a8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0405.bpo-28918.SFVuPz.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the cross compilation of xxlimited when Python has been built with -Py_DEBUG defined. diff --git a/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst b/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst deleted file mode 100644 index 058da76ca79..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0406.bpo-28512.i-pv6d.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed setting the offset attribute of SyntaxError by -PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst b/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst deleted file mode 100644 index 10be6c33d94..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0407.bpo-28739.w1fvhk.rst +++ /dev/null @@ -1,2 +0,0 @@ -f-string expressions are no longer accepted as docstrings and by -ast.literal_eval() even if they do not include expressions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst b/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst deleted file mode 100644 index 61882116776..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0408.bpo-28147.CnK_xf.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a memory leak in split-table dictionaries: setattr() must not convert -combined table into split table. Patch written by INADA Naoki. diff --git a/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst b/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst deleted file mode 100644 index f9999731db0..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0409.bpo-28991.lGA0FK.rst +++ /dev/null @@ -1,2 +0,0 @@ -functools.lru_cache() was susceptible to an obscure reentrancy bug -triggerable by a monkey-patched len() function. diff --git a/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst b/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst deleted file mode 100644 index 7be06401e41..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0410.bpo-26919.Cm7MSa.rst +++ /dev/null @@ -1,3 +0,0 @@ -On Android, operating system data is now always encoded/decoded to/from -UTF-8, instead of the locale encoding to avoid inconsistencies with -os.fsencode() and os.fsdecode() which are already using UTF-8. diff --git a/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst b/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst deleted file mode 100644 index a5a89e13450..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0411.bpo-22257.2a8zxB.rst +++ /dev/null @@ -1 +0,0 @@ -Clean up interpreter startup (see PEP 432). diff --git a/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst b/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst deleted file mode 100644 index 9f63ef982a9..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0412.bpo-28596.snIJRd.rst +++ /dev/null @@ -1 +0,0 @@ -The preferred encoding is UTF-8 on Android. Patch written by Chi Hsuan Yen. diff --git a/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst b/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst deleted file mode 100644 index a67dc93dfb8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0413.bpo-18896.Pqe0bg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Python function can now have more than 255 parameters. -collections.namedtuple() now supports tuples with more than 255 elements. diff --git a/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst b/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst deleted file mode 100644 index 94c8b054e87..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0414.bpo-29000.K6wQ-3.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed bytes formatting of octals with zero padding in alternate form. diff --git a/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst b/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst deleted file mode 100644 index f665835a296..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0415.bpo-25677.RWhZrb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Correct the positioning of the syntax error caret for indented blocks. -Based on patch by Michael Layzell. diff --git a/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst b/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst deleted file mode 100644 index e20901189b2..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0416.bpo-28932.QnLx8A.rst +++ /dev/null @@ -1 +0,0 @@ -Do not include if it does not exist. diff --git a/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst b/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst deleted file mode 100644 index 39358cd29c8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0417.bpo-28927.9fxf6y.rst +++ /dev/null @@ -1,2 +0,0 @@ -bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not -only spaces. Patch by Robert Xiao. diff --git a/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst b/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst deleted file mode 100644 index ff50abd37a9..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0418.bpo-29049.KpVXBw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Call _PyObject_GC_TRACK() lazily when calling Python function. Calling -function is up to 5% faster. diff --git a/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst b/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst deleted file mode 100644 index e67ea280100..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0419.bpo-29159.gEn_kP.rst +++ /dev/null @@ -1 +0,0 @@ -Fix regression in bytes(x) when x.__index__() raises Exception. diff --git a/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst b/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst deleted file mode 100644 index a356cd784e3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0420.bpo-29034.7-uEDT.rst +++ /dev/null @@ -1 +0,0 @@ -Fix memory leak and use-after-free in os module (path_converter). diff --git a/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst b/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst deleted file mode 100644 index f23bad0bc1a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0421.bpo-29327.XXQarW.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a crash when pass the iterable keyword argument to sorted(). diff --git a/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst b/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst deleted file mode 100644 index 201325cbf6c..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0422.bpo-29337.bjX8AE.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible BytesWarning when compare the code objects. Warnings could be -emitted at compile time. diff --git a/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst b/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst deleted file mode 100644 index 254d8731d56..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0423.bpo-29319.KLDUZf.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent RunMainFromImporter overwriting sys.path[0]. diff --git a/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst b/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst deleted file mode 100644 index a9d4bdbabd1..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0424.bpo-29478.rTQ-qy.rst +++ /dev/null @@ -1,2 +0,0 @@ -If max_line_length=None is specified while using the Compat32 policy, it is -no longer ignored. Patch by Mircea Cosbuc. diff --git a/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst b/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst deleted file mode 100644 index cb60a48a3c0..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0425.bpo-29546.O1rmG_.rst +++ /dev/null @@ -1 +0,0 @@ -Improve from-import error message with location diff --git a/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst b/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst deleted file mode 100644 index 0868cd17bea..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0426.bpo-29546.PS1I1T.rst +++ /dev/null @@ -1,2 +0,0 @@ -Set the 'path' and 'name' attribute on ImportError for ``from ... import -...``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst b/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst deleted file mode 100644 index e3eecb6136e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0427.bpo-29438.IKxD6I.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed use-after-free problem in key sharing dict. diff --git a/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst b/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst deleted file mode 100644 index 298d05f331d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0428.bpo-29463.h2bg8A.rst +++ /dev/null @@ -1,4 +0,0 @@ -Add ``docstring`` field to Module, ClassDef, FunctionDef, and -AsyncFunctionDef ast nodes. docstring is not first stmt in their body -anymore. It affects ``co_firstlineno`` and ``co_lnotab`` of code object for -module and class. diff --git a/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst b/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst deleted file mode 100644 index 35fa1066645..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0429.bpo-29347.1RPPGN.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possibly dereferencing undefined pointers when creating weakref -objects. diff --git a/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst b/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst deleted file mode 100644 index cc1366caf30..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0430.bpo-29602.qyyskC.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix incorrect handling of signed zeros in complex constructor for complex -subclasses and for inputs having a __complex__ method. Patch by Serhiy -Storchaka. diff --git a/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst b/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst deleted file mode 100644 index 9185bdab9fe..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0431.bpo-29607.7NvBA1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix stack_effect computation for CALL_FUNCTION_EX. Patch by Matthieu -Dartiailh. diff --git a/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst b/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst deleted file mode 100644 index 4757347a3d0..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0432.bpo-28598.QxbzQn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Support __rmod__ for subclasses of str being called before str.__mod__. -Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst b/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst deleted file mode 100644 index 738e3fc7eb4..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0433.bpo-29684.wTgEoh.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix minor regression of PyEval_CallObjectWithKeywords. It should raise -TypeError when kwargs is not a dict. But it might cause segv when args=NULL -and kwargs is not a dict. diff --git a/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst b/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst deleted file mode 100644 index 00abe055759..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0434.bpo-29683.G5iS-P.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes to memory allocation in _PyCode_SetExtra. Patch by Brian Coleman. diff --git a/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst b/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst deleted file mode 100644 index 76c09e34e1c..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0435.bpo-28876.cU-sGT.rst +++ /dev/null @@ -1 +0,0 @@ -``bool(range)`` works even if ``len(range)`` raises :exc:`OverflowError`. diff --git a/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst b/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst deleted file mode 100644 index 15b74e714aa..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0436.bpo-28893.WTKnpj.rst +++ /dev/null @@ -1,2 +0,0 @@ -Set correct __cause__ for errors about invalid awaitables returned from -__aiter__ and __anext__. diff --git a/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst b/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst deleted file mode 100644 index 66dde19fcc8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0437.bpo-29695.z75xXa.rst +++ /dev/null @@ -1,2 +0,0 @@ -bool(), float(), list() and tuple() no longer take keyword arguments. The -first argument of int() can now be passes only as positional argument. diff --git a/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst b/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst deleted file mode 100644 index 26e520864a7..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0438.bpo-29714.z-BhVd.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a regression that bytes format may fail when containing zero bytes -inside. diff --git a/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst b/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst deleted file mode 100644 index d2d1fd547ca..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0439.bpo-29568.3EtOC-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Escaped percent "%%" in the format string for classic string formatting no -longer allows any characters between two percents. diff --git a/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst b/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst deleted file mode 100644 index c8e9298d53a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0440.bpo-29723.M5omgP.rst +++ /dev/null @@ -1,7 +0,0 @@ -The ``sys.path[0]`` initialization change for bpo-29139 caused a regression -by revealing an inconsistency in how sys.path is initialized when executing -``__main__`` from a zipfile, directory, or other import location. The -interpreter now consistently avoids ever adding the import location's parent -directory to ``sys.path``, and ensures no other ``sys.path`` entries are -inadvertently modified when inserting the import location named on the -command line. diff --git a/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst b/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst deleted file mode 100644 index 753f0a485c8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0441.bpo-28856.AFRmo4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an oversight that %b format for bytes should support objects follow the -buffer protocol. diff --git a/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst b/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst deleted file mode 100644 index 0d7901e25f8..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0442.bpo-29849.hafvBD.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a memory leak when an ImportError is raised during from import. diff --git a/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst b/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst deleted file mode 100644 index e40d8caf95e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0443.bpo-29859.Z1MLcA.rst +++ /dev/null @@ -1,2 +0,0 @@ -Show correct error messages when any of the pthread_* calls in -thread_pthread.h fails. diff --git a/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst b/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst deleted file mode 100644 index 850d91cdc85..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0444.bpo-29894.Vev6t-.rst +++ /dev/null @@ -1,3 +0,0 @@ -The deprecation warning is emitted if __complex__ returns an instance of a -strict subclass of complex. In a future versions of Python this can be an -error. diff --git a/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst b/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst deleted file mode 100644 index 8576892ff7d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0445.bpo-29102.AW4YPj.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add a unique ID to PyInterpreterState. This makes it easier to identify -each subinterpreter. diff --git a/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst b/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst deleted file mode 100644 index 70a683b5def..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0446.bpo-24821.4DINGV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the slowing down to 25 times in the searching of some unlucky Unicode -characters. diff --git a/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst b/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst deleted file mode 100644 index fc1044ea9c6..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0447.bpo-29816.0H75Nl.rst +++ /dev/null @@ -1,3 +0,0 @@ -Shift operation now has less opportunity to raise OverflowError. ValueError -always is raised rather than OverflowError for negative counts. Shifting -zero with non-negative count always returns zero. diff --git a/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst b/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst deleted file mode 100644 index 6f96cded835..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0448.bpo-29935.vgjdJo.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed error messages in the index() method of tuple, list and deque when -pass indices of wrong type. diff --git a/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst b/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst deleted file mode 100644 index 92f50ccb7af..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0449.bpo-29949.DevGPS.rst +++ /dev/null @@ -1 +0,0 @@ -Fix memory usage regression of set and frozenset object. diff --git a/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst b/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst deleted file mode 100644 index 4351b4ad6ed..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0450.bpo-29914.nqFSRR.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed default implementations of __reduce__ and __reduce_ex__(). -object.__reduce__() no longer takes arguments, object.__reduce_ex__() now -requires one argument. diff --git a/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst b/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst deleted file mode 100644 index cf3975ac469..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0451.bpo-11913.5uiMX9.rst +++ /dev/null @@ -1,2 +0,0 @@ -README.rst is now included in the list of distutils standard READMEs and -therefore included in source distributions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst b/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst deleted file mode 100644 index f047dd1a813..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0452.bpo-29839.rUmfay.rst +++ /dev/null @@ -1,2 +0,0 @@ -len() now raises ValueError rather than OverflowError if __len__() returned -a large negative integer. diff --git a/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst b/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst deleted file mode 100644 index e57890dc8c1..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0453.bpo-12414.T9ix8O.rst +++ /dev/null @@ -1,2 +0,0 @@ -sys.getsizeof() on a code object now returns the sizes which includes the -code struct and sizes of objects which it references. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst b/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst deleted file mode 100644 index ffaeee90c9e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0454.bpo-30024.kSOlED.rst +++ /dev/null @@ -1,2 +0,0 @@ -Circular imports involving absolute imports with binding a submodule to a -name are now supported. diff --git a/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst b/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst deleted file mode 100644 index 9611dbb9ba6..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0455.bpo-28974.jVewS0.rst +++ /dev/null @@ -1,2 +0,0 @@ -``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than -``format(str(self), '')``. diff --git a/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst b/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst deleted file mode 100644 index 8884a9aee1e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0456.bpo-30039.e0u4DG.rst +++ /dev/null @@ -1,3 +0,0 @@ -If a KeyboardInterrupt happens when the interpreter is in the middle of -resuming a chain of nested 'yield from' or 'await' calls, it's now correctly -delivered to the innermost frame. diff --git a/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst b/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst deleted file mode 100644 index de46584a64d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0457.bpo-25794.xfPwqm.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed type.__setattr__() and type.__delattr__() for non-interned attribute -names. Based on patch by Eryk Sun. diff --git a/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst b/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst deleted file mode 100644 index da5b8d1a2ca..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0458.bpo-27945.p29r3O.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed various segfaults with dict when input collections are mutated during -searching, inserting or comparing. Based on patches by Duane Griffin and -Tim Mitchell. diff --git a/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst b/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst deleted file mode 100644 index 45e0fa1eb80..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0459.bpo-29104.u26yCx.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed parsing backslashes in f-strings. diff --git a/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst b/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst deleted file mode 100644 index 15025232e70..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0460.bpo-25324.l12VjO.rst +++ /dev/null @@ -1,3 +0,0 @@ -Tokens needed for parsing in Python moved to C. ``COMMENT``, ``NL`` and -``ENCODING``. This way the tokens and tok_names in the token module don't -get changed when you import the tokenize module. diff --git a/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst b/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst deleted file mode 100644 index 2f042aba42c..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0461.bpo-30537.sGC27r.rst +++ /dev/null @@ -1,2 +0,0 @@ -itertools.islice now accepts integer-like objects (having an __index__ -method) as start, stop, and slice arguments diff --git a/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst b/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst deleted file mode 100644 index f081dfd0b7b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0462.bpo-30486.KZi3nB.rst +++ /dev/null @@ -1 +0,0 @@ -Allows setting cell values for __closure__. Patch by Lisa Roach. diff --git a/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst b/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst deleted file mode 100644 index 00341e01140..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0463.bpo-28180.f_IHor.rst +++ /dev/null @@ -1,4 +0,0 @@ -Implement PEP 538 (legacy C locale coercion). This means that when a -suitable coercion target locale is available, both the core interpreter and -locale-aware C extensions will assume the use of UTF-8 as the default text -encoding, rather than ASCII. diff --git a/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst b/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst deleted file mode 100644 index 2e8c39d24fb..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0464.bpo-30501.BWJByG.rst +++ /dev/null @@ -1,3 +0,0 @@ -The compiler now produces more optimal code for complex condition -expressions in the "if", "while" and "assert" statement, the "if" -expression, and generator expressions and comprehensions. diff --git a/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst b/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst deleted file mode 100644 index ad0bde2e0c1..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0465.bpo-30682.zZm88E.rst +++ /dev/null @@ -1,2 +0,0 @@ -Removed a too-strict assertion that failed for certain f-strings, such as -eval("f'\\\n'") and eval("f'\\\r'"). diff --git a/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst b/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst deleted file mode 100644 index 0114fee02a4..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0466.bpo-30597.7erHiP.rst +++ /dev/null @@ -1,2 +0,0 @@ -``print`` now shows expected input in custom error message when used as a -Python 2 statement. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst b/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst deleted file mode 100644 index 3ec21b4a6d3..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0467.bpo-30604.zGPGoX.rst +++ /dev/null @@ -1 +0,0 @@ -Move co_extra_freefuncs from per-thread to per-interpreter to avoid crashes. diff --git a/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst b/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst deleted file mode 100644 index 07d6ceb5d9d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0468.bpo-30736.kA4J9v.rst +++ /dev/null @@ -1 +0,0 @@ -The internal unicodedata database has been upgraded to Unicode 10.0. diff --git a/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst b/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst deleted file mode 100644 index 8d63a46cbde..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0469.bpo-30814.HcYsfM.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a race condition when import a submodule from a package. diff --git a/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst b/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst deleted file mode 100644 index 3ecd404373b..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/0470.bpo-31161.FcUAA0.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make sure the 'Missing parentheses' syntax error message is only applied to -SyntaxError, not to subclasses. Patch by Martijn Pieters. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst b/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst deleted file mode 100644 index 08d76cb965e..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-06-26-14-29-50.bpo-30765.Q5iBmf.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid blocking in pthread_mutex_lock() when PyThread_acquire_lock() is asked -not to block. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst b/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst deleted file mode 100644 index 9adeb450aee..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-06-28-21-07-32.bpo-30703.ULCdFp.rst +++ /dev/null @@ -1,6 +0,0 @@ -Improve signal delivery. - -Avoid using Py_AddPendingCall from signal handler, to avoid calling signal- -unsafe functions. The tests I'm adding here fail without the rest of the -patch, on Linux and OS X. This means our signal delivery logic had defects -(some signals could be lost). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst deleted file mode 100644 index 4f3f4d29190..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-11-06-31-32.bpo-30876.x35jZX.rst +++ /dev/null @@ -1,3 +0,0 @@ -Relative import from unloaded package now reimports the package instead of -failing with SystemError. Relative import from non-package now fails with -ImportError rather than SystemError. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst deleted file mode 100644 index 8adbbe7dc3a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-17-12-12-59.bpo-30808.bA3zOv.rst +++ /dev/null @@ -1 +0,0 @@ -Use _Py_atomic API for concurrency-sensitive signal state. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst deleted file mode 100644 index bb67a9fb244..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-21-07-39-05.bpo-30978.f0jODc.rst +++ /dev/null @@ -1,2 +0,0 @@ -str.format_map() now passes key lookup exceptions through. -Previously any exception was replaced with a KeyError exception. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst deleted file mode 100644 index c34d4751bfa..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-31-13-28-53.bpo-31071.P9UBDy.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid masking original TypeError in call with * unpacking when other -arguments are passed. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst deleted file mode 100644 index ca1f8bafba6..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-01-18-48-30.bpo-31095.bXWZDb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix potential crash during GC caused by ``tp_dealloc`` which doesn't call -``PyObject_GC_UnTrack()``. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-08-12-00-29.bpo-30747.g2kZRT.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-08-12-00-29.bpo-30747.g2kZRT.rst deleted file mode 100644 index 04a726a7e69..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-08-12-00-29.bpo-30747.g2kZRT.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add a non-dummy implementation of _Py_atomic_store and _Py_atomic_load on -MSVC. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst deleted file mode 100644 index 8f9d7b534b5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a race condition in importlib _get_module_lock(). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst deleted file mode 100644 index da553d654ec..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-18-15-15-20.bpo-30721.Hmc56z.rst +++ /dev/null @@ -1,2 +0,0 @@ -``print`` now shows correct usage hint for using Python 2 redirection -syntax. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst deleted file mode 100644 index 166458f2b78..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-24-13-34-49.bpo-31243.dRJzqR.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a crash in some methods of `io.TextIOWrapper`, when the decoder's state -is invalid. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst deleted file mode 100644 index 7bb78801057..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-25-20-43-22.bpo-31271.YMduKF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in the write() method of `io.TextIOWrapper`, when -the encoder doesn't return a bytes object. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst deleted file mode 100644 index 0576785c7df..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-11-51-29.bpo-31291.t8QggK.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix an assertion failure in `zipimport.zipimporter.get_data` on Windows, -when the return value of ``pathname.replace('/','\\')`` isn't a string. -Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst deleted file mode 100644 index 7def54336fd..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-14-57-27.bpo-31343.Kl_fS5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray -plans to remove the functions from sys/types.h. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst deleted file mode 100644 index 52a6168e632..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-16-35-06.bpo-31347.KDuf2w.rst +++ /dev/null @@ -1 +0,0 @@ -Fix possible undefined behavior in _PyObject_FastCall_Prepend. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst deleted file mode 100644 index d8e9d5eeea1..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-05-13-47-49.bpo-30860.MROpZw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Consolidate CPython's global runtime state under a single struct. This -improves discoverability of the runtime state. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst deleted file mode 100644 index 0d9138ed82d..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-10-47-29.bpo-30465.oe-3GD.rst +++ /dev/null @@ -1,3 +0,0 @@ -Location information (``lineno`` and ``col_offset``) in f-strings is now -(mostly) correct. This fixes tools like flake8 from showing warnings on the -wrong line (typically the first line of the file). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst deleted file mode 100644 index 3ffb4093470..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-15-25-59.bpo-31373.dC4jd4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix several possible instances of undefined behavior due to floating-point -demotions. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst deleted file mode 100644 index 2b3a386d2b0..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-06-20-25-47.bpo-31344.XpFs-q.rst +++ /dev/null @@ -1,5 +0,0 @@ -For finer control of tracing behaviour when testing the interpreter, two new -frame attributes have been added to control the emission of particular trace -events: ``f_trace_lines`` (``True`` by default) to turn off per-line trace -events; and ``f_trace_opcodes`` (``False`` by default) to turn on per-opcode -trace events. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst deleted file mode 100644 index ad1b4b8870a..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-08-50-41.bpo-31411.HZz82I.rst +++ /dev/null @@ -1,2 +0,0 @@ -Raise a TypeError instead of SystemError in case warnings.onceregistry is -not a dictionary. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst deleted file mode 100644 index a45f9d86248..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-11-20.bpo-28411.Ax91lz.rst +++ /dev/null @@ -1,4 +0,0 @@ -Switch to the abstract API when dealing with ``PyInterpreterState.modules``. -This allows later support for all dict subclasses and other Mapping -implementations. Also add a ``PyImport_GetModule()`` function to reduce -a bunch of duplicated code. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst deleted file mode 100644 index 47f9fa684e5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-09-24-21.bpo-28411.12SpAm.rst +++ /dev/null @@ -1,3 +0,0 @@ -Change direct usage of PyInterpreterState.modules to PyImport_GetModuleDict(). -Also introduce more uniformity in other code that deals with sys.modules. -This helps reduce complications when working on sys.modules. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst deleted file mode 100644 index 148a5c8eda5..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-11-12-54-35.bpo-31416.2hlQFd.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix assertion failures in case of a bad warnings.filters or -warnings.defaultaction. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst deleted file mode 100644 index 6d6cbd81142..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-13-13-03-52.bpo-31418.rS-FlC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in `PyErr_WriteUnraisable()` in case of an -exception with a bad ``__module__`` attribute. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst deleted file mode 100644 index 73c444444fc..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-14-19-47-57.bpo-31471.0yiA5Q.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix an assertion failure in `subprocess.Popen()` on Windows, in case the env -argument has a bad keys() method. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst deleted file mode 100644 index d95e825f132..00000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-09-16-13-32-35.bpo-31490.r7m2sj.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix an assertion failure in `ctypes` class definition, in case the class has -an attribute whose name is specified in ``_anonymous_`` but not in -``_fields_``. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst b/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst deleted file mode 100644 index b758724fb71..00000000000 --- a/Misc/NEWS.d/next/Documentation/0051.bpo-28513.L3joAz.rst +++ /dev/null @@ -1 +0,0 @@ -Documented command-line interface of zipfile. diff --git a/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst b/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst deleted file mode 100644 index 4708fb26196..00000000000 --- a/Misc/NEWS.d/next/Documentation/0052.bpo-23722.nFjY3C.rst +++ /dev/null @@ -1,3 +0,0 @@ -The data model reference and the porting section in the 3.6 What's New guide -now cover the additional ``__classcell__`` handling needed for custom -metaclasses to fully support PEP 487 and zero-argument ``super()``. diff --git a/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst b/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst deleted file mode 100644 index 09f6f3889b5..00000000000 --- a/Misc/NEWS.d/next/Documentation/0053.bpo-29349.PjSo-t.rst +++ /dev/null @@ -1 +0,0 @@ -Fix Python 2 syntax in code for building the documentation. diff --git a/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst b/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst deleted file mode 100644 index 2614c0ba850..00000000000 --- a/Misc/NEWS.d/next/Documentation/0054.bpo-26355.SDq_8Y.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add canonical header link on each page to corresponding major version of the -documentation. Patch by Matthias Bussonnier. diff --git a/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst b/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst deleted file mode 100644 index ea4046ead7d..00000000000 --- a/Misc/NEWS.d/next/Documentation/0055.bpo-25008.CeIzyU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Document smtpd.py as effectively deprecated and add a pointer to aiosmtpd, a -third-party asyncio-based replacement. diff --git a/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst b/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst deleted file mode 100644 index acacdd01322..00000000000 --- a/Misc/NEWS.d/next/Documentation/0056.bpo-28929.Md7kb0.rst +++ /dev/null @@ -1 +0,0 @@ -Link the documentation to its source file on GitHub. diff --git a/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst b/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst deleted file mode 100644 index 3410f7085c7..00000000000 --- a/Misc/NEWS.d/next/Documentation/0057.bpo-19824.We9an6.rst +++ /dev/null @@ -1,3 +0,0 @@ -Improve the documentation for, and links to, template strings by emphasizing -their utility for internationalization, and by clarifying some usage -constraints. (See also: bpo-20314, bpo-12518) diff --git a/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst b/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst deleted file mode 100644 index 3413e054759..00000000000 --- a/Misc/NEWS.d/next/Documentation/0058.bpo-26985.NB5_9S.rst +++ /dev/null @@ -1 +0,0 @@ -Add missing info of code object in inspect documentation. diff --git a/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst b/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst deleted file mode 100644 index fe8eb2aaa0c..00000000000 --- a/Misc/NEWS.d/next/Documentation/0059.bpo-30052.TpmpaF.rst +++ /dev/null @@ -1,8 +0,0 @@ -the link targets for :func:`bytes` and :func:`bytearray` are now their -respective type definitions, rather than the corresponding builtin function -entries. Use :ref:`bytes ` and :ref:`bytearray ` -to reference the latter. - -In order to ensure this and future cross-reference updates are applied -automatically, the daily documentation builds now disable the default output -caching features in Sphinx. diff --git a/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst b/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst deleted file mode 100644 index df73aeda646..00000000000 --- a/Misc/NEWS.d/next/Documentation/0060.bpo-30176.VivmCg.rst +++ /dev/null @@ -1 +0,0 @@ -Add missing attribute related constants in curses documentation. diff --git a/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst b/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst deleted file mode 100644 index 4699713ee6e..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-07-29-14-55-50.bpo-30803.6hutqQ.rst +++ /dev/null @@ -1 +0,0 @@ -Clarify doc on truth value testing. Original patch by Peter Thomassen. diff --git a/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst b/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst deleted file mode 100644 index 480ec6b2869..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-08-31.bpo-31128.uoa3cr.rst +++ /dev/null @@ -1 +0,0 @@ -Allow the pydoc server to bind to arbitrary hostnames. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst b/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst deleted file mode 100644 index a09985aa3d8..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-09-06-10-11-57.bpo-21649.EUvqA9.rst +++ /dev/null @@ -1 +0,0 @@ -Add RFC 7525 and Mozilla server side TLS links to SSL documentation. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst b/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst deleted file mode 100644 index 2c8f8507697..00000000000 --- a/Misc/NEWS.d/next/Documentation/2017-09-07-20-49-09.bpo-31294.WgI18w.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix incomplete code snippet in the ZeroMQSocketListener and -ZeroMQSocketHandler examples and adapt them to Python 3. diff --git a/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst b/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst deleted file mode 100644 index efc3bc8c76f..00000000000 --- a/Misc/NEWS.d/next/IDLE/0089.bpo-28572.1_duKY.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add 10% to coverage of IDLE's test_configdialog. Update and augment -description of the configuration system. diff --git a/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst b/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst deleted file mode 100644 index 504d803c7eb..00000000000 --- a/Misc/NEWS.d/next/IDLE/0090.bpo-29071.FCOpJn.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE colors f-string prefixes (but not invalid ur prefixes). diff --git a/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst b/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst deleted file mode 100644 index 3c30eb8b670..00000000000 --- a/Misc/NEWS.d/next/IDLE/0091.bpo-30303.2L2F-4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add _utest option to textview; add new tests. Increase coverage to 100%. -Patches by Louie Lu and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst b/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst deleted file mode 100644 index fb4e25feb93..00000000000 --- a/Misc/NEWS.d/next/IDLE/0092.bpo-30290.fZ3kod.rst +++ /dev/null @@ -1,2 +0,0 @@ -Help-about: use pep8 names and add tests. Increase coverage to 100%. Patches -by Louie Lu, Cheryl Sabella, and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst b/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst deleted file mode 100644 index 13ac32b24c7..00000000000 --- a/Misc/NEWS.d/next/IDLE/0093.bpo-30495.I3i5vL.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add docstrings for textview.py and use PEP8 names. Patches by Cheryl Sabella -and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst b/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst deleted file mode 100644 index ac6b5158ddb..00000000000 --- a/Misc/NEWS.d/next/IDLE/0094.bpo-30642.3Zujzt.rst +++ /dev/null @@ -1 +0,0 @@ -Fix reference leaks in IDLE tests. Patches by Louie Lu and Terry Jan Reedy. diff --git a/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst b/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst deleted file mode 100644 index b92e6f9af02..00000000000 --- a/Misc/NEWS.d/next/IDLE/0095.bpo-25514.882pXa.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add doc subsubsection about IDLE failure to start. Popup no-connection -message directs users to this section. diff --git a/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst b/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst deleted file mode 100644 index 1c8141e7af1..00000000000 --- a/Misc/NEWS.d/next/IDLE/0096.bpo-15786._XRbaR.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix several problems with IDLE's autocompletion box. The following should -now work: clicking on selection box items; using the scrollbar; selecting an -item by hitting Return. Hangs on MacOSX should no longer happen. Patch by -Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst deleted file mode 100644 index fee904d9e78..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-00-28-59.bpo-6739.x5MfhB.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Verify user-entered key sequences by trying to bind them with tk. Add -tests for all 3 validation functions. Original patch by G Polo. Tests added -by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst deleted file mode 100644 index 014eff369de..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-15-47-13.bpo-30728.qH4TGL.rst +++ /dev/null @@ -1,4 +0,0 @@ -Review and change idlelib.configdialog names. -Lowercase method and attribute names. -Replace 'colour' with 'color', expand overly cryptic names, delete unneeded underscores. -Replace ``import *`` with specific imports. Patches by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst b/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst deleted file mode 100644 index 5157f8bb923..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-26-22-45-27.bpo-29910.mqHh7u.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE no longer deletes a character after commenting out a region by a key -shortcut. Add ``return 'break'`` for this and other potential conflicts -between IDLE and default key bindings. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst deleted file mode 100644 index b224f6b892b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-00-29-56.bpo-21519.fTj9T0.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE's basic custom key entry dialog now detects duplicates properly. -Original patch by Saimadhav Heblikar. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst deleted file mode 100644 index 4b718fef017..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-01-40-34.bpo-30674.ppK_q8.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: add docstrings to grep module. Patch by Cheryl Sabella diff --git a/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst b/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst deleted file mode 100644 index ceb42a2bbca..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-27-19-05-40.bpo-30723.rQh06y.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE: Make several improvements to parenmatch. Add 'parens' style to -highlight both opener and closer. Make 'default' style, which is not -default, a synonym for 'opener'. Make time-delay work the same with all -styles. Add help for config dialog extensions tab, including help for -parenmatch. Add new tests. Original patch by Charles Wohlganger. diff --git a/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst b/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst deleted file mode 100644 index 5e046e0069e..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-06-29-18-23-06.bpo-30495.qIWgc4.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Improve textview with docstrings, PEP8 names, and more tests. Patch by -Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst b/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst deleted file mode 100644 index b7118bf2c25..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-04-22-45-46.bpo-30777.uxzlMB.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: configdialog - Add docstrings and fix comments. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst b/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst deleted file mode 100644 index 1d0dc181304..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-07-20-26-37.bpo-30779.8KXEXN.rst +++ /dev/null @@ -1,8 +0,0 @@ -IDLE: Factor ConfigChanges class from configdialog, put in config; test. * -In config, put dump test code in a function; run it and unittest in 'if -__name__ == '__main__'. * Add class config.ConfigChanges based on -changes_class_v4.py on bpo issue. * Add class test_config.ChangesTest, -partly using configdialog_tests_v1.py. * Revise configdialog to use -ConfigChanges; see tracker msg297804. * Revise test_configdialog to match -configdialog changes. * Remove configdialog functions unused or moved to -ConfigChanges. Cheryl Sabella contributed parts of the patch. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst b/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst deleted file mode 100644 index c96cc4e1438..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: call config.IdleConf.GetUserCfgDir only once. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst b/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst deleted file mode 100644 index 1bd0cbb6abf..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-08-17-57-04.bpo-30870.IcR2pf.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: In Settings dialog, select font with Up, Down keys as well as mouse. -Initial patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst b/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst deleted file mode 100644 index 5ed7c8bb1af..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-09-23-53-00.bpo-30851.AHXBYa.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Remove unused variables in configdialog. One is a duplicate, one is -set but cannot be altered by users. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst b/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst deleted file mode 100644 index 4e4e0e69a01..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-11-02-21-42.bpo-30881.4KAq_9.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add docstrings to browser.py. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst b/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst deleted file mode 100644 index 665c7cd5bbf..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-11-02-26-17.bpo-30899.SQmVO8.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add tests for ConfigParser subclasses in config. Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst b/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst deleted file mode 100644 index 23a9fe86ccb..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-13-23-07-33.bpo-30913.aezn_e.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Document ConfigDialog tk Vars, methods, and widgets in docstrings This -will facilitate improving the dialog and splitting up the class. Original -patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst b/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst deleted file mode 100644 index 53beb43159c..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-15-22-26-57.bpo-30934.BanuSB.rst +++ /dev/null @@ -1,7 +0,0 @@ -Document coverage details for idlelib tests. - -* Add section to idlelib/idle-test/README.txt. - -* Include check that branches are taken both ways. - -* Exclude IDLE-specific code that does not run during unit tests. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst b/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst deleted file mode 100644 index c2cc9ccdd11..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add tests for idlelib.config.IdleConf. -Increase coverage from 46% to 96%. -Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst b/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst deleted file mode 100644 index d7c5f54c7c3..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-21-00-54-52.bpo-28523.OPcqYJ.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: replace 'colour' with 'color' in configdialog. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst b/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst deleted file mode 100644 index 48d477ed2e1..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-21-01-55-14.bpo-30981.ZFvQPt.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE -- Add more configdialog font page tests. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst b/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst deleted file mode 100644 index 04c94349165..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-22-18-08-41.bpo-30993.34vJkB.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE - Improve configdialog font page and tests. - -In configdialog: Document causal pathways in create_font_tab docstring. Simplify some attribute names. Move set_samples calls to var_changed_font (idea from Cheryl Sabella). Move related functions to positions after the create widgets function. - -In test_configdialog: Fix test_font_set so not order dependent. Fix renamed test_indent_scale so it tests the widget. Adjust tests for movement of set_samples call. Add tests for load functions. Put all font tests in one class and tab indent tests in another. Except for two lines, these tests completely cover the related functions. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst b/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst deleted file mode 100644 index f3dab0fd9e6..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-25-01-28-35.bpo-31003.bYINVH.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE: Add more tests for General tab. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst b/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst deleted file mode 100644 index 9cabca193b9..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-27-10-01-14.bpo-30853.enPvvc.rst +++ /dev/null @@ -1,5 +0,0 @@ -IDLE -- Factor a VarTrace class out of ConfigDialog. - -Instance tracers manages pairs consisting of a tk variable and a -callback function. When tracing is turned on, setting the variable -calls the function. Test coverage for the new class is 100%. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst b/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst deleted file mode 100644 index 1d202c7fa2c..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-27-14-48-42.bpo-31060.GdY_VY.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE - Finish rearranging methods of ConfigDialog Grouping methods -pertaining to each tab and the buttons will aid writing tests and improving -the tabs and will enable splitting the groups into classes. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst b/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst deleted file mode 100644 index 3031adff717..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-28-18-59-06.bpo-30781.ud5m18.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE - Use ttk widgets in ConfigDialog. -Patches by Terry Jan Reedy and Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst b/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst deleted file mode 100644 index 47fed949d10..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-30-01-00-58.bpo-31004.m8cc1t.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Factor FontPage(Frame) class from ConfigDialog. - -Slightly modified tests continue to pass. Fix General tests. Patch mostly by -Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst b/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst deleted file mode 100644 index e33b2e231d6..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-30-17-39-59.bpo-31050.AXR3kP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Factor GenPage(Frame) class from ConfigDialog. The slightly modified tests -continue to pass. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst b/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst deleted file mode 100644 index 3bb337562de..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-07-31-23-20-51.bpo-31083.991FXm.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE - Add an outline of a TabPage class in configdialog. -Update existing classes to match outline. -Initial patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst b/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst deleted file mode 100644 index f25fc80c3dd..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-03-14-08-42.bpo-19903.sqE1FS.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE: Calltips use `inspect.signature` instead of `inspect.getfullargspec`. -This improves calltips for builtins converted to use Argument Clinic. -Patch by Louie Lu. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst b/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst deleted file mode 100644 index 1708be72b8b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-03-17-54-02.bpo-31002.kUSgTE.rst +++ /dev/null @@ -1 +0,0 @@ -Add tests for configdialog keys tab. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst b/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst deleted file mode 100644 index c57728fda22..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-07-14-02-56.bpo-31130.FbsC7f.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE -- stop leaks in test_configdialog. Initial patch by Victor Stinner. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst b/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst deleted file mode 100644 index 007a2e2fc55..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-15-12-58-23.bpo-31205.iuziZ5.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Factor KeysPage(Frame) class from ConfigDialog. The slightly -modified tests continue to pass. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst b/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst deleted file mode 100644 index 5e1eeee0419..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-17-15-00-20.bpo-31001.KLxYHC.rst +++ /dev/null @@ -1 +0,0 @@ -Add tests for configdialog highlight tab. Patch by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst b/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst deleted file mode 100644 index ba984065e88..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-18-14-13-42.bpo-31206.F1-tKK.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Factor HighPage(Frame) class from ConfigDialog. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst b/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst deleted file mode 100644 index 9b59fbabe53..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-24-13-48-16.bpo-27099.rENefC.rst +++ /dev/null @@ -1,20 +0,0 @@ -Convert IDLE's built-in 'extensions' to regular features. - -About 10 IDLE features were implemented as supposedly optional -extensions. Their different behavior could be confusing or worse for -users and not good for maintenance. Hence the conversion. - -The main difference for users is that user configurable key bindings -for builtin features are now handled uniformly. Now, editing a binding -in a keyset only affects its value in the keyset. All bindings are -defined together in the system-specific default keysets in config- -extensions.def. All custom keysets are saved as a whole in config- -extension.cfg. All take effect as soon as one clicks Apply or Ok. - -The affected events are '<>', '<>', -'<>', '<>', '<>', -'<>', '<>', and '<>'. Any -(global) customizations made before 3.6.3 will not affect their keyset- -specific customization after 3.6.3. and vice versa. - -Inital patch by Charles Wohlganger. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst b/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst deleted file mode 100644 index 9cd55573f87..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-27-15-31-33.bpo-31287.aZERfI.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE - Do not modify tkinter.message in test_configdialog. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst b/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst deleted file mode 100644 index 262674c32dc..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-27-16-49-36.bpo-30617.UHnswr.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Add docstrings and tests for outwin subclass of editor. - -Move some data and functions from the class to module level. Patch by Cheryl -Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst b/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst deleted file mode 100644 index fe515911b0d..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-08-30-00-06-58.bpo-31051.50Jp_Q.rst +++ /dev/null @@ -1 +0,0 @@ -Rearrange IDLE condigdialog GenPage into Window, Editor, and Help sections. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst b/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst deleted file mode 100644 index aa49d882d0a..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-11-15-46-05.bpo-31414.wiepgK.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE -- fix tk entry box tests by deleting first. Adding to an int entry is -not the same as deleting and inserting because int('') will fail. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst b/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst deleted file mode 100644 index f3e4ab22320..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-12-08-38-27.bpo-31421.mYfQNq.rst +++ /dev/null @@ -1,4 +0,0 @@ -Document how IDLE runs tkinter programs. IDLE calls tcl/tk update in the -background in order to make live - -interaction and experimentatin with tkinter applications much easier. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst b/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst deleted file mode 100644 index 5999e9a8f27..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-14-17-53-53.bpo-31480.4WJ0pl.rst +++ /dev/null @@ -1 +0,0 @@ -IDLE - make tests pass with zzdummy extension disabled by default. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst b/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst deleted file mode 100644 index 4b47ed3f53b..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-15-12-38-47.bpo-31477.n__6sa.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE - Improve rstrip entry in doc. Strip trailing whitespace strips more -than blank spaces. Multiline string literals are not skipped. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst deleted file mode 100644 index 258fc1ba75d..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-16-01-21-20.bpo-31488.0rtXIT.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE - Update non-key options in former extension classes. When applying -configdialog changes, call .reload for each feature class. Change ParenMatch -so updated options affect existing instances attached to existing editor -windows. diff --git a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst b/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst deleted file mode 100644 index 7fbf7b27795..00000000000 --- a/Misc/NEWS.d/next/IDLE/2017-09-16-23-43-39.bpo-31493.nmHMCR.rst +++ /dev/null @@ -1,3 +0,0 @@ -IDLE code context -- fix code update and font update timers. - -Canceling timers prevents a warning message when test_idle completes. diff --git a/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst b/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst deleted file mode 100644 index 8c0674a0f5d..00000000000 --- a/Misc/NEWS.d/next/Library/0097.bpo-30177.JGIJNL.rst +++ /dev/null @@ -1,2 +0,0 @@ -path.resolve(strict=False) no longer cuts the path after the first element -not present in the filesystem. Patch by Antoine Pietri. diff --git a/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst b/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst deleted file mode 100644 index 8146dcdc6d5..00000000000 --- a/Misc/NEWS.d/next/Library/0098.bpo-25532.ey4Yez.rst +++ /dev/null @@ -1,3 +0,0 @@ -inspect.unwrap() will now only try to unwrap an object -sys.getrecursionlimit() times, to protect against objects which create a new -object on every attribute access. diff --git a/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst b/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst deleted file mode 100644 index 10b11a4dcdb..00000000000 --- a/Misc/NEWS.d/next/Library/0099.bpo-29581.gHCrxP.rst +++ /dev/null @@ -1,2 +0,0 @@ -ABCMeta.__new__ now accepts ``**kwargs``, allowing abstract base classes to -use keyword parameters in __init_subclass__. Patch by Nate Soares. diff --git a/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst b/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst deleted file mode 100644 index be376cdafac..00000000000 --- a/Misc/NEWS.d/next/Library/0100.bpo-24142.IrZnFs.rst +++ /dev/null @@ -1,2 +0,0 @@ -Reading a corrupt config file left configparser in an invalid state. -Original patch by Florian H?ch. diff --git a/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst b/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst deleted file mode 100644 index 6ffaab0e73d..00000000000 --- a/Misc/NEWS.d/next/Library/0101.bpo-27972.ZK-GFm.rst +++ /dev/null @@ -1 +0,0 @@ -Prohibit Tasks to await on themselves. diff --git a/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst b/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst deleted file mode 100644 index f3becad1775..00000000000 --- a/Misc/NEWS.d/next/Library/0102.bpo-28399.QKIqRX.rst +++ /dev/null @@ -1 +0,0 @@ -Remove UNIX socket from FS before binding. Patch by ????????? ????. diff --git a/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst b/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst deleted file mode 100644 index 9adfb940811..00000000000 --- a/Misc/NEWS.d/next/Library/0103.bpo-28372.njcIPk.rst +++ /dev/null @@ -1 +0,0 @@ -Fix asyncio to support formatting of non-python coroutines. diff --git a/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst b/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst deleted file mode 100644 index bf3594afff5..00000000000 --- a/Misc/NEWS.d/next/Library/0104.bpo-28371.U9Zqdk.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecate passing asyncio.Handles to run_in_executor. diff --git a/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst b/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst deleted file mode 100644 index 5a8ab80e0dd..00000000000 --- a/Misc/NEWS.d/next/Library/0105.bpo-28370.18jBuZ.rst +++ /dev/null @@ -1 +0,0 @@ -Speedup asyncio.StreamReader.readexactly. Patch by ????????? ????. diff --git a/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst b/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst deleted file mode 100644 index 62d5f45b5cb..00000000000 --- a/Misc/NEWS.d/next/Library/0106.bpo-28369.8DTANe.rst +++ /dev/null @@ -1,2 +0,0 @@ -Raise RuntimeError when transport's FD is used with add_reader, add_writer, -etc. diff --git a/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst b/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst deleted file mode 100644 index 3385265a51e..00000000000 --- a/Misc/NEWS.d/next/Library/0107.bpo-28368.n594X4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Refuse monitoring processes if the child watcher has no loop attached. Patch -by Vincent Michel. diff --git a/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst b/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst deleted file mode 100644 index 8a53daac3c8..00000000000 --- a/Misc/NEWS.d/next/Library/0108.bpo-28325.wAHmnK.rst +++ /dev/null @@ -1 +0,0 @@ -Remove vestigial MacOS 9 macurl2path module and its tests. diff --git a/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst b/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst deleted file mode 100644 index f262c84a51b..00000000000 --- a/Misc/NEWS.d/next/Library/0109.bpo-27759.qpMDGq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix selectors incorrectly retain invalid file descriptors. Patch by Mark -Williams. diff --git a/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst b/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst deleted file mode 100644 index 79bdb480d2f..00000000000 --- a/Misc/NEWS.d/next/Library/0110.bpo-28176.sU8R6L.rst +++ /dev/null @@ -1 +0,0 @@ -Fix callbacks race in asyncio.SelectorLoop.sock_connect. diff --git a/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst b/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst deleted file mode 100644 index 1add3ddc317..00000000000 --- a/Misc/NEWS.d/next/Library/0111.bpo-26909.ASiakT.rst +++ /dev/null @@ -1 +0,0 @@ -Fix slow pipes IO in asyncio. Patch by INADA Naoki. diff --git a/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst b/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst deleted file mode 100644 index 81f3f525c61..00000000000 --- a/Misc/NEWS.d/next/Library/0112.bpo-26654.XtzTE9.rst +++ /dev/null @@ -1 +0,0 @@ -Inspect functools.partial in asyncio.Handle.__repr__. Patch by iceboy. diff --git a/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst b/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst deleted file mode 100644 index e67ba9606e2..00000000000 --- a/Misc/NEWS.d/next/Library/0113.bpo-28174.CV1UdI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Handle when SO_REUSEPORT isn't properly supported. Patch by Seth Michael -Larson. diff --git a/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst b/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst deleted file mode 100644 index 9e261ccd858..00000000000 --- a/Misc/NEWS.d/next/Library/0114.bpo-27906.TBBXrv.rst +++ /dev/null @@ -1 +0,0 @@ -Fix socket accept exhaustion during high TCP traffic. Patch by Kevin Conway. diff --git a/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst b/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst deleted file mode 100644 index 71905507f18..00000000000 --- a/Misc/NEWS.d/next/Library/0115.bpo-27599.itvm8T.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). diff --git a/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst b/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst deleted file mode 100644 index 9c567f0c1ce..00000000000 --- a/Misc/NEWS.d/next/Library/0116.bpo-28114.gmFXsA.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a crash in parse_envlist() when env contains byte strings. Patch by Eryk -Sun. diff --git a/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst b/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst deleted file mode 100644 index 8690675e56e..00000000000 --- a/Misc/NEWS.d/next/Library/0117.bpo-25895.j92qoQ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by Gergely Imreh -and Markus Holtermann. diff --git a/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst b/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst deleted file mode 100644 index 104fa1a011b..00000000000 --- a/Misc/NEWS.d/next/Library/0118.bpo-28181.NGc4Yv.rst +++ /dev/null @@ -1 +0,0 @@ -Get antigravity over HTTPS. Patch by Kaartic Sivaraam. diff --git a/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst b/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst deleted file mode 100644 index fe11915953d..00000000000 --- a/Misc/NEWS.d/next/Library/0119.bpo-25270.jrZruM.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent codecs.escape_encode() from raising SystemError when an empty -bytestring is passed. diff --git a/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst b/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst deleted file mode 100644 index fedd5a5fd10..00000000000 --- a/Misc/NEWS.d/next/Library/0120.bpo-22493.Mv_hZf.rst +++ /dev/null @@ -1,2 +0,0 @@ -Warning message emitted by using inline flags in the middle of regular -expression now contains a (truncated) regex pattern. Patch by Tim Graham. diff --git a/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst b/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst deleted file mode 100644 index 8a44468e8d4..00000000000 --- a/Misc/NEWS.d/next/Library/0121.bpo-28075.aLiUs9.rst +++ /dev/null @@ -1,2 +0,0 @@ -Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch -by Eryk Sun. diff --git a/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst b/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst deleted file mode 100644 index 8dd432b9643..00000000000 --- a/Misc/NEWS.d/next/Library/0122.bpo-0.iPpjqX.rst +++ /dev/null @@ -1 +0,0 @@ -Fix UnboundLocalError in socket._sendfile_use_sendfile. diff --git a/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst b/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst deleted file mode 100644 index d60eefe4667..00000000000 --- a/Misc/NEWS.d/next/Library/0123.bpo-27932.mtgl-6.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent memory leak in win32_ver(). diff --git a/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst b/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst deleted file mode 100644 index 60180e7b01a..00000000000 --- a/Misc/NEWS.d/next/Library/0124.bpo-25400.d9Qn0E.rst +++ /dev/null @@ -1,2 +0,0 @@ -RobotFileParser now correctly returns default values for crawl_delay and -request_rate. Initial patch by Peter Wirtz. diff --git a/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst b/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst deleted file mode 100644 index 8cb460c76b9..00000000000 --- a/Misc/NEWS.d/next/Library/0125.bpo-28200.4IEbr7.rst +++ /dev/null @@ -1 +0,0 @@ -Fix memory leak on Windows in the os module (fix path_converter() function). diff --git a/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst b/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst deleted file mode 100644 index 8e4d1c93492..00000000000 --- a/Misc/NEWS.d/next/Library/0126.bpo-27778.Yyo1aP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a memory leak in os.getrandom() when the getrandom() is interrupted by a -signal and a signal handler raises a Python exception. diff --git a/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst b/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst deleted file mode 100644 index 33809ea0f37..00000000000 --- a/Misc/NEWS.d/next/Library/0127.bpo-25651.3UhyPo.rst +++ /dev/null @@ -1 +0,0 @@ -Allow falsy values to be used for msg parameter of subTest(). diff --git a/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst b/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst deleted file mode 100644 index 846b80adfab..00000000000 --- a/Misc/NEWS.d/next/Library/0128.bpo-27348.tDx7Vw.rst +++ /dev/null @@ -1,2 +0,0 @@ -In the traceback module, restore the formatting of exception messages like -"Exception: None". This fixes a regression introduced in 3.5a2. diff --git a/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst b/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst deleted file mode 100644 index 090049151b6..00000000000 --- a/Misc/NEWS.d/next/Library/0129.bpo-27611.A_ArH_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed support of default root window in the tkinter.tix module. Added the -master parameter in the DisplayStyle constructor. diff --git a/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst b/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst deleted file mode 100644 index 31683232e4e..00000000000 --- a/Misc/NEWS.d/next/Library/0130.bpo-18893.osiX5c.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by -Madison May. diff --git a/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst b/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst deleted file mode 100644 index f9fa6409385..00000000000 --- a/Misc/NEWS.d/next/Library/0131.bpo-18844.fQsEdn.rst +++ /dev/null @@ -1,3 +0,0 @@ -random.choices() now has k as a keyword-only argument to improve the -readability of common cases and come into line with the signature used in -other languages. diff --git a/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst b/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst deleted file mode 100644 index da0793afa0b..00000000000 --- a/Misc/NEWS.d/next/Library/0132.bpo-27897.I0Ppmx.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible crash in sqlite3.Connection.create_collation() if pass -invalid string-like object as a name. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst b/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst deleted file mode 100644 index cff7838f524..00000000000 --- a/Misc/NEWS.d/next/Library/0133.bpo-28275.EhWIsz.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible use after free in the decompress() methods of the -LZMADecompressor and BZ2Decompressor classes. Original patch by John Leitch. diff --git a/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst b/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst deleted file mode 100644 index b25f9817469..00000000000 --- a/Misc/NEWS.d/next/Library/0134.bpo-28253.aLfmhe.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fixed calendar functions for extreme months: 0001-01 and 9999-12. - -Methods itermonthdays() and itermonthdays2() are reimplemented so that they -don't call itermonthdates() which can cause datetime.date under/overflow. diff --git a/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst b/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst deleted file mode 100644 index 49304e63d63..00000000000 --- a/Misc/NEWS.d/next/Library/0135.bpo-28148.Flzndx.rst +++ /dev/null @@ -1,4 +0,0 @@ -Stop using localtime() and gmtime() in the time module. - -Introduced platform independent _PyTime_localtime API that is similar to -POSIX localtime_r, but available on all platforms. Patch by Ed Schouten. diff --git a/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst b/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst deleted file mode 100644 index 7f9b9afa6b4..00000000000 --- a/Misc/NEWS.d/next/Library/0136.bpo-28314.N7YrkN.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix function declaration (C flags) for the getiterator() method of -xml.etree.ElementTree.Element. diff --git a/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst b/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst deleted file mode 100644 index fc5d14e38c5..00000000000 --- a/Misc/NEWS.d/next/Library/0137.bpo-28226.nMXiwU.rst +++ /dev/null @@ -1 +0,0 @@ -compileall now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst b/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst deleted file mode 100644 index b3e7ba5bf1e..00000000000 --- a/Misc/NEWS.d/next/Library/0138.bpo-28228.1qBwdM.rst +++ /dev/null @@ -1 +0,0 @@ -imghdr now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst b/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst deleted file mode 100644 index 5e33ba12c0d..00000000000 --- a/Misc/NEWS.d/next/Library/0139.bpo-28322.l9hzap.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible crashes when unpickle itertools objects from incorrect pickle -data. Based on patch by John Leitch. diff --git a/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst b/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst deleted file mode 100644 index ebf241afd53..00000000000 --- a/Misc/NEWS.d/next/Library/0140.bpo-28257.SVD_IH.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improved error message when passing a non-iterable as a var-positional -argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. diff --git a/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst b/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst deleted file mode 100644 index 2ca6fedd02b..00000000000 --- a/Misc/NEWS.d/next/Library/0141.bpo-27358.t288Iv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Optimized merging var-keyword arguments and improved error message when -passing a non-mapping as a var-keyword argument. diff --git a/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst b/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst deleted file mode 100644 index e315ecc00b4..00000000000 --- a/Misc/NEWS.d/next/Library/0142.bpo-28332.Ed8fNk.rst +++ /dev/null @@ -1,2 +0,0 @@ -Deprecated silent truncations in socket.htons and socket.ntohs. Original -patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst b/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst deleted file mode 100644 index eb21cffc39d..00000000000 --- a/Misc/NEWS.d/next/Library/0143.bpo-28227.7lUz8i.rst +++ /dev/null @@ -1 +0,0 @@ -gzip now supports pathlib. Patch by Ethan Furman. diff --git a/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst b/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst deleted file mode 100644 index 6abd1a078a1..00000000000 --- a/Misc/NEWS.d/next/Library/0144.bpo-28225.6N28nu.rst +++ /dev/null @@ -1 +0,0 @@ -bz2 module now supports pathlib. Initial patch by Ethan Furman. diff --git a/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst b/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst deleted file mode 100644 index 69bd193641d..00000000000 --- a/Misc/NEWS.d/next/Library/0145.bpo-28321.bQ-IIX.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed writing non-BMP characters with binary format in plistlib. diff --git a/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst b/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst deleted file mode 100644 index 5d2a7763cb7..00000000000 --- a/Misc/NEWS.d/next/Library/0146.bpo-28229.BKAxcS.rst +++ /dev/null @@ -1 +0,0 @@ -lzma module now supports pathlib. diff --git a/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst b/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst deleted file mode 100644 index 35d26ae41ee..00000000000 --- a/Misc/NEWS.d/next/Library/0147.bpo-28380.jKPMzH.rst +++ /dev/null @@ -1,2 +0,0 @@ -unittest.mock Mock autospec functions now properly support assert_called, -assert_not_called, and assert_called_once. diff --git a/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst b/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst deleted file mode 100644 index 3d3a19ba472..00000000000 --- a/Misc/NEWS.d/next/Library/0148.bpo-28317.LgHleA.rst +++ /dev/null @@ -1 +0,0 @@ -The disassembler now decodes FORMAT_VALUE argument. diff --git a/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst b/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst deleted file mode 100644 index 040b4c0888f..00000000000 --- a/Misc/NEWS.d/next/Library/0149.bpo-27998.CPhy4H.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed bytes path support in os.scandir() on Windows. Patch by Eryk Sun. diff --git a/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst b/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst deleted file mode 100644 index 5495b783568..00000000000 --- a/Misc/NEWS.d/next/Library/0150.bpo-20766.4kvCzx.rst +++ /dev/null @@ -1 +0,0 @@ -Fix references leaked by pdb in the handling of SIGINT handlers. diff --git a/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst b/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst deleted file mode 100644 index 26bb026dd00..00000000000 --- a/Misc/NEWS.d/next/Library/0151.bpo-24452.pVsjt0.rst +++ /dev/null @@ -1 +0,0 @@ -Make webbrowser support Chrome on Mac OS X. Patch by Ned Batchelder. diff --git a/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst b/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst deleted file mode 100644 index c3cf076e463..00000000000 --- a/Misc/NEWS.d/next/Library/0152.bpo-0.5Y0ngw.rst +++ /dev/null @@ -1,4 +0,0 @@ -Distutils.sdist now looks for README and setup.py files with case -sensitivity. This behavior matches that found in Setuptools 6.0 and later. -See `setuptools 100 `_ for -rationale. diff --git a/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst b/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst deleted file mode 100644 index d2c24f36719..00000000000 --- a/Misc/NEWS.d/next/Library/0153.bpo-28240.cXljq-.rst +++ /dev/null @@ -1,3 +0,0 @@ -timeit autorange now uses a single loop iteration if the benchmark takes -less than 10 seconds, instead of 10 iterations. "python3 -m timeit -s -'import time' 'time.sleep(1)'" now takes 4 seconds instead of 40 seconds. diff --git a/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst b/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst deleted file mode 100644 index 650c94ad719..00000000000 --- a/Misc/NEWS.d/next/Library/0154.bpo-28240.IwQMgd.rst +++ /dev/null @@ -1,2 +0,0 @@ -timeit now repeats the benchmarks 5 times instead of only 3 to make -benchmarks more reliable. diff --git a/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst b/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst deleted file mode 100644 index 377b3dc2e7b..00000000000 --- a/Misc/NEWS.d/next/Library/0155.bpo-28240.hqzQvS.rst +++ /dev/null @@ -1,2 +0,0 @@ -timeit: remove ``-c/--clock`` and ``-t/--time`` command line options which -were deprecated since Python 3.3. diff --git a/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst b/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst deleted file mode 100644 index 786ff2c1a6a..00000000000 --- a/Misc/NEWS.d/next/Library/0156.bpo-28480.9lHw6m.rst +++ /dev/null @@ -1 +0,0 @@ -Fix error building socket module when multithreading is disabled. diff --git a/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst b/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst deleted file mode 100644 index a09e1d8cba6..00000000000 --- a/Misc/NEWS.d/next/Library/0157.bpo-23214.-4Q5Z7.rst +++ /dev/null @@ -1,3 +0,0 @@ -In the "io" module, the argument to BufferedReader and BytesIO's read1() -methods is now optional and can be -1, matching the BufferedIOBase -specification. diff --git a/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst b/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst deleted file mode 100644 index bb3f32b3740..00000000000 --- a/Misc/NEWS.d/next/Library/0158.bpo-28448.5bduWe.rst +++ /dev/null @@ -1 +0,0 @@ -Fix C implemented asyncio.Future didn't work on Windows. diff --git a/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst b/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst deleted file mode 100644 index cf19d7e04cd..00000000000 --- a/Misc/NEWS.d/next/Library/0159.bpo-18219.1ANQN1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Optimize csv.DictWriter for large number of columns. Patch by Mariatta -Wijaya. diff --git a/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst b/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst deleted file mode 100644 index b8a77f78766..00000000000 --- a/Misc/NEWS.d/next/Library/0160.bpo-28115.4FIjIE.rst +++ /dev/null @@ -1,2 +0,0 @@ -Command-line interface of the zipfile module now uses argparse. Added -support of long options. diff --git a/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst b/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst deleted file mode 100644 index ef2d4766394..00000000000 --- a/Misc/NEWS.d/next/Library/0161.bpo-28469.QZW1Np.rst +++ /dev/null @@ -1,2 +0,0 @@ -timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead of 1, 10, -100,... for autoranging. diff --git a/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst b/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst deleted file mode 100644 index 72a8f59d125..00000000000 --- a/Misc/NEWS.d/next/Library/0162.bpo-25953.EKKJAQ.rst +++ /dev/null @@ -1,4 +0,0 @@ -re.sub() now raises an error for invalid numerical group reference in -replacement template even if the pattern is not found in the string. Error -message for invalid group reference now includes the group index and the -position of the reference. Based on patch by SilentGhost. diff --git a/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst b/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst deleted file mode 100644 index f8d370c0b24..00000000000 --- a/Misc/NEWS.d/next/Library/0163.bpo-28488.TgO112.rst +++ /dev/null @@ -1 +0,0 @@ -shutil.make_archive() no longer adds entry "./" to ZIP archive. diff --git a/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst b/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst deleted file mode 100644 index 4b90795b470..00000000000 --- a/Misc/NEWS.d/next/Library/0164.bpo-25464.HDUTCu.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed HList.header_exists() in tkinter.tix module by addin a workaround to -Tix library bug. diff --git a/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst b/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst deleted file mode 100644 index ca1f183e0cd..00000000000 --- a/Misc/NEWS.d/next/Library/0165.bpo-27025.foAViS.rst +++ /dev/null @@ -1,2 +0,0 @@ -Generated names for Tkinter widgets now start by the "!" prefix for -readability. diff --git a/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst b/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst deleted file mode 100644 index 90394c4603e..00000000000 --- a/Misc/NEWS.d/next/Library/0166.bpo-28430.4MiEYT.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix iterator of C implemented asyncio.Future doesn't accept non-None value -is passed to it.send(val). diff --git a/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst b/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst deleted file mode 100644 index 74f33025c13..00000000000 --- a/Misc/NEWS.d/next/Library/0167.bpo-28353.sKGbLL.rst +++ /dev/null @@ -1 +0,0 @@ -os.fwalk() no longer fails on broken links. diff --git a/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst b/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst deleted file mode 100644 index a2a3f295437..00000000000 --- a/Misc/NEWS.d/next/Library/0168.bpo-20491.ObgnQ2.rst +++ /dev/null @@ -1,2 +0,0 @@ -The textwrap.TextWrapper class now honors non-breaking spaces. Based on -patch by Kaarle Ritvanen. diff --git a/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst b/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst deleted file mode 100644 index 6818da9048e..00000000000 --- a/Misc/NEWS.d/next/Library/0169.bpo-28255.fHNZu0.rst +++ /dev/null @@ -1,2 +0,0 @@ -calendar.TextCalendar.prmonth() no longer prints a space at the start of new -line after printing a month's calendar. Patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst b/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst deleted file mode 100644 index 56c6d653cdf..00000000000 --- a/Misc/NEWS.d/next/Library/0170.bpo-28255.G3iOPm.rst +++ /dev/null @@ -1,3 +0,0 @@ -calendar.TextCalendar.prweek() no longer prints a space after a weeks's -calendar. calendar.TextCalendar.pryear() no longer prints redundant newline -after a year's calendar. Based on patch by Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst b/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst deleted file mode 100644 index 53c40580f29..00000000000 --- a/Misc/NEWS.d/next/Library/0171.bpo-27939.mTfADV.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by -representing the scale as float value internally in Tk. tkinter.IntVar now -works if float value is set to underlying Tk variable. diff --git a/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst b/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst deleted file mode 100644 index 0aa7db90a93..00000000000 --- a/Misc/NEWS.d/next/Library/0172.bpo-24241.y7N12p.rst +++ /dev/null @@ -1,4 +0,0 @@ -The webbrowser in an X environment now prefers using the default browser -directly. Also, the webbrowser register() function now has a documented -'preferred' argument, to specify browsers to be returned by get() with no -arguments. Patch by David Steele diff --git a/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst b/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst deleted file mode 100644 index dba0be1c22a..00000000000 --- a/Misc/NEWS.d/next/Library/0173.bpo-23262.6EVB7N.rst +++ /dev/null @@ -1,2 +0,0 @@ -The webbrowser module now supports Firefox 36+ and derived browsers. Based -on patch by Oleg Broytman. diff --git a/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst b/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst deleted file mode 100644 index 896227d0f1a..00000000000 --- a/Misc/NEWS.d/next/Library/0174.bpo-28449.5JK6ES.rst +++ /dev/null @@ -1,3 +0,0 @@ -tarfile.open() with mode "r" or "r:" now tries to open a tar file with -compression before trying to open it without compression. Otherwise it had -50% chance failed with ignore_zeros=True. diff --git a/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst b/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst deleted file mode 100644 index 237e66dd085..00000000000 --- a/Misc/NEWS.d/next/Library/0175.bpo-28549.ShnM2y.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed segfault in curses's addch() with ncurses6. diff --git a/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst b/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst deleted file mode 100644 index c9e5b8dd2c0..00000000000 --- a/Misc/NEWS.d/next/Library/0176.bpo-27517.1CYM8A.rst +++ /dev/null @@ -1,2 +0,0 @@ -LZMA compressor and decompressor no longer raise exceptions if given empty -data twice. Patch by Benjamin Fogle. diff --git a/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst b/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst deleted file mode 100644 index aa8e29d97c6..00000000000 --- a/Misc/NEWS.d/next/Library/0177.bpo-28387.1clJu7.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible crash in _io.TextIOWrapper deallocator when the garbage -collector is invoked in other thread. Based on patch by Sebastian Cufre. diff --git a/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst b/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst deleted file mode 100644 index 9da96ab9ba6..00000000000 --- a/Misc/NEWS.d/next/Library/0178.bpo-28563.iweEiw.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed possible DoS and arbitrary code execution when handle plural form -selections in the gettext module. The expression parser now supports exact -syntax supported by GNU gettext. diff --git a/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst b/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst deleted file mode 100644 index 9d0622b33fd..00000000000 --- a/Misc/NEWS.d/next/Library/0179.bpo-19717.HXCAIz.rst +++ /dev/null @@ -1,2 +0,0 @@ -Makes Path.resolve() succeed on paths that do not exist. Patch by Vajrasky -Kok diff --git a/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst b/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst deleted file mode 100644 index daa0cdaf816..00000000000 --- a/Misc/NEWS.d/next/Library/0180.bpo-28548.IeNrnG.rst +++ /dev/null @@ -1,2 +0,0 @@ -In the "http.server" module, parse the protocol version if possible, to -avoid using HTTP 0.9 in some error responses. diff --git a/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst b/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst deleted file mode 100644 index 8c12033b7c0..00000000000 --- a/Misc/NEWS.d/next/Library/0181.bpo-25659.lE2IlT.rst +++ /dev/null @@ -1,2 +0,0 @@ -In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() -methods on abstract classes like Array. diff --git a/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst b/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst deleted file mode 100644 index 9f712803e11..00000000000 --- a/Misc/NEWS.d/next/Library/0182.bpo-20572.NCRmvz.rst +++ /dev/null @@ -1,2 +0,0 @@ -Remove the subprocess.Popen.wait endtime parameter. It was deprecated in -3.4 and undocumented prior to that. diff --git a/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst b/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst deleted file mode 100644 index 682cb16bfe6..00000000000 --- a/Misc/NEWS.d/next/Library/0183.bpo-28727.ubZP_b.rst +++ /dev/null @@ -1,4 +0,0 @@ -Regular expression patterns, _sre.SRE_Pattern objects created by -re.compile(), become comparable (only x==y and x!=y operators). This change -should fix the issue #18383: don't duplicate warning filters when the -warnings module is reloaded (thing usually only done in unit tests). diff --git a/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst b/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst deleted file mode 100644 index 0c5730600f0..00000000000 --- a/Misc/NEWS.d/next/Library/0184.bpo-28752.Q-4oRE.rst +++ /dev/null @@ -1 +0,0 @@ -Restored the __reduce__() methods of datetime objects. diff --git a/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst b/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst deleted file mode 100644 index dc603f0a4f2..00000000000 --- a/Misc/NEWS.d/next/Library/0185.bpo-26273.ilNIWN.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and -:data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by -Omar Sandoval. diff --git a/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst b/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst deleted file mode 100644 index 2cdfc78e69c..00000000000 --- a/Misc/NEWS.d/next/Library/0186.bpo-28740.rY8kz-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add sys.getandroidapilevel(): return the build time API version of Android -as an integer. Function only available on Android. diff --git a/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst b/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst deleted file mode 100644 index e49ec2e2b83..00000000000 --- a/Misc/NEWS.d/next/Library/0187.bpo-27172.mVKfLT.rst +++ /dev/null @@ -1,4 +0,0 @@ -To assist with upgrades from 2.7, the previously documented deprecation of -``inspect.getfullargspec()`` has been reversed. This decision may be -revisited again after the Python 2.7 branch is no longer officially -supported. diff --git a/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst b/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst deleted file mode 100644 index af92a019ebe..00000000000 --- a/Misc/NEWS.d/next/Library/0188.bpo-28835.iWBYH7.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a regression introduced in warnings.catch_warnings(): call -warnings.showwarning() if it was overridden inside the context manager. diff --git a/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst b/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst deleted file mode 100644 index a05f572ad17..00000000000 --- a/Misc/NEWS.d/next/Library/0189.bpo-27030.GoGlFH.rst +++ /dev/null @@ -1,2 +0,0 @@ -Unknown escapes consisting of ``'\'`` and an ASCII letter in re.sub() -replacement templates regular expressions now are errors. diff --git a/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst b/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst deleted file mode 100644 index 1e1e8a0ca9b..00000000000 --- a/Misc/NEWS.d/next/Library/0190.bpo-28847.GiWd9w.rst +++ /dev/null @@ -1,4 +0,0 @@ -dbm.dumb now supports reading read-only files and no longer writes the index -file when it is not changed. A deprecation warning is now emitted if the -index file is missed and recreated in the 'r' and 'w' modes (will be an -error in future Python releases). diff --git a/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst b/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst deleted file mode 100644 index 3d0e17fe5c9..00000000000 --- a/Misc/NEWS.d/next/Library/0191.bpo-26937.c9kgiA.rst +++ /dev/null @@ -1,2 +0,0 @@ -The chown() method of the tarfile.TarFile class does not fail now when the -grp module cannot be imported, as for example on Android platforms. diff --git a/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst b/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst deleted file mode 100644 index 63b22ee36c8..00000000000 --- a/Misc/NEWS.d/next/Library/0192.bpo-28779.t-mjED.rst +++ /dev/null @@ -1,3 +0,0 @@ -multiprocessing.set_forkserver_preload() would crash the forkserver process -if a preloaded module instantiated some multiprocessing objects such as -locks. diff --git a/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst b/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst deleted file mode 100644 index c7fd44b6651..00000000000 --- a/Misc/NEWS.d/next/Library/0193.bpo-16255.p2YA85.rst +++ /dev/null @@ -1,2 +0,0 @@ -subprocess.Popen uses /system/bin/sh on Android as the shell, instead of -/bin/sh. diff --git a/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst b/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst deleted file mode 100644 index 8ea757bb42f..00000000000 --- a/Misc/NEWS.d/next/Library/0194.bpo-20191.Q7uZCS.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed a crash in resource.prlimit() when passing a sequence that doesn't own -its elements as limits. diff --git a/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst b/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst deleted file mode 100644 index b330241c2a8..00000000000 --- a/Misc/NEWS.d/next/Library/0195.bpo-19542.5tCkaK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() -when a GC collection happens in another thread. diff --git a/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst b/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst deleted file mode 100644 index 43830548b8c..00000000000 --- a/Misc/NEWS.d/next/Library/0196.bpo-28871.cPMXCJ.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a crash when deallocate deep ElementTree. diff --git a/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst b/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst deleted file mode 100644 index 5470585f69f..00000000000 --- a/Misc/NEWS.d/next/Library/0197.bpo-28923.naVULD.rst +++ /dev/null @@ -1 +0,0 @@ -Remove editor artifacts from Tix.py. diff --git a/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst b/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst deleted file mode 100644 index e6eab05306f..00000000000 --- a/Misc/NEWS.d/next/Library/0198.bpo-28427.vUd-va.rst +++ /dev/null @@ -1,2 +0,0 @@ -old keys should not remove new values from WeakValueDictionary when -collecting from another thread. diff --git a/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst b/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst deleted file mode 100644 index 18abe3d6d2c..00000000000 --- a/Misc/NEWS.d/next/Library/0199.bpo-9770.WJJnwP.rst +++ /dev/null @@ -1 +0,0 @@ -curses.ascii predicates now work correctly with negative integers. diff --git a/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst b/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst deleted file mode 100644 index 87fe36e34a6..00000000000 --- a/Misc/NEWS.d/next/Library/0200.bpo-13051.YzC1Te.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed recursion errors in large or resized curses.textpad.Textbox. Based on -patch by Tycho Andersen. diff --git a/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst b/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst deleted file mode 100644 index 2bc4cd41157..00000000000 --- a/Misc/NEWS.d/next/Library/0201.bpo-29079.g4YLix.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent infinite loop in pathlib.resolve() on Windows diff --git a/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst b/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst deleted file mode 100644 index 8b41a1f6312..00000000000 --- a/Misc/NEWS.d/next/Library/0202.bpo-28985.TMWJFg.rst +++ /dev/null @@ -1 +0,0 @@ -Update authorizer constants in sqlite3 module. Patch by Dingyuan Wang. diff --git a/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst b/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst deleted file mode 100644 index 6df13d27c5e..00000000000 --- a/Misc/NEWS.d/next/Library/0203.bpo-15812.R1U-Ec.rst +++ /dev/null @@ -1,2 +0,0 @@ -inspect.getframeinfo() now correctly shows the first line of a context. -Patch by Sam Breese. diff --git a/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst b/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst deleted file mode 100644 index 31d81af9853..00000000000 --- a/Misc/NEWS.d/next/Library/0204.bpo-28961.Rt93vg.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix unittest.mock._Call helper: don't ignore the name parameter anymore. -Patch written by Jiajun Huang. diff --git a/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst b/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst deleted file mode 100644 index fd5465baa90..00000000000 --- a/Misc/NEWS.d/next/Library/0205.bpo-29142.xo6kAv.rst +++ /dev/null @@ -1,3 +0,0 @@ -In urllib.request, suffixes in no_proxy environment variable with leading -dots could match related hostnames again (e.g. .b.c matches a.b.c). Patch by -Milan Oberkirch. diff --git a/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst b/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst deleted file mode 100644 index b2e9bce519c..00000000000 --- a/Misc/NEWS.d/next/Library/0206.bpo-20804.XyZhvi.rst +++ /dev/null @@ -1,2 +0,0 @@ -The unittest.mock.sentinel attributes now preserve their identity when they -are copied or pickled. diff --git a/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst b/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst deleted file mode 100644 index f2a4171294f..00000000000 --- a/Misc/NEWS.d/next/Library/0207.bpo-28969.j3HJYO.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed race condition in C implementation of functools.lru_cache. KeyError -could be raised when cached function with full cache was simultaneously -called from differen threads with the same uncached arguments. diff --git a/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst b/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst deleted file mode 100644 index 47123d98f6c..00000000000 --- a/Misc/NEWS.d/next/Library/0208.bpo-29195.vK5LjU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Removed support of deprecated undocumented keyword arguments in methods of -regular expression objects. diff --git a/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst b/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst deleted file mode 100644 index b87246f5a07..00000000000 --- a/Misc/NEWS.d/next/Library/0209.bpo-29193.CgcjEx.rst +++ /dev/null @@ -1,2 +0,0 @@ -A format string argument for string.Formatter.format() is now positional- -only. diff --git a/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst b/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst deleted file mode 100644 index e23778956be..00000000000 --- a/Misc/NEWS.d/next/Library/0210.bpo-29192.mY31H8.rst +++ /dev/null @@ -1 +0,0 @@ -Removed deprecated features in the http.cookies module. diff --git a/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst b/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst deleted file mode 100644 index ab6725f596a..00000000000 --- a/Misc/NEWS.d/next/Library/0211.bpo-29219.kxui7t.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed infinite recursion in the repr of uninitialized ctypes.CDLL instances. diff --git a/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst b/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst deleted file mode 100644 index 02452fe88d5..00000000000 --- a/Misc/NEWS.d/next/Library/0212.bpo-29210.y1UHWf.rst +++ /dev/null @@ -1 +0,0 @@ -Removed support of deprecated argument "exclude" in tarfile.TarFile.add(). diff --git a/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst b/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst deleted file mode 100644 index 9e9fc4fbcf8..00000000000 --- a/Misc/NEWS.d/next/Library/0213.bpo-29197.sZssFZ.rst +++ /dev/null @@ -1 +0,0 @@ -Removed deprecated function ntpath.splitunc(). diff --git a/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst b/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst deleted file mode 100644 index 1ec6247bb9c..00000000000 --- a/Misc/NEWS.d/next/Library/0214.bpo-28735.admHLO.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed the comparison of mock.MagickMock with mock.ANY. diff --git a/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst b/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst deleted file mode 100644 index a4ac1f0725f..00000000000 --- a/Misc/NEWS.d/next/Library/0215.bpo-29290.XBqptF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a regression in argparse that help messages would wrap at non-breaking -spaces. diff --git a/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst b/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst deleted file mode 100644 index 79e17482299..00000000000 --- a/Misc/NEWS.d/next/Library/0216.bpo-29335._KC7IK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix subprocess.Popen.wait() when the child process has exited to a stopped -instead of terminated state (ex: when under ptrace). diff --git a/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst b/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst deleted file mode 100644 index a9e5315e8e9..00000000000 --- a/Misc/NEWS.d/next/Library/0217.bpo-29338.EpvQJl.rst +++ /dev/null @@ -1,2 +0,0 @@ -The help of a builtin or extension class now includes the constructor -signature if __text_signature__ is provided for the class. diff --git a/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst b/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst deleted file mode 100644 index 04c7dfce8a5..00000000000 --- a/Misc/NEWS.d/next/Library/0218.bpo-29368.nTtA_V.rst +++ /dev/null @@ -1,3 +0,0 @@ -The extend() method is now called instead of the append() method when -unpickle collections.deque and other list-like objects. This can speed up -unpickling to 2 times. diff --git a/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst b/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst deleted file mode 100644 index cd7c117d52a..00000000000 --- a/Misc/NEWS.d/next/Library/0219.bpo-29218.-Qoti0.rst +++ /dev/null @@ -1,2 +0,0 @@ -Unused install_misc command is now removed. It has been documented as -unused since 2000. Patch by Eric N. Vander Weele. diff --git a/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst b/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst deleted file mode 100644 index 4b7bd5a944b..00000000000 --- a/Misc/NEWS.d/next/Library/0220.bpo-29377.4AvSrC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add WrapperDescriptorType, MethodWrapperType, and MethodDescriptorType -built-in types to types module. Original patch by Manuel Krebber. diff --git a/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst b/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst deleted file mode 100644 index 05e96fb79da..00000000000 --- a/Misc/NEWS.d/next/Library/0221.bpo-29444.cEwgmk.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed out-of-bounds buffer access in the group() method of the match object. -Based on patch by WGH. diff --git a/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst b/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst deleted file mode 100644 index b0b9838b373..00000000000 --- a/Misc/NEWS.d/next/Library/0222.bpo-29416.KJGyI_.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent infinite loop in pathlib.Path.mkdir diff --git a/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst b/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst deleted file mode 100644 index d12217a34bd..00000000000 --- a/Misc/NEWS.d/next/Library/0223.bpo-29100.LAAERS.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check -minimum and maximum years. diff --git a/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst b/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst deleted file mode 100644 index 5b1c326f486..00000000000 --- a/Misc/NEWS.d/next/Library/0224.bpo-28556.p6967e.rst +++ /dev/null @@ -1,3 +0,0 @@ -Various updates to typing module: typing.Counter, typing.ChainMap, improved -ABC caching, etc. Original PRs by Jelle Zijlstra, Ivan Levkivskyi, Manuel -Krebber, and ?ukasz Langa. diff --git a/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst b/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst deleted file mode 100644 index c346c364249..00000000000 --- a/Misc/NEWS.d/next/Library/0225.bpo-29851.jqs_5s.rst +++ /dev/null @@ -1,2 +0,0 @@ -importlib.reload() now raises ModuleNotFoundError if the module lacks a -spec. diff --git a/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst b/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst deleted file mode 100644 index 38866c3a291..00000000000 --- a/Misc/NEWS.d/next/Library/0226.bpo-10379.mRlZsT.rst +++ /dev/null @@ -1,2 +0,0 @@ -locale.format_string now supports the 'monetary' keyword argument, and -locale.format is deprecated. diff --git a/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst b/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst deleted file mode 100644 index 94a015c3964..00000000000 --- a/Misc/NEWS.d/next/Library/0227.bpo-29534.Ug3HPU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed different behaviour of Decimal.from_float() for _decimal and -_pydecimal. Thanks Andrew Nester. diff --git a/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst b/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst deleted file mode 100644 index 789bb3e688d..00000000000 --- a/Misc/NEWS.d/next/Library/0228.bpo-29576.F-b8_5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve some deprecations in importlib. Some deprecated methods now emit -DeprecationWarnings and have better descriptive messages. diff --git a/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst b/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst deleted file mode 100644 index af151acec52..00000000000 --- a/Misc/NEWS.d/next/Library/0229.bpo-22807.VmoSkZ.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add uuid.SafeUUID and uuid.UUID.is_safe to relay information from the -platform about whether generated UUIDs are generated with a multiprocessing -safe method. diff --git a/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst b/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst deleted file mode 100644 index 10c495cb907..00000000000 --- a/Misc/NEWS.d/next/Library/0230.bpo-29110.wmE-_T.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix file object leak in aifc.open() when file is given as a filesystem path -and is not in valid AIFF format. Patch by Anthony Zhang. diff --git a/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst b/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst deleted file mode 100644 index 9e3a25e2908..00000000000 --- a/Misc/NEWS.d/next/Library/0231.bpo-29532.YCwVQn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Altering a kwarg dictionary passed to functools.partial() no longer affects -a partial object after creation. diff --git a/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst b/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst deleted file mode 100644 index f1db485970a..00000000000 --- a/Misc/NEWS.d/next/Library/0232.bpo-16285.4f5gbp.rst +++ /dev/null @@ -1,3 +0,0 @@ -urrlib.parse.quote is now based on RFC 3986 and hence includes '~' in the -set of characters that is not quoted by default. Patch by Christian Theune -and Ratnadeep Debnath. diff --git a/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst b/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst deleted file mode 100644 index af487f02efe..00000000000 --- a/Misc/NEWS.d/next/Library/0233.bpo-29742.8hqfEO.rst +++ /dev/null @@ -1,2 +0,0 @@ -get_extra_info() raises exception if get called on closed ssl transport. -Patch by Nikolay Kim. diff --git a/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst b/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst deleted file mode 100644 index c40da624958..00000000000 --- a/Misc/NEWS.d/next/Library/0234.bpo-28518.o-Q2Nw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Start a transaction implicitly before a DML statement. Patch by Aviv -Palivoda. diff --git a/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst b/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst deleted file mode 100644 index caf5197fd56..00000000000 --- a/Misc/NEWS.d/next/Library/0235.bpo-28624.43TJib.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add a test that checks that cwd parameter of Popen() accepts PathLike -objects. Patch by Sayan Chowdhury. diff --git a/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst b/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst deleted file mode 100644 index 5b610c45895..00000000000 --- a/Misc/NEWS.d/next/Library/0236.bpo-29376.rrJhJy.rst +++ /dev/null @@ -1 +0,0 @@ -Fix assertion error in threading._DummyThread.is_alive(). diff --git a/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst b/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst deleted file mode 100644 index a9ccebebb9d..00000000000 --- a/Misc/NEWS.d/next/Library/0237.bpo-7769.xGRJWh.rst +++ /dev/null @@ -1,2 +0,0 @@ -Method register_function() of xmlrpc.server.SimpleXMLRPCDispatcher and its -subclasses can now be used as a decorator. diff --git a/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst b/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst deleted file mode 100644 index 4cef50404a5..00000000000 --- a/Misc/NEWS.d/next/Library/0238.bpo-29615.OpFKzg.rst +++ /dev/null @@ -1,2 +0,0 @@ -SimpleXMLRPCDispatcher no longer chains KeyError (or any other exception) to -exception(s) raised in the dispatched methods. Patch by Petr Motejlek. diff --git a/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst b/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst deleted file mode 100644 index ce844f7b2ba..00000000000 --- a/Misc/NEWS.d/next/Library/0239.bpo-29703.ZdsPCR.rst +++ /dev/null @@ -1 +0,0 @@ -Fix asyncio to support instantiation of new event loops in child processes. diff --git a/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst b/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst deleted file mode 100644 index fd3f2aea906..00000000000 --- a/Misc/NEWS.d/next/Library/0240.bpo-29271.y8Vj2v.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix Task.current_task and Task.all_tasks implemented in C to accept None -argument as their pure Python implementation. diff --git a/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst b/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst deleted file mode 100644 index c371cedc086..00000000000 --- a/Misc/NEWS.d/next/Library/0241.bpo-29704.WHbx27.rst +++ /dev/null @@ -1,2 +0,0 @@ -asyncio.subprocess.SubprocessStreamProtocol no longer closes before all -pipes are closed. diff --git a/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst b/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst deleted file mode 100644 index 15e34710252..00000000000 --- a/Misc/NEWS.d/next/Library/0242.bpo-28963.tPl8dq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix out of bound iteration in asyncio.Future.remove_done_callback -implemented in C. diff --git a/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst b/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst deleted file mode 100644 index edad62bc1e4..00000000000 --- a/Misc/NEWS.d/next/Library/0243.bpo-9303.kDZRSd.rst +++ /dev/null @@ -1 +0,0 @@ -Migrate sqlite3 module to _v2 API. Patch by Aviv Palivoda. diff --git a/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst b/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst deleted file mode 100644 index 331fc02ae5a..00000000000 --- a/Misc/NEWS.d/next/Library/0244.bpo-29623.D3-NP2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow use of path-like object as a single argument in ConfigParser.read(). -Patch by David Ellis. diff --git a/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst b/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst deleted file mode 100644 index 81786e33259..00000000000 --- a/Misc/NEWS.d/next/Library/0245.bpo-29728.37jMwb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add new :data:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constant. Patch by -Nathaniel J. Smith. diff --git a/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst b/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst deleted file mode 100644 index 480325cf9e2..00000000000 --- a/Misc/NEWS.d/next/Library/0246.bpo-28682.hUxdej.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for bytes paths in os.fwalk(). diff --git a/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst b/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst deleted file mode 100644 index cb9fd02e1c7..00000000000 --- a/Misc/NEWS.d/next/Library/0247.bpo-26915.qShJZO.rst +++ /dev/null @@ -1,2 +0,0 @@ -index() and count() methods of collections.abc.Sequence now check identity -before checking equality when do comparisons. diff --git a/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst b/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst deleted file mode 100644 index b706b0641a3..00000000000 --- a/Misc/NEWS.d/next/Library/0248.bpo-28231.MG1X09.rst +++ /dev/null @@ -1 +0,0 @@ -The zipfile module now accepts path-like objects for external paths. diff --git a/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst b/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst deleted file mode 100644 index 8f194b8a23e..00000000000 --- a/Misc/NEWS.d/next/Library/0249.bpo-29645.XCxTHM.rst +++ /dev/null @@ -1,2 +0,0 @@ -Speed up importing the webbrowser module. webbrowser.register() is now -thread-safe. diff --git a/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst b/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst deleted file mode 100644 index 1e5ba953445..00000000000 --- a/Misc/NEWS.d/next/Library/0250.bpo-28298.PNOPsT.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big intables -(objects that have __int__) as elements. diff --git a/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst b/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst deleted file mode 100644 index ae8df9ffdd0..00000000000 --- a/Misc/NEWS.d/next/Library/0251.bpo-29619.WIGVxO.rst +++ /dev/null @@ -1,2 +0,0 @@ -os.stat() and os.DirEntry.inode() now convert inode (st_ino) using unsigned -integers. diff --git a/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst b/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst deleted file mode 100644 index 82a54e5d9ec..00000000000 --- a/Misc/NEWS.d/next/Library/0252.bpo-26121.LX-pQA.rst +++ /dev/null @@ -1 +0,0 @@ -Use C library implementation for math functions erf() and erfc(). diff --git a/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst b/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst deleted file mode 100644 index a99463b03f0..00000000000 --- a/Misc/NEWS.d/next/Library/0253.bpo-28692.CDt-Gb.rst +++ /dev/null @@ -1,2 +0,0 @@ -Using non-integer value for selecting a plural form in gettext is now -deprecated. diff --git a/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst b/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst deleted file mode 100644 index 3a9fc7c07bc..00000000000 --- a/Misc/NEWS.d/next/Library/0254.bpo-8256.jAwGQH.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed possible failing or crashing input() if attributes "encoding" or -"errors" of sys.stdin or sys.stdout are not set or are not strings. diff --git a/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst b/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst deleted file mode 100644 index e4aba4b88e6..00000000000 --- a/Misc/NEWS.d/next/Library/0255.bpo-29800.d2xASa.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix crashes in partial.__repr__ if the keys of partial.keywords are not -strings. Patch by Michael Seifert. diff --git a/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst b/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst deleted file mode 100644 index ee68d5b6c86..00000000000 --- a/Misc/NEWS.d/next/Library/0256.bpo-25455.ZsahHN.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed crashes in repr of recursive buffered file-like objects. diff --git a/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst b/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst deleted file mode 100644 index 90b5f0cf9ac..00000000000 --- a/Misc/NEWS.d/next/Library/0257.bpo-29884.kWXR8W.rst +++ /dev/null @@ -1,2 +0,0 @@ -faulthandler: Restore the old sigaltstack during teardown. Patch by -Christophe Zeitouny. diff --git a/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst b/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst deleted file mode 100644 index 50075da9ec9..00000000000 --- a/Misc/NEWS.d/next/Library/0258.bpo-19930.QCjO6A.rst +++ /dev/null @@ -1,2 +0,0 @@ -The mode argument of os.makedirs() no longer affects the file permission -bits of newly-created intermediate-level directories. diff --git a/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst b/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst deleted file mode 100644 index c14091ab5bd..00000000000 --- a/Misc/NEWS.d/next/Library/0259.bpo-29861.t2ZoRK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Release references to tasks, their arguments and their results as soon as -they are finished in multiprocessing.Pool. diff --git a/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst b/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst deleted file mode 100644 index 2ca8488f397..00000000000 --- a/Misc/NEWS.d/next/Library/0260.bpo-25803.CPDR0W.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid incorrect errors raised by Path.mkdir(exist_ok=True) when the OS gives -priority to errors such as EACCES over EEXIST. diff --git a/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst b/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst deleted file mode 100644 index 51fde26f1e1..00000000000 --- a/Misc/NEWS.d/next/Library/0261.bpo-29901.QdgMvW.rst +++ /dev/null @@ -1,2 +0,0 @@ -The zipapp module now supports general path-like objects, not just -pathlib.Path. diff --git a/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst b/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst deleted file mode 100644 index 7a589f1dcdb..00000000000 --- a/Misc/NEWS.d/next/Library/0262.bpo-23890.GCFAAZ.rst +++ /dev/null @@ -1,2 +0,0 @@ -unittest.TestCase.assertRaises() now manually breaks a reference cycle to -not keep objects alive longer than expected. diff --git a/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst b/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst deleted file mode 100644 index 5ea6808390e..00000000000 --- a/Misc/NEWS.d/next/Library/0263.bpo-28699.wZztZP.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed a bug in pools in multiprocessing.pool that raising an exception at -the very first of an iterable may swallow the exception or make the program -hang. Patch by Davin Potts and Xiang Zhang. diff --git a/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst b/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst deleted file mode 100644 index b2786264aa4..00000000000 --- a/Misc/NEWS.d/next/Library/0264.bpo-25996.L2_giP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added support of file descriptors in os.scandir() on Unix. os.fwalk() is -sped up by 2 times by using os.scandir(). diff --git a/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst b/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst deleted file mode 100644 index 49f0f03d7bb..00000000000 --- a/Misc/NEWS.d/next/Library/0265.bpo-27863.pPYHHI.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed multiple crashes in ElementTree caused by race conditions and wrong -types. diff --git a/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst b/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst deleted file mode 100644 index cde465f4b29..00000000000 --- a/Misc/NEWS.d/next/Library/0266.bpo-29204.8Hbqn2.rst +++ /dev/null @@ -1,3 +0,0 @@ -Element.getiterator() and the html parameter of XMLParser() were deprecated -only in the documentation (since Python 3.2 and 3.4 correspondintly). Now -using them emits a deprecation warning. diff --git a/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst b/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst deleted file mode 100644 index e215fc2faab..00000000000 --- a/Misc/NEWS.d/next/Library/0267.bpo-10030.ZdhU3k.rst +++ /dev/null @@ -1 +0,0 @@ -Sped up reading encrypted ZIP files by 2 times. diff --git a/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst b/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst deleted file mode 100644 index 39b8ba8f3e0..00000000000 --- a/Misc/NEWS.d/next/Library/0268.bpo-29942.CsGNuT.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a crash in itertools.chain.from_iterable when encountering long runs of -empty iterables. diff --git a/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst b/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst deleted file mode 100644 index 214fd31b802..00000000000 --- a/Misc/NEWS.d/next/Library/0269.bpo-29953.Q1hSt-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed memory leaks in the replace() method of datetime and time objects when -pass out of bound fold argument. diff --git a/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst b/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst deleted file mode 100644 index cb098ff6b05..00000000000 --- a/Misc/NEWS.d/next/Library/0270.bpo-29931.tfcTwK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed comparison check for ipaddress.ip_interface objects. Patch by Sanjay -Sundaresan. diff --git a/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst b/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst deleted file mode 100644 index 26ef8ef1f4c..00000000000 --- a/Misc/NEWS.d/next/Library/0271.bpo-29654.xRFPge.rst +++ /dev/null @@ -1,2 +0,0 @@ -Support If-Modified-Since HTTP header (browser cache). Patch by Pierre -Quentel. diff --git a/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst b/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst deleted file mode 100644 index 58c8a8e2f34..00000000000 --- a/Misc/NEWS.d/next/Library/0272.bpo-29649.2eIxQ8.rst +++ /dev/null @@ -1,2 +0,0 @@ -Improve struct.pack_into() exception messages for problems with the buffer -size and offset. Patch by Andrew Nester. diff --git a/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst b/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst deleted file mode 100644 index 4844525f23a..00000000000 --- a/Misc/NEWS.d/next/Library/0273.bpo-29962.r-ibsN.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add math.remainder operation, implementing remainder as specified in IEEE -754. diff --git a/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst b/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst deleted file mode 100644 index 5e6637873b3..00000000000 --- a/Misc/NEWS.d/next/Library/0274.bpo-29995.b3mOqx.rst +++ /dev/null @@ -1 +0,0 @@ -re.escape() now escapes only regex special characters. diff --git a/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst b/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst deleted file mode 100644 index 1999770e5d3..00000000000 --- a/Misc/NEWS.d/next/Library/0275.bpo-29998.poeIKD.rst +++ /dev/null @@ -1 +0,0 @@ -Pickling and copying ImportError now preserves name and path attributes. diff --git a/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst b/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst deleted file mode 100644 index d57348eeb28..00000000000 --- a/Misc/NEWS.d/next/Library/0276.bpo-30017.cKBuhU.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allowed calling the close() method of the zip entry writer object multiple -times. Writing to a closed writer now always produces a ValueError. diff --git a/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst b/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst deleted file mode 100644 index f21f7a7dc61..00000000000 --- a/Misc/NEWS.d/next/Library/0277.bpo-26187.aViyiR.rst +++ /dev/null @@ -1,3 +0,0 @@ -Test that sqlite3 trace callback is not called multiple times when schema is -changing. Indirectly fixed by switching to use sqlite3_prepare_v2() in -bpo-9303. Patch by Aviv Palivoda. diff --git a/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst b/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst deleted file mode 100644 index 118475deca0..00000000000 --- a/Misc/NEWS.d/next/Library/0278.bpo-29692.oyWrAE.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed arbitrary unchaining of RuntimeError exceptions in -contextlib.contextmanager. Patch by Siddharth Velankar. diff --git a/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst b/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst deleted file mode 100644 index fd91668c3df..00000000000 --- a/Misc/NEWS.d/next/Library/0279.bpo-29694.LWKxb1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed race condition in pathlib mkdir with flags parents=True. Patch by -Armin Rigo. diff --git a/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst b/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst deleted file mode 100644 index 429673b83ac..00000000000 --- a/Misc/NEWS.d/next/Library/0280.bpo-30068.n4q47r.rst +++ /dev/null @@ -1 +0,0 @@ -_io._IOBase.readlines will check if it's closed first when hint is present. diff --git a/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst b/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst deleted file mode 100644 index 842aa953b4b..00000000000 --- a/Misc/NEWS.d/next/Library/0281.bpo-10076.qCnwly.rst +++ /dev/null @@ -1,2 +0,0 @@ -Compiled regular expression and match objects in the re module now support -copy.copy() and copy.deepcopy() (they are considered atomic). diff --git a/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst b/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst deleted file mode 100644 index bf1ff7d4720..00000000000 --- a/Misc/NEWS.d/next/Library/0282.bpo-30218.ab5oIg.rst +++ /dev/null @@ -1 +0,0 @@ -Fix PathLike support for shutil.unpack_archive. Patch by Jelle Zijlstra. diff --git a/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst b/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst deleted file mode 100644 index 0b181f6084f..00000000000 --- a/Misc/NEWS.d/next/Library/0283.bpo-30061.2w_dX9.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fixed crashes in IOBase methods __next__() and readlines() when readline() -or __next__() respectively return non-sizeable object. Fixed possible other -errors caused by not checking results of PyObject_Size(), PySequence_Size(), -or PyMapping_Size(). diff --git a/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst b/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst deleted file mode 100644 index e74ad0ed975..00000000000 --- a/Misc/NEWS.d/next/Library/0284.bpo-22352.gIQ5qC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Column widths in the output of dis.dis() are now adjusted for large line -numbers and instruction offsets. diff --git a/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst b/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst deleted file mode 100644 index 8e31371216a..00000000000 --- a/Misc/NEWS.d/next/Library/0285.bpo-30070.XM_B41.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed leaks and crashes in errors handling in the parser module. diff --git a/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst b/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst deleted file mode 100644 index 0b37a4b96d5..00000000000 --- a/Misc/NEWS.d/next/Library/0286.bpo-29960.g0wr3r.rst +++ /dev/null @@ -1,2 +0,0 @@ -Preserve generator state when _random.Random.setstate() raises an exception. -Patch by Bryan Olson. diff --git a/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst b/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst deleted file mode 100644 index a9ed2719b4a..00000000000 --- a/Misc/NEWS.d/next/Library/0287.bpo-29822.G7dX13.rst +++ /dev/null @@ -1,2 +0,0 @@ -inspect.isabstract() now works during __init_subclass__. Patch by Nate -Soares. diff --git a/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst b/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst deleted file mode 100644 index cb1577550a6..00000000000 --- a/Misc/NEWS.d/next/Library/0288.bpo-30101.hxUqSL.rst +++ /dev/null @@ -1 +0,0 @@ -Add support for curses.A_ITALIC. diff --git a/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst b/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst deleted file mode 100644 index 7c52e0693e8..00000000000 --- a/Misc/NEWS.d/next/Library/0289.bpo-30190.5E7Hyb.rst +++ /dev/null @@ -1,3 +0,0 @@ -unittest's assertAlmostEqual and assertNotAlmostEqual provide a better -message in case of failure which includes the difference between left and -right arguments. (patch by Giampaolo Rodola') diff --git a/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst b/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst deleted file mode 100644 index fdd33cc0022..00000000000 --- a/Misc/NEWS.d/next/Library/0290.bpo-30228.nF8Ov4.rst +++ /dev/null @@ -1,2 +0,0 @@ -The seek() and tell() methods of io.FileIO now set the internal seekable -attribute to avoid one syscall on open() (in buffered or text mode). diff --git a/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst b/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst deleted file mode 100644 index 2692614a80a..00000000000 --- a/Misc/NEWS.d/next/Library/0291.bpo-30205.BsxO34.rst +++ /dev/null @@ -1 +0,0 @@ -Fix getsockname() for unbound AF_UNIX sockets on Linux. diff --git a/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst b/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst deleted file mode 100644 index dd8fc74567d..00000000000 --- a/Misc/NEWS.d/next/Library/0292.bpo-28556.51gjbP.rst +++ /dev/null @@ -1,3 +0,0 @@ -Various updates to typing module: add typing.NoReturn type, use -WrapperDescriptorType, minor bug-fixes. Original PRs by Jim Fasarakis- -Hilliard and Ivan Levkivskyi. diff --git a/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst b/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst deleted file mode 100644 index b49ba6f2ce9..00000000000 --- a/Misc/NEWS.d/next/Library/0293.bpo-30103.mmPjf5.rst +++ /dev/null @@ -1,2 +0,0 @@ -binascii.b2a_uu() and uu.encode() now support using ``'`'`` as zero instead -of space. diff --git a/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst b/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst deleted file mode 100644 index f19d47c7af9..00000000000 --- a/Misc/NEWS.d/next/Library/0294.bpo-30185.Tiu1n8.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid KeyboardInterrupt tracebacks in forkserver helper process when Ctrl-C -is received. diff --git a/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst b/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst deleted file mode 100644 index 36e2939c902..00000000000 --- a/Misc/NEWS.d/next/Library/0295.bpo-30215.SY8738.rst +++ /dev/null @@ -1,3 +0,0 @@ -Compiled regular expression objects with the re.LOCALE flag no longer depend -on the locale at compile time. Only the locale at matching time affects the -result of matching. diff --git a/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst b/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst deleted file mode 100644 index 6037eaf2555..00000000000 --- a/Misc/NEWS.d/next/Library/0296.bpo-30243.RHQt0v.rst +++ /dev/null @@ -1,3 +0,0 @@ -Removed the __init__ methods of _json's scanner and encoder. Misusing them -could cause memory leaks or crashes. Now scanner and encoder objects are -completely initialized in the __new__ methods. diff --git a/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst b/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst deleted file mode 100644 index ea6329d3952..00000000000 --- a/Misc/NEWS.d/next/Library/0297.bpo-29979.jGBMyE.rst +++ /dev/null @@ -1,3 +0,0 @@ -rewrite cgi.parse_multipart, reusing the FieldStorage class and making its -results consistent with those of FieldStorage for multipart/form-data -requests. Patch by Pierre Quentel. diff --git a/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst b/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst deleted file mode 100644 index 7a6793095f4..00000000000 --- a/Misc/NEWS.d/next/Library/0298.bpo-29990.HWV6KE.rst +++ /dev/null @@ -1 +0,0 @@ -Fix range checking in GB18030 decoder. Original patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst b/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst deleted file mode 100644 index 2e09fb93042..00000000000 --- a/Misc/NEWS.d/next/Library/0299.bpo-30285.s1vpsO.rst +++ /dev/null @@ -1 +0,0 @@ -Optimized case-insensitive matching and searching of regular expressions. diff --git a/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst b/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst deleted file mode 100644 index d0102a01a4e..00000000000 --- a/Misc/NEWS.d/next/Library/0300.bpo-30298.ZN-bWo.rst +++ /dev/null @@ -1,4 +0,0 @@ -Weaken the condition of deprecation warnings for inline modifiers. Now -allowed several subsequential inline modifiers at the start of the pattern -(e.g. ``'(?i)(?s)...'``). In verbose mode whitespaces and comments now are -allowed before and between inline modifiers (e.g. ``'(?x) (?i) (?s)...'``). diff --git a/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst b/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst deleted file mode 100644 index d79acef6765..00000000000 --- a/Misc/NEWS.d/next/Library/0301.bpo-30340.kvtGm-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Enhanced regular expressions optimization. This increased the performance of -matching some patterns up to 25 times. diff --git a/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst b/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst deleted file mode 100644 index c9154526ddb..00000000000 --- a/Misc/NEWS.d/next/Library/0302.bpo-30266.YJzHAH.rst +++ /dev/null @@ -1,3 +0,0 @@ -contextlib.AbstractContextManager now supports anti-registration by setting -__enter__ = None or __exit__ = None, following the pattern introduced in -bpo-25958. Patch by Jelle Zijlstra. diff --git a/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst b/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst deleted file mode 100644 index ee47a9e5832..00000000000 --- a/Misc/NEWS.d/next/Library/0303.bpo-30048.ELRx8R.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed ``Task.cancel()`` can be ignored when the task is running coroutine -and the coroutine returned without any more ``await``. diff --git a/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst b/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst deleted file mode 100644 index 00702b5d1e4..00000000000 --- a/Misc/NEWS.d/next/Library/0304.bpo-30299.O-5d4A.rst +++ /dev/null @@ -1,2 +0,0 @@ -Compiling regular expression in debug mode on CPython now displays the -compiled bytecode in human readable form. diff --git a/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst b/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst deleted file mode 100644 index c1e4112dc07..00000000000 --- a/Misc/NEWS.d/next/Library/0305.bpo-9850.c6SMxt.rst +++ /dev/null @@ -1 +0,0 @@ -The :mod:`macpath` is now deprecated and will be removed in Python 3.8. diff --git a/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst b/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst deleted file mode 100644 index a435b8246f1..00000000000 --- a/Misc/NEWS.d/next/Library/0306.bpo-29196.qBq9eB.rst +++ /dev/null @@ -1,4 +0,0 @@ -Removed previously deprecated in Python 2.4 classes Plist, Dict and -_InternalDict in the plistlib module. Dict values in the result of -functions readPlist() and readPlistFromBytes() are now normal dicts. You no -longer can use attribute access to access items of these dictionaries. diff --git a/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst b/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst deleted file mode 100644 index d9d7be37e44..00000000000 --- a/Misc/NEWS.d/next/Library/0307.bpo-30329.EuT36N.rst +++ /dev/null @@ -1,3 +0,0 @@ -imaplib and poplib now catch the Windows socket WSAEINVAL error (code 10022) -on shutdown(SHUT_RDWR): An invalid operation was attempted. This error -occurs sometimes on SSL connections. diff --git a/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst b/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst deleted file mode 100644 index cb0f7eb038c..00000000000 --- a/Misc/NEWS.d/next/Library/0308.bpo-30375.9c8qM7.rst +++ /dev/null @@ -1,3 +0,0 @@ -Warnings emitted when compile a regular expression now always point to the -line in the user code. Previously they could point into inners of the re -module if emitted from inside of groups or conditionals. diff --git a/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst b/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst deleted file mode 100644 index 0479f10483f..00000000000 --- a/Misc/NEWS.d/next/Library/0309.bpo-30301.ywOkjN.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix AttributeError when using SimpleQueue.empty() under *spawn* and -*forkserver* start methods. diff --git a/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst b/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst deleted file mode 100644 index ad6724d5f07..00000000000 --- a/Misc/NEWS.d/next/Library/0310.bpo-30436.b3zqE7.rst +++ /dev/null @@ -1,3 +0,0 @@ -importlib.find_spec() raises ModuleNotFoundError instead of AttributeError -if the specified parent module is not a package (i.e. lacks a __path__ -attribute). diff --git a/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst b/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst deleted file mode 100644 index 44a69f47ce8..00000000000 --- a/Misc/NEWS.d/next/Library/0311.bpo-30149.hE649r.rst +++ /dev/null @@ -1,2 +0,0 @@ -inspect.signature() now supports callables with variable-argument parameters -wrapped with partialmethod. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst b/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst deleted file mode 100644 index ac449728fd7..00000000000 --- a/Misc/NEWS.d/next/Library/0312.bpo-30003.BOl9HE.rst +++ /dev/null @@ -1 +0,0 @@ -Fix handling escape characters in HZ codec. Based on patch by Ma Lin. diff --git a/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst b/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst deleted file mode 100644 index 3bd0a23069e..00000000000 --- a/Misc/NEWS.d/next/Library/0313.bpo-30414.jGl1Lb.rst +++ /dev/null @@ -1,2 +0,0 @@ -multiprocessing.Queue._feed background running thread do not break from main -loop on exception. diff --git a/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst b/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst deleted file mode 100644 index 666175af758..00000000000 --- a/Misc/NEWS.d/next/Library/0314.bpo-30470.wAYhUc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Deprecate invalid ctypes call protection on Windows. Patch by Mariatta -Wijaya. diff --git a/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst b/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst deleted file mode 100644 index 5b1b3f9d4d8..00000000000 --- a/Misc/NEWS.d/next/Library/0315.bpo-16500.9ypo9k.rst +++ /dev/null @@ -1 +0,0 @@ -Allow registering at-fork handlers. diff --git a/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst b/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst deleted file mode 100644 index 5994abe142c..00000000000 --- a/Misc/NEWS.d/next/Library/0316.bpo-30378.R_19_5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the problem that logging.handlers.SysLogHandler cannot handle IPv6 -addresses. diff --git a/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst b/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst deleted file mode 100644 index f7c1b254c5a..00000000000 --- a/Misc/NEWS.d/next/Library/0317.bpo-30245.Xoa_8Y.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix possible overflow when organize struct.pack_into error message. Patch -by Yuan Liu. diff --git a/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst b/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst deleted file mode 100644 index ab5a622021a..00000000000 --- a/Misc/NEWS.d/next/Library/0318.bpo-30526.7zTG30.rst +++ /dev/null @@ -1 +0,0 @@ -Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through attribute. diff --git a/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst b/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst deleted file mode 100644 index f9f28700076..00000000000 --- a/Misc/NEWS.d/next/Library/0319.bpo-30557.uykrLf.rst +++ /dev/null @@ -1 +0,0 @@ -faulthandler now correctly filters and displays exception codes on Windows diff --git a/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst b/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst deleted file mode 100644 index 87b18d9f47f..00000000000 --- a/Misc/NEWS.d/next/Library/0320.bpo-30520.VYzaSn.rst +++ /dev/null @@ -1 +0,0 @@ -Loggers are now pickleable. diff --git a/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst b/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst deleted file mode 100644 index 588d17e8ee4..00000000000 --- a/Misc/NEWS.d/next/Library/0321.bpo-30463.CdOuSl.rst +++ /dev/null @@ -1,2 +0,0 @@ -Addded empty __slots__ to abc.ABC. This allows subclassers to deny __dict__ -and __weakref__ creation. Patch by Aaron Hall. diff --git a/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst b/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst deleted file mode 100644 index 43e149daffe..00000000000 --- a/Misc/NEWS.d/next/Library/0322.bpo-30418.EwISQm.rst +++ /dev/null @@ -1,2 +0,0 @@ -On Windows, subprocess.Popen.communicate() now also ignore EINVAL on -stdin.write() if the child process is still running but closed the pipe. diff --git a/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst b/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst deleted file mode 100644 index 8292e857a90..00000000000 --- a/Misc/NEWS.d/next/Library/0323.bpo-30014.x7Yx6o.rst +++ /dev/null @@ -1,2 +0,0 @@ -modify() method of poll(), epoll() and devpoll() based classes of selectors -module is around 10% faster. Patch by Giampaolo Rodola'. diff --git a/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst b/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst deleted file mode 100644 index 3e31ab1b855..00000000000 --- a/Misc/NEWS.d/next/Library/0324.bpo-27585.0Ugqqu.rst +++ /dev/null @@ -1 +0,0 @@ -Fix waiter cancellation in asyncio.Lock. Patch by Mathieu Sornay. diff --git a/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst b/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst deleted file mode 100644 index c4264b45ce5..00000000000 --- a/Misc/NEWS.d/next/Library/0325.bpo-29743.en2P4s.rst +++ /dev/null @@ -1,2 +0,0 @@ -Closing transport during handshake process leaks open socket. Patch by -Nikolay Kim diff --git a/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst b/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst deleted file mode 100644 index 55b78a7a79b..00000000000 --- a/Misc/NEWS.d/next/Library/0326.bpo-29870.p960Ih.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ssl sockets leaks when connection is aborted in asyncio/ssl -implementation. Patch by Micha?l Sgha?er. diff --git a/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst b/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst deleted file mode 100644 index a01c8dda8a7..00000000000 --- a/Misc/NEWS.d/next/Library/0327.bpo-30605.XqGz1r.rst +++ /dev/null @@ -1,2 +0,0 @@ -re.compile() no longer raises a BytesWarning when compiling a bytes instance -with misplaced inline modifier. Patch by Roy Williams. diff --git a/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst b/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst deleted file mode 100644 index 96a4eeb3cb9..00000000000 --- a/Misc/NEWS.d/next/Library/0328.bpo-28556.mESP7G.rst +++ /dev/null @@ -1,3 +0,0 @@ -Updates to typing module: Add generic AsyncContextManager, add support for -ContextManager on all versions. Original PRs by Jelle Zijlstra and Ivan -Levkivskyi diff --git a/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst b/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst deleted file mode 100644 index 6f3e2b62ebb..00000000000 --- a/Misc/NEWS.d/next/Library/0329.bpo-30595.d0nRRA.rst +++ /dev/null @@ -1,3 +0,0 @@ -multiprocessing.Queue.get() with a timeout now polls its reader in non- -blocking mode if it succeeded to acquire the lock but the acquire took -longer than the timeout. diff --git a/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst b/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst deleted file mode 100644 index 26cb1cb041f..00000000000 --- a/Misc/NEWS.d/next/Library/0330.bpo-30624.g5oVSn.rst +++ /dev/null @@ -1,2 +0,0 @@ -selectors does not take KeyboardInterrupt and SystemExit into account, -leaving a fd in a bad state in case of error. Patch by Giampaolo Rodola'. diff --git a/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst b/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst deleted file mode 100644 index b8cec56c0a1..00000000000 --- a/Misc/NEWS.d/next/Library/0331.bpo-11822.GQmKw3.rst +++ /dev/null @@ -1 +0,0 @@ -The dis.dis() function now is able to disassemble nested code objects. diff --git a/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst b/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst deleted file mode 100644 index 309908f7cfc..00000000000 --- a/Misc/NEWS.d/next/Library/0332.bpo-30645.xihJ4Y.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix path calculation in `imp.load_package()`, fixing it for cases when a -package is only shipped with bytecodes. Patch by Alexandru Ardelean. diff --git a/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst b/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst deleted file mode 100644 index c0322082e8b..00000000000 --- a/Misc/NEWS.d/next/Library/0333.bpo-30508.wNWRS2.rst +++ /dev/null @@ -1 +0,0 @@ -Don't log exceptions if Task/Future "cancel()" method was called. diff --git a/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst b/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst deleted file mode 100644 index 80de944b4e8..00000000000 --- a/Misc/NEWS.d/next/Library/0334.bpo-28994.9vzun1.rst +++ /dev/null @@ -1,2 +0,0 @@ -The traceback no longer displayed for SystemExit raised in a callback -registered by atexit. diff --git a/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst b/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst deleted file mode 100644 index ac5f0bb2f1b..00000000000 --- a/Misc/NEWS.d/next/Library/0335.bpo-30589.xyZGM0.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix multiprocessing.Process.exitcode to return the opposite of the signal -number when the process is killed by a signal (instead of 255) when using -the "forkserver" method. diff --git a/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst b/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst deleted file mode 100644 index ac5b648a25b..00000000000 --- a/Misc/NEWS.d/next/Library/0336.bpo-24484.vFem8K.rst +++ /dev/null @@ -1 +0,0 @@ -Avoid race condition in multiprocessing cleanup. diff --git a/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst b/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst deleted file mode 100644 index 5a87ccb421d..00000000000 --- a/Misc/NEWS.d/next/Library/0337.bpo-24744.NKxUj3.rst +++ /dev/null @@ -1,2 +0,0 @@ -pkgutil.walk_packages function now raises ValueError if *path* is a string. -Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst b/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst deleted file mode 100644 index 16004ccc3a3..00000000000 --- a/Misc/NEWS.d/next/Library/0339.bpo-23894.k2pADV.rst +++ /dev/null @@ -1 +0,0 @@ -lib2to3 now recognizes ``rb'...'`` and ``f'...'`` strings. diff --git a/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst b/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst deleted file mode 100644 index bfb9a1df80e..00000000000 --- a/Misc/NEWS.d/next/Library/0340.bpo-30038.vb4DWk.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix race condition between signal delivery and wakeup file descriptor. -Patch by Nathaniel Smith. diff --git a/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst b/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst deleted file mode 100644 index e254768b94e..00000000000 --- a/Misc/NEWS.d/next/Library/0341.bpo-30616.I2mDTz.rst +++ /dev/null @@ -1 +0,0 @@ -Functional API of enum allows to create empty enums. Patched by Dong-hee Na diff --git a/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst b/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst deleted file mode 100644 index f4f1b277c18..00000000000 --- a/Misc/NEWS.d/next/Library/0343.bpo-29755.diQcY_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the lgettext() family of functions in the gettext module. They now -always return bytes. diff --git a/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst b/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst deleted file mode 100644 index 9395b6bc7bb..00000000000 --- a/Misc/NEWS.d/next/Library/0345.bpo-29212.HmTdef.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix concurrent.futures.thread.ThreadPoolExecutor threads to have a non -repr() based thread name by default when no thread_name_prefix is supplied. -They will now identify themselves as "ThreadPoolExecutor-y_n". diff --git a/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst b/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst deleted file mode 100644 index 5e54970454d..00000000000 --- a/Misc/NEWS.d/next/Library/0346.bpo-21071.Sw37rs.rst +++ /dev/null @@ -1 +0,0 @@ -struct.Struct.format type is now :class:`str` instead of :class:`bytes`. diff --git a/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst b/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst deleted file mode 100644 index 2636960523c..00000000000 --- a/Misc/NEWS.d/next/Library/0348.bpo-30664.oyqiUl.rst +++ /dev/null @@ -1,2 +0,0 @@ -The description of a unittest subtest now preserves the order of keyword -arguments of TestCase.subTest(). diff --git a/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst b/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst deleted file mode 100644 index 94803bb5f1d..00000000000 --- a/Misc/NEWS.d/next/Library/0349.bpo-30746.7drQI0.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prohibited the '=' character in environment variable names in -``os.putenv()`` and ``os.spawn*()``. diff --git a/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst b/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst deleted file mode 100644 index 862c114aef8..00000000000 --- a/Misc/NEWS.d/next/Library/0350.bpo-30879.N3KI-o.rst +++ /dev/null @@ -1,2 +0,0 @@ -os.listdir() and os.scandir() now emit bytes names when called with bytes- -like argument. diff --git a/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst b/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst deleted file mode 100644 index a37d3703842..00000000000 --- a/Misc/NEWS.d/next/Library/0351.bpo-30119.4UMLNh.rst +++ /dev/null @@ -1,2 +0,0 @@ -ftplib.FTP.putline() now throws ValueError on commands that contains CR or -LF. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst b/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst deleted file mode 100644 index 96d066d41d2..00000000000 --- a/Misc/NEWS.d/next/Library/0352.bpo-29169.8ypApm.rst +++ /dev/null @@ -1 +0,0 @@ -Update zlib to 1.2.11. diff --git a/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst b/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst deleted file mode 100644 index 8c45bcef5fd..00000000000 --- a/Misc/NEWS.d/next/Library/2017-05-24-00-00-00.bpo-9146.pinky_.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix a segmentation fault in _hashopenssl when standard hash functions -such as md5 are not available in the linked OpenSSL library. As in -some special FIPS-140 build environments. diff --git a/Misc/NEWS.d/next/Library/2017-06-24-18-55-58.bpo-30596.VhB8iG.rst b/Misc/NEWS.d/next/Library/2017-06-24-18-55-58.bpo-30596.VhB8iG.rst deleted file mode 100644 index 6b9e9a17c48..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-24-18-55-58.bpo-30596.VhB8iG.rst +++ /dev/null @@ -1 +0,0 @@ -Add a ``close()`` method to ``multiprocessing.Process``. diff --git a/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst b/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst deleted file mode 100644 index adce85fbc2b..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-26-11-01-59.bpo-30532.qTeL1o.rst +++ /dev/null @@ -1 +0,0 @@ -Fix email header value parser dropping folding white space in certain cases. diff --git a/Misc/NEWS.d/next/Library/2017-06-29-00-07-22.bpo-29293.Z6WZjD.rst b/Misc/NEWS.d/next/Library/2017-06-29-00-07-22.bpo-29293.Z6WZjD.rst deleted file mode 100644 index 9ef3ace0906..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-00-07-22.bpo-29293.Z6WZjD.rst +++ /dev/null @@ -1,5 +0,0 @@ -Add missing parameter "n" on multiprocessing.Condition.notify(). - -The doc claims multiprocessing.Condition behaves like threading.Condition, -but its notify() method lacked the optional "n" argument (to specify the -number of sleepers to wake up) that threading.Condition.notify() accepts. diff --git a/Misc/NEWS.d/next/Library/2017-06-29-00-17-38.bpo-29585.x2V0my.rst b/Misc/NEWS.d/next/Library/2017-06-29-00-17-38.bpo-29585.x2V0my.rst deleted file mode 100644 index c841f1b2250..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-00-17-38.bpo-29585.x2V0my.rst +++ /dev/null @@ -1,2 +0,0 @@ -Avoid importing ``sysconfig`` from ``site`` to improve startup speed. Python -startup is about 5% faster on Linux and 30% faster on macOS. diff --git a/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst b/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst deleted file mode 100644 index 55dd6136c8d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-14-25-14.bpo-30441.3Wh9kc.rst +++ /dev/null @@ -1 +0,0 @@ -Fix bug when modifying os.environ while iterating over it diff --git a/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst b/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst deleted file mode 100644 index ce6f48a61f6..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-29-22-04-44.bpo-30807.sLtjY-.rst +++ /dev/null @@ -1,6 +0,0 @@ -signal.setitimer() may disable the timer when passed a tiny value. - -Tiny values (such as 1e-6) are valid non-zero values for setitimer(), which -is specified as taking microsecond-resolution intervals. However, on some -platform, our conversion routine could convert 1e-6 into a zero interval, -therefore disabling the timer instead of (re-)scheduling it. diff --git a/Misc/NEWS.d/next/Library/2017-06-30-23-05-47.bpo-30302.itwK_k.rst b/Misc/NEWS.d/next/Library/2017-06-30-23-05-47.bpo-30302.itwK_k.rst deleted file mode 100644 index 927250d04c4..00000000000 --- a/Misc/NEWS.d/next/Library/2017-06-30-23-05-47.bpo-30302.itwK_k.rst +++ /dev/null @@ -1 +0,0 @@ -Use keywords in the ``repr`` of ``datetime.timedelta``. diff --git a/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst b/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst deleted file mode 100644 index 8924962d071..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-04-13-10-52.bpo-30828.CLvEvV.rst +++ /dev/null @@ -1 +0,0 @@ -Fix out of bounds write in `asyncio.CFuture.remove_done_callback()`. diff --git a/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst b/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst deleted file mode 100644 index 1112d2f3737..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst +++ /dev/null @@ -1 +0,0 @@ -socket.close() now ignores ECONNRESET error. diff --git a/Misc/NEWS.d/next/Library/2017-07-04-22-00-20.bpo-30794.qFwozm.rst b/Misc/NEWS.d/next/Library/2017-07-04-22-00-20.bpo-30794.qFwozm.rst deleted file mode 100644 index d960bd3a306..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-04-22-00-20.bpo-30794.qFwozm.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added multiprocessing.Process.kill method to terminate using the SIGKILL -signal on Unix. diff --git a/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst b/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst deleted file mode 100644 index 5c439087dcb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-07-02-18-57.bpo-29854.J8wKb_.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix segfault in readline when using readline's history-size option. Patch -by Nir Soffer. diff --git a/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst b/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst deleted file mode 100644 index fedd6cd0474..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-10-12-14-22.bpo-30886.nqQj34.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix multiprocessing.Queue.join_thread(): it now waits until the thread -completes, even if the thread was started by the same process which created -the queue. diff --git a/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst b/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst deleted file mode 100644 index 61d6b29cafc..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-17-11-35-00.bpo-25684.usELVx.rst +++ /dev/null @@ -1,2 +0,0 @@ -Change ``ttk.OptionMenu`` radiobuttons to be unique across instances of -``OptionMenu``. diff --git a/Misc/NEWS.d/next/Library/2017-07-17-12-32-47.bpo-30946.DUo-uA.rst b/Misc/NEWS.d/next/Library/2017-07-17-12-32-47.bpo-30946.DUo-uA.rst deleted file mode 100644 index 0d06a7d0ed5..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-17-12-32-47.bpo-30946.DUo-uA.rst +++ /dev/null @@ -1,2 +0,0 @@ -Remove obsolete code in readline module for platforms where GNU readline is -older than 2.1 or where select() is not available. diff --git a/Misc/NEWS.d/next/Library/2017-07-18-13-24-50.bpo-19896.-S0IWu.rst b/Misc/NEWS.d/next/Library/2017-07-18-13-24-50.bpo-19896.-S0IWu.rst deleted file mode 100644 index ce06279440f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-18-13-24-50.bpo-19896.-S0IWu.rst +++ /dev/null @@ -1 +0,0 @@ -Fix multiprocessing.sharedctypes to recognize typecodes ``'q'`` and ``'Q'``. diff --git a/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst b/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst deleted file mode 100644 index b89c6d4769d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst +++ /dev/null @@ -1 +0,0 @@ -Fix decrementing a borrowed reference in tracemalloc. diff --git a/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst b/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst deleted file mode 100644 index 95bcd1007de..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-20-02-29-49.bpo-29403.3RinCV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``unittest.mock``'s autospec to not fail on method-bound builtin -functions. Patch by Aaron Gallagher. diff --git a/Misc/NEWS.d/next/Library/2017-07-22-12-12-42.bpo-26732.lYLWBH.rst b/Misc/NEWS.d/next/Library/2017-07-22-12-12-42.bpo-26732.lYLWBH.rst deleted file mode 100644 index cff0f9ad6ab..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-22-12-12-42.bpo-26732.lYLWBH.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix too many fds in processes started with the "forkserver" method. - -A child process would inherit as many fds as the number of still-running -children. diff --git a/Misc/NEWS.d/next/Library/2017-07-23-11-33-10.bpo-30919.5dYRru.rst b/Misc/NEWS.d/next/Library/2017-07-23-11-33-10.bpo-30919.5dYRru.rst deleted file mode 100644 index 44c3a22bc85..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-23-11-33-10.bpo-30919.5dYRru.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix shared memory performance regression in multiprocessing in 3.x. - -Shared memory used anonymous memory mappings in 2.x, while 3.x mmaps actual -files. Try to be careful to do as little disk I/O as possible. diff --git a/Misc/NEWS.d/next/Library/2017-07-26-13-18-29.bpo-5288.o_xEGj.rst b/Misc/NEWS.d/next/Library/2017-07-26-13-18-29.bpo-5288.o_xEGj.rst deleted file mode 100644 index a7eaa06107f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-26-13-18-29.bpo-5288.o_xEGj.rst +++ /dev/null @@ -1 +0,0 @@ -Support tzinfo objects with sub-minute offsets. diff --git a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst b/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst deleted file mode 100644 index 522bdf669e9..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-27-11-33-58.bpo-30502.GJlfU8.rst +++ /dev/null @@ -1 +0,0 @@ -Fix handling of long oids in ssl. Based on patch by Christian Heimes. diff --git a/Misc/NEWS.d/next/Library/2017-07-30-10-07-58.bpo-30522.gAX1N-.rst b/Misc/NEWS.d/next/Library/2017-07-30-10-07-58.bpo-30522.gAX1N-.rst deleted file mode 100644 index 214f98e101c..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-30-10-07-58.bpo-30522.gAX1N-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added a ``setStream`` method to ``logging.StreamHandler`` to allow the -stream to be set after creation. diff --git a/Misc/NEWS.d/next/Library/2017-07-30-22-00-12.bpo-30987.228rW0.rst b/Misc/NEWS.d/next/Library/2017-07-30-22-00-12.bpo-30987.228rW0.rst deleted file mode 100644 index de30ea8850c..00000000000 --- a/Misc/NEWS.d/next/Library/2017-07-30-22-00-12.bpo-30987.228rW0.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for CAN ISO-TP protocol in the socket module. diff --git a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst b/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst deleted file mode 100644 index 650e5f95f94..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-01-09-32-58.bpo-31061.husAYX.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed a crash when using asyncio and threads. diff --git a/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst b/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst deleted file mode 100644 index 41a75b805ae..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-01-15-56-50.bpo-30897.OuT1-Y.rst +++ /dev/null @@ -1,3 +0,0 @@ -``pathlib.Path`` objects now include an ``is_mount()`` method (only -implemented on POSIX). This is similar to ``os.path.ismount(p)``. Patch by -Cooper Ry Lees. diff --git a/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst b/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst deleted file mode 100644 index afa2d532c5c..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst +++ /dev/null @@ -1 +0,0 @@ -Allow `logging.config.fileConfig` to accept kwargs and/or args. diff --git a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst b/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst deleted file mode 100644 index 3c2a15528d8..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-02-12-48-15.bpo-31107.1t2hn5.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix `copyreg._slotnames()` mangled attribute calculation for classes whose -name begins with an underscore. Patch by Shane Harvey. diff --git a/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst b/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst deleted file mode 100644 index 60068fb648f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-08-14-44-37.bpo-31135.HH94xR.rst +++ /dev/null @@ -1,4 +0,0 @@ -ttk: fix the destroy() method of LabeledScale and OptionMenu classes. -Call the parent destroy() method even if the used attribute doesn't -exist. The LabeledScale.destroy() method now also explicitly clears label and -scale attributes to help the garbage collector to destroy all widgets. diff --git a/Misc/NEWS.d/next/Library/2017-08-08-15-14-34.bpo-24700.44mvNV.rst b/Misc/NEWS.d/next/Library/2017-08-08-15-14-34.bpo-24700.44mvNV.rst deleted file mode 100644 index a78172e0423..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-08-15-14-34.bpo-24700.44mvNV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Optimize array.array comparison. It is now from 10x up to 70x faster when -comparing arrays holding values of the same integer type. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2017-08-09-13-45-23.bpo-31072.NLXDPV.rst b/Misc/NEWS.d/next/Library/2017-08-09-13-45-23.bpo-31072.NLXDPV.rst deleted file mode 100644 index 8c96201210f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-09-13-45-23.bpo-31072.NLXDPV.rst +++ /dev/null @@ -1 +0,0 @@ -Add an ``include_file`` parameter to ``zipapp.create_archive()`` diff --git a/Misc/NEWS.d/next/Library/2017-08-10-13-20-02.bpo-31151.730VBI.rst b/Misc/NEWS.d/next/Library/2017-08-10-13-20-02.bpo-31151.730VBI.rst deleted file mode 100644 index 6eff63653ab..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-10-13-20-02.bpo-31151.730VBI.rst +++ /dev/null @@ -1,2 +0,0 @@ -socketserver.ForkingMixIn.server_close() now waits until all child processes -completed to prevent leaking zombie processes. diff --git a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst b/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst deleted file mode 100644 index bdaa4ea35da..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-11-19-30-00.bpo-31185.i6TPgL.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed miscellaneous errors in asyncio speedup module. diff --git a/Misc/NEWS.d/next/Library/2017-08-12-09-25-55.bpo-5001.huQi2Y.rst b/Misc/NEWS.d/next/Library/2017-08-12-09-25-55.bpo-5001.huQi2Y.rst deleted file mode 100644 index f157d49a816..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-12-09-25-55.bpo-5001.huQi2Y.rst +++ /dev/null @@ -1,9 +0,0 @@ -There are a number of uninformative asserts in the `multiprocessing` module, -as noted in issue 5001. This change fixes two of the most potentially -problematic ones, since they are in error-reporting code, in the -`multiprocessing.managers.convert_to_error` function. (It also makes more -informative a ValueError message.) The only potentially problematic change -is that the AssertionError is now a TypeError; however, this should also -help distinguish it from an AssertionError being *reported* by the -function/its caller (such as in issue 31169). - Patch by Allen W. Smith -(drallensmith on github). diff --git a/Misc/NEWS.d/next/Library/2017-08-13-09-17-01.bpo-31183.-2_YGj.rst b/Misc/NEWS.d/next/Library/2017-08-13-09-17-01.bpo-31183.-2_YGj.rst deleted file mode 100644 index ef7a31a8d01..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-13-09-17-01.bpo-31183.-2_YGj.rst +++ /dev/null @@ -1,2 +0,0 @@ -`dis` now works with asynchronous generator and coroutine objects. Patch by -George Collins based on diagnosis by Luciano Ramalho. diff --git a/Misc/NEWS.d/next/Library/2017-08-16-20-28-06.bpo-18966.mjHWk2.rst b/Misc/NEWS.d/next/Library/2017-08-16-20-28-06.bpo-18966.mjHWk2.rst deleted file mode 100644 index 53bea710127..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-16-20-28-06.bpo-18966.mjHWk2.rst +++ /dev/null @@ -1,2 +0,0 @@ -Non-daemonic threads created by a multiprocessing.Process are now joined on -child exit. diff --git a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst b/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst deleted file mode 100644 index 13c07e39fdc..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-16-21-14-31.bpo-30102.1sPqmc.rst +++ /dev/null @@ -1,4 +0,0 @@ -The ssl and hashlib modules now call OPENSSL_add_all_algorithms_noconf() on -OpenSSL < 1.1.0. The function detects CPU features and enables optimizations -on some CPU architectures such as POWER8. Patch is based on research from -Gustavo Serra Scalet. diff --git a/Misc/NEWS.d/next/Library/2017-08-17-20-29-45.bpo-31109.7qtC64.rst b/Misc/NEWS.d/next/Library/2017-08-17-20-29-45.bpo-31109.7qtC64.rst deleted file mode 100644 index f023cbc80eb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-17-20-29-45.bpo-31109.7qtC64.rst +++ /dev/null @@ -1 +0,0 @@ -Convert zipimport to use Argument Clinic. diff --git a/Misc/NEWS.d/next/Library/2017-08-18-17-16-38.bpo-5001.gwnthq.rst b/Misc/NEWS.d/next/Library/2017-08-18-17-16-38.bpo-5001.gwnthq.rst deleted file mode 100644 index 640b801c9b3..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-18-17-16-38.bpo-5001.gwnthq.rst +++ /dev/null @@ -1 +0,0 @@ -Many asserts in `multiprocessing` are now more informative, and some error types have been changed to more specific ones. diff --git a/Misc/NEWS.d/next/Library/2017-08-21-12-31-53.bpo-31238.Gg0LRH.rst b/Misc/NEWS.d/next/Library/2017-08-21-12-31-53.bpo-31238.Gg0LRH.rst deleted file mode 100644 index 3e1cd130100..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-21-12-31-53.bpo-31238.Gg0LRH.rst +++ /dev/null @@ -1,3 +0,0 @@ -pydoc: the stop() method of the private ServerThread class now waits until -DocServer.serve_until_quit() completes and then explicitly sets its -docserver attribute to None to break a reference cycle. diff --git a/Misc/NEWS.d/next/Library/2017-08-21-16-06-19.bpo-23835.da_4Kz.rst b/Misc/NEWS.d/next/Library/2017-08-21-16-06-19.bpo-23835.da_4Kz.rst deleted file mode 100644 index 5e15ed9669e..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-21-16-06-19.bpo-23835.da_4Kz.rst +++ /dev/null @@ -1,4 +0,0 @@ -configparser: reading defaults in the ``ConfigParser()`` constructor is now -using ``read_dict()``, making its behavior consistent with the rest of the -parser. Non-string keys and values in the defaults dictionary are now being -implicitly converted to strings. Patch by James Tocknell. diff --git a/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst b/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst deleted file mode 100644 index 6879384eb8f..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-21-17-50-27.bpo-31247.8S3zJp.rst +++ /dev/null @@ -1,2 +0,0 @@ -xmlrpc.server now explicitly breaks reference cycles when using -sys.exc_info() in code handling exceptions. diff --git a/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst b/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst deleted file mode 100644 index f11a66802d1..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-22-12-44-48.bpo-31249.STPbb9.rst +++ /dev/null @@ -1,2 +0,0 @@ -concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now breaks a -reference cycle between an exception object and the WorkItem object. diff --git a/Misc/NEWS.d/next/Library/2017-08-23-00-31-32.bpo-29741.EBn_DM.rst b/Misc/NEWS.d/next/Library/2017-08-23-00-31-32.bpo-29741.EBn_DM.rst deleted file mode 100644 index dce720b193b..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-23-00-31-32.bpo-29741.EBn_DM.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update some methods in the _pyio module to also accept integer types. Patch -by Oren Milman. diff --git a/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst b/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst deleted file mode 100644 index bd238f95b8a..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-23.bpo-22536._narf_.rst +++ /dev/null @@ -1,2 +0,0 @@ -The subprocess module now sets the filename when FileNotFoundError -is raised on POSIX systems due to the executable or cwd not being found. diff --git a/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst b/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst deleted file mode 100644 index af4c583e186..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-24-14-03-14.bpo-27584.r11JHZ.rst +++ /dev/null @@ -1,2 +0,0 @@ -``AF_VSOCK`` has been added to the socket interface which allows -communication between virtual machines and their host. diff --git a/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst b/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst deleted file mode 100644 index e7625631002..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-28-13-01-05.bpo-10746.nmAvfu.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ctypes producing wrong PEP 3118 type codes for integer types. diff --git a/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst b/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst deleted file mode 100644 index 7fc8229cf47..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-29-07-14-14.bpo-31281.DcFyNs.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``fileinput.FileInput(files, inplace=True)`` when ``files`` contain -``pathlib.Path`` objects. diff --git a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst b/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst deleted file mode 100644 index 857fad0c852..00000000000 --- a/Misc/NEWS.d/next/Library/2017-08-30-11-26-14.bpo-27144.PEDJsE.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``map()`` and ``as_completed()`` iterators in ``concurrent.futures`` -now avoid keeping a reference to yielded objects. \ No newline at end of file diff --git a/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst b/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst deleted file mode 100644 index ea0ff2b4580..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-01-18-48-06.bpo-31326.TB05tV.rst +++ /dev/null @@ -1,3 +0,0 @@ -concurrent.futures.ProcessPoolExecutor.shutdown() now explicitly closes the -call queue. Moreover, shutdown(wait=True) now also join the call queue -thread, to prevent leaking a dangling thread. diff --git a/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst b/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst deleted file mode 100644 index 86754191e7d..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-10-53-06.bpo-1198569.vhh2nY.rst +++ /dev/null @@ -1,3 +0,0 @@ -``string.Template`` subclasses can optionally define ``braceidpattern`` if -they want to specify different placeholder patterns inside and outside the -braces. If None (the default) it falls back to ``idpattern``. diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst deleted file mode 100644 index e76997ef836..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst +++ /dev/null @@ -1 +0,0 @@ -Add TLS 1.3 cipher suites and OP_NO_TLSv1_3. diff --git a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst deleted file mode 100644 index 2505007dac0..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-23-41-35.bpo-31170.QGmJ1t.rst +++ /dev/null @@ -1,3 +0,0 @@ -expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial -characters for UTF-8 input (libexpat bug 115): -https://github.com/libexpat/libexpat/issues/115 diff --git a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst b/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst deleted file mode 100644 index 299cf3c9d54..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst +++ /dev/null @@ -1 +0,0 @@ -Micro-optimize :func:`asyncio._get_running_loop` to become up to 10% faster. diff --git a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst b/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst deleted file mode 100644 index df018e0c37e..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-05-14-55-28.bpo-31178.JrSFo7.rst +++ /dev/null @@ -1 +0,0 @@ -Fix string concatenation bug in rare error path in the subprocess module diff --git a/Misc/NEWS.d/next/Library/2017-09-05-17-43-00.bpo-14191.vhh2xx.rst b/Misc/NEWS.d/next/Library/2017-09-05-17-43-00.bpo-14191.vhh2xx.rst deleted file mode 100644 index b9e26fb267a..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-05-17-43-00.bpo-14191.vhh2xx.rst +++ /dev/null @@ -1,3 +0,0 @@ -A new function ``argparse.ArgumentParser.parse_intermixed_args`` provides the -ability to parse command lines where there user intermixes options and -positional arguments. diff --git a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst b/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst deleted file mode 100644 index 2d05e10fc14..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-06-06-50-41.bpo-27340.GgekV5.rst +++ /dev/null @@ -1,3 +0,0 @@ -SSLSocket.sendall() now uses memoryview to create slices of data. This fixes -support for all bytes-like object. It is also more efficient and avoids -costly copies. diff --git a/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst b/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst deleted file mode 100644 index d96079f0aee..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-06-18-49-16.bpo-28182.hRP8Bk.rst +++ /dev/null @@ -1,3 +0,0 @@ -The SSL module now raises SSLCertVerificationError when OpenSSL fails to -verify the peer's certificate. The exception contains more information about -the error. diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst deleted file mode 100644 index eb4e206be37..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst +++ /dev/null @@ -1,2 +0,0 @@ -ssl.SSLContext() now uses OpenSSL error information when a context cannot be -instantiated. diff --git a/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst b/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst deleted file mode 100644 index 95a6c2b48b3..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-07-12-15-56.bpo-27629.7xJXEy.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make return types of SSLContext.wrap_bio() and SSLContext.wrap_socket() -customizable. diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst deleted file mode 100644 index 1321300dbd4..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-08-14-19-57.bpo-31400.YOTPKi.rst +++ /dev/null @@ -1 +0,0 @@ -Improves SSL error handling to avoid losing error numbers. diff --git a/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst b/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst deleted file mode 100644 index 53b809f51c0..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-08-14-31-15.bpo-28638.lfbVyH.rst +++ /dev/null @@ -1,9 +0,0 @@ -Changed the implementation strategy for collections.namedtuple() to -substantially reduce the use of exec() in favor of precomputed methods. As a -result, the *verbose* parameter and *_source* attribute are no longer -supported. The benefits include 1) having a smaller memory footprint for -applications using multiple named tuples, 2) faster creation of the named -tuple class (approx 4x to 6x depending on how it is measured), and 3) minor -speed-ups for instance creation using __new__, _make, and _replace. (The -primary patch contributor is Jelle Zijlstra with further improvements by -INADA Naoki, Serhiy Storchaka, and Raymond Hettinger.) diff --git a/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst b/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst deleted file mode 100644 index 5cf75e7c9f8..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-02-17-11.bpo-31233.r-IPIu.rst +++ /dev/null @@ -1,2 +0,0 @@ -socketserver.ThreadingMixIn now keeps a list of non-daemonic threads to wait -until all these threads complete in server_close(). diff --git a/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst b/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst deleted file mode 100644 index 6083fd65bd1..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-07-37-20.bpo-31431.dj994R.rst +++ /dev/null @@ -1,2 +0,0 @@ -SSLContext.check_hostname now automatically sets SSLContext.verify_mode to -ssl.CERT_REQUIRED instead of failing with a ValueError. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst b/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst deleted file mode 100644 index 153aa42a62e..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-13-33-39.bpo-31457.bIVBtI.rst +++ /dev/null @@ -1 +0,0 @@ -LoggerAdapter objects can now be nested. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst b/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst deleted file mode 100644 index e522e8e9527..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-18-05-56.bpo-31234.lGkcPg.rst +++ /dev/null @@ -1,2 +0,0 @@ -socket.create_connection() now fixes manually a reference cycle: clear the -variable storing the last exception on success. diff --git a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst b/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst deleted file mode 100644 index 9ea3599ee0b..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst +++ /dev/null @@ -1,2 +0,0 @@ -The C accelerator module of ElementTree ignored exceptions raised when -looking up TreeBuilder target methods in XMLParser(). diff --git a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst b/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst deleted file mode 100644 index efc5918ca07..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-13-23-27-39.bpo-28556.UmTQvv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Speed improvements to the ``typing`` module. Original PRs by Ivan -Levkivskyi and Mitar. diff --git a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst b/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst deleted file mode 100644 index 8464d59a0cb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-14-11-02-56.bpo-28556.EUOiYs.rst +++ /dev/null @@ -1,2 +0,0 @@ -typing.get_type_hints now finds the right globalns for classes and modules -by default (when no ``globalns`` was specified by the caller). diff --git a/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst b/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst deleted file mode 100644 index ed7a4175cd7..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst +++ /dev/null @@ -1 +0,0 @@ -``random.seed()`` now works with bytes in version=1 diff --git a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst b/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst deleted file mode 100644 index 22af29fdecb..00000000000 --- a/Misc/NEWS.d/next/Library/2017-09-18-10-57-04.bpo-31499.BydYhf.rst +++ /dev/null @@ -1 +0,0 @@ -xml.etree: Fix a crash when a parser is part of a reference cycle. diff --git a/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst b/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst deleted file mode 100644 index 7394ac2ff0e..00000000000 --- a/Misc/NEWS.d/next/Security/0338.bpo-29591.ExKblw.rst +++ /dev/null @@ -1,5 +0,0 @@ -.. original section: Library - -Update expat copy from 2.1.1 to 2.2.0 to get fixes of CVE-2016-0718 and -CVE-2016-4472. See https://sourceforge.net/p/expat/bugs/537/ for more -information. diff --git a/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst b/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst deleted file mode 100644 index adf464567b0..00000000000 --- a/Misc/NEWS.d/next/Security/0342.bpo-30500.1VG7R-.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. original section: Library - -Fix urllib.parse.splithost() to correctly parse fragments. For example, -``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the -``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an -authentification (``login at host``). diff --git a/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst b/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst deleted file mode 100644 index ebbd359e63f..00000000000 --- a/Misc/NEWS.d/next/Security/0344.bpo-30694.WkMWM_.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. original section: Library - -Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple security -vulnerabilities including: CVE-2017-9233 (External entity infinite loop -DoS), CVE-2016-9063 (Integer overflow, re-fix), CVE-2016-0718 (Fix -regression bugs from 2.2.0's fix to CVE-2016-0718) and CVE-2012-0876 -(Counter hash flooding with SipHash). Note: the CVE-2016-5300 (Use os- -specific entropy sources like getrandom) doesn't impact Python, since Python -already gets entropy from the OS to set the expat secret using -``XML_SetHashSalt()``. diff --git a/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst b/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst deleted file mode 100644 index 008aa706d49..00000000000 --- a/Misc/NEWS.d/next/Security/0347.bpo-30730.rJsyTH.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. original section: Library - -Prevent environment variables injection in subprocess on Windows. Prevent -passing other environment variables and command arguments. diff --git a/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst b/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst deleted file mode 100644 index 3caca9a79b4..00000000000 --- a/Misc/NEWS.d/next/Security/2017-08-16-16-35-59.bpo-30947.iNMmm4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security -fixes. diff --git a/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst b/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst deleted file mode 100644 index 9a0fb16f9ee..00000000000 --- a/Misc/NEWS.d/next/Security/2017-08-23-17-02-55.bpo-29505.BL6Yt8.rst +++ /dev/null @@ -1 +0,0 @@ -Add fuzz tests for float(str), int(str), unicode(str); for oss-fuzz. diff --git a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst b/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst deleted file mode 100644 index b9106a5f744..00000000000 --- a/Misc/NEWS.d/next/Security/2017-09-05-15-26-30.bpo-29781.LwYtBP.rst +++ /dev/null @@ -1,2 +0,0 @@ -SSLObject.version() now correctly returns None when handshake over BIO has -not been performed yet. diff --git a/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst b/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst deleted file mode 100644 index 1288f34f5ac..00000000000 --- a/Misc/NEWS.d/next/Tests/0001.bpo-26939.7j_W5R.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add the support.setswitchinterval() function to fix test_functools hanging -on the Android armv7 qemu emulator. diff --git a/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst b/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst deleted file mode 100644 index 90fb8631c10..00000000000 --- a/Misc/NEWS.d/next/Tests/0002.bpo-28217.Y37OKV.rst +++ /dev/null @@ -1 +0,0 @@ -Adds _testconsole module to test console input. diff --git a/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst b/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst deleted file mode 100644 index 27af4a2135a..00000000000 --- a/Misc/NEWS.d/next/Tests/0003.bpo-28409.Q2IlxJ.rst +++ /dev/null @@ -1 +0,0 @@ -regrtest: fix the parser of command line arguments. diff --git a/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst b/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst deleted file mode 100644 index 78384ffb4c1..00000000000 --- a/Misc/NEWS.d/next/Tests/0004.bpo-26944.ChZ_BO.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix test_posix for Android where 'id -G' is entirely wrong or missing the -effective gid. diff --git a/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst b/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst deleted file mode 100644 index 8cf2627787e..00000000000 --- a/Misc/NEWS.d/next/Tests/0005.bpo-23839.zsT_L9.rst +++ /dev/null @@ -1 +0,0 @@ -Various caches now are cleared before running every test file. diff --git a/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst b/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst deleted file mode 100644 index ec9830397c4..00000000000 --- a/Misc/NEWS.d/next/Tests/0006.bpo-28666.RtTk-4.rst +++ /dev/null @@ -1,2 +0,0 @@ -Now test.support.rmtree is able to remove unwritable or unreadable -directories. diff --git a/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst b/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst deleted file mode 100644 index 330399cc4bf..00000000000 --- a/Misc/NEWS.d/next/Tests/0007.bpo-26936.XSZSVS.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the test_socket failures on Android - getservbyname(), getservbyport() -and getaddrinfo() are broken on some Android API levels. diff --git a/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst b/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst deleted file mode 100644 index 2dd5006f2c5..00000000000 --- a/Misc/NEWS.d/next/Tests/0008.bpo-28683.Fp-Hdq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the tests that bind() a unix socket and raise PermissionError on Android -for a non-root user. diff --git a/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst b/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst deleted file mode 100644 index c7421780b2d..00000000000 --- a/Misc/NEWS.d/next/Tests/0009.bpo-28950.1W8Glo.rst +++ /dev/null @@ -1 +0,0 @@ -Disallow -j0 to be combined with -T/-l in regrtest command line arguments. diff --git a/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst b/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst deleted file mode 100644 index 044e7a40dda..00000000000 --- a/Misc/NEWS.d/next/Tests/0010.bpo-24932.XLTzvR.rst +++ /dev/null @@ -1 +0,0 @@ -Use proper command line parsing in _testembed diff --git a/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst b/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst deleted file mode 100644 index 63461bb478b..00000000000 --- a/Misc/NEWS.d/next/Tests/0011.bpo-30197.c5wRfu.rst +++ /dev/null @@ -1,5 +0,0 @@ -Enhanced functions swap_attr() and swap_item() in the test.support module. -They now work when delete replaced attribute or item inside the with -statement. The old value of the attribute or item (or None if it doesn't -exist) now will be assigned to the target of the "as" clause, if there is -one. diff --git a/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst b/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst deleted file mode 100644 index c7e7b7f242b..00000000000 --- a/Misc/NEWS.d/next/Tests/0012.bpo-30357.n4CPEa.rst +++ /dev/null @@ -1,3 +0,0 @@ -test_thread: setUp() now uses support.threading_setup() and -support.threading_cleanup() to wait until threads complete to avoid random -side effects on following tests. Initial patch written by Grzegorz Grzywacz. diff --git a/Misc/NEWS.d/next/Tests/2017-06-30-11-20-20.bpo-30695.lo7FQX.rst b/Misc/NEWS.d/next/Tests/2017-06-30-11-20-20.bpo-30695.lo7FQX.rst deleted file mode 100644 index a57bbe73c27..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-06-30-11-20-20.bpo-30695.lo7FQX.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add the `set_nomemory(start, stop)` and `remove_mem_hooks()` functions to -the _testcapi module. diff --git a/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst b/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst deleted file mode 100644 index 53557f66fef..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst +++ /dev/null @@ -1,5 +0,0 @@ -regrtest: Exclude tzdata from regrtest --all. When running the test suite -using --use=all / -u all, exclude tzdata since it makes test_datetime too -slow (15-20 min on some buildbots) which then times out on some buildbots. -Fix also regrtest command line parser to allow passing -u extralargefile to -run test_zipfile64. diff --git a/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst b/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst deleted file mode 100644 index 88394e585c5..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst +++ /dev/null @@ -1,2 +0,0 @@ -Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves -like OpenSSL 1.0.2 and no longer aborts handshake. diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst b/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst deleted file mode 100644 index 383d1b43615..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-04-13-03-55.bpo-25674.whVTXh.rst +++ /dev/null @@ -1 +0,0 @@ -Remove sha256.tbs-internet.com ssl test diff --git a/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst b/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst deleted file mode 100644 index 87bc8cfabaf..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-04-16-21-18.bpo-31346.xni1VR.rst +++ /dev/null @@ -1 +0,0 @@ -Prefer PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER protocols for SSLContext. diff --git a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst b/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst deleted file mode 100644 index 8b7163dfe79..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-05-14-23-35.bpo-31320.JRDHx7.rst +++ /dev/null @@ -1 +0,0 @@ -Silence traceback in test_ssl diff --git a/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst b/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst deleted file mode 100644 index 7f49eb4bab4..00000000000 --- a/Misc/NEWS.d/next/Tests/2017-09-08-15-59-07.bpo-29639.yIZecp.rst +++ /dev/null @@ -1,2 +0,0 @@ -test.support.HOST is now "localhost", a new HOSTv4 constant has been added -for your ``127.0.0.1`` needs, similar to the existing HOSTv6 constant. diff --git a/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst b/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst deleted file mode 100644 index bfd2f95def1..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0013.bpo-28102.5fKaek.rst +++ /dev/null @@ -1,2 +0,0 @@ -The zipfile module CLI now prints usage to stderr. Patch by Stephen J. -Turnbull. diff --git a/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst b/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst deleted file mode 100644 index 0d785edcb5d..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0014.bpo-15369.bdZ3n-.rst +++ /dev/null @@ -1,4 +0,0 @@ -The pybench and pystone microbenchmark have been removed from Tools. Please -use the new Python benchmark suite https://github.com/python/performance -which is more reliable and includes a portable version of pybench working on -Python 2 and Python 3. diff --git a/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst b/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst deleted file mode 100644 index 515c7175a79..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0015.bpo-28023.4gzSGp.rst +++ /dev/null @@ -1 +0,0 @@ -Fix python-gdb.py didn't support new dict implementation. diff --git a/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst b/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst deleted file mode 100644 index c0dc7d1f975..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0016.bpo-29367.4dOKL0.rst +++ /dev/null @@ -1,2 +0,0 @@ -python-gdb.py now supports also ``method-wrapper`` (``wrapperobject``) -objects. diff --git a/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst b/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst deleted file mode 100644 index 1be5ab30e9c..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0017.bpo-24037.KPFC7o.rst +++ /dev/null @@ -1,3 +0,0 @@ -Argument Clinic now uses the converter `bool(accept={int})` rather than -`int` for semantical booleans. This avoids repeating the default value for -Python and C and will help in converting to `bool` in future. diff --git a/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst b/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst deleted file mode 100644 index 2992d06249f..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/0018.bpo-29748.6pV6s9.rst +++ /dev/null @@ -1 +0,0 @@ -Added the slice index converter in Argument Clinic. diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst b/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst deleted file mode 100644 index 404263e9ac8..00000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2017-08-18-17-19-23.bpo-30983.ggGz9z.rst +++ /dev/null @@ -1,6 +0,0 @@ -gdb integration commands (py-bt, etc.) work on optimized shared builds now, -too. PEP 523 introduced _PyEval_EvalFrameDefault which inlines -PyEval_EvalFrameEx on non-debug shared builds. This broke the ability to -use py-bt, py-up, and a few other Python-specific gdb integrations. The -problem is fixed by only looking for _PyEval_EvalFrameDefault frames in -python-gdb.py. Original patch by Bruno "Polaco" Penteado. diff --git a/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst b/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst deleted file mode 100644 index fb06e8ea323..00000000000 --- a/Misc/NEWS.d/next/Windows/0074.bpo-28138.pNdv64.rst +++ /dev/null @@ -1 +0,0 @@ -Windows ._pth file should allow import site diff --git a/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst b/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst deleted file mode 100644 index fd98a660c9a..00000000000 --- a/Misc/NEWS.d/next/Windows/0075.bpo-28137.C1uvzY.rst +++ /dev/null @@ -1 +0,0 @@ -Renames Windows path file to ._pth diff --git a/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst b/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst deleted file mode 100644 index 83ee2eb8df0..00000000000 --- a/Misc/NEWS.d/next/Windows/0076.bpo-28164.5MfN0J.rst +++ /dev/null @@ -1 +0,0 @@ -_PyIO_get_console_type fails for various paths diff --git a/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst b/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst deleted file mode 100644 index 0c44499e74a..00000000000 --- a/Misc/NEWS.d/next/Windows/0077.bpo-28163.-DUgJw.rst +++ /dev/null @@ -1 +0,0 @@ -WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle diff --git a/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst b/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst deleted file mode 100644 index 2568d3676b5..00000000000 --- a/Misc/NEWS.d/next/Windows/0078.bpo-28162.3FHPVD.rst +++ /dev/null @@ -1 +0,0 @@ -WindowsConsoleIO readall() fails if first line starts with Ctrl+Z diff --git a/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst b/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst deleted file mode 100644 index 667817a2fd9..00000000000 --- a/Misc/NEWS.d/next/Windows/0079.bpo-28161.hF91LI.rst +++ /dev/null @@ -1 +0,0 @@ -Opening CON for write access fails diff --git a/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst b/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst deleted file mode 100644 index 174690e49ae..00000000000 --- a/Misc/NEWS.d/next/Windows/0080.bpo-28110.cnkP5F.rst +++ /dev/null @@ -1 +0,0 @@ -launcher.msi has different product codes between 32-bit and 64-bit diff --git a/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst b/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst deleted file mode 100644 index 16d5ad08d80..00000000000 --- a/Misc/NEWS.d/next/Windows/0081.bpo-28251.tR_AFs.rst +++ /dev/null @@ -1 +0,0 @@ -Improvements to help manuals on Windows. diff --git a/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst b/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst deleted file mode 100644 index 564c925e182..00000000000 --- a/Misc/NEWS.d/next/Windows/0082.bpo-28333.KnpeO4.rst +++ /dev/null @@ -1 +0,0 @@ -Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun) diff --git a/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst b/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst deleted file mode 100644 index cdf17e1685d..00000000000 --- a/Misc/NEWS.d/next/Windows/0083.bpo-28402.v9zETJ.rst +++ /dev/null @@ -1 +0,0 @@ -Adds signed catalog files for stdlib on Windows. diff --git a/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst b/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst deleted file mode 100644 index 9b91f326d77..00000000000 --- a/Misc/NEWS.d/next/Windows/0084.bpo-28522.XHMQa7.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes mishandled buffer reallocation in getpathp.c diff --git a/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst b/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst deleted file mode 100644 index 727830c3899..00000000000 --- a/Misc/NEWS.d/next/Windows/0085.bpo-28896.qOcBBL.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecate WindowsRegistryFinder and disable it by default diff --git a/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst b/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst deleted file mode 100644 index efe97458158..00000000000 --- a/Misc/NEWS.d/next/Windows/0086.bpo-25778.8uKJ82.rst +++ /dev/null @@ -1 +0,0 @@ -winreg does not truncate string correctly (Patch by Eryk Sun) diff --git a/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst b/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst deleted file mode 100644 index 13c5b0d9dfd..00000000000 --- a/Misc/NEWS.d/next/Windows/0087.bpo-29579.07B-FQ.rst +++ /dev/null @@ -1 +0,0 @@ -Removes readme.txt from the installer. diff --git a/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst b/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst deleted file mode 100644 index be003d1a0cf..00000000000 --- a/Misc/NEWS.d/next/Windows/0088.bpo-30450.qsaK8y.rst +++ /dev/null @@ -1,4 +0,0 @@ -The build process on Windows no longer depends on Subversion, instead -pulling external code from GitHub via a Python script. If Python 3.6 is not -found on the system (via ``py -3.6``), NuGet is used to download a copy of -32-bit Python. diff --git a/Misc/NEWS.d/next/Windows/2017-06-27-07-04-06.bpo-23451.bl_QOB.rst b/Misc/NEWS.d/next/Windows/2017-06-27-07-04-06.bpo-23451.bl_QOB.rst deleted file mode 100644 index bad4e22d487..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-06-27-07-04-06.bpo-23451.bl_QOB.rst +++ /dev/null @@ -1 +0,0 @@ -Fix socket deprecation warnings in socketmodule.c. Patch by Segev Finer. diff --git a/Misc/NEWS.d/next/Windows/2017-06-28-03-08-22.bpo-30362.XxeVMB.rst b/Misc/NEWS.d/next/Windows/2017-06-28-03-08-22.bpo-30362.XxeVMB.rst deleted file mode 100644 index fb24ec541f3..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-06-28-03-08-22.bpo-30362.XxeVMB.rst +++ /dev/null @@ -1 +0,0 @@ -Adds list options (-0, -0p) to py.exe launcher. Contributed by Steve Barnes. diff --git a/Misc/NEWS.d/next/Windows/2017-06-28-03-20-48.bpo-30291.zBpOl6.rst b/Misc/NEWS.d/next/Windows/2017-06-28-03-20-48.bpo-30291.zBpOl6.rst deleted file mode 100644 index 2869823326d..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-06-28-03-20-48.bpo-30291.zBpOl6.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow requiring 64-bit interpreters from py.exe using -64 suffix. Contributed -by Steve (Gadget) Barnes. diff --git a/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst b/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst deleted file mode 100644 index 8a65a9e022c..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-07-13-11-22-53.bpo-30731.nmMDwI.rst +++ /dev/null @@ -1 +0,0 @@ -Add a missing xmlns to python.manifest so that it matches the schema. diff --git a/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst b/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst deleted file mode 100644 index c91fd881825..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-07-15-00-40-12.bpo-30916.BpCrro.rst +++ /dev/null @@ -1 +0,0 @@ -Pre-build OpenSSL, Tcl and Tk and include the binaries in the build. diff --git a/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst b/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst deleted file mode 100644 index 6591fa0df00..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-08-04-10-05-19.bpo-30581.OQhR7l.rst +++ /dev/null @@ -1,2 +0,0 @@ -os.cpu_count() now returns the correct number of processors on Windows -when the number of logical processors is greater than 64. diff --git a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst b/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst deleted file mode 100644 index 065596fcc85..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-04-13-19-05.bpo-31340.MbkzLi.rst +++ /dev/null @@ -1 +0,0 @@ -Change to building with MSVC v141 (included with Visual Studio 2017) diff --git a/Misc/NEWS.d/next/Windows/2017-09-05-19-46-52.bpo-31358.n1Fjxc.rst b/Misc/NEWS.d/next/Windows/2017-09-05-19-46-52.bpo-31358.n1Fjxc.rst deleted file mode 100644 index 6d95d862c7e..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-05-19-46-52.bpo-31358.n1Fjxc.rst +++ /dev/null @@ -1,2 +0,0 @@ -zlib is no longer bundled in the CPython source, instead it is downloaded on -demand just like bz2, lzma, OpenSSL, Tcl/Tk, and SQLite. diff --git a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst b/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst deleted file mode 100644 index 7c72e315142..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-06-17-14-54.bpo-30389.9Dizrx.rst +++ /dev/null @@ -1 +0,0 @@ -Adds detection of Visual Studio 2017 to distutils on Windows. diff --git a/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst b/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst deleted file mode 100644 index cc1cb787e55..00000000000 --- a/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst +++ /dev/null @@ -1 +0,0 @@ -Update Windows build to use OpenSSL 1.1.0f From solipsis at pitrou.net Tue Sep 19 05:23:15 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 19 Sep 2017 09:23:15 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=6 Message-ID: <20170919092315.61399.FFD3F60687C04F95@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [2, -2, 2] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog95Oykj', '--timeout', '7200'] From webhook-mailer at python.org Tue Sep 19 07:23:04 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 19 Sep 2017 11:23:04 -0000 Subject: [Python-checkins] bpo-31492: Fix assertion failures in case of a module with a bad __name__ attribute. (#3620) Message-ID: https://github.com/python/cpython/commit/6db7033192cd537ca987a65971acb01206c3ba82 commit: 6db7033192cd537ca987a65971acb01206c3ba82 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-19T14:23:01+03:00 summary: bpo-31492: Fix assertion failures in case of a module with a bad __name__ attribute. (#3620) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-16-22-49-16.bpo-31492.RtyteL.rst M Lib/test/test_import/__init__.py M Objects/moduleobject.c M Python/ceval.c diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index ddef27d9cd4..5a610ba3126 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -400,6 +400,18 @@ def __getattr__(self, _): self.assertEqual(str(cm.exception), "cannot import name 'does_not_exist' from '' (unknown location)") + @cpython_only + def test_issue31492(self): + # There shouldn't be an assertion failure in case of failing to import + # from a module with a bad __name__ attribute, or in case of failing + # to access an attribute of such a module. + with swap_attr(os, '__name__', None): + with self.assertRaises(ImportError): + from os import does_not_exist + + with self.assertRaises(AttributeError): + os.does_not_exist + def test_concurrency(self): sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'data')) try: diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-16-22-49-16.bpo-31492.RtyteL.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-16-22-49-16.bpo-31492.RtyteL.rst new file mode 100644 index 00000000000..a8704738d1a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-16-22-49-16.bpo-31492.RtyteL.rst @@ -0,0 +1,3 @@ +Fix assertion failures in case of failing to import from a module with a bad +``__name__`` attribute, and in case of failing to access an attribute of such +a module. Patch by Oren Milman. diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 2be49fbda38..29732633da1 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -687,14 +687,11 @@ module_getattro(PyModuleObject *m, PyObject *name) if (m->md_dict) { _Py_IDENTIFIER(__name__); mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__); - if (mod_name) { + if (mod_name && PyUnicode_Check(mod_name)) { PyErr_Format(PyExc_AttributeError, "module '%U' has no attribute '%U'", mod_name, name); return NULL; } - else if (PyErr_Occurred()) { - PyErr_Clear(); - } } PyErr_Format(PyExc_AttributeError, "module has no attribute '%U'", name); diff --git a/Python/ceval.c b/Python/ceval.c index 8cc5094a3f4..cf0c6c9ae2f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4930,6 +4930,10 @@ import_from(PyObject *v, PyObject *name) if (pkgname == NULL) { goto error; } + if (!PyUnicode_Check(pkgname)) { + Py_CLEAR(pkgname); + goto error; + } fullmodname = PyUnicode_FromFormat("%U.%U", pkgname, name); if (fullmodname == NULL) { Py_DECREF(pkgname); From webhook-mailer at python.org Tue Sep 19 07:39:50 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 19 Sep 2017 11:39:50 -0000 Subject: [Python-checkins] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (#3257) Message-ID: https://github.com/python/cpython/commit/9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54 commit: 9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-19T14:39:47+03:00 summary: bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (#3257) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst M Lib/test/test_imp.py M Python/importdl.c diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 3bfcb095894..51bec50cc2f 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -313,6 +313,17 @@ def test_load_source(self): with self.assertRaisesRegex(ValueError, 'embedded null'): imp.load_source(__name__, __file__ + "\0") + @support.cpython_only + def test_issue31315(self): + # There shouldn't be an assertion failure in imp.create_dynamic(), + # when spec.name is not a string. + create_dynamic = support.get_attribute(imp, 'create_dynamic') + class BadSpec: + name = None + origin = 'foo' + with self.assertRaises(TypeError): + create_dynamic(BadSpec()) + class ReloadTests(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst new file mode 100644 index 00000000000..d13badbb358 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in imp.create_dynamic(), when spec.name is not a +string. Patch by Oren Milman. diff --git a/Python/importdl.c b/Python/importdl.c index 32fb7e1be21..50231ff2884 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -103,6 +103,11 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp) if (name_unicode == NULL) { return NULL; } + if (!PyUnicode_Check(name_unicode)) { + PyErr_SetString(PyExc_TypeError, + "spec.name must be a string"); + goto error; + } name = get_encoded_name(name_unicode, &hook_prefix); if (name == NULL) { From webhook-mailer at python.org Tue Sep 19 08:51:24 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 19 Sep 2017 12:51:24 -0000 Subject: [Python-checkins] [3.6] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (GH-3257) (#3653) Message-ID: https://github.com/python/cpython/commit/99a51d4e5b154a7b8d971090fecc1e34769a3ca1 commit: 99a51d4e5b154a7b8d971090fecc1e34769a3ca1 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-19T15:51:19+03:00 summary: [3.6] bpo-31315: Fix an assertion failure in imp.create_dynamic(), when spec.name is not a string. (GH-3257) (#3653) (cherry picked from commit 9974e1bcf3d0cec9b38b39b39b7ec8a1ebd9ef54) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst M Lib/test/test_imp.py M Python/importdl.c diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 6f35f49487c..d513eedc7bb 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -318,6 +318,17 @@ def test_load_source(self): with self.assertRaisesRegex(ValueError, 'embedded null'): imp.load_source(__name__, __file__ + "\0") + @support.cpython_only + def test_issue31315(self): + # There shouldn't be an assertion failure in imp.create_dynamic(), + # when spec.name is not a string. + create_dynamic = support.get_attribute(imp, 'create_dynamic') + class BadSpec: + name = None + origin = 'foo' + with self.assertRaises(TypeError): + create_dynamic(BadSpec()) + class ReloadTests(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst new file mode 100644 index 00000000000..d13badbb358 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-01-00-40-58.bpo-31315.ZX20bl.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in imp.create_dynamic(), when spec.name is not a +string. Patch by Oren Milman. diff --git a/Python/importdl.c b/Python/importdl.c index f56fa94cc42..326b26fd06e 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -103,6 +103,11 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp) if (name_unicode == NULL) { return NULL; } + if (!PyUnicode_Check(name_unicode)) { + PyErr_SetString(PyExc_TypeError, + "spec.name must be a string"); + goto error; + } name = get_encoded_name(name_unicode, &hook_prefix); if (name == NULL) { From webhook-mailer at python.org Tue Sep 19 08:58:14 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 19 Sep 2017 12:58:14 -0000 Subject: [Python-checkins] bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (#3227) Message-ID: https://github.com/python/cpython/commit/865e4b4f630e2ae91e61239258abb58b488f1d65 commit: 865e4b4f630e2ae91e61239258abb58b488f1d65 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-19T15:58:11+03:00 summary: bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (#3227) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst M Lib/test/datetimetester.py M Modules/_datetimemodule.c diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 29b70e1a8a0..a042efd878b 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -866,6 +866,26 @@ def test_divmod(self): self.assertRaises(TypeError, divmod, t, 10) + def test_issue31293(self): + # The interpreter shouldn't crash in case a timedelta is divided or + # multiplied by a float with a bad as_integer_ratio() method. + def get_bad_float(bad_ratio): + class BadFloat(float): + def as_integer_ratio(self): + return bad_ratio + return BadFloat() + + with self.assertRaises(TypeError): + timedelta() / get_bad_float(1 << 1000) + with self.assertRaises(TypeError): + timedelta() * get_bad_float(1 << 1000) + + for bad_ratio in [(), (42, ), (1, 2, 3)]: + with self.assertRaises(ValueError): + timedelta() / get_bad_float(bad_ratio) + with self.assertRaises(ValueError): + timedelta() * get_bad_float(bad_ratio) + ############################################################################# # date tests diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst new file mode 100644 index 00000000000..28b7bfb2ef3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst @@ -0,0 +1,2 @@ +Fix crashes in true division and multiplication of a timedelta object by a +float with a bad as_integer_ratio() method. Patch by Oren Milman. diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 619ac84bf74..3dd7f827509 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1651,6 +1651,33 @@ multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) } static PyObject * +get_float_as_integer_ratio(PyObject *floatobj) +{ + PyObject *ratio; + + assert(floatobj && PyFloat_Check(floatobj)); + ratio = _PyObject_CallMethodId(floatobj, &PyId_as_integer_ratio, NULL); + if (ratio == NULL) { + return NULL; + } + if (!PyTuple_Check(ratio)) { + PyErr_Format(PyExc_TypeError, + "unexpected return type from as_integer_ratio(): " + "expected tuple, got '%.200s'", + Py_TYPE(ratio)->tp_name); + Py_DECREF(ratio); + return NULL; + } + if (PyTuple_Size(ratio) != 2) { + PyErr_SetString(PyExc_ValueError, + "as_integer_ratio() must return a 2-tuple"); + Py_DECREF(ratio); + return NULL; + } + return ratio; +} + +static PyObject * multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta) { PyObject *result = NULL; @@ -1660,9 +1687,10 @@ multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta) pyus_in = delta_to_microseconds(delta); if (pyus_in == NULL) return NULL; - ratio = _PyObject_CallMethodId(floatobj, &PyId_as_integer_ratio, NULL); - if (ratio == NULL) + ratio = get_float_as_integer_ratio(floatobj); + if (ratio == NULL) { goto error; + } temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 0)); Py_DECREF(pyus_in); pyus_in = NULL; @@ -1758,9 +1786,10 @@ truedivide_timedelta_float(PyDateTime_Delta *delta, PyObject *f) pyus_in = delta_to_microseconds(delta); if (pyus_in == NULL) return NULL; - ratio = _PyObject_CallMethodId(f, &PyId_as_integer_ratio, NULL); - if (ratio == NULL) + ratio = get_float_as_integer_ratio(f); + if (ratio == NULL) { goto error; + } temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 1)); Py_DECREF(pyus_in); pyus_in = NULL; From webhook-mailer at python.org Tue Sep 19 10:00:48 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Tue, 19 Sep 2017 14:00:48 -0000 Subject: [Python-checkins] [3.6] bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (GH-3227) (#3654) Message-ID: https://github.com/python/cpython/commit/f37dd11f0d4832c15d49c2ddc83d533ddaa36e74 commit: f37dd11f0d4832c15d49c2ddc83d533ddaa36e74 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-19T17:00:44+03:00 summary: [3.6] bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a bad as_integer_ratio() method. (GH-3227) (#3654) (cherry picked from commit 865e4b4f630e2ae91e61239258abb58b488f1d65) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst M Lib/test/datetimetester.py M Modules/_datetimemodule.c diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index b25e6c17136..77df1b3744d 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -846,6 +846,26 @@ def test_divmod(self): self.assertRaises(TypeError, divmod, t, 10) + def test_issue31293(self): + # The interpreter shouldn't crash in case a timedelta is divided or + # multiplied by a float with a bad as_integer_ratio() method. + def get_bad_float(bad_ratio): + class BadFloat(float): + def as_integer_ratio(self): + return bad_ratio + return BadFloat() + + with self.assertRaises(TypeError): + timedelta() / get_bad_float(1 << 1000) + with self.assertRaises(TypeError): + timedelta() * get_bad_float(1 << 1000) + + for bad_ratio in [(), (42, ), (1, 2, 3)]: + with self.assertRaises(ValueError): + timedelta() / get_bad_float(bad_ratio) + with self.assertRaises(ValueError): + timedelta() * get_bad_float(bad_ratio) + ############################################################################# # date tests diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst new file mode 100644 index 00000000000..28b7bfb2ef3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-28-17-51-42.bpo-31293.eMYZXj.rst @@ -0,0 +1,2 @@ +Fix crashes in true division and multiplication of a timedelta object by a +float with a bad as_integer_ratio() method. Patch by Oren Milman. diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index c2ad9a203e9..d44bb3e047f 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1647,6 +1647,33 @@ multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) } static PyObject * +get_float_as_integer_ratio(PyObject *floatobj) +{ + PyObject *ratio; + + assert(floatobj && PyFloat_Check(floatobj)); + ratio = _PyObject_CallMethodId(floatobj, &PyId_as_integer_ratio, NULL); + if (ratio == NULL) { + return NULL; + } + if (!PyTuple_Check(ratio)) { + PyErr_Format(PyExc_TypeError, + "unexpected return type from as_integer_ratio(): " + "expected tuple, got '%.200s'", + Py_TYPE(ratio)->tp_name); + Py_DECREF(ratio); + return NULL; + } + if (PyTuple_Size(ratio) != 2) { + PyErr_SetString(PyExc_ValueError, + "as_integer_ratio() must return a 2-tuple"); + Py_DECREF(ratio); + return NULL; + } + return ratio; +} + +static PyObject * multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta) { PyObject *result = NULL; @@ -1656,9 +1683,10 @@ multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta) pyus_in = delta_to_microseconds(delta); if (pyus_in == NULL) return NULL; - ratio = _PyObject_CallMethodId(floatobj, &PyId_as_integer_ratio, NULL); - if (ratio == NULL) + ratio = get_float_as_integer_ratio(floatobj); + if (ratio == NULL) { goto error; + } temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 0)); Py_DECREF(pyus_in); pyus_in = NULL; @@ -1754,9 +1782,10 @@ truedivide_timedelta_float(PyDateTime_Delta *delta, PyObject *f) pyus_in = delta_to_microseconds(delta); if (pyus_in == NULL) return NULL; - ratio = _PyObject_CallMethodId(f, &PyId_as_integer_ratio, NULL); - if (ratio == NULL) + ratio = get_float_as_integer_ratio(f); + if (ratio == NULL) { goto error; + } temp = PyNumber_Multiply(pyus_in, PyTuple_GET_ITEM(ratio, 1)); Py_DECREF(pyus_in); pyus_in = NULL; From webhook-mailer at python.org Tue Sep 19 10:37:29 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 19 Sep 2017 14:37:29 -0000 Subject: [Python-checkins] pythoninfo: ignore OSError(ENOSYS) on getrandom() (#3655) Message-ID: https://github.com/python/cpython/commit/a92941ff12c1d554f42c05ed24621894a758b40f commit: a92941ff12c1d554f42c05ed24621894a758b40f branch: master author: Victor Stinner committer: GitHub date: 2017-09-19T07:37:24-07:00 summary: pythoninfo: ignore OSError(ENOSYS) on getrandom() (#3655) files: M Lib/test/pythoninfo.py diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 15cce34e822..5447ab8274b 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -2,6 +2,7 @@ Collect various informations about Python to help debugging test failures. """ from __future__ import print_function +import errno import re import sys import traceback @@ -223,11 +224,17 @@ def format_attr(attr, value): if hasattr(os, 'getrandom'): # PEP 524: Check if system urandom is initialized try: - os.getrandom(1, os.GRND_NONBLOCK) - state = 'ready (initialized)' - except BlockingIOError as exc: - state = 'not seeded yet (%s)' % exc - info_add('os.getrandom', state) + try: + os.getrandom(1, os.GRND_NONBLOCK) + state = 'ready (initialized)' + except BlockingIOError as exc: + state = 'not seeded yet (%s)' % exc + info_add('os.getrandom', state) + except OSError as exc: + # Python was compiled on a more recent Linux version + # than the current Linux kernel: ignore OSError(ENOSYS) + if exc.errno != errno.ENOSYS: + raise def collect_readline(info_add): From webhook-mailer at python.org Tue Sep 19 11:34:30 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 19 Sep 2017 15:34:30 -0000 Subject: [Python-checkins] [3.6] pythoninfo: ignore OSError(ENOSYS) on getrandom() (GH-3655) (#3657) Message-ID: https://github.com/python/cpython/commit/72c05e31d6127cf41bdce31bfb83fffe8d85bdd7 commit: 72c05e31d6127cf41bdce31bfb83fffe8d85bdd7 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Victor Stinner date: 2017-09-19T08:34:24-07:00 summary: [3.6] pythoninfo: ignore OSError(ENOSYS) on getrandom() (GH-3655) (#3657) (cherry picked from commit a92941ff12c1d554f42c05ed24621894a758b40f) files: M Lib/test/pythoninfo.py diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 15cce34e822..5447ab8274b 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -2,6 +2,7 @@ Collect various informations about Python to help debugging test failures. """ from __future__ import print_function +import errno import re import sys import traceback @@ -223,11 +224,17 @@ def format_attr(attr, value): if hasattr(os, 'getrandom'): # PEP 524: Check if system urandom is initialized try: - os.getrandom(1, os.GRND_NONBLOCK) - state = 'ready (initialized)' - except BlockingIOError as exc: - state = 'not seeded yet (%s)' % exc - info_add('os.getrandom', state) + try: + os.getrandom(1, os.GRND_NONBLOCK) + state = 'ready (initialized)' + except BlockingIOError as exc: + state = 'not seeded yet (%s)' % exc + info_add('os.getrandom', state) + except OSError as exc: + # Python was compiled on a more recent Linux version + # than the current Linux kernel: ignore OSError(ENOSYS) + if exc.errno != errno.ENOSYS: + raise def collect_readline(info_add): From webhook-mailer at python.org Tue Sep 19 12:36:57 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Tue, 19 Sep 2017 16:36:57 -0000 Subject: [Python-checkins] bpo-31479: Always reset the signal alarm in tests (#3588) Message-ID: https://github.com/python/cpython/commit/9abee722d448c1c00c7d4e11ce242ec7b13e5c49 commit: 9abee722d448c1c00c7d4e11ce242ec7b13e5c49 branch: master author: Victor Stinner committer: GitHub date: 2017-09-19T09:36:54-07:00 summary: bpo-31479: Always reset the signal alarm in tests (#3588) * bpo-31479: Always reset the signal alarm in tests Use "try: ... finally: signal.signal(0)" pattern to make sure that tests don't "leak" a pending fatal signal alarm. * Move two more alarm() calls into the try block Fix also typo: replace signal.signal(0) with signal.alarm(0) * Move another signal.alarm() into the try block files: M Lib/test/signalinterproctester.py M Lib/test/test_io.py M Lib/test/test_pty.py M Lib/test/test_selectors.py M Lib/test/test_socket.py M Lib/test/test_threadsignals.py diff --git a/Lib/test/signalinterproctester.py b/Lib/test/signalinterproctester.py index d3ae170983b..877be517c0e 100644 --- a/Lib/test/signalinterproctester.py +++ b/Lib/test/signalinterproctester.py @@ -74,10 +74,13 @@ def test_interprocess_signal(self): # Nothing should happen: SIGUSR2 is ignored child.wait() - signal.alarm(1) - self.wait_signal(None, 'SIGALRM', KeyboardInterrupt) - self.assertEqual(self.got_signals, {'SIGHUP': 1, 'SIGUSR1': 1, - 'SIGALRM': 0}) + try: + signal.alarm(1) + self.wait_signal(None, 'SIGALRM', KeyboardInterrupt) + self.assertEqual(self.got_signals, {'SIGHUP': 1, 'SIGUSR1': 1, + 'SIGALRM': 0}) + finally: + signal.alarm(0) if __name__ == "__main__": diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index d4685dd22e1..ce4ed1b8f6a 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3940,6 +3940,7 @@ def on_alarm(*args): if isinstance(exc, RuntimeError): self.assertTrue(str(exc).startswith("reentrant call"), str(exc)) finally: + signal.alarm(0) wio.close() os.close(r) @@ -3968,6 +3969,7 @@ def alarm_handler(sig, frame): # - third raw read() returns b"bar" self.assertEqual(decode(rio.read(6)), "foobar") finally: + signal.alarm(0) rio.close() os.close(w) os.close(r) @@ -4035,6 +4037,7 @@ def alarm2(sig, frame): self.assertIsNone(error) self.assertEqual(N, sum(len(x) for x in read_results)) finally: + signal.alarm(0) write_finished = True os.close(w) os.close(r) diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index b6e2ed51f61..f283e1930b7 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -51,14 +51,11 @@ class PtyTest(unittest.TestCase): def setUp(self): # isatty() and close() can hang on some platforms. Set an alarm # before running the test to make sure we don't hang forever. - self.old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) + old_alarm = signal.signal(signal.SIGALRM, self.handle_sig) + self.addCleanup(signal.signal, signal.SIGALRM, old_alarm) + self.addCleanup(signal.alarm, 0) signal.alarm(10) - def tearDown(self): - # remove alarm, restore old alarm handler - signal.alarm(0) - signal.signal(signal.SIGALRM, self.old_alarm) - def handle_sig(self, sig, frame): self.fail("isatty hung") diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py index f2594a6b121..79ac25c12d4 100644 --- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -399,17 +399,19 @@ def handler(*args): orig_alrm_handler = signal.signal(signal.SIGALRM, handler) self.addCleanup(signal.signal, signal.SIGALRM, orig_alrm_handler) - self.addCleanup(signal.alarm, 0) - signal.alarm(1) + try: + signal.alarm(1) - s.register(rd, selectors.EVENT_READ) - t = time() - # select() is interrupted by a signal which raises an exception - with self.assertRaises(InterruptSelect): - s.select(30) - # select() was interrupted before the timeout of 30 seconds - self.assertLess(time() - t, 5.0) + s.register(rd, selectors.EVENT_READ) + t = time() + # select() is interrupted by a signal which raises an exception + with self.assertRaises(InterruptSelect): + s.select(30) + # select() was interrupted before the timeout of 30 seconds + self.assertLess(time() - t, 5.0) + finally: + signal.alarm(0) @unittest.skipUnless(hasattr(signal, "alarm"), "signal.alarm() required for this test") @@ -421,17 +423,19 @@ def test_select_interrupt_noraise(self): orig_alrm_handler = signal.signal(signal.SIGALRM, lambda *args: None) self.addCleanup(signal.signal, signal.SIGALRM, orig_alrm_handler) - self.addCleanup(signal.alarm, 0) - signal.alarm(1) + try: + signal.alarm(1) - s.register(rd, selectors.EVENT_READ) - t = time() - # select() is interrupted by a signal, but the signal handler doesn't - # raise an exception, so select() should by retries with a recomputed - # timeout - self.assertFalse(s.select(1.5)) - self.assertGreaterEqual(time() - t, 1.0) + s.register(rd, selectors.EVENT_READ) + t = time() + # select() is interrupted by a signal, but the signal handler doesn't + # raise an exception, so select() should by retries with a recomputed + # timeout + self.assertFalse(s.select(1.5)) + self.assertGreaterEqual(time() - t, 1.0) + finally: + signal.alarm(0) class ScalableSelectorMixIn: diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 01502c805cc..84ec4291335 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -3854,7 +3854,6 @@ def setUp(self): orig_alrm_handler = signal.signal(signal.SIGALRM, lambda signum, frame: 1 / 0) self.addCleanup(signal.signal, signal.SIGALRM, orig_alrm_handler) - self.addCleanup(self.setAlarm, 0) # Timeout for socket operations timeout = 4.0 @@ -3891,9 +3890,12 @@ def setUp(self): def checkInterruptedRecv(self, func, *args, **kwargs): # Check that func(*args, **kwargs) raises # errno of EINTR when interrupted by a signal. - self.setAlarm(self.alarm_time) - with self.assertRaises(ZeroDivisionError) as cm: - func(*args, **kwargs) + try: + self.setAlarm(self.alarm_time) + with self.assertRaises(ZeroDivisionError) as cm: + func(*args, **kwargs) + finally: + self.setAlarm(0) def testInterruptedRecvTimeout(self): self.checkInterruptedRecv(self.serv.recv, 1024) @@ -3948,10 +3950,13 @@ def checkInterruptedSend(self, func, *args, **kwargs): # Check that func(*args, **kwargs), run in a loop, raises # OSError with an errno of EINTR when interrupted by a # signal. - with self.assertRaises(ZeroDivisionError) as cm: - while True: - self.setAlarm(self.alarm_time) - func(*args, **kwargs) + try: + with self.assertRaises(ZeroDivisionError) as cm: + while True: + self.setAlarm(self.alarm_time) + func(*args, **kwargs) + finally: + self.setAlarm(0) # Issue #12958: The following tests have problems on OS X prior to 10.7 @support.requires_mac_ver(10, 7) @@ -4675,8 +4680,8 @@ def alarm_handler(signal, frame): raise Alarm old_alarm = signal.signal(signal.SIGALRM, alarm_handler) try: - signal.alarm(2) # POSIX allows alarm to be up to 1 second early try: + signal.alarm(2) # POSIX allows alarm to be up to 1 second early foo = self.serv.accept() except socket.timeout: self.fail("caught timeout instead of Alarm") diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py index 67a1c581d79..1ad6c63fea2 100644 --- a/Lib/test/test_threadsignals.py +++ b/Lib/test/test_threadsignals.py @@ -56,9 +56,11 @@ def test_signals(self): # wait for it return. if signal_blackboard[signal.SIGUSR1]['tripped'] == 0 \ or signal_blackboard[signal.SIGUSR2]['tripped'] == 0: - signal.alarm(1) - signal.pause() - signal.alarm(0) + try: + signal.alarm(1) + signal.pause() + finally: + signal.alarm(0) self.assertEqual( signal_blackboard[signal.SIGUSR1]['tripped'], 1) self.assertEqual( signal_blackboard[signal.SIGUSR1]['tripped_by'], @@ -98,6 +100,7 @@ def test_lock_acquire_interruption(self): # after timeout return of lock.acquire() (which can fool assertRaises). self.assertLess(dt, 3.0) finally: + signal.alarm(0) signal.signal(signal.SIGALRM, oldalrm) @unittest.skipIf(USING_PTHREAD_COND, @@ -131,6 +134,7 @@ def other_thread(): # See rationale above in test_lock_acquire_interruption self.assertLess(dt, 3.0) finally: + signal.alarm(0) signal.signal(signal.SIGALRM, oldalrm) def acquire_retries_on_intr(self, lock): From webhook-mailer at python.org Tue Sep 19 13:56:39 2017 From: webhook-mailer at python.org (Mariatta) Date: Tue, 19 Sep 2017 17:56:39 -0000 Subject: [Python-checkins] [3.6] bpo-31482: Missing bytes support for random.seed() version 1 (GH-3614) (GH-3659) Message-ID: https://github.com/python/cpython/commit/c6ce8fba07ea6798eac46ab2808167afecd4d90b commit: c6ce8fba07ea6798eac46ab2808167afecd4d90b branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-19T10:56:33-07:00 summary: [3.6] bpo-31482: Missing bytes support for random.seed() version 1 (GH-3614) (GH-3659) (cherry picked from commit 132a7d7cdbc7cb89fa1c1f4e8192241c3d68f549) files: A Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst M Lib/random.py M Lib/test/test_random.py diff --git a/Lib/random.py b/Lib/random.py index ad1c9167b02..0152e5ea12b 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -109,9 +109,10 @@ def seed(self, a=None, version=2): """ if version == 1 and isinstance(a, (str, bytes)): + a = a.decode('latin-1') if isinstance(a, bytes) else a x = ord(a[0]) << 7 if a else 0 - for c in a: - x = ((1000003 * x) ^ ord(c)) & 0xFFFFFFFFFFFFFFFF + for c in map(ord, a): + x = ((1000003 * x) ^ c) & 0xFFFFFFFFFFFFFFFF x ^= len(a) a = -2 if x == -1 else x diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 03adc0a7229..a2d9a961cc8 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -423,6 +423,33 @@ def test_bug_27706(self): ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1', '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2']) + def test_bug_31482(self): + # Verify that version 1 seeds are unaffected by hash randomization + # when the seeds are expressed as bytes rather than strings. + # The hash(b) values listed are the Python2.7 hash() values + # which were used for seeding. + + self.gen.seed(b'nofar', version=1) # hash('nofar') == 5990528763808513177 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.8645314505ad7p-1', '0x1.afb1f82e40a40p-5', + '0x1.2a59d2285e971p-1', '0x1.56977142a7880p-6']) + + self.gen.seed(b'rachel', version=1) # hash('rachel') == -9091735575445484789 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.0b294cc856fcdp-1', '0x1.2ad22d79e77b8p-3', + '0x1.3052b9c072678p-2', '0x1.578f332106574p-3']) + + self.gen.seed(b'', version=1) # hash('') == 0 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.b0580f98a7dbep-1', '0x1.84129978f9c1ap-1', + '0x1.aeaa51052e978p-2', '0x1.092178fb945a6p-2']) + + b = b'\x00\x20\x40\x60\x80\xA0\xC0\xE0\xF0' + self.gen.seed(b, version=1) # hash(b) == 5015594239749365497 + self.assertEqual([self.gen.random().hex() for i in range(4)], + ['0x1.52c2fde444d23p-1', '0x1.875174f0daea4p-2', + '0x1.9e9b2c50e5cd2p-1', '0x1.fa57768bd321cp-2']) + def test_setstate_first_arg(self): self.assertRaises(ValueError, self.gen.setstate, (1, None, None)) diff --git a/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst b/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst new file mode 100644 index 00000000000..ed7a4175cd7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-16-01-53-11.bpo-31482.39s5dS.rst @@ -0,0 +1 @@ +``random.seed()`` now works with bytes in version=1 From webhook-mailer at python.org Tue Sep 19 15:10:54 2017 From: webhook-mailer at python.org (R. David Murray) Date: Tue, 19 Sep 2017 19:10:54 -0000 Subject: [Python-checkins] bpo-31507 Add docstring to parseaddr function in email.utils.parseaddr (gh-3647) Message-ID: https://github.com/python/cpython/commit/9e7b9b21fe45f7d93eaf9382fedfa18247d0d2b2 commit: 9e7b9b21fe45f7d93eaf9382fedfa18247d0d2b2 branch: master author: Rohit Balasubramanian committer: R. David Murray date: 2017-09-19T15:10:49-04:00 summary: bpo-31507 Add docstring to parseaddr function in email.utils.parseaddr (gh-3647) files: M Lib/email/utils.py diff --git a/Lib/email/utils.py b/Lib/email/utils.py index a759d23308d..39c22406078 100644 --- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -215,6 +215,12 @@ def parsedate_to_datetime(data): def parseaddr(addr): + """ + Parse addr into its constituent realname and email address parts. + + Return a tuple of realname and email address, unless the parse fails, in + which case return a 2-tuple of ('', ''). + """ addrs = _AddressList(addr).addresslist if not addrs: return '', '' From webhook-mailer at python.org Tue Sep 19 15:31:31 2017 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 19 Sep 2017 19:31:31 -0000 Subject: [Python-checkins] Fix build issues in Doc/make.bat (#3658) Message-ID: https://github.com/python/cpython/commit/a4bb58fda48b75427661c313607bc84dd12c0354 commit: a4bb58fda48b75427661c313607bc84dd12c0354 branch: master author: Steve Dower committer: GitHub date: 2017-09-19T12:31:28-07:00 summary: Fix build issues in Doc/make.bat (#3658) files: M Doc/make.bat diff --git a/Doc/make.bat b/Doc/make.bat index c43135d75be..6cb315fda40 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -58,7 +58,7 @@ if "%1" EQU "help" goto help if "%1" EQU "check" goto check if "%1" EQU "serve" goto serve if "%1" == "clean" ( - rmdir /q /s %BUILDDIR% + rmdir /q /s "%BUILDDIR%" goto end ) @@ -107,6 +107,8 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build +if not exist "%BUILDDIR%" mkdir "%BUILDDIR%" + if exist ..\Misc\NEWS ( echo.Copying Misc\NEWS to build\NEWS copy ..\Misc\NEWS build\NEWS > nul @@ -123,10 +125,10 @@ if exist ..\Misc\NEWS ( if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) -cmd /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%*" +cmd /S /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . "%BUILDDIR%\%1" %2 %3 %4 %5 %6 %7 %8 %9" if "%1" EQU "htmlhelp" ( - cmd /C "%HTMLHELP%" build\htmlhelp\python%DISTVERSION:.=%.hhp + "%HTMLHELP%" "%BUILDDIR%\htmlhelp\python%DISTVERSION:.=%.hhp" rem hhc.exe seems to always exit with code 1, reset to 0 for less than 2 if not errorlevel 2 cmd /C exit /b 0 ) @@ -146,19 +148,19 @@ if NOT "%2" EQU "" ( ) cmd /C %this% html -if EXIST %BUILDDIR%\html\index.html ( - echo.Opening %BUILDDIR%\html\index.html in the default web browser... - start %BUILDDIR%\html\index.html +if EXIST "%BUILDDIR%\html\index.html" ( + echo.Opening "%BUILDDIR%\html\index.html" in the default web browser... + start "%BUILDDIR%\html\index.html" ) goto end :check -cmd /C %PYTHON% tools\rstlint.py -i tools +cmd /S /C "%PYTHON% tools\rstlint.py -i tools" goto end :serve -cmd /C %PYTHON% ..\Tools\scripts\serve.py %BUILDDIR%\html +cmd /S /C "%PYTHON% ..\Tools\scripts\serve.py "%BUILDDIR%\html"" goto end :end From webhook-mailer at python.org Tue Sep 19 17:40:51 2017 From: webhook-mailer at python.org (Steve Dower) Date: Tue, 19 Sep 2017 21:40:51 -0000 Subject: [Python-checkins] Fix build issues in Doc/make.bat (#3663) Message-ID: https://github.com/python/cpython/commit/aa2bda788d9874c43d70dd4ce3e0f1a24381aa66 commit: aa2bda788d9874c43d70dd4ce3e0f1a24381aa66 branch: 3.6 author: Steve Dower committer: GitHub date: 2017-09-19T14:40:48-07:00 summary: Fix build issues in Doc/make.bat (#3663) files: M Doc/make.bat diff --git a/Doc/make.bat b/Doc/make.bat index 0472a3de82f..6cb315fda40 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -58,7 +58,7 @@ if "%1" EQU "help" goto help if "%1" EQU "check" goto check if "%1" EQU "serve" goto serve if "%1" == "clean" ( - rmdir /q /s %BUILDDIR% + rmdir /q /s "%BUILDDIR%" goto end ) @@ -107,6 +107,8 @@ echo.be passed by setting the SPHINXOPTS environment variable. goto end :build +if not exist "%BUILDDIR%" mkdir "%BUILDDIR%" + if exist ..\Misc\NEWS ( echo.Copying Misc\NEWS to build\NEWS copy ..\Misc\NEWS build\NEWS > nul @@ -123,10 +125,10 @@ if exist ..\Misc\NEWS ( if NOT "%PAPER%" == "" ( set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) -cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%* +cmd /S /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . "%BUILDDIR%\%1" %2 %3 %4 %5 %6 %7 %8 %9" if "%1" EQU "htmlhelp" ( - cmd /C "%HTMLHELP%" build\htmlhelp\python%DISTVERSION:.=%.hhp + "%HTMLHELP%" "%BUILDDIR%\htmlhelp\python%DISTVERSION:.=%.hhp" rem hhc.exe seems to always exit with code 1, reset to 0 for less than 2 if not errorlevel 2 cmd /C exit /b 0 ) @@ -146,19 +148,19 @@ if NOT "%2" EQU "" ( ) cmd /C %this% html -if EXIST %BUILDDIR%\html\index.html ( - echo.Opening %BUILDDIR%\html\index.html in the default web browser... - start %BUILDDIR%\html\index.html +if EXIST "%BUILDDIR%\html\index.html" ( + echo.Opening "%BUILDDIR%\html\index.html" in the default web browser... + start "%BUILDDIR%\html\index.html" ) goto end :check -cmd /C %PYTHON% tools\rstlint.py -i tools +cmd /S /C "%PYTHON% tools\rstlint.py -i tools" goto end :serve -cmd /C %PYTHON% ..\Tools\scripts\serve.py %BUILDDIR%\html +cmd /S /C "%PYTHON% ..\Tools\scripts\serve.py "%BUILDDIR%\html"" goto end :end From webhook-mailer at python.org Tue Sep 19 18:48:34 2017 From: webhook-mailer at python.org (Mariatta) Date: Tue, 19 Sep 2017 22:48:34 -0000 Subject: [Python-checkins] bpo-31501: Operator precedence description for arithmetic operators (GH-3633) (GH-3638) Message-ID: https://github.com/python/cpython/commit/e2593aa673c0347a74c4896a519e3b8cb7b55eb4 commit: e2593aa673c0347a74c4896a519e3b8cb7b55eb4 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-19T15:48:29-07:00 summary: bpo-31501: Operator precedence description for arithmetic operators (GH-3633) (GH-3638) (cherry picked from commit 9b47af65375fab9318e88ccb061394a36c8c6c33) files: M Doc/reference/expressions.rst diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index d92be975aac..ff890a815b5 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1692,8 +1692,8 @@ precedence and have a left-to-right chaining feature as described in the | ``+``, ``-`` | Addition and subtraction | +-----------------------------------------------+-------------------------------------+ | ``*``, ``@``, ``/``, ``//``, ``%`` | Multiplication, matrix | -| | multiplication division, | -| | remainder [#]_ | +| | multiplication, division, floor | +| | division, remainder [#]_ | +-----------------------------------------------+-------------------------------------+ | ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT | +-----------------------------------------------+-------------------------------------+ From webhook-mailer at python.org Tue Sep 19 19:01:49 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 19 Sep 2017 23:01:49 -0000 Subject: [Python-checkins] bpo-31500: Removed fixed size of IDLE config dialog. (#3664) Message-ID: https://github.com/python/cpython/commit/d6e2f26f3f7c62a4ddbf668027d3ba27cb0e1eca commit: d6e2f26f3f7c62a4ddbf668027d3ba27cb0e1eca branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-19T19:01:45-04:00 summary: bpo-31500: Removed fixed size of IDLE config dialog. (#3664) This one line of Serhiy Storchacka's bpo-31500 patch for is needed for other issues. files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 0f530c66a11..a05f3b957af 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -105,7 +105,7 @@ def create_widgets(self): load_configs: Load pages except for extensions. activate_config_changes: Tell editors to reload. """ - self.note = note = Notebook(self, width=450, height=450) + self.note = note = Notebook(self) self.highpage = HighPage(note) self.fontpage = FontPage(note, self.highpage) self.keyspage = KeysPage(note) From webhook-mailer at python.org Tue Sep 19 19:45:06 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Tue, 19 Sep 2017 23:45:06 -0000 Subject: [Python-checkins] [3.6] bpo-31500: Removed fixed size of IDLE config dialog. (GH-3664) (#3665) Message-ID: https://github.com/python/cpython/commit/97be14996b247b853ead77fb255d7029e3cf3dc9 commit: 97be14996b247b853ead77fb255d7029e3cf3dc9 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-19T19:45:00-04:00 summary: [3.6] bpo-31500: Removed fixed size of IDLE config dialog. (GH-3664) (#3665) This one line of Serhiy Storchacka's bpo-31500 patch for is needed for other issues. (cherry picked from commit d6e2f26f3f7c62a4ddbf668027d3ba27cb0e1eca) files: M Lib/idlelib/configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 0f530c66a11..a05f3b957af 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -105,7 +105,7 @@ def create_widgets(self): load_configs: Load pages except for extensions. activate_config_changes: Tell editors to reload. """ - self.note = note = Notebook(self, width=450, height=450) + self.note = note = Notebook(self) self.highpage = HighPage(note) self.fontpage = FontPage(note, self.highpage) self.keyspage = KeysPage(note) From lp_benchmark_robot at intel.com Tue Sep 19 20:38:42 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 19 Sep 2017 17:38:42 -0700 Subject: [Python-checkins] [3 down, 1 up, 61 flat] Results for Python (master branch) 2017-09-19 Message-ID: Results for project python/master, build date: 2017-09-19 03:05:14-07:00. - commit: 453408a - previous commit: 9b47af6 - revision date: 2017-09-19 03:12:46-04:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.194% | +0.336% | +3.695% | +7.927% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 1.185% | -0.106% | +20.244% | +11.287% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 2.061% | -0.992% | +20.634% | +11.535% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.600% | +0.205% | +20.199% | +12.269% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 3.288% | -0.167% | +4.428% | +9.462% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.361% | -1.669% | +8.862% | +12.712% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 2.479% | +0.111% | +6.513% | +11.115% | +-----+------------------------+--------+------------+------------+------------+ | :-( | crypto_pyaes| 0.791% | -2.673% | +0.787% | +9.424% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.536% | -2.086% | +6.898% | +18.682% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 3.945% | -0.802% | +7.855% | +13.882% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.358% | +0.029% | +3.412% | +7.254% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.394% | -1.078% | +5.316% | +6.638% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.943% | +1.587% | +3.441% | +4.979% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.064% | +0.994% | +7.672% | +12.209% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.569% | +0.393% | +6.162% | +10.145% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.929% | -0.038% | +6.927% | +9.741% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.856% | +0.486% | +9.437% | +10.936% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.015% | -0.670% | +7.492% | +9.139% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 1.204% | +0.704% | +4.451% | +8.421% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 3.965% | -2.435% | +0.363% | +10.878% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.762% | -0.418% | +5.883% | +13.372% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.807% | -0.488% | +46.183% | +11.355% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.387% | -0.438% | +7.439% | +13.213% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.468% | -1.010% | +16.444% | +12.746% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 2.108% | +2.310% | +9.412% | +7.504% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.701% | -0.386% | +4.034% | +4.367% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 1.045% | -0.420% | -1.256% | +2.316% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 1.208% | +0.374% | +1.885% | +8.607% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.457% | -3.510% | +0.647% | +13.662% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.096% | -0.449% | +0.993% | +21.835% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.311% | +1.488% | +3.438% | +15.916% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.649% | +1.312% | +7.499% | +15.554% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 3.118% | +0.763% | +11.918% | +8.586% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.232% | -0.026% | +0.128% | +10.430% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.136% | -0.083% | +8.850% | +5.527% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.096% | -0.133% | +0.864% | +5.333% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.148% | +0.730% | +9.720% | +11.787% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.825% | -0.150% | -9.101% | +10.566% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_dna| 0.374% | -3.845% | -1.946% | +8.302% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_effbot| 1.771% | -5.124% | -3.866% | +3.602% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.074% | +3.600% | +11.218% | +4.173% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.406% | +0.084% | +7.570% | +13.911% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 0.719% | +0.710% | +2.200% | +1.404% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.932% | -1.681% | +25.932% | +10.281% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.574% | -0.005% | +5.369% | +5.940% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.616% | +1.300% | +15.604% | +8.024% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.511% | +0.703% | +2.513% | -0.428% | +-----+------------------------+--------+------------+------------+------------+ | :-) | spectral_norm| 2.739% | +5.606% | +4.373% | +2.792% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 1.338% | +0.744% | +5.399% | +6.067% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 2.940% | +0.918% | +4.956% | +3.943% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.325% | -0.900% | +2.505% | +8.594% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 1.857% | +0.206% | +11.958% | +8.278% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.756% | +0.924% | +9.599% | +6.878% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.273% | -1.181% | +10.765% | +9.051% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.185% | +0.325% | +9.612% | +11.571% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 2.648% | +1.178% | +23.935% | +8.573% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.350% | +0.603% | +6.029% | +5.360% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 3.386% | -1.087% | +1.558% | +0.600% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.644% | -2.098% | +6.788% | +19.545% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 1.348% | -2.901% | -0.496% | +18.706% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 3.694% | -0.499% | +7.453% | +5.983% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.231% | -0.063% | +5.932% | +8.526% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.355% | -0.449% | +1.310% | +8.180% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 4.244% | -1.407% | -8.860% | +13.883% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.888% | -0.306% | +6.446% | +9.135% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/3-down-1-up-61-flat-results-for-python-master-branch-2017-09-19 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Tue Sep 19 23:44:36 2017 From: webhook-mailer at python.org (Nick Coghlan) Date: Wed, 20 Sep 2017 03:44:36 -0000 Subject: [Python-checkins] bpo-31506: Improve the error message logic for object.__new__ and object.__init__. (GH-3650) Message-ID: https://github.com/python/cpython/commit/a6c0c0695614177c8b6e1840465375eefcfee586 commit: a6c0c0695614177c8b6e1840465375eefcfee586 branch: master author: Serhiy Storchaka committer: Nick Coghlan date: 2017-09-20T13:44:32+10:00 summary: bpo-31506: Improve the error message logic for object.__new__ and object.__init__. (GH-3650) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst M Objects/typeobject.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst new file mode 100644 index 00000000000..3bafd8332f9 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst @@ -0,0 +1 @@ +Improved the error message logic for object.__new__ and object.__init__. diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 190a8b2aa48..5e0d81f6859 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3543,23 +3543,34 @@ excess_args(PyObject *args, PyObject *kwds) static int object_init(PyObject *self, PyObject *args, PyObject *kwds) { - int err = 0; PyTypeObject *type = Py_TYPE(self); - if (excess_args(args, kwds) && - (type->tp_new == object_new || type->tp_init != object_init)) { - PyErr_SetString(PyExc_TypeError, "object.__init__() takes no parameters"); - err = -1; + if (excess_args(args, kwds)) { + if (type->tp_init != object_init) { + PyErr_SetString(PyExc_TypeError, "object() takes no arguments"); + return -1; + } + if (type->tp_new == object_new) { + PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments", + type->tp_name); + return -1; + } } - return err; + return 0; } static PyObject * object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - if (excess_args(args, kwds) && - (type->tp_init == object_init || type->tp_new != object_new)) { - PyErr_SetString(PyExc_TypeError, "object() takes no parameters"); - return NULL; + if (excess_args(args, kwds)) { + if (type->tp_new != object_new) { + PyErr_SetString(PyExc_TypeError, "object() takes no arguments"); + return NULL; + } + if (type->tp_init == object_init) { + PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments", + type->tp_name); + return NULL; + } } if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) { From solipsis at pitrou.net Wed Sep 20 05:28:19 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 20 Sep 2017 09:28:19 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=3 Message-ID: <20170920092311.114515.22BD9EE3A75273B7@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 1, 0] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogZ85Me3', '--timeout', '7200'] From webhook-mailer at python.org Wed Sep 20 09:54:21 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 20 Sep 2017 13:54:21 -0000 Subject: [Python-checkins] bpo-30486: Make cell_set_contents() symbol private (#3668) Message-ID: https://github.com/python/cpython/commit/0ad05c32cc41d4c21bfd78b9ffead519ead475a2 commit: 0ad05c32cc41d4c21bfd78b9ffead519ead475a2 branch: master author: Victor Stinner committer: GitHub date: 2017-09-20T06:54:13-07:00 summary: bpo-30486: Make cell_set_contents() symbol private (#3668) Don't export the cell_set_contents() symbol in the C API. files: M Objects/cellobject.c diff --git a/Objects/cellobject.c b/Objects/cellobject.c index 8f16f07d7b3..af19229c4b6 100644 --- a/Objects/cellobject.c +++ b/Objects/cellobject.c @@ -142,7 +142,7 @@ cell_get_contents(PyCellObject *op, void *closure) return op->ob_ref; } -int +static int cell_set_contents(PyCellObject *op, PyObject *obj) { Py_XINCREF(obj); From webhook-mailer at python.org Wed Sep 20 10:36:21 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Wed, 20 Sep 2017 14:36:21 -0000 Subject: [Python-checkins] closes bpo-31525: require sqlite3_prepare_v2 (#3666) Message-ID: https://github.com/python/cpython/commit/525269430a3f9fbb7287e4bb6b365ac216004980 commit: 525269430a3f9fbb7287e4bb6b365ac216004980 branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-20T07:36:18-07:00 summary: closes bpo-31525: require sqlite3_prepare_v2 (#3666) This is based on https://github.com/ghaering/pysqlite/commit/40b349cadbd87c42f70fc92e5e1aee6d02564c6d#diff-0489411409cd2934730e88bf7767790, though we can be a bit more aggressive about deleting code. files: A Misc/NEWS.d/next/Library/2017-09-19-18-48-21.bpo-31525.O2TIL2.rst M Modules/_sqlite/connection.c M Modules/_sqlite/cursor.c M Modules/_sqlite/statement.c M Modules/_sqlite/statement.h M Modules/_sqlite/util.c M Modules/_sqlite/util.h diff --git a/Misc/NEWS.d/next/Library/2017-09-19-18-48-21.bpo-31525.O2TIL2.rst b/Misc/NEWS.d/next/Library/2017-09-19-18-48-21.bpo-31525.O2TIL2.rst new file mode 100644 index 00000000000..7f09e57d9d1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-19-18-48-21.bpo-31525.O2TIL2.rst @@ -0,0 +1 @@ +In the sqlite module, require the sqlite3_prepare_v2 API. Thus, the sqlite module now requires sqlite version at least 3.3.9. diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index f596bcf7aca..27591164b82 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -375,7 +375,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self) sqlite3_stmt* statement; Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(self->db, self->begin_statement, -1, &statement, &tail); + rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { @@ -417,7 +417,7 @@ PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args) if (!sqlite3_get_autocommit(self->db)) { Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(self->db, "COMMIT", -1, &statement, &tail); + rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { _pysqlite_seterror(self->db, NULL); @@ -460,7 +460,7 @@ PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args pysqlite_do_all_statements(self, ACTION_RESET, 1); Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(self->db, "ROLLBACK", -1, &statement, &tail); + rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, &tail); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { _pysqlite_seterror(self->db, NULL); diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index ba6e52db568..cfe2627aacd 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -536,47 +536,19 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* goto error; } - /* Keep trying the SQL statement until the schema stops changing. */ - while (1) { - /* Actually execute the SQL statement. */ - rc = pysqlite_step(self->statement->st, self->connection); + rc = pysqlite_step(self->statement->st, self->connection); + if (rc != SQLITE_DONE && rc != SQLITE_ROW) { if (PyErr_Occurred()) { - (void)pysqlite_statement_reset(self->statement); - goto error; - } - if (rc == SQLITE_DONE || rc == SQLITE_ROW) { - /* If it worked, let's get out of the loop */ - break; - } -#if SQLITE_VERSION_NUMBER < 3003009 - /* Something went wrong. Re-set the statement and try again. */ - rc = pysqlite_statement_reset(self->statement); -#endif - if (rc == SQLITE_SCHEMA) { - /* If this was a result of the schema changing, let's try - again. */ - rc = pysqlite_statement_recompile(self->statement, parameters); - if (rc == SQLITE_OK) { - continue; + /* there was an error that occurred in a user-defined callback */ + if (_enable_callback_tracebacks) { + PyErr_Print(); } else { - /* If the database gave us an error, promote it to Python. */ - (void)pysqlite_statement_reset(self->statement); - _pysqlite_seterror(self->connection->db, NULL); - goto error; - } - } else { - if (PyErr_Occurred()) { - /* there was an error that occurred in a user-defined callback */ - if (_enable_callback_tracebacks) { - PyErr_Print(); - } else { - PyErr_Clear(); - } + PyErr_Clear(); } - (void)pysqlite_statement_reset(self->statement); - _pysqlite_seterror(self->connection->db, NULL); - goto error; } + (void)pysqlite_statement_reset(self->statement); + _pysqlite_seterror(self->connection->db, NULL); + goto error; } if (pysqlite_build_row_cast_map(self) != 0) { @@ -584,29 +556,28 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* goto error; } - if (rc == SQLITE_ROW || rc == SQLITE_DONE) { - Py_BEGIN_ALLOW_THREADS - numcols = sqlite3_column_count(self->statement->st); - Py_END_ALLOW_THREADS - if (self->description == Py_None && numcols > 0) { - Py_SETREF(self->description, PyTuple_New(numcols)); - if (!self->description) { + assert(rc == SQLITE_ROW || rc == SQLITE_DONE); + Py_BEGIN_ALLOW_THREADS + numcols = sqlite3_column_count(self->statement->st); + Py_END_ALLOW_THREADS + if (self->description == Py_None && numcols > 0) { + Py_SETREF(self->description, PyTuple_New(numcols)); + if (!self->description) { + goto error; + } + for (i = 0; i < numcols; i++) { + descriptor = PyTuple_New(7); + if (!descriptor) { goto error; } - for (i = 0; i < numcols; i++) { - descriptor = PyTuple_New(7); - if (!descriptor) { - goto error; - } - PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i))); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 4, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 5, Py_None); - Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 6, Py_None); - PyTuple_SetItem(self->description, i, descriptor); - } + PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i))); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 4, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 5, Py_None); + Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 6, Py_None); + PyTuple_SetItem(self->description, i, descriptor); } } @@ -708,11 +679,11 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args) while (1) { Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(self->connection->db, - script_cstr, - -1, - &statement, - &script_cstr); + rc = sqlite3_prepare_v2(self->connection->db, + script_cstr, + -1, + &statement, + &script_cstr); Py_END_ALLOW_THREADS if (rc != SQLITE_OK) { _pysqlite_seterror(self->connection->db, NULL); diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index bc0d9401d0f..38690884227 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -93,11 +93,11 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con } Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(connection->db, - sql_cstr, - -1, - &self->st, - &tail); + rc = sqlite3_prepare_v2(connection->db, + sql_cstr, + -1, + &self->st, + &tail); Py_END_ALLOW_THREADS self->db = connection->db; @@ -319,52 +319,6 @@ void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* para } } -int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params) -{ - const char* tail; - int rc; - const char* sql_cstr; - Py_ssize_t sql_len; - sqlite3_stmt* new_st; - - sql_cstr = PyUnicode_AsUTF8AndSize(self->sql, &sql_len); - if (sql_cstr == NULL) { - rc = PYSQLITE_SQL_WRONG_TYPE; - return rc; - } - - Py_BEGIN_ALLOW_THREADS - rc = SQLITE3_PREPARE(self->db, - sql_cstr, - -1, - &new_st, - &tail); - Py_END_ALLOW_THREADS - - if (rc == SQLITE_OK) { - /* The efficient sqlite3_transfer_bindings is only available in SQLite - * version 3.2.2 or later. For older SQLite releases, that might not - * even define SQLITE_VERSION_NUMBER, we do it the manual way. - */ - #ifdef SQLITE_VERSION_NUMBER - #if SQLITE_VERSION_NUMBER >= 3002002 - /* The check for the number of parameters is necessary to not trigger a - * bug in certain SQLite versions (experienced in 3.2.8 and 3.3.4). */ - if (sqlite3_bind_parameter_count(self->st) > 0) { - (void)sqlite3_transfer_bindings(self->st, new_st); - } - #endif - #else - statement_bind_parameters(self, params); - #endif - - (void)sqlite3_finalize(self->st); - self->st = new_st; - } - - return rc; -} - int pysqlite_statement_finalize(pysqlite_Statement* self) { int rc; diff --git a/Modules/_sqlite/statement.h b/Modules/_sqlite/statement.h index 8db10f6649c..fd88d7d6622 100644 --- a/Modules/_sqlite/statement.h +++ b/Modules/_sqlite/statement.h @@ -50,7 +50,6 @@ void pysqlite_statement_dealloc(pysqlite_Statement* self); int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter); void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters); -int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* parameters); int pysqlite_statement_finalize(pysqlite_Statement* self); int pysqlite_statement_reset(pysqlite_Statement* self); void pysqlite_statement_mark_dirty(pysqlite_Statement* self); diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index b371aed99db..3fa671d052b 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -47,17 +47,7 @@ int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection) */ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st) { - int errorcode; - -#if SQLITE_VERSION_NUMBER < 3003009 - /* SQLite often doesn't report anything useful, unless you reset the statement first. - When using sqlite3_prepare_v2 this is not needed. */ - if (st != NULL) { - (void)sqlite3_reset(st); - } -#endif - - errorcode = sqlite3_errcode(db); + int errorcode = sqlite3_errcode(db); switch (errorcode) { diff --git a/Modules/_sqlite/util.h b/Modules/_sqlite/util.h index 9106fcaf54c..abaefd8b87b 100644 --- a/Modules/_sqlite/util.h +++ b/Modules/_sqlite/util.h @@ -39,12 +39,6 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st); PyObject * _pysqlite_long_from_int64(sqlite_int64 value); sqlite_int64 _pysqlite_long_as_int64(PyObject * value); -#if SQLITE_VERSION_NUMBER >= 3003009 -#define SQLITE3_PREPARE sqlite3_prepare_v2 -#else -#define SQLITE3_PREPARE sqlite3_prepare -#endif - #if SQLITE_VERSION_NUMBER >= 3007014 #define SQLITE3_CLOSE sqlite3_close_v2 #else From webhook-mailer at python.org Wed Sep 20 14:20:21 2017 From: webhook-mailer at python.org (Christian Heimes) Date: Wed, 20 Sep 2017 18:20:21 -0000 Subject: [Python-checkins] bpo-31533: fix broken link to OpenSSL docs (#3674) Message-ID: https://github.com/python/cpython/commit/19e4d9346db7fb65845b98a9cb9caacaaac8a81a commit: 19e4d9346db7fb65845b98a9cb9caacaaac8a81a branch: master author: Felipe committer: Christian Heimes date: 2017-09-20T20:20:18+02:00 summary: bpo-31533: fix broken link to OpenSSL docs (#3674) files: M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 1f3e8d5f781..9b3bdd5489d 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -233,7 +233,7 @@ instead. The *ciphers* parameter sets the available ciphers for this SSL object. It should be a string in the `OpenSSL cipher list format - `_. + `_. The parameter ``do_handshake_on_connect`` specifies whether to do the SSL handshake automatically after doing a :meth:`socket.connect`, or whether the @@ -1465,7 +1465,7 @@ to speed up repeated connections from the same clients. Set the available ciphers for sockets created with this context. It should be a string in the `OpenSSL cipher list format - `_. + `_. If no cipher can be selected (because compile-time options or other configuration forbids use of all the specified ciphers), an :class:`SSLError` will be raised. From webhook-mailer at python.org Wed Sep 20 16:23:01 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 20 Sep 2017 20:23:01 -0000 Subject: [Python-checkins] bpo-31533: fix broken link to OpenSSL docs (GH-3674) (GH-3675) Message-ID: https://github.com/python/cpython/commit/6b44ad1abdb9b3aaf27e2ba1fc4b69b9a0f50c25 commit: 6b44ad1abdb9b3aaf27e2ba1fc4b69b9a0f50c25 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-20T13:22:56-07:00 summary: bpo-31533: fix broken link to OpenSSL docs (GH-3674) (GH-3675) (cherry picked from commit 19e4d9346db7fb65845b98a9cb9caacaaac8a81a) files: M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index d7e0467239b..495cd590f89 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -218,7 +218,7 @@ instead. The *ciphers* parameter sets the available ciphers for this SSL object. It should be a string in the `OpenSSL cipher list format - `_. + `_. The parameter ``do_handshake_on_connect`` specifies whether to do the SSL handshake automatically after doing a :meth:`socket.connect`, or whether the @@ -1445,7 +1445,7 @@ to speed up repeated connections from the same clients. Set the available ciphers for sockets created with this context. It should be a string in the `OpenSSL cipher list format - `_. + `_. If no cipher can be selected (because compile-time options or other configuration forbids use of all the specified ciphers), an :class:`SSLError` will be raised. From webhook-mailer at python.org Wed Sep 20 16:23:12 2017 From: webhook-mailer at python.org (Mariatta) Date: Wed, 20 Sep 2017 20:23:12 -0000 Subject: [Python-checkins] bpo-31533: fix broken link to OpenSSL docs (GH-3674) (GH-3676) Message-ID: https://github.com/python/cpython/commit/5b6452d412b5be45f265093e75563fcf6d05dc3e commit: 5b6452d412b5be45f265093e75563fcf6d05dc3e branch: 2.7 author: Christian Heimes committer: Mariatta date: 2017-09-20T13:23:09-07:00 summary: bpo-31533: fix broken link to OpenSSL docs (GH-3674) (GH-3676) (cherry picked from commit 19e4d93) files: M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 288b2914a25..93df8d70559 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -211,7 +211,7 @@ instead. The *ciphers* parameter sets the available ciphers for this SSL object. It should be a string in the `OpenSSL cipher list format - `_. + `_. The parameter ``do_handshake_on_connect`` specifies whether to do the SSL handshake automatically after doing a :meth:`socket.connect`, or whether the @@ -1167,7 +1167,7 @@ to speed up repeated connections from the same clients. Set the available ciphers for sockets created with this context. It should be a string in the `OpenSSL cipher list format - `_. + `_. If no cipher can be selected (because compile-time options or other configuration forbids use of all the specified ciphers), an :class:`SSLError` will be raised. From webhook-mailer at python.org Wed Sep 20 17:35:30 2017 From: webhook-mailer at python.org (=?utf-8?q?=C3=89ric?= Araujo) Date: Wed, 20 Sep 2017 21:35:30 -0000 Subject: [Python-checkins] bpo-26510: make argparse subparsers required by default (#3027) Message-ID: https://github.com/python/cpython/commit/aaf6fc0982c916cb71d9e0afcd7dda4ba495793b commit: aaf6fc0982c916cb71d9e0afcd7dda4ba495793b branch: master author: Anthony Sottile committer: ?ric Araujo date: 2017-09-20T17:35:27-04:00 summary: bpo-26510: make argparse subparsers required by default (#3027) This fixes a regression from Python 2. To get optional subparsers, use the new parameter ``add_subparsers(required=False)``. Patch by Anthony Sottile. files: A Misc/NEWS.d/next/Library/2017-09-19-13-29-29.bpo-26510.oncW6V.rst M Doc/library/argparse.rst M Lib/argparse.py M Lib/test/test_argparse.py diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index c425be6d481..53e670161dd 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1539,8 +1539,8 @@ Sub-commands .. method:: ArgumentParser.add_subparsers([title], [description], [prog], \ [parser_class], [action], \ - [option_string], [dest], [help], \ - [metavar]) + [option_string], [dest], [required] \ + [help], [metavar]) Many programs split up their functionality into a number of sub-commands, for example, the ``svn`` program can invoke sub-commands like ``svn @@ -1576,6 +1576,9 @@ Sub-commands * dest_ - name of the attribute under which sub-command name will be stored; by default ``None`` and no value is stored + * required_ - Whether or not a subcommand must be provided, by default + ``True``. + * help_ - help for sub-parser group in help output, by default ``None`` * metavar_ - string presenting available sub-commands in help; by default it diff --git a/Lib/argparse.py b/Lib/argparse.py index d59e645203c..98bbed0e508 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1066,6 +1066,7 @@ def __init__(self, prog, parser_class, dest=SUPPRESS, + required=True, help=None, metavar=None): @@ -1079,6 +1080,7 @@ def __init__(self, dest=dest, nargs=PARSER, choices=self._name_parser_map, + required=required, help=help, metavar=metavar) diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index d8bcd7309d2..c4440e4df7c 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1807,7 +1807,7 @@ def _get_parser(self, subparser_help=False, prefix_chars=None, 'bar', type=float, help='bar help') # check that only one subparsers argument can be added - subparsers_kwargs = {} + subparsers_kwargs = {'required': False} if aliases: subparsers_kwargs['metavar'] = 'COMMAND' subparsers_kwargs['title'] = 'commands' @@ -1907,6 +1907,41 @@ def test_dest(self): self.assertEqual(NS(foo=False, bar='1', baz='2'), parser.parse_args('1 2'.split())) + def _test_required_subparsers(self, parser): + # Should parse the sub command + ret = parser.parse_args(['run']) + self.assertEqual(ret.command, 'run') + + # Error when the command is missing + self.assertArgumentParserError(parser.parse_args, ()) + + def test_required_subparsers_via_attribute(self): + parser = ErrorRaisingArgumentParser() + subparsers = parser.add_subparsers(dest='command') + subparsers.required = True + subparsers.add_parser('run') + self._test_required_subparsers(parser) + + def test_required_subparsers_via_kwarg(self): + parser = ErrorRaisingArgumentParser() + subparsers = parser.add_subparsers(dest='command', required=True) + subparsers.add_parser('run') + self._test_required_subparsers(parser) + + def test_required_subparsers_default(self): + parser = ErrorRaisingArgumentParser() + subparsers = parser.add_subparsers(dest='command') + subparsers.add_parser('run') + self._test_required_subparsers(parser) + + def test_optional_subparsers(self): + parser = ErrorRaisingArgumentParser() + subparsers = parser.add_subparsers(dest='command', required=False) + subparsers.add_parser('run') + # No error here + ret = parser.parse_args(()) + self.assertIsNone(ret.command) + def test_help(self): self.assertEqual(self.parser.format_usage(), 'usage: PROG [-h] [--foo] bar {1,2,3} ...\n') diff --git a/Misc/NEWS.d/next/Library/2017-09-19-13-29-29.bpo-26510.oncW6V.rst b/Misc/NEWS.d/next/Library/2017-09-19-13-29-29.bpo-26510.oncW6V.rst new file mode 100644 index 00000000000..26a6b4b0ee8 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-19-13-29-29.bpo-26510.oncW6V.rst @@ -0,0 +1,3 @@ +argparse subparsers are now required by default. This matches behaviour in Python 2. +For optional subparsers, use the new parameter ``add_subparsers(required=False)``. +Patch by Anthony Sottile. From webhook-mailer at python.org Wed Sep 20 17:57:59 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Wed, 20 Sep 2017 21:57:59 -0000 Subject: [Python-checkins] bpo-31536: Avoid wholesale rebuild after `make regen-all` (#3678) Message-ID: https://github.com/python/cpython/commit/b091bec824137f286b22084be5f8d397d21b9abb commit: b091bec824137f286b22084be5f8d397d21b9abb branch: master author: Antoine Pitrou committer: Victor Stinner date: 2017-09-20T14:57:56-07:00 summary: bpo-31536: Avoid wholesale rebuild after `make regen-all` (#3678) * bpo-31536: Avoid wholesale rebuild after `make regen-all` * Add NEWS files: A Misc/NEWS.d/next/Build/2017-09-20-21-32-21.bpo-31536.KUDjno.rst A Tools/scripts/update_file.py M Makefile.pre.in M Parser/asdl_c.py diff --git a/Makefile.pre.in b/Makefile.pre.in index 5a001ecbe73..8f4918dff6e 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -230,6 +230,7 @@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@ +UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ BUILD_GNU_TYPE= @build@ @@ -691,12 +692,14 @@ regen-importlib: Programs/_freeze_importlib # from Lib/importlib/_bootstrap_external.py using _freeze_importlib ./Programs/_freeze_importlib \ $(srcdir)/Lib/importlib/_bootstrap_external.py \ - $(srcdir)/Python/importlib_external.h + $(srcdir)/Python/importlib_external.h.new + $(UPDATE_FILE) $(srcdir)/Python/importlib_external.h $(srcdir)/Python/importlib_external.h.new # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py # using _freeze_importlib ./Programs/_freeze_importlib \ $(srcdir)/Lib/importlib/_bootstrap.py \ - $(srcdir)/Python/importlib.h + $(srcdir)/Python/importlib.h.new + $(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new ############################################################################ @@ -770,8 +773,10 @@ regen-grammar: $(PGEN) # from Grammar/Grammar using pgen @$(MKDIR_P) Include $(PGEN) $(srcdir)/Grammar/Grammar \ - $(srcdir)/Include/graminit.h \ - $(srcdir)/Python/graminit.c + $(srcdir)/Include/graminit.h.new \ + $(srcdir)/Python/graminit.c.new + $(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new + $(UPDATE_FILE) $(srcdir)/Python/graminit.c $(srcdir)/Python/graminit.c.new Parser/grammar.o: $(srcdir)/Parser/grammar.c \ $(srcdir)/Include/token.h \ @@ -789,13 +794,15 @@ regen-ast: # Regenerate Include/Python-ast.h using Parser/asdl_c.py -h $(MKDIR_P) $(srcdir)/Include $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \ - -h $(srcdir)/Include \ + -h $(srcdir)/Include/Python-ast.h.new \ $(srcdir)/Parser/Python.asdl + $(UPDATE_FILE) $(srcdir)/Include/Python-ast.h $(srcdir)/Include/Python-ast.h.new # Regenerate Python/Python-ast.c using Parser/asdl_c.py -c $(MKDIR_P) $(srcdir)/Python $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \ - -c $(srcdir)/Python \ + -c $(srcdir)/Python/Python-ast.c.new \ $(srcdir)/Parser/Python.asdl + $(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new .PHONY: regen-opcode regen-opcode: @@ -803,7 +810,8 @@ regen-opcode: # using Tools/scripts/generate_opcode_h.py $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \ $(srcdir)/Lib/opcode.py \ - $(srcdir)/Include/opcode.h + $(srcdir)/Include/opcode.h.new + $(UPDATE_FILE) $(srcdir)/Include/opcode.h $(srcdir)/Include/opcode.h.new Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h @@ -860,7 +868,8 @@ regen-opcode-targets: # Regenerate Python/opcode_targets.h from Lib/opcode.py # using Python/makeopcodetargets.py $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \ - $(srcdir)/Python/opcode_targets.h + $(srcdir)/Python/opcode_targets.h.new + $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h @@ -887,7 +896,8 @@ regen-typeslots: # using Objects/typeslots.py $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \ < $(srcdir)/Include/typeslots.h \ - $(srcdir)/Objects/typeslots.inc + $(srcdir)/Objects/typeslots.inc.new + $(UPDATE_FILE) $(srcdir)/Objects/typeslots.inc $(srcdir)/Objects/typeslots.inc.new ############################################################################ # Header files diff --git a/Misc/NEWS.d/next/Build/2017-09-20-21-32-21.bpo-31536.KUDjno.rst b/Misc/NEWS.d/next/Build/2017-09-20-21-32-21.bpo-31536.KUDjno.rst new file mode 100644 index 00000000000..414f1a45eab --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-20-21-32-21.bpo-31536.KUDjno.rst @@ -0,0 +1 @@ +Avoid wholesale rebuild after `make regen-all` if nothing changed. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index a43d2e7b834..0286d6652f5 100644 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1285,59 +1285,55 @@ def main(srcfile, dump_module=False): print(mod) if not asdl.check(mod): sys.exit(1) - if INC_DIR: - p = "%s/%s-ast.h" % (INC_DIR, mod.name) - f = open(p, "w") - f.write(auto_gen_msg) - f.write('#include "asdl.h"\n\n') - c = ChainOfVisitors(TypeDefVisitor(f), - StructVisitor(f), - PrototypeVisitor(f), - ) - c.visit(mod) - f.write("PyObject* PyAST_mod2obj(mod_ty t);\n") - f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n") - f.write("int PyAST_Check(PyObject* obj);\n") - f.close() - - if SRC_DIR: - p = os.path.join(SRC_DIR, str(mod.name) + "-ast.c") - f = open(p, "w") - f.write(auto_gen_msg) - f.write('#include \n') - f.write('\n') - f.write('#include "Python.h"\n') - f.write('#include "%s-ast.h"\n' % mod.name) - f.write('\n') - f.write("static PyTypeObject AST_type;\n") - v = ChainOfVisitors( - PyTypesDeclareVisitor(f), - PyTypesVisitor(f), - Obj2ModPrototypeVisitor(f), - FunctionVisitor(f), - ObjVisitor(f), - Obj2ModVisitor(f), - ASTModuleVisitor(f), - PartingShots(f), - ) - v.visit(mod) - f.close() + if H_FILE: + with open(H_FILE, "w") as f: + f.write(auto_gen_msg) + f.write('#include "asdl.h"\n\n') + c = ChainOfVisitors(TypeDefVisitor(f), + StructVisitor(f), + PrototypeVisitor(f), + ) + c.visit(mod) + f.write("PyObject* PyAST_mod2obj(mod_ty t);\n") + f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n") + f.write("int PyAST_Check(PyObject* obj);\n") + + if C_FILE: + with open(C_FILE, "w") as f: + f.write(auto_gen_msg) + f.write('#include \n') + f.write('\n') + f.write('#include "Python.h"\n') + f.write('#include "%s-ast.h"\n' % mod.name) + f.write('\n') + f.write("static PyTypeObject AST_type;\n") + v = ChainOfVisitors( + PyTypesDeclareVisitor(f), + PyTypesVisitor(f), + Obj2ModPrototypeVisitor(f), + FunctionVisitor(f), + ObjVisitor(f), + Obj2ModVisitor(f), + ASTModuleVisitor(f), + PartingShots(f), + ) + v.visit(mod) if __name__ == "__main__": import getopt - INC_DIR = '' - SRC_DIR = '' + H_FILE = '' + C_FILE = '' dump_module = False opts, args = getopt.getopt(sys.argv[1:], "dh:c:") for o, v in opts: if o == '-h': - INC_DIR = v + H_FILE = v if o == '-c': - SRC_DIR = v + C_FILE = v if o == '-d': dump_module = True - if INC_DIR and SRC_DIR: + if H_FILE and C_FILE: print('Must specify exactly one output file') sys.exit(1) elif len(args) != 1: diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py new file mode 100644 index 00000000000..224585c69bb --- /dev/null +++ b/Tools/scripts/update_file.py @@ -0,0 +1,28 @@ +""" +A script that replaces an old file with a new one, only if the contents +actually changed. If not, the new file is simply deleted. + +This avoids wholesale rebuilds when a code (re)generation phase does not +actually change the in-tree generated code. +""" + +import os +import sys + + +def main(old_path, new_path): + with open(old_path, 'rb') as f: + old_contents = f.read() + with open(new_path, 'rb') as f: + new_contents = f.read() + if old_contents != new_contents: + os.replace(new_path, old_path) + else: + os.unlink(new_path) + + +if __name__ == '__main__': + if len(sys.argv) != 3: + print("Usage: %s " % (sys.argv[0],)) + sys.exit(1) + main(sys.argv[1], sys.argv[2]) From lp_benchmark_robot at intel.com Wed Sep 20 19:59:36 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 20 Sep 2017 16:59:36 -0700 Subject: [Python-checkins] [3 down, 2 up, 60 flat] Results for Python (master branch) 2017-09-20 Message-ID: Results for project python/master, build date: 2017-09-20 03:05:18-07:00. - commit: a6c0c06 - previous commit: 453408a - revision date: 2017-09-20 13:44:32+10:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.078% | -0.314% | +3.393% | +8.106% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 1.472% | +0.100% | +20.324% | +8.202% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 2.557% | +0.037% | +20.663% | +8.830% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.929% | -0.134% | +20.091% | +7.087% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.457% | +2.409% | +6.730% | +7.345% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.563% | +1.780% | +10.484% | +11.272% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.928% | +1.380% | +7.803% | +8.903% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.613% | +2.231% | +3.001% | +6.531% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.035% | +2.181% | +8.929% | +17.680% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.787% | +0.506% | +8.321% | +15.103% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.336% | -1.552% | +1.913% | +9.369% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.600% | +1.307% | +6.553% | +3.318% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.750% | -1.028% | +2.449% | +6.135% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.269% | -0.007% | +7.666% | +11.611% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.574% | +0.827% | +6.938% | +9.043% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.847% | -0.443% | +6.515% | +10.250% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.903% | -0.279% | +9.184% | +11.074% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 2.709% | +1.172% | +8.576% | +9.559% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 2.193% | -0.467% | +4.004% | +8.611% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 2.378% | +0.072% | +0.435% | +13.227% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.305% | +0.564% | +6.414% | +10.631% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 3.352% | -0.189% | +46.082% | +10.033% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.405% | -1.526% | +6.027% | +11.775% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.565% | +1.749% | +17.906% | +11.690% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 2.127% | -2.907% | +6.779% | +10.778% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.305% | -0.287% | +3.758% | +5.186% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.348% | +0.560% | -0.689% | +0.544% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.779% | -0.066% | +1.820% | +6.530% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.392% | +1.865% | +2.500% | +12.211% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.318% | -0.181% | +0.814% | +20.921% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_dict| 0.529% | -2.509% | +1.015% | +19.815% | +-----+------------------------+--------+------------+------------+------------+ | :-( | pickle_list| 0.660% | -2.364% | +5.312% | +17.894% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 5.061% | -1.127% | +10.925% | +9.682% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.341% | +0.166% | +0.294% | +10.177% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.145% | +0.320% | +9.142% | +4.837% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.092% | +0.386% | +1.246% | +4.707% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.264% | -0.465% | +9.300% | +12.551% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.594% | +0.056% | -9.041% | +9.304% | +-----+------------------------+--------+------------+------------+------------+ | :-) | regex_dna| 0.714% | +3.733% | +1.859% | +8.016% | +-----+------------------------+--------+------------+------------+------------+ | :-) | regex_effbot| 1.830% | +4.835% | +1.156% | +1.970% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 2.293% | -0.244% | +11.002% | +2.917% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.041% | -1.792% | +5.914% | +15.007% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.286% | -1.594% | +0.640% | -0.028% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.342% | +0.047% | +25.967% | +9.308% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.273% | -0.372% | +5.017% | +5.124% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.658% | -0.580% | +15.115% | +7.414% | +-----+------------------------+--------+------------+------------+------------+ | :-( | scimark_sparse_mat_mult| 1.570% | -3.396% | -0.798% | -1.913% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.347% | +1.184% | +5.505% | +1.173% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.984% | -0.611% | +4.821% | +5.892% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.111% | +0.043% | +4.997% | +4.320% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.718% | -1.226% | +1.310% | +8.496% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.070% | +0.532% | +12.427% | +6.823% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.974% | -0.059% | +9.546% | +6.620% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.998% | +1.085% | +11.732% | +8.200% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.132% | +0.408% | +9.981% | +9.371% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 3.784% | -0.429% | +23.608% | +11.007% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.469% | -0.897% | +5.186% | +7.130% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 1.028% | +0.690% | +2.237% | +2.411% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 9.679% | -1.898% | +5.019% | +23.077% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 2.459% | +2.692% | +2.210% | +17.914% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.554% | +0.767% | +8.163% | +5.442% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 0.968% | +0.887% | +6.767% | +7.272% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 3.068% | +0.996% | +2.294% | +7.671% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 3.496% | +1.644% | -7.070% | +12.874% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.516% | +0.553% | +6.963% | +8.524% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/3-down-2-up-60-flat-results-for-python-master-branch-2017-09-20 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Thu Sep 21 02:08:26 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 21 Sep 2017 06:08:26 -0000 Subject: [Python-checkins] bpo-31532: Fix memory corruption due to allocator mix (#3679) Message-ID: https://github.com/python/cpython/commit/3d1e2ab584ed0175592b5be2a0bc98dc1723776a commit: 3d1e2ab584ed0175592b5be2a0bc98dc1723776a branch: master author: nurelin committer: Benjamin Peterson date: 2017-09-20T23:08:20-07:00 summary: bpo-31532: Fix memory corruption due to allocator mix (#3679) Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812 files: A Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst M Modules/getpath.c diff --git a/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst b/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst new file mode 100644 index 00000000000..7451986846e --- /dev/null +++ b/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst @@ -0,0 +1,2 @@ +Fix memory corruption due to allocator mix in getpath.c between Py_GetPath() +and Py_SetPath() diff --git a/Modules/getpath.c b/Modules/getpath.c index 0f916436c51..dd3387a9d77 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -735,7 +735,7 @@ calculate_path(void) bufsz += wcslen(zip_path) + 1; bufsz += wcslen(exec_prefix) + 1; - buf = PyMem_New(wchar_t, bufsz); + buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t)); if (buf == NULL) { Py_FatalError( "Not enough memory for dynamic PYTHONPATH"); From webhook-mailer at python.org Thu Sep 21 02:47:15 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Thu, 21 Sep 2017 06:47:15 -0000 Subject: [Python-checkins] [3.6] closes bpo-31532: Fix memory corruption due to allocator mix (GH-3679) (#3681) Message-ID: https://github.com/python/cpython/commit/88d0663005d258526496d1f8ee0acb7103c69e80 commit: 88d0663005d258526496d1f8ee0acb7103c69e80 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Benjamin Peterson date: 2017-09-20T23:47:12-07:00 summary: [3.6] closes bpo-31532: Fix memory corruption due to allocator mix (GH-3679) (#3681) Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812 (cherry picked from commit 3d1e2ab584ed0175592b5be2a0bc98dc1723776a) files: A Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst M Modules/getpath.c diff --git a/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst b/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst new file mode 100644 index 00000000000..7451986846e --- /dev/null +++ b/Misc/NEWS.d/next/C API/2017-09-20-21-59-52.bpo-31532.s9Cw9_.rst @@ -0,0 +1,2 @@ +Fix memory corruption due to allocator mix in getpath.c between Py_GetPath() +and Py_SetPath() diff --git a/Modules/getpath.c b/Modules/getpath.c index 0f916436c51..dd3387a9d77 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -735,7 +735,7 @@ calculate_path(void) bufsz += wcslen(zip_path) + 1; bufsz += wcslen(exec_prefix) + 1; - buf = PyMem_New(wchar_t, bufsz); + buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t)); if (buf == NULL) { Py_FatalError( "Not enough memory for dynamic PYTHONPATH"); From webhook-mailer at python.org Thu Sep 21 04:20:13 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 21 Sep 2017 08:20:13 -0000 Subject: [Python-checkins] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (#3639) Message-ID: https://github.com/python/cpython/commit/a96c96f5dab68d4e611af4b8caefd7268533fd9a commit: a96c96f5dab68d4e611af4b8caefd7268533fd9a branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-21T11:20:06+03:00 summary: bpo-31500: IDLE: Scale default fonts on HiDPI displays. (#3639) files: A Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst M Lib/idlelib/filelist.py M Lib/idlelib/pyshell.py M Lib/idlelib/run.py diff --git a/Lib/idlelib/filelist.py b/Lib/idlelib/filelist.py index f46ad7cd7e9..5e1a3dcd77d 100644 --- a/Lib/idlelib/filelist.py +++ b/Lib/idlelib/filelist.py @@ -113,8 +113,10 @@ def canonize(self, filename): def _test(): from idlelib.editor import fixwordbreaks + from idlelib.run import fix_scaling import sys root = Tk() + fix_scaling(root) fixwordbreaks(root) root.withdraw() flist = FileList(root) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 47df74433cf..168eeae9ad8 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -12,6 +12,8 @@ if TkVersion < 8.5: root = Tk() # otherwise create root in main root.withdraw() + from idlelib.run import fix_scaling + fix_scaling(root) tkMessageBox.showerror("Idle Cannot Start", "Idle requires tcl/tk 8.5+, not %s." % TkVersion, parent=root) @@ -1457,6 +1459,8 @@ def main(): NoDefaultRoot() root = Tk(className="Idle") root.withdraw() + from idlelib.run import fix_scaling + fix_scaling(root) # set application icon icondir = os.path.join(os.path.dirname(__file__), 'Icons') diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 9f6604bb0ac..39e0c116f9b 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -184,6 +184,7 @@ def show_socket_error(err, address): import tkinter from tkinter.messagebox import showerror root = tkinter.Tk() + fix_scaling(root) root.withdraw() msg = f"IDLE's subprocess can't connect to {address[0]}:{address[1]}.\n"\ f"Fatal OSError #{err.errno}: {err.strerror}.\n"\ @@ -277,6 +278,18 @@ def exit(): sys.exit(0) +def fix_scaling(root): + """Scale fonts on HiDPI displays.""" + import tkinter.font + scaling = float(root.tk.call('tk', 'scaling')) + if scaling > 1.4: + for name in tkinter.font.names(root): + font = tkinter.font.Font(root=root, name=name, exists=True) + size = int(font['size']) + if size < 0: + font['size'] = round(-0.75*size) + + class MyRPCServer(rpc.RPCServer): def handle_error(self, request, client_address): diff --git a/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst b/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst new file mode 100644 index 00000000000..68d68cb1c86 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst @@ -0,0 +1 @@ +Default fonts now are scaled on HiDPI displays. From solipsis at pitrou.net Thu Sep 21 05:23:05 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 21 Sep 2017 09:23:05 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=10 Message-ID: <20170921092304.76951.C87FFC56872FA8FD@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 8] memory blocks, sum=8 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_logging leaked [0, 27, -27] memory blocks, sum=0 test_multiprocessing_spawn leaked [-1, 1, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/refloghcPa9o', '--timeout', '7200'] From webhook-mailer at python.org Thu Sep 21 06:07:48 2017 From: webhook-mailer at python.org (Nick Coghlan) Date: Thu, 21 Sep 2017 10:07:48 -0000 Subject: [Python-checkins] bpo-31351: Set return code in ensurepip when pip fails (GH-3626) Message-ID: https://github.com/python/cpython/commit/9adda0cdf89432386b7a04444a6199b580d287a1 commit: 9adda0cdf89432386b7a04444a6199b580d287a1 branch: master author: Igor Filatov committer: Nick Coghlan date: 2017-09-21T20:07:45+10:00 summary: bpo-31351: Set return code in ensurepip when pip fails (GH-3626) Previously ensurepip would always report success, even if the pip installation failed. files: A Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst M Doc/library/ensurepip.rst M Lib/ensurepip/__init__.py M Lib/ensurepip/__main__.py M Lib/ensurepip/_uninstall.py M Lib/test/test_ensurepip.py diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst index c797f63326d..ed22180dc3f 100644 --- a/Doc/library/ensurepip.rst +++ b/Doc/library/ensurepip.rst @@ -78,6 +78,9 @@ options: Providing both of the script selection options will trigger an exception. +.. versionchanged:: 3.7.0 + The exit status is non-zero if the command fails. + Module API ---------- diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index 9f5d15109a3..d69e09fab08 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -25,7 +25,7 @@ def _run_pip(args, additional_paths=None): # Install the bundled software import pip - pip.main(args) + return pip.main(args) def version(): @@ -55,6 +55,21 @@ def bootstrap(*, root=None, upgrade=False, user=False, Note that calling this function will alter both sys.path and os.environ. """ + # Discard the return value + _bootstrap(root=root, upgrade=upgrade, user=user, + altinstall=altinstall, default_pip=default_pip, + verbosity=verbosity) + + +def _bootstrap(*, root=None, upgrade=False, user=False, + altinstall=False, default_pip=False, + verbosity=0): + """ + Bootstrap pip into the current Python installation (or the given root + directory). Returns pip command status code. + + Note that calling this function will alter both sys.path and os.environ. + """ if altinstall and default_pip: raise ValueError("Cannot use altinstall and default_pip together") @@ -99,7 +114,7 @@ def bootstrap(*, root=None, upgrade=False, user=False, if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) + return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) def _uninstall_helper(*, verbosity=0): """Helper to support a clean default uninstall process on Windows @@ -126,7 +141,7 @@ def _uninstall_helper(*, verbosity=0): if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) + return _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) def _main(argv=None): @@ -180,7 +195,7 @@ def _main(argv=None): args = parser.parse_args(argv) - bootstrap( + return _bootstrap( root=args.root, upgrade=args.upgrade, user=args.user, diff --git a/Lib/ensurepip/__main__.py b/Lib/ensurepip/__main__.py index 77527d7a351..03eef0dd94d 100644 --- a/Lib/ensurepip/__main__.py +++ b/Lib/ensurepip/__main__.py @@ -1,4 +1,5 @@ import ensurepip +import sys if __name__ == "__main__": - ensurepip._main() + sys.exit(ensurepip._main()) diff --git a/Lib/ensurepip/_uninstall.py b/Lib/ensurepip/_uninstall.py index 750365ec4d0..b257904328d 100644 --- a/Lib/ensurepip/_uninstall.py +++ b/Lib/ensurepip/_uninstall.py @@ -2,6 +2,7 @@ import argparse import ensurepip +import sys def _main(argv=None): @@ -23,8 +24,8 @@ def _main(argv=None): args = parser.parse_args(argv) - ensurepip._uninstall_helper(verbosity=args.verbosity) + return ensurepip._uninstall_helper(verbosity=args.verbosity) if __name__ == "__main__": - _main() + sys.exit(_main()) diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py index 9b04c18b0e2..89966893092 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -20,6 +20,7 @@ class EnsurepipMixin: def setUp(self): run_pip_patch = unittest.mock.patch("ensurepip._run_pip") self.run_pip = run_pip_patch.start() + self.run_pip.return_value = 0 self.addCleanup(run_pip_patch.stop) # Avoid side effects on the actual os module @@ -255,7 +256,7 @@ def test_bootstrap_version(self): self.assertFalse(self.run_pip.called) def test_basic_bootstrapping(self): - ensurepip._main([]) + exit_code = ensurepip._main([]) self.run_pip.assert_called_once_with( [ @@ -267,6 +268,13 @@ def test_basic_bootstrapping(self): additional_paths = self.run_pip.call_args[0][1] self.assertEqual(len(additional_paths), 2) + self.assertEqual(exit_code, 0) + + def test_bootstrapping_error_code(self): + self.run_pip.return_value = 2 + exit_code = ensurepip._main([]) + self.assertEqual(exit_code, 2) + class TestUninstallationMainFunction(EnsurepipMixin, unittest.TestCase): @@ -280,7 +288,7 @@ def test_uninstall_version(self): def test_basic_uninstall(self): with fake_pip(): - ensurepip._uninstall._main([]) + exit_code = ensurepip._uninstall._main([]) self.run_pip.assert_called_once_with( [ @@ -289,6 +297,13 @@ def test_basic_uninstall(self): ] ) + self.assertEqual(exit_code, 0) + + def test_uninstall_error_code(self): + with fake_pip(): + self.run_pip.return_value = 2 + exit_code = ensurepip._uninstall._main([]) + self.assertEqual(exit_code, 2) if __name__ == "__main__": diff --git a/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst new file mode 100644 index 00000000000..20f2c1bdc11 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst @@ -0,0 +1,2 @@ +python -m ensurepip now exits with non-zero exit code if pip bootstrapping +has failed. From webhook-mailer at python.org Thu Sep 21 07:24:17 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 21 Sep 2017 11:24:17 -0000 Subject: [Python-checkins] bpo-27541: Reprs of subclasses of some classes now contain actual type name. (#3631) Message-ID: https://github.com/python/cpython/commit/b3a77964ea89a488fc0e920e3db6d8477279f19b commit: b3a77964ea89a488fc0e920e3db6d8477279f19b branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-21T14:24:13+03:00 summary: bpo-27541: Reprs of subclasses of some classes now contain actual type name. (#3631) Affected classes are bytearray, array, deque, defaultdict, count and repeat. files: A Misc/NEWS.d/next/Library/2017-09-17-19-59-04.bpo-27541.cIMFJW.rst M Lib/test/test_defaultdict.py M Modules/_collectionsmodule.c M Modules/arraymodule.c M Modules/itertoolsmodule.c M Objects/bytearrayobject.c diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py index 72183498acb..b9f1fb9f23d 100644 --- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -157,8 +157,8 @@ def _factory(self): return [] d = sub() self.assertRegex(repr(d), - r"defaultdict\(, \{\}\)") + r"sub\(, \{\}\)") # NOTE: printing a subclass of a builtin type does not call its # tp_print slot. So this part is essentially the same test as above. diff --git a/Misc/NEWS.d/next/Library/2017-09-17-19-59-04.bpo-27541.cIMFJW.rst b/Misc/NEWS.d/next/Library/2017-09-17-19-59-04.bpo-27541.cIMFJW.rst new file mode 100644 index 00000000000..c5c058c3b9b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-17-19-59-04.bpo-27541.cIMFJW.rst @@ -0,0 +1,4 @@ +Reprs of subclasses of some collection and iterator classes (`bytearray`, +`array.array`, `collections.deque`, `collections.defaultdict`, +`itertools.count`, `itertools.repeat`) now contain actual type name insteads +of hardcoded name of the base class. diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 8766d86dd3e..e78399ddefa 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1384,10 +1384,12 @@ deque_repr(PyObject *deque) return NULL; } if (((dequeobject *)deque)->maxlen >= 0) - result = PyUnicode_FromFormat("deque(%R, maxlen=%zd)", - aslist, ((dequeobject *)deque)->maxlen); + result = PyUnicode_FromFormat("%s(%R, maxlen=%zd)", + _PyType_Name(Py_TYPE(deque)), aslist, + ((dequeobject *)deque)->maxlen); else - result = PyUnicode_FromFormat("deque(%R)", aslist); + result = PyUnicode_FromFormat("%s(%R)", + _PyType_Name(Py_TYPE(deque)), aslist); Py_ReprLeave(deque); Py_DECREF(aslist); return result; @@ -2127,7 +2129,8 @@ defdict_repr(defdictobject *dd) Py_DECREF(baserepr); return NULL; } - result = PyUnicode_FromFormat("defaultdict(%U, %U)", + result = PyUnicode_FromFormat("%s(%U, %U)", + _PyType_Name(Py_TYPE(dd)), defrepr, baserepr); Py_DECREF(defrepr); Py_DECREF(baserepr); diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 1d9a4f11d87..4f778a2dea3 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2307,7 +2307,8 @@ array_repr(arrayobject *a) len = Py_SIZE(a); typecode = a->ob_descr->typecode; if (len == 0) { - return PyUnicode_FromFormat("array('%c')", (int)typecode); + return PyUnicode_FromFormat("%s('%c')", + _PyType_Name(Py_TYPE(a)), (int)typecode); } if (typecode == 'u') { v = array_array_tounicode_impl(a); @@ -2317,7 +2318,8 @@ array_repr(arrayobject *a) if (v == NULL) return NULL; - s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v); + s = PyUnicode_FromFormat("%s('%c', %R)", + _PyType_Name(Py_TYPE(a)), (int)typecode, v); Py_DECREF(v); return s; } diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 0e5cbbd18dd..48e6c35db4f 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4067,7 +4067,8 @@ static PyObject * count_repr(countobject *lz) { if (lz->cnt != PY_SSIZE_T_MAX) - return PyUnicode_FromFormat("count(%zd)", lz->cnt); + return PyUnicode_FromFormat("%s(%zd)", + _PyType_Name(Py_TYPE(lz)), lz->cnt); if (PyLong_Check(lz->long_step)) { long step = PyLong_AsLong(lz->long_step); @@ -4076,11 +4077,14 @@ count_repr(countobject *lz) } if (step == 1) { /* Don't display step when it is an integer equal to 1 */ - return PyUnicode_FromFormat("count(%R)", lz->long_cnt); + return PyUnicode_FromFormat("%s(%R)", + _PyType_Name(Py_TYPE(lz)), + lz->long_cnt); } } - return PyUnicode_FromFormat("count(%R, %R)", - lz->long_cnt, lz->long_step); + return PyUnicode_FromFormat("%s(%R, %R)", + _PyType_Name(Py_TYPE(lz)), + lz->long_cnt, lz->long_step); } static PyObject * @@ -4220,9 +4224,12 @@ static PyObject * repeat_repr(repeatobject *ro) { if (ro->cnt == -1) - return PyUnicode_FromFormat("repeat(%R)", ro->element); + return PyUnicode_FromFormat("%s(%R)", + _PyType_Name(Py_TYPE(ro)), ro->element); else - return PyUnicode_FromFormat("repeat(%R, %zd)", ro->element, ro->cnt); + return PyUnicode_FromFormat("%s(%R, %zd)", + _PyType_Name(Py_TYPE(ro)), ro->element, + ro->cnt); } static PyObject * diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index d09b1f22b44..840d5b0f9ba 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -891,11 +891,12 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) static PyObject * bytearray_repr(PyByteArrayObject *self) { - const char *quote_prefix = "bytearray(b"; + const char *className = _PyType_Name(Py_TYPE(self)); + const char *quote_prefix = "(b"; const char *quote_postfix = ")"; Py_ssize_t length = Py_SIZE(self); - /* 15 == strlen(quote_prefix) + 2 + strlen(quote_postfix) + 1 */ - size_t newsize; + /* 6 == strlen(quote_prefix) + 2 + strlen(quote_postfix) + 1 */ + Py_ssize_t newsize; PyObject *v; Py_ssize_t i; char *bytes; @@ -905,13 +906,14 @@ bytearray_repr(PyByteArrayObject *self) char *test, *start; char *buffer; - if (length > (PY_SSIZE_T_MAX - 15) / 4) { + newsize = strlen(className); + if (length > (PY_SSIZE_T_MAX - 6 - newsize) / 4) { PyErr_SetString(PyExc_OverflowError, "bytearray object is too large to make repr"); return NULL; } - newsize = 15 + length * 4; + newsize += 6 + length * 4; buffer = PyObject_Malloc(newsize); if (buffer == NULL) { PyErr_NoMemory(); @@ -931,6 +933,8 @@ bytearray_repr(PyByteArrayObject *self) } p = buffer; + while (*className) + *p++ = *className++; while (*quote_prefix) *p++ = *quote_prefix++; *p++ = quote; @@ -966,7 +970,7 @@ bytearray_repr(PyByteArrayObject *self) *p++ = *quote_postfix++; } - v = PyUnicode_DecodeASCII(buffer, p - buffer, NULL); + v = PyUnicode_FromStringAndSize(buffer, p - buffer); PyObject_Free(buffer); return v; } From webhook-mailer at python.org Thu Sep 21 07:25:39 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Thu, 21 Sep 2017 11:25:39 -0000 Subject: [Python-checkins] bpo-31410: Optimized calling wrapper and classmethod descriptors. (#3481) Message-ID: https://github.com/python/cpython/commit/5e02c7826f9797fb3add79b608ef51f7a62b3e5a commit: 5e02c7826f9797fb3add79b608ef51f7a62b3e5a branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-21T14:25:36+03:00 summary: bpo-31410: Optimized calling wrapper and classmethod descriptors. (#3481) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst M Objects/descrobject.c diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst new file mode 100644 index 00000000000..e3a660f14fa --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst @@ -0,0 +1 @@ +Optimized calling wrapper and classmethod descriptors. diff --git a/Objects/descrobject.c b/Objects/descrobject.c index edead26a7d5..5dc27ef6727 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -296,7 +296,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) { Py_ssize_t argc; - PyObject *self, *func, *result, **stack; + PyObject *self, *result; /* Make sure that the first argument is acceptable as 'self' */ assert(PyTuple_Check(args)); @@ -330,20 +330,38 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, return NULL; } - func = PyCFunction_NewEx(descr->d_method, self, NULL); - if (func == NULL) - return NULL; - stack = &PyTuple_GET_ITEM(args, 1); - result = _PyObject_FastCallDict(func, stack, argc - 1, kwds); - Py_DECREF(func); + result = _PyMethodDef_RawFastCallDict(descr->d_method, self, + &PyTuple_GET_ITEM(args, 1), argc - 1, + kwds); + result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL); return result; } +Py_LOCAL_INLINE(PyObject *) +wrapperdescr_raw_call(PyWrapperDescrObject *descr, PyObject *self, + PyObject *args, PyObject *kwds) +{ + wrapperfunc wrapper = descr->d_base->wrapper; + + if (descr->d_base->flags & PyWrapperFlag_KEYWORDS) { + wrapperfunc_kwds wk = (wrapperfunc_kwds)wrapper; + return (*wk)(self, args, descr->d_wrapped, kwds); + } + + if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_GET_SIZE(kwds) != 0)) { + PyErr_Format(PyExc_TypeError, + "wrapper %s() takes no keyword arguments", + descr->d_base->name); + return NULL; + } + return (*wrapper)(self, args, descr->d_wrapped); +} + static PyObject * wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) { Py_ssize_t argc; - PyObject *self, *func, *result, **stack; + PyObject *self, *result; /* Make sure that the first argument is acceptable as 'self' */ assert(PyTuple_Check(args)); @@ -369,16 +387,16 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) return NULL; } - func = PyWrapper_New((PyObject *)descr, self); - if (func == NULL) + args = PyTuple_GetSlice(args, 1, argc); + if (args == NULL) { return NULL; - - stack = &PyTuple_GET_ITEM(args, 1); - result = _PyObject_FastCallDict(func, stack, argc - 1, kwds); - Py_DECREF(func); + } + result = wrapperdescr_raw_call(descr, self, args, kwds); + Py_DECREF(args); return result; } + static PyObject * method_get_doc(PyMethodDescrObject *descr, void *closure) { @@ -1167,21 +1185,7 @@ static PyGetSetDef wrapper_getsets[] = { static PyObject * wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds) { - wrapperfunc wrapper = wp->descr->d_base->wrapper; - PyObject *self = wp->self; - - if (wp->descr->d_base->flags & PyWrapperFlag_KEYWORDS) { - wrapperfunc_kwds wk = (wrapperfunc_kwds)wrapper; - return (*wk)(self, args, wp->descr->d_wrapped, kwds); - } - - if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_GET_SIZE(kwds) != 0)) { - PyErr_Format(PyExc_TypeError, - "wrapper %s() takes no keyword arguments", - wp->descr->d_base->name); - return NULL; - } - return (*wrapper)(self, args, wp->descr->d_wrapped); + return wrapperdescr_raw_call(wp->descr, wp->self, args, kwds); } static int From webhook-mailer at python.org Thu Sep 21 11:15:50 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Thu, 21 Sep 2017 15:15:50 -0000 Subject: [Python-checkins] [3.6] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (#3686) Message-ID: https://github.com/python/cpython/commit/0c4997f1919d8583353b12537a63dcbe7b9d280f commit: 0c4997f1919d8583353b12537a63dcbe7b9d280f branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-09-21T11:15:45-04:00 summary: [3.6] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (#3686) (cherry picked from commit a96c96f) files: A Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst M Lib/idlelib/filelist.py M Lib/idlelib/pyshell.py M Lib/idlelib/run.py diff --git a/Lib/idlelib/filelist.py b/Lib/idlelib/filelist.py index f46ad7cd7e9..5e1a3dcd77d 100644 --- a/Lib/idlelib/filelist.py +++ b/Lib/idlelib/filelist.py @@ -113,8 +113,10 @@ def canonize(self, filename): def _test(): from idlelib.editor import fixwordbreaks + from idlelib.run import fix_scaling import sys root = Tk() + fix_scaling(root) fixwordbreaks(root) root.withdraw() flist = FileList(root) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 47df74433cf..168eeae9ad8 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -12,6 +12,8 @@ if TkVersion < 8.5: root = Tk() # otherwise create root in main root.withdraw() + from idlelib.run import fix_scaling + fix_scaling(root) tkMessageBox.showerror("Idle Cannot Start", "Idle requires tcl/tk 8.5+, not %s." % TkVersion, parent=root) @@ -1457,6 +1459,8 @@ def main(): NoDefaultRoot() root = Tk(className="Idle") root.withdraw() + from idlelib.run import fix_scaling + fix_scaling(root) # set application icon icondir = os.path.join(os.path.dirname(__file__), 'Icons') diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 9f6604bb0ac..39e0c116f9b 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -184,6 +184,7 @@ def show_socket_error(err, address): import tkinter from tkinter.messagebox import showerror root = tkinter.Tk() + fix_scaling(root) root.withdraw() msg = f"IDLE's subprocess can't connect to {address[0]}:{address[1]}.\n"\ f"Fatal OSError #{err.errno}: {err.strerror}.\n"\ @@ -277,6 +278,18 @@ def exit(): sys.exit(0) +def fix_scaling(root): + """Scale fonts on HiDPI displays.""" + import tkinter.font + scaling = float(root.tk.call('tk', 'scaling')) + if scaling > 1.4: + for name in tkinter.font.names(root): + font = tkinter.font.Font(root=root, name=name, exists=True) + size = int(font['size']) + if size < 0: + font['size'] = round(-0.75*size) + + class MyRPCServer(rpc.RPCServer): def handle_error(self, request, client_address): diff --git a/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst b/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst new file mode 100644 index 00000000000..68d68cb1c86 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-18-10-43-03.bpo-31500.Y_YDxA.rst @@ -0,0 +1 @@ +Default fonts now are scaled on HiDPI displays. From tjreedy at udel.edu Thu Sep 21 11:38:19 2017 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 21 Sep 2017 11:38:19 -0400 Subject: [Python-checkins] [3.6] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (#3686) In-Reply-To: <3xygDG4svgzGnCf@mail.python.org> References: <3xygDG4svgzGnCf@mail.python.org> Message-ID: <06be07c8-9cf8-15e8-ed84-ef966118b5e5@udel.edu> On 9/21/2017 11:15 AM, Terry Jan Reedy wrote: > https://github.com/python/cpython/commit/0c4997f1919d8583353b12537a63dcbe7b9d280f > commit: 0c4997f1919d8583353b12537a63dcbe7b9d280f > branch: 3.6 > author: Terry Jan Reedy > committer: GitHub This is mixed up. Serhiy Stochaka is the author of the patch and 3.7 committer. When the Islington bot silently failed, I ran cherry_picker and hit the merge button to synch up 3.6. So I am the committer of the backport. > date: 2017-09-21T11:15:45-04:00 > summary: > > [3.6] bpo-31500: IDLE: Scale default fonts on HiDPI displays. (GH-3639) (#3686) From lp_benchmark_robot at intel.com Thu Sep 21 20:24:50 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 21 Sep 2017 17:24:50 -0700 Subject: [Python-checkins] [2 down, 2 up, 61 flat] Results for Python (master branch) 2017-09-21 Message-ID: <9746bc50-51a2-4cab-85fc-b42a98f2f487@orsmsx151.amr.corp.intel.com> Results for project python/master, build date: 2017-09-21 03:02:52-07:00. - commit: a96c96f - previous commit: a6c0c06 - revision date: 2017-09-21 11:20:06+03:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.064% | +0.024% | +3.416% | +9.239% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 1.268% | -2.538% | +18.302% | +13.521% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 1.482% | -1.177% | +19.729% | +13.172% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_unknown| 0.481% | -1.899% | +18.574% | +10.456% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.170% | +0.514% | +7.210% | +10.717% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.699% | +1.096% | +11.465% | +9.709% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 0.820% | -0.470% | +7.370% | +10.755% | +-----+------------------------+--------+------------+------------+------------+ | :-( | crypto_pyaes| 0.579% | -2.331% | +0.739% | +8.844% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.728% | -3.366% | +5.864% | +18.422% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 4.610% | +1.649% | +9.833% | +14.332% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.102% | +1.046% | +2.939% | +7.091% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.354% | -0.309% | +6.264% | +4.482% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 1.077% | +1.273% | +3.691% | +5.542% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.650% | +0.663% | +8.278% | +11.997% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.681% | +1.044% | +7.909% | +8.984% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 0.919% | +0.186% | +6.689% | +10.457% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.391% | +0.309% | +9.464% | +10.140% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.373% | -1.732% | +6.993% | +11.635% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 0.968% | +1.393% | +5.342% | +7.607% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 3.895% | +2.221% | +2.647% | +9.717% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.588% | +1.290% | +7.622% | +12.256% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.614% | +0.213% | +46.197% | +10.118% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.246% | +2.423% | +8.304% | +14.335% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.522% | -0.015% | +17.894% | +12.029% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.439% | +1.682% | +8.347% | +8.708% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.146% | +0.094% | +3.848% | +5.237% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.886% | +0.005% | -0.684% | +0.349% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 1.732% | +0.575% | +2.385% | +7.616% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.218% | +1.645% | +4.105% | +11.540% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.087% | +1.132% | +1.937% | +20.301% | +-----+------------------------+--------+------------+------------+------------+ | :-) | pickle_dict| 0.624% | +3.493% | +4.473% | +20.201% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 1.259% | +1.721% | +6.942% | +19.152% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 5.086% | +1.139% | +11.939% | +8.948% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.290% | +0.037% | +0.331% | +9.978% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.115% | +0.481% | +9.579% | +4.792% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.097% | +0.347% | +1.589% | +4.679% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.607% | -0.547% | +8.804% | +12.336% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 5.265% | +0.807% | -8.161% | +11.598% | +-----+------------------------+--------+------------+------------+------------+ | :-( | regex_dna| 0.938% | -4.024% | -2.090% | +12.694% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.830% | -3.014% | -1.823% | +5.861% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 0.762% | -3.306% | +8.060% | +6.202% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.484% | +1.539% | +7.362% | +15.291% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.481% | +0.351% | +0.989% | +2.590% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.970% | +0.403% | +26.266% | +8.594% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.315% | +0.622% | +5.608% | +2.904% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.483% | -0.030% | +15.090% | +7.148% | +-----+------------------------+--------+------------+------------+------------+ | :-) | scimark_sparse_mat_mult| 1.713% | +5.431% | +4.676% | -7.362% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.429% | -0.680% | +4.862% | +2.567% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.956% | +0.595% | +5.387% | +8.205% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.689% | -0.530% | +4.493% | +6.316% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 3.398% | +1.169% | +2.463% | +7.445% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.104% | +0.164% | +12.571% | +8.139% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 1.997% | +0.094% | +9.631% | +7.272% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 4.452% | -1.151% | +10.717% | +10.436% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.417% | +1.023% | +10.902% | +11.952% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 6.805% | -0.705% | +23.070% | +10.819% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.008% | +1.652% | +6.753% | +6.403% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 5.375% | -0.748% | +1.506% | -0.477% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle|10.256% | +1.634% | +6.572% | +21.107% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.584% | +0.251% | +2.456% | +15.643% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 4.564% | -0.876% | +7.358% | +6.984% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.051% | +0.136% | +6.893% | +7.560% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.501% | -1.414% | +0.912% | +7.020% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 1.791% | +2.222% | -4.691% | +11.604% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.197% | +1.098% | +7.985% | +7.877% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/2-down-2-up-61-flat-results-for-python-master-branch-2017-09-21 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From solipsis at pitrou.net Fri Sep 22 05:23:33 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 22 Sep 2017 09:23:33 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170922092328.105346.DCADF6EF077455A7@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogfOgNsT', '--timeout', '7200'] From webhook-mailer at python.org Fri Sep 22 09:45:41 2017 From: webhook-mailer at python.org (Mariatta) Date: Fri, 22 Sep 2017 13:45:41 -0000 Subject: [Python-checkins] bpo-31351: Set return code in ensurepip when pip fails (GH-3626) (GH-3683) Message-ID: https://github.com/python/cpython/commit/eef49f5dd021d15396551880cf451042a79a1107 commit: eef49f5dd021d15396551880cf451042a79a1107 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-22T06:45:37-07:00 summary: bpo-31351: Set return code in ensurepip when pip fails (GH-3626) (GH-3683) Previously ensurepip would always report success, even if the pip installation failed. (cherry picked from commit 9adda0cdf89432386b7a04444a6199b580d287a1) * Update version changed notice for backport files: A Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst M Doc/library/ensurepip.rst M Lib/ensurepip/__init__.py M Lib/ensurepip/__main__.py M Lib/ensurepip/_uninstall.py M Lib/test/test_ensurepip.py diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst index c797f63326d..652339e57f3 100644 --- a/Doc/library/ensurepip.rst +++ b/Doc/library/ensurepip.rst @@ -78,6 +78,9 @@ options: Providing both of the script selection options will trigger an exception. +.. versionchanged:: 3.6.3 + The exit status is non-zero if the command fails. + Module API ---------- diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index 9f5d15109a3..d69e09fab08 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -25,7 +25,7 @@ def _run_pip(args, additional_paths=None): # Install the bundled software import pip - pip.main(args) + return pip.main(args) def version(): @@ -55,6 +55,21 @@ def bootstrap(*, root=None, upgrade=False, user=False, Note that calling this function will alter both sys.path and os.environ. """ + # Discard the return value + _bootstrap(root=root, upgrade=upgrade, user=user, + altinstall=altinstall, default_pip=default_pip, + verbosity=verbosity) + + +def _bootstrap(*, root=None, upgrade=False, user=False, + altinstall=False, default_pip=False, + verbosity=0): + """ + Bootstrap pip into the current Python installation (or the given root + directory). Returns pip command status code. + + Note that calling this function will alter both sys.path and os.environ. + """ if altinstall and default_pip: raise ValueError("Cannot use altinstall and default_pip together") @@ -99,7 +114,7 @@ def bootstrap(*, root=None, upgrade=False, user=False, if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) + return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) def _uninstall_helper(*, verbosity=0): """Helper to support a clean default uninstall process on Windows @@ -126,7 +141,7 @@ def _uninstall_helper(*, verbosity=0): if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) + return _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) def _main(argv=None): @@ -180,7 +195,7 @@ def _main(argv=None): args = parser.parse_args(argv) - bootstrap( + return _bootstrap( root=args.root, upgrade=args.upgrade, user=args.user, diff --git a/Lib/ensurepip/__main__.py b/Lib/ensurepip/__main__.py index 77527d7a351..03eef0dd94d 100644 --- a/Lib/ensurepip/__main__.py +++ b/Lib/ensurepip/__main__.py @@ -1,4 +1,5 @@ import ensurepip +import sys if __name__ == "__main__": - ensurepip._main() + sys.exit(ensurepip._main()) diff --git a/Lib/ensurepip/_uninstall.py b/Lib/ensurepip/_uninstall.py index 750365ec4d0..b257904328d 100644 --- a/Lib/ensurepip/_uninstall.py +++ b/Lib/ensurepip/_uninstall.py @@ -2,6 +2,7 @@ import argparse import ensurepip +import sys def _main(argv=None): @@ -23,8 +24,8 @@ def _main(argv=None): args = parser.parse_args(argv) - ensurepip._uninstall_helper(verbosity=args.verbosity) + return ensurepip._uninstall_helper(verbosity=args.verbosity) if __name__ == "__main__": - _main() + sys.exit(_main()) diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py index 9b04c18b0e2..89966893092 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -20,6 +20,7 @@ class EnsurepipMixin: def setUp(self): run_pip_patch = unittest.mock.patch("ensurepip._run_pip") self.run_pip = run_pip_patch.start() + self.run_pip.return_value = 0 self.addCleanup(run_pip_patch.stop) # Avoid side effects on the actual os module @@ -255,7 +256,7 @@ def test_bootstrap_version(self): self.assertFalse(self.run_pip.called) def test_basic_bootstrapping(self): - ensurepip._main([]) + exit_code = ensurepip._main([]) self.run_pip.assert_called_once_with( [ @@ -267,6 +268,13 @@ def test_basic_bootstrapping(self): additional_paths = self.run_pip.call_args[0][1] self.assertEqual(len(additional_paths), 2) + self.assertEqual(exit_code, 0) + + def test_bootstrapping_error_code(self): + self.run_pip.return_value = 2 + exit_code = ensurepip._main([]) + self.assertEqual(exit_code, 2) + class TestUninstallationMainFunction(EnsurepipMixin, unittest.TestCase): @@ -280,7 +288,7 @@ def test_uninstall_version(self): def test_basic_uninstall(self): with fake_pip(): - ensurepip._uninstall._main([]) + exit_code = ensurepip._uninstall._main([]) self.run_pip.assert_called_once_with( [ @@ -289,6 +297,13 @@ def test_basic_uninstall(self): ] ) + self.assertEqual(exit_code, 0) + + def test_uninstall_error_code(self): + with fake_pip(): + self.run_pip.return_value = 2 + exit_code = ensurepip._uninstall._main([]) + self.assertEqual(exit_code, 2) if __name__ == "__main__": diff --git a/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst new file mode 100644 index 00000000000..20f2c1bdc11 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst @@ -0,0 +1,2 @@ +python -m ensurepip now exits with non-zero exit code if pip bootstrapping +has failed. From webhook-mailer at python.org Fri Sep 22 11:45:01 2017 From: webhook-mailer at python.org (Stefan Krah) Date: Fri, 22 Sep 2017 15:45:01 -0000 Subject: [Python-checkins] bpo-31443: Formulate the type slot initialization rules in terms of C99. (#3688) Message-ID: https://github.com/python/cpython/commit/ca72589bfabe2fd0e12eebfeb770b6c7a499b3e6 commit: ca72589bfabe2fd0e12eebfeb770b6c7a499b3e6 branch: master author: Stefan Krah committer: GitHub date: 2017-09-22T17:44:58+02:00 summary: bpo-31443: Formulate the type slot initialization rules in terms of C99. (#3688) files: M Doc/extending/newtypes.rst M Modules/xxmodule.c diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index f0e8985c615..0e36ba0aec0 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -177,16 +177,9 @@ the module. We'll expand this example later to have more interesting behavior. For now, all we want to be able to do is to create new :class:`Noddy` objects. To enable object creation, we have to provide a :c:member:`~PyTypeObject.tp_new` implementation. In this case, we can just use the default implementation provided by the API -function :c:func:`PyType_GenericNew`. We'd like to just assign this to the -:c:member:`~PyTypeObject.tp_new` slot, but we can't, for portability sake, On some platforms or -compilers, we can't statically initialize a structure member with a function -defined in another C module, so, instead, we'll assign the :c:member:`~PyTypeObject.tp_new` slot -in the module initialization function just before calling -:c:func:`PyType_Ready`:: - - noddy_NoddyType.tp_new = PyType_GenericNew; - if (PyType_Ready(&noddy_NoddyType) < 0) - return; +function :c:func:`PyType_GenericNew`. :: + + PyType_GenericNew, /* tp_new */ All the other type methods are *NULL*, so we'll go over them later --- that's for a later section! diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 076440703f5..c0564ea9674 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -308,7 +308,7 @@ static PyTypeObject Null_Type = { 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ - 0, /* see PyInit_xx */ /*tp_new*/ + PyType_GenericNew, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ }; @@ -338,11 +338,19 @@ PyDoc_STRVAR(module_doc, static int xx_exec(PyObject *m) { - /* Due to cross platform compiler issues the slots must be filled - * here. It's required for portability to Windows without requiring - * C++. */ + /* Slot initialization is subject to the rules of initializing globals. + C99 requires the initializers to be "address constants". Function + designators like 'PyType_GenericNew', with implicit conversion to + a pointer, are valid C99 address constants. + + However, the unary '&' operator applied to a non-static variable + like 'PyBaseObject_Type' is not required to produce an address + constant. Compilers may support this (gcc does), MSVC does not. + + Both compilers are strictly standard conforming in this particular + behavior. + */ Null_Type.tp_base = &PyBaseObject_Type; - Null_Type.tp_new = PyType_GenericNew; Str_Type.tp_base = &PyUnicode_Type; /* Finalize the type object including setting type of the new type From webhook-mailer at python.org Fri Sep 22 12:14:16 2017 From: webhook-mailer at python.org (Stefan Krah) Date: Fri, 22 Sep 2017 16:14:16 -0000 Subject: [Python-checkins] bpo-31443: Update included code. (#3697) Message-ID: https://github.com/python/cpython/commit/b1558a0368949714f5765702a8d83a2d163eaacf commit: b1558a0368949714f5765702a8d83a2d163eaacf branch: master author: Stefan Krah committer: GitHub date: 2017-09-22T18:14:13+02:00 summary: bpo-31443: Update included code. (#3697) files: M Doc/includes/noddy.c diff --git a/Doc/includes/noddy.c b/Doc/includes/noddy.c index 19a27a89e88..07b5d5a9b83 100644 --- a/Doc/includes/noddy.c +++ b/Doc/includes/noddy.c @@ -27,6 +27,23 @@ static PyTypeObject noddy_NoddyType = { 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Noddy objects", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; static PyModuleDef noddymodule = { @@ -42,7 +59,6 @@ PyInit_noddy(void) { PyObject* m; - noddy_NoddyType.tp_new = PyType_GenericNew; if (PyType_Ready(&noddy_NoddyType) < 0) return NULL; From webhook-mailer at python.org Fri Sep 22 12:29:45 2017 From: webhook-mailer at python.org (Barry Warsaw) Date: Fri, 22 Sep 2017 16:29:45 -0000 Subject: [Python-checkins] bpo-31389 Add an optional `header` argument to pdb.set_trace() (#3438) Message-ID: https://github.com/python/cpython/commit/35425d638c0eeb8377620e016f47df3ae08d7061 commit: 35425d638c0eeb8377620e016f47df3ae08d7061 branch: master author: Barry Warsaw committer: GitHub date: 2017-09-22T12:29:42-04:00 summary: bpo-31389 Add an optional `header` argument to pdb.set_trace() (#3438) * Give pdb.set_trace() an optional `header` argument * What's new. * Give pdb.set_trace() an optional `header` argument * What's new. files: A Misc/NEWS.d/next/Library/2017-09-07-15-31-47.bpo-31389.jNFYqB.rst M Doc/library/pdb.rst M Doc/whatsnew/3.7.rst M Lib/pdb.py M Lib/test/test_pdb.py diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 6225a3a1f07..c5d4181c35d 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -118,11 +118,15 @@ slightly different way: is entered. -.. function:: set_trace() +.. function:: set_trace(*, header=None) - Enter the debugger at the calling stack frame. This is useful to hard-code a - breakpoint at a given point in a program, even if the code is not otherwise - being debugged (e.g. when an assertion fails). + Enter the debugger at the calling stack frame. This is useful to hard-code + a breakpoint at a given point in a program, even if the code is not + otherwise being debugged (e.g. when an assertion fails). If given, + ``header`` is printed to the console just before debugging begins. + + .. versionadded:: 3.7 + The keyword-only argument ``header``. .. function:: post_mortem(traceback=None) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 870ca066923..a19a2895828 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -232,6 +232,13 @@ New function :func:`os.register_at_fork` allows registering Python callbacks to be executed on a process fork. (Contributed by Antoine Pitrou in :issue:`16500`.) +pdb +--- + +:func:`~pdb.set_trace` now takes an optional ``header`` keyword-only +argument. If given, this is printed to the console just before debugging +begins. + string ------ diff --git a/Lib/pdb.py b/Lib/pdb.py index 97618b0ff16..8dd4dedb220 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -1581,8 +1581,11 @@ def runctx(statement, globals, locals): def runcall(*args, **kwds): return Pdb().runcall(*args, **kwds) -def set_trace(): - Pdb().set_trace(sys._getframe().f_back) +def set_trace(*, header=None): + pdb = Pdb() + if header is not None: + pdb.message(header) + pdb.set_trace(sys._getframe().f_back) # Post-Mortem interface diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 755d265d5c8..71d8203fc56 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -9,9 +9,12 @@ import subprocess import textwrap +from contextlib import ExitStack +from io import StringIO from test import support # This little helper class is essential for testing pdb under doctest. from test.test_doctest import _FakeInput +from unittest.mock import patch class PdbTestInput(object): @@ -1107,6 +1110,15 @@ def test_readrc_kwarg(self): if save_home is not None: os.environ['HOME'] = save_home + def test_header(self): + stdout = StringIO() + header = 'Nobody expects... blah, blah, blah' + with ExitStack() as resources: + resources.enter_context(patch('sys.stdout', stdout)) + resources.enter_context(patch.object(pdb.Pdb, 'set_trace')) + pdb.set_trace(header=header) + self.assertEqual(stdout.getvalue(), header + '\n') + def tearDown(self): support.unlink(support.TESTFN) diff --git a/Misc/NEWS.d/next/Library/2017-09-07-15-31-47.bpo-31389.jNFYqB.rst b/Misc/NEWS.d/next/Library/2017-09-07-15-31-47.bpo-31389.jNFYqB.rst new file mode 100644 index 00000000000..7f459680967 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-07-15-31-47.bpo-31389.jNFYqB.rst @@ -0,0 +1,2 @@ +``pdb.set_trace()`` now takes an optional keyword-only argument ``header``. +If given, this is printed to the console just before debugging begins. From webhook-mailer at python.org Fri Sep 22 13:17:00 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Fri, 22 Sep 2017 17:17:00 -0000 Subject: [Python-checkins] bpo-31423: Fix building the PDF documentation (GH-3693) Message-ID: https://github.com/python/cpython/commit/da9b4cfb488119f2493a762fcb1d85c58494f51d commit: da9b4cfb488119f2493a762fcb1d85c58494f51d branch: master author: Fran?ois Magimel committer: Zachary Ware date: 2017-09-22T12:16:57-05:00 summary: bpo-31423: Fix building the PDF documentation (GH-3693) Use prefixed macro names for the `authoraddress` function, add T2A to the font encoding in LaTeX sources to support Cyrillic characters in the PDF documentation, and replace the deprecated `font_size` config option with `pointsize`. files: M Doc/conf.py diff --git a/Doc/conf.py b/Doc/conf.py index c1c2472a196..c4ae16a2054 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -90,13 +90,17 @@ # ------------------------ # Get LaTeX to handle Unicode correctly -latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} +latex_elements = { + 'inputenc': r'\usepackage[utf8x]{inputenc}', + 'utf8extra': '', + 'fontenc': r'\usepackage[T1,T2A]{fontenc}', +} # Additional stuff for the LaTeX preamble. latex_elements['preamble'] = r''' \authoraddress{ - \strong{Python Software Foundation}\\ - Email: \email{docs at python.org} + \sphinxstrong{Python Software Foundation}\\ + Email: \sphinxemail{docs at python.org} } \let\Verbatim=\OriginalVerbatim \let\endVerbatim=\endOriginalVerbatim @@ -106,7 +110,7 @@ latex_elements['papersize'] = 'a4' # The font size ('10pt', '11pt' or '12pt'). -latex_elements['font_size'] = '10pt' +latex_elements['pointsize'] = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). From webhook-mailer at python.org Fri Sep 22 13:17:33 2017 From: webhook-mailer at python.org (Neil Schemenauer) Date: Fri, 22 Sep 2017 17:17:33 -0000 Subject: [Python-checkins] bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#3372) Message-ID: https://github.com/python/cpython/commit/0a1ff24acfc15d8c7f2dc41000a6f3d9a31e7480 commit: 0a1ff24acfc15d8c7f2dc41000a6f3d9a31e7480 branch: master author: Neil Schemenauer committer: GitHub date: 2017-09-22T10:17:30-07:00 summary: bpo-17852: Maintain a list of BufferedWriter objects. Flush them on exit. (#3372) * Maintain a list of BufferedWriter objects. Flush them on exit. In Python 3, the buffer and the underlying file object are separate and so the order in which objects are finalized matters. This is unlike Python 2 where the file and buffer were a single object and finalization was done for both at the same time. In Python 3, if the file is finalized and closed before the buffer then the data in the buffer is lost. This change adds a doubly linked list of open file buffers. An atexit hook ensures they are flushed before proceeding with interpreter shutdown. This is addition does not remove the need to properly close files as there are other reasons why buffered data could get lost during finalization. Initial patch by Armin Rigo. * Use weakref.WeakSet instead of WeakKeyDictionary. * Simplify buffered double-linked list types. * In _flush_all_writers(), suppress errors from flush(). * Remove NEWS entry, use blurb. * Take more care when flushing file buffers from atexit. The previous implementation was not careful enough to avoid causing issues in multi-threaded cases. Check for buf->ok and buf->finalizing before actually doing the flush. Also, increase the refcnt to ensure the object does not disappear. files: A Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst M Lib/_pyio.py M Modules/_io/_iomodule.c M Modules/_io/_iomodule.h M Modules/_io/bufferedio.c diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 1e105f27734..6833883dadb 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1182,6 +1182,7 @@ def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): self.buffer_size = buffer_size self._write_buf = bytearray() self._write_lock = Lock() + _register_writer(self) def writable(self): return self.raw.writable() @@ -2571,3 +2572,26 @@ def encoding(self): def detach(self): # This doesn't make sense on StringIO. self._unsupported("detach") + + +# ____________________________________________________________ + +import atexit, weakref + +_all_writers = weakref.WeakSet() + +def _register_writer(w): + # keep weak-ref to buffered writer + _all_writers.add(w) + +def _flush_all_writers(): + # Ensure all buffered writers are flushed before proceeding with + # normal shutdown. Otherwise, if the underlying file objects get + # finalized before the buffered writer wrapping it then any buffered + # data will be lost. + for w in _all_writers: + try: + w.flush() + except: + pass +atexit.register(_flush_all_writers) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst new file mode 100644 index 00000000000..185664c747d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-04-12-46-25.bpo-17852.OxAtCg.rst @@ -0,0 +1,2 @@ +Maintain a list of open buffered files, flush them before exiting the +interpreter. Based on a patch from Armin Rigo. diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index f0621f4d4ab..5db44f970d2 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -766,6 +766,8 @@ PyInit__io(void) !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; + _Py_PyAtExit(_PyIO_atexit_flush); + state->initialized = 1; return m; diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h index db8403774ea..1dce5dada4e 100644 --- a/Modules/_io/_iomodule.h +++ b/Modules/_io/_iomodule.h @@ -183,3 +183,5 @@ extern PyObject *_PyIO_empty_str; extern PyObject *_PyIO_empty_bytes; extern PyTypeObject _PyBytesIOBuffer_Type; + +extern void _PyIO_atexit_flush(void); diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index b2b9ade2c7c..edc4ba5a537 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -197,7 +197,7 @@ bufferediobase_write(PyObject *self, PyObject *args) } -typedef struct { +typedef struct _buffered { PyObject_HEAD PyObject *raw; @@ -239,8 +239,18 @@ typedef struct { PyObject *dict; PyObject *weakreflist; + + /* a doubly-linked chained list of "buffered" objects that need to + be flushed when the process exits */ + struct _buffered *next, *prev; } buffered; +/* the actual list of buffered objects */ +static buffered buffer_list_end = { + .next = &buffer_list_end, + .prev = &buffer_list_end +}; + /* Implementation notes: @@ -379,9 +389,20 @@ _enter_buffered_busy(buffered *self) static void +remove_from_linked_list(buffered *self) +{ + self->next->prev = self->prev; + self->prev->next = self->next; + self->prev = NULL; + self->next = NULL; +} + +static void buffered_dealloc(buffered *self) { self->finalizing = 1; + if (self->next != NULL) + remove_from_linked_list(self); if (_PyIOBase_finalize((PyObject *) self) < 0) return; _PyObject_GC_UNTRACK(self); @@ -1805,10 +1826,38 @@ _io_BufferedWriter___init___impl(buffered *self, PyObject *raw, self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && Py_TYPE(raw) == &PyFileIO_Type); + if (self->next == NULL) { + self->prev = &buffer_list_end; + self->next = buffer_list_end.next; + buffer_list_end.next->prev = self; + buffer_list_end.next = self; + } + self->ok = 1; return 0; } +/* +* Ensure all buffered writers are flushed before proceeding with +* normal shutdown. Otherwise, if the underlying file objects get +* finalized before the buffered writer wrapping it then any buffered +* data will be lost. +*/ +void _PyIO_atexit_flush(void) +{ + while (buffer_list_end.next != &buffer_list_end) { + buffered *buf = buffer_list_end.next; + remove_from_linked_list(buf); + if (buf->ok && !buf->finalizing) { + /* good state and not finalizing */ + Py_INCREF(buf); + buffered_flush(buf, NULL); + Py_DECREF(buf); + PyErr_Clear(); + } + } +} + static Py_ssize_t _bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) { From webhook-mailer at python.org Fri Sep 22 14:26:22 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Fri, 22 Sep 2017 18:26:22 -0000 Subject: [Python-checkins] [3.6] bpo-31423: Fix building the PDF documentation (GH-3693) (GH-3699) Message-ID: https://github.com/python/cpython/commit/6de35849cb7a18bfaad828eb57a2e6caa7978690 commit: 6de35849cb7a18bfaad828eb57a2e6caa7978690 branch: 3.6 author: Zachary Ware committer: GitHub date: 2017-09-22T13:26:19-05:00 summary: [3.6] bpo-31423: Fix building the PDF documentation (GH-3693) (GH-3699) Use prefixed macro names for the `authoraddress` function, add T2A to the font encoding in LaTeX sources to support Cyrillic characters in the PDF documentation, and replace the deprecated `font_size` config option with `pointsize`. (cherry picked from commit da9b4cfb488119f2493a762fcb1d85c58494f51d) files: M Doc/conf.py diff --git a/Doc/conf.py b/Doc/conf.py index 18aebb68a8d..d4ee50de7db 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -89,13 +89,17 @@ # ------------------------ # Get LaTeX to handle Unicode correctly -latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} +latex_elements = { + 'inputenc': r'\usepackage[utf8x]{inputenc}', + 'utf8extra': '', + 'fontenc': r'\usepackage[T1,T2A]{fontenc}', +} # Additional stuff for the LaTeX preamble. latex_elements['preamble'] = r''' \authoraddress{ - \strong{Python Software Foundation}\\ - Email: \email{docs at python.org} + \sphinxstrong{Python Software Foundation}\\ + Email: \sphinxemail{docs at python.org} } \let\Verbatim=\OriginalVerbatim \let\endVerbatim=\endOriginalVerbatim @@ -105,7 +109,7 @@ latex_elements['papersize'] = 'a4' # The font size ('10pt', '11pt' or '12pt'). -latex_elements['font_size'] = '10pt' +latex_elements['pointsize'] = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). From webhook-mailer at python.org Fri Sep 22 14:41:12 2017 From: webhook-mailer at python.org (Zachary Ware) Date: Fri, 22 Sep 2017 18:41:12 -0000 Subject: [Python-checkins] [2.7] bpo-31423: Fix building the PDF documentation (GH-3693) (GH-3700) Message-ID: https://github.com/python/cpython/commit/da86874a3d8f882d6aedd882b2e27f59b59d6798 commit: da86874a3d8f882d6aedd882b2e27f59b59d6798 branch: 2.7 author: Zachary Ware committer: GitHub date: 2017-09-22T13:41:10-05:00 summary: [2.7] bpo-31423: Fix building the PDF documentation (GH-3693) (GH-3700) Use prefixed macro names for the `authoraddress` function, add T2A to the font encoding in LaTeX sources to support Cyrillic characters in the PDF documentation, and replace the deprecated `font_size` config option with `pointsize`. (cherry picked from commit da9b4cfb488119f2493a762fcb1d85c58494f51d) files: M Doc/conf.py diff --git a/Doc/conf.py b/Doc/conf.py index 14bb6419d32..557fe1e72f2 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -83,13 +83,17 @@ # ------------------------ # Get LaTeX to handle Unicode correctly -latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} +latex_elements = { + 'inputenc': r'\usepackage[utf8x]{inputenc}', + 'utf8extra': '', + 'fontenc': r'\usepackage[T1,T2A]{fontenc}', +} # Additional stuff for the LaTeX preamble. latex_elements['preamble'] = r''' \authoraddress{ - \strong{Python Software Foundation}\\ - Email: \email{docs at python.org} + \sphinxstrong{Python Software Foundation}\\ + Email: \sphinxemail{docs at python.org} } \let\Verbatim=\OriginalVerbatim \let\endVerbatim=\endOriginalVerbatim @@ -99,7 +103,7 @@ latex_elements['papersize'] = 'a4' # The font size ('10pt', '11pt' or '12pt'). -latex_elements['font_size'] = '10pt' +latex_elements['pointsize'] = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). From webhook-mailer at python.org Fri Sep 22 16:08:46 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 22 Sep 2017 20:08:46 -0000 Subject: [Python-checkins] bpo-1612262: IDLE: Class Browser shows nested functions, classes (#2573) Message-ID: https://github.com/python/cpython/commit/058de11360ea6816a6e978c7be0bcbea99a3f7da commit: 058de11360ea6816a6e978c7be0bcbea99a3f7da branch: master author: Cheryl Sabella committer: Terry Jan Reedy date: 2017-09-22T16:08:44-04:00 summary: bpo-1612262: IDLE: Class Browser shows nested functions, classes (#2573) Original patches for code and tests by Guilherme Polo and Cheryl Sabella, respectively. files: A Lib/idlelib/idle_test/test_browser.py A Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst M Lib/idlelib/browser.py M Lib/idlelib/pathbrowser.py diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index 4cf4744fb0a..1fc04d873a8 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -19,14 +19,49 @@ from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas from idlelib.windows import ListedToplevel + file_open = None # Method...Item and Class...Item use this. # Normally pyshell.flist.open, but there is no pyshell.flist for htest. + +def transform_children(child_dict, modname=None): + """Transform a child dictionary to an ordered sequence of objects. + + The dictionary maps names to pyclbr information objects. + Filter out imported objects. + Augment class names with bases. + Sort objects by line number. + + The current tree only calls this once per child_dic as it saves + TreeItems once created. A future tree and tests might violate this, + so a check prevents multiple in-place augmentations. + """ + obs = [] # Use list since values should already be sorted. + for key, obj in child_dict.items(): + if modname is None or obj.module == modname: + if hasattr(obj, 'super') and obj.super and obj.name == key: + # If obj.name != key, it has already been suffixed. + supers = [] + for sup in obj.super: + if type(sup) is type(''): + sname = sup + else: + sname = sup.name + if sup.module != obj.module: + sname = f'{sup.module}.{sname}' + supers.append(sname) + obj.name += '({})'.format(', '.join(supers)) + obs.append(obj) + return sorted(obs, key=lambda o: o.lineno) + + class ClassBrowser: """Browse module classes and functions in IDLE. """ + # This class is the base class for pathbrowser.PathBrowser. + # Init and close are inherited, other methods are overriden. - def __init__(self, flist, name, path, _htest=False): + def __init__(self, flist, name, path, _htest=False, _utest=False): # XXX This API should change, if the file doesn't end in ".py" # XXX the code here is bogus! """Create a window for browsing a module's structure. @@ -47,11 +82,12 @@ def __init__(self, flist, name, path, _htest=False): the tree and subsequently in the children. """ global file_open - if not _htest: + if not (_htest or _utest): file_open = pyshell.flist.open self.name = name self.file = os.path.join(path[0], self.name + ".py") self._htest = _htest + self._utest = _utest self.init(flist) def close(self, event=None): @@ -80,8 +116,9 @@ def init(self, flist): sc.frame.pack(expand=1, fill="both") item = self.rootnode() self.node = node = TreeNode(sc.canvas, None, item) - node.update() - node.expand() + if not self._utest: + node.update() + node.expand() def settitle(self): "Set the window title." @@ -92,6 +129,7 @@ def rootnode(self): "Return a ModuleBrowserTreeItem as the root of the tree." return ModuleBrowserTreeItem(self.file) + class ModuleBrowserTreeItem(TreeItem): """Browser tree for Python module. @@ -115,16 +153,8 @@ def GetIconName(self): return "python" def GetSubList(self): - """Return the list of ClassBrowserTreeItem items. - - Each item returned from listclasses is the first level of - classes/functions within the module. - """ - sublist = [] - for name in self.listclasses(): - item = ClassBrowserTreeItem(name, self.classes, self.file) - sublist.append(item) - return sublist + "Return ChildBrowserTreeItems for children." + return [ChildBrowserTreeItem(obj) for obj in self.listchildren()] def OnDoubleClick(self): "Open a module in an editor window when double clicked." @@ -132,89 +162,44 @@ def OnDoubleClick(self): return if not os.path.exists(self.file): return - pyshell.flist.open(self.file) + file_open(self.file) def IsExpandable(self): "Return True if Python (.py) file." return os.path.normcase(self.file[-3:]) == ".py" - def listclasses(self): - """Return list of classes and functions in the module. - - The dictionary output from pyclbr is re-written as a - list of tuples in the form (lineno, name) and - then sorted so that the classes and functions are - processed in line number order. The returned list only - contains the name and not the line number. An instance - variable self.classes contains the pyclbr dictionary values, - which are instances of Class and Function. - """ + def listchildren(self): + "Return sequenced classes and functions in the module." dir, file = os.path.split(self.file) name, ext = os.path.splitext(file) if os.path.normcase(ext) != ".py": return [] try: - dict = pyclbr.readmodule_ex(name, [dir] + sys.path) + tree = pyclbr.readmodule_ex(name, [dir] + sys.path) except ImportError: return [] - items = [] - self.classes = {} - for key, cl in dict.items(): - if cl.module == name: - s = key - if hasattr(cl, 'super') and cl.super: - supers = [] - for sup in cl.super: - if type(sup) is type(''): - sname = sup - else: - sname = sup.name - if sup.module != cl.module: - sname = "%s.%s" % (sup.module, sname) - supers.append(sname) - s = s + "(%s)" % ", ".join(supers) - items.append((cl.lineno, s)) - self.classes[s] = cl - items.sort() - list = [] - for item, s in items: - list.append(s) - return list - -class ClassBrowserTreeItem(TreeItem): - """Browser tree for classes within a module. + return transform_children(tree, name) - Uses TreeItem as the basis for the structure of the tree. - """ - def __init__(self, name, classes, file): - """Create a TreeItem for the class/function. +class ChildBrowserTreeItem(TreeItem): + """Browser tree for child nodes within the module. - Args: - name: Name of the class/function. - classes: Dictonary of Class/Function instances from pyclbr. - file: Full path and module name. + Uses TreeItem as the basis for the structure of the tree. + """ - Instance variables: - self.cl: Class/Function instance for the class/function name. - self.isfunction: True if self.cl is a Function. - """ - self.name = name - # XXX - Does classes need to be an instance variable? - self.classes = classes - self.file = file - try: - self.cl = self.classes[self.name] - except (IndexError, KeyError): - self.cl = None - self.isfunction = isinstance(self.cl, pyclbr.Function) + def __init__(self, obj): + "Create a TreeItem for a pyclbr class/function object." + self.obj = obj + self.name = obj.name + self.isfunction = isinstance(obj, pyclbr.Function) def GetText(self): "Return the name of the function/class to display." + name = self.name if self.isfunction: - return "def " + self.name + "(...)" + return "def " + name + "(...)" else: - return "class " + self.name + return "class " + name def GetIconName(self): "Return the name of the icon to display." @@ -224,95 +209,34 @@ def GetIconName(self): return "folder" def IsExpandable(self): - "Return True if this class has methods." - if self.cl: - try: - return not not self.cl.methods - except AttributeError: - return False - return None + "Return True if self.obj has nested objects." + return self.obj.children != {} def GetSubList(self): - """Return Class methods as a list of MethodBrowserTreeItem items. - - Each item is a method within the class. - """ - if not self.cl: - return [] - sublist = [] - for name in self.listmethods(): - item = MethodBrowserTreeItem(name, self.cl, self.file) - sublist.append(item) - return sublist + "Return ChildBrowserTreeItems for children." + return [ChildBrowserTreeItem(obj) + for obj in transform_children(self.obj.children)] def OnDoubleClick(self): - "Open module with file_open and position to lineno, if it exists." - if not os.path.exists(self.file): - return - edit = file_open(self.file) - if hasattr(self.cl, 'lineno'): - lineno = self.cl.lineno - edit.gotoline(lineno) - - def listmethods(self): - "Return list of methods within a class sorted by lineno." - if not self.cl: - return [] - items = [] - for name, lineno in self.cl.methods.items(): - items.append((lineno, name)) - items.sort() - list = [] - for item, name in items: - list.append(name) - return list - -class MethodBrowserTreeItem(TreeItem): - """Browser tree for methods within a class. - - Uses TreeItem as the basis for the structure of the tree. - """ - - def __init__(self, name, cl, file): - """Create a TreeItem for the methods. - - Args: - name: Name of the class/function. - cl: pyclbr.Class instance for name. - file: Full path and module name. - """ - self.name = name - self.cl = cl - self.file = file - - def GetText(self): - "Return the method name to display." - return "def " + self.name + "(...)" - - def GetIconName(self): - "Return the name of the icon to display." - return "python" - - def IsExpandable(self): - "Return False as there are no tree items after methods." - return False + "Open module with file_open and position to lineno." + try: + edit = file_open(self.obj.file) + edit.gotoline(self.obj.lineno) + except (OSError, AttributeError): + pass - def OnDoubleClick(self): - "Open module with file_open and position at the method start." - if not os.path.exists(self.file): - return - edit = file_open(self.file) - edit.gotoline(self.cl.methods[self.name]) def _class_browser(parent): # htest # try: + file = sys.argv[1] # If pass file on command line + # If this succeeds, unittest will fail. + except IndexError: file = __file__ - except NameError: - file = sys.argv[0] - if sys.argv[1:]: - file = sys.argv[1] - else: - file = sys.argv[0] + # Add objects for htest + class Nested_in_func(TreeNode): + def nested_in_class(): pass + def closure(): + class Nested_in_closure: pass dir, file = os.path.split(file) name = os.path.splitext(file)[0] flist = pyshell.PyShellFileList(parent) @@ -321,5 +245,7 @@ def _class_browser(parent): # htest # ClassBrowser(flist, name, [dir], _htest=True) if __name__ == "__main__": + from unittest import main + main('idlelib.idle_test.test_browser', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_class_browser) diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py new file mode 100644 index 00000000000..025e2902d8f --- /dev/null +++ b/Lib/idlelib/idle_test/test_browser.py @@ -0,0 +1,242 @@ +""" Test idlelib.browser. + +Coverage: 88% +(Higher, because should exclude 3 lines that .coveragerc won't exclude.) +""" + +import os.path +import unittest +import pyclbr + +from idlelib import browser, filelist +from idlelib.tree import TreeNode +from test.support import requires +from unittest import mock +from tkinter import Tk +from idlelib.idle_test.mock_idle import Func +from collections import deque + + +class ClassBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.flist = filelist.FileList(cls.root) + cls.file = __file__ + cls.path = os.path.dirname(cls.file) + cls.module = os.path.basename(cls.file).rstrip('.py') + cls.cb = browser.ClassBrowser(cls.flist, cls.module, [cls.path], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.cb.close() + cls.root.destroy() + del cls.root, cls.flist, cls.cb + + def test_init(self): + cb = self.cb + eq = self.assertEqual + eq(cb.name, self.module) + eq(cb.file, self.file) + eq(cb.flist, self.flist) + eq(pyclbr._modules, {}) + self.assertIsInstance(cb.node, TreeNode) + + def test_settitle(self): + cb = self.cb + self.assertIn(self.module, cb.top.title()) + self.assertEqual(cb.top.iconname(), 'Class Browser') + + def test_rootnode(self): + cb = self.cb + rn = cb.rootnode() + self.assertIsInstance(rn, browser.ModuleBrowserTreeItem) + + def test_close(self): + cb = self.cb + cb.top.destroy = Func() + cb.node.destroy = Func() + cb.close() + self.assertTrue(cb.top.destroy.called) + self.assertTrue(cb.node.destroy.called) + del cb.top.destroy, cb.node.destroy + + +# Same nested tree creation as in test_pyclbr.py except for super on C0. +mb = pyclbr +module, fname = 'test', 'test.py' +f0 = mb.Function(module, 'f0', fname, 1) +f1 = mb._nest_function(f0, 'f1', 2) +f2 = mb._nest_function(f1, 'f2', 3) +c1 = mb._nest_class(f0, 'c1', 5) +C0 = mb.Class(module, 'C0', ['base'], fname, 6) +F1 = mb._nest_function(C0, 'F1', 8) +C1 = mb._nest_class(C0, 'C1', 11, ['']) +C2 = mb._nest_class(C1, 'C2', 12) +F3 = mb._nest_function(C2, 'F3', 14) +mock_pyclbr_tree = {'f0': f0, 'C0': C0} + +# transform_children(mock_pyclbr_tree, 'test') mutates C0.name. + +class TransformChildrenTest(unittest.TestCase): + + def test_transform_children(self): + eq = self.assertEqual + # Parameter matches tree module. + tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + eq(tcl[0], f0) + eq(tcl[1], C0) + eq(tcl[1].name, 'C0(base)') + # Check that second call does not add second '(base)' suffix. + tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + eq(tcl[1].name, 'C0(base)') + # Nothing to traverse if parameter name isn't same as tree module. + tn = browser.transform_children(mock_pyclbr_tree, 'different name') + self.assertEqual(list(tn), []) + # No name parameter. + tn = browser.transform_children({'f1': f1, 'c1': c1}) + self.assertEqual(list(tn), [f1, c1]) + + +class ModuleBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.mbt = browser.ModuleBrowserTreeItem(fname) + + def test_init(self): + self.assertEqual(self.mbt.file, fname) + + def test_gettext(self): + self.assertEqual(self.mbt.GetText(), fname) + + def test_geticonname(self): + self.assertEqual(self.mbt.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.mbt.IsExpandable()) + + def test_listchildren(self): + save_rex = browser.pyclbr.readmodule_ex + save_tc = browser.transform_children + browser.pyclbr.readmodule_ex = Func(result=mock_pyclbr_tree) + browser.transform_children = Func(result=[f0, C0]) + try: + self.assertEqual(self.mbt.listchildren(), [f0, C0]) + finally: + browser.pyclbr.readmodule_ex = save_rex + browser.transform_children = save_tc + + def test_getsublist(self): + mbt = self.mbt + mbt.listchildren = Func(result=[f0, C0]) + sub0, sub1 = mbt.GetSubList() + del mbt.listchildren + self.assertIsInstance(sub0, browser.ChildBrowserTreeItem) + self.assertIsInstance(sub1, browser.ChildBrowserTreeItem) + self.assertEqual(sub0.name, 'f0') + self.assertEqual(sub1.name, 'C0') + + + def test_ondoubleclick(self): + mbt = self.mbt + fopen = browser.file_open = mock.Mock() + + with mock.patch('os.path.exists', return_value=False): + mbt.OnDoubleClick() + fopen.assert_not_called() + + with mock.patch('os.path.exists', return_value=True): + mbt.OnDoubleClick() + fopen.assert_called() + fopen.called_with(fname) + + del browser.file_open + + +class ChildBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + CBT = browser.ChildBrowserTreeItem + cls.cbt_f1 = CBT(f1) + cls.cbt_C1 = CBT(C1) + cls.cbt_F1 = CBT(F1) + + @classmethod + def tearDownClass(cls): + del cls.cbt_C1, cls.cbt_f1, cls.cbt_F1 + + def test_init(self): + eq = self.assertEqual + eq(self.cbt_C1.name, 'C1') + self.assertFalse(self.cbt_C1.isfunction) + eq(self.cbt_f1.name, 'f1') + self.assertTrue(self.cbt_f1.isfunction) + + def test_gettext(self): + self.assertEqual(self.cbt_C1.GetText(), 'class C1') + self.assertEqual(self.cbt_f1.GetText(), 'def f1(...)') + + def test_geticonname(self): + self.assertEqual(self.cbt_C1.GetIconName(), 'folder') + self.assertEqual(self.cbt_f1.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.cbt_C1.IsExpandable()) + self.assertTrue(self.cbt_f1.IsExpandable()) + self.assertFalse(self.cbt_F1.IsExpandable()) + + def test_getsublist(self): + eq = self.assertEqual + CBT = browser.ChildBrowserTreeItem + + f1sublist = self.cbt_f1.GetSubList() + self.assertIsInstance(f1sublist[0], CBT) + eq(len(f1sublist), 1) + eq(f1sublist[0].name, 'f2') + + eq(self.cbt_F1.GetSubList(), []) + + def test_ondoubleclick(self): + fopen = browser.file_open = mock.Mock() + goto = fopen.return_value.gotoline = mock.Mock() + self.cbt_F1.OnDoubleClick() + fopen.assert_called() + goto.assert_called() + goto.assert_called_with(self.cbt_F1.obj.lineno) + del browser.file_open + # Failure test would have to raise OSError or AttributeError. + + +class NestedChildrenTest(unittest.TestCase): + "Test that all the nodes in a nested tree are added to the BrowserTree." + + def test_nested(self): + queue = deque() + actual_names = [] + # The tree items are processed in breadth first order. + # Verify that processing each sublist hits every node and + # in the right order. + expected_names = ['f0', 'C0', # This is run before transform test. + 'f1', 'c1', 'F1', 'C1()', + 'f2', 'C2', + 'F3'] + CBT = browser.ChildBrowserTreeItem + queue.extend((CBT(f0), CBT(C0))) + while queue: + cb = queue.popleft() + sublist = cb.GetSubList() + queue.extend(sublist) + self.assertIn(cb.name, cb.GetText()) + self.assertIn(cb.GetIconName(), ('python', 'folder')) + self.assertIs(cb.IsExpandable(), sublist != []) + actual_names.append(cb.name) + self.assertEqual(actual_names, expected_names) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/pathbrowser.py b/Lib/idlelib/pathbrowser.py index 6c19508d314..598dff8d56b 100644 --- a/Lib/idlelib/pathbrowser.py +++ b/Lib/idlelib/pathbrowser.py @@ -9,11 +9,12 @@ class PathBrowser(ClassBrowser): - def __init__(self, flist, _htest=False): + def __init__(self, flist, _htest=False, _utest=False): """ _htest - bool, change box location when running htest """ self._htest = _htest + self._utest = _utest self.init(flist) def settitle(self): diff --git a/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst b/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst new file mode 100644 index 00000000000..0d4494c16a7 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst @@ -0,0 +1,3 @@ +IDLE module browser now shows nested classes and functions. +Original patches for code and tests by Guilherme Polo and +Cheryl Sabella, respectively. From webhook-mailer at python.org Fri Sep 22 17:28:04 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Fri, 22 Sep 2017 21:28:04 -0000 Subject: [Python-checkins] [3.6] bpo-1612262: IDLE: Class Browser shows nested functions, classes (GH-2573) (#3702) Message-ID: https://github.com/python/cpython/commit/fa1cae5832cbcfafedc4b1879c2abc85452f4edd commit: fa1cae5832cbcfafedc4b1879c2abc85452f4edd branch: 3.6 author: Terry Jan Reedy committer: GitHub date: 2017-09-22T17:28:01-04:00 summary: [3.6] bpo-1612262: IDLE: Class Browser shows nested functions, classes (GH-2573) (#3702) Original patches for code and tests by Guilherme Polo and Cheryl Sabella, respectively. (cherry picked from commit 058de11360ea6816a6e978c7be0bcbea99a3f7da) files: A Lib/idlelib/_pyclbr.py A Lib/idlelib/idle_test/test_browser.py A Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst M Lib/idlelib/browser.py M Lib/idlelib/pathbrowser.py diff --git a/Lib/idlelib/_pyclbr.py b/Lib/idlelib/_pyclbr.py new file mode 100644 index 00000000000..e85566dbf61 --- /dev/null +++ b/Lib/idlelib/_pyclbr.py @@ -0,0 +1,402 @@ +# A private copy of 3.7.0a1 pyclbr for use by idlelib.browser +"""Parse a Python module and describe its classes and functions. + +Parse enough of a Python file to recognize imports and class and +function definitions, and to find out the superclasses of a class. + +The interface consists of a single function: + readmodule_ex(module, path=None) +where module is the name of a Python module, and path is an optional +list of directories where the module is to be searched. If present, +path is prepended to the system search path sys.path. The return value +is a dictionary. The keys of the dictionary are the names of the +classes and functions defined in the module (including classes that are +defined via the from XXX import YYY construct). The values are +instances of classes Class and Function. One special key/value pair is +present for packages: the key '__path__' has a list as its value which +contains the package search path. + +Classes and Functions have a common superclass: _Object. Every instance +has the following attributes: + module -- name of the module; + name -- name of the object; + file -- file in which the object is defined; + lineno -- line in the file where the object's definition starts; + parent -- parent of this object, if any; + children -- nested objects contained in this object. +The 'children' attribute is a dictionary mapping names to objects. + +Instances of Function describe functions with the attributes from _Object. + +Instances of Class describe classes with the attributes from _Object, +plus the following: + super -- list of super classes (Class instances if possible); + methods -- mapping of method names to beginning line numbers. +If the name of a super class is not recognized, the corresponding +entry in the list of super classes is not a class instance but a +string giving the name of the super class. Since import statements +are recognized and imported modules are scanned as well, this +shouldn't happen often. +""" + +import io +import sys +import importlib.util +import tokenize +from token import NAME, DEDENT, OP + +__all__ = ["readmodule", "readmodule_ex", "Class", "Function"] + +_modules = {} # Initialize cache of modules we've seen. + + +class _Object: + "Informaton about Python class or function." + def __init__(self, module, name, file, lineno, parent): + self.module = module + self.name = name + self.file = file + self.lineno = lineno + self.parent = parent + self.children = {} + + def _addchild(self, name, obj): + self.children[name] = obj + + +class Function(_Object): + "Information about a Python function, including methods." + def __init__(self, module, name, file, lineno, parent=None): + _Object.__init__(self, module, name, file, lineno, parent) + + +class Class(_Object): + "Information about a Python class." + def __init__(self, module, name, super, file, lineno, parent=None): + _Object.__init__(self, module, name, file, lineno, parent) + self.super = [] if super is None else super + self.methods = {} + + def _addmethod(self, name, lineno): + self.methods[name] = lineno + + +def _nest_function(ob, func_name, lineno): + "Return a Function after nesting within ob." + newfunc = Function(ob.module, func_name, ob.file, lineno, ob) + ob._addchild(func_name, newfunc) + if isinstance(ob, Class): + ob._addmethod(func_name, lineno) + return newfunc + +def _nest_class(ob, class_name, lineno, super=None): + "Return a Class after nesting within ob." + newclass = Class(ob.module, class_name, super, ob.file, lineno, ob) + ob._addchild(class_name, newclass) + return newclass + +def readmodule(module, path=None): + """Return Class objects for the top-level classes in module. + + This is the original interface, before Functions were added. + """ + + res = {} + for key, value in _readmodule(module, path or []).items(): + if isinstance(value, Class): + res[key] = value + return res + +def readmodule_ex(module, path=None): + """Return a dictionary with all functions and classes in module. + + Search for module in PATH + sys.path. + If possible, include imported superclasses. + Do this by reading source, without importing (and executing) it. + """ + return _readmodule(module, path or []) + +def _readmodule(module, path, inpackage=None): + """Do the hard work for readmodule[_ex]. + + If inpackage is given, it must be the dotted name of the package in + which we are searching for a submodule, and then PATH must be the + package search path; otherwise, we are searching for a top-level + module, and path is combined with sys.path. + """ + # Compute the full module name (prepending inpackage if set). + if inpackage is not None: + fullmodule = "%s.%s" % (inpackage, module) + else: + fullmodule = module + + # Check in the cache. + if fullmodule in _modules: + return _modules[fullmodule] + + # Initialize the dict for this module's contents. + tree = {} + + # Check if it is a built-in module; we don't do much for these. + if module in sys.builtin_module_names and inpackage is None: + _modules[module] = tree + return tree + + # Check for a dotted module name. + i = module.rfind('.') + if i >= 0: + package = module[:i] + submodule = module[i+1:] + parent = _readmodule(package, path, inpackage) + if inpackage is not None: + package = "%s.%s" % (inpackage, package) + if not '__path__' in parent: + raise ImportError('No package named {}'.format(package)) + return _readmodule(submodule, parent['__path__'], package) + + # Search the path for the module. + f = None + if inpackage is not None: + search_path = path + else: + search_path = path + sys.path + spec = importlib.util._find_spec_from_path(fullmodule, search_path) + _modules[fullmodule] = tree + # Is module a package? + if spec.submodule_search_locations is not None: + tree['__path__'] = spec.submodule_search_locations + try: + source = spec.loader.get_source(fullmodule) + if source is None: + return tree + except (AttributeError, ImportError): + # If module is not Python source, we cannot do anything. + return tree + + fname = spec.loader.get_filename(fullmodule) + return _create_tree(fullmodule, path, fname, source, tree, inpackage) + + +def _create_tree(fullmodule, path, fname, source, tree, inpackage): + """Return the tree for a particular module. + + fullmodule (full module name), inpackage+module, becomes o.module. + path is passed to recursive calls of _readmodule. + fname becomes o.file. + source is tokenized. Imports cause recursive calls to _readmodule. + tree is {} or {'__path__': }. + inpackage, None or string, is passed to recursive calls of _readmodule. + + The effect of recursive calls is mutation of global _modules. + """ + f = io.StringIO(source) + + stack = [] # Initialize stack of (class, indent) pairs. + + g = tokenize.generate_tokens(f.readline) + try: + for tokentype, token, start, _end, _line in g: + if tokentype == DEDENT: + lineno, thisindent = start + # Close previous nested classes and defs. + while stack and stack[-1][1] >= thisindent: + del stack[-1] + elif token == 'def': + lineno, thisindent = start + # Close previous nested classes and defs. + while stack and stack[-1][1] >= thisindent: + del stack[-1] + tokentype, func_name, start = next(g)[0:3] + if tokentype != NAME: + continue # Skip def with syntax error. + cur_func = None + if stack: + cur_obj = stack[-1][0] + cur_func = _nest_function(cur_obj, func_name, lineno) + else: + # It is just a function. + cur_func = Function(fullmodule, func_name, fname, lineno) + tree[func_name] = cur_func + stack.append((cur_func, thisindent)) + elif token == 'class': + lineno, thisindent = start + # Close previous nested classes and defs. + while stack and stack[-1][1] >= thisindent: + del stack[-1] + tokentype, class_name, start = next(g)[0:3] + if tokentype != NAME: + continue # Skip class with syntax error. + # Parse what follows the class name. + tokentype, token, start = next(g)[0:3] + inherit = None + if token == '(': + names = [] # Initialize list of superclasses. + level = 1 + super = [] # Tokens making up current superclass. + while True: + tokentype, token, start = next(g)[0:3] + if token in (')', ',') and level == 1: + n = "".join(super) + if n in tree: + # We know this super class. + n = tree[n] + else: + c = n.split('.') + if len(c) > 1: + # Super class form is module.class: + # look in module for class. + m = c[-2] + c = c[-1] + if m in _modules: + d = _modules[m] + if c in d: + n = d[c] + names.append(n) + super = [] + if token == '(': + level += 1 + elif token == ')': + level -= 1 + if level == 0: + break + elif token == ',' and level == 1: + pass + # Only use NAME and OP (== dot) tokens for type name. + elif tokentype in (NAME, OP) and level == 1: + super.append(token) + # Expressions in the base list are not supported. + inherit = names + if stack: + cur_obj = stack[-1][0] + cur_class = _nest_class( + cur_obj, class_name, lineno, inherit) + else: + cur_class = Class(fullmodule, class_name, inherit, + fname, lineno) + tree[class_name] = cur_class + stack.append((cur_class, thisindent)) + elif token == 'import' and start[1] == 0: + modules = _getnamelist(g) + for mod, _mod2 in modules: + try: + # Recursively read the imported module. + if inpackage is None: + _readmodule(mod, path) + else: + try: + _readmodule(mod, path, inpackage) + except ImportError: + _readmodule(mod, []) + except: + # If we can't find or parse the imported module, + # too bad -- don't die here. + pass + elif token == 'from' and start[1] == 0: + mod, token = _getname(g) + if not mod or token != "import": + continue + names = _getnamelist(g) + try: + # Recursively read the imported module. + d = _readmodule(mod, path, inpackage) + except: + # If we can't find or parse the imported module, + # too bad -- don't die here. + continue + # Add any classes that were defined in the imported module + # to our name space if they were mentioned in the list. + for n, n2 in names: + if n in d: + tree[n2 or n] = d[n] + elif n == '*': + # Don't add names that start with _. + for n in d: + if n[0] != '_': + tree[n] = d[n] + except StopIteration: + pass + + f.close() + return tree + + +def _getnamelist(g): + """Return list of (dotted-name, as-name or None) tuples for token source g. + + An as-name is the name that follows 'as' in an as clause. + """ + names = [] + while True: + name, token = _getname(g) + if not name: + break + if token == 'as': + name2, token = _getname(g) + else: + name2 = None + names.append((name, name2)) + while token != "," and "\n" not in token: + token = next(g)[1] + if token != ",": + break + return names + + +def _getname(g): + "Return (dotted-name or None, next-token) tuple for token source g." + parts = [] + tokentype, token = next(g)[0:2] + if tokentype != NAME and token != '*': + return (None, token) + parts.append(token) + while True: + tokentype, token = next(g)[0:2] + if token != '.': + break + tokentype, token = next(g)[0:2] + if tokentype != NAME: + break + parts.append(token) + return (".".join(parts), token) + + +def _main(): + "Print module output (default this file) for quick visual check." + import os + try: + mod = sys.argv[1] + except: + mod = __file__ + if os.path.exists(mod): + path = [os.path.dirname(mod)] + mod = os.path.basename(mod) + if mod.lower().endswith(".py"): + mod = mod[:-3] + else: + path = [] + tree = readmodule_ex(mod, path) + lineno_key = lambda a: getattr(a, 'lineno', 0) + objs = sorted(tree.values(), key=lineno_key, reverse=True) + indent_level = 2 + while objs: + obj = objs.pop() + if isinstance(obj, list): + # Value is a __path__ key. + continue + if not hasattr(obj, 'indent'): + obj.indent = 0 + + if isinstance(obj, _Object): + new_objs = sorted(obj.children.values(), + key=lineno_key, reverse=True) + for ob in new_objs: + ob.indent = obj.indent + indent_level + objs.extend(new_objs) + if isinstance(obj, Class): + print("{}class {} {} {}" + .format(' ' * obj.indent, obj.name, obj.super, obj.lineno)) + elif isinstance(obj, Function): + print("{}def {} {}".format(' ' * obj.indent, obj.name, obj.lineno)) + +if __name__ == "__main__": + _main() diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index 4cf4744fb0a..df6d5c7cb3b 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -11,7 +11,7 @@ """ import os -import pyclbr +from idlelib import _pyclbr as pyclbr import sys from idlelib.config import idleConf @@ -19,14 +19,49 @@ from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas from idlelib.windows import ListedToplevel + file_open = None # Method...Item and Class...Item use this. # Normally pyshell.flist.open, but there is no pyshell.flist for htest. + +def transform_children(child_dict, modname=None): + """Transform a child dictionary to an ordered sequence of objects. + + The dictionary maps names to pyclbr information objects. + Filter out imported objects. + Augment class names with bases. + Sort objects by line number. + + The current tree only calls this once per child_dic as it saves + TreeItems once created. A future tree and tests might violate this, + so a check prevents multiple in-place augmentations. + """ + obs = [] # Use list since values should already be sorted. + for key, obj in child_dict.items(): + if modname is None or obj.module == modname: + if hasattr(obj, 'super') and obj.super and obj.name == key: + # If obj.name != key, it has already been suffixed. + supers = [] + for sup in obj.super: + if type(sup) is type(''): + sname = sup + else: + sname = sup.name + if sup.module != obj.module: + sname = f'{sup.module}.{sname}' + supers.append(sname) + obj.name += '({})'.format(', '.join(supers)) + obs.append(obj) + return sorted(obs, key=lambda o: o.lineno) + + class ClassBrowser: """Browse module classes and functions in IDLE. """ + # This class is the base class for pathbrowser.PathBrowser. + # Init and close are inherited, other methods are overriden. - def __init__(self, flist, name, path, _htest=False): + def __init__(self, flist, name, path, _htest=False, _utest=False): # XXX This API should change, if the file doesn't end in ".py" # XXX the code here is bogus! """Create a window for browsing a module's structure. @@ -47,11 +82,12 @@ def __init__(self, flist, name, path, _htest=False): the tree and subsequently in the children. """ global file_open - if not _htest: + if not (_htest or _utest): file_open = pyshell.flist.open self.name = name self.file = os.path.join(path[0], self.name + ".py") self._htest = _htest + self._utest = _utest self.init(flist) def close(self, event=None): @@ -80,8 +116,9 @@ def init(self, flist): sc.frame.pack(expand=1, fill="both") item = self.rootnode() self.node = node = TreeNode(sc.canvas, None, item) - node.update() - node.expand() + if not self._utest: + node.update() + node.expand() def settitle(self): "Set the window title." @@ -92,6 +129,7 @@ def rootnode(self): "Return a ModuleBrowserTreeItem as the root of the tree." return ModuleBrowserTreeItem(self.file) + class ModuleBrowserTreeItem(TreeItem): """Browser tree for Python module. @@ -115,16 +153,8 @@ def GetIconName(self): return "python" def GetSubList(self): - """Return the list of ClassBrowserTreeItem items. - - Each item returned from listclasses is the first level of - classes/functions within the module. - """ - sublist = [] - for name in self.listclasses(): - item = ClassBrowserTreeItem(name, self.classes, self.file) - sublist.append(item) - return sublist + "Return ChildBrowserTreeItems for children." + return [ChildBrowserTreeItem(obj) for obj in self.listchildren()] def OnDoubleClick(self): "Open a module in an editor window when double clicked." @@ -132,89 +162,44 @@ def OnDoubleClick(self): return if not os.path.exists(self.file): return - pyshell.flist.open(self.file) + file_open(self.file) def IsExpandable(self): "Return True if Python (.py) file." return os.path.normcase(self.file[-3:]) == ".py" - def listclasses(self): - """Return list of classes and functions in the module. - - The dictionary output from pyclbr is re-written as a - list of tuples in the form (lineno, name) and - then sorted so that the classes and functions are - processed in line number order. The returned list only - contains the name and not the line number. An instance - variable self.classes contains the pyclbr dictionary values, - which are instances of Class and Function. - """ + def listchildren(self): + "Return sequenced classes and functions in the module." dir, file = os.path.split(self.file) name, ext = os.path.splitext(file) if os.path.normcase(ext) != ".py": return [] try: - dict = pyclbr.readmodule_ex(name, [dir] + sys.path) + tree = pyclbr.readmodule_ex(name, [dir] + sys.path) except ImportError: return [] - items = [] - self.classes = {} - for key, cl in dict.items(): - if cl.module == name: - s = key - if hasattr(cl, 'super') and cl.super: - supers = [] - for sup in cl.super: - if type(sup) is type(''): - sname = sup - else: - sname = sup.name - if sup.module != cl.module: - sname = "%s.%s" % (sup.module, sname) - supers.append(sname) - s = s + "(%s)" % ", ".join(supers) - items.append((cl.lineno, s)) - self.classes[s] = cl - items.sort() - list = [] - for item, s in items: - list.append(s) - return list - -class ClassBrowserTreeItem(TreeItem): - """Browser tree for classes within a module. + return transform_children(tree, name) - Uses TreeItem as the basis for the structure of the tree. - """ - def __init__(self, name, classes, file): - """Create a TreeItem for the class/function. +class ChildBrowserTreeItem(TreeItem): + """Browser tree for child nodes within the module. - Args: - name: Name of the class/function. - classes: Dictonary of Class/Function instances from pyclbr. - file: Full path and module name. + Uses TreeItem as the basis for the structure of the tree. + """ - Instance variables: - self.cl: Class/Function instance for the class/function name. - self.isfunction: True if self.cl is a Function. - """ - self.name = name - # XXX - Does classes need to be an instance variable? - self.classes = classes - self.file = file - try: - self.cl = self.classes[self.name] - except (IndexError, KeyError): - self.cl = None - self.isfunction = isinstance(self.cl, pyclbr.Function) + def __init__(self, obj): + "Create a TreeItem for a pyclbr class/function object." + self.obj = obj + self.name = obj.name + self.isfunction = isinstance(obj, pyclbr.Function) def GetText(self): "Return the name of the function/class to display." + name = self.name if self.isfunction: - return "def " + self.name + "(...)" + return "def " + name + "(...)" else: - return "class " + self.name + return "class " + name def GetIconName(self): "Return the name of the icon to display." @@ -224,95 +209,34 @@ def GetIconName(self): return "folder" def IsExpandable(self): - "Return True if this class has methods." - if self.cl: - try: - return not not self.cl.methods - except AttributeError: - return False - return None + "Return True if self.obj has nested objects." + return self.obj.children != {} def GetSubList(self): - """Return Class methods as a list of MethodBrowserTreeItem items. - - Each item is a method within the class. - """ - if not self.cl: - return [] - sublist = [] - for name in self.listmethods(): - item = MethodBrowserTreeItem(name, self.cl, self.file) - sublist.append(item) - return sublist + "Return ChildBrowserTreeItems for children." + return [ChildBrowserTreeItem(obj) + for obj in transform_children(self.obj.children)] def OnDoubleClick(self): - "Open module with file_open and position to lineno, if it exists." - if not os.path.exists(self.file): - return - edit = file_open(self.file) - if hasattr(self.cl, 'lineno'): - lineno = self.cl.lineno - edit.gotoline(lineno) - - def listmethods(self): - "Return list of methods within a class sorted by lineno." - if not self.cl: - return [] - items = [] - for name, lineno in self.cl.methods.items(): - items.append((lineno, name)) - items.sort() - list = [] - for item, name in items: - list.append(name) - return list - -class MethodBrowserTreeItem(TreeItem): - """Browser tree for methods within a class. - - Uses TreeItem as the basis for the structure of the tree. - """ - - def __init__(self, name, cl, file): - """Create a TreeItem for the methods. - - Args: - name: Name of the class/function. - cl: pyclbr.Class instance for name. - file: Full path and module name. - """ - self.name = name - self.cl = cl - self.file = file - - def GetText(self): - "Return the method name to display." - return "def " + self.name + "(...)" - - def GetIconName(self): - "Return the name of the icon to display." - return "python" - - def IsExpandable(self): - "Return False as there are no tree items after methods." - return False + "Open module with file_open and position to lineno." + try: + edit = file_open(self.obj.file) + edit.gotoline(self.obj.lineno) + except (OSError, AttributeError): + pass - def OnDoubleClick(self): - "Open module with file_open and position at the method start." - if not os.path.exists(self.file): - return - edit = file_open(self.file) - edit.gotoline(self.cl.methods[self.name]) def _class_browser(parent): # htest # try: + file = sys.argv[1] # If pass file on command line + # If this succeeds, unittest will fail. + except IndexError: file = __file__ - except NameError: - file = sys.argv[0] - if sys.argv[1:]: - file = sys.argv[1] - else: - file = sys.argv[0] + # Add objects for htest + class Nested_in_func(TreeNode): + def nested_in_class(): pass + def closure(): + class Nested_in_closure: pass dir, file = os.path.split(file) name = os.path.splitext(file)[0] flist = pyshell.PyShellFileList(parent) @@ -321,5 +245,7 @@ def _class_browser(parent): # htest # ClassBrowser(flist, name, [dir], _htest=True) if __name__ == "__main__": + from unittest import main + main('idlelib.idle_test.test_browser', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_class_browser) diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py new file mode 100644 index 00000000000..875b0b9cb85 --- /dev/null +++ b/Lib/idlelib/idle_test/test_browser.py @@ -0,0 +1,242 @@ +""" Test idlelib.browser. + +Coverage: 88% +(Higher, because should exclude 3 lines that .coveragerc won't exclude.) +""" + +import os.path +import unittest +from idlelib import _pyclbr as pyclbr + +from idlelib import browser, filelist +from idlelib.tree import TreeNode +from test.support import requires +from unittest import mock +from tkinter import Tk +from idlelib.idle_test.mock_idle import Func +from collections import deque + + +class ClassBrowserTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.root.withdraw() + cls.flist = filelist.FileList(cls.root) + cls.file = __file__ + cls.path = os.path.dirname(cls.file) + cls.module = os.path.basename(cls.file).rstrip('.py') + cls.cb = browser.ClassBrowser(cls.flist, cls.module, [cls.path], _utest=True) + + @classmethod + def tearDownClass(cls): + cls.cb.close() + cls.root.destroy() + del cls.root, cls.flist, cls.cb + + def test_init(self): + cb = self.cb + eq = self.assertEqual + eq(cb.name, self.module) + eq(cb.file, self.file) + eq(cb.flist, self.flist) + eq(pyclbr._modules, {}) + self.assertIsInstance(cb.node, TreeNode) + + def test_settitle(self): + cb = self.cb + self.assertIn(self.module, cb.top.title()) + self.assertEqual(cb.top.iconname(), 'Class Browser') + + def test_rootnode(self): + cb = self.cb + rn = cb.rootnode() + self.assertIsInstance(rn, browser.ModuleBrowserTreeItem) + + def test_close(self): + cb = self.cb + cb.top.destroy = Func() + cb.node.destroy = Func() + cb.close() + self.assertTrue(cb.top.destroy.called) + self.assertTrue(cb.node.destroy.called) + del cb.top.destroy, cb.node.destroy + + +# Same nested tree creation as in test_pyclbr.py except for super on C0. +mb = pyclbr +module, fname = 'test', 'test.py' +f0 = mb.Function(module, 'f0', fname, 1) +f1 = mb._nest_function(f0, 'f1', 2) +f2 = mb._nest_function(f1, 'f2', 3) +c1 = mb._nest_class(f0, 'c1', 5) +C0 = mb.Class(module, 'C0', ['base'], fname, 6) +F1 = mb._nest_function(C0, 'F1', 8) +C1 = mb._nest_class(C0, 'C1', 11, ['']) +C2 = mb._nest_class(C1, 'C2', 12) +F3 = mb._nest_function(C2, 'F3', 14) +mock_pyclbr_tree = {'f0': f0, 'C0': C0} + +# transform_children(mock_pyclbr_tree, 'test') mutates C0.name. + +class TransformChildrenTest(unittest.TestCase): + + def test_transform_children(self): + eq = self.assertEqual + # Parameter matches tree module. + tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + eq(tcl[0], f0) + eq(tcl[1], C0) + eq(tcl[1].name, 'C0(base)') + # Check that second call does not add second '(base)' suffix. + tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + eq(tcl[1].name, 'C0(base)') + # Nothing to traverse if parameter name isn't same as tree module. + tn = browser.transform_children(mock_pyclbr_tree, 'different name') + self.assertEqual(list(tn), []) + # No name parameter. + tn = browser.transform_children({'f1': f1, 'c1': c1}) + self.assertEqual(list(tn), [f1, c1]) + + +class ModuleBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.mbt = browser.ModuleBrowserTreeItem(fname) + + def test_init(self): + self.assertEqual(self.mbt.file, fname) + + def test_gettext(self): + self.assertEqual(self.mbt.GetText(), fname) + + def test_geticonname(self): + self.assertEqual(self.mbt.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.mbt.IsExpandable()) + + def test_listchildren(self): + save_rex = browser.pyclbr.readmodule_ex + save_tc = browser.transform_children + browser.pyclbr.readmodule_ex = Func(result=mock_pyclbr_tree) + browser.transform_children = Func(result=[f0, C0]) + try: + self.assertEqual(self.mbt.listchildren(), [f0, C0]) + finally: + browser.pyclbr.readmodule_ex = save_rex + browser.transform_children = save_tc + + def test_getsublist(self): + mbt = self.mbt + mbt.listchildren = Func(result=[f0, C0]) + sub0, sub1 = mbt.GetSubList() + del mbt.listchildren + self.assertIsInstance(sub0, browser.ChildBrowserTreeItem) + self.assertIsInstance(sub1, browser.ChildBrowserTreeItem) + self.assertEqual(sub0.name, 'f0') + self.assertEqual(sub1.name, 'C0') + + + def test_ondoubleclick(self): + mbt = self.mbt + fopen = browser.file_open = mock.Mock() + + with mock.patch('os.path.exists', return_value=False): + mbt.OnDoubleClick() + fopen.assert_not_called() + + with mock.patch('os.path.exists', return_value=True): + mbt.OnDoubleClick() + fopen.assert_called() + fopen.called_with(fname) + + del browser.file_open + + +class ChildBrowserTreeItemTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + CBT = browser.ChildBrowserTreeItem + cls.cbt_f1 = CBT(f1) + cls.cbt_C1 = CBT(C1) + cls.cbt_F1 = CBT(F1) + + @classmethod + def tearDownClass(cls): + del cls.cbt_C1, cls.cbt_f1, cls.cbt_F1 + + def test_init(self): + eq = self.assertEqual + eq(self.cbt_C1.name, 'C1') + self.assertFalse(self.cbt_C1.isfunction) + eq(self.cbt_f1.name, 'f1') + self.assertTrue(self.cbt_f1.isfunction) + + def test_gettext(self): + self.assertEqual(self.cbt_C1.GetText(), 'class C1') + self.assertEqual(self.cbt_f1.GetText(), 'def f1(...)') + + def test_geticonname(self): + self.assertEqual(self.cbt_C1.GetIconName(), 'folder') + self.assertEqual(self.cbt_f1.GetIconName(), 'python') + + def test_isexpandable(self): + self.assertTrue(self.cbt_C1.IsExpandable()) + self.assertTrue(self.cbt_f1.IsExpandable()) + self.assertFalse(self.cbt_F1.IsExpandable()) + + def test_getsublist(self): + eq = self.assertEqual + CBT = browser.ChildBrowserTreeItem + + f1sublist = self.cbt_f1.GetSubList() + self.assertIsInstance(f1sublist[0], CBT) + eq(len(f1sublist), 1) + eq(f1sublist[0].name, 'f2') + + eq(self.cbt_F1.GetSubList(), []) + + def test_ondoubleclick(self): + fopen = browser.file_open = mock.Mock() + goto = fopen.return_value.gotoline = mock.Mock() + self.cbt_F1.OnDoubleClick() + fopen.assert_called() + goto.assert_called() + goto.assert_called_with(self.cbt_F1.obj.lineno) + del browser.file_open + # Failure test would have to raise OSError or AttributeError. + + +class NestedChildrenTest(unittest.TestCase): + "Test that all the nodes in a nested tree are added to the BrowserTree." + + def test_nested(self): + queue = deque() + actual_names = [] + # The tree items are processed in breadth first order. + # Verify that processing each sublist hits every node and + # in the right order. + expected_names = ['f0', 'C0', # This is run before transform test. + 'f1', 'c1', 'F1', 'C1()', + 'f2', 'C2', + 'F3'] + CBT = browser.ChildBrowserTreeItem + queue.extend((CBT(f0), CBT(C0))) + while queue: + cb = queue.popleft() + sublist = cb.GetSubList() + queue.extend(sublist) + self.assertIn(cb.name, cb.GetText()) + self.assertIn(cb.GetIconName(), ('python', 'folder')) + self.assertIs(cb.IsExpandable(), sublist != []) + actual_names.append(cb.name) + self.assertEqual(actual_names, expected_names) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/pathbrowser.py b/Lib/idlelib/pathbrowser.py index 6c19508d314..598dff8d56b 100644 --- a/Lib/idlelib/pathbrowser.py +++ b/Lib/idlelib/pathbrowser.py @@ -9,11 +9,12 @@ class PathBrowser(ClassBrowser): - def __init__(self, flist, _htest=False): + def __init__(self, flist, _htest=False, _utest=False): """ _htest - bool, change box location when running htest """ self._htest = _htest + self._utest = _utest self.init(flist) def settitle(self): diff --git a/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst b/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst new file mode 100644 index 00000000000..0d4494c16a7 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-08-14-15-13-50.bpo-1612262.-x_Oyq.rst @@ -0,0 +1,3 @@ +IDLE module browser now shows nested classes and functions. +Original patches for code and tests by Guilherme Polo and +Cheryl Sabella, respectively. From webhook-mailer at python.org Sat Sep 23 02:25:31 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Sat, 23 Sep 2017 06:25:31 -0000 Subject: [Python-checkins] sqlite: delete some bsddb cargo-culted code to work around Python 2.3/2.4 bugs Message-ID: https://github.com/python/cpython/commit/c8a6e5b18d3c3df04c17ed7761e34487971c82ff commit: c8a6e5b18d3c3df04c17ed7761e34487971c82ff branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-22T23:25:28-07:00 summary: sqlite: delete some bsddb cargo-culted code to work around Python 2.3/2.4 bugs files: M Modules/_sqlite/module.c diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 5f8aaf96b59..ffb711830bc 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -465,21 +465,6 @@ PyMODINIT_FUNC PyInit__sqlite3(void) pysqlite_BaseTypeAdapted = 0; - /* Original comment from _bsddb.c in the Python core. This is also still - * needed nowadays for Python 2.3/2.4. - * - * PyEval_InitThreads is called here due to a quirk in python 1.5 - * - 2.2.1 (at least) according to Russell Williamson : - * The global interpreter lock is not initialized until the first - * thread is created using thread.start_new_thread() or fork() is - * called. that would cause the ALLOW_THREADS here to segfault due - * to a null pointer reference if no threads or child processes - * have been created. This works around that and is a no-op if - * threads have already been initialized. - * (see pybsddb-users mailing list post on 2002-08-07) - */ - PyEval_InitThreads(); - error: if (PyErr_Occurred()) { From solipsis at pitrou.net Sat Sep 23 05:21:57 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 23 Sep 2017 09:21:57 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=15 Message-ID: <20170923092156.104698.FCC5DEF2C911CA67@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [3, 0, 0] memory blocks, sum=3 test_collections leaked [7, -7, 8] memory blocks, sum=8 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [1, 1, -2] memory blocks, sum=0 test_multiprocessing_forkserver leaked [2, 0, -2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogM4l6qA', '--timeout', '7200'] From webhook-mailer at python.org Sat Sep 23 13:18:43 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Sat, 23 Sep 2017 17:18:43 -0000 Subject: [Python-checkins] Docs: correct hashlib.blake2 keyed hashing example (bpo-31560) Message-ID: https://github.com/python/cpython/commit/aecc08ac3a14a73aa353655bb65ff8d965e935a0 commit: aecc08ac3a14a73aa353655bb65ff8d965e935a0 branch: master author: Dmitry Chestnykh committer: Benjamin Peterson date: 2017-09-23T10:18:40-07:00 summary: Docs: correct hashlib.blake2 keyed hashing example (bpo-31560) files: M Doc/library/hashlib.rst M Doc/tools/susp-ignored.csv diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 725dce6fa15..3a27a5b566f 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -510,15 +510,19 @@ to users and later verify them to make sure they weren't tampered with:: ... h.update(cookie) ... return h.hexdigest().encode('utf-8') >>> - >>> cookie = b'user:vatrogasac' + >>> def verify(cookie, sig): + ... good_sig = sign(cookie) + ... return compare_digest(good_sig, sig) + >>> + >>> cookie = b'user-alice' >>> sig = sign(cookie) >>> print("{0},{1}".format(cookie.decode('utf-8'), sig)) - user:vatrogasac,349cf904533767ed2d755279a8df84d0 - >>> compare_digest(cookie, sig) + user-alice,b'43b3c982cf697e0c5ab22172d1ca7421' + >>> verify(cookie, sig) True - >>> compare_digest(b'user:policajac', sig) + >>> verify(b'user-bob', sig) False - >>> compare_digest(cookie, b'0102030405060708090a0b0c0d0e0f00') + >>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00') False Even though there's a native keyed hashing mode, BLAKE2 can, of course, be used diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 7f1f9ea1629..2b3ccf3ac60 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -130,9 +130,6 @@ library/exceptions,,:err,err.object[err.start:err.end] library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] -library/hashlib,,:vatrogasac,>>> cookie = b'user:vatrogasac' -library/hashlib,,:vatrogasac,"user:vatrogasac,349cf904533767ed2d755279a8df84d0" -library/hashlib,,:policajac,">>> compare_digest(b'user:policajac', sig)" library/hashlib,,:LEAF,"h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH," library/http.client,,:port,host:port library/http.cookies,,`,!#$%&'*+-.^_`|~: From webhook-mailer at python.org Sat Sep 23 13:27:25 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Sat, 23 Sep 2017 17:27:25 -0000 Subject: [Python-checkins] [3.6] Docs: correct hashlib.blake2 keyed hashing example (bpo-31560) Message-ID: https://github.com/python/cpython/commit/5614487378863d14cdbe730b00d6803523abb7ac commit: 5614487378863d14cdbe730b00d6803523abb7ac branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Benjamin Peterson date: 2017-09-23T10:27:22-07:00 summary: [3.6] Docs: correct hashlib.blake2 keyed hashing example (bpo-31560) (cherry picked from commit aecc08ac3a14a73aa353655bb65ff8d965e935a0) files: M Doc/library/hashlib.rst M Doc/tools/susp-ignored.csv diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 725dce6fa15..3a27a5b566f 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -510,15 +510,19 @@ to users and later verify them to make sure they weren't tampered with:: ... h.update(cookie) ... return h.hexdigest().encode('utf-8') >>> - >>> cookie = b'user:vatrogasac' + >>> def verify(cookie, sig): + ... good_sig = sign(cookie) + ... return compare_digest(good_sig, sig) + >>> + >>> cookie = b'user-alice' >>> sig = sign(cookie) >>> print("{0},{1}".format(cookie.decode('utf-8'), sig)) - user:vatrogasac,349cf904533767ed2d755279a8df84d0 - >>> compare_digest(cookie, sig) + user-alice,b'43b3c982cf697e0c5ab22172d1ca7421' + >>> verify(cookie, sig) True - >>> compare_digest(b'user:policajac', sig) + >>> verify(b'user-bob', sig) False - >>> compare_digest(cookie, b'0102030405060708090a0b0c0d0e0f00') + >>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00') False Even though there's a native keyed hashing mode, BLAKE2 can, of course, be used diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 6cd5a32878f..482ffc0bde8 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -130,9 +130,6 @@ library/exceptions,,:err,err.object[err.start:err.end] library/functions,,:step,a[start:stop:step] library/functions,,:stop,"a[start:stop, i]" library/functions,,:stop,a[start:stop:step] -library/hashlib,,:vatrogasac,>>> cookie = b'user:vatrogasac' -library/hashlib,,:vatrogasac,"user:vatrogasac,349cf904533767ed2d755279a8df84d0" -library/hashlib,,:policajac,">>> compare_digest(b'user:policajac', sig)" library/hashlib,,:LEAF,"h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH," library/http.client,,:port,host:port library/http.cookies,,`,!#$%&'*+-.^_`|~: From webhook-mailer at python.org Sat Sep 23 14:19:26 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 23 Sep 2017 18:19:26 -0000 Subject: [Python-checkins] bpo-31559: Remove test order dependence in idle_test.test_browser. (#3708) Message-ID: https://github.com/python/cpython/commit/99167f85b7373c8082b30a74211f009627bdedfa commit: 99167f85b7373c8082b30a74211f009627bdedfa branch: master author: Terry Jan Reedy committer: GitHub date: 2017-09-23T14:19:23-04:00 summary: bpo-31559: Remove test order dependence in idle_test.test_browser. (#3708) Order dependence caused leak-test buildbots to fail when running test_idle repeatedly. files: A Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst M Lib/idlelib/idle_test/test_browser.py diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py index 025e2902d8f..3b1ece99528 100644 --- a/Lib/idlelib/idle_test/test_browser.py +++ b/Lib/idlelib/idle_test/test_browser.py @@ -65,7 +65,7 @@ def test_close(self): del cb.top.destroy, cb.node.destroy -# Same nested tree creation as in test_pyclbr.py except for super on C0. +# Nested tree same as in test_pyclbr.py except for supers on C0. C1. mb = pyclbr module, fname = 'test', 'test.py' f0 = mb.Function(module, 'f0', fname, 1) @@ -79,26 +79,43 @@ def test_close(self): F3 = mb._nest_function(C2, 'F3', 14) mock_pyclbr_tree = {'f0': f0, 'C0': C0} -# transform_children(mock_pyclbr_tree, 'test') mutates C0.name. +# Adjust C0.name, C1.name so tests do not depend on order. +browser.transform_children(mock_pyclbr_tree, 'test') # C0(base) +browser.transform_children(C0.children) # C1() + +# The class below checks that the calls above are correct +# and that duplicate calls have no effect. + class TransformChildrenTest(unittest.TestCase): - def test_transform_children(self): + def test_transform_module_children(self): eq = self.assertEqual + transform = browser.transform_children # Parameter matches tree module. - tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) - eq(tcl[0], f0) - eq(tcl[1], C0) + tcl = list(transform(mock_pyclbr_tree, 'test')) + eq(tcl, [f0, C0]) + eq(tcl[0].name, 'f0') eq(tcl[1].name, 'C0(base)') - # Check that second call does not add second '(base)' suffix. - tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + # Check that second call does not change suffix. + tcl = list(transform(mock_pyclbr_tree, 'test')) eq(tcl[1].name, 'C0(base)') # Nothing to traverse if parameter name isn't same as tree module. - tn = browser.transform_children(mock_pyclbr_tree, 'different name') - self.assertEqual(list(tn), []) - # No name parameter. - tn = browser.transform_children({'f1': f1, 'c1': c1}) - self.assertEqual(list(tn), [f1, c1]) + tcl = list(transform(mock_pyclbr_tree, 'different name')) + eq(tcl, []) + + def test_transform_node_children(self): + eq = self.assertEqual + transform = browser.transform_children + # Class with two children, one name altered. + tcl = list(transform(C0.children)) + eq(tcl, [F1, C1]) + eq(tcl[0].name, 'F1') + eq(tcl[1].name, 'C1()') + tcl = list(transform(C0.children)) + eq(tcl[1].name, 'C1()') + # Function with two children. + eq(list(transform(f0.children)), [f1, c1]) class ModuleBrowserTreeItemTest(unittest.TestCase): @@ -138,7 +155,7 @@ def test_getsublist(self): self.assertIsInstance(sub0, browser.ChildBrowserTreeItem) self.assertIsInstance(sub1, browser.ChildBrowserTreeItem) self.assertEqual(sub0.name, 'f0') - self.assertEqual(sub1.name, 'C0') + self.assertEqual(sub1.name, 'C0(base)') def test_ondoubleclick(self): @@ -172,13 +189,13 @@ def tearDownClass(cls): def test_init(self): eq = self.assertEqual - eq(self.cbt_C1.name, 'C1') + eq(self.cbt_C1.name, 'C1()') self.assertFalse(self.cbt_C1.isfunction) eq(self.cbt_f1.name, 'f1') self.assertTrue(self.cbt_f1.isfunction) def test_gettext(self): - self.assertEqual(self.cbt_C1.GetText(), 'class C1') + self.assertEqual(self.cbt_C1.GetText(), 'class C1()') self.assertEqual(self.cbt_f1.GetText(), 'def f1(...)') def test_geticonname(self): @@ -221,7 +238,7 @@ def test_nested(self): # The tree items are processed in breadth first order. # Verify that processing each sublist hits every node and # in the right order. - expected_names = ['f0', 'C0', # This is run before transform test. + expected_names = ['f0', 'C0(base)', 'f1', 'c1', 'F1', 'C1()', 'f2', 'C2', 'F3'] diff --git a/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst b/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst new file mode 100644 index 00000000000..424da7a3f17 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst @@ -0,0 +1 @@ +Remove test order dependence in idle_test.test_browser. From webhook-mailer at python.org Sat Sep 23 15:24:21 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 23 Sep 2017 19:24:21 -0000 Subject: [Python-checkins] [3.6] bpo-31559: Remove test order dependence in idle_test.test_browser. (GH-3708) (#3709) Message-ID: https://github.com/python/cpython/commit/429b3b1188cfac654677e8aeed494bb6067c475f commit: 429b3b1188cfac654677e8aeed494bb6067c475f branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-23T15:24:18-04:00 summary: [3.6] bpo-31559: Remove test order dependence in idle_test.test_browser. (GH-3708) (#3709) Order dependence caused leak-test buildbots to fail when running test_idle repeatedly. (cherry picked from commit 99167f85b7373c8082b30a74211f009627bdedfa) files: A Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst M Lib/idlelib/idle_test/test_browser.py diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py index 875b0b9cb85..8bc26c3451a 100644 --- a/Lib/idlelib/idle_test/test_browser.py +++ b/Lib/idlelib/idle_test/test_browser.py @@ -65,7 +65,7 @@ def test_close(self): del cb.top.destroy, cb.node.destroy -# Same nested tree creation as in test_pyclbr.py except for super on C0. +# Nested tree same as in test_pyclbr.py except for supers on C0. C1. mb = pyclbr module, fname = 'test', 'test.py' f0 = mb.Function(module, 'f0', fname, 1) @@ -79,26 +79,43 @@ def test_close(self): F3 = mb._nest_function(C2, 'F3', 14) mock_pyclbr_tree = {'f0': f0, 'C0': C0} -# transform_children(mock_pyclbr_tree, 'test') mutates C0.name. +# Adjust C0.name, C1.name so tests do not depend on order. +browser.transform_children(mock_pyclbr_tree, 'test') # C0(base) +browser.transform_children(C0.children) # C1() + +# The class below checks that the calls above are correct +# and that duplicate calls have no effect. + class TransformChildrenTest(unittest.TestCase): - def test_transform_children(self): + def test_transform_module_children(self): eq = self.assertEqual + transform = browser.transform_children # Parameter matches tree module. - tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) - eq(tcl[0], f0) - eq(tcl[1], C0) + tcl = list(transform(mock_pyclbr_tree, 'test')) + eq(tcl, [f0, C0]) + eq(tcl[0].name, 'f0') eq(tcl[1].name, 'C0(base)') - # Check that second call does not add second '(base)' suffix. - tcl = list(browser.transform_children(mock_pyclbr_tree, 'test')) + # Check that second call does not change suffix. + tcl = list(transform(mock_pyclbr_tree, 'test')) eq(tcl[1].name, 'C0(base)') # Nothing to traverse if parameter name isn't same as tree module. - tn = browser.transform_children(mock_pyclbr_tree, 'different name') - self.assertEqual(list(tn), []) - # No name parameter. - tn = browser.transform_children({'f1': f1, 'c1': c1}) - self.assertEqual(list(tn), [f1, c1]) + tcl = list(transform(mock_pyclbr_tree, 'different name')) + eq(tcl, []) + + def test_transform_node_children(self): + eq = self.assertEqual + transform = browser.transform_children + # Class with two children, one name altered. + tcl = list(transform(C0.children)) + eq(tcl, [F1, C1]) + eq(tcl[0].name, 'F1') + eq(tcl[1].name, 'C1()') + tcl = list(transform(C0.children)) + eq(tcl[1].name, 'C1()') + # Function with two children. + eq(list(transform(f0.children)), [f1, c1]) class ModuleBrowserTreeItemTest(unittest.TestCase): @@ -138,7 +155,7 @@ def test_getsublist(self): self.assertIsInstance(sub0, browser.ChildBrowserTreeItem) self.assertIsInstance(sub1, browser.ChildBrowserTreeItem) self.assertEqual(sub0.name, 'f0') - self.assertEqual(sub1.name, 'C0') + self.assertEqual(sub1.name, 'C0(base)') def test_ondoubleclick(self): @@ -172,13 +189,13 @@ def tearDownClass(cls): def test_init(self): eq = self.assertEqual - eq(self.cbt_C1.name, 'C1') + eq(self.cbt_C1.name, 'C1()') self.assertFalse(self.cbt_C1.isfunction) eq(self.cbt_f1.name, 'f1') self.assertTrue(self.cbt_f1.isfunction) def test_gettext(self): - self.assertEqual(self.cbt_C1.GetText(), 'class C1') + self.assertEqual(self.cbt_C1.GetText(), 'class C1()') self.assertEqual(self.cbt_f1.GetText(), 'def f1(...)') def test_geticonname(self): @@ -221,7 +238,7 @@ def test_nested(self): # The tree items are processed in breadth first order. # Verify that processing each sublist hits every node and # in the right order. - expected_names = ['f0', 'C0', # This is run before transform test. + expected_names = ['f0', 'C0(base)', 'f1', 'c1', 'F1', 'C1()', 'f2', 'C2', 'F3'] diff --git a/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst b/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst new file mode 100644 index 00000000000..424da7a3f17 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-23-12-52-24.bpo-31559.ydckYX.rst @@ -0,0 +1 @@ +Remove test order dependence in idle_test.test_browser. From webhook-mailer at python.org Sat Sep 23 16:46:04 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 23 Sep 2017 20:46:04 -0000 Subject: [Python-checkins] bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (#3704) Message-ID: https://github.com/python/cpython/commit/cd99e79dc74c9d9dea83a5551d657c334b2cc6c9 commit: cd99e79dc74c9d9dea83a5551d657c334b2cc6c9 branch: master author: Cheryl Sabella committer: Terry Jan Reedy date: 2017-09-23T16:46:01-04:00 summary: bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (#3704) The original module-level class and method browser became a module browser, with the addition of module-level functions, years ago. Nested classes and functions were added yesterday. For back- compatibility, the virtual event <>, which appears on the Keys tab of the Settings dialog, is not changed. Patch by Cheryl Sabella. files: A Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst M Lib/idlelib/browser.py M Lib/idlelib/editor.py M Lib/idlelib/idle_test/htest.py M Lib/idlelib/idle_test/test_browser.py M Lib/idlelib/mainmenu.py M Lib/idlelib/pathbrowser.py diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index 1fc04d873a8..603d299518d 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -1,4 +1,4 @@ -"""Class browser. +"""Module browser. XXX TO DO: @@ -55,7 +55,7 @@ def transform_children(child_dict, modname=None): return sorted(obs, key=lambda o: o.lineno) -class ClassBrowser: +class ModuleBrowser: """Browse module classes and functions in IDLE. """ # This class is the base class for pathbrowser.PathBrowser. @@ -122,8 +122,8 @@ def init(self, flist): def settitle(self): "Set the window title." - self.top.wm_title("Class Browser - " + self.name) - self.top.wm_iconname("Class Browser") + self.top.wm_title("Module Browser - " + self.name) + self.top.wm_iconname("Module Browser") def rootnode(self): "Return a ModuleBrowserTreeItem as the root of the tree." @@ -226,7 +226,7 @@ def OnDoubleClick(self): pass -def _class_browser(parent): # htest # +def _module_browser(parent): # htest # try: file = sys.argv[1] # If pass file on command line # If this succeeds, unittest will fail. @@ -242,10 +242,10 @@ class Nested_in_closure: pass flist = pyshell.PyShellFileList(parent) global file_open file_open = flist.open - ClassBrowser(flist, name, [dir], _htest=True) + ModuleBrowser(flist, name, [dir], _htest=True) if __name__ == "__main__": from unittest import main main('idlelib.idle_test.test_browser', verbosity=2, exit=False) from idlelib.idle_test.htest import run - run(_class_browser) + run(_module_browser) diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 855d3750556..5b16ccee8a6 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -190,7 +190,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): flist.dict[key] = self text.bind("<>", self.new_callback) text.bind("<>", self.flist.close_all_callback) - text.bind("<>", self.open_class_browser) + text.bind("<>", self.open_module_browser) text.bind("<>", self.open_path_browser) text.bind("<>", self.open_turtle_demo) @@ -632,10 +632,10 @@ def goto_line_event(self, event): def open_module(self): """Get module name from user and open it. - Return module path or None for calls by open_class_browser + Return module path or None for calls by open_module_browser when latter is not invoked in named editor window. """ - # XXX This, open_class_browser, and open_path_browser + # XXX This, open_module_browser, and open_path_browser # would fit better in iomenu.IOBinding. try: name = self.text.get("sel.first", "sel.last").strip() @@ -657,7 +657,7 @@ def open_module_event(self, event): self.open_module() return "break" - def open_class_browser(self, event=None): + def open_module_browser(self, event=None): filename = self.io.filename if not (self.__class__.__name__ == 'PyShellEditorWindow' and filename): @@ -667,7 +667,7 @@ def open_class_browser(self, event=None): head, tail = os.path.split(filename) base, ext = os.path.splitext(tail) from idlelib import browser - browser.ClassBrowser(self.flist, base, [head]) + browser.ModuleBrowser(self.flist, base, [head]) return "break" def open_path_browser(self, event=None): diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index e483bbc93a2..442f55e283a 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -86,7 +86,7 @@ def _wrapper(parent): # htest # "Typing ') should hide the calltip.\n" } -_class_browser_spec = { +_module_browser_spec = { 'file': 'browser', 'kwds': {}, 'msg': "Inspect names of module, class(with superclass if " diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py index 3b1ece99528..a4add89b93b 100644 --- a/Lib/idlelib/idle_test/test_browser.py +++ b/Lib/idlelib/idle_test/test_browser.py @@ -17,7 +17,7 @@ from collections import deque -class ClassBrowserTest(unittest.TestCase): +class ModuleBrowserTest(unittest.TestCase): @classmethod def setUpClass(cls): @@ -28,41 +28,41 @@ def setUpClass(cls): cls.file = __file__ cls.path = os.path.dirname(cls.file) cls.module = os.path.basename(cls.file).rstrip('.py') - cls.cb = browser.ClassBrowser(cls.flist, cls.module, [cls.path], _utest=True) + cls.mb = browser.ModuleBrowser(cls.flist, cls.module, [cls.path], _utest=True) @classmethod def tearDownClass(cls): - cls.cb.close() + cls.mb.close() cls.root.destroy() - del cls.root, cls.flist, cls.cb + del cls.root, cls.flist, cls.mb def test_init(self): - cb = self.cb + mb = self.mb eq = self.assertEqual - eq(cb.name, self.module) - eq(cb.file, self.file) - eq(cb.flist, self.flist) + eq(mb.name, self.module) + eq(mb.file, self.file) + eq(mb.flist, self.flist) eq(pyclbr._modules, {}) - self.assertIsInstance(cb.node, TreeNode) + self.assertIsInstance(mb.node, TreeNode) def test_settitle(self): - cb = self.cb - self.assertIn(self.module, cb.top.title()) - self.assertEqual(cb.top.iconname(), 'Class Browser') + mb = self.mb + self.assertIn(self.module, mb.top.title()) + self.assertEqual(mb.top.iconname(), 'Module Browser') def test_rootnode(self): - cb = self.cb - rn = cb.rootnode() + mb = self.mb + rn = mb.rootnode() self.assertIsInstance(rn, browser.ModuleBrowserTreeItem) def test_close(self): - cb = self.cb - cb.top.destroy = Func() - cb.node.destroy = Func() - cb.close() - self.assertTrue(cb.top.destroy.called) - self.assertTrue(cb.node.destroy.called) - del cb.top.destroy, cb.node.destroy + mb = self.mb + mb.top.destroy = Func() + mb.node.destroy = Func() + mb.close() + self.assertTrue(mb.top.destroy.called) + self.assertTrue(mb.node.destroy.called) + del mb.top.destroy, mb.node.destroy # Nested tree same as in test_pyclbr.py except for supers on C0. C1. diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py index d1dcb83d932..143570d6b11 100644 --- a/Lib/idlelib/mainmenu.py +++ b/Lib/idlelib/mainmenu.py @@ -25,7 +25,7 @@ ('_New File', '<>'), ('_Open...', '<>'), ('Open _Module...', '<>'), - ('Class _Browser', '<>'), + ('Module _Browser', '<>'), ('_Path Browser', '<>'), None, ('_Save', '<>'), diff --git a/Lib/idlelib/pathbrowser.py b/Lib/idlelib/pathbrowser.py index 598dff8d56b..b0c8c6d3055 100644 --- a/Lib/idlelib/pathbrowser.py +++ b/Lib/idlelib/pathbrowser.py @@ -2,12 +2,12 @@ import os import sys -from idlelib.browser import ClassBrowser, ModuleBrowserTreeItem +from idlelib.browser import ModuleBrowser, ModuleBrowserTreeItem from idlelib.pyshell import PyShellFileList from idlelib.tree import TreeItem -class PathBrowser(ClassBrowser): +class PathBrowser(ModuleBrowser): def __init__(self, flist, _htest=False, _utest=False): """ diff --git a/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst new file mode 100644 index 00000000000..b53c009dfcd --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst @@ -0,0 +1,7 @@ +Rename IDLE's module browser from Class Browser to Module Browser. +The original module-level class and method browser became a module +browser, with the addition of module-level functions, years ago. +Nested classes and functions were added yesterday. For back- +compatibility, the virtual event <>, which +appears on the Keys tab of the Settings dialog, is not changed. +Patch by Cheryl Sabella. From webhook-mailer at python.org Sat Sep 23 17:16:50 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sat, 23 Sep 2017 21:16:50 -0000 Subject: [Python-checkins] [3.6] bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (GH-3704) (#3710) Message-ID: https://github.com/python/cpython/commit/b650194652a591503f97c15f8f4c0b08c05058c5 commit: b650194652a591503f97c15f8f4c0b08c05058c5 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-23T17:16:47-04:00 summary: [3.6] bpo-31459: Rename IDLE's module browser from Class Browser to Module Browser. (GH-3704) (#3710) The original module-level class and method browser became a module browser, with the addition of module-level functions, years ago. Nested classes and functions were added yesterday. For back- compatibility, the virtual event <>, which appears on the Keys tab of the Settings dialog, is not changed. Patch by Cheryl Sabella. (cherry picked from commit cd99e79dc74c9d9dea83a5551d657c334b2cc6c9) files: A Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst M Lib/idlelib/browser.py M Lib/idlelib/editor.py M Lib/idlelib/idle_test/htest.py M Lib/idlelib/idle_test/test_browser.py M Lib/idlelib/mainmenu.py M Lib/idlelib/pathbrowser.py diff --git a/Lib/idlelib/browser.py b/Lib/idlelib/browser.py index df6d5c7cb3b..145ecd1b525 100644 --- a/Lib/idlelib/browser.py +++ b/Lib/idlelib/browser.py @@ -1,4 +1,4 @@ -"""Class browser. +"""Module browser. XXX TO DO: @@ -55,7 +55,7 @@ def transform_children(child_dict, modname=None): return sorted(obs, key=lambda o: o.lineno) -class ClassBrowser: +class ModuleBrowser: """Browse module classes and functions in IDLE. """ # This class is the base class for pathbrowser.PathBrowser. @@ -122,8 +122,8 @@ def init(self, flist): def settitle(self): "Set the window title." - self.top.wm_title("Class Browser - " + self.name) - self.top.wm_iconname("Class Browser") + self.top.wm_title("Module Browser - " + self.name) + self.top.wm_iconname("Module Browser") def rootnode(self): "Return a ModuleBrowserTreeItem as the root of the tree." @@ -226,7 +226,7 @@ def OnDoubleClick(self): pass -def _class_browser(parent): # htest # +def _module_browser(parent): # htest # try: file = sys.argv[1] # If pass file on command line # If this succeeds, unittest will fail. @@ -242,10 +242,10 @@ class Nested_in_closure: pass flist = pyshell.PyShellFileList(parent) global file_open file_open = flist.open - ClassBrowser(flist, name, [dir], _htest=True) + ModuleBrowser(flist, name, [dir], _htest=True) if __name__ == "__main__": from unittest import main main('idlelib.idle_test.test_browser', verbosity=2, exit=False) from idlelib.idle_test.htest import run - run(_class_browser) + run(_module_browser) diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 855d3750556..5b16ccee8a6 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -190,7 +190,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): flist.dict[key] = self text.bind("<>", self.new_callback) text.bind("<>", self.flist.close_all_callback) - text.bind("<>", self.open_class_browser) + text.bind("<>", self.open_module_browser) text.bind("<>", self.open_path_browser) text.bind("<>", self.open_turtle_demo) @@ -632,10 +632,10 @@ def goto_line_event(self, event): def open_module(self): """Get module name from user and open it. - Return module path or None for calls by open_class_browser + Return module path or None for calls by open_module_browser when latter is not invoked in named editor window. """ - # XXX This, open_class_browser, and open_path_browser + # XXX This, open_module_browser, and open_path_browser # would fit better in iomenu.IOBinding. try: name = self.text.get("sel.first", "sel.last").strip() @@ -657,7 +657,7 @@ def open_module_event(self, event): self.open_module() return "break" - def open_class_browser(self, event=None): + def open_module_browser(self, event=None): filename = self.io.filename if not (self.__class__.__name__ == 'PyShellEditorWindow' and filename): @@ -667,7 +667,7 @@ def open_class_browser(self, event=None): head, tail = os.path.split(filename) base, ext = os.path.splitext(tail) from idlelib import browser - browser.ClassBrowser(self.flist, base, [head]) + browser.ModuleBrowser(self.flist, base, [head]) return "break" def open_path_browser(self, event=None): diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py index e483bbc93a2..442f55e283a 100644 --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -86,7 +86,7 @@ def _wrapper(parent): # htest # "Typing ') should hide the calltip.\n" } -_class_browser_spec = { +_module_browser_spec = { 'file': 'browser', 'kwds': {}, 'msg': "Inspect names of module, class(with superclass if " diff --git a/Lib/idlelib/idle_test/test_browser.py b/Lib/idlelib/idle_test/test_browser.py index 8bc26c3451a..b9ae0419f8c 100644 --- a/Lib/idlelib/idle_test/test_browser.py +++ b/Lib/idlelib/idle_test/test_browser.py @@ -17,7 +17,7 @@ from collections import deque -class ClassBrowserTest(unittest.TestCase): +class ModuleBrowserTest(unittest.TestCase): @classmethod def setUpClass(cls): @@ -28,41 +28,41 @@ def setUpClass(cls): cls.file = __file__ cls.path = os.path.dirname(cls.file) cls.module = os.path.basename(cls.file).rstrip('.py') - cls.cb = browser.ClassBrowser(cls.flist, cls.module, [cls.path], _utest=True) + cls.mb = browser.ModuleBrowser(cls.flist, cls.module, [cls.path], _utest=True) @classmethod def tearDownClass(cls): - cls.cb.close() + cls.mb.close() cls.root.destroy() - del cls.root, cls.flist, cls.cb + del cls.root, cls.flist, cls.mb def test_init(self): - cb = self.cb + mb = self.mb eq = self.assertEqual - eq(cb.name, self.module) - eq(cb.file, self.file) - eq(cb.flist, self.flist) + eq(mb.name, self.module) + eq(mb.file, self.file) + eq(mb.flist, self.flist) eq(pyclbr._modules, {}) - self.assertIsInstance(cb.node, TreeNode) + self.assertIsInstance(mb.node, TreeNode) def test_settitle(self): - cb = self.cb - self.assertIn(self.module, cb.top.title()) - self.assertEqual(cb.top.iconname(), 'Class Browser') + mb = self.mb + self.assertIn(self.module, mb.top.title()) + self.assertEqual(mb.top.iconname(), 'Module Browser') def test_rootnode(self): - cb = self.cb - rn = cb.rootnode() + mb = self.mb + rn = mb.rootnode() self.assertIsInstance(rn, browser.ModuleBrowserTreeItem) def test_close(self): - cb = self.cb - cb.top.destroy = Func() - cb.node.destroy = Func() - cb.close() - self.assertTrue(cb.top.destroy.called) - self.assertTrue(cb.node.destroy.called) - del cb.top.destroy, cb.node.destroy + mb = self.mb + mb.top.destroy = Func() + mb.node.destroy = Func() + mb.close() + self.assertTrue(mb.top.destroy.called) + self.assertTrue(mb.node.destroy.called) + del mb.top.destroy, mb.node.destroy # Nested tree same as in test_pyclbr.py except for supers on C0. C1. diff --git a/Lib/idlelib/mainmenu.py b/Lib/idlelib/mainmenu.py index d1dcb83d932..143570d6b11 100644 --- a/Lib/idlelib/mainmenu.py +++ b/Lib/idlelib/mainmenu.py @@ -25,7 +25,7 @@ ('_New File', '<>'), ('_Open...', '<>'), ('Open _Module...', '<>'), - ('Class _Browser', '<>'), + ('Module _Browser', '<>'), ('_Path Browser', '<>'), None, ('_Save', '<>'), diff --git a/Lib/idlelib/pathbrowser.py b/Lib/idlelib/pathbrowser.py index 598dff8d56b..b0c8c6d3055 100644 --- a/Lib/idlelib/pathbrowser.py +++ b/Lib/idlelib/pathbrowser.py @@ -2,12 +2,12 @@ import os import sys -from idlelib.browser import ClassBrowser, ModuleBrowserTreeItem +from idlelib.browser import ModuleBrowser, ModuleBrowserTreeItem from idlelib.pyshell import PyShellFileList from idlelib.tree import TreeItem -class PathBrowser(ClassBrowser): +class PathBrowser(ModuleBrowser): def __init__(self, flist, _htest=False, _utest=False): """ diff --git a/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst new file mode 100644 index 00000000000..b53c009dfcd --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-09-22-20-26-23.bpo-31459.L0pnH9.rst @@ -0,0 +1,7 @@ +Rename IDLE's module browser from Class Browser to Module Browser. +The original module-level class and method browser became a module +browser, with the addition of module-level functions, years ago. +Nested classes and functions were added yesterday. For back- +compatibility, the virtual event <>, which +appears on the Keys tab of the Settings dialog, is not changed. +Patch by Cheryl Sabella. From webhook-mailer at python.org Sat Sep 23 19:50:02 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sat, 23 Sep 2017 23:50:02 -0000 Subject: [Python-checkins] bpo-25359: Add missed "goto error" after setting an exception. (#3712) Message-ID: https://github.com/python/cpython/commit/d6238a76c655e0feb13478505220dc9049f1682f commit: d6238a76c655e0feb13478505220dc9049f1682f branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-24T02:49:58+03:00 summary: bpo-25359: Add missed "goto error" after setting an exception. (#3712) files: M Modules/_io/textio.c diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 9b7334d3b54..5239e8518e6 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -941,6 +941,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, else { PyErr_SetString(PyExc_OSError, "could not determine default encoding"); + goto error; } /* Check we have been asked for a real text encoding */ From webhook-mailer at python.org Sat Sep 23 20:29:19 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 00:29:19 -0000 Subject: [Python-checkins] [3.6] bpo-25359: Add missed "goto error" after setting an exception. (GH-3712) (#3714) Message-ID: https://github.com/python/cpython/commit/7e32cee1a68a489c4f2e916ac7003004b51887de commit: 7e32cee1a68a489c4f2e916ac7003004b51887de branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-24T03:29:17+03:00 summary: [3.6] bpo-25359: Add missed "goto error" after setting an exception. (GH-3712) (#3714) (cherry picked from commit d6238a76c655e0feb13478505220dc9049f1682f) files: M Modules/_io/textio.c diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 588c6977691..4638b475970 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -943,6 +943,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, else { PyErr_SetString(PyExc_IOError, "could not determine default encoding"); + goto error; } /* Check we have been asked for a real text encoding */ From webhook-mailer at python.org Sat Sep 23 22:37:51 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 24 Sep 2017 02:37:51 -0000 Subject: [Python-checkins] bpo-31564: Update typing documentation (GH-3696) Message-ID: https://github.com/python/cpython/commit/039b25d8fd21f8d5d9e3cb536402d952cf068dc1 commit: 039b25d8fd21f8d5d9e3cb536402d952cf068dc1 branch: master author: topper-123 committer: Mariatta date: 2017-09-23T19:37:48-07:00 summary: bpo-31564: Update typing documentation (GH-3696) Mention that ``NewType`` can derive from another ``NewType``. files: M Doc/library/typing.rst diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 1e48fecdbf7..bd04f731a12 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -111,8 +111,7 @@ More precisely, the expression ``some_value is Derived(some_value)`` is always true at runtime. This also means that it is not possible to create a subtype of ``Derived`` -since it is an identity function at runtime, not an actual type. Similarly, it -is not possible to create another :func:`NewType` based on a ``Derived`` type:: +since it is an identity function at runtime, not an actual type:: from typing import NewType @@ -121,9 +120,16 @@ is not possible to create another :func:`NewType` based on a ``Derived`` type:: # Fails at runtime and does not typecheck class AdminUserId(UserId): pass - # Also does not typecheck +However, it is possible to create a :func:`NewType` based on a 'derived' ``NewType``:: + + from typing import NewType + + UserId = NewType('UserId', int) + ProUserId = NewType('ProUserId', UserId) +and typechecking for ``ProUserId`` will work as expected. + See :pep:`484` for more details. .. note:: From webhook-mailer at python.org Sat Sep 23 22:46:27 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 24 Sep 2017 02:46:27 -0000 Subject: [Python-checkins] bpo-31564: Update typing documentation (GH-3696) (GH-3715) Message-ID: https://github.com/python/cpython/commit/018e6b9f696311a65f47f33ea04b7baef3f3664f commit: 018e6b9f696311a65f47f33ea04b7baef3f3664f branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-23T19:46:24-07:00 summary: bpo-31564: Update typing documentation (GH-3696) (GH-3715) Mention that ``NewType`` can derive from another ``NewType``. (cherry picked from commit 039b25d8fd21f8d5d9e3cb536402d952cf068dc1) files: M Doc/library/typing.rst diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 1e48fecdbf7..bd04f731a12 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -111,8 +111,7 @@ More precisely, the expression ``some_value is Derived(some_value)`` is always true at runtime. This also means that it is not possible to create a subtype of ``Derived`` -since it is an identity function at runtime, not an actual type. Similarly, it -is not possible to create another :func:`NewType` based on a ``Derived`` type:: +since it is an identity function at runtime, not an actual type:: from typing import NewType @@ -121,9 +120,16 @@ is not possible to create another :func:`NewType` based on a ``Derived`` type:: # Fails at runtime and does not typecheck class AdminUserId(UserId): pass - # Also does not typecheck +However, it is possible to create a :func:`NewType` based on a 'derived' ``NewType``:: + + from typing import NewType + + UserId = NewType('UserId', int) + ProUserId = NewType('ProUserId', UserId) +and typechecking for ``ProUserId`` will work as expected. + See :pep:`484` for more details. .. note:: From webhook-mailer at python.org Sun Sep 24 05:07:16 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 09:07:16 -0000 Subject: [Python-checkins] bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() received a bad encoder() argument. (#3643) Message-ID: https://github.com/python/cpython/commit/2b382dd6121bb1e4b75470fb3ef8555665df3eb6 commit: 2b382dd6121bb1e4b75470fb3ef8555665df3eb6 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-24T12:07:12+03:00 summary: bpo-31505: Fix an assertion failure in json, in case _json.make_encoder() received a bad encoder() argument. (#3643) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-18-12-07-39.bpo-31505.VomaFa.rst M Lib/test/test_json/test_speedups.py M Modules/_json.c diff --git a/Lib/test/test_json/test_speedups.py b/Lib/test/test_json/test_speedups.py index 56f1882001d..5dad6920870 100644 --- a/Lib/test/test_json/test_speedups.py +++ b/Lib/test/test_json/test_speedups.py @@ -36,6 +36,27 @@ def test_make_encoder(self): b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75", None) + def test_bad_str_encoder(self): + # Issue #31505: There shouldn't be an assertion failure in case + # c_make_encoder() receives a bad encoder() argument. + def bad_encoder1(*args): + return None + enc = self.json.encoder.c_make_encoder(None, lambda obj: str(obj), + bad_encoder1, None, ': ', ', ', + False, False, False) + with self.assertRaises(TypeError): + enc('spam', 4) + with self.assertRaises(TypeError): + enc({'spam': 42}, 4) + + def bad_encoder2(*args): + 1/0 + enc = self.json.encoder.c_make_encoder(None, lambda obj: str(obj), + bad_encoder2, None, ': ', ', ', + False, False, False) + with self.assertRaises(ZeroDivisionError): + enc('spam', 4) + def test_bad_bool_args(self): def test(name): self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1}) diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-18-12-07-39.bpo-31505.VomaFa.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-18-12-07-39.bpo-31505.VomaFa.rst new file mode 100644 index 00000000000..bad9e51aaf6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-18-12-07-39.bpo-31505.VomaFa.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `json`, in case `_json.make_encoder()` received +a bad `encoder()` argument. Patch by Oren Milman. diff --git a/Modules/_json.c b/Modules/_json.c index 769696d9d68..13218a6ecce 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1429,10 +1429,20 @@ static PyObject * encoder_encode_string(PyEncoderObject *s, PyObject *obj) { /* Return the JSON representation of a string */ - if (s->fast_encode) + PyObject *encoded; + + if (s->fast_encode) { return s->fast_encode(NULL, obj); - else - return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); + } + encoded = PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); + if (encoded != NULL && !PyUnicode_Check(encoded)) { + PyErr_Format(PyExc_TypeError, + "encoder() must return a string, not %.80s", + Py_TYPE(encoded)->tp_name); + Py_DECREF(encoded); + return NULL; + } + return encoded; } static int From webhook-mailer at python.org Sun Sep 24 05:21:44 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 09:21:44 -0000 Subject: [Python-checkins] bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255) Message-ID: https://github.com/python/cpython/commit/4facdf523aa6967487a9425f124da9661b59fd43 commit: 4facdf523aa6967487a9425f124da9661b59fd43 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-24T12:21:42+03:00 summary: bpo-31311: Impove error reporting in case the first argument to PyCData_setstate() isn't a dictionary. (#3255) files: M Modules/_ctypes/_ctypes.c diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 1942c63c815..8afb8cc1f16 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -2665,8 +2665,11 @@ PyCData_setstate(PyObject *myself, PyObject *args) int res; PyObject *dict, *mydict; CDataObject *self = (CDataObject *)myself; - if (!PyArg_ParseTuple(args, "Os#", &dict, &data, &len)) + if (!PyArg_ParseTuple(args, "O!s#", + &PyDict_Type, &dict, &data, &len)) + { return NULL; + } if (len > self->b_size) len = self->b_size; memmove(self->b_ptr, data, len); From solipsis at pitrou.net Sun Sep 24 05:22:51 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 24 Sep 2017 09:22:51 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170924092251.34866.CD8527A0DFC6E46B@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, -7, 1] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-1, -1, 2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogbuFk4H', '--timeout', '7200'] From webhook-mailer at python.org Sun Sep 24 06:36:14 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 10:36:14 -0000 Subject: [Python-checkins] bpo-30346: An iterator produced by the itertools.groupby() iterator (#1569) Message-ID: https://github.com/python/cpython/commit/c247caf33f6e6000d828db4762d1cb12edf3cd57 commit: c247caf33f6e6000d828db4762d1cb12edf3cd57 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-24T13:36:11+03:00 summary: bpo-30346: An iterator produced by the itertools.groupby() iterator (#1569) now becames exhausted after advancing the groupby iterator. files: A Misc/NEWS.d/next/Library/2017-09-24-13-08-46.bpo-30346.Csse77.rst M Doc/library/itertools.rst M Lib/test/test_itertools.py M Modules/itertoolsmodule.c diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index c989e464200..530c29dec4a 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -401,13 +401,14 @@ loops that truncate the stream. def __iter__(self): return self def __next__(self): + self.id = object() while self.currkey == self.tgtkey: self.currvalue = next(self.it) # Exit on StopIteration self.currkey = self.keyfunc(self.currvalue) self.tgtkey = self.currkey - return (self.currkey, self._grouper(self.tgtkey)) - def _grouper(self, tgtkey): - while self.currkey == tgtkey: + return (self.currkey, self._grouper(self.tgtkey, self.id)) + def _grouper(self, tgtkey, id): + while self.id is id and self.currkey == tgtkey: yield self.currvalue try: self.currvalue = next(self.it) diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 50cf1488ec6..8353e68977d 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -751,6 +751,26 @@ def test_groupby(self): self.assertEqual(set(keys), expectedkeys) self.assertEqual(len(keys), len(expectedkeys)) + # Check case where inner iterator is used after advancing the groupby + # iterator + s = list(zip('AABBBAAAA', range(9))) + it = groupby(s, testR) + _, g1 = next(it) + _, g2 = next(it) + _, g3 = next(it) + self.assertEqual(list(g1), []) + self.assertEqual(list(g2), []) + self.assertEqual(next(g3), ('A', 5)) + list(it) # exhaust the groupby iterator + self.assertEqual(list(g3), []) + + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + it = groupby(s, testR) + _, g = next(it) + next(it) + next(it) + self.assertEqual(list(pickle.loads(pickle.dumps(g, proto))), []) + # Exercise pipes and filters style s = 'abracadabra' # sort s | uniq diff --git a/Misc/NEWS.d/next/Library/2017-09-24-13-08-46.bpo-30346.Csse77.rst b/Misc/NEWS.d/next/Library/2017-09-24-13-08-46.bpo-30346.Csse77.rst new file mode 100644 index 00000000000..81ad0534fc1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-24-13-08-46.bpo-30346.Csse77.rst @@ -0,0 +1,2 @@ +An iterator produced by itertools.groupby() iterator now becames exhausted +after advancing the groupby iterator. diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 48e6c35db4f..2ac5ab24ec8 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -17,6 +17,7 @@ typedef struct { PyObject *tgtkey; PyObject *currkey; PyObject *currvalue; + const void *currgrouper; /* borrowed reference */ } groupbyobject; static PyTypeObject groupby_type; @@ -77,6 +78,7 @@ groupby_next(groupbyobject *gbo) { PyObject *newvalue, *newkey, *r, *grouper; + gbo->currgrouper = NULL; /* skip to next iteration group */ for (;;) { if (gbo->currkey == NULL) @@ -255,6 +257,7 @@ _grouper_create(groupbyobject *parent, PyObject *tgtkey) Py_INCREF(parent); igo->tgtkey = tgtkey; Py_INCREF(tgtkey); + parent->currgrouper = igo; /* borrowed reference */ PyObject_GC_Track(igo); return (PyObject *)igo; @@ -284,6 +287,8 @@ _grouper_next(_grouperobject *igo) PyObject *newvalue, *newkey, *r; int rcmp; + if (gbo->currgrouper != igo) + return NULL; if (gbo->currvalue == NULL) { newvalue = PyIter_Next(gbo->it); if (newvalue == NULL) @@ -321,6 +326,9 @@ _grouper_next(_grouperobject *igo) static PyObject * _grouper_reduce(_grouperobject *lz) { + if (((groupbyobject *)lz->parent)->currgrouper != lz) { + return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter")); + } return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->parent, lz->tgtkey); } From webhook-mailer at python.org Sun Sep 24 07:34:13 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 11:34:13 -0000 Subject: [Python-checkins] bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (#3667) Message-ID: https://github.com/python/cpython/commit/2fad10235460ac394cc8b869c41f47aba3d63594 commit: 2fad10235460ac394cc8b869c41f47aba3d63594 branch: master author: Serhiy Storchaka committer: GitHub date: 2017-09-24T14:34:09+03:00 summary: bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (#3667) Defer removing old behavior to 3.8. Document new feature of selection_set() and friends. files: M Doc/library/tkinter.ttk.rst M Lib/tkinter/test/test_ttk/test_widgets.py M Lib/tkinter/ttk.py diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst index 3dad182cccd..927f7f3c6c1 100644 --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -1099,26 +1099,42 @@ ttk.Treeview If *selop* is not specified, returns selected items. Otherwise, it will act according to the following selection methods. + .. deprecated-removed:: 3.6 3.8 + Using ``selection()`` for changing the selection state is deprecated. + Use the following selection methods instead. - .. method:: selection_set(items) + + .. method:: selection_set(*items) *items* becomes the new selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + - .. method:: selection_add(items) + .. method:: selection_add(*items) Add *items* to the selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + - .. method:: selection_remove(items) + .. method:: selection_remove(*items) Remove *items* from the selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. - .. method:: selection_toggle(items) + + .. method:: selection_toggle(*items) Toggle the selection state of each item in *items*. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + .. method:: set(item, column=None, value=None) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py index 26766a8a1fe..ab0db2878e1 100644 --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1556,7 +1556,7 @@ def test_selection(self): self.tv.selection_toggle((c1, c3)) self.assertEqual(self.tv.selection(), (c3, item2)) - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 8): import warnings warnings.warn( 'Deprecated API of Treeview.selection() should be removed') diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py index e1a965e8dff..05c7364d203 100644 --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1404,13 +1404,13 @@ def selection(self, selop=_sentinel, items=None): import warnings warnings.warn( "The selop=None argument of selection() is deprecated " - "and will be removed in Python 3.7", + "and will be removed in Python 3.8", DeprecationWarning, 3) elif selop in ('set', 'add', 'remove', 'toggle'): import warnings warnings.warn( "The selop argument of selection() is deprecated " - "and will be removed in Python 3.7, " + "and will be removed in Python 3.8, " "use selection_%s() instead" % (selop,), DeprecationWarning, 3) else: From webhook-mailer at python.org Sun Sep 24 08:03:51 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 12:03:51 -0000 Subject: [Python-checkins] [3.6] bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (GH-3667) (#3719) Message-ID: https://github.com/python/cpython/commit/e31eca45e548bf6f439d540f3751516acbc31689 commit: e31eca45e548bf6f439d540f3751516acbc31689 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-24T15:03:48+03:00 summary: [3.6] bpo-27319, bpo-31508: Document deprecation in Treeview.selection(). (GH-3667) (#3719) Defer removing old behavior to 3.8. Document new feature of selection_set() and friends. (cherry picked from commit 2fad10235460ac394cc8b869c41f47aba3d63594) files: M Doc/library/tkinter.ttk.rst M Lib/tkinter/test/test_ttk/test_widgets.py M Lib/tkinter/ttk.py diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst index 3dad182cccd..927f7f3c6c1 100644 --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -1099,26 +1099,42 @@ ttk.Treeview If *selop* is not specified, returns selected items. Otherwise, it will act according to the following selection methods. + .. deprecated-removed:: 3.6 3.8 + Using ``selection()`` for changing the selection state is deprecated. + Use the following selection methods instead. - .. method:: selection_set(items) + + .. method:: selection_set(*items) *items* becomes the new selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + - .. method:: selection_add(items) + .. method:: selection_add(*items) Add *items* to the selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + - .. method:: selection_remove(items) + .. method:: selection_remove(*items) Remove *items* from the selection. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. - .. method:: selection_toggle(items) + + .. method:: selection_toggle(*items) Toggle the selection state of each item in *items*. + .. versionchanged:: 3.6 + *items* can be passed as separate arguments, not just as a single tuple. + .. method:: set(item, column=None, value=None) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py index 26766a8a1fe..ab0db2878e1 100644 --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1556,7 +1556,7 @@ def test_selection(self): self.tv.selection_toggle((c1, c3)) self.assertEqual(self.tv.selection(), (c3, item2)) - if sys.version_info >= (3, 7): + if sys.version_info >= (3, 8): import warnings warnings.warn( 'Deprecated API of Treeview.selection() should be removed') diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py index 2a3e1cec701..635b500579e 100644 --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1404,13 +1404,13 @@ def selection(self, selop=_sentinel, items=None): import warnings warnings.warn( "The selop=None argument of selection() is deprecated " - "and will be removed in Python 3.7", + "and will be removed in Python 3.8", DeprecationWarning, 3) elif selop in ('set', 'add', 'remove', 'toggle'): import warnings warnings.warn( "The selop argument of selection() is deprecated " - "and will be removed in Python 3.7, " + "and will be removed in Python 3.8, " "use selection_%s() instead" % (selop,), DeprecationWarning, 3) else: From webhook-mailer at python.org Sun Sep 24 12:12:56 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 24 Sep 2017 16:12:56 -0000 Subject: [Python-checkins] Update Email library documentation example (GH-3720) Message-ID: https://github.com/python/cpython/commit/8337239d792bc2098c592def5fc3af84c3b0dfd1 commit: 8337239d792bc2098c592def5fc3af84c3b0dfd1 branch: master author: Henk-Jaap Wagenaar committer: Mariatta date: 2017-09-24T09:12:53-07:00 summary: Update Email library documentation example (GH-3720) A `"` was missing from an `` tag. files: M Doc/includes/email-alternative.py diff --git a/Doc/includes/email-alternative.py b/Doc/includes/email-alternative.py index 2e142b1e3b7..df7ca6f3faa 100644 --- a/Doc/includes/email-alternative.py +++ b/Doc/includes/email-alternative.py @@ -32,7 +32,7 @@

        Salut!

        Cela ressemble ? un excellent - recipie d?jeuner.

        From webhook-mailer at python.org Sun Sep 24 12:18:52 2017 From: webhook-mailer at python.org (Mariatta) Date: Sun, 24 Sep 2017 16:18:52 -0000 Subject: [Python-checkins] bpo-31570: Update Email library documentation example (GH-3720) (GH-3721) Message-ID: https://github.com/python/cpython/commit/ce418bf8228c9a6a19702638e5f5c2fb66ad0588 commit: ce418bf8228c9a6a19702638e5f5c2fb66ad0588 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Mariatta date: 2017-09-24T09:18:50-07:00 summary: bpo-31570: Update Email library documentation example (GH-3720) (GH-3721) A `"` was missing from an `` tag. (cherry picked from commit 8337239d792bc2098c592def5fc3af84c3b0dfd1) files: M Doc/includes/email-alternative.py diff --git a/Doc/includes/email-alternative.py b/Doc/includes/email-alternative.py index 2e142b1e3b7..df7ca6f3faa 100644 --- a/Doc/includes/email-alternative.py +++ b/Doc/includes/email-alternative.py @@ -32,7 +32,7 @@

        Salut!

        Cela ressemble ? un excellent - recipie d?jeuner.

        From webhook-mailer at python.org Sun Sep 24 14:27:14 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 18:27:14 -0000 Subject: [Python-checkins] bpo-31285: Fix an assertion failure and a SystemError in warnings.warn_explicit. (#3219) Message-ID: https://github.com/python/cpython/commit/91fb0afe181986b48abfc6092dcca912b39de51d commit: 91fb0afe181986b48abfc6092dcca912b39de51d branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-24T21:27:12+03:00 summary: bpo-31285: Fix an assertion failure and a SystemError in warnings.warn_explicit. (#3219) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-27-21-18-30.bpo-31285.7lzaKV.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 2d0c46f409a..f27ee6ef681 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -794,6 +794,42 @@ def test_stderr_none(self): self.assertNotIn(b'Warning!', stderr) self.assertNotIn(b'Error', stderr) + def test_issue31285(self): + # warn_explicit() should neither raise a SystemError nor cause an + # assertion failure, in case the return value of get_source() has a + # bad splitlines() method. + def get_bad_loader(splitlines_ret_val): + class BadLoader: + def get_source(self, fullname): + class BadSource(str): + def splitlines(self): + return splitlines_ret_val + return BadSource('spam') + return BadLoader() + + wmod = self.module + with original_warnings.catch_warnings(module=wmod): + wmod.filterwarnings('default', category=UserWarning) + + with support.captured_stderr() as stderr: + wmod.warn_explicit( + 'foo', UserWarning, 'bar', 1, + module_globals={'__loader__': get_bad_loader(42), + '__name__': 'foobar'}) + self.assertIn('UserWarning: foo', stderr.getvalue()) + + show = wmod._showwarnmsg + try: + del wmod._showwarnmsg + with support.captured_stderr() as stderr: + wmod.warn_explicit( + 'eggs', UserWarning, 'bar', 1, + module_globals={'__loader__': get_bad_loader([42]), + '__name__': 'foobar'}) + self.assertIn('UserWarning: eggs', stderr.getvalue()) + finally: + wmod._showwarnmsg = show + @support.cpython_only def test_issue31411(self): # warn_explicit() shouldn't raise a SystemError in case diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-27-21-18-30.bpo-31285.7lzaKV.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-27-21-18-30.bpo-31285.7lzaKV.rst new file mode 100644 index 00000000000..61f2c4eff65 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-27-21-18-30.bpo-31285.7lzaKV.rst @@ -0,0 +1,3 @@ +Fix an assertion failure in `warnings.warn_explicit`, when the return value +of the received loader's get_source() has a bad splitlines() method. Patch +by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index f6688b04067..f56e92d2c1b 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -893,9 +893,7 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) } /* Split the source into lines. */ - source_list = PyObject_CallMethodObjArgs(source, - PyId_splitlines.object, - NULL); + source_list = PyUnicode_Splitlines(source, 0); Py_DECREF(source); if (!source_list) return NULL; From webhook-mailer at python.org Sun Sep 24 14:28:45 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 18:28:45 -0000 Subject: [Python-checkins] bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (#3717) Message-ID: https://github.com/python/cpython/commit/5d3e80021ab33360191eb0fbff34e0246c913884 commit: 5d3e80021ab33360191eb0fbff34e0246c913884 branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-24T21:28:42+03:00 summary: bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (#3717) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index f27ee6ef681..e007dc7e39e 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -856,6 +856,16 @@ def test_issue31416(self): self.assertRaises(TypeError): wmod.warn_explicit('foo', Warning, 'bar', 1) + @support.cpython_only + def test_issue31566(self): + # warn() shouldn't cause an assertion failure in case of a bad + # __name__ global. + with original_warnings.catch_warnings(module=self.module): + self.module.filterwarnings('error', category=UserWarning) + with support.swap_item(globals(), '__name__', b'foo'), \ + support.swap_item(globals(), '__file__', None): + self.assertRaises(UserWarning, self.module.warn, 'bar') + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst new file mode 100644 index 00000000000..d3ccfd7a242 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `_warnings.warn()` in case of a bad +``__name__`` global. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index f56e92d2c1b..4ea9fce47cf 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -684,13 +684,14 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); - if (*module == NULL) { + if (*module == Py_None || (*module != NULL && PyUnicode_Check(*module))) { + Py_INCREF(*module); + } + else { *module = PyUnicode_FromString(""); if (*module == NULL) goto handle_error; } - else - Py_INCREF(*module); /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); From webhook-mailer at python.org Sun Sep 24 14:29:24 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 24 Sep 2017 18:29:24 -0000 Subject: [Python-checkins] bpo-30085: Improve documentation for operator (#1171) Message-ID: https://github.com/python/cpython/commit/5b9299d8c72aeadccadd77e4b8132094ba9a1f96 commit: 5b9299d8c72aeadccadd77e4b8132094ba9a1f96 branch: master author: Sanket Dasgupta committer: Terry Jan Reedy date: 2017-09-24T14:29:22-04:00 summary: bpo-30085: Improve documentation for operator (#1171) The dunderless functions are preferred; dunder are retained for back compatilibity. Patch by Sanket Dasgupta. files: A Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst M Doc/library/operator.rst diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 76335b179c5..e4d6d05a23a 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -17,9 +17,10 @@ The :mod:`operator` module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, ``operator.add(x, y)`` is -equivalent to the expression ``x+y``. The function names are those used for -special class methods; variants without leading and trailing ``__`` are also -provided for convenience. +equivalent to the expression ``x+y``. Many function names are those used for +special methods, without the double underscores. For backward compatibility, +many of these have a variant with the double underscores kept. The variants +without the double underscores are preferred for clarity. The functions fall into categories that perform object comparisons, logical operations, mathematical operations and sequence operations. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst b/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst new file mode 100644 index 00000000000..c8be050009c --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst @@ -0,0 +1,2 @@ +The operator functions without double underscores are preferred for clarity. +The one with underscores are only kept for back-compatibility. From webhook-mailer at python.org Sun Sep 24 15:08:43 2017 From: webhook-mailer at python.org (Benjamin Peterson) Date: Sun, 24 Sep 2017 19:08:43 -0000 Subject: [Python-checkins] remove configure check for memmove (#3716) Message-ID: https://github.com/python/cpython/commit/b1d1c422ccb9a1711c2d90660373edce9204adcb commit: b1d1c422ccb9a1711c2d90660373edce9204adcb branch: master author: Benjamin Peterson committer: GitHub date: 2017-09-24T12:08:40-07:00 summary: remove configure check for memmove (#3716) Python requires C implementations provide memmove, so we shouldn't need to check for it. The only place using this configure check was expat, where we can simply always define HAVE_MEMMOVE. files: M Modules/expat/expat_config.h M configure M configure.ac M pyconfig.h.in diff --git a/Modules/expat/expat_config.h b/Modules/expat/expat_config.h index b8c1639b976..afbedd011f6 100644 --- a/Modules/expat/expat_config.h +++ b/Modules/expat/expat_config.h @@ -12,6 +12,8 @@ #define BYTEORDER 1234 #endif +#define HAVE_MEMMOVE 1 + #define XML_NS 1 #define XML_DTD 1 #define XML_CONTEXT_BYTES 1024 diff --git a/configure b/configure index 00dd1f0514a..819dc7a0c16 100755 --- a/configure +++ b/configure @@ -12253,19 +12253,6 @@ fi done -# Stuff for expat. -for ac_func in memmove -do : - ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MEMMOVE 1 -_ACEOF - -fi -done - - # check for long file support functions for ac_func in fseek64 fseeko fstatvfs ftell64 ftello statvfs do : diff --git a/configure.ac b/configure.ac index 88ab6a12157..e90d05d1c8d 100644 --- a/configure.ac +++ b/configure.ac @@ -3684,9 +3684,6 @@ AC_CHECK_FUNCS(forkpty,, ) ) -# Stuff for expat. -AC_CHECK_FUNCS(memmove) - # check for long file support functions AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) diff --git a/pyconfig.h.in b/pyconfig.h.in index 4fc5a3f5a38..d4feabeece3 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -601,9 +601,6 @@ /* Define to 1 if you have the `mbrtowc' function. */ #undef HAVE_MBRTOWC -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H From webhook-mailer at python.org Sun Sep 24 16:14:44 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Sun, 24 Sep 2017 20:14:44 -0000 Subject: [Python-checkins] [3.6] bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (GH-3717) (#3730) Message-ID: https://github.com/python/cpython/commit/415cc1fa57710614ed3384d0cafc58ccf7adee8c commit: 415cc1fa57710614ed3384d0cafc58ccf7adee8c branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-24T23:14:41+03:00 summary: [3.6] bpo-31566: Fix an assertion failure in _warnings.warn() in case of a bad __name__ global. (GH-3717) (#3730) (cherry picked from commit 5d3e80021ab33360191eb0fbff34e0246c913884) files: A Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst M Lib/test/test_warnings/__init__.py M Python/_warnings.c diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 354da6b46f0..a07886c6f54 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -820,6 +820,16 @@ def test_issue31416(self): self.assertRaises(TypeError): wmod.warn_explicit('foo', Warning, 'bar', 1) + @support.cpython_only + def test_issue31566(self): + # warn() shouldn't cause an assertion failure in case of a bad + # __name__ global. + with original_warnings.catch_warnings(module=self.module): + self.module.filterwarnings('error', category=UserWarning) + with support.swap_item(globals(), '__name__', b'foo'), \ + support.swap_item(globals(), '__file__', None): + self.assertRaises(UserWarning, self.module.warn, 'bar') + class WarningsDisplayTests(BaseTest): diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst b/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst new file mode 100644 index 00000000000..d3ccfd7a242 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-09-24-09-57-04.bpo-31566.OxwINs.rst @@ -0,0 +1,2 @@ +Fix an assertion failure in `_warnings.warn()` in case of a bad +``__name__`` global. Patch by Oren Milman. diff --git a/Python/_warnings.c b/Python/_warnings.c index 7270d2c2ecb..b074788f5b6 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -694,13 +694,14 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); - if (*module == NULL) { + if (*module == Py_None || (*module != NULL && PyUnicode_Check(*module))) { + Py_INCREF(*module); + } + else { *module = PyUnicode_FromString(""); if (*module == NULL) goto handle_error; } - else - Py_INCREF(*module); /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); From webhook-mailer at python.org Sun Sep 24 17:13:18 2017 From: webhook-mailer at python.org (Terry Jan Reedy) Date: Sun, 24 Sep 2017 21:13:18 -0000 Subject: [Python-checkins] [3.6] bpo-30085: Improve documentation for operator (GH-1171) (#3736) Message-ID: https://github.com/python/cpython/commit/d38caf68bb417232fb0ccecb5558d7d0ca4a9507 commit: d38caf68bb417232fb0ccecb5558d7d0ca4a9507 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Terry Jan Reedy date: 2017-09-24T17:13:15-04:00 summary: [3.6] bpo-30085: Improve documentation for operator (GH-1171) (#3736) The dunderless functions are preferred; dunder are retained for back compatilibity. Patch by Sanket Dasgupta. (cherry picked from commit 5b9299d8c72aeadccadd77e4b8132094ba9a1f96) files: A Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst M Doc/library/operator.rst diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 8121b480cb6..60bf23a549b 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -17,9 +17,10 @@ The :mod:`operator` module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, ``operator.add(x, y)`` is -equivalent to the expression ``x+y``. The function names are those used for -special class methods; variants without leading and trailing ``__`` are also -provided for convenience. +equivalent to the expression ``x+y``. Many function names are those used for +special methods, without the double underscores. For backward compatibility, +many of these have a variant with the double underscores kept. The variants +without the double underscores are preferred for clarity. The functions fall into categories that perform object comparisons, logical operations, mathematical operations and sequence operations. diff --git a/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst b/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst new file mode 100644 index 00000000000..c8be050009c --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-09-14-18-44-50.bpo-30085.0J9w-u.rst @@ -0,0 +1,2 @@ +The operator functions without double underscores are preferred for clarity. +The one with underscores are only kept for back-compatibility. From webhook-mailer at python.org Sun Sep 24 18:45:03 2017 From: webhook-mailer at python.org (larryhastings) Date: Sun, 24 Sep 2017 22:45:03 -0000 Subject: [Python-checkins] bpo-31568, Travis CI: Fix python3.5 (#3737) Message-ID: https://github.com/python/cpython/commit/70c630a7316f9f6063557786442e3c56502fe8ea commit: 70c630a7316f9f6063557786442e3c56502fe8ea branch: 3.5 author: Victor Stinner committer: larryhastings date: 2017-09-24T15:45:00-07:00 summary: bpo-31568, Travis CI: Fix python3.5 (#3737) Works around Travis CI bug about the python3.5 binary: https://github.com/travis-ci/travis-ci/issues/8363 files: M .travis.yml diff --git a/.travis.yml b/.travis.yml index eb98a657b27..fed0052b54a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,9 @@ matrix: # compiler here and the other to run the coverage build. Clang is preferred # in this instance for its better error messages. env: TESTING=cpython + before_install: + # work around https://github.com/travis-ci/travis-ci/issues/8363 + - pyenv global system 3.5 - os: osx language: c compiler: clang From webhook-mailer at python.org Sun Sep 24 20:58:36 2017 From: webhook-mailer at python.org (larryhastings) Date: Mon, 25 Sep 2017 00:58:36 -0000 Subject: [Python-checkins] [3.5][Security] bpo-30947, bpo-31170: Update expat from 2.2.1 to 2.2.4 (#3354) Message-ID: https://github.com/python/cpython/commit/f2492bb6aae061aea47e21fc7e56b7ab9bfdf543 commit: f2492bb6aae061aea47e21fc7e56b7ab9bfdf543 branch: 3.5 author: Victor Stinner committer: larryhastings date: 2017-09-24T17:58:32-07:00 summary: [3.5][Security] bpo-30947, bpo-31170: Update expat from 2.2.1 to 2.2.4 (#3354) * bpo-30947, bpo-31170: Update expat from 2.2.1 to 2.2.4 * Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security fixes. * Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial characters for UTF-8 input (libexpat bug 115): https://github.com/libexpat/libexpat/issues/115 * Define XML_POOR_ENTROPY when compiling expat files: A Misc/NEWS.d/next/Library/2017-09-05-20-35-21.bpo-31170.QGmJ1t.rst A Misc/NEWS.d/next/Security/2017-09-05-20-34-44.bpo-30947.iNMmm4.rst A Modules/expat/loadlibrary.c M Modules/expat/ascii.h M Modules/expat/asciitab.h M Modules/expat/expat.h M Modules/expat/expat_external.h M Modules/expat/iasciitab.h M Modules/expat/internal.h M Modules/expat/latin1tab.h M Modules/expat/nametab.h M Modules/expat/siphash.h M Modules/expat/utf8tab.h M Modules/expat/winconfig.h M Modules/expat/xmlparse.c M Modules/expat/xmlrole.c M Modules/expat/xmlrole.h M Modules/expat/xmltok.c M Modules/expat/xmltok.h M Modules/expat/xmltok_impl.c M Modules/expat/xmltok_impl.h M Modules/expat/xmltok_ns.c M setup.py diff --git a/Misc/NEWS.d/next/Library/2017-09-05-20-35-21.bpo-31170.QGmJ1t.rst b/Misc/NEWS.d/next/Library/2017-09-05-20-35-21.bpo-31170.QGmJ1t.rst new file mode 100644 index 00000000000..2505007dac0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-05-20-35-21.bpo-31170.QGmJ1t.rst @@ -0,0 +1,3 @@ +expat: Update libexpat from 2.2.3 to 2.2.4. Fix copying of partial +characters for UTF-8 input (libexpat bug 115): +https://github.com/libexpat/libexpat/issues/115 diff --git a/Misc/NEWS.d/next/Security/2017-09-05-20-34-44.bpo-30947.iNMmm4.rst b/Misc/NEWS.d/next/Security/2017-09-05-20-34-44.bpo-30947.iNMmm4.rst new file mode 100644 index 00000000000..3caca9a79b4 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2017-09-05-20-34-44.bpo-30947.iNMmm4.rst @@ -0,0 +1,2 @@ +Upgrade libexpat embedded copy from version 2.2.1 to 2.2.3 to get security +fixes. diff --git a/Modules/expat/ascii.h b/Modules/expat/ascii.h index d10530b09bd..c3587e57332 100644 --- a/Modules/expat/ascii.h +++ b/Modules/expat/ascii.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ASCII_A 0x41 diff --git a/Modules/expat/asciitab.h b/Modules/expat/asciitab.h index 79a15c28ca1..2f59fd92906 100644 --- a/Modules/expat/asciitab.h +++ b/Modules/expat/asciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index 28b0f954d41..d0735bb5c61 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_INCLUDED @@ -24,7 +52,6 @@ extern "C" { struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; -/* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; #define XML_TRUE ((XML_Bool) 1) #define XML_FALSE ((XML_Bool) 0) @@ -1049,7 +1076,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 1 +#define XML_MICRO_VERSION 4 #ifdef __cplusplus } diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index 4c9e5eabdee..81102856496 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_External_INCLUDED diff --git a/Modules/expat/iasciitab.h b/Modules/expat/iasciitab.h index 24a1d5ccc9a..ce4a4bf7ede 100644 --- a/Modules/expat/iasciitab.h +++ b/Modules/expat/iasciitab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index 94cb98e15ca..3c5d6e913d6 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -18,6 +18,35 @@ Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) diff --git a/Modules/expat/latin1tab.h b/Modules/expat/latin1tab.h index 53c25d76b26..95dfa52b1fb 100644 --- a/Modules/expat/latin1tab.h +++ b/Modules/expat/latin1tab.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Modules/expat/loadlibrary.c b/Modules/expat/loadlibrary.c new file mode 100644 index 00000000000..452ae92db26 --- /dev/null +++ b/Modules/expat/loadlibrary.c @@ -0,0 +1,143 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2016 - 2017, Steve Holme, . + * Copyright (C) 2017, Expat development team + * + * All rights reserved. + * Licensed under the MIT license: + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH + * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization of the + * copyright holder. + * + ***************************************************************************/ + +#if defined(_WIN32) + +#include +#include + + +HMODULE _Expat_LoadLibrary(LPCTSTR filename); + + +#if !defined(LOAD_WITH_ALTERED_SEARCH_PATH) +#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008 +#endif + +#if !defined(LOAD_LIBRARY_SEARCH_SYSTEM32) +#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif + +/* We use our own typedef here since some headers might lack these */ +typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD); + +/* See function definitions in winbase.h */ +#ifdef UNICODE +# ifdef _WIN32_WCE +# define LOADLIBARYEX L"LoadLibraryExW" +# else +# define LOADLIBARYEX "LoadLibraryExW" +# endif +#else +# define LOADLIBARYEX "LoadLibraryExA" +#endif + + +/* + * _Expat_LoadLibrary() + * + * This is used to dynamically load DLLs using the most secure method available + * for the version of Windows that we are running on. + * + * Parameters: + * + * filename [in] - The filename or full path of the DLL to load. If only the + * filename is passed then the DLL will be loaded from the + * Windows system directory. + * + * Returns the handle of the module on success; otherwise NULL. + */ +HMODULE _Expat_LoadLibrary(LPCTSTR filename) +{ + HMODULE hModule = NULL; + LOADLIBRARYEX_FN pLoadLibraryEx = NULL; + + /* Get a handle to kernel32 so we can access it's functions at runtime */ + HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32")); + if(!hKernel32) + return NULL; + + /* Attempt to find LoadLibraryEx() which is only available on Windows 2000 + and above */ + pLoadLibraryEx = (LOADLIBRARYEX_FN) GetProcAddress(hKernel32, LOADLIBARYEX); + + /* Detect if there's already a path in the filename and load the library if + there is. Note: Both back slashes and forward slashes have been supported + since the earlier days of DOS at an API level although they are not + supported by command prompt */ + if(_tcspbrk(filename, TEXT("\\/"))) { + /** !checksrc! disable BANNEDFUNC 1 **/ + hModule = pLoadLibraryEx ? + pLoadLibraryEx(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) : + LoadLibrary(filename); + } + /* Detect if KB2533623 is installed, as LOAD_LIBARY_SEARCH_SYSTEM32 is only + supported on Windows Vista, Windows Server 2008, Windows 7 and Windows + Server 2008 R2 with this patch or natively on Windows 8 and above */ + else if(pLoadLibraryEx && GetProcAddress(hKernel32, "AddDllDirectory")) { + /* Load the DLL from the Windows system directory */ + hModule = pLoadLibraryEx(filename, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + } + else { + /* Attempt to get the Windows system path */ + UINT systemdirlen = GetSystemDirectory(NULL, 0); + if(systemdirlen) { + /* Allocate space for the full DLL path (Room for the null terminator + is included in systemdirlen) */ + size_t filenamelen = _tcslen(filename); + TCHAR *path = malloc(sizeof(TCHAR) * (systemdirlen + 1 + filenamelen)); + if(path && GetSystemDirectory(path, systemdirlen)) { + /* Calculate the full DLL path */ + _tcscpy(path + _tcslen(path), TEXT("\\")); + _tcscpy(path + _tcslen(path), filename); + + /* Load the DLL from the Windows system directory */ + /** !checksrc! disable BANNEDFUNC 1 **/ + hModule = pLoadLibraryEx ? + pLoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) : + LoadLibrary(path); + + } + free(path); + } + } + + return hModule; +} + +#else /* defined(_WIN32) */ + +/* ISO C requires a translation unit to contain at least one declaration + [-Wempty-translation-unit] */ +typedef int _TRANSLATION_UNIT_LOAD_LIBRARY_C_NOT_EMTPY; + +#endif /* defined(_WIN32) */ diff --git a/Modules/expat/nametab.h b/Modules/expat/nametab.h index b05e62c77a6..bfa2bd38cd9 100644 --- a/Modules/expat/nametab.h +++ b/Modules/expat/nametab.h @@ -1,3 +1,35 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + static const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, diff --git a/Modules/expat/siphash.h b/Modules/expat/siphash.h index 23b56d2ae48..581872df7b4 100644 --- a/Modules/expat/siphash.h +++ b/Modules/expat/siphash.h @@ -2,9 +2,8 @@ * siphash.h - SipHash-2-4 in a single header file * -------------------------------------------------------------------------- * Derived by William Ahern from the reference implementation[1] published[2] - * by Jean-Philippe Aumasson and Daniel J. Berstein. Licensed in kind. * by Jean-Philippe Aumasson and Daniel J. Berstein. - * Minimal changes by Sebastian Pipping on top, details below. + * Minimal changes by Sebastian Pipping and Victor Stinner on top, see below. * Licensed under the CC0 Public Domain Dedication license. * * 1. https://www.131002.net/siphash/siphash24.c @@ -12,14 +11,25 @@ * -------------------------------------------------------------------------- * HISTORY: * - * 2017-06-10 (Sebastian Pipping) + * 2017-07-25 (Vadim Zeitlin) + * - Fix use of SIPHASH_MAIN macro + * + * 2017-07-05 (Sebastian Pipping) + * - Use _SIP_ULL macro to not require a C++11 compiler if compiled as C++ + * - Add const qualifiers at two places + * - Ensure <=80 characters line length (assuming tab width 4) + * + * 2017-06-23 (Victor Stinner) + * - Address Win64 compile warnings + * + * 2017-06-18 (Sebastian Pipping) * - Clarify license note in the header * - Address C89 issues: * - Stop using inline keyword (and let compiler decide) - * - Turn integer suffix ULL to UL * - Replace _Bool by int * - Turn macro siphash24 into a function * - Address invalid conversion (void pointer) by explicit cast + * - Address lack of stdint.h for Visual Studio 2003 to 2008 * - Always expose sip24_valid (for self-tests) * * 2012-11-04 - Born. (William Ahern) @@ -76,7 +86,23 @@ #define SIPHASH_H #include /* size_t */ -#include /* uint64_t uint32_t uint8_t */ + +#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600) + /* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */ + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +#else + #include /* uint64_t uint32_t uint8_t */ +#endif + + +/* + * Workaround to not require a C++11 compiler for using ULL suffix + * if this code is included and compiled as C++; related GCC warning is: + * warning: use of C++11 long long integer constant [-Wlong-long] + */ +#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low) #define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b)))) @@ -158,11 +184,12 @@ static void sip_round(struct siphash *H, const int rounds) { } /* sip_round() */ -static struct siphash *sip24_init(struct siphash *H, const struct sipkey *key) { - H->v0 = 0x736f6d6570736575UL ^ key->k[0]; - H->v1 = 0x646f72616e646f6dUL ^ key->k[1]; - H->v2 = 0x6c7967656e657261UL ^ key->k[0]; - H->v3 = 0x7465646279746573UL ^ key->k[1]; +static struct siphash *sip24_init(struct siphash *H, + const struct sipkey *key) { + H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0]; + H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1]; + H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0]; + H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1]; H->p = H->buf; H->c = 0; @@ -173,7 +200,8 @@ static struct siphash *sip24_init(struct siphash *H, const struct sipkey *key) { #define sip_endof(a) (&(a)[sizeof (a) / sizeof *(a)]) -static struct siphash *sip24_update(struct siphash *H, const void *src, size_t len) { +static struct siphash *sip24_update(struct siphash *H, const void *src, + size_t len) { const unsigned char *p = (const unsigned char *)src, *pe = p + len; uint64_t m; @@ -198,7 +226,7 @@ static struct siphash *sip24_update(struct siphash *H, const void *src, size_t l static uint64_t sip24_final(struct siphash *H) { - char left = H->p - H->buf; + const char left = (char)(H->p - H->buf); uint64_t b = (H->c + left) << 56; switch (left) { @@ -222,7 +250,8 @@ static uint64_t sip24_final(struct siphash *H) { } /* sip24_final() */ -static uint64_t siphash24(const void *src, size_t len, const struct sipkey *key) { +static uint64_t siphash24(const void *src, size_t len, + const struct sipkey *key) { struct siphash state = SIPHASH_INITIALIZER; return sip24_final(sip24_update(sip24_init(&state, key), src, len)); } /* siphash24() */ @@ -310,10 +339,11 @@ static int sip24_valid(void) { struct sipkey k; size_t i; - sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"); + sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011" + "\012\013\014\015\016\017"); for (i = 0; i < sizeof in; ++i) { - in[i] = i; + in[i] = (unsigned char)i; if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i])) return 0; @@ -323,12 +353,12 @@ static int sip24_valid(void) { } /* sip24_valid() */ -#if SIPHASH_MAIN +#ifdef SIPHASH_MAIN #include int main(void) { - int ok = sip24_valid(); + const int ok = sip24_valid(); if (ok) puts("OK"); diff --git a/Modules/expat/utf8tab.h b/Modules/expat/utf8tab.h index 7bb3e77603f..fa0bed6f5d7 100644 --- a/Modules/expat/utf8tab.h +++ b/Modules/expat/utf8tab.h @@ -1,7 +1,34 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index 9bf014d7fba..17fea468900 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -1,10 +1,33 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef WINCONFIG_H diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index daec151e232..0df68830f05 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,10 +1,38 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - 77fea421d361dca90041d0040ecf1dca651167fadf2af79e990e35168d70d933 (2.2.1+) +/* 8c6b2be7c6281da65ce05218fc15c339f02a811706340824ab596aa86e1fd51a (2.2.4+) + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define _GNU_SOURCE 1 /* syscall prototype */ +#if !defined(_GNU_SOURCE) +# define _GNU_SOURCE 1 /* syscall prototype */ +#endif #include #include /* memset(), memcpy() */ @@ -19,6 +47,8 @@ #include /* gettimeofday() */ #include /* getpid() */ #include /* getpid() */ +#include /* O_RDONLY */ +#include #endif #define XML_BUILDING_EXPAT 1 @@ -33,6 +63,54 @@ #include "expat.h" #include "siphash.h" +#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) +# if defined(HAVE_GETRANDOM) +# include /* getrandom */ +# else +# include /* syscall */ +# include /* SYS_getrandom */ +# endif +# if ! defined(GRND_NONBLOCK) +# define GRND_NONBLOCK 0x0001 +# endif /* defined(GRND_NONBLOCK) */ +#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + +#if defined(HAVE_LIBBSD) \ + && (defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_ARC4RANDOM)) +# include +#endif + +#if defined(_WIN32) && !defined(LOAD_LIBRARY_SEARCH_SYSTEM32) +# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif + +#if !defined(HAVE_GETRANDOM) && !defined(HAVE_SYSCALL_GETRANDOM) \ + && !defined(HAVE_ARC4RANDOM_BUF) && !defined(HAVE_ARC4RANDOM) \ + && !defined(XML_DEV_URANDOM) \ + && !defined(_WIN32) \ + && !defined(XML_POOR_ENTROPY) +# error \ + You do not have support for any sources of high quality entropy \ + enabled. For end user security, that is probably not what you want. \ + \ + Your options include: \ + * Linux + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \ + * Linux + glibc <2.25 (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \ + * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \ + * BSD / macOS <10.7 (arc4random): HAVE_ARC4RANDOM, \ + * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \ + * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \ + * Linux / BSD / macOS (/dev/urandom): XML_DEV_URANDOM \ + * Windows (RtlGenRandom): _WIN32. \ + \ + If insist on not using any of these, bypass this error by defining \ + XML_POOR_ENTROPY; you have been warned. \ + \ + If you have reasons to patch this detection code away or need changes \ + to the build system, please open a bug. Thank you! +#endif + + #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX #define XmlConvert XmlUtf16Convert @@ -436,6 +514,9 @@ static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end); +static XML_Char *copyString(const XML_Char *s, + const XML_Memory_Handling_Suite *memsuite); + static unsigned long generate_hash_secret_salt(XML_Parser parser); static XML_Bool startParsing(XML_Parser parser); @@ -696,21 +777,13 @@ static const XML_Char implicitContext[] = { #if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) -# include - -# if defined(HAVE_GETRANDOM) -# include /* getrandom */ -# else -# include /* syscall */ -# include /* SYS_getrandom */ -# endif /* Obtain entropy on Linux 3.17+ */ static int -writeRandomBytes_getrandom(void * target, size_t count) { +writeRandomBytes_getrandom_nonblock(void * target, size_t count) { int success = 0; /* full count bytes written? */ size_t bytesWrittenTotal = 0; - const unsigned int getrandomFlags = 0; + const unsigned int getrandomFlags = GRND_NONBLOCK; do { void * const currentTarget = (void*)((char*)target + bytesWrittenTotal); @@ -728,7 +801,7 @@ writeRandomBytes_getrandom(void * target, size_t count) { if (bytesWrittenTotal >= count) success = 1; } - } while (! success && (errno == EINTR || errno == EAGAIN)); + } while (! success && (errno == EINTR)); return success; } @@ -736,12 +809,67 @@ writeRandomBytes_getrandom(void * target, size_t count) { #endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ +#if ! defined(_WIN32) && defined(XML_DEV_URANDOM) + +/* Extract entropy from /dev/urandom */ +static int +writeRandomBytes_dev_urandom(void * target, size_t count) { + int success = 0; /* full count bytes written? */ + size_t bytesWrittenTotal = 0; + + const int fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) { + return 0; + } + + do { + void * const currentTarget = (void*)((char*)target + bytesWrittenTotal); + const size_t bytesToWrite = count - bytesWrittenTotal; + + const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite); + + if (bytesWrittenMore > 0) { + bytesWrittenTotal += bytesWrittenMore; + if (bytesWrittenTotal >= count) + success = 1; + } + } while (! success && (errno == EINTR)); + + close(fd); + return success; +} + +#endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */ + + +#if defined(HAVE_ARC4RANDOM) + +static void +writeRandomBytes_arc4random(void * target, size_t count) { + size_t bytesWrittenTotal = 0; + + while (bytesWrittenTotal < count) { + const uint32_t random32 = arc4random(); + size_t i = 0; + + for (; (i < sizeof(random32)) && (bytesWrittenTotal < count); + i++, bytesWrittenTotal++) { + const uint8_t random8 = (uint8_t)(random32 >> (i * 8)); + ((uint8_t *)target)[bytesWrittenTotal] = random8; + } + } +} + +#endif /* defined(HAVE_ARC4RANDOM) */ + + #ifdef _WIN32 typedef BOOLEAN (APIENTRY *RTLGENRANDOM_FUNC)(PVOID, ULONG); +HMODULE _Expat_LoadLibrary(LPCTSTR filename); /* see loadlibrary.c */ /* Obtain entropy on Windows XP / Windows Server 2003 and later. - * Hint on RtlGenRandom and the following article from libsodioum. + * Hint on RtlGenRandom and the following article from libsodium. * * Michael Howard: Cryptographically Secure Random number on Windows without using CryptoAPI * https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/ @@ -749,7 +877,7 @@ typedef BOOLEAN (APIENTRY *RTLGENRANDOM_FUNC)(PVOID, ULONG); static int writeRandomBytes_RtlGenRandom(void * target, size_t count) { int success = 0; /* full count bytes written? */ - const HMODULE advapi32 = LoadLibrary("ADVAPI32.DLL"); + const HMODULE advapi32 = _Expat_LoadLibrary(TEXT("ADVAPI32.DLL")); if (advapi32) { const RTLGENRANDOM_FUNC RtlGenRandom @@ -768,6 +896,8 @@ writeRandomBytes_RtlGenRandom(void * target, size_t count) { #endif /* _WIN32 */ +#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) + static unsigned long gather_time_entropy(void) { @@ -780,16 +910,20 @@ gather_time_entropy(void) int gettimeofday_res; gettimeofday_res = gettimeofday(&tv, NULL); + +#if defined(NDEBUG) + (void)gettimeofday_res; +#else assert (gettimeofday_res == 0); +#endif /* defined(NDEBUG) */ /* Microseconds time is <20 bits entropy */ return tv.tv_usec; #endif } -#if defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_LIBBSD) -# include -#endif +#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */ + static unsigned long ENTROPY_DEBUG(const char * label, unsigned long entropy) { @@ -808,10 +942,12 @@ generate_hash_secret_salt(XML_Parser parser) { unsigned long entropy; (void)parser; -#if defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__) - (void)gather_time_entropy; +#if defined(HAVE_ARC4RANDOM_BUF) arc4random_buf(&entropy, sizeof(entropy)); return ENTROPY_DEBUG("arc4random_buf", entropy); +#elif defined(HAVE_ARC4RANDOM) + writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy)); + return ENTROPY_DEBUG("arc4random", entropy); #else /* Try high quality providers first .. */ #ifdef _WIN32 @@ -819,10 +955,15 @@ generate_hash_secret_salt(XML_Parser parser) return ENTROPY_DEBUG("RtlGenRandom", entropy); } #elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) - if (writeRandomBytes_getrandom((void *)&entropy, sizeof(entropy))) { + if (writeRandomBytes_getrandom_nonblock((void *)&entropy, sizeof(entropy))) { return ENTROPY_DEBUG("getrandom", entropy); } #endif +#if ! defined(_WIN32) && defined(XML_DEV_URANDOM) + if (writeRandomBytes_dev_urandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("/dev/urandom", entropy); + } +#endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */ /* .. and self-made low quality for backup: */ /* Process ID is 0 bits entropy if attacker has local access */ @@ -833,7 +974,7 @@ generate_hash_secret_salt(XML_Parser parser) return ENTROPY_DEBUG("fallback(4)", entropy * 2147483647); } else { return ENTROPY_DEBUG("fallback(8)", - entropy * (unsigned long)2305843009213693951); + entropy * (unsigned long)2305843009213693951ULL); } #endif } @@ -962,6 +1103,8 @@ parserCreate(const XML_Char *encodingName, nsAttsVersion = 0; nsAttsPower = 0; + protocolEncodingName = NULL; + poolInit(&tempPool, &(parser->m_mem)); poolInit(&temp2Pool, &(parser->m_mem)); parserInit(parser, encodingName); @@ -988,9 +1131,9 @@ parserInit(XML_Parser parser, const XML_Char *encodingName) { processor = prologInitProcessor; XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); + if (encodingName != NULL) { + protocolEncodingName = copyString(encodingName, &(parser->m_mem)); + } curBase = NULL; XmlInitEncoding(&initEncoding, &encoding, 0); userData = NULL; @@ -1103,6 +1246,8 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) unknownEncodingRelease(unknownEncodingData); poolClear(&tempPool); poolClear(&temp2Pool); + FREE((void *)protocolEncodingName); + protocolEncodingName = NULL; parserInit(parser, encodingName); dtdReset(_dtd, &parser->m_mem); return XML_TRUE; @@ -1119,10 +1264,16 @@ XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return XML_STATUS_ERROR; + + /* Get rid of any previous encoding name */ + FREE((void *)protocolEncodingName); + if (encodingName == NULL) + /* No new encoding name */ protocolEncodingName = NULL; else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); + /* Copy the new encoding name into allocated memory */ + protocolEncodingName = copyString(encodingName, &(parser->m_mem)); if (!protocolEncodingName) return XML_STATUS_ERROR; } @@ -1357,6 +1508,7 @@ XML_ParserFree(XML_Parser parser) destroyBindings(inheritedBindings, parser); poolDestroy(&tempPool); poolDestroy(&temp2Pool); + FREE((void *)protocolEncodingName); #ifdef XML_DTD /* external parameter entity parsers share the DTD structure parser->m_dtd with the root parser, so we must not destroy it @@ -1748,7 +1900,8 @@ enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { - errorCode = XML_ERROR_INVALID_ARGUMENT; + if (parser != NULL) + parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT; return XML_STATUS_ERROR; } switch (ps_parsing) { @@ -1783,9 +1936,22 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) if (errorCode == XML_ERROR_NONE) { switch (ps_parsing) { case XML_SUSPENDED: + /* It is hard to be certain, but it seems that this case + * cannot occur. This code is cleaning up a previous parse + * with no new data (since len == 0). Changing the parsing + * state requires getting to execute a handler function, and + * there doesn't seem to be an opportunity for that while in + * this circumstance. + * + * Given the uncertainty, we retain the code but exclude it + * from coverage tests. + * + * LCOV_EXCL_START + */ XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return XML_STATUS_SUSPENDED; + /* LCOV_EXCL_STOP */ case XML_INITIALIZED: case XML_PARSING: ps_parsing = XML_FINISHED; @@ -2974,9 +3140,17 @@ doContent(XML_Parser parser, return XML_ERROR_NO_MEMORY; break; default: + /* All of the tokens produced by XmlContentTok() have their own + * explicit cases, so this default is not strictly necessary. + * However it is a useful safety net, so we retain the code and + * simply exclude it from the coverage tests. + * + * LCOV_EXCL_START + */ if (defaultHandler) reportDefault(parser, enc, s, next); break; + /* LCOV_EXCL_STOP */ } *eventPP = s = next; switch (ps_parsing) { @@ -3067,13 +3241,17 @@ storeAtts(XML_Parser parser, const ENCODING *enc, #endif attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) + if (temp == NULL) { + attsSize = oldAttsSize; return XML_ERROR_NO_MEMORY; + } atts = temp; #ifdef XML_ATTR_INFO temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) + if (temp2 == NULL) { + attsSize = oldAttsSize; return XML_ERROR_NO_MEMORY; + } attInfo = temp2; #endif if (n > oldAttsSize) @@ -3210,6 +3388,7 @@ storeAtts(XML_Parser parser, const ENCODING *enc, int j; /* hash table index */ unsigned long version = nsAttsVersion; int nsAttsSize = (int)1 << nsAttsPower; + unsigned char oldNsAttsPower = nsAttsPower; /* size of hash table must be at least 2 * (# of prefixed attributes) */ if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ NS_ATT *temp; @@ -3219,8 +3398,11 @@ storeAtts(XML_Parser parser, const ENCODING *enc, nsAttsPower = 3; nsAttsSize = (int)1 << nsAttsPower; temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) + if (!temp) { + /* Restore actual size of memory in nsAtts */ + nsAttsPower = oldNsAttsPower; return XML_ERROR_NO_MEMORY; + } nsAtts = temp; version = 0; /* force re-initialization of nsAtts hash table */ } @@ -3247,8 +3429,23 @@ storeAtts(XML_Parser parser, const ENCODING *enc, ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); - if (!id || !id->prefix) - return XML_ERROR_NO_MEMORY; + if (!id || !id->prefix) { + /* This code is walking through the appAtts array, dealing + * with (in this case) a prefixed attribute name. To be in + * the array, the attribute must have already been bound, so + * has to have passed through the hash table lookup once + * already. That implies that an entry for it already + * exists, so the lookup above will return a pointer to + * already allocated memory. There is no opportunaity for + * the allocator to fail, so the condition above cannot be + * fulfilled. + * + * Since it is difficult to be certain that the above + * analysis is complete, we retain the test and merely + * remove the code from coverage tests. + */ + return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */ + } b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -3625,8 +3822,16 @@ doCdataSection(XML_Parser parser, } return XML_ERROR_UNCLOSED_CDATA_SECTION; default: + /* Every token returned by XmlCdataSectionTok() has its own + * explicit case, so this default case will never be executed. + * We retain it as a safety net and exclude it from the coverage + * statistics. + * + * LCOV_EXCL_START + */ *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } *eventPP = s = next; @@ -3686,8 +3891,20 @@ doIgnoreSection(XML_Parser parser, eventEndPP = &eventEndPtr; } else { + /* It's not entirely clear, but it seems the following two lines + * of code cannot be executed. The only occasions on which 'enc' + * is not 'parser->m_encoding' are when this function is called + * from the internal entity processing, and IGNORE sections are an + * error in internal entities. + * + * Since it really isn't clear that this is true, we keep the code + * and just remove it from our coverage tests. + * + * LCOV_EXCL_START + */ eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); + /* LCOV_EXCL_STOP */ } *eventPP = s; *startPtr = NULL; @@ -3720,8 +3937,16 @@ doIgnoreSection(XML_Parser parser, } return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ default: + /* All of the tokens that XmlIgnoreSectionTok() returns have + * explicit cases to handle them, so this default case is never + * executed. We keep it as a safety net anyway, and remove it + * from our test coverage statistics. + * + * LCOV_EXCL_START + */ *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } /* not reached */ } @@ -3734,6 +3959,7 @@ initializeEncoding(XML_Parser parser) const char *s; #ifdef XML_UNICODE char encodingBuf[128]; + /* See comments abount `protoclEncodingName` in parserInit() */ if (!protocolEncodingName) s = NULL; else { @@ -3817,7 +4043,14 @@ processXmlDecl(XML_Parser parser, int isGeneralTextEntity, reportDefault(parser, encoding, s, next); if (protocolEncodingName == NULL) { if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { + /* Check that the specified encoding does not conflict with what + * the parser has already deduced. Do we have the same number + * of bytes in the smallest representation of a character? If + * this is UTF-16, is it the same endianness? + */ + if (newEncoding->minBytesPerChar != encoding->minBytesPerChar + || (newEncoding->minBytesPerChar == 2 && + newEncoding != encoding)) { eventPtr = encodingName; return XML_ERROR_INCORRECT_ENCODING; } @@ -3962,15 +4195,14 @@ entityValueInitProcessor(XML_Parser parser, result = processXmlDecl(parser, 0, start, next); if (result != XML_ERROR_NONE) return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: + /* At this point, ps_parsing cannot be XML_SUSPENDED. For that + * to happen, a parameter entity parsing handler must have + * attempted to suspend the parser, which fails and raises an + * error. The parser can be aborted, but can't be suspended. + */ + if (ps_parsing == XML_FINISHED) return XML_ERROR_ABORTED; - default: - *nextPtr = next; - } + *nextPtr = next; /* stop scanning for text declaration - we found one */ processor = entityValueProcessor; return entityValueProcessor(parser, next, end, nextPtr); @@ -4293,8 +4525,14 @@ doProlog(XML_Parser parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; + if (!entity) { + /* The external subset name "#" will have already been + * inserted into the hash table at the start of the + * external entity parsing, so no allocation will happen + * and lookup() cannot fail. + */ + return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */ + } if (useForeignDTD) entity->base = curBase; dtd->paramEntityRead = XML_FALSE; @@ -4773,8 +5011,10 @@ doProlog(XML_Parser parser, if (prologState.level >= groupSize) { if (groupSize) { char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) + if (temp == NULL) { + groupSize /= 2; return XML_ERROR_NO_MEMORY; + } groupConnector = temp; if (dtd->scaffIndex) { int *temp = (int *)REALLOC(dtd->scaffIndex, @@ -4786,8 +5026,10 @@ doProlog(XML_Parser parser, } else { groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) + if (!groupConnector) { + groupSize = 0; return XML_ERROR_NO_MEMORY; + } } } groupConnector[prologState.level] = 0; @@ -4850,8 +5092,29 @@ doProlog(XML_Parser parser, : !dtd->hasParamEntityRefs)) { if (!entity) return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; + else if (!entity->is_internal) { + /* It's hard to exhaustively search the code to be sure, + * but there doesn't seem to be a way of executing the + * following line. There are two cases: + * + * If 'standalone' is false, the DTD must have no + * parameter entities or we wouldn't have passed the outer + * 'if' statement. That measn the only entity in the hash + * table is the external subset name "#" which cannot be + * given as a parameter entity name in XML syntax, so the + * lookup must have returned NULL and we don't even reach + * the test for an internal entity. + * + * If 'standalone' is true, it does not seem to be + * possible to create entities taking this code path that + * are not internal entities, so fail the test above. + * + * Because this analysis is very uncertain, the code is + * being left in place and merely removed from the + * coverage test statistics. + */ + return XML_ERROR_ENTITY_DECLARED_IN_PE; /* LCOV_EXCL_LINE */ + } } else if (!entity) { dtd->keepProcessing = dtd->standalone; @@ -5323,11 +5586,15 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } + /* The XmlEncode() functions can never return 0 here. That + * error return happens if the code point passed in is either + * negative or greater than or equal to 0x110000. The + * XmlCharRefNumber() functions will all return a number + * strictly less than 0x110000 or a negative value if an error + * occurred. The negative value is intercepted above, so + * XmlEncode() is never passed a value it might return an + * error for. + */ for (i = 0; i < n; i++) { if (!poolAppendChar(pool, buf[i])) return XML_ERROR_NO_MEMORY; @@ -5401,8 +5668,26 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, break; } if (entity->open) { - if (enc == encoding) - eventPtr = ptr; + if (enc == encoding) { + /* It does not appear that this line can be executed. + * + * The "if (entity->open)" check catches recursive entity + * definitions. In order to be called with an open + * entity, it must have gone through this code before and + * been through the recursive call to + * appendAttributeValue() some lines below. That call + * sets the local encoding ("enc") to the parser's + * internal encoding (internal_utf8 or internal_utf16), + * which can never be the same as the principle encoding. + * It doesn't appear there is another code path that gets + * here with entity->open being TRUE. + * + * Since it is not certain that this logic is watertight, + * we keep the line and merely exclude it from coverage + * tests. + */ + eventPtr = ptr; /* LCOV_EXCL_LINE */ + } return XML_ERROR_RECURSIVE_ENTITY_REF; } if (entity->notation) { @@ -5429,9 +5714,21 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, } break; default: + /* The only token returned by XmlAttributeValueTok() that does + * not have an explicit case here is XML_TOK_PARTIAL_CHAR. + * Getting that would require an entity name to contain an + * incomplete XML character (e.g. \xE2\x82); however previous + * tokenisers will have already recognised and rejected such + * names before XmlAttributeValueTok() gets a look-in. This + * default case should be retained as a safety net, but the code + * excluded from coverage tests. + * + * LCOV_EXCL_START + */ if (enc == encoding) eventPtr = ptr; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } ptr = next; } @@ -5564,12 +5861,15 @@ storeEntityValue(XML_Parser parser, goto endEntityValue; } n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } + /* The XmlEncode() functions can never return 0 here. That + * error return happens if the code point passed in is either + * negative or greater than or equal to 0x110000. The + * XmlCharRefNumber() functions will all return a number + * strictly less than 0x110000 or a negative value if an error + * occurred. The negative value is intercepted above, so + * XmlEncode() is never passed a value it might return an + * error for. + */ for (i = 0; i < n; i++) { if (pool->end == pool->ptr && !poolGrow(pool)) { result = XML_ERROR_NO_MEMORY; @@ -5590,10 +5890,18 @@ storeEntityValue(XML_Parser parser, result = XML_ERROR_INVALID_TOKEN; goto endEntityValue; default: + /* This default case should be unnecessary -- all the tokens + * that XmlEntityValueTok() can return have their own explicit + * cases -- but should be retained for safety. We do however + * exclude it from the coverage statistics. + * + * LCOV_EXCL_START + */ if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_UNEXPECTED_STATE; goto endEntityValue; + /* LCOV_EXCL_STOP */ } entityTextPtr = next; } @@ -5691,8 +5999,25 @@ reportDefault(XML_Parser parser, const ENCODING *enc, eventEndPP = &eventEndPtr; } else { + /* To get here, two things must be true; the parser must be + * using a character encoding that is not the same as the + * encoding passed in, and the encoding passed in must need + * conversion to the internal format (UTF-8 unless XML_UNICODE + * is defined). The only occasions on which the encoding passed + * in is not the same as the parser's encoding are when it is + * the internal encoding (e.g. a previously defined parameter + * entity, already converted to internal format). This by + * definition doesn't need conversion, so the whole branch never + * gets executed. + * + * For safety's sake we don't delete these lines and merely + * exclude them from coverage statistics. + * + * LCOV_EXCL_START + */ eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); + /* LCOV_EXCL_STOP */ } do { ICHAR *dataPtr = (ICHAR *)dataBuf; @@ -5861,9 +6186,30 @@ getContext(XML_Parser parser) len = dtd->defaultPrefix.binding->uriLen; if (namespaceSeparator) len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) - return NULL; + for (i = 0; i < len; i++) { + if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) { + /* Because of memory caching, I don't believe this line can be + * executed. + * + * This is part of a loop copying the default prefix binding + * URI into the parser's temporary string pool. Previously, + * that URI was copied into the same string pool, with a + * terminating NUL character, as part of setContext(). When + * the pool was cleared, that leaves a block definitely big + * enough to hold the URI on the free block list of the pool. + * The URI copy in getContext() therefore cannot run out of + * memory. + * + * If the pool is used between the setContext() and + * getContext() calls, the worst it can do is leave a bigger + * block on the front of the free list. Given that this is + * all somewhat inobvious and program logic can be changed, we + * don't delete the line but we do exclude it from the test + * coverage statistics. + */ + return NULL; /* LCOV_EXCL_LINE */ + } + } needSep = XML_TRUE; } @@ -5875,8 +6221,15 @@ getContext(XML_Parser parser) PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); if (!prefix) break; - if (!prefix->binding) - continue; + if (!prefix->binding) { + /* This test appears to be (justifiable) paranoia. There does + * not seem to be a way of injecting a prefix without a binding + * that doesn't get errored long before this function is called. + * The test should remain for safety's sake, so we instead + * exclude the following line from the coverage statistics. + */ + continue; /* LCOV_EXCL_LINE */ + } if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) return NULL; for (s = prefix->name; *s; s++) @@ -6547,8 +6900,20 @@ poolCopyString(STRING_POOL *pool, const XML_Char *s) static const XML_Char * poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { - if (!pool->ptr && !poolGrow(pool)) - return NULL; + if (!pool->ptr && !poolGrow(pool)) { + /* The following line is unreachable given the current usage of + * poolCopyStringN(). Currently it is called from exactly one + * place to copy the text of a simple general entity. By that + * point, the name of the entity is already stored in the pool, so + * pool->ptr cannot be NULL. + * + * If poolCopyStringN() is used elsewhere as it well might be, + * this line may well become executable again. Regardless, this + * sort of check shouldn't be removed lightly, so we just exclude + * it from the coverage statistics. + */ + return NULL; /* LCOV_EXCL_LINE */ + } for (; n > 0; --n, s++) { if (!poolAppendChar(pool, *s)) return NULL; @@ -6641,8 +7006,19 @@ poolGrow(STRING_POOL *pool) int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); size_t bytesToAllocate; - if (blockSize < 0) - return XML_FALSE; + // NOTE: Needs to be calculated prior to calling `realloc` + // to avoid dangling pointers: + const ptrdiff_t offsetInsideBlock = pool->ptr - pool->start; + + if (blockSize < 0) { + /* This condition traps a situation where either more than + * INT_MAX/2 bytes have already been allocated. This isn't + * readily testable, since it is unlikely that an average + * machine will have that much memory, so we exclude it from the + * coverage statistics. + */ + return XML_FALSE; /* LCOV_EXCL_LINE */ + } bytesToAllocate = poolBytesToAllocateFor(blockSize); if (bytesToAllocate == 0) @@ -6654,7 +7030,7 @@ poolGrow(STRING_POOL *pool) return XML_FALSE; pool->blocks = temp; pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->ptr = pool->blocks->s + offsetInsideBlock; pool->start = pool->blocks->s; pool->end = pool->start + blockSize; } @@ -6663,8 +7039,18 @@ poolGrow(STRING_POOL *pool) int blockSize = (int)(pool->end - pool->start); size_t bytesToAllocate; - if (blockSize < 0) - return XML_FALSE; + if (blockSize < 0) { + /* This condition traps a situation where either more than + * INT_MAX bytes have already been allocated (which is prevented + * by various pieces of program logic, not least this one, never + * mind the unlikelihood of actually having that much memory) or + * the pool control fields have been corrupted (which could + * conceivably happen in an extremely buggy user handler + * function). Either way it isn't readily testable, so we + * exclude it from the coverage statistics. + */ + return XML_FALSE; /* LCOV_EXCL_LINE */ + } if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; @@ -6827,3 +7213,26 @@ getElementType(XML_Parser parser, } return ret; } + +static XML_Char * +copyString(const XML_Char *s, + const XML_Memory_Handling_Suite *memsuite) +{ + int charsRequired = 0; + XML_Char *result; + + /* First determine how long the string is */ + while (s[charsRequired] != 0) { + charsRequired++; + } + /* Include the terminator */ + charsRequired++; + + /* Now allocate space for the copy */ + result = memsuite->malloc_fcn(charsRequired * sizeof(XML_Char)); + if (result == NULL) + return NULL; + /* Copy the original into place */ + memcpy(result, s, charsRequired * sizeof(XML_Char)); + return result; +} diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c index a7c56302796..708507d575b 100644 --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include @@ -170,7 +198,14 @@ prolog1(PROLOG_STATE *state, case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_BOM: - return XML_ROLE_NONE; + /* This case can never arise. To reach this role function, the + * parse must have passed through prolog0 and therefore have had + * some form of input, even if only a space. At that point, a + * byte order mark is no longer a valid character (though + * technically it should be interpreted as a non-breaking space), + * so will be rejected by the tokenizing stages. + */ + return XML_ROLE_NONE; /* LCOV_EXCL_LINE */ case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), @@ -1285,6 +1320,26 @@ declClose(PROLOG_STATE *state, return common(state, tok); } +/* This function will only be invoked if the internal logic of the + * parser has broken down. It is used in two cases: + * + * 1: When the XML prolog has been finished. At this point the + * processor (the parser level above these role handlers) should + * switch from prologProcessor to contentProcessor and reinitialise + * the handler function. + * + * 2: When an error has been detected (via common() below). At this + * point again the processor should be switched to errorProcessor, + * which will never call a handler. + * + * The result of this is that error() can only be called if the + * processor switch failed to happen, which is an internal error and + * therefore we shouldn't be able to provoke it simply by using the + * library. It is a necessary backstop, however, so we merely exclude + * it from the coverage statistics. + * + * LCOV_EXCL_START + */ static int PTRCALL error(PROLOG_STATE *UNUSED_P(state), int UNUSED_P(tok), @@ -1294,6 +1349,7 @@ error(PROLOG_STATE *UNUSED_P(state), { return XML_ROLE_NONE; } +/* LCOV_EXCL_STOP */ static int FASTCALL common(PROLOG_STATE *state, int tok) diff --git a/Modules/expat/xmlrole.h b/Modules/expat/xmlrole.h index 4dd9f06f976..e5f048eab55 100644 --- a/Modules/expat/xmlrole.h +++ b/Modules/expat/xmlrole.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlRole_INCLUDED diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index cdf0720dd89..007aed0640a 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1,8 +1,38 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include +#include // memcpy #ifdef _WIN32 #include "winconfig.h" @@ -363,22 +393,33 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - char *to; - const char *from; - const char *fromLimInitial = fromLim; + bool input_incomplete = false; + bool output_exhausted = false; + + /* Avoid copying partial characters (due to limited space). */ + const ptrdiff_t bytesAvailable = fromLim - *fromP; + const ptrdiff_t bytesStorable = toLim - *toP; + if (bytesAvailable > bytesStorable) { + fromLim = *fromP + bytesStorable; + output_exhausted = true; + } - /* Avoid copying partial characters. */ + /* Avoid copying partial characters (from incomplete input). */ + const char * const fromLimBefore = fromLim; align_limit_to_full_utf8_characters(*fromP, &fromLim); + if (fromLim < fromLimBefore) { + input_incomplete = true; + } - for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) - *to = *from; - *fromP = from; - *toP = to; + const ptrdiff_t bytesToCopy = fromLim - *fromP; + memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy); + *fromP += bytesToCopy; + *toP += bytesToCopy; - if (fromLim < fromLimInitial) - return XML_CONVERT_INPUT_INCOMPLETE; - else if ((to == toLim) && (from < fromLim)) + if (output_exhausted) // needs to go first return XML_CONVERT_OUTPUT_EXHAUSTED; + else if (input_incomplete) + return XML_CONVERT_INPUT_INCOMPLETE; else return XML_CONVERT_COMPLETED; } @@ -1019,7 +1060,11 @@ streqci(const char *s1, const char *s2) if (ASCII_a <= c1 && c1 <= ASCII_z) c1 += ASCII_A - ASCII_a; if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; + /* The following line will never get executed. streqci() is + * only called from two places, both of which guarantee to put + * upper-case strings into s2. + */ + c2 += ASCII_A - ASCII_a; /* LCOV_EXCL_LINE */ if (c1 != c2) return 0; if (!c1) @@ -1291,7 +1336,7 @@ XmlUtf8Encode(int c, char *buf) }; if (c < 0) - return 0; + return 0; /* LCOV_EXCL_LINE: this case is always eliminated beforehand */ if (c < min2) { buf[0] = (char)(c | UTF8_cval1); return 1; @@ -1314,7 +1359,7 @@ XmlUtf8Encode(int c, char *buf) buf[3] = (char)((c & 0x3f) | 0x80); return 4; } - return 0; + return 0; /* LCOV_EXCL_LINE: this case too is eliminated before calling */ } int FASTCALL @@ -1465,6 +1510,9 @@ XmlInitUnknownEncoding(void *mem, else if (c < 0) { if (c < -4) return 0; + /* Multi-byte sequences need a converter function */ + if (!convert) + return 0; e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); e->utf8[i][0] = 0; e->utf16[i] = 0; diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h index 752007e8b9e..6d31879b331 100644 --- a/Modules/expat/xmltok.h +++ b/Modules/expat/xmltok.h @@ -1,5 +1,33 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlTok_INCLUDED diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c index 5f779c0571b..93328b841a1 100644 --- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_IMPL_C #ifndef IS_INVALID_CHAR @@ -1198,8 +1225,14 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *start; if (ptr >= end) return XML_TOK_NONE; - else if (! HAS_CHAR(enc, ptr, end)) - return XML_TOK_PARTIAL; + else if (! HAS_CHAR(enc, ptr, end)) { + /* This line cannot be executed. The incoming data has already + * been tokenized once, so incomplete characters like this have + * already been eliminated from the input. Retaining the paranoia + * check is still valuable, however. + */ + return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */ + } start = ptr; while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { @@ -1258,8 +1291,14 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *start; if (ptr >= end) return XML_TOK_NONE; - else if (! HAS_CHAR(enc, ptr, end)) - return XML_TOK_PARTIAL; + else if (! HAS_CHAR(enc, ptr, end)) { + /* This line cannot be executed. The incoming data has already + * been tokenized once, so incomplete characters like this have + * already been eliminated from the input. Retaining the paranoia + * check is still valuable, however. + */ + return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */ + } start = ptr; while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { @@ -1614,6 +1653,14 @@ PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, return 0; } +/* This function does not appear to be called from anywhere within the + * library code. It is used via the macro XmlSameName(), which is + * defined but never used. Since it appears in the encoding function + * table, removing it is not a thing to be undertaken lightly. For + * the moment, we simply exclude it from coverage tests. + * + * LCOV_EXCL_START + */ static int PTRCALL PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) { @@ -1677,14 +1724,21 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) } /* not reached */ } +/* LCOV_EXCL_STOP */ static int PTRCALL PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1, const char *end1, const char *ptr2) { for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (end1 - ptr1 < MINBPC(enc)) - return 0; + if (end1 - ptr1 < MINBPC(enc)) { + /* This line cannot be executed. THe incoming data has already + * been tokenized once, so imcomplete characters like this have + * already been eliminated from the input. Retaining the + * paranoia check is still valuable, however. + */ + return 0; /* LCOV_EXCL_LINE */ + } if (!CHAR_MATCHES(enc, ptr1, *ptr2)) return 0; } diff --git a/Modules/expat/xmltok_impl.h b/Modules/expat/xmltok_impl.h index da0ea60a657..a6420f48eed 100644 --- a/Modules/expat/xmltok_impl.h +++ b/Modules/expat/xmltok_impl.h @@ -1,6 +1,33 @@ /* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum { diff --git a/Modules/expat/xmltok_ns.c b/Modules/expat/xmltok_ns.c index c3b88fdf4e3..23d31e8e424 100644 --- a/Modules/expat/xmltok_ns.c +++ b/Modules/expat/xmltok_ns.c @@ -1,8 +1,35 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * diff --git a/setup.py b/setup.py index 40f8bf20ee7..2944c9dd6fa 100644 --- a/setup.py +++ b/setup.py @@ -1472,6 +1472,9 @@ class db_found(Exception): pass expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')] define_macros = [ ('HAVE_EXPAT_CONFIG_H', '1'), + # bpo-30947: Python uses best available entropy sources to + # call XML_SetHashSalt(), expat entropy sources are not needed + ('XML_POOR_ENTROPY', '1'), ] expat_lib = [] expat_sources = ['expat/xmlparse.c', From webhook-mailer at python.org Sun Sep 24 21:03:27 2017 From: webhook-mailer at python.org (Nick Coghlan) Date: Mon, 25 Sep 2017 01:03:27 -0000 Subject: [Python-checkins] [2.7] bpo-31351: Set return code in ensurepip when pip fails (GH-3734) Message-ID: https://github.com/python/cpython/commit/cf7197ae43767c4346864e5b41246f628edd9b51 commit: cf7197ae43767c4346864e5b41246f628edd9b51 branch: 2.7 author: Igor Filatov committer: Nick Coghlan date: 2017-09-25T11:03:24+10:00 summary: [2.7] bpo-31351: Set return code in ensurepip when pip fails (GH-3734) Previously ensurepip would always report success, even if the pip installation failed. (cherry picked from commit 9adda0cdf89432386b7a04444a6199b580d287a1) files: A Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst M Doc/library/ensurepip.rst M Lib/ensurepip/__init__.py M Lib/ensurepip/__main__.py M Lib/ensurepip/_uninstall.py M Lib/test/test_ensurepip.py diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst index a6358e44b15..b6f7120947c 100644 --- a/Doc/library/ensurepip.rst +++ b/Doc/library/ensurepip.rst @@ -76,6 +76,9 @@ options: * ``--no-default-pip``: if a non-default installation is request, the ``pip`` script will *not* be installed. +.. versionchanged:: 2.7.15 + The exit status is non-zero if the command fails. + Module API ---------- diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py index c2abed84ef0..ea2a5e63482 100644 --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py @@ -29,7 +29,7 @@ def _run_pip(args, additional_paths=None): # Install the bundled software import pip - pip.main(args) + return pip.main(args) def version(): @@ -60,6 +60,21 @@ def bootstrap(root=None, upgrade=False, user=False, Note that calling this function will alter both sys.path and os.environ. """ + # Discard the return value + _bootstrap(root=root, upgrade=upgrade, user=user, + altinstall=altinstall, default_pip=default_pip, + verbosity=verbosity) + + +def _bootstrap(root=None, upgrade=False, user=False, + altinstall=False, default_pip=True, + verbosity=0): + """ + Bootstrap pip into the current Python installation (or the given root + directory). Returns pip command status code. + + Note that calling this function will alter both sys.path and os.environ. + """ if altinstall and default_pip: raise ValueError("Cannot use altinstall and default_pip together") @@ -105,11 +120,10 @@ def bootstrap(root=None, upgrade=False, user=False, if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) + return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) finally: shutil.rmtree(tmpdir, ignore_errors=True) - def _uninstall_helper(verbosity=0): """Helper to support a clean default uninstall process on Windows @@ -135,7 +149,7 @@ def _uninstall_helper(verbosity=0): if verbosity: args += ["-" + "v" * verbosity] - _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) + return _run_pip(args + [p[0] for p in reversed(_PROJECTS)]) def _main(argv=None): @@ -196,7 +210,7 @@ def _main(argv=None): args = parser.parse_args(argv) - bootstrap( + return _bootstrap( root=args.root, upgrade=args.upgrade, user=args.user, diff --git a/Lib/ensurepip/__main__.py b/Lib/ensurepip/__main__.py index 77527d7a351..03eef0dd94d 100644 --- a/Lib/ensurepip/__main__.py +++ b/Lib/ensurepip/__main__.py @@ -1,4 +1,5 @@ import ensurepip +import sys if __name__ == "__main__": - ensurepip._main() + sys.exit(ensurepip._main()) diff --git a/Lib/ensurepip/_uninstall.py b/Lib/ensurepip/_uninstall.py index 750365ec4d0..b257904328d 100644 --- a/Lib/ensurepip/_uninstall.py +++ b/Lib/ensurepip/_uninstall.py @@ -2,6 +2,7 @@ import argparse import ensurepip +import sys def _main(argv=None): @@ -23,8 +24,8 @@ def _main(argv=None): args = parser.parse_args(argv) - ensurepip._uninstall_helper(verbosity=args.verbosity) + return ensurepip._uninstall_helper(verbosity=args.verbosity) if __name__ == "__main__": - _main() + sys.exit(_main()) diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py index 3316fcfaa16..cb9d10a1049 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -21,6 +21,7 @@ class EnsurepipMixin: def setUp(self): run_pip_patch = mock.patch("ensurepip._run_pip") self.run_pip = run_pip_patch.start() + self.run_pip.return_value = 0 self.addCleanup(run_pip_patch.stop) # Avoid side effects on the actual os module @@ -258,7 +259,7 @@ def test_bootstrap_version(self): self.assertFalse(self.run_pip.called) def test_basic_bootstrapping(self): - ensurepip._main([]) + exit_code = ensurepip._main([]) self.run_pip.assert_called_once_with( [ @@ -270,6 +271,13 @@ def test_basic_bootstrapping(self): additional_paths = self.run_pip.call_args[0][1] self.assertEqual(len(additional_paths), 2) + self.assertEqual(exit_code, 0) + + def test_bootstrapping_error_code(self): + self.run_pip.return_value = 2 + exit_code = ensurepip._main([]) + self.assertEqual(exit_code, 2) + class TestUninstallationMainFunction(EnsurepipMixin, unittest.TestCase): @@ -284,7 +292,7 @@ def test_uninstall_version(self): def test_basic_uninstall(self): with fake_pip(): - ensurepip._uninstall._main([]) + exit_code = ensurepip._uninstall._main([]) self.run_pip.assert_called_once_with( [ @@ -293,6 +301,13 @@ def test_basic_uninstall(self): ] ) + self.assertEqual(exit_code, 0) + + def test_uninstall_error_code(self): + with fake_pip(): + self.run_pip.return_value = 2 + exit_code = ensurepip._uninstall._main([]) + self.assertEqual(exit_code, 2) if __name__ == "__main__": test.test_support.run_unittest(__name__) diff --git a/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst new file mode 100644 index 00000000000..20f2c1bdc11 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-17-15-24-25.bpo-31351.yQdKv-.rst @@ -0,0 +1,2 @@ +python -m ensurepip now exits with non-zero exit code if pip bootstrapping +has failed. From lp_benchmark_robot at intel.com Sun Sep 24 23:58:46 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Sun, 24 Sep 2017 20:58:46 -0700 Subject: [Python-checkins] [1 down, 64 flat] Results for Python (master branch) 2017-09-22 Message-ID: Results for project python/master, build date: 2017-09-22 15:12:14-07:00. - commit: 058de11 - previous commit: a96c96f - revision date: 2017-09-22 16:08:44-04:00 - environment: Broadwell-EP - cpu: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz 2x22 cores, stepping 1, LLC 55 MB - mem: 128 GB - os: Ubuntu 16.04.2 LTS - kernel: 4.4.0-62-generic x86_64 GNU/Linux Baseline results were generated using release v3.6.0, with hash 5c4568a from 2016-12-22 23:38:47+00:00. +-----+------------------------+--------+------------+------------+------------+ | | |relative|change since|change since|current rev | | | benchmark|std_dev*| last run | baseline |run with PGO| +-----+------------------------+--------+------------+------------+------------+ | :-| | 2to3| 1.059% | +0.731% | +4.123% | +8.206% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method| 0.307% | -1.738% | +16.882% | +15.961% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_method_slots| 0.335% | -1.580% | +18.461% | +14.459% | +-----+------------------------+--------+------------+------------+------------+ | :-( | call_method_unknown| 0.277% | -1.775% | +17.128% | +13.021% | +-----+------------------------+--------+------------+------------+------------+ | :-| | call_simple| 2.127% | -4.621% | +2.922% | +15.284% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chameleon| 1.505% | -0.107% | +11.370% | +10.137% | +-----+------------------------+--------+------------+------------+------------+ | :-| | chaos| 1.384% | +0.998% | +8.295% | +10.764% | +-----+------------------------+--------+------------+------------+------------+ | :-| | crypto_pyaes| 0.564% | +2.027% | +2.752% | +6.658% | +-----+------------------------+--------+------------+------------+------------+ | :-| | deltablue| 4.050% | +0.754% | +6.574% | +18.709% | +-----+------------------------+--------+------------+------------+------------+ | :-| | django_template| 2.236% | +0.036% | +9.865% | +12.602% | +-----+------------------------+--------+------------+------------+------------+ | :-| | dulwich_log| 1.260% | +0.456% | +3.382% | +5.871% | +-----+------------------------+--------+------------+------------+------------+ | :-| | fannkuch| 0.726% | +1.465% | +7.638% | +3.270% | +-----+------------------------+--------+------------+------------+------------+ | :-| | float| 0.742% | +0.396% | +4.073% | +5.325% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_text| 1.309% | +0.344% | +8.594% | +11.236% | +-----+------------------------+--------+------------+------------+------------+ | :-| | genshi_xml| 1.456% | -1.126% | +6.872% | +9.528% | +-----+------------------------+--------+------------+------------+------------+ | :-| | go| 1.037% | +0.625% | +7.272% | +9.078% | +-----+------------------------+--------+------------+------------+------------+ | :-| | hexiom| 0.490% | +0.080% | +9.537% | +11.648% | +-----+------------------------+--------+------------+------------+------------+ | :-| | html5lib| 3.064% | +2.150% | +8.993% | +8.387% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_dumps| 2.096% | -1.097% | +4.303% | +9.016% | +-----+------------------------+--------+------------+------------+------------+ | :-| | json_loads| 1.277% | -0.058% | +2.590% | +10.702% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_format| 1.489% | +0.317% | +7.915% | +10.625% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_silent| 2.235% | +1.286% | +46.888% | +11.681% | +-----+------------------------+--------+------------+------------+------------+ | :-| | logging_simple| 1.647% | -0.186% | +8.133% | +11.124% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mako| 0.606% | +0.810% | +18.559% | +11.772% | +-----+------------------------+--------+------------+------------+------------+ | :-| | mdp| 1.002% | +0.172% | +8.504% | +9.457% | +-----+------------------------+--------+------------+------------+------------+ | :-| | meteor_contest| 1.670% | -0.606% | +3.266% | +6.120% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nbody| 0.524% | +0.174% | -0.508% | +1.557% | +-----+------------------------+--------+------------+------------+------------+ | :-| | nqueens| 0.972% | -0.349% | +2.044% | +8.452% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pathlib| 1.455% | +1.450% | +5.495% | +9.424% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle| 1.220% | -0.204% | +1.737% | +20.991% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_dict| 0.233% | -0.790% | +3.719% | +20.830% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_list| 0.774% | +0.138% | +7.070% | +18.408% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pickle_pure_python| 4.618% | +0.474% | +12.356% | +8.870% | +-----+------------------------+--------+------------+------------+------------+ | :-| | pidigits| 0.520% | +0.097% | +0.427% | +9.708% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup| 0.124% | -0.252% | +9.351% | +5.106% | +-----+------------------------+--------+------------+------------+------------+ | :-| | python_startup_no_site| 0.098% | -0.150% | +1.441% | +4.939% | +-----+------------------------+--------+------------+------------+------------+ | :-| | raytrace| 1.237% | +1.180% | +9.880% | +12.540% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_compile| 4.836% | -0.547% | -8.752% | +12.196% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_dna| 0.366% | +0.179% | -1.908% | +12.359% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_effbot| 2.880% | -0.172% | -1.998% | +6.925% | +-----+------------------------+--------+------------+------------+------------+ | :-| | regex_v8| 1.156% | +0.397% | +8.425% | +6.157% | +-----+------------------------+--------+------------+------------+------------+ | :-| | richards| 1.999% | -0.993% | +6.441% | +13.918% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_fft| 1.458% | +0.911% | +1.891% | +1.278% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_lu| 2.162% | +0.063% | +26.312% | +9.415% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_monte_carlo| 2.380% | +0.496% | +6.077% | +4.544% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sor| 0.881% | +0.298% | +15.342% | +8.420% | +-----+------------------------+--------+------------+------------+------------+ | :-| | scimark_sparse_mat_mult| 0.681% | +0.193% | +4.861% | -5.556% | +-----+------------------------+--------+------------+------------+------------+ | :-| | spectral_norm| 0.599% | +1.367% | +6.163% | +1.822% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_declarative| 0.881% | -0.385% | +5.022% | +8.913% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlalchemy_imperative| 3.262% | +0.505% | +4.975% | +4.978% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sqlite_synth| 2.831% | +0.803% | +3.247% | +8.023% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_expand| 2.605% | -0.938% | +11.751% | +8.802% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_integrate| 2.011% | +0.133% | +9.751% | +7.727% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_str| 3.877% | +1.009% | +11.618% | +9.576% | +-----+------------------------+--------+------------+------------+------------+ | :-| | sympy_sum| 5.292% | -1.212% | +9.822% | +13.335% | +-----+------------------------+--------+------------+------------+------------+ | :-| | telco| 4.500% | +1.239% | +24.024% | +10.195% | +-----+------------------------+--------+------------+------------+------------+ | :-| | tornado_http| 1.291% | -0.526% | +6.263% | +6.392% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpack_sequence| 0.862% | +0.973% | +2.464% | -0.480% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle| 8.997% | +0.462% | +7.003% | +19.857% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_list| 0.850% | -2.029% | +0.477% | +18.160% | +-----+------------------------+--------+------------+------------+------------+ | :-| | unpickle_pure_python| 2.728% | +0.242% | +7.582% | +6.670% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_generate| 1.050% | -0.305% | +6.610% | +7.049% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_iterparse| 2.500% | +0.186% | +1.096% | +7.568% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_parse| 1.594% | -0.806% | -5.535% | +11.929% | +-----+------------------------+--------+------------+------------+------------+ | :-| | xml_etree_process| 1.689% | -0.431% | +7.589% | +7.020% | +-----+------------------------+--------+------------+------------+------------+ * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/1-down-64-flat-results-for-python-master-branch-2017-09-22 Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From webhook-mailer at python.org Mon Sep 25 03:52:12 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 07:52:12 -0000 Subject: [Python-checkins] bpo-18558: Clarify glossary entry for "Iterable" (#3732) Message-ID: https://github.com/python/cpython/commit/0bf287b6e0a42877b06cbea5d0fe6474d8061caa commit: 0bf287b6e0a42877b06cbea5d0fe6474d8061caa branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-25T00:52:06-07:00 summary: bpo-18558: Clarify glossary entry for "Iterable" (#3732) files: M Doc/glossary.rst M Doc/library/collections.abc.rst diff --git a/Doc/glossary.rst b/Doc/glossary.rst index dba9186d935..b947520b96b 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -535,7 +535,10 @@ Glossary iterables include all sequence types (such as :class:`list`, :class:`str`, and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:`file objects `, and objects of any classes you define - with an :meth:`__iter__` or :meth:`__getitem__` method. Iterables can be + with an :meth:`__iter__` method or with a :meth:`__getitem__` method + that implements :term:`Sequence` semantics. + + Iterables can be used in a :keyword:`for` loop and in many other places where a sequence is needed (:func:`zip`, :func:`map`, ...). When an iterable object is passed as an argument to the built-in function :func:`iter`, it returns an diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst index 58b03b9bd76..60154532094 100644 --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -107,7 +107,12 @@ ABC Inherits from Abstract Methods Mixin .. class:: Iterable ABC for classes that provide the :meth:`__iter__` method. - See also the definition of :term:`iterable`. + + Checking ``isinstance(obj, Iterable)`` detects classes that are registered + as :class:`Iterable` or that have an :meth:`__iter__` method, but it does + not detect classes that iterate with the :meth:`__getitem__` method. + The only reliable way to determine whether an object is :term:`iterable` + is to call ``iter(obj)``. .. class:: Collection From webhook-mailer at python.org Mon Sep 25 03:57:26 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 07:57:26 -0000 Subject: [Python-checkins] [3.6] bpo-18558: Clarify glossary entry for "Iterable" (GH-3732) (#3741) Message-ID: https://github.com/python/cpython/commit/01438ed4c22ca150da1cc5c38d83a59b0b6a62a7 commit: 01438ed4c22ca150da1cc5c38d83a59b0b6a62a7 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2017-09-25T00:57:24-07:00 summary: [3.6] bpo-18558: Clarify glossary entry for "Iterable" (GH-3732) (#3741) (cherry picked from commit 0bf287b6e0a42877b06cbea5d0fe6474d8061caa) files: M Doc/glossary.rst M Doc/library/collections.abc.rst diff --git a/Doc/glossary.rst b/Doc/glossary.rst index dba9186d935..b947520b96b 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -535,7 +535,10 @@ Glossary iterables include all sequence types (such as :class:`list`, :class:`str`, and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:`file objects `, and objects of any classes you define - with an :meth:`__iter__` or :meth:`__getitem__` method. Iterables can be + with an :meth:`__iter__` method or with a :meth:`__getitem__` method + that implements :term:`Sequence` semantics. + + Iterables can be used in a :keyword:`for` loop and in many other places where a sequence is needed (:func:`zip`, :func:`map`, ...). When an iterable object is passed as an argument to the built-in function :func:`iter`, it returns an diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst index 58b03b9bd76..60154532094 100644 --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -107,7 +107,12 @@ ABC Inherits from Abstract Methods Mixin .. class:: Iterable ABC for classes that provide the :meth:`__iter__` method. - See also the definition of :term:`iterable`. + + Checking ``isinstance(obj, Iterable)`` detects classes that are registered + as :class:`Iterable` or that have an :meth:`__iter__` method, but it does + not detect classes that iterate with the :meth:`__getitem__` method. + The only reliable way to determine whether an object is :term:`iterable` + is to call ``iter(obj)``. .. class:: Collection From webhook-mailer at python.org Mon Sep 25 04:05:52 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 08:05:52 -0000 Subject: [Python-checkins] bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (#3739) Message-ID: https://github.com/python/cpython/commit/0d4497b9cae7942b7f731a6f99a73985c3fb4630 commit: 0d4497b9cae7942b7f731a6f99a73985c3fb4630 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-25T01:05:49-07:00 summary: bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (#3739) files: M Doc/howto/descriptor.rst diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index b34937585ea..5e85a9aa659 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -180,7 +180,7 @@ descriptor is useful for monitoring just a few chosen attributes:: The protocol is simple and offers exciting possibilities. Several use cases are so common that they have been packaged into individual function calls. -Properties, bound and unbound methods, static methods, and class methods are all +Properties, bound methods, static methods, and class methods are all based on the descriptor protocol. @@ -266,22 +266,23 @@ Python's object oriented features are built upon a function based environment. Using non-data descriptors, the two are merged seamlessly. Class dictionaries store methods as functions. In a class definition, methods -are written using :keyword:`def` and :keyword:`lambda`, the usual tools for -creating functions. The only difference from regular functions is that the +are written using :keyword:`def` or :keyword:`lambda`, the usual tools for +creating functions. Methods only differ from regular functions in that the first argument is reserved for the object instance. By Python convention, the instance reference is called *self* but may be called *this* or any other variable name. To support method calls, functions include the :meth:`__get__` method for binding methods during attribute access. This means that all functions are -non-data descriptors which return bound or unbound methods depending whether -they are invoked from an object or a class. In pure python, it works like -this:: +non-data descriptors which return bound methods when they are invoked from an +object. In pure python, it works like this:: class Function(object): . . . def __get__(self, obj, objtype=None): "Simulate func_descr_get() in Objects/funcobject.c" + if obj is None: + return self return types.MethodType(self, obj) Running the interpreter shows how the function descriptor works in practice:: @@ -291,25 +292,34 @@ Running the interpreter shows how the function descriptor works in practice:: ... return x ... >>> d = D() - >>> D.__dict__['f'] # Stored internally as a function - - >>> D.f # Get from a class becomes an unbound method - - >>> d.f # Get from an instance becomes a bound method + + # Access through the class dictionary does not invoke __get__. + # It just returns the underlying function object. + >>> D.__dict__['f'] + + + # Dotted access from a class calls __get__() which just returns + # the underlying function unchanged. + >>> D.f + + + # The function has a __qualname__ attribute to support introspection + >>> D.f.__qualname__ + 'D.f' + + # Dotted access from an instance calls __get__() which returns the + # function wrapped in a bound method object + >>> d.f > -The output suggests that bound and unbound methods are two different types. -While they could have been implemented that way, the actual C implementation of -:c:type:`PyMethod_Type` in :source:`Objects/classobject.c` is a single object -with two different representations depending on whether the :attr:`im_self` -field is set or is *NULL* (the C equivalent of ``None``). - -Likewise, the effects of calling a method object depend on the :attr:`im_self` -field. If set (meaning bound), the original function (stored in the -:attr:`im_func` field) is called as expected with the first argument set to the -instance. If unbound, all of the arguments are passed unchanged to the original -function. The actual C implementation of :func:`instancemethod_call()` is only -slightly more complex in that it includes some type checking. + # Internally, the bound method stores the underlying function, + # the bound instance, and the class of the bound instance. + >>> d.f.__func__ + + >>> d.f.__self__ + <__main__.D object at 0x1012e1f98> + >>> d.f.__class__ + Static Methods and Class Methods From webhook-mailer at python.org Mon Sep 25 04:09:14 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 25 Sep 2017 08:09:14 -0000 Subject: [Python-checkins] bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (#3254) Message-ID: https://github.com/python/cpython/commit/57c2561c8c5663aef55b00e3f29cba575ff36ccd commit: 57c2561c8c5663aef55b00e3f29cba575ff36ccd branch: master author: Oren Milman committer: Serhiy Storchaka date: 2017-09-25T11:09:11+03:00 summary: bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (#3254) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst M Lib/ctypes/test/test_parameters.py M Modules/_ctypes/_ctypes.c diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py index 4eaa15aff42..e4c25fd880c 100644 --- a/Lib/ctypes/test/test_parameters.py +++ b/Lib/ctypes/test/test_parameters.py @@ -1,5 +1,6 @@ import unittest from ctypes.test import need_symbol +import test.support class SimpleTypesTestCase(unittest.TestCase): @@ -180,6 +181,26 @@ def test_abstract(self): self.assertRaises(TypeError, _Pointer.from_param, 42) self.assertRaises(TypeError, _SimpleCData.from_param, 42) + @test.support.cpython_only + def test_issue31311(self): + # __setstate__ should neither raise a SystemError nor crash in case + # of a bad __dict__. + from ctypes import Structure + + class BadStruct(Structure): + @property + def __dict__(self): + pass + with self.assertRaises(TypeError): + BadStruct().__setstate__({}, b'foo') + + class WorseStruct(Structure): + @property + def __dict__(self): + 1/0 + with self.assertRaises(ZeroDivisionError): + WorseStruct().__setstate__({}, b'foo') + ################################################################ if __name__ == '__main__': diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst new file mode 100644 index 00000000000..db51cd2d586 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst @@ -0,0 +1,2 @@ +Fix a crash in the ``__setstate__()`` method of `ctypes._CData`, in case of +a bad ``__dict__``. Patch by Oren Milman. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 8afb8cc1f16..eaaedfa413f 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -2674,6 +2674,16 @@ PyCData_setstate(PyObject *myself, PyObject *args) len = self->b_size; memmove(self->b_ptr, data, len); mydict = PyObject_GetAttrString(myself, "__dict__"); + if (mydict == NULL) { + return NULL; + } + if (!PyDict_Check(mydict)) { + PyErr_Format(PyExc_TypeError, + "%.200s.__dict__ must be a dictionary, not %.200s", + Py_TYPE(myself)->tp_name, Py_TYPE(mydict)->tp_name); + Py_DECREF(mydict); + return NULL; + } res = PyDict_Update(mydict, dict); Py_DECREF(mydict); if (res == -1) From webhook-mailer at python.org Mon Sep 25 04:11:24 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 08:11:24 -0000 Subject: [Python-checkins] [3.6] bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (GH-3739) (#3742) Message-ID: https://github.com/python/cpython/commit/73c915a5cd1cdd8775cf47b77fef7ca8fd42ad96 commit: 73c915a5cd1cdd8775cf47b77fef7ca8fd42ad96 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2017-09-25T01:11:21-07:00 summary: [3.6] bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (GH-3739) (#3742) (cherry picked from commit 0d4497b9cae7942b7f731a6f99a73985c3fb4630) files: M Doc/howto/descriptor.rst diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index b34937585ea..5e85a9aa659 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -180,7 +180,7 @@ descriptor is useful for monitoring just a few chosen attributes:: The protocol is simple and offers exciting possibilities. Several use cases are so common that they have been packaged into individual function calls. -Properties, bound and unbound methods, static methods, and class methods are all +Properties, bound methods, static methods, and class methods are all based on the descriptor protocol. @@ -266,22 +266,23 @@ Python's object oriented features are built upon a function based environment. Using non-data descriptors, the two are merged seamlessly. Class dictionaries store methods as functions. In a class definition, methods -are written using :keyword:`def` and :keyword:`lambda`, the usual tools for -creating functions. The only difference from regular functions is that the +are written using :keyword:`def` or :keyword:`lambda`, the usual tools for +creating functions. Methods only differ from regular functions in that the first argument is reserved for the object instance. By Python convention, the instance reference is called *self* but may be called *this* or any other variable name. To support method calls, functions include the :meth:`__get__` method for binding methods during attribute access. This means that all functions are -non-data descriptors which return bound or unbound methods depending whether -they are invoked from an object or a class. In pure python, it works like -this:: +non-data descriptors which return bound methods when they are invoked from an +object. In pure python, it works like this:: class Function(object): . . . def __get__(self, obj, objtype=None): "Simulate func_descr_get() in Objects/funcobject.c" + if obj is None: + return self return types.MethodType(self, obj) Running the interpreter shows how the function descriptor works in practice:: @@ -291,25 +292,34 @@ Running the interpreter shows how the function descriptor works in practice:: ... return x ... >>> d = D() - >>> D.__dict__['f'] # Stored internally as a function - - >>> D.f # Get from a class becomes an unbound method - - >>> d.f # Get from an instance becomes a bound method + + # Access through the class dictionary does not invoke __get__. + # It just returns the underlying function object. + >>> D.__dict__['f'] + + + # Dotted access from a class calls __get__() which just returns + # the underlying function unchanged. + >>> D.f + + + # The function has a __qualname__ attribute to support introspection + >>> D.f.__qualname__ + 'D.f' + + # Dotted access from an instance calls __get__() which returns the + # function wrapped in a bound method object + >>> d.f > -The output suggests that bound and unbound methods are two different types. -While they could have been implemented that way, the actual C implementation of -:c:type:`PyMethod_Type` in :source:`Objects/classobject.c` is a single object -with two different representations depending on whether the :attr:`im_self` -field is set or is *NULL* (the C equivalent of ``None``). - -Likewise, the effects of calling a method object depend on the :attr:`im_self` -field. If set (meaning bound), the original function (stored in the -:attr:`im_func` field) is called as expected with the first argument set to the -instance. If unbound, all of the arguments are passed unchanged to the original -function. The actual C implementation of :func:`instancemethod_call()` is only -slightly more complex in that it includes some type checking. + # Internally, the bound method stores the underlying function, + # the bound instance, and the class of the bound instance. + >>> d.f.__func__ + + >>> d.f.__self__ + <__main__.D object at 0x1012e1f98> + >>> d.f.__class__ + Static Methods and Class Methods From webhook-mailer at python.org Mon Sep 25 04:21:09 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 08:21:09 -0000 Subject: [Python-checkins] bpo-27385: Clarify docstring for groupby() (#3738) Message-ID: https://github.com/python/cpython/commit/49392c63a243052c8013bef80d35202bb6d7c404 commit: 49392c63a243052c8013bef80d35202bb6d7c404 branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-25T01:21:06-07:00 summary: bpo-27385: Clarify docstring for groupby() (#3738) files: M Doc/library/itertools.rst M Modules/itertoolsmodule.c diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 530c29dec4a..fa6c340bb7b 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -53,7 +53,7 @@ Iterator Arguments Results :func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F`` :func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1`` :func:`filterfalse` pred, seq elements of seq where pred(elem) is false ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8`` -:func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v) +:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v) :func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G`` :func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000`` :func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4`` diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 2ac5ab24ec8..cc9895a942d 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -176,8 +176,9 @@ static PyMethodDef groupby_methods[] = { }; PyDoc_STRVAR(groupby_doc, -"groupby(iterable[, keyfunc]) -> create an iterator which returns\n\ -(key, sub-iterator) grouped by each value of key(value).\n"); +"groupby(iterable, key=None) -> make an iterator that returns consecutive\n\ +keys and groups from the iterable. If the key function is not specified or\n\ +is None, the element itself is used for grouping.\n"); static PyTypeObject groupby_type = { PyVarObject_HEAD_INIT(NULL, 0) From webhook-mailer at python.org Mon Sep 25 04:27:37 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 25 Sep 2017 08:27:37 -0000 Subject: [Python-checkins] bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) Message-ID: https://github.com/python/cpython/commit/e6d9fcbb8d0c325e57df08ae8781aafedb71eca2 commit: e6d9fcbb8d0c325e57df08ae8781aafedb71eca2 branch: master author: Victor Stinner committer: GitHub date: 2017-09-25T01:27:34-07:00 summary: bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) Non-regression tests for the Expat 2.2.3 UTF-8 decoder bug. files: A Lib/test/xmltestdata/expat224_utf8_bug.xml M Lib/test/test_xml_etree.py diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index baa4e1f5342..661ad8b9d4d 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -34,6 +34,7 @@ except UnicodeEncodeError: raise unittest.SkipTest("filename is not encodable to utf8") SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir="xmltestdata") +UTF8_BUG_XMLFILE = findfile("expat224_utf8_bug.xml", subdir="xmltestdata") SAMPLE_XML = """\ @@ -1739,6 +1740,37 @@ def __eq__(self, other): self.assertIsInstance(e[0].tag, str) self.assertEqual(e[0].tag, 'changed') + def check_expat224_utf8_bug(self, text): + xml = b'' % text + root = ET.XML(xml) + self.assertEqual(root.get('b'), text.decode('utf-8')) + + def test_expat224_utf8_bug(self): + # bpo-31170: Expat 2.2.3 had a bug in its UTF-8 decoder. + # Check that Expat 2.2.4 fixed the bug. + # + # Test buffer bounds at odd and even positions. + + text = b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + text = b'x' + b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + def test_expat224_utf8_bug_file(self): + with open(UTF8_BUG_XMLFILE, 'rb') as fp: + raw = fp.read() + root = ET.fromstring(raw) + xmlattr = root.get('b') + + # "Parse" manually the XML file to extract the value of the 'b' + # attribute of the XML element + text = raw.decode('utf-8').strip() + text = text.replace('\r\n', ' ') + text = text[6:-4] + self.assertEqual(root.get('b'), text) + + # -------------------------------------------------------------------- diff --git a/Lib/test/xmltestdata/expat224_utf8_bug.xml b/Lib/test/xmltestdata/expat224_utf8_bug.xml new file mode 100644 index 00000000000..d66a8e6b50f --- /dev/null +++ b/Lib/test/xmltestdata/expat224_utf8_bug.xml @@ -0,0 +1,2 @@ + From webhook-mailer at python.org Mon Sep 25 04:41:52 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 08:41:52 -0000 Subject: [Python-checkins] [3.6] bpo-27385: Clarify docstring for groupby() (GH-3738) (#3744) Message-ID: https://github.com/python/cpython/commit/e2a30cd35b95dad55aea10347655f246348d1951 commit: e2a30cd35b95dad55aea10347655f246348d1951 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Raymond Hettinger date: 2017-09-25T01:41:49-07:00 summary: [3.6] bpo-27385: Clarify docstring for groupby() (GH-3738) (#3744) (cherry picked from commit 49392c63a243052c8013bef80d35202bb6d7c404) files: M Doc/library/itertools.rst M Modules/itertoolsmodule.c diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index b0d0a8c8c8c..86a590bb67c 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -53,7 +53,7 @@ Iterator Arguments Results :func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F`` :func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1`` :func:`filterfalse` pred, seq elements of seq where pred(elem) is false ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8`` -:func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v) +:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v) :func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G`` :func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000`` :func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4`` diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 8e22ec9c4b7..21c0e8297a7 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -174,8 +174,9 @@ static PyMethodDef groupby_methods[] = { }; PyDoc_STRVAR(groupby_doc, -"groupby(iterable[, keyfunc]) -> create an iterator which returns\n\ -(key, sub-iterator) grouped by each value of key(value).\n"); +"groupby(iterable, key=None) -> make an iterator that returns consecutive\n\ +keys and groups from the iterable. If the key function is not specified or\n\ +is None, the element itself is used for grouping.\n"); static PyTypeObject groupby_type = { PyVarObject_HEAD_INIT(NULL, 0) From webhook-mailer at python.org Mon Sep 25 04:43:59 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 25 Sep 2017 08:43:59 -0000 Subject: [Python-checkins] bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) (#3745) Message-ID: https://github.com/python/cpython/commit/5f5da728aec9c4f74cc771fbf30037b64a447514 commit: 5f5da728aec9c4f74cc771fbf30037b64a447514 branch: 2.7 author: Victor Stinner committer: GitHub date: 2017-09-25T01:43:56-07:00 summary: bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) (#3745) Non-regression tests for the Expat 2.2.3 UTF-8 decoder bug. (cherry picked from commit e6d9fcbb8d0c325e57df08ae8781aafedb71eca2) files: A Lib/test/xmltestdata/expat224_utf8_bug.xml M Lib/test/test_xml_etree.py diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 55d70101233..e466867b7cd 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -30,6 +30,7 @@ SIMPLE_XMLFILE = findfile("simple.xml", subdir="xmltestdata") SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir="xmltestdata") +UTF8_BUG_XMLFILE = findfile("expat224_utf8_bug.xml", subdir="xmltestdata") SAMPLE_XML = """\ @@ -1494,6 +1495,36 @@ def test_issue10777(self): ET.register_namespace('test10777', 'http://myuri/') ET.register_namespace('test10777', 'http://myuri/') + def check_expat224_utf8_bug(self, text): + xml = b'' % text + root = ET.XML(xml) + self.assertEqual(root.get('b'), text.decode('utf-8')) + + def test_expat224_utf8_bug(self): + # bpo-31170: Expat 2.2.3 had a bug in its UTF-8 decoder. + # Check that Expat 2.2.4 fixed the bug. + # + # Test buffer bounds at odd and even positions. + + text = b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + text = b'x' + b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + def test_expat224_utf8_bug_file(self): + with open(UTF8_BUG_XMLFILE, 'rb') as fp: + raw = fp.read() + root = ET.fromstring(raw) + xmlattr = root.get('b') + + # "Parse" manually the XML file to extract the value of the 'b' + # attribute of the XML element + text = raw.decode('utf-8').strip() + text = text.replace('\r\n', ' ') + text = text[6:-4] + self.assertEqual(root.get('b'), text) + # -------------------------------------------------------------------- diff --git a/Lib/test/xmltestdata/expat224_utf8_bug.xml b/Lib/test/xmltestdata/expat224_utf8_bug.xml new file mode 100644 index 00000000000..d66a8e6b50f --- /dev/null +++ b/Lib/test/xmltestdata/expat224_utf8_bug.xml @@ -0,0 +1,2 @@ + From webhook-mailer at python.org Mon Sep 25 04:49:11 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 25 Sep 2017 08:49:11 -0000 Subject: [Python-checkins] [3.6] bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (GH-3254) (#3743) Message-ID: https://github.com/python/cpython/commit/a6bddb8e4397df30926eb1ade6420a2277174227 commit: a6bddb8e4397df30926eb1ade6420a2277174227 branch: 3.6 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: Serhiy Storchaka date: 2017-09-25T11:49:08+03:00 summary: [3.6] bpo-31311: Fix a SystemError and a crash in ctypes._CData.__setstate__(), in case of a bad __dict__. (GH-3254) (#3743) (cherry picked from commit 57c2561c8c5663aef55b00e3f29cba575ff36ccd) files: A Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst M Lib/ctypes/test/test_parameters.py M Modules/_ctypes/_ctypes.c diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py index 363f58612db..a61f1c7fa76 100644 --- a/Lib/ctypes/test/test_parameters.py +++ b/Lib/ctypes/test/test_parameters.py @@ -1,5 +1,6 @@ import unittest from ctypes.test import need_symbol +import test.support class SimpleTypesTestCase(unittest.TestCase): @@ -170,6 +171,26 @@ def from_param(cls, obj): self.assertRaises(ArgumentError, func, 99) + @test.support.cpython_only + def test_issue31311(self): + # __setstate__ should neither raise a SystemError nor crash in case + # of a bad __dict__. + from ctypes import Structure + + class BadStruct(Structure): + @property + def __dict__(self): + pass + with self.assertRaises(TypeError): + BadStruct().__setstate__({}, b'foo') + + class WorseStruct(Structure): + @property + def __dict__(self): + 1/0 + with self.assertRaises(ZeroDivisionError): + WorseStruct().__setstate__({}, b'foo') + ################################################################ if __name__ == '__main__': diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst b/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst new file mode 100644 index 00000000000..db51cd2d586 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2017-08-31-17-52-56.bpo-31311.bNE2l-.rst @@ -0,0 +1,2 @@ +Fix a crash in the ``__setstate__()`` method of `ctypes._CData`, in case of +a bad ``__dict__``. Patch by Oren Milman. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 1ced6305d3d..27f6dd43449 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -2663,6 +2663,16 @@ PyCData_setstate(PyObject *myself, PyObject *args) len = self->b_size; memmove(self->b_ptr, data, len); mydict = PyObject_GetAttrString(myself, "__dict__"); + if (mydict == NULL) { + return NULL; + } + if (!PyDict_Check(mydict)) { + PyErr_Format(PyExc_TypeError, + "%.200s.__dict__ must be a dictionary, not %.200s", + Py_TYPE(myself)->tp_name, Py_TYPE(mydict)->tp_name); + Py_DECREF(mydict); + return NULL; + } res = PyDict_Update(mydict, dict); Py_DECREF(mydict); if (res == -1) From webhook-mailer at python.org Mon Sep 25 05:00:07 2017 From: webhook-mailer at python.org (Victor Stinner) Date: Mon, 25 Sep 2017 09:00:07 -0000 Subject: [Python-checkins] bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) (#3746) Message-ID: https://github.com/python/cpython/commit/ad051cbce1360ad3055a048506c09bc2a5442474 commit: ad051cbce1360ad3055a048506c09bc2a5442474 branch: 3.6 author: Victor Stinner committer: GitHub date: 2017-09-25T02:00:04-07:00 summary: bpo-31170: Write unit test for Expat 2.2.4 UTF-8 bug (#3570) (#3746) Non-regression tests for the Expat 2.2.3 UTF-8 decoder bug. (cherry picked from commit e6d9fcbb8d0c325e57df08ae8781aafedb71eca2) files: A Lib/test/xmltestdata/expat224_utf8_bug.xml M Lib/test/test_xml_etree.py diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index ad0ffb31aa4..7adfbdfd7a9 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -33,6 +33,7 @@ except UnicodeEncodeError: raise unittest.SkipTest("filename is not encodable to utf8") SIMPLE_NS_XMLFILE = findfile("simple-ns.xml", subdir="xmltestdata") +UTF8_BUG_XMLFILE = findfile("expat224_utf8_bug.xml", subdir="xmltestdata") SAMPLE_XML = """\ @@ -1724,6 +1725,37 @@ def __eq__(self, other): self.assertIsInstance(e[0].tag, str) self.assertEqual(e[0].tag, 'changed') + def check_expat224_utf8_bug(self, text): + xml = b'' % text + root = ET.XML(xml) + self.assertEqual(root.get('b'), text.decode('utf-8')) + + def test_expat224_utf8_bug(self): + # bpo-31170: Expat 2.2.3 had a bug in its UTF-8 decoder. + # Check that Expat 2.2.4 fixed the bug. + # + # Test buffer bounds at odd and even positions. + + text = b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + text = b'x' + b'\xc3\xa0' * 1024 + self.check_expat224_utf8_bug(text) + + def test_expat224_utf8_bug_file(self): + with open(UTF8_BUG_XMLFILE, 'rb') as fp: + raw = fp.read() + root = ET.fromstring(raw) + xmlattr = root.get('b') + + # "Parse" manually the XML file to extract the value of the 'b' + # attribute of the XML element + text = raw.decode('utf-8').strip() + text = text.replace('\r\n', ' ') + text = text[6:-4] + self.assertEqual(root.get('b'), text) + + # -------------------------------------------------------------------- diff --git a/Lib/test/xmltestdata/expat224_utf8_bug.xml b/Lib/test/xmltestdata/expat224_utf8_bug.xml new file mode 100644 index 00000000000..d66a8e6b50f --- /dev/null +++ b/Lib/test/xmltestdata/expat224_utf8_bug.xml @@ -0,0 +1,2 @@ + From webhook-mailer at python.org Mon Sep 25 05:15:57 2017 From: webhook-mailer at python.org (Raymond Hettinger) Date: Mon, 25 Sep 2017 09:15:57 -0000 Subject: [Python-checkins] bpo-26491 Defer DECREFs until enumobject is in a consistent state (#3747) Message-ID: https://github.com/python/cpython/commit/8110dbd470f3daa4de58dda66d360e3c26d3b94f commit: 8110dbd470f3daa4de58dda66d360e3c26d3b94f branch: master author: Raymond Hettinger committer: GitHub date: 2017-09-25T02:15:53-07:00 summary: bpo-26491 Defer DECREFs until enumobject is in a consistent state (#3747) files: M Objects/enumobject.c diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 3eb1736200c..154d901e86d 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -103,6 +103,8 @@ enum_next_long(enumobject *en, PyObject* next_item) PyObject *result = en->en_result; PyObject *next_index; PyObject *stepped_up; + PyObject *old_index; + PyObject *old_item; if (en->en_longindex == NULL) { en->en_longindex = PyLong_FromSsize_t(PY_SSIZE_T_MAX); @@ -118,15 +120,19 @@ enum_next_long(enumobject *en, PyObject* next_item) if (result->ob_refcnt == 1) { Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); - } else { - result = PyTuple_New(2); - if (result == NULL) { - Py_DECREF(next_index); - Py_DECREF(next_item); - return NULL; - } + old_index = PyTuple_GET_ITEM(result, 0); + old_item = PyTuple_GET_ITEM(result, 1); + PyTuple_SET_ITEM(result, 0, next_index); + PyTuple_SET_ITEM(result, 1, next_item); + Py_DECREF(old_index); + Py_DECREF(old_item); + return result; + } + result = PyTuple_New(2); + if (result == NULL) { + Py_DECREF(next_index); + Py_DECREF(next_item); + return NULL; } PyTuple_SET_ITEM(result, 0, next_index); PyTuple_SET_ITEM(result, 1, next_item); @@ -140,6 +146,8 @@ enum_next(enumobject *en) PyObject *next_item; PyObject *result = en->en_result; PyObject *it = en->en_sit; + PyObject *old_index; + PyObject *old_item; next_item = (*Py_TYPE(it)->tp_iternext)(it); if (next_item == NULL) @@ -157,15 +165,19 @@ enum_next(enumobject *en) if (result->ob_refcnt == 1) { Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); - } else { - result = PyTuple_New(2); - if (result == NULL) { - Py_DECREF(next_index); - Py_DECREF(next_item); - return NULL; - } + old_index = PyTuple_GET_ITEM(result, 0); + old_item = PyTuple_GET_ITEM(result, 1); + PyTuple_SET_ITEM(result, 0, next_index); + PyTuple_SET_ITEM(result, 1, next_item); + Py_DECREF(old_index); + Py_DECREF(old_item); + return result; + } + result = PyTuple_New(2); + if (result == NULL) { + Py_DECREF(next_index); + Py_DECREF(next_item); + return NULL; } PyTuple_SET_ITEM(result, 0, next_index); PyTuple_SET_ITEM(result, 1, next_item); From solipsis at pitrou.net Mon Sep 25 05:22:44 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 25 Sep 2017 09:22:44 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170925092243.68133.9632D41446CC7103@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, -7, 1] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogI3qDj8', '--timeout', '7200'] From webhook-mailer at python.org Mon Sep 25 07:41:38 2017 From: webhook-mailer at python.org (Serhiy Storchaka) Date: Mon, 25 Sep 2017 11:41:38 -0000 Subject: [Python-checkins] bpo-25732: Make functools.total_ordering implementing __ne__. (#3748) Message-ID: https://github.com/python/cpython/commit/d94a65a0694a188713f91ba7c9fffded090247dc commit: d94a65a0694a188713f91ba7c9fffded090247dc branch: 2.7 author: Serhiy Storchaka committer: GitHub date: 2017-09-25T14:41:34+03:00 summary: bpo-25732: Make functools.total_ordering implementing __ne__. (#3748) Patch by Raymond Hettinger. files: A Misc/NEWS.d/next/Library/2017-09-25-13-10-08.bpo-25732.RWWgzg.rst M Lib/functools.py M Lib/test/test_functools.py diff --git a/Lib/functools.py b/Lib/functools.py index 53680b89466..5d755d47262 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -55,23 +55,28 @@ def total_ordering(cls): convert = { '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)), ('__le__', lambda self, other: self < other or self == other), + ('__ne__', lambda self, other: not self == other), ('__ge__', lambda self, other: not self < other)], '__le__': [('__ge__', lambda self, other: not self <= other or self == other), ('__lt__', lambda self, other: self <= other and not self == other), + ('__ne__', lambda self, other: not self == other), ('__gt__', lambda self, other: not self <= other)], '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)), ('__ge__', lambda self, other: self > other or self == other), + ('__ne__', lambda self, other: not self == other), ('__le__', lambda self, other: not self > other)], '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other), ('__gt__', lambda self, other: self >= other and not self == other), + ('__ne__', lambda self, other: not self == other), ('__lt__', lambda self, other: not self >= other)] } - roots = set(dir(cls)) & set(convert) + defined_methods = set(dir(cls)) + roots = defined_methods & set(convert) if not roots: raise ValueError('must define at least one ordering operation: < > <= >=') root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__ for opname, opfunc in convert[root]: - if opname not in roots: + if opname not in defined_methods: opfunc.__name__ = opname opfunc.__doc__ = getattr(int, opname).__doc__ setattr(cls, opname, opfunc) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 62d60296bcb..b3372ea7c33 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -600,6 +600,59 @@ def __lt__(self, other): with self.assertRaises(TypeError): TestTO(8) <= () + def test_bug_25732(self): + @functools.total_ordering + class A: + def __init__(self, value): + self.value = value + def __gt__(self, other): + return self.value > other.value + def __eq__(self, other): + return self.value == other.value + self.assertTrue(A(1) != A(2)) + self.assertFalse(A(1) != A(1)) + + @functools.total_ordering + class A(object): + def __init__(self, value): + self.value = value + def __gt__(self, other): + return self.value > other.value + def __eq__(self, other): + return self.value == other.value + self.assertTrue(A(1) != A(2)) + self.assertFalse(A(1) != A(1)) + + @functools.total_ordering + class A: + def __init__(self, value): + self.value = value + def __gt__(self, other): + return self.value > other.value + def __eq__(self, other): + return self.value == other.value + def __ne__(self, other): + raise RuntimeError(self, other) + with self.assertRaises(RuntimeError): + A(1) != A(2) + with self.assertRaises(RuntimeError): + A(1) != A(1) + + @functools.total_ordering + class A(object): + def __init__(self, value): + self.value = value + def __gt__(self, other): + return self.value > other.value + def __eq__(self, other): + return self.value == other.value + def __ne__(self, other): + raise RuntimeError(self, other) + with self.assertRaises(RuntimeError): + A(1) != A(2) + with self.assertRaises(RuntimeError): + A(1) != A(1) + def test_main(verbose=None): test_classes = ( TestPartial, diff --git a/Misc/NEWS.d/next/Library/2017-09-25-13-10-08.bpo-25732.RWWgzg.rst b/Misc/NEWS.d/next/Library/2017-09-25-13-10-08.bpo-25732.RWWgzg.rst new file mode 100644 index 00000000000..1d807b1b5f7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-09-25-13-10-08.bpo-25732.RWWgzg.rst @@ -0,0 +1 @@ +`functools.total_ordering()` now implements the `__ne__` method. From webhook-mailer at python.org Mon Sep 25 12:58:14 2017 From: webhook-mailer at python.org (Paul Moore) Date: Mon, 25 Sep 2017 16:58:14 -0000 Subject: [Python-checkins] bpo-31569: correct PCBuild/ case to PCbuild/ in build scripts and docs (GH-3711) Message-ID: https://github.com/python/cpython/commit/f1502d097c29b266a5748312ee2451a2d6ac0af6 commit: f1502d097c29b266a5748312ee2451a2d6ac0af6 branch: master author: Stefan Gr?nke committer: Paul Moore date: 2017-09-25T17:58:10+01:00 summary: bpo-31569: correct PCBuild/ case to PCbuild/ in build scripts and docs (GH-3711) files: A Misc/NEWS.d/next/Build/2017-09-25-00-25-23.bpo-31569.TS49pM.rst M .github/CODEOWNERS M .github/appveyor.yml M Doc/distutils/builtdist.rst M Doc/library/test.rst M Doc/make.bat M Lib/distutils/sysconfig.py M PC/bdist_wininst/bdist_wininst.vcxproj M PC/bdist_wininst/build.bat M PC/launcher.c M PCbuild/python.props M Tools/freeze/extensions_win32.ini M Tools/msi/README.txt M Tools/msi/build.bat M Tools/msi/buildrelease.bat M Tools/msi/exe/exe.wixproj M Tools/msi/launcher/launcher.wixproj M Tools/msi/msi.props M Tools/msi/testrelease.bat M Tools/msi/uploadrelease.bat M Tools/msi/wix.props M Tools/nuget/build.bat diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 28ca17e7e93..67c03a807d0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -35,7 +35,7 @@ Python/bootstrap_hash.c @python/crypto-team # Windows /PC/ @python/windows-team -/PCBuild/ @python/windows-team +/PCbuild/ @python/windows-team # Windows installer packages /Tools/msi/ @python/windows-team diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 98b32c977d1..b052b28f8aa 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -28,7 +28,7 @@ only_commits: - Modules/ - Objects/ - PC/ - - PCBuild/ + - PCbuild/ - Parser/ - Programs/ - Python/ diff --git a/Doc/distutils/builtdist.rst b/Doc/distutils/builtdist.rst index dc3a50cb032..f523a672340 100644 --- a/Doc/distutils/builtdist.rst +++ b/Doc/distutils/builtdist.rst @@ -368,7 +368,7 @@ Python itself for the platform you are targeting - it is not possible from a binary installation of Python (as the .lib etc file for other platforms are not included.) In practice, this means the user of a 32 bit operating system will need to use Visual Studio 2008 to open the -:file:`PCBuild/PCbuild.sln` solution in the Python source tree and build the +:file:`PCbuild/PCbuild.sln` solution in the Python source tree and build the "x64" configuration of the 'pythoncore' project before cross-compiling extensions is possible. diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 9d4ff7ad8b4..33978e331b6 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -186,7 +186,7 @@ options, run :program:`python -m test -h`. Some other ways to execute the regression tests depend on what platform the tests are being executed on. On Unix, you can run :program:`make test` at the top-level directory where Python was built. On Windows, -executing :program:`rt.bat` from your :file:`PCBuild` directory will run all +executing :program:`rt.bat` from your :file:`PCbuild` directory will run all regression tests. diff --git a/Doc/make.bat b/Doc/make.bat index 6cb315fda40..3f201de1db7 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -5,7 +5,7 @@ pushd %~dp0 set this=%~n0 -call ..\PCBuild\find_python.bat %PYTHON% +call ..\PCbuild\find_python.bat %PYTHON% if not defined SPHINXBUILD if defined PYTHON ( %PYTHON% -c "import sphinx" > nul 2> nul if errorlevel 1 ( diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 2bcd1dd2885..e07a6c8b94e 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -23,7 +23,7 @@ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) # Path to the base directory of the project. On Windows the binary may -# live in project/PCBuild/win32 or project/PCBuild/amd64. +# live in project/PCbuild/win32 or project/PCbuild/amd64. # set for cross builds if "_PYTHON_PROJECT_BASE" in os.environ: project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"]) diff --git a/Misc/NEWS.d/next/Build/2017-09-25-00-25-23.bpo-31569.TS49pM.rst b/Misc/NEWS.d/next/Build/2017-09-25-00-25-23.bpo-31569.TS49pM.rst new file mode 100644 index 00000000000..a6345dbbbdb --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-09-25-00-25-23.bpo-31569.TS49pM.rst @@ -0,0 +1 @@ +Correct PCBuild/ case to PCbuild/ in build scripts and documentation. diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj b/PC/bdist_wininst/bdist_wininst.vcxproj index 9bbfda28ccb..70bfb9c9337 100644 --- a/PC/bdist_wininst/bdist_wininst.vcxproj +++ b/PC/bdist_wininst/bdist_wininst.vcxproj @@ -39,7 +39,7 @@ wininst false - + Application @@ -51,7 +51,7 @@ - + <_ProjectFileVersion>10.0.30319.1 diff --git a/PC/bdist_wininst/build.bat b/PC/bdist_wininst/build.bat index d5cf75206dd..3ce46cfd380 100644 --- a/PC/bdist_wininst/build.bat +++ b/PC/bdist_wininst/build.bat @@ -2,7 +2,7 @@ setlocal set D=%~dp0 -set PCBUILD=%~dp0..\..\PCBuild\ +set PCBUILD=%~dp0..\..\PCbuild\ echo Building Lib\distutils\command\wininst-xx.0.exe diff --git a/PC/launcher.c b/PC/launcher.c index 0733df7563f..d717a7e3419 100644 --- a/PC/launcher.c +++ b/PC/launcher.c @@ -169,11 +169,11 @@ static size_t num_installed_pythons = 0; static wchar_t * location_checks[] = { L"\\", - L"\\PCBuild\\win32\\", - L"\\PCBuild\\amd64\\", + L"\\PCbuild\\win32\\", + L"\\PCbuild\\amd64\\", /* To support early 32bit versions of Python that stuck the build binaries - * directly in PCBuild... */ - L"\\PCBuild\\", + * directly in PCbuild... */ + L"\\PCbuild\\", NULL }; diff --git a/PCbuild/python.props b/PCbuild/python.props index ebb16315e1a..32c12fabdf0 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -32,13 +32,13 @@ $(PySourcePath)\ - $(PySourcePath)PCBuild\win32\ + $(PySourcePath)PCbuild\win32\ $(Py_OutDir)\win32\ - $(PySourcePath)PCBuild\amd64\ + $(PySourcePath)PCbuild\amd64\ $(Py_OutDir)\amd64\ $(BuildPath32) $(BuildPath64) - $(PySourcePath)PCBuild\$(ArchName)\ + $(PySourcePath)PCbuild\$(ArchName)\ $(BuildPath)\ $(BuildPath)instrumented\ @@ -118,11 +118,11 @@ Override the version number when building by specifying OverrideVersion. For example: - PCBuild\build.bat "/p:OverrideVersion=3.5.2a1" + PCbuild\build.bat "/p:OverrideVersion=3.5.2a1" Use the -V option to check your version is valid: - PCBuild\build.bat -V "/p:OverrideVersion=3.5.2a1" + PCbuild\build.bat -V "/p:OverrideVersion=3.5.2a1" PythonVersionNumber: 3.5.2 PythonVersion: 3.5.2a1 PythonVersionHex: 0x030502A1 diff --git a/Tools/freeze/extensions_win32.ini b/Tools/freeze/extensions_win32.ini index d01fd6b9f52..d8f274b1664 100644 --- a/Tools/freeze/extensions_win32.ini +++ b/Tools/freeze/extensions_win32.ini @@ -26,34 +26,34 @@ ; If you need others, add them here [_socket] -dsp=%PYTHONPREFIX%\PCBuild\_socket.dsp +dsp=%PYTHONPREFIX%\PCbuild\_socket.dsp [_sre] -dsp=%PYTHONPREFIX%\PCBuild\_sre.dsp +dsp=%PYTHONPREFIX%\PCbuild\_sre.dsp [unicodedata] -dsp=%PYTHONPREFIX%\PCBuild\unicodedata.dsp +dsp=%PYTHONPREFIX%\PCbuild\unicodedata.dsp [mmap] -dsp=%PYTHONPREFIX%\PCBuild\mmap.dsp +dsp=%PYTHONPREFIX%\PCbuild\mmap.dsp [winsound] -dsp=%PYTHONPREFIX%\PCBuild\winsound.dsp +dsp=%PYTHONPREFIX%\PCbuild\winsound.dsp libs=winmm.lib [parser] -dsp=%PYTHONPREFIX%\PCBuild\parser.dsp +dsp=%PYTHONPREFIX%\PCbuild\parser.dsp [select] -dsp=%PYTHONPREFIX%\PCBuild\select.dsp +dsp=%PYTHONPREFIX%\PCbuild\select.dsp [zlib] -dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp +dsp=%PYTHONPREFIX%\PCbuild\zlib.dsp cl=/I %PYTHONPREFIX%\..\zlib-1.1.4 /D _WINDOWS /D WIN32 libs=%PYTHONPREFIX%\..\zlib-1.1.4\zlib.lib /nodefaultlib:libc [winreg] -dsp=%PYTHONPREFIX%\PCBuild\winreg.dsp +dsp=%PYTHONPREFIX%\PCbuild\winreg.dsp libs=advapi32.lib diff --git a/Tools/msi/README.txt b/Tools/msi/README.txt index 7023b611819..1908f5c3a40 100644 --- a/Tools/msi/README.txt +++ b/Tools/msi/README.txt @@ -64,7 +64,7 @@ Building the Installer Before building the installer, download extra build dependencies using Tools\msi\get_externals.bat. (Note that this is in addition to the -similarly named file in PCBuild.) +similarly named file in PCbuild.) For testing, the installer should be built with the Tools/msi/build.bat script: @@ -72,7 +72,7 @@ script: build.bat [-x86] [-x64] [--doc] [--test-marker] [--pack] This script will build the required configurations of Python and -generate an installer layout in PCBuild/(win32|amd64)/en-us. +generate an installer layout in PCbuild/(win32|amd64)/en-us. Specify -x86 and/or -x64 to build for each platform. If neither is specified, both platforms will be built. Currently, both the debug and diff --git a/Tools/msi/build.bat b/Tools/msi/build.bat index f720ea9a86a..8fa612e9ddc 100644 --- a/Tools/msi/build.bat +++ b/Tools/msi/build.bat @@ -1,7 +1,7 @@ @echo off setlocal set D=%~dp0 -set PCBUILD=%D%..\..\PCBuild\ +set PCBUILD=%D%..\..\PCbuild\ set BUILDX86= set BUILDX64= diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat index 5dc1b57b668..4178981195e 100644 --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -28,7 +28,7 @@ rem {msi} MSI filename core.msi set DOWNLOAD_URL=https://www.python.org/ftp/python/{version}/{arch}{releasename}/{msi} set D=%~dp0 -set PCBUILD=%D%..\..\PCBuild\ +set PCBUILD=%D%..\..\PCbuild\ if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD% set EXTERNALS=%D%..\..\externals\windows-installer\ diff --git a/Tools/msi/exe/exe.wixproj b/Tools/msi/exe/exe.wixproj index 8eaf494c4d4..071501ce6e6 100644 --- a/Tools/msi/exe/exe.wixproj +++ b/Tools/msi/exe/exe.wixproj @@ -45,7 +45,7 @@ - + @@ -58,8 +58,8 @@ @(HostPython) $(HostPython.Remove($(HostPython.IndexOf(';')))) - - + + diff --git a/Tools/msi/launcher/launcher.wixproj b/Tools/msi/launcher/launcher.wixproj index 8935ce88a7d..7ff169029e4 100644 --- a/Tools/msi/launcher/launcher.wixproj +++ b/Tools/msi/launcher/launcher.wixproj @@ -20,16 +20,16 @@ - + - + - + - + diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 2318d484d11..24a90bd8cb1 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -15,7 +15,7 @@ - +